From 59037aef99d01335d64857c9cf697ab34fb7f531 Mon Sep 17 00:00:00 2001
From: yanmorin <yanmorin>
Date: Thu, 16 Nov 2006 04:45:21 +0000
Subject: [PATCH] Fix amd64 issue (std::string::size_type return). Thanks to
 Pierre Pomes

---
 src/audio/tone.cpp    | 21 ++++++++++++---------
 src/config/config.cpp |  2 +-
 src/gui/cli/setup.c   |  9 +++++++++
 src/gui/qt/Url.cpp    | 21 ++++++++++++---------
 src/sipvoiplink.cpp   | 12 +++++++-----
 5 files changed, 41 insertions(+), 24 deletions(-)

diff --git a/src/audio/tone.cpp b/src/audio/tone.cpp
index 3fef567306..9648dc30d2 100644
--- a/src/audio/tone.cpp
+++ b/src/audio/tone.cpp
@@ -1,5 +1,5 @@
-/**
- *  Copyright (C) 2005 Savoir-Faire Linux inc.
+/*
+ *  Copyright (C) 2005, 2006 Savoir-Faire Linux inc.
  *  Author: Yan Morin <yan.morin@savoirfairelinux.com>
  *
  *  Inspired by tonegenerator of 
@@ -20,6 +20,9 @@
  *  along with this program; if not, write to the Free Software
  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
+/*
+ * YM: 2006-11-15: changes unsigned int to std::string::size_type, thanks to Pierre Pomes (AMD64 compilation)
+ */
 #include "tone.h"
 #include <math.h>
 
@@ -43,13 +46,13 @@ Tone::genBuffer(const std::string& definition)
   SFLDataFormat* bufferPos = buffer;
 
   // Number of format sections 
-  unsigned int posStart = 0; // position of precedent comma
-  unsigned int posEnd = 0; // position of the next comma
+  std::string::size_type posStart = 0; // position of precedent comma
+  std::string::size_type posEnd = 0; // position of the next comma
 
   std::string s; // portion of frequency
   int count; // number of int for one sequence
 
