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=9533>.
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=9533

Win32TransService does not handle aliases

           Summary: Win32TransService does not handle aliases
           Product: Xerces-C++
           Version: 1.7.0
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Utilities
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


Win32TransService does not recognize aliases for encodings. 

When Win32TransService is building its map of encoding entries, the loop the 
creates entries for aliases contains a bug. The code snippet below fixes the 
problem. In the original code, the check if (::wcscmp(uniAlias, aliasedEntry-
>getEncodingName())) always fails because it compares the name of the alias 
target to the base entry (in effect comparing it to itself). The check should 
compare the original name from registry against the name of the existing entry.


Suggested fix:
Starting at line 406 in Win32TransService.cpp

            CPMapEntry* aliasedEntry = fCPMap->get(uniAlias);
            if (aliasedEntry)
            {
// Begin added code
                const unsigned int srcLen = strlen(nameBuf);
                const unsigned int targetLen = ::mbstowcs(0, nameBuf, srcLen);
                XMLCh* uniName = new XMLCh[targetLen + 1];
                ::mbstowcs(uniName, nameBuf, srcLen);
                uniName[targetLen] = 0;
                _wcsupr(uniName);
// End added code

                //
                //  If the name is actually different, then take it.
                //  Otherwise, don't take it. They map aliases that are
                //  just different case.
                //
/*modified*/    if (::wcscmp(uniName, aliasedEntry->getEncodingName()))
                {
/*modified*/        CPMapEntry* newEntry = new CPMapEntry(uniName, 
aliasedEntry->getWinCP(), aliasedEntry->getIEEncoding());
                    fCPMap->put((void*)newEntry->getEncodingName(), newEntry);
                }
            
/*Added*/       delete [] uniName;
            }
            delete [] uniAlias;

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

Reply via email to