From 9be75f010b3e37caf04d79ede962676731c6ded9 Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
Date: Thu, 3 Oct 2013 22:52:00 +0200
Subject: Import gcc2 compatibility fixes.


diff --git a/libs/libgloox/connectionbosh.cpp b/libs/libgloox/connectionbosh.cpp
index f0a1124..c433564 100644
--- a/libs/libgloox/connectionbosh.cpp
+++ b/libs/libgloox/connectionbosh.cpp
@@ -303,7 +303,7 @@ namespace gloox
 
   bool ci_equal( char ch1, char ch2 )
   {
-    return std::toupper( (unsigned char)ch1 ) == std::toupper( (unsigned char)ch2 );
+    return toupper( (unsigned char)ch1 ) == toupper( (unsigned char)ch2 );
   }
 
   std::string::size_type ci_find( const std::string& str1, const std::string& str2 )
diff --git a/libs/libgloox/gloox.h b/libs/libgloox/gloox.h
index b86462e..8186d20 100644
--- a/libs/libgloox/gloox.h
+++ b/libs/libgloox/gloox.h
@@ -1214,7 +1214,7 @@ namespace gloox
   /**
    * A multimap of strings.
    */
-  typedef std::multimap<std::string, std::string> StringMultiMap;
+  typedef std::multimap<const std::string, const std::string> StringMultiMap;
 
   class StanzaExtension;
   /**
diff --git a/libs/libgloox/parser.cpp b/libs/libgloox/parser.cpp
index a72fbdc..5884624 100644
--- a/libs/libgloox/parser.cpp
+++ b/libs/libgloox/parser.cpp
@@ -141,7 +141,7 @@ namespace gloox
   {
     if( pos + needle.length() <= data.length() )
     {
-      if( !data.compare( pos, needle.length(), needle ) )
+      if( !data.compare(pos, needle.length(), needle ) )
       {
         pos += needle.length() - 1;
         return ForwardFound;
diff --git a/libs/libgloox/siprofileft.cpp b/libs/libgloox/siprofileft.cpp
index 4836efd..aeafac4 100644
--- a/libs/libgloox/siprofileft.cpp
+++ b/libs/libgloox/siprofileft.cpp
@@ -84,11 +84,11 @@ namespace gloox
     DataFormField* dff = df.addField( DataFormField::TypeListSingle, "stream-method" );
     StringMultiMap sm;
     if( streamTypes & FTTypeS5B )
-      sm.insert( std::make_pair( "s5b", XMLNS_BYTESTREAMS ) );
+      sm.insert( std::make_pair<const char*, std::string>( "s5b", XMLNS_BYTESTREAMS ) );
     if( streamTypes & FTTypeIBB )
-      sm.insert( std::make_pair( "ibb", XMLNS_IBB ) );
+      sm.insert( std::make_pair<const char*, std::string>( "ibb", XMLNS_IBB ) );
     if( streamTypes & FTTypeOOB )
-      sm.insert( std::make_pair( "oob", XMLNS_IQ_OOB ) );
+      sm.insert( std::make_pair<const char*, std::string>( "oob", XMLNS_IQ_OOB ) );
     dff->setOptions( sm );
     feature->addChild( df.tag() );
 
diff --git a/libs/libmsn/Jamfile b/libs/libmsn/Jamfile
index ec7bd45..02a1dc4 100644
--- a/libs/libmsn/Jamfile
+++ b/libs/libmsn/Jamfile
@@ -2,6 +2,7 @@ SubDir TOP libs libmsn ;
 
 SubDirSysHdrs [ FDirName $(TOP) ] ;
 SubDirSysHdrs [ FDirName $(TOP) libs ] ;
+SubDirSysHdrs [ FDirName $(TOP) libs libmsn ] ;
 
 SubDirSysHdrs [ FDirName $(OPENSSL_INCLUDE_DIR) ] ;
 
diff --git a/libs/libmsn/connection.h b/libs/libmsn/connection.h
index c469460..c92539b 100644
--- a/libs/libmsn/connection.h
+++ b/libs/libmsn/connection.h
@@ -29,6 +29,7 @@
 #include <vector>
 #include <map>
 #include <stdexcept>
+#include <sstream>
 
 #ifdef _MSC_VER
 #pragma warning( disable : 4290 )
diff --git a/libs/libmsn/message.cpp b/libs/libmsn/message.cpp
index aedf463..26eebd0 100644
--- a/libs/libmsn/message.cpp
+++ b/libs/libmsn/message.cpp
@@ -124,7 +124,7 @@ namespace MSN
     {
         std::string color = this->getFormatInfo()["CO"];
         assert(color.size() <= 6 && color.size() >= 0);
-        color.insert(0U, 6 - color.size(), '0');
+        color.insert((size_t)0, (size_t)(6 - color.size()), '0');
         int r = 0, g = 0, b = 0;
         
         b = strtol(color.substr(0, 2).c_str(), NULL, 16);
@@ -167,7 +167,7 @@ namespace MSN
     
     void Message::setColor(std::string color)
     {
-        color.insert(0U, 6 - color.size(), '0');
+        color.insert((size_t)0, (size_t)(6 - color.size()), '0');
         int r = 0, g = 0, b = 0;
         
         r = strtol(color.substr(0, 2).c_str(), NULL, 16);
diff --git a/libs/libmsn/msnobject.cpp b/libs/libmsn/msnobject.cpp
index 4a83221..8192c3a 100644
--- a/libs/libmsn/msnobject.cpp
+++ b/libs/libmsn/msnobject.cpp
@@ -30,7 +30,7 @@ namespace MSN
 {
     void MSNObject::addMSNObject(std::string filename, int Type)
     {
-        std::ifstream::pos_type size;
+        std::streampos size;
         char * memblock;
         SHA_CTX  ctx;
         unsigned char digest[SHA_DIGEST_LENGTH];
diff --git a/libs/libmsn/util.cpp b/libs/libmsn/util.cpp
index b2f843f..5e73f54 100644
--- a/libs/libmsn/util.cpp
+++ b/libs/libmsn/util.cpp
@@ -146,8 +146,8 @@ namespace MSN
              it1 != s1.end() && it2 != s2.end();
              ++it1, ++it2)
         { 
-            if (std::toupper(*it1) != std::toupper(*it2)) 
-                return std::toupper(*it1) - std::toupper(*it2);
+            if (toupper(*it1) != toupper(*it2)) 
+                return toupper(*it1) - toupper(*it2);
         }
         size_t size1 = s1.size(), size2 = s2.size(); 
         return (int) (size1 - size2);
@@ -358,11 +358,11 @@ namespace MSN
     int FileSize(const char* sFileName)
     {
         std::ifstream f;
-        f.open(sFileName, std::ios_base::binary | std::ios_base::in);
+        f.open(sFileName, std::ios::binary | std::ios::in);
         if (!f.good() || f.eof() || !f.is_open()) { return 0; }
-        f.seekg(0, std::ios_base::beg);
-        std::ifstream::pos_type begin_pos = f.tellg();
-        f.seekg(0, std::ios_base::end);
+        f.seekg(0, std::ios::beg);
+        std::streampos begin_pos = f.tellg();
+        f.seekg(0, std::ios::end);
         return static_cast<int>(f.tellg() - begin_pos);
     }
 
diff --git a/libs/libyahoo2/yahoo_httplib.c b/libs/libyahoo2/yahoo_httplib.c
index 049f6e7..d2f6a53 100755
--- a/libs/libyahoo2/yahoo_httplib.c
+++ b/libs/libyahoo2/yahoo_httplib.c
@@ -29,19 +29,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 
-#if STDC_HEADERS
 # include <string.h>
-#else
-# if !HAVE_STRCHR
-#  define strchr index
-#  define strrchr rindex
-# endif
-char *strchr(), *strrchr();
-# if !HAVE_MEMCPY
-#  define memcpy(d, s, n) bcopy ((s), (d), (n))
-#  define memmove(d, s, n) bcopy ((s), (d), (n))
-# endif
-#endif
 
 #include <errno.h>
 #if HAVE_UNISTD_H
@@ -374,7 +362,6 @@ void yahoo_http_get(int id, const char *url, const char *cookies, int http11,
 void yahoo_http_head(int id, const char *url, const char *cookies, int len,
 	char *payload, yahoo_get_fd_callback callback, void *data)
 {
-	printf("yahoo_http_read\n");
 	char host[255];
 	int port = 80;
 	char path[255];
diff --git a/protocols/msn/MSN.cpp b/protocols/msn/MSN.cpp
index 087b949..e987c27 100644
--- a/protocols/msn/MSN.cpp
+++ b/protocols/msn/MSN.cpp
@@ -52,7 +52,7 @@ const char* kProtocolName = "MSN Protocol";
 const uint32 kAvatarCheckMessage = 'AVMs';
 
 struct pollfd* kPollSockets = NULL;
-struct ssl {
+struct Ssl {
 	bool isSSL;
 	bool isConnected;
 	SSL *ssl;
@@ -718,7 +718,7 @@ void MSNP::registerSocket(void *s, int reading, int writing, bool isSSL)
 			return;
 		}
 
-		kSocketsSsl = (struct ssl*) realloc(kSocketsSsl, (kSocketsAvailable + 10) * sizeof(struct ssl));
+		kSocketsSsl = (struct Ssl*) realloc(kSocketsSsl, (kSocketsAvailable + 10) * sizeof(struct Ssl));
 		if (kSocketsSsl == NULL) {
 			Error("Memory Error!!\n", NULL);
 			return;
diff --git a/protocols/xmpp/Jamfile b/protocols/xmpp/Jamfile
index 34351ec..3848ff7 100644
--- a/protocols/xmpp/Jamfile
+++ b/protocols/xmpp/Jamfile
@@ -2,6 +2,7 @@ SubDir TOP protocols xmpp ;
 
 SubDirSysHdrs [ FDirName $(TOP) ] ;
 SubDirSysHdrs [ FDirName $(TOP) libs ] ;
+SubDirSysHdrs [ FDirName $(TOP) libs libgloox ] ;
 SubDirSysHdrs [ FDirName $(OPENSSL_INCLUDE_DIR) ] ;
 SubDirSysHdrs [ FDirName $(CAYA_INCLUDE_DIR) ] ;
 
-- 
1.8.3.4


From 26bcbc64e44c24a09085fa6d4d86bf05e2213035 Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
Date: Sat, 5 Oct 2013 14:01:13 +0200
Subject: Fixes for directory moves in PM-Haiku


diff --git a/build/jam/CheckRules b/build/jam/CheckRules
index ac2e326..334eee2 100644
--- a/build/jam/CheckRules
+++ b/build/jam/CheckRules
@@ -14,7 +14,7 @@ rule CheckGccPlatform
 		# /boot/develop/lib/x86 to judge whether this is a BeOS compatible and thus
 		# gcc 2 platform. This is not entirely correct, but should be good enough
 		# for the time being.
-		local haveLibStdC++.R4 = [ Glob /boot/develop/lib/x86 : libstdc++.r4.so ] ;
+		local haveLibStdC++.R4 = [ Glob /boot/system/develop/tools/lib : libstdc++.r4.so ] ;
 		if ! $(haveLibStdC++.R4) {
 			IS_GCC4_PLATFORM = 1 ;
 			Echo Using GCC4 platform ;
diff --git a/configure b/configure
index 6879cee..55a6251 100755
--- a/configure
+++ b/configure
@@ -122,22 +122,21 @@ MIMESET = ${mimesetbin} ;
 SETVERSION = ${setversionbin} ;
 COPYATTR = ${copyattrbin} ;
 
-COMMON_DIRECTORY = $(finddir B_COMMON_DIRECTORY) ;
-COMMON_BIN_DIRECTORY = $(finddir B_COMMON_BIN_DIRECTORY) ;
-COMMON_INCLUDE_DIRECTORY = $(finddir B_COMMON_DIRECTORY)/include ;
-COMMON_LIB_DIRECTORY = $(finddir B_COMMON_LIB_DIRECTORY) ;
-COMMON_SERVERS_DIRECTORY = $(finddir B_COMMON_SERVERS_DIRECTORY) ;
-COMMON_ADDONS_DIRECTORY = $(finddir B_COMMON_ADDONS_DIRECTORY) ;
-COMMON_DEVELOP_DIRECTORY = $(finddir B_COMMON_DEVELOP_DIRECTORY) ;
+COMMON_BIN_DIRECTORY = $binDir ;
+COMMON_INCLUDE_DIRECTORY = $(finddir B_SYSTEM_HEADERS_DIRECTORY) ;
+COMMON_LIB_DIRECTORY = $libDir ;
+COMMON_SERVERS_DIRECTORY = $(finddir B_SYSTEM_SERVERS_DIRECTORY) ;
+COMMON_ADDONS_DIRECTORY = $(finddir B_SYSTEM_ADDONS_DIRECTORY) ;
+COMMON_DEVELOP_DIRECTORY = $(finddir B_SYSTEM_DEVELOP_DIRECTORY) ;
 USER_CONFIG_DIRECTORY = $(finddir B_USER_CONFIG_DIRECTORY) ;
-USER_INCLUDE_DIRECTORY = $(finddir B_USER_CONFIG_DIRECTORY)/include ;
+USER_INCLUDE_DIRECTORY = $includeDir ;
 SYSTEM_DIRECTORY = $(finddir B_SYSTEM_DIRECTORY) ;
-SYSTEM_LIB_DIRECTORY = $(finddir B_SYSTEM_LIB_DIRECTORY) ;
+SYSTEM_LIB_DIRECTORY = $libDir ;
 BEOS_PREFERENCES_DIRECTORY = $(finddir B_BEOS_PREFERENCES_DIRECTORY) ;
 PREFERENCES_DIRECTORY = $(finddir B_PREFERENCES_DIRECTORY) ;
 USER_PREFERENCES_DIRECTORY = $(finddir B_USER_CONFIG_DIRECTORY)/be/Preferences ;
-APPS_DIRECTORY = $(finddir B_APPS_DIRECTORY) ;
-CAYA_DIRECTORY = $(finddir B_APPS_DIRECTORY)/Caya ;
+APPS_DIRECTORY = $appsDir ;
+CAYA_DIRECTORY = $appsDir/Caya ;
 
 DEFINES += ${defines} ;
 EOF
-- 
1.8.3.4


From 31ebae4d014682f95d0e1cc0d0ec6444619d59f2 Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
Date: Sat, 5 Oct 2013 14:12:42 +0200
Subject: Use BeOS broken prototype for string::compare

 * Our C++ lib has the args in the wrong order

diff --git a/libs/libgloox/parser.cpp b/libs/libgloox/parser.cpp
index 5884624..5a406d2 100644
--- a/libs/libgloox/parser.cpp
+++ b/libs/libgloox/parser.cpp
@@ -141,7 +141,7 @@ namespace gloox
   {
     if( pos + needle.length() <= data.length() )
     {
-      if( !data.compare(pos, needle.length(), needle ) )
+      if( !data.compare(needle, pos, needle.length()) )
       {
         pos += needle.length() - 1;
         return ForwardFound;
-- 
1.8.3.4


From 53370d0138ccb68d6fb4eb7b06ae1493fab140b7 Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
Date: Sat, 5 Oct 2013 14:31:20 +0200
Subject: Fix lib directory so configure script finds OpenSSL


diff --git a/configure b/configure
index 55a6251..ca177ba 100755
--- a/configure
+++ b/configure
@@ -124,7 +124,7 @@ COPYATTR = ${copyattrbin} ;
 
 COMMON_BIN_DIRECTORY = $binDir ;
 COMMON_INCLUDE_DIRECTORY = $(finddir B_SYSTEM_HEADERS_DIRECTORY) ;
-COMMON_LIB_DIRECTORY = $libDir ;
+COMMON_LIB_DIRECTORY = $(finddir B_SYSTEM_DEVELOP_DIRECTORY)/lib ;
 COMMON_SERVERS_DIRECTORY = $(finddir B_SYSTEM_SERVERS_DIRECTORY) ;
 COMMON_ADDONS_DIRECTORY = $(finddir B_SYSTEM_ADDONS_DIRECTORY) ;
 COMMON_DEVELOP_DIRECTORY = $(finddir B_SYSTEM_DEVELOP_DIRECTORY) ;
-- 
1.8.3.4