-  unsigned int deflen = definition.length();
+  std::string::size_type deflen = definition.length();
   do {
     posEnd = definition.find(',', posStart);
     if (posEnd == std::string::npos) {
@@ -62,10 +65,10 @@ Tone::genBuffer(const std::string& definition)
       s = definition.substr(posStart, posEnd-posStart);
 
       // The 1st frequency is before the first + or the /
-      unsigned int pos_plus = s.find('+');
-      unsigned int pos_slash = s.find('/');
-      unsigned int len = s.length();
-      unsigned int endfrequency = 0;
+      std::string::size_type pos_plus = s.find('+');
+      std::string::size_type pos_slash = s.find('/');
+      std::string::size_type len = s.length();
+      std::string::size_type endfrequency = 0;
 
       if ( pos_slash == std::string::npos ) {
         time = 0;
diff --git a/src/config/config.cpp b/src/config/config.cpp
index 76aa490fc9..8f307be010 100644
--- a/src/config/config.cpp
+++ b/src/config/config.cpp
@@ -219,7 +219,7 @@ ConfigTree::populateFromFile(const std::string& fileName) {
   std::string section("");
   std::string key("");
   std::string val("");
-  int pos;
+  std::string::size_type pos;
 
   while (!file.eof()) {
     // Read the file line by line
diff --git a/src/gui/cli/setup.c b/src/gui/cli/setup.c
index 7f73855d1c..6474afe17f 100644
--- a/src/gui/cli/setup.c
+++ b/src/gui/cli/setup.c
@@ -1,5 +1,14 @@
+/*
+ * Author: Jerome Oufella <jerome.oufella@savoirfairelinux.com>
+ * Author: Yan Morin <yan.morin@savoirfairelinux.com>
+ */
+/*
+ * 2006-11-15: add <string.h> declaration, thanks to Pierre Pomes (AMD64 compilation)
+ */
+
 #include "config.h"
 #include <stdio.h>
+#include <string.h>
 #include <stdlib.h>
 #include "display.h"
 #include "setup.h"
diff --git a/src/gui/qt/Url.cpp b/src/gui/qt/Url.cpp
index ac3549f830..6ff1b982c7 100644
--- a/src/gui/qt/Url.cpp
+++ b/src/gui/qt/Url.cpp
@@ -1,8 +1,9 @@
-/**
- *  Copyright (C) 2004-2005 Savoir-Faire Linux inc.
+/*
+ *  Copyright (C) 2004, 2005, 2006 Savoir-Faire Linux inc.
  *  Author: Jean-Philippe Barrette-LaPierre
  *             <jean-philippe.barrette-lapierre@savoirfairelinux.com>
- *                                                                              
+ *  Author: Yan Morin <yan.morin@savoirfairelinux.com>
+ *                                                                               
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
  *  the Free Software Foundation; either version 2 of the License, or
@@ -17,7 +18,10 @@
  *  along with this program; if not, write to the Free Software
  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-
+/*
+ * YM: 2006-11-15: fix type for QString.length(), return a uint
+ * YM: 2006-11-15: commentunused variable
+ */
 #include <string>
 #include <qurl.h>
 
@@ -36,15 +40,14 @@ static uchar hex_to_int( uchar c )
 
 void Url::decode( QString& url )
 {
-    int oldlen = url.length();
+    uint oldlen = url.length();
     if ( !oldlen )
         return;
 
-    int newlen = 0;
-
+//    uint newlen = 0;
     std::string newUrl;
 
-    int i = 0;
+    uint i = 0;
     while ( i < oldlen ) {
         ushort c = url[ i++ ].unicode();
         if ( c == '%' ) {
@@ -55,7 +58,7 @@ void Url::decode( QString& url )
 	  c = ' ';
 	}
         newUrl += c;
-	newlen++;
+//	newlen++;
     }
 
     url = QString::fromUtf8(newUrl.c_str());
diff --git a/src/sipvoiplink.cpp b/src/sipvoiplink.cpp
index 1ab7ccce2f..81ec22db8d 100644
--- a/src/sipvoiplink.cpp
+++ b/src/sipvoiplink.cpp
@@ -17,6 +17,9 @@
  *  along with this program; if not, write to the Free Software
  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
+/*
+ * YM: 2006-11-15: changes unsigned int to std::string::size_type, thanks to Pierre Pomes (AMD64 compilation)
+ */
 #include "sipvoiplink.h"
 #include "eventthread.h"
 #include "sipcall.h"
@@ -1359,9 +1362,6 @@ SIPVoIPLink::SIPMessageNew(eXosip_event_t *event)
   else if (MSG_IS_NOTIFY(event->request)){
     _debug("  > NOTIFY Voice message\n");
     int ii;
-    unsigned int pos;
-    unsigned int pos_slash;
-
     osip_body_t *body = NULL;
     // Get the message body
     ii = osip_message_get_body(event->request, 0, &body);
@@ -1375,6 +1375,8 @@ SIPVoIPLink::SIPMessageNew(eXosip_event_t *event)
        return;
     }
     std::string str(body->body);
+    std::string::size_type pos;
+    std::string::size_type pos_slash;
     pos = str.find(VOICE_MSG);
 
     if (pos == std::string::npos) {
@@ -1496,8 +1498,8 @@ SIPVoIPLink::handleDtmfRelay(eXosip_event_t* event) {
   if (0 == osip_message_get_body(event->request, 0, &body) && body->body != 0 )   {
     _debug("* SIP Info: Text body: %s\n", body->body);
     std::string dtmfBody(body->body);
-    unsigned int posStart = 0;
-    unsigned int posEnd = 0;
+    std::string::size_type posStart = 0;
+    std::string::size_type posEnd = 0;
     std::string signal;
     std::string duration;
     // search for signal=and duration=
-- 
GitLab