You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by am...@apache.org on 2008/01/07 14:29:47 UTC
svn commit: r609601 -
/xerces/c/trunk/src/xercesc/util/Transcoders/Win32/Win32TransService.cpp
Author: amassari
Date: Mon Jan 7 05:29:46 2008
New Revision: 609601
URL: http://svn.apache.org/viewvc?rev=609601&view=rev
Log:
Avoid invoking strlen
Modified:
xerces/c/trunk/src/xercesc/util/Transcoders/Win32/Win32TransService.cpp
Modified: xerces/c/trunk/src/xercesc/util/Transcoders/Win32/Win32TransService.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/Transcoders/Win32/Win32TransService.cpp?rev=609601&r1=609600&r2=609601&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/util/Transcoders/Win32/Win32TransService.cpp (original)
+++ xerces/c/trunk/src/xercesc/util/Transcoders/Win32/Win32TransService.cpp Mon Jan 7 05:29:46 2008
@@ -198,15 +198,14 @@
, fIEId(ieId)
{
// Transcode the name to Unicode and store that copy
- const XMLSize_t srcLen = strlen(encodingName);
- int targetLen=::MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, encodingName, srcLen, NULL, 0);
+ int targetLen=::MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, encodingName, -1, NULL, 0);
if(targetLen!=0)
{
fEncodingName = (XMLCh*) XMLPlatformUtils::fgMemoryManager->allocate
(
(targetLen + 1) * sizeof(XMLCh)
);//new XMLCh[targetLen + 1];
- ::MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, encodingName, srcLen, (LPWSTR)fEncodingName, targetLen);
+ ::MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, encodingName, -1, (LPWSTR)fEncodingName, targetLen);
fEncodingName[targetLen] = 0;
//
@@ -429,15 +428,14 @@
//
if (isAlias(encodingKey, aliasBuf, nameBufSz))
{
- const XMLSize_t srcLen = strlen(aliasBuf);
- int targetLen = ::MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, aliasBuf, srcLen, NULL, 0);
+ int targetLen = ::MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, aliasBuf, -1, NULL, 0);
if(targetLen!=0)
{
XMLCh* uniAlias = (XMLCh*) XMLPlatformUtils::fgMemoryManager->allocate
(
(targetLen + 1) * sizeof(XMLCh)
);//new XMLCh[targetLen + 1];
- ::MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, aliasBuf, srcLen, (LPWSTR)uniAlias, targetLen);
+ ::MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, aliasBuf, -1, (LPWSTR)uniAlias, targetLen);
uniAlias[targetLen] = 0;
wcsupr(uniAlias);
@@ -445,15 +443,14 @@
CPMapEntry* aliasedEntry = fCPMap->get(uniAlias);
if (aliasedEntry)
{
- const XMLSize_t srcLen = strlen(nameBuf);
- int targetLen = ::MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, nameBuf, srcLen, NULL, 0);
+ int targetLen = ::MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, nameBuf, -1, NULL, 0);
if(targetLen!=0)
{
XMLCh* uniName = (XMLCh*) XMLPlatformUtils::fgMemoryManager->allocate
(
(targetLen + 1) * sizeof(XMLCh)
);//new XMLCh[targetLen + 1];
- ::MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, nameBuf, srcLen, (LPWSTR)uniName, targetLen);
+ ::MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, nameBuf, -1, (LPWSTR)uniName, targetLen);
uniName[targetLen] = 0;
wcsupr(uniName);
@@ -572,7 +569,7 @@
// Get an upper cased copy of the encoding name, since we use a hash
// table and we store them all in upper case.
//
- XMLString::copyNString(upEncoding, encodingName, upLen);
+ XMLString::copyNString(upEncoding, encodingName, upLen);
wcsupr(upEncoding);
// Now to try to find this guy in the CP map
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xerces.apache.org
For additional commands, e-mail: commits-help@xerces.apache.org