diff options
author | Jose <jose@zeroc.com> | 2014-05-02 20:24:00 +0200 |
---|---|---|
committer | Jose <jose@zeroc.com> | 2014-05-02 20:24:00 +0200 |
commit | b48eab05676ec06380f895d8610f28b4b5831707 (patch) | |
tree | aac05dea0302aca912ca19ddc25886ebca506ce7 /cpp | |
parent | ICE-4851 - Use wstrings for input and output data that contain non-ASCII char... (diff) | |
download | ice-b48eab05676ec06380f895d8610f28b4b5831707.tar.bz2 ice-b48eab05676ec06380f895d8610f28b4b5831707.tar.xz ice-b48eab05676ec06380f895d8610f28b4b5831707.zip |
Minor fixes to wstringToString usage in demos.
Diffstat (limited to 'cpp')
-rw-r--r-- | cpp/demo/IceGrid/icebox/HelloI.cpp | 6 | ||||
-rw-r--r-- | cpp/demo/IcePatch2/MFC/PatchClient.cpp | 6 | ||||
-rw-r--r-- | cpp/demo/IcePatch2/MFC/PatchClientDlg.cpp | 19 |
3 files changed, 17 insertions, 14 deletions
diff --git a/cpp/demo/IceGrid/icebox/HelloI.cpp b/cpp/demo/IceGrid/icebox/HelloI.cpp index 46b0ea6abf7..1e96d635ba9 100644 --- a/cpp/demo/IceGrid/icebox/HelloI.cpp +++ b/cpp/demo/IceGrid/icebox/HelloI.cpp @@ -23,9 +23,9 @@ HelloI::sayHello(const Ice::Current&) #ifdef _WIN32 vector<wchar_t> buf; buf.resize(1024); - DWORD val = GetEnvironmentVariableW(IceUtil::stringToWstring("LANG").c_str(), &buf[0], - static_cast<DWORD>(buf.size())); - string lang = (val > 0 && val < buf.size()) ? IceUtil::wstringToString(&buf[0]) : string("en"); + DWORD val = GetEnvironmentVariableW(L"LANG", &buf[0], static_cast<DWORD>(buf.size())); + string lang = (val > 0 && val < buf.size()) ? + IceUtil::wnativeToNative(IceUtil::getProcessStringConverter(), 0, &buf[0]) : string("en"); #else char* val = getenv("LANG"); string lang = val ? string(val) : "en"; diff --git a/cpp/demo/IcePatch2/MFC/PatchClient.cpp b/cpp/demo/IcePatch2/MFC/PatchClient.cpp index a0043197954..6a1fb3108ea 100644 --- a/cpp/demo/IcePatch2/MFC/PatchClient.cpp +++ b/cpp/demo/IcePatch2/MFC/PatchClient.cpp @@ -46,11 +46,7 @@ CPatchClientApp::InitInstance() Ice::CommunicatorPtr communicator; try { - Ice::StringSeq args; - for(int i = 0; i < __argc; ++i) - { - args.push_back(IceUtil::wstringToString(__wargv[i])); - } + Ice::StringSeq args = Ice::argsToStringSeq(__argc, __wargv); communicator = Ice::initialize(args); } catch(const IceUtil::Exception& ex) diff --git a/cpp/demo/IcePatch2/MFC/PatchClientDlg.cpp b/cpp/demo/IcePatch2/MFC/PatchClientDlg.cpp index 9340f6a10b6..015cfb31458 100644 --- a/cpp/demo/IcePatch2/MFC/PatchClientDlg.cpp +++ b/cpp/demo/IcePatch2/MFC/PatchClientDlg.cpp @@ -148,7 +148,7 @@ CPatchDlg::checksumProgress(const string& path) // TODO: indicate busy progress CString file; - file.Format(L" %s", IceUtil::stringToWstring(getBasename(path)).c_str()); + file.Format(L" %s", IceUtil::nativeToWnative(IceUtil::getProcessStringConverter(), 0, getBasename(path)).c_str()); _file->SetWindowText(file); processMessages(); @@ -206,7 +206,7 @@ CPatchDlg::patchStart(const string& path, Ice::Long size, Ice::Long totalProgres } CString file; - file.Format(L" %s", IceUtil::stringToWstring(getBasename(path)).c_str()); + file.Format(L" %s", IceUtil::nativeToWnative(IceUtil::getProcessStringConverter(), 0, getBasename(path)).c_str()); _file->SetWindowText(file); return patchProgress(0, size, totalProgress, totalSize); @@ -294,13 +294,19 @@ CPatchDlg::OnInitDialog() // Set the patch directory and thorough flag from properties. // Ice::PropertiesPtr properties = _communicator->getProperties(); - CString path = IceUtil::stringToWstring(properties->getPropertyWithDefault("IcePatch2Client.Directory", "")).c_str(); + CString path = IceUtil::nativeToWnative( + IceUtil::getProcessStringConverter(), 0, + properties->getPropertyWithDefault("IcePatch2Client.Directory", "")).c_str(); _path->SetWindowText(path); - CString thorough = IceUtil::stringToWstring(properties->getPropertyWithDefault("IcePatch2Client.Thorough", "0")).c_str(); + CString thorough = IceUtil::nativeToWnative( + IceUtil::getProcessStringConverter(), 0, + properties->getPropertyWithDefault("IcePatch2Client.Thorough", "0")).c_str(); _thorough->SetCheck(thorough != "0"); - CString remove = IceUtil::stringToWstring(properties->getPropertyWithDefault("IcePatch2Client.Remove", "0")).c_str(); + CString remove = IceUtil::nativeToWnative( + IceUtil::getProcessStringConverter(), 0, + properties->getPropertyWithDefault("IcePatch2Client.Remove", "0")).c_str(); _remove->SetCheck(remove != "0"); // @@ -395,7 +401,8 @@ CPatchDlg::OnStartPatch() AfxMessageBox(CString(L"Please select a patch directory."), MB_OK|MB_ICONEXCLAMATION); return; } - properties->setProperty("IcePatch2Client.Directory", IceUtil::wstringToString(wstring(path))); + properties->setProperty("IcePatch2Client.Directory", + IceUtil::wnativeToNative(IceUtil::getProcessStringConverter(), 0, wstring(path))); // // Set the thorough patch flag. |