[ http://nagoya.apache.org/jira/browse/XERCESC-709?page=history ]
Alberto Massari updated XERCESC-709: ------------------------------------ Priority: Major > Bug fix for scandinavian letters in volume name > ----------------------------------------------- > > Key: XERCESC-709 > URL: http://nagoya.apache.org/jira/browse/XERCESC-709 > Project: Xerces-C++ > Type: Bug > Components: Utilities > Versions: 1.6.0 > Environment: Operating System: MacOS 9 > Platform: Macintosh > Reporter: Niclas Hedell > Assignee: Xerces-C Developers Mailing List > > The function XMLParsePathToFSRef_Classic in the file MacOSPlatformUtils.cpp > doesn't recognize scandinavian letters in volume names. This is a bug fix: > void QuickAndDirtySetASCII_C_CharsFromUnicodeText(char **text, UniCharArrayPtr > ucap, UniCharCount ucc); > void QuickAndDirtySetASCII_C_CharsFromUnicodeText(char **text, UniCharArrayPtr > ucap, UniCharCount ucc) > { > ByteCount ail, aol, bigLength = 2 * ucc; > Ptr buffer = NewPtr(bigLength); > TECObjectRef ec; > OSStatus status = TECCreateConverter(&ec, kTextEncodingUnicodeDefault, > kTextEncodingMacRoman); > if (status != noErr) DebugStr("\p TECCreateConverter failed"); > status = TECConvertText(ec, (ConstTextPtr)ucap, bigLength, &ail, > (TextPtr)buffer, bigLength, &aol); > if (status != noErr) DebugStr("\p TECConvertText failed"); > status = TECDisposeConverter(ec); > if (status != noErr) DebugStr("\p TECDisposeConverter failed"); > *text = (char *)NewPtr(aol); > BlockMove(buffer, (*text), aol); > DisposePtr(buffer); > } > bool > XMLParsePathToFSRef_Classic(const XMLCh* const pathName, FSRef& ref) > { > // Parse Path to FSRef by stepping manually through path components. > > // Path's parsed in this way must always begin with a volume name. > // This assumption would fail for standard unix paths under Mac OS X, > // so for those cases we use the routine XMLParsePathToFSRef_Carbon > // above. > > const XMLCh* p = pathName; > const XMLCh* pEnd; > std::size_t segLen; > > const std::size_t kXMLBufCount = 256; > XMLCh xmlBuf[kXMLBufCount]; > OSErr err = noErr; > > > if (*p == L'/') > { > // Absolute name: grab the first component as volume name > > // Find the end of the path segment > for (pEnd = ++p; *pEnd && *pEnd != L'/'; ++pEnd) ; > segLen = pEnd - p; > > // Try to find a volume that matches this name > for (ItemCount volIndex = 1; err == noErr; ++volIndex) > { > HFSUniStr255 hfsStr; > hfsStr.length = 0; > > // Get the volume name > err = FSGetVolumeInfo( > 0, > volIndex, > static_cast<FSVolumeRefNum*>(NULL), > 0, > static_cast<FSVolumeInfo*>(NULL), > &hfsStr, > &ref > ); > > if (err == noErr) { > > // Compare against our path segment > if (segLen == hfsStr.length) > { > // Case-insensitive compare > if (XMLString::compareNIString( > > ConvertSlashToColon( > > CopyUniCharsToXMLChs(hfsStr.unicode, xmlBuf, segLen, kXMLBufCount), > > segLen), > p, > segLen) == 0) > break; // we found our volume > } > > // Bug fix for scandinavian letters in volume name ******* > Str255 volname; > ParamBlockRec pb; > char **ctext = NULL; > > QuickAndDirtySetASCII_C_CharsFromUnicodeText(ctext, > (UniCharArrayPtr)p, segLen); > > pb.volumeParam.ioVolIndex = (short)volIndex; > pb.volumeParam.ioNamePtr = volname; > OSErr reply = PBGetVInfo(&pb, false); > > if (reply == noErr) > { > if (IUMagString(volname+1, *ctext, volname[0], > segLen) == > 0) { > break; // we found our volume > } > } > // End bug fix ******* > } > } > > p = pEnd; > } -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://nagoya.apache.org/jira/secure/Administrators.jspa - If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]