summaryrefslogtreecommitdiff
path: root/cpp/src/Ice/StringConverter.cpp
diff options
context:
space:
mode:
authorBernard Normier <bernard@zeroc.com>2008-01-23 09:15:28 -0500
committerBernard Normier <bernard@zeroc.com>2008-01-23 09:15:28 -0500
commit2cdd39227e7efda5fc8b3a04a9c2b0d678943a17 (patch)
treeac7d3ef0ae27a80cc2bc1f4a2c7f42c52d35e979 /cpp/src/Ice/StringConverter.cpp
parentNew VC60 third-party build + VC60 build fixes (diff)
parent- Added IceUtil::SyscallException and cleaned up few IceUtil exceptions (diff)
downloadice-2cdd39227e7efda5fc8b3a04a9c2b0d678943a17.tar.bz2
ice-2cdd39227e7efda5fc8b3a04a9c2b0d678943a17.tar.xz
ice-2cdd39227e7efda5fc8b3a04a9c2b0d678943a17.zip
Merge branch 'master' of ssh://cvs/home/git/ice
Diffstat (limited to 'cpp/src/Ice/StringConverter.cpp')
-rwxr-xr-xcpp/src/Ice/StringConverter.cpp42
1 files changed, 3 insertions, 39 deletions
diff --git a/cpp/src/Ice/StringConverter.cpp b/cpp/src/Ice/StringConverter.cpp
index ec88ab47188..a89fa716494 100755
--- a/cpp/src/Ice/StringConverter.cpp
+++ b/cpp/src/Ice/StringConverter.cpp
@@ -9,6 +9,7 @@
#include <Ice/StringConverter.h>
#include <IceUtil/IceUtil.h>
+#include <IceUtil/StringUtil.h>
#include <IceUtil/ScopedArray.h>
#include <Ice/LocalException.h>
@@ -16,43 +17,6 @@ using namespace IceUtil;
using namespace IceUtilInternal;
using namespace std;
-
-#ifdef _WIN32
-namespace
-{
-//
-// Helper function
-//
-
-string getMessageForLastError()
-{
- LPVOID lpMsgBuf = 0;
- DWORD ok = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
- FORMAT_MESSAGE_FROM_SYSTEM |
- FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL,
- GetLastError(),
- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
- (LPTSTR)&lpMsgBuf,
- 0,
- NULL);
-
- string msg;
- if(ok)
- {
- msg = (LPCTSTR)lpMsgBuf;
- LocalFree(lpMsgBuf);
- }
- else
- {
- msg = "Unknown Windows error";
- }
- return msg;
-}
-}
-#endif
-
-
namespace Ice
{
@@ -162,7 +126,7 @@ WindowsStringConverter::toUTF8(const char* sourceStart,
if(writtenWchar == 0)
{
- throw StringConversionException(__FILE__, __LINE__, getMessageForLastError());
+ throw StringConversionException(__FILE__, __LINE__, IceUtilInternal::lastErrorToString());
}
//
@@ -203,7 +167,7 @@ WindowsStringConverter::fromUTF8(const Byte* sourceStart, const Byte* sourceEnd,
if(writtenChar == 0)
{
- throw StringConversionException(__FILE__, __LINE__, getMessageForLastError());
+ throw StringConversionException(__FILE__, __LINE__, IceUtilInternal::lastErrorToString());
}
target.assign(buffer.get(), writtenChar);