Date: Thursday, December 22, 2005 @ 14:09:32
  Author: marc
    Path: /cvsroot/carob/carob/src

Modified: JavaSocket.cpp (1.23 -> 1.24)

Added (still disabled) code to be compatible with SEQUOIA-133 (standard UTF8).


----------------+
 JavaSocket.cpp |   17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)


Index: carob/src/JavaSocket.cpp
diff -u carob/src/JavaSocket.cpp:1.23 carob/src/JavaSocket.cpp:1.24
--- carob/src/JavaSocket.cpp:1.23       Mon Dec 19 16:11:14 2005
+++ carob/src/JavaSocket.cpp    Thu Dec 22 14:09:32 2005
@@ -180,6 +180,7 @@
   return true;
 }
 
+#define MODIFIED_UTF8   1
 
 // Localization (Chapter 22) in
 // /usr/share/doc/gcc-4.0-base/libstdc++/html/documentation.html
@@ -193,8 +194,12 @@
 
   std::string utf8str(toUTF8(str));
 
-  // FIXME: move netlen to uint32_t once SEQUOIA-133 is complete
+  // FIXME: move netlen to int32_t once SEQUOIA-133 is complete
+#if MODIFIED_UTF8
   uint16_t netlen = htons(utf8str.length());
+#else
+  int32_t netlen = htonl(utf8str.length());
+#endif
 
   //First write number of bytes to follow as 
   if (sendToSocket(fctName, L"UTF string", &netlen, sizeof(netlen), 
MSG_NOSIGNAL))
@@ -212,16 +217,24 @@
 {
   wstring fctName(L"JavaSocket::readJavaUTF");
   
-  // FIXME: move lenRecNet to uint32_t once SEQUOIA-133 is complete
+  // FIXME: move lenRecNet to int32_t once SEQUOIA-133 is complete
   //the size read on the network
+#if MODIFIED_UTF8
   uint16_t lenRecNet;
+#else
+  int32_t lenRecNet;
+#endif
   //the converted size
   uint16_t lenRec;
   size_t sizeRead = 0;
   //First get size
   if (receiveFromSocket(fctName, L"UTF string size", &lenRecNet, 
sizeof(lenRecNet), 0))
   {
+#if MODIFIED_UTF8
     lenRec = ntohs(lenRecNet); // number of bytes to come
+#else
+    lenRec = ntohl(lenRecNet); // number of bytes to come
+#endif
 
     uint8_t* utfStr = new uint8_t[lenRec];
     if (receiveFromSocket(fctName, L"UTF string", utfStr, lenRec, 0))

_______________________________________________
Carob-commits mailing list
[email protected]
https://forge.continuent.org/mailman/listinfo/carob-commits

Reply via email to