[mapguide-commits] r8700 - in trunk/MgDev: . Common/Stylization

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Thu Jul 9 05:08:55 PDT 2015


Author: jng
Date: 2015-07-09 05:08:55 -0700 (Thu, 09 Jul 2015)
New Revision: 8700

Modified:
   trunk/MgDev/
   trunk/MgDev/Common/Stylization/KeyEncode.cpp
Log:
Merged revision(s) 8694-8695 from sandbox/adsk/3.0m:
#2562, Linux: Select feature doesn't work when type of key column is string.

In Linux, when the key column of a feature class is string type, select feature on this layer doesn't work. The feature is not highlighted, the selection panel is empty either. 
I found that the API SelectFeatures works well. The value of the key column is correct. But after encoding it to base64 string, it becomes 'AAAA', which means an empty string. So the error is in encoding key. 
wchar is UTF32 in Linux, while it is UTF16 in Windows. In Linux, we will first convert the wide string to UTF16, then convert the UTF16 string to UTF8. Something is wrong during the 2 conversions. Now I change it to use UTF32toUTF8 directly. The result is correct after the change.
 
........
#2562, Linux: Select feature doesn't work when type of key column is string.

Select feature doesn't work again when connecting to Oracle. The type of key column is NUMBER(10). And the FDO data type of the column is double. The odd thing is that it works well with my local build version, but don't work in AIMS official build. After investigation, I found the issue is in KeyEncode::WriteDouble(). The WriteDouble function of KeyEncode is like below:
void KeyEncode::WriteDouble(double d)
{
    FdoInt64 swap = *(FdoInt64*)&d;
    WriteInt64(swap);
}
The code  FdoInt64 swap = *(FdoInt64*)&d; is optimized by gcc. It works after I added the volatile keyword.
........



Property changes on: trunk/MgDev
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/2.4/MgDev:6749-6756,6777-6783,6785-6787,6789,6791-6794,6796-6801,6954-6962,6986-7006
/branches/2.6/MgDev:8276-8286,8288-8292,8297,8299,8301,8303,8314-8315,8318,8335,8340,8354-8355,8365,8373
/sandbox/adsk/3.0m:8563,8584,8607,8625
/sandbox/jng/convenience_apis:8262-8268,8271-8363
/sandbox/jng/createruntimemap:7486-7555
/sandbox/jng/dwftk:8321-8324,8328-8329,8331,8352
/sandbox/jng/geos34x:8256-8259
/sandbox/jng/tiling:8174-8208
/sandbox/jng/v30:8212-8227
/sandbox/rfc94:5099-5163
   + /branches/2.4/MgDev:6749-6756,6777-6783,6785-6787,6789,6791-6794,6796-6801,6954-6962,6986-7006
/branches/2.6/MgDev:8276-8286,8288-8292,8297,8299,8301,8303,8314-8315,8318,8335,8340,8354-8355,8365,8373
/sandbox/adsk/3.0m:8563,8584,8607,8625,8694-8695
/sandbox/jng/convenience_apis:8262-8268,8271-8363
/sandbox/jng/createruntimemap:7486-7555
/sandbox/jng/dwftk:8321-8324,8328-8329,8331,8352
/sandbox/jng/geos34x:8256-8259
/sandbox/jng/tiling:8174-8208
/sandbox/jng/v30:8212-8227
/sandbox/rfc94:5099-5163

Modified: trunk/MgDev/Common/Stylization/KeyEncode.cpp
===================================================================
--- trunk/MgDev/Common/Stylization/KeyEncode.cpp	2015-07-09 11:53:55 UTC (rev 8699)
+++ trunk/MgDev/Common/Stylization/KeyEncode.cpp	2015-07-09 12:08:55 UTC (rev 8700)
@@ -143,7 +143,7 @@
 
 void KeyEncode::WriteDouble(double d)
 {
-    FdoInt64 swap = *(FdoInt64*)&d;
+    FdoInt64 swap = *(FdoInt64 volatile*)&d;
     WriteInt64(swap);
 }
 
@@ -199,8 +199,12 @@
 void KeyEncode::WriteString(const wchar_t* src)
 {
     std::string sutf8;
+    #ifdef _WIN32
     const XMLCh* srcX = W2X(src);
     UnicodeString::UTF16toUTF8(srcX, sutf8);
+    #else
+    UnicodeString::UTF32toUTF8((const LCh*)src, sutf8);
+    #endif
     size_t nUsed = sutf8.length();
     WriteBytes((unsigned char*)sutf8.c_str(), nUsed+1);
 }



More information about the mapguide-commits mailing list