DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=14402>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=14402

Bug fix for scandinavian letters in volume name

           Summary: Bug fix for scandinavian letters in volume name
           Product: Xerces-C++
           Version: 1.6.0
          Platform: Macintosh
        OS/Version: MacOS 9
            Status: NEW
          Severity: Major
          Priority: Other
         Component: Utilities
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


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;
    }

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to