You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by na...@apache.org on 2009/02/15 07:10:57 UTC
svn commit: r744612 - in /webservices/axis/trunk/c/src/platforms:
PlatformLanguageUtils.cpp os400/PlatformLanguageUtils.cpp
Author: nadiramra
Date: Sun Feb 15 06:10:57 2009
New Revision: 744612
URL: http://svn.apache.org/viewvc?rev=744612&view=rev
Log:
AXISCPP-964 SOAP request/response not UTF-8 encoded (but claims to be)
AXISCPP-856 Add Platform Services Abstraction Layer
Modified:
webservices/axis/trunk/c/src/platforms/PlatformLanguageUtils.cpp
webservices/axis/trunk/c/src/platforms/os400/PlatformLanguageUtils.cpp
Modified: webservices/axis/trunk/c/src/platforms/PlatformLanguageUtils.cpp
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/platforms/PlatformLanguageUtils.cpp?rev=744612&r1=744611&r2=744612&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/platforms/PlatformLanguageUtils.cpp (original)
+++ webservices/axis/trunk/c/src/platforms/PlatformLanguageUtils.cpp Sun Feb 15 06:10:57 2009
@@ -37,28 +37,28 @@
wchar_t * PlatformLanguageUtils::
toWchar(const char *charBuf, int charLen)
{
- logSetFunctionNameEngine("PlatformLanguageUtils::toWchar")
-
- if (charBuf == NULL || charLen == 0)
- return NULL;
-
- // Allocate buffer. Need to make sure buffer will fit wide-character
- // representation of character string, including null-terminating character.
- wchar_t *outBuffer = new wchar_t[charLen];
-
- // Now call wide-character function to convert string to wide-character.
- size_t nbrGenerated = mbstowcs(outBuffer, charBuf, charLen);
-
- if (nbrGenerated == (size_t)-1)
- {
- delete [] outBuffer;
-
- logThrowExceptionNoExit("AxisEngineException: Error converting from character to wide-character.")
-
- throw AxisEngineException(-999, "Error converting from character to wide-character.");
- }
-
- return outBuffer;
+ logSetFunctionNameEngine("PlatformLanguageUtils::toWchar")
+
+ if (charBuf == NULL || charLen == 0)
+ return NULL;
+
+ // Allocate buffer. Need to make sure buffer will fit wide-character
+ // representation of character string, including null-terminating character.
+ wchar_t *outBuffer = new wchar_t[charLen];
+
+ // Now call wide-character function to convert string to wide-character.
+ size_t nbrGenerated = mbstowcs(outBuffer, charBuf, charLen);
+
+ if (nbrGenerated == (size_t)-1)
+ {
+ delete [] outBuffer;
+
+ logThrowExceptionNoExit("AxisEngineException: Error converting from character to wide-character.")
+
+ throw AxisEngineException(-999, "Error converting from character to wide-character.");
+ }
+
+ return outBuffer;
}
//******************************************************************************
@@ -69,29 +69,29 @@
char * PlatformLanguageUtils::
toChar(const wchar_t *wcharBuf, int wcharLen)
{
- logSetFunctionNameEngine("PlatformLanguageUtils::toChar")
-
- if (wcharBuf == NULL || wcharLen == 0)
- return NULL;
-
- // Allocate buffer. Need to make sure buffer will fit character
- // representation of wide-character string, including null-terminating character.
- int bufLen = (wcharLen * MB_CUR_MAX);
- char *outBuffer = new char[bufLen];
-
- // Now call wide-character function to convert wide-character to character string.
- size_t nbrGenerated = wcstombs(outBuffer, wcharBuf, bufLen);
-
- if (nbrGenerated == (size_t)-1)
- {
- delete [] outBuffer;
-
- logThrowExceptionNoExit("AxisEngineException: Error converting from wide-character to character.")
+ logSetFunctionNameEngine("PlatformLanguageUtils::toChar")
+
+ if (wcharBuf == NULL || wcharLen == 0)
+ return NULL;
+
+ // Allocate buffer. Need to make sure buffer will fit character
+ // representation of wide-character string, including null-terminating character.
+ int bufLen = (wcharLen * MB_CUR_MAX);
+ char *outBuffer = new char[bufLen];
+
+ // Now call wide-character function to convert wide-character to character string.
+ size_t nbrGenerated = wcstombs(outBuffer, wcharBuf, bufLen);
+
+ if (nbrGenerated == (size_t)-1)
+ {
+ delete [] outBuffer;
+
+ logThrowExceptionNoExit("AxisEngineException: Error converting from wide-character to character.")
- throw AxisEngineException(-999, "Error converting from wide-character to character.");
- }
-
- return outBuffer;
+ throw AxisEngineException(-999, "Error converting from wide-character to character.");
+ }
+
+ return outBuffer;
}
//******************************************************************************
@@ -102,20 +102,20 @@
char * PlatformLanguageUtils::
toUTF8(const char *charBuf, int charLen)
{
- logSetFunctionNameEngine("PlatformLanguageUtils::toUTF8")
-
- if (charBuf == NULL || charLen == 0)
- return NULL;
-
- // TODO
- // I do not think there is a generic way to do this
- // that is acceptable by windows and unix platforms (maybe iconv?), so if someone
- // wants to do this then they have to create plarform-specific copy of this file and
- // put in proper directory and update the build/buildClient.xml file to pick the
- // platform file instead of the common file. See how os400 does it.
- logThrowExceptionNoExit("AxisEngineException: Error converting to UTF-8.")
+ logSetFunctionNameEngine("PlatformLanguageUtils::toUTF8")
+
+ if (charBuf == NULL || charLen == 0)
+ return NULL;
+
+ // TODO
+ // I do not think there is a generic way to do this
+ // that is acceptable by windows and unix platforms (maybe iconv?), so if someone
+ // wants to do this then they have to create plarform-specific copy of this file and
+ // put in proper directory and update the build/buildClient.xml file to pick the
+ // platform file instead of the common file. See how os400 does it.
+ logThrowExceptionNoExit("AxisEngineException: Error converting to UTF-8.")
- throw AxisEngineException(-999, "Error converting to utf-8.");
+ throw AxisEngineException(-999, "Error converting to utf-8.");
}
AXIS_CPP_NAMESPACE_END
Modified: webservices/axis/trunk/c/src/platforms/os400/PlatformLanguageUtils.cpp
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/platforms/os400/PlatformLanguageUtils.cpp?rev=744612&r1=744611&r2=744612&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/platforms/os400/PlatformLanguageUtils.cpp (original)
+++ webservices/axis/trunk/c/src/platforms/os400/PlatformLanguageUtils.cpp Sun Feb 15 06:10:57 2009
@@ -56,30 +56,30 @@
wchar_t * PlatformLanguageUtils::
toWchar(const char *charBuf, int charLen)
{
- logSetFunctionNameEngine("PlatformLanguageUtils::toWchar")
+ logSetFunctionNameEngine("PlatformLanguageUtils::toWchar")
- if (charLen == 0 || charBuf == NULL)
- return NULL;
+ if (charLen == 0 || charBuf == NULL)
+ return NULL;
- size_t outBytesLeft = charLen*sizeof(wchar_t);
- wchar_t *outBuffer = (wchar_t *) new wchar_t[charLen];
+ size_t outBytesLeft = charLen*sizeof(wchar_t);
+ wchar_t *outBuffer = (wchar_t *) new wchar_t[charLen];
- int myToBufLen = outBytesLeft;
- char *myToBuf = (char *)outBuffer;
-
- size_t irc = iconv(cvtrJobToUCS2, (char **)&charBuf, (size_t *)&charLen, &myToBuf, &outBytesLeft);
- myToBufLen -= outBytesLeft;
-
- if (irc == (size_t)-1)
- {
- delete [] outBuffer;
-
- logThrowExceptionNoExit("AxisEngineException: Error converting from character to wide-character.")
-
- throw AxisEngineException(-999, "Error converting from character to wide-character.");
- }
+ int myToBufLen = outBytesLeft;
+ char *myToBuf = (char *)outBuffer;
- return outBuffer;
+ size_t irc = iconv(cvtrJobToUCS2, (char **)&charBuf, (size_t *)&charLen, &myToBuf, &outBytesLeft);
+ myToBufLen -= outBytesLeft;
+
+ if (irc == (size_t)-1)
+ {
+ delete [] outBuffer;
+
+ logThrowExceptionNoExit("AxisEngineException: Error converting from character to wide-character.")
+
+ throw AxisEngineException(-999, "Error converting from character to wide-character.");
+ }
+
+ return outBuffer;
}
//******************************************************************************
@@ -96,30 +96,31 @@
char * PlatformLanguageUtils::
toChar(const wchar_t *wcharBuf, int wcharLen)
{
- logSetFunctionNameEngine("PlatformLanguageUtils::toChar")
+ logSetFunctionNameEngine("PlatformLanguageUtils::toChar")
- if (wcharLen == 0 || wcharBuf == NULL)
- return NULL;
+ if (wcharLen == 0 || wcharBuf == NULL)
+ return NULL;
- size_t outBytesLeft = (wcharLen * MB_LEN_MAX);
- char *outBuffer = (char *) new char[wcharLen * MB_LEN_MAX];
+ size_t outBytesLeft = (wcharLen * MB_LEN_MAX);
+ char *outBuffer = (char *) new char[wcharLen * MB_LEN_MAX];
- int myToBufLen = outBytesLeft;
- char *myToBuf = outBuffer;
+ int myToBufLen = outBytesLeft;
+ char *myToBuf = outBuffer;
- size_t irc = iconv(cvtrUCS2ToJob, (char **)&wcharBuf, (size_t *)&wcharLen, &myToBuf, &outBytesLeft);
- myToBufLen -= outBytesLeft;
+ int numberOfBytes = wcharLen * sizeof(wchar_t);
+ size_t irc = iconv(cvtrUCS2ToJob, (char **)&wcharBuf, (size_t *)&numberOfBytes, &myToBuf, &outBytesLeft);
+ myToBufLen -= outBytesLeft;
- if (irc == (size_t)-1)
- {
- delete [] outBuffer;
-
- logThrowExceptionNoExit("AxisEngineException: Error converting from wide-character to character.")
+ if (irc == (size_t)-1)
+ {
+ delete [] outBuffer;
+
+ logThrowExceptionNoExit("AxisEngineException: Error converting from wide-character to character.")
- throw AxisEngineException(-999, "Error converting from wide-character to character.");
- }
+ throw AxisEngineException(-999, "Error converting from wide-character to character.");
+ }
- return outBuffer;
+ return outBuffer;
}
//******************************************************************************
@@ -148,8 +149,8 @@
if (irc == (size_t)-1)
{
- delete [] outBuffer;
-
+ delete [] outBuffer;
+
logThrowExceptionNoExit("AxisEngineException: Error converting to UTF-8.")
throw AxisEngineException(-999, "Error converting to utf-8.");