[mapguide-trac] #1118: Alias with unicode path can't work

MapGuide Open Source trac_mapguide at osgeo.org
Thu Oct 15 05:24:24 EDT 2009


#1118: Alias with unicode path can't work
--------------------------+-------------------------------------------------
 Reporter:  christinebao  |         Owner:  Christine Bao
     Type:  defect        |        Status:  new          
 Priority:  medium        |     Milestone:  2.2          
Component:  General       |       Version:  2.0.2        
 Severity:  major         |    Resolution:               
 Keywords:                |   External_id:  1262444      
--------------------------+-------------------------------------------------
Comment (by christinebao):

 Tech diagnosis:[[BR]]
 The defect happens in UnmanagedDataManager.cpp, [[BR]]

 {{{
 int MgUnmanagedDataManager::SubstituteDataPathAliases(string& doc)
 {
     //some code
                     STRING mappingDir = stringProp->GetValue();

                     // replace the mappingName with the actual directory
                     if (!MgFileUtil::EndsWithSlash(mappingDir))
                         MgFileUtil::AppendSlashToEndOfPath(mappingDir);

                     size_t dirLen = mappingDir.length();

                     doc.replace(startPos, len1 + nameLen + len2,
 MgUtil::WideCharToMultiByte(mappingDir), 0, dirLen);
     //some code
 }
 }}}


 mappingDir is STRING type, which stands for std::wstring. However doc
 stands for string and composited by char. So use the size of mappingDir to
 replace the content in doc causing path to be cut off.

 To fix this, mappingDir should be converted to string type first and then
 replace the content in doc.

-- 
Ticket URL: <https://trac.osgeo.org/mapguide/ticket/1118#comment:1>
MapGuide Open Source <http://mapguide.osgeo.org/>
MapGuide Open Source Internals


More information about the mapguide-trac mailing list