summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/Ice/.gitignore4
-rw-r--r--cpp/src/Ice/Instance.cpp3
-rw-r--r--cpp/src/Ice/LoggerI.cpp13
3 files changed, 11 insertions, 9 deletions
diff --git a/cpp/src/Ice/.gitignore b/cpp/src/Ice/.gitignore
index 686ad33b883..8ca8805244c 100644
--- a/cpp/src/Ice/.gitignore
+++ b/cpp/src/Ice/.gitignore
@@ -38,8 +38,6 @@ Router.cpp
ServantLocatorF.cpp
ServantLocator.cpp
SliceChecksumDict.cpp
-StatsF.cpp
-Stats.cpp
Version.cpp
BuiltinSequences.h
CommunicatorF.h
@@ -78,6 +76,4 @@ Router.h
ServantLocatorF.h
ServantLocator.h
SliceChecksumDict.h
-StatsF.h
-Stats.h
Version.h
diff --git a/cpp/src/Ice/Instance.cpp b/cpp/src/Ice/Instance.cpp
index 361165c87ab..39668b5340e 100644
--- a/cpp/src/Ice/Instance.cpp
+++ b/cpp/src/Ice/Instance.cpp
@@ -1014,7 +1014,8 @@ IceInternal::Instance::Instance(const CommunicatorPtr& communicator, const Initi
_initData.logger = getProcessLogger();
if(LoggerIPtr::dynamicCast(_initData.logger))
{
- _initData.logger = new LoggerI("", "", logStdErrConvert, _stringConverter);
+ _initData.logger = new LoggerI(_initData.properties->getProperty("Ice.ProgramName"), "",
+ logStdErrConvert, _stringConverter);
}
}
}
diff --git a/cpp/src/Ice/LoggerI.cpp b/cpp/src/Ice/LoggerI.cpp
index fa39ff9e21d..94a427bf40d 100644
--- a/cpp/src/Ice/LoggerI.cpp
+++ b/cpp/src/Ice/LoggerI.cpp
@@ -65,7 +65,7 @@ UTF8ToCodePage(const string& in, int codePage)
int wlength = 0;
do
{
- size == 0 ? 2 * in.size() : 2 * size;
+ size = size == 0 ? 2 * in.size() : 2 * size;
wbuffer.reset(new wchar_t[size]);
wlength = MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, in.c_str(), -1, wbuffer.get(), size);
}
@@ -88,8 +88,8 @@ UTF8ToCodePage(const string& in, int codePage)
int length = 0;
do
{
- size == 0 ? wlength + 2 : 2 * size;
- buffer.reset(new char[length]);
+ size = size == 0 ? wlength + 2 : 2 * size;
+ buffer.reset(new char[size]);
length = WideCharToMultiByte(codePage, conversionFlags, wbuffer.get(), wlength, buffer.get(), size, 0, 0);
}
while(length == 0 && GetLastError() == ERROR_INSUFFICIENT_BUFFER);
@@ -207,7 +207,12 @@ Ice::LoggerI::write(const string& message, bool indent)
//
if(!_convert)
{
- cerr << s << endl;
+ //
+ // Use fprintf_s to avoid encoding conversion when stderr is connected
+ // to Windows console. When _convert is set to false we always output
+ // UTF8 encoded messages.
+ //
+ fprintf_s(stderr, "%s\n", IceUtil::nativeToUTF8(_converter, s).c_str());
}
else
{