tng 2002/07/29 08:29:09
Modified: c/src/xercesc/util/Transcoders/Win32 Win32TransService.cpp
Log:
[Bug 9533] Win32TransService does not recognize aliases for encodings. Fixed by Tom
Keane.
Revision Changes Path
1.4 +16 -6
xml-xerces/c/src/xercesc/util/Transcoders/Win32/Win32TransService.cpp
Index: Win32TransService.cpp
===================================================================
RCS file:
/home/cvs/xml-xerces/c/src/xercesc/util/Transcoders/Win32/Win32TransService.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Win32TransService.cpp 29 Jul 2002 14:22:20 -0000 1.3
+++ Win32TransService.cpp 29 Jul 2002 15:29:09 -0000 1.4
@@ -359,6 +359,7 @@
// values we stored for the original.
//
subIndex = 0;
+ char aliasBuf[nameBufSz + 1];
while (true)
{
// Get the name of the next key
@@ -392,12 +393,12 @@
// then construct a new one with the new name and the aliased
// ids.
//
- if (isAlias(encodingKey, nameBuf, nameBufSz))
+ if (isAlias(encodingKey, aliasBuf, nameBufSz))
{
- const unsigned int srcLen = strlen(nameBuf);
- const unsigned int targetLen = ::mbstowcs(0, nameBuf, srcLen);
+ const unsigned int srcLen = strlen(aliasBuf);
+ const unsigned int targetLen = ::mbstowcs(0, aliasBuf, srcLen);
XMLCh* uniAlias = new XMLCh[targetLen + 1];
- ::mbstowcs(uniAlias, nameBuf, srcLen);
+ ::mbstowcs(uniAlias, aliasBuf, srcLen);
uniAlias[targetLen] = 0;
_wcsupr(uniAlias);
@@ -405,16 +406,25 @@
CPMapEntry* aliasedEntry = fCPMap->get(uniAlias);
if (aliasedEntry)
{
+ 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);
+
//
// If the name is actually different, then take it.
// Otherwise, don't take it. They map aliases that are
// just different case.
//
- if (::wcscmp(uniAlias, aliasedEntry->getEncodingName()))
+ if (::wcscmp(uniName, aliasedEntry->getEncodingName()))
{
- CPMapEntry* newEntry = new CPMapEntry(uniAlias,
aliasedEntry->getWinCP(), aliasedEntry->getIEEncoding());
+ CPMapEntry* newEntry = new CPMapEntry(uniName,
aliasedEntry->getWinCP(), aliasedEntry->getIEEncoding());
fCPMap->put((void*)newEntry->getEncodingName(), newEntry);
}
+
+ delete [] uniName;
}
delete [] uniAlias;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]