Author: amassari
Date: Wed Jul 2 09:58:06 2008
New Revision: 673441
URL: http://svn.apache.org/viewvc?rev=673441&view=rev
Log:
Use the _wcsupr naming instead of wcsupr (only Visual C++ defines both, Borland
only defines the version prefixed by the underscore)
Modified:
xerces/c/trunk/src/xercesc/util/Transcoders/Win32/Win32TransService.cpp
xerces/c/trunk/src/xercesc/util/Transcoders/Win32/Win32TransService.hpp
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=673441&r1=673440&r2=673441&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/util/Transcoders/Win32/Win32TransService.cpp
(original)
+++ xerces/c/trunk/src/xercesc/util/Transcoders/Win32/Win32TransService.cpp Wed
Jul 2 09:58:06 2008
@@ -50,7 +50,7 @@
#if !HAVE_WCSUPR
-void wcsupr(LPWSTR str)
+void _wcsupr(LPWSTR str)
{
int nLen=XMLString::stringLen(str);
::LCMapStringW( GetThreadLocale(), LCMAP_UPPERCASE, str, nLen, str, nLen);
@@ -58,7 +58,7 @@
#endif
#if !HAVE_WCSLWR
-void wcslwr(LPWSTR str)
+void _wcslwr(LPWSTR str)
{
int nLen=XMLString::stringLen(str);
::LCMapStringW( GetThreadLocale(), LCMAP_LOWERCASE, str, nLen, str, nLen);
@@ -66,7 +66,7 @@
#endif
#if !HAVE_WCSNICMP
-int wcsnicmp(LPCWSTR comp1, LPCWSTR comp2, unsigned int nLen)
+int _wcsnicmp(LPCWSTR comp1, LPCWSTR comp2, unsigned int nLen)
{
unsigned int len = XMLString::stringLen( comp1);
unsigned int otherLen = XMLString::stringLen( comp2);
@@ -123,16 +123,35 @@
#endif
#if !HAVE_WCSICMP
-int wcsicmp(LPCWSTR comp1, LPCWSTR comp2)
+int _wcsicmp(LPCWSTR comp1, LPCWSTR comp2)
{
unsigned int len = XMLString::stringLen( comp1);
unsigned int otherLen = XMLString::stringLen( comp2);
// Must compare terminating NUL to return difference if one string is
shorter than the other.
unsigned int maxChars = ( len > otherLen ) ? otherLen : len;
- return wcsnicmp(comp1, comp2, maxChars+1);
+ return _wcsnicmp(comp1, comp2, maxChars+1);
}
#endif
+// it's a local function (instead of a static function) so that we are not
+// forced to include <windows.h> in the header
+bool isAlias(const HKEY encodingKey
+ , char* const aliasBuf = 0
+ , const unsigned int nameBufSz = 0)
+{
+ unsigned long theType;
+ unsigned long theSize = nameBufSz;
+ return (::RegQueryValueExA
+ (
+ encodingKey
+ , "AliasForCharset"
+ , 0
+ , &theType
+ , (unsigned char*)aliasBuf
+ , &theSize
+ ) == ERROR_SUCCESS);
+}
+
// ---------------------------------------------------------------------------
// This is the simple CPMapEntry class. It just contains an encoding name
// and a code page for that encoding.
@@ -212,7 +231,7 @@
// Upper case it because we are using a hash table and need to be
// sure that we find all case combinations.
//
- wcsupr(fEncodingName);
+ _wcsupr(fEncodingName);
}
}
@@ -228,7 +247,7 @@
// Upper case it because we are using a hash table and need to be
// sure that we find all case combinations.
//
- wcsupr(fEncodingName);
+ _wcsupr(fEncodingName);
}
CPMapEntry::~CPMapEntry()
@@ -437,7 +456,7 @@
);//new XMLCh[targetLen + 1];
::MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, aliasBuf, -1,
(LPWSTR)uniAlias, targetLen);
uniAlias[targetLen] = 0;
- wcsupr(uniAlias);
+ _wcsupr(uniAlias);
// Look up the alias name
CPMapEntry* aliasedEntry = fCPMap->get(uniAlias);
@@ -452,14 +471,14 @@
);//new XMLCh[targetLen + 1];
::MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, nameBuf,
-1, (LPWSTR)uniName, targetLen);
uniName[targetLen] = 0;
- wcsupr(uniName);
+ _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(uniName, aliasedEntry->getEncodingName()))
+ if (!XMLString::equals(uniName,
aliasedEntry->getEncodingName()))
{
CPMapEntry* newEntry = new CPMapEntry(uniName,
aliasedEntry->getIEEncoding());
fCPMap->put((void*)newEntry->getEncodingName(),
newEntry);
@@ -493,7 +512,7 @@
int Win32TransService::compareIString( const XMLCh* const comp1
, const XMLCh* const comp2)
{
- return wcsicmp(comp1, comp2);
+ return _wcsicmp(comp1, comp2);
}
@@ -501,7 +520,7 @@
, const XMLCh* const comp2
, const XMLSize_t maxChars)
{
- return wcsnicmp(comp1, comp2, maxChars);
+ return _wcsnicmp(comp1, comp2, maxChars);
}
@@ -530,32 +549,14 @@
void Win32TransService::upperCase(XMLCh* const toUpperCase)
{
- wcsupr(toUpperCase);
+ _wcsupr(toUpperCase);
}
void Win32TransService::lowerCase(XMLCh* const toLowerCase)
{
- wcslwr(toLowerCase);
+ _wcslwr(toLowerCase);
}
-bool Win32TransService::isAlias(const HKEY encodingKey
- , char* const aliasBuf
- , const unsigned int nameBufSz )
-{
- unsigned long theType;
- unsigned long theSize = nameBufSz;
- return (::RegQueryValueExA
- (
- encodingKey
- , "AliasForCharset"
- , 0
- , &theType
- , (unsigned char*)aliasBuf
- , &theSize
- ) == ERROR_SUCCESS);
-}
-
-
XMLTranscoder*
Win32TransService::makeNewXMLTranscoder(const XMLCh* const
encodingName
, XMLTransService::Codes&
resValue
@@ -570,7 +571,7 @@
// table and we store them all in upper case.
//
XMLString::copyNString(upEncoding, encodingName, upLen);
- wcsupr(upEncoding);
+ _wcsupr(upEncoding);
// Now to try to find this guy in the CP map
CPMapEntry* theEntry = fCPMap->get(upEncoding);
Modified:
xerces/c/trunk/src/xercesc/util/Transcoders/Win32/Win32TransService.hpp
URL:
http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/Transcoders/Win32/Win32TransService.hpp?rev=673441&r1=673440&r2=673441&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/util/Transcoders/Win32/Win32TransService.hpp
(original)
+++ xerces/c/trunk/src/xercesc/util/Transcoders/Win32/Win32TransService.hpp Wed
Jul 2 09:58:06 2008
@@ -24,7 +24,6 @@
#include <xercesc/util/TransService.hpp>
#include <xercesc/util/RefHashTableOf.hpp>
-#include <windows.h>
XERCES_CPP_NAMESPACE_BEGIN
@@ -101,13 +100,6 @@
// This map is shared unsynchronized among all threads of the process,
// which is cool since it will be read only once its initialized.
-
-
- static bool isAlias(const HKEY encodingKey
- , char* const aliasBuf = 0
- , const unsigned int nameBufSz = 0);
-
-
RefHashTableOf<CPMapEntry> *fCPMap;
};
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]