summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
Diffstat (limited to 'indra')
-rw-r--r--indra/llcommon/llapp.cpp4
-rw-r--r--indra/llcommon/llerror.cpp2
-rw-r--r--indra/llcommon/llfile.cpp38
-rw-r--r--indra/llcommon/llsys.cpp4
-rw-r--r--indra/llcommon/tests/stringize_test.cpp12
-rw-r--r--indra/llcrashlogger/llcrashlock.cpp4
-rw-r--r--indra/llfilesystem/lldir.cpp4
-rw-r--r--indra/llfilesystem/lldir_win32.cpp12
-rw-r--r--indra/llfilesystem/lldir_win32.h2
-rw-r--r--indra/llfilesystem/lldirguard.h7
-rw-r--r--indra/llfilesystem/lldiriterator.cpp2
-rw-r--r--indra/llfilesystem/lldiskcache.cpp8
-rw-r--r--indra/llfilesystem/llfilesystem.cpp4
-rw-r--r--indra/llwindow/lldxhardware.cpp6
-rw-r--r--indra/llwindow/llwindowwin32.cpp37
-rw-r--r--indra/newview/llappviewerwin32.cpp20
-rw-r--r--indra/newview/llfilepicker.cpp10
-rw-r--r--indra/newview/llfloaterjoystick.cpp2
-rw-r--r--indra/newview/lllocalbitmaps.cpp2
-rw-r--r--indra/newview/lllocalgltfmaterials.cpp2
-rw-r--r--indra/newview/llmachineid.cpp4
-rw-r--r--indra/newview/llviewerjoystick.cpp6
-rw-r--r--indra/newview/llviewerwindow.cpp2
23 files changed, 99 insertions, 95 deletions
diff --git a/indra/llcommon/llapp.cpp b/indra/llcommon/llapp.cpp
index 08a43983d3..c532620daa 100644
--- a/indra/llcommon/llapp.cpp
+++ b/indra/llcommon/llapp.cpp
@@ -229,7 +229,7 @@ bool LLApp::parseCommandOptions(int argc, wchar_t** wargv)
if(wargv[ii][1] == '-') ++offset;
#if LL_WINDOWS
- name.assign(utf16str_to_utf8str(&wargv[ii][offset]));
+ name.assign(ll_convert_wide_to_string(&wargv[ii][offset]));
#else
name.assign(wstring_to_utf8str(&wargv[ii][offset]));
#endif
@@ -253,7 +253,7 @@ bool LLApp::parseCommandOptions(int argc, wchar_t** wargv)
++ii;
#if LL_WINDOWS
- value.assign(utf16str_to_utf8str((wargv[ii])));
+ value.assign(ll_convert_wide_to_string((wargv[ii])));
#else
value.assign(wstring_to_utf8str((wargv[ii])));
#endif
diff --git a/indra/llcommon/llerror.cpp b/indra/llcommon/llerror.cpp
index d834098994..3411e9c6bb 100644
--- a/indra/llcommon/llerror.cpp
+++ b/indra/llcommon/llerror.cpp
@@ -79,7 +79,7 @@ namespace {
//
if (s.size())
{
- OutputDebugString(utf8str_to_utf16str(s).c_str());
+ OutputDebugString(ll_convert<std::wstring>(s).c_str());
OutputDebugString(TEXT("\n"));
}
}
diff --git a/indra/llcommon/llfile.cpp b/indra/llcommon/llfile.cpp
index d0bc8f7652..53659ac13f 100644
--- a/indra/llcommon/llfile.cpp
+++ b/indra/llcommon/llfile.cpp
@@ -178,8 +178,7 @@ int LLFile::mkdir(const std::string& dirname, int perms)
{
#if LL_WINDOWS
// permissions are ignored on Windows
- std::string utf8dirname = dirname;
- llutf16string utf16dirname = utf8str_to_utf16str(utf8dirname);
+ std::wstring utf16dirname = ll_convert<std::wstring>(dirname);
int rc = _wmkdir(utf16dirname.c_str());
#else
int rc = ::mkdir(dirname.c_str(), (mode_t)perms);
@@ -201,8 +200,7 @@ int LLFile::rmdir(const std::string& dirname)
{
#if LL_WINDOWS
// permissions are ignored on Windows
- std::string utf8dirname = dirname;
- llutf16string utf16dirname = utf8str_to_utf16str(utf8dirname);
+ std::wstring utf16dirname = ll_convert<std::wstring>(dirname);
int rc = _wrmdir(utf16dirname.c_str());
#else
int rc = ::rmdir(dirname.c_str());
@@ -214,10 +212,8 @@ int LLFile::rmdir(const std::string& dirname)
LLFILE* LLFile::fopen(const std::string& filename, const char* mode) /* Flawfinder: ignore */
{
#if LL_WINDOWS
- std::string utf8filename = filename;
- std::string utf8mode = std::string(mode);
- llutf16string utf16filename = utf8str_to_utf16str(utf8filename);
- llutf16string utf16mode = utf8str_to_utf16str(utf8mode);
+ std::wstring utf16filename = ll_convert<std::wstring>(filename);
+ std::wstring utf16mode = ll_convert<std::wstring>(std::string(mode));
return _wfopen(utf16filename.c_str(),utf16mode.c_str());
#else
return ::fopen(filename.c_str(),mode); /* Flawfinder: ignore */
@@ -227,10 +223,8 @@ LLFILE* LLFile::fopen(const std::string& filename, const char* mode) /* Flawf
LLFILE* LLFile::_fsopen(const std::string& filename, const char* mode, int sharingFlag)
{
#if LL_WINDOWS
- std::string utf8filename = filename;
- std::string utf8mode = std::string(mode);
- llutf16string utf16filename = utf8str_to_utf16str(utf8filename);
- llutf16string utf16mode = utf8str_to_utf16str(utf8mode);
+ std::wstring utf16filename = ll_convert<std::wstring>(filename);
+ std::wstring utf16mode = ll_convert<std::wstring>(std::string(mode));
return _wfsopen(utf16filename.c_str(),utf16mode.c_str(),sharingFlag);
#else
llassert(0);//No corresponding function on non-windows
@@ -270,8 +264,7 @@ std::string LLFile::getContents(const std::string& filename)
int LLFile::remove(const std::string& filename, int supress_error)
{
#if LL_WINDOWS
- std::string utf8filename = filename;
- llutf16string utf16filename = utf8str_to_utf16str(utf8filename);
+ std::wstring utf16filename = ll_convert<std::wstring>(filename);
int rc = _wremove(utf16filename.c_str());
#else
int rc = ::remove(filename.c_str());
@@ -282,10 +275,8 @@ int LLFile::remove(const std::string& filename, int supress_error)
int LLFile::rename(const std::string& filename, const std::string& newname, int supress_error)
{
#if LL_WINDOWS
- std::string utf8filename = filename;
- std::string utf8newname = newname;
- llutf16string utf16filename = utf8str_to_utf16str(utf8filename);
- llutf16string utf16newname = utf8str_to_utf16str(utf8newname);
+ std::wstring utf16filename = ll_convert<std::wstring>(filename);
+ std::wstring utf16newname = ll_convert<std::wstring>(newname);
int rc = _wrename(utf16filename.c_str(),utf16newname.c_str());
#else
int rc = ::rename(filename.c_str(),newname.c_str());
@@ -327,8 +318,7 @@ bool LLFile::copy(const std::string& from, const std::string& to)
int LLFile::stat(const std::string& filename, llstat* filestatus)
{
#if LL_WINDOWS
- std::string utf8filename = filename;
- llutf16string utf16filename = utf8str_to_utf16str(utf8filename);
+ std::wstring utf16filename = ll_convert<std::wstring>(filename);
int rc = _wstat(utf16filename.c_str(),filestatus);
#else
int rc = ::stat(filename.c_str(),filestatus);
@@ -453,14 +443,14 @@ llifstream::llifstream() {}
// explicit
llifstream::llifstream(const std::string& _Filename, ios_base::openmode _Mode):
- std::ifstream(utf8str_to_utf16str( _Filename ).c_str(),
+ std::ifstream(ll_convert<std::wstring>( _Filename ).c_str(),
_Mode | ios_base::in)
{
}
void llifstream::open(const std::string& _Filename, ios_base::openmode _Mode)
{
- std::ifstream::open(utf8str_to_utf16str(_Filename).c_str(),
+ std::ifstream::open(ll_convert<std::wstring>(_Filename).c_str(),
_Mode | ios_base::in);
}
@@ -472,14 +462,14 @@ llofstream::llofstream() {}
// explicit
llofstream::llofstream(const std::string& _Filename, ios_base::openmode _Mode):
- std::ofstream(utf8str_to_utf16str( _Filename ).c_str(),
+ std::ofstream(ll_convert<std::wstring>( _Filename ).c_str(),
_Mode | ios_base::out)
{
}
void llofstream::open(const std::string& _Filename, ios_base::openmode _Mode)
{
- std::ofstream::open(utf8str_to_utf16str( _Filename ).c_str(),
+ std::ofstream::open(ll_convert<std::wstring>( _Filename ).c_str(),
_Mode | ios_base::out);
}
diff --git a/indra/llcommon/llsys.cpp b/indra/llcommon/llsys.cpp
index b38b3725be..21b11c5311 100644
--- a/indra/llcommon/llsys.cpp
+++ b/indra/llcommon/llsys.cpp
@@ -1328,7 +1328,7 @@ bool gunzip_file(const std::string& srcfile, const std::string& dstfile)
S32 bytes = 0;
tmpfile = dstfile + ".t";
#ifdef LL_WINDOWS
- llutf16string utf16filename = utf8str_to_utf16str(srcfile);
+ std::wstring utf16filename = ll_convert<std::wstring>(srcfile);
src = gzopen_w(utf16filename.c_str(), "rb");
#else
src = gzopen(srcfile.c_str(), "rb");
@@ -1372,7 +1372,7 @@ bool gzip_file(const std::string& srcfile, const std::string& dstfile)
tmpfile = dstfile + ".t";
#ifdef LL_WINDOWS
- llutf16string utf16filename = utf8str_to_utf16str(tmpfile);
+ std::wstring utf16filename = ll_convert<std::wstring>(tmpfile);
dst = gzopen_w(utf16filename.c_str(), "wb");
#else
dst = gzopen(tmpfile.c_str(), "wb");
diff --git a/indra/llcommon/tests/stringize_test.cpp b/indra/llcommon/tests/stringize_test.cpp
index a3ce7f8e3d..3f99041592 100644
--- a/indra/llcommon/tests/stringize_test.cpp
+++ b/indra/llcommon/tests/stringize_test.cpp
@@ -110,6 +110,17 @@ namespace tut
void stringize_object::test<3>()
{
//Tests rely on validity of wstring_to_utf8str()
+#if LL_WINDOWS // Windows wstring is a 2byte UTF16 type
+ ensure_equals(ll_convert<std::string>(wstringize(c)), ll_convert<std::string>(std::wstring(L"c")));
+ ensure_equals(ll_convert<std::string>(wstringize(s)), ll_convert<std::string>(std::wstring(L"17")));
+ ensure_equals(ll_convert<std::string>(wstringize(i)), ll_convert<std::string>(std::wstring(L"34")));
+ ensure_equals(ll_convert<std::string>(wstringize(l)), ll_convert<std::string>(std::wstring(L"68")));
+ ensure_equals(ll_convert<std::string>(wstringize(f)), ll_convert<std::string>(std::wstring(L"3.14159")));
+ ensure_equals(ll_convert<std::string>(wstringize(d)), ll_convert<std::string>(std::wstring(L"3.14159")));
+ ensure_equals(ll_convert<std::string>(wstringize(abc)), ll_convert<std::string>(std::wstring(L"abc def")));
+ ensure_equals(ll_convert<std::string>(wstringize(abc)), ll_convert<std::string>(wstringize(abc.c_str())));
+ ensure_equals(ll_convert<std::string>(wstringize(def)), ll_convert<std::string>(std::wstring(L"def ghi")));
+#else
ensure_equals(wstring_to_utf8str(wstringize(c)), wstring_to_utf8str(L"c"));
ensure_equals(wstring_to_utf8str(wstringize(s)), wstring_to_utf8str(L"17"));
ensure_equals(wstring_to_utf8str(wstringize(i)), wstring_to_utf8str(L"34"));
@@ -119,6 +130,7 @@ namespace tut
ensure_equals(wstring_to_utf8str(wstringize(abc)), wstring_to_utf8str(L"abc def"));
ensure_equals(wstring_to_utf8str(wstringize(abc)), wstring_to_utf8str(wstringize(abc.c_str())));
ensure_equals(wstring_to_utf8str(wstringize(def)), wstring_to_utf8str(L"def ghi"));
+#endif
// ensure_equals(wstring_to_utf8str(wstringize(llsd)), wstring_to_utf8str(L"{'abc':'abc def','d':r3.14159,'i':i34}"));
}
} // namespace tut
diff --git a/indra/llcrashlogger/llcrashlock.cpp b/indra/llcrashlogger/llcrashlock.cpp
index ecd197b2c1..bc34f6798f 100644
--- a/indra/llcrashlogger/llcrashlock.cpp
+++ b/indra/llcrashlogger/llcrashlock.cpp
@@ -189,7 +189,7 @@ LLSD LLCrashLock::getProcessList()
bool LLCrashLock::fileExists(std::string filename)
{
#ifdef LL_WINDOWS // or BOOST_WINDOWS_API
- boost::filesystem::path file_path(utf8str_to_utf16str(filename));
+ boost::filesystem::path file_path(ll_convert<std::wstring>(filename));
#else
boost::filesystem::path file_path(filename);
#endif
@@ -199,7 +199,7 @@ bool LLCrashLock::fileExists(std::string filename)
void LLCrashLock::cleanupProcess(std::string proc_dir)
{
#ifdef LL_WINDOWS // or BOOST_WINDOWS_API
- boost::filesystem::path dir_path(utf8str_to_utf16str(proc_dir));
+ boost::filesystem::path dir_path(ll_convert<std::wstring>(proc_dir));
#else
boost::filesystem::path dir_path(proc_dir);
#endif
diff --git a/indra/llfilesystem/lldir.cpp b/indra/llfilesystem/lldir.cpp
index 99d4850610..9c61c25ada 100644
--- a/indra/llfilesystem/lldir.cpp
+++ b/indra/llfilesystem/lldir.cpp
@@ -103,7 +103,7 @@ std::vector<std::string> LLDir::getFilesInDir(const std::string &dirname)
//Returns a vector of fullpath filenames.
#ifdef LL_WINDOWS // or BOOST_WINDOWS_API
- boost::filesystem::path p(utf8str_to_utf16str(dirname));
+ boost::filesystem::path p(ll_convert<std::wstring>(dirname));
#else
boost::filesystem::path p(dirname);
#endif
@@ -196,7 +196,7 @@ U32 LLDir::deleteDirAndContents(const std::string& dir_name)
try
{
#ifdef LL_WINDOWS // or BOOST_WINDOWS_API
- boost::filesystem::path dir_path(utf8str_to_utf16str(dir_name));
+ boost::filesystem::path dir_path(ll_convert<std::wstring>(dir_name));
#else
boost::filesystem::path dir_path(dir_name);
#endif
diff --git a/indra/llfilesystem/lldir_win32.cpp b/indra/llfilesystem/lldir_win32.cpp
index a607c70b44..58c080c982 100644
--- a/indra/llfilesystem/lldir_win32.cpp
+++ b/indra/llfilesystem/lldir_win32.cpp
@@ -172,7 +172,7 @@ LLDir_Win32::LLDir_Win32()
{
w_str[wcslen(w_str)-1] = '\0'; /* Flawfinder: ignore */ // remove trailing slash
}
- mTempDir = utf16str_to_utf8str(llutf16string(w_str));
+ mTempDir = ll_convert<std::string>(std::wstring(w_str));
if (mOSUserDir.empty())
{
@@ -225,14 +225,14 @@ LLDir_Win32::LLDir_Win32()
// Set working directory, for LLDir::getWorkingDir()
GetCurrentDirectory(MAX_PATH, w_str);
- mWorkingDir = utf16str_to_utf8str(llutf16string(w_str));
+ mWorkingDir = ll_convert<std::string>(std::wstring(w_str));
// Set the executable directory
S32 size = GetModuleFileName(NULL, w_str, MAX_PATH);
if (size)
{
w_str[size] = '\0';
- mExecutablePathAndName = utf16str_to_utf8str(llutf16string(w_str));
+ mExecutablePathAndName = ll_convert<std::string>(std::wstring(w_str));
auto path_end = mExecutablePathAndName.find_last_of('\\');
if (path_end != std::string::npos)
{
@@ -347,8 +347,8 @@ U32 LLDir_Win32::countFilesInDir(const std::string &dirname, const std::string &
WIN32_FIND_DATA FileData;
- llutf16string pathname = utf8str_to_utf16str(dirname);
- pathname += utf8str_to_utf16str(mask);
+ std::wstring pathname = ll_convert<std::wstring>(dirname);
+ pathname += ll_convert<std::wstring>(mask);
if ((count_search_h = FindFirstFile(pathname.c_str(), &FileData)) != INVALID_HANDLE_VALUE)
{
@@ -370,7 +370,7 @@ std::string LLDir_Win32::getCurPath()
WCHAR w_str[MAX_PATH];
GetCurrentDirectory(MAX_PATH, w_str);
- return utf16str_to_utf8str(llutf16string(w_str));
+ return ll_convert<std::string>(std::wstring(w_str));
}
diff --git a/indra/llfilesystem/lldir_win32.h b/indra/llfilesystem/lldir_win32.h
index ab2726f1a0..21a3f1213b 100644
--- a/indra/llfilesystem/lldir_win32.h
+++ b/indra/llfilesystem/lldir_win32.h
@@ -51,7 +51,7 @@ public:
private:
void* mDirSearch_h{ nullptr };
- llutf16string mCurrentDir;
+ std::wstring mCurrentDir;
};
#endif // LL_LLDIR_WIN32_H
diff --git a/indra/llfilesystem/lldirguard.h b/indra/llfilesystem/lldirguard.h
index fcb179bbc8..c6ce13efb4 100644
--- a/indra/llfilesystem/lldirguard.h
+++ b/indra/llfilesystem/lldirguard.h
@@ -31,6 +31,9 @@
#include "llerror.h"
#if LL_WINDOWS
+
+#include "llwin32headers.h"
+
class LLDirectoryGuard
{
public:
@@ -46,8 +49,8 @@ public:
(wcsncmp(mOrigDir,mFinalDir,mOrigDirLen)!=0))
{
// Dir has changed
- std::string mOrigDirUtf8 = utf16str_to_utf8str(llutf16string(mOrigDir));
- std::string mFinalDirUtf8 = utf16str_to_utf8str(llutf16string(mFinalDir));
+ std::string mOrigDirUtf8 = ll_convert<std::string>(std::wstring(mOrigDir));
+ std::string mFinalDirUtf8 = ll_convert<std::string>(std::wstring(mFinalDir));
LL_INFOS() << "Resetting working dir from " << mFinalDirUtf8 << " to " << mOrigDirUtf8 << LL_ENDL;
SetCurrentDirectory(mOrigDir);
}
diff --git a/indra/llfilesystem/lldiriterator.cpp b/indra/llfilesystem/lldiriterator.cpp
index 61f768c512..e8c37389d2 100644
--- a/indra/llfilesystem/lldiriterator.cpp
+++ b/indra/llfilesystem/lldiriterator.cpp
@@ -52,7 +52,7 @@ LLDirIterator::Impl::Impl(const std::string &dirname, const std::string &mask)
: mIsValid(false)
{
#ifdef LL_WINDOWS // or BOOST_WINDOWS_API
- fs::path dir_path(utf8str_to_utf16str(dirname));
+ fs::path dir_path(ll_convert<std::wstring>(dirname));
#else
fs::path dir_path(dirname);
#endif
diff --git a/indra/llfilesystem/lldiskcache.cpp b/indra/llfilesystem/lldiskcache.cpp
index 49904911a9..e971e1885a 100644
--- a/indra/llfilesystem/lldiskcache.cpp
+++ b/indra/llfilesystem/lldiskcache.cpp
@@ -103,7 +103,7 @@ void LLDiskCache::purge()
std::vector<file_info_t> file_info;
#if LL_WINDOWS
- std::wstring cache_path(utf8str_to_utf16str(sCacheDir));
+ std::wstring cache_path(ll_convert<std::wstring>(sCacheDir));
#else
std::string cache_path(sCacheDir);
#endif
@@ -226,7 +226,7 @@ void LLDiskCache::clearCache()
*/
boost::system::error_code ec;
#if LL_WINDOWS
- std::wstring cache_path(utf8str_to_utf16str(sCacheDir));
+ std::wstring cache_path(ll_convert<std::wstring>(sCacheDir));
#else
std::string cache_path(sCacheDir);
#endif
@@ -259,7 +259,7 @@ void LLDiskCache::removeOldVFSFiles()
boost::system::error_code ec;
#if LL_WINDOWS
- std::wstring cache_path(utf8str_to_utf16str(gDirUtilp->getExpandedFilename(LL_PATH_CACHE, "")));
+ std::wstring cache_path(ll_convert<std::wstring>(gDirUtilp->getExpandedFilename(LL_PATH_CACHE, "")));
#else
std::string cache_path(gDirUtilp->getExpandedFilename(LL_PATH_CACHE, ""));
#endif
@@ -300,7 +300,7 @@ uintmax_t LLDiskCache::dirFileSize(const std::string& dir)
*/
boost::system::error_code ec;
#if LL_WINDOWS
- std::wstring dir_path(utf8str_to_utf16str(dir));
+ std::wstring dir_path(ll_convert<std::wstring>(dir));
#else
std::string dir_path(dir);
#endif
diff --git a/indra/llfilesystem/llfilesystem.cpp b/indra/llfilesystem/llfilesystem.cpp
index c8ce9531c2..5ce5244107 100644
--- a/indra/llfilesystem/llfilesystem.cpp
+++ b/indra/llfilesystem/llfilesystem.cpp
@@ -316,7 +316,7 @@ void LLFileSystem::updateFileAccessTime(const std::string& file_path)
boost::system::error_code ec;
#if LL_WINDOWS
// file last write time
- const std::time_t last_write_time = boost::filesystem::last_write_time(utf8str_to_utf16str(file_path), ec);
+ const std::time_t last_write_time = boost::filesystem::last_write_time(ll_convert<std::wstring>(file_path), ec);
if (ec.failed())
{
LL_WARNS() << "Failed to read last write time for cache file " << file_path << ": " << ec.message() << LL_ENDL;
@@ -330,7 +330,7 @@ void LLFileSystem::updateFileAccessTime(const std::string& file_path)
// before the last one
if (delta_time > time_threshold)
{
- boost::filesystem::last_write_time(utf8str_to_utf16str(file_path), cur_time, ec);
+ boost::filesystem::last_write_time(ll_convert<std::wstring>(file_path), cur_time, ec);
}
#else
// file last write time
diff --git a/indra/llwindow/lldxhardware.cpp b/indra/llwindow/lldxhardware.cpp
index 4bc069c5a4..fc51979eaf 100644
--- a/indra/llwindow/lldxhardware.cpp
+++ b/indra/llwindow/lldxhardware.cpp
@@ -477,7 +477,7 @@ std::string get_string(IDxDiagContainer *containerp, const WCHAR *wszPropName)
WCHAR wszPropValue[256];
get_wstring(containerp, wszPropName, wszPropValue, 256);
- return utf16str_to_utf8str(wszPropValue);
+ return ll_convert<std::string>(std::wstring(wszPropValue));
}
@@ -784,7 +784,7 @@ bool LLDXHardware::getInfo(bool vram_only)
else
{
get_wstring(device_containerp, L"szKeyDeviceID", deviceID, 512);
- LL_WARNS() << "szDeviceID" << deviceID << LL_ENDL;
+ LL_WARNS() << "szDeviceID" << ll_convert<std::string>(std::wstring(deviceID)) << LL_ENDL;
// '+9' to avoid ENUM\\PCI\\ prefix
// Returns string like Enum\\PCI\\VEN_10DE&DEV_1F06&SUBSYS...
// and since GetVideoMemoryViaWMI searches by PNPDeviceID it is sufficient
@@ -1087,7 +1087,7 @@ LLSD LLDXHardware::getDisplayInfo()
// print the value
// windows doesn't guarantee to be null terminated
release_version[RV_SIZE - 1] = NULL;
- ret["DriverVersion"] = utf16str_to_utf8str(release_version);
+ ret["DriverVersion"] = ll_convert<std::string>(std::wstring(release_version));
}
RegCloseKey(hKey);
diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp
index 90713a6653..c7d09f6737 100644
--- a/indra/llwindow/llwindowwin32.cpp
+++ b/indra/llwindow/llwindowwin32.cpp
@@ -786,7 +786,7 @@ LLWindowWin32::LLWindowWin32(LLWindowCallbacks* callbacks,
// }
// SL-12971 dual GPU display
- DISPLAY_DEVICEA display_device;
+ DISPLAY_DEVICE display_device;
int display_index = -1;
DWORD display_flags = 0; // EDD_GET_DEVICE_INTERFACE_NAME ?
const size_t display_bytes = sizeof(display_device);
@@ -797,23 +797,23 @@ LLWindowWin32::LLWindowWin32(LLWindowCallbacks* callbacks,
{
// CHAR DeviceName [ 32] Adapter name
// CHAR DeviceString[128]
- CHAR text[256];
+ WCHAR text[256];
- size_t name_len = strlen(display_device.DeviceName );
- size_t desc_len = strlen(display_device.DeviceString);
+ size_t name_len = lstrlen(display_device.DeviceName );
+ size_t desc_len = lstrlen(display_device.DeviceString);
- const CHAR *name = name_len ? display_device.DeviceName : "???";
- const CHAR *desc = desc_len ? display_device.DeviceString : "???";
+ const WCHAR *name = name_len ? display_device.DeviceName : TEXT("???");
+ const WCHAR *desc = desc_len ? display_device.DeviceString : TEXT("???");
- sprintf(text, "Display Device %d: %s, %s", display_index, name, desc);
- LL_INFOS("Window") << text << LL_ENDL;
+ wsprintf(text, TEXT("Display Device %d: %s, %s"), display_index, name, desc);
+ LL_INFOS("Window") << ll_convert<std::string>(std::wstring(text)) << LL_ENDL;
}
::ZeroMemory(&display_device,display_bytes);
display_device.cb = display_bytes;
display_index++;
- } while( EnumDisplayDevicesA(NULL, display_index, &display_device, display_flags ));
+ } while( EnumDisplayDevices(NULL, display_index, &display_device, display_flags ));
LL_INFOS("Window") << "Total Display Devices: " << display_index << LL_ENDL;
@@ -1934,7 +1934,7 @@ void LLWindowWin32::setTitle(const std::string title)
// to support non-ascii usernames (and region names?)
mWindowThread->post([=]()
{
- SetWindowTextA(mWindowHandle, title.c_str());
+ SetWindowText(mWindowHandle, ll_convert<std::wstring>(title).c_str());
});
}
@@ -3244,7 +3244,7 @@ bool LLWindowWin32::pasteTextFromClipboard(LLWString &dst)
WCHAR *utf16str = (WCHAR*) GlobalLock(h_data);
if (utf16str)
{
- dst = utf16str_to_wstring(utf16str);
+ dst = ll_convert<LLWString>(std::wstring(utf16str));
LLWStringUtil::removeWindowsCR(dst);
GlobalUnlock(h_data);
success = true;
@@ -3269,8 +3269,8 @@ bool LLWindowWin32::copyTextToClipboard(const LLWString& wstr)
// Provide a copy of the data in Unicode format.
LLWString sanitized_string(wstr);
LLWStringUtil::addCRLF(sanitized_string);
- llutf16string out_utf16 = wstring_to_utf16str(sanitized_string);
- const size_t size_utf16 = (out_utf16.length() + 1) * sizeof(WCHAR);
+ std::wstring out_utf16 = ll_convert<std::wstring>(sanitized_string);
+ const size_t size_utf16 = (out_utf16.length() + 1) * sizeof(wchar_t);
// Memory is allocated and then ownership of it is transfered to the system.
HGLOBAL hglobal_copy_utf16 = GlobalAlloc(GMEM_MOVEABLE, size_utf16);
@@ -3632,7 +3632,7 @@ void LLSplashScreenWin32::showImpl()
ShowWindow(mWindow, SW_SHOW);
// Should set taskbar text without creating a header for the window (caption)
- SetWindowTextA(mWindow, "Second Life");
+ SetWindowText(mWindow, TEXT("Second Life"));
}
@@ -3769,8 +3769,7 @@ void LLWindowWin32::spawnWebBrowser(const std::string& escaped_url, bool async)
// reliablly on Vista.
// this is madness.. no, this is..
- LLWString url_wstring = utf8str_to_wstring( escaped_url );
- llutf16string url_utf16 = wstring_to_utf16str( url_wstring );
+ std::wstring url_utf16 = ll_convert<std::wstring>(escaped_url);
// let the OS decide what to use to open the URL
SHELLEXECUTEINFO sei = { sizeof( sei ) };
@@ -4050,7 +4049,7 @@ void LLWindowWin32::fillCompositionLogfont(LOGFONT *logfont)
U32 LLWindowWin32::fillReconvertString(const LLWString &text,
S32 focus, S32 focus_length, RECONVERTSTRING *reconvert_string)
{
- const llutf16string text_utf16 = wstring_to_utf16str(text);
+ const std::wstring text_utf16 = ll_convert<std::wstring>(text);
const DWORD required_size = sizeof(RECONVERTSTRING) + (static_cast<DWORD>(text_utf16.length()) + 1) * sizeof(WCHAR);
if (reconvert_string && reconvert_string->dwSize >= required_size)
{
@@ -4150,7 +4149,7 @@ void LLWindowWin32::handleCompositionMessage(const U32 indexes)
size = LLWinImm::getCompositionString(himc, GCS_RESULTSTR, data, size);
if (size > 0)
{
- result_string = utf16str_to_wstring(llutf16string(data, size / sizeof(WCHAR)));
+ result_string = ll_convert_wide_to_wstring(std::wstring(data, size / sizeof(WCHAR)));
}
delete[] data;
needs_update = true;
@@ -4167,7 +4166,7 @@ void LLWindowWin32::handleCompositionMessage(const U32 indexes)
if (size > 0)
{
preedit_string_utf16_length = size / sizeof(WCHAR);
- preedit_string = utf16str_to_wstring(llutf16string(data, size / sizeof(WCHAR)));
+ preedit_string = ll_convert_wide_to_wstring(std::wstring(data, size / sizeof(WCHAR)));
}
delete[] data;
needs_update = true;
diff --git a/indra/newview/llappviewerwin32.cpp b/indra/newview/llappviewerwin32.cpp
index 023ec3410a..724182a929 100644
--- a/indra/newview/llappviewerwin32.cpp
+++ b/indra/newview/llappviewerwin32.cpp
@@ -253,8 +253,8 @@ void ll_nvapi_init(NvDRSSessionHandle hSession)
NvAPI_UnicodeString profile_name;
std::string app_name = LLTrans::getString("APP_NAME");
- llutf16string w_app_name = utf8str_to_utf16str(app_name);
- wsprintf(profile_name, L"%s", w_app_name.c_str());
+ std::wstring w_app_name = ll_convert<std::wstring>(app_name);
+ wsprintf(reinterpret_cast<wchar_t*>(profile_name), L"%s", w_app_name.c_str());
NvDRSProfileHandle hProfile = 0;
// (3) Check if we already have an application profile for the viewer
status = NvAPI_DRS_FindProfileByName(hSession, profile_name, &hProfile);
@@ -271,7 +271,7 @@ void ll_nvapi_init(NvDRSSessionHandle hSession)
NVDRS_PROFILE profileInfo;
profileInfo.version = NVDRS_PROFILE_VER;
profileInfo.isPredefined = 0;
- wsprintf(profileInfo.profileName, L"%s", w_app_name.c_str());
+ wsprintf(reinterpret_cast<wchar_t*>(profileInfo.profileName), L"%s", w_app_name.c_str());
status = NvAPI_DRS_CreateProfile(hSession, &profileInfo, &hProfile);
if (status != NVAPI_OK)
@@ -286,9 +286,9 @@ void ll_nvapi_init(NvDRSSessionHandle hSession)
NVDRS_APPLICATION profile_application;
profile_application.version = NVDRS_APPLICATION_VER;
- llutf16string w_exe_name = utf8str_to_utf16str(exe_name);
+ std::wstring w_exe_name = ll_convert<std::wstring>(exe_name);
NvAPI_UnicodeString profile_app_name;
- wsprintf(profile_app_name, L"%s", w_exe_name.c_str());
+ wsprintf(reinterpret_cast<wchar_t*>(profile_app_name), L"%s", w_exe_name.c_str());
status = NvAPI_DRS_GetApplicationInfo(hSession, hProfile, profile_app_name, &profile_application);
if (status != NVAPI_OK && status != NVAPI_EXECUTABLE_NOT_FOUND)
@@ -304,10 +304,10 @@ void ll_nvapi_init(NvDRSSessionHandle hSession)
NVDRS_APPLICATION application;
application.version = NVDRS_APPLICATION_VER;
application.isPredefined = 0;
- wsprintf(application.appName, L"%s", w_exe_name.c_str());
- wsprintf(application.userFriendlyName, L"%s", w_exe_name.c_str());
- wsprintf(application.launcher, L"%s", w_exe_name.c_str());
- wsprintf(application.fileInFolder, L"%s", "");
+ wsprintf(reinterpret_cast<wchar_t*>(application.appName), L"%s", w_exe_name.c_str());
+ wsprintf(reinterpret_cast<wchar_t*>(application.userFriendlyName), L"%s", w_exe_name.c_str());
+ wsprintf(reinterpret_cast<wchar_t*>(application.launcher), L"%s", w_exe_name.c_str());
+ wsprintf(reinterpret_cast<wchar_t*>(application.fileInFolder), L"%s", "");
status = NvAPI_DRS_CreateApplication(hSession, hProfile, &application);
if (status != NVAPI_OK)
@@ -580,7 +580,7 @@ void LLAppViewerWin32::disableWinErrorReporting()
{
std::string executable_name = gDirUtilp->getExecutableFilename();
- if( S_OK == WerAddExcludedApplication( utf8str_to_utf16str(executable_name).c_str(), FALSE ) )
+ if( S_OK == WerAddExcludedApplication(ll_convert<std::wstring>(executable_name).c_str(), FALSE ) )
{
LL_INFOS() << "WerAddExcludedApplication() succeeded for " << executable_name << LL_ENDL;
}
diff --git a/indra/newview/llfilepicker.cpp b/indra/newview/llfilepicker.cpp
index 0afb275d13..0dd2c13bb8 100644
--- a/indra/newview/llfilepicker.cpp
+++ b/indra/newview/llfilepicker.cpp
@@ -285,7 +285,7 @@ bool LLFilePicker::getOpenFile(ELoadFilter filter, bool blocking)
success = GetOpenFileName(&mOFN);
if (success)
{
- std::string filename = utf16str_to_utf8str(llutf16string(mFilesW));
+ std::string filename = ll_convert<std::string>(std::wstring(mFilesW));
mFiles.push_back(filename);
}
@@ -351,7 +351,7 @@ bool LLFilePicker::getMultipleOpenFiles(ELoadFilter filter, bool blocking)
// lengths.
if( wcslen(mOFN.lpstrFile) > mOFN.nFileOffset ) /*Flawfinder: ignore*/
{
- std::string filename = utf16str_to_utf8str(llutf16string(mFilesW));
+ std::string filename = ll_convert<std::string>(std::wstring(mFilesW));
mFiles.push_back(filename);
}
else
@@ -365,7 +365,7 @@ bool LLFilePicker::getMultipleOpenFiles(ELoadFilter filter, bool blocking)
break;
if (*tptrw == 0)
tptrw++; // shouldn't happen?
- std::string filename = utf16str_to_utf8str(llutf16string(tptrw));
+ std::string filename = ll_convert<std::string>(std::wstring(tptrw));
if (dirname.empty())
dirname = filename + "\\";
else
@@ -411,7 +411,7 @@ bool LLFilePicker::getSaveFile(ESaveFilter filter, const std::string& filename,
mOFN.lpstrFile = mFilesW;
if (!filename.empty())
{
- llutf16string tstring = utf8str_to_utf16str(filename);
+ std::wstring tstring = ll_convert<std::wstring>(filename);
wcsncpy(mFilesW, tstring.c_str(), FILENAME_BUFFER_SIZE); } /*Flawfinder: ignore*/
else
{
@@ -593,7 +593,7 @@ bool LLFilePicker::getSaveFile(ESaveFilter filter, const std::string& filename,
success = GetSaveFileName(&mOFN);
if (success)
{
- std::string filename = utf16str_to_utf8str(llutf16string(mFilesW));
+ std::string filename = ll_convert<std::string>(std::wstring(mFilesW));
mFiles.push_back(filename);
}
}
diff --git a/indra/newview/llfloaterjoystick.cpp b/indra/newview/llfloaterjoystick.cpp
index 68b11ec92b..871f924316 100644
--- a/indra/newview/llfloaterjoystick.cpp
+++ b/indra/newview/llfloaterjoystick.cpp
@@ -78,7 +78,7 @@ BOOL CALLBACK di8_list_devices_callback(LPCDIDEVICEINSTANCE device_instance_ptr,
// Capable of detecting devices like Oculus Rift
if (device_instance_ptr && pvRef)
{
- std::string product_name = utf16str_to_utf8str(llutf16string(device_instance_ptr->tszProductName));
+ std::string product_name = ll_convert<std::string>(std::wstring(device_instance_ptr->tszProductName));
S32 size = sizeof(GUID);
LLSD::Binary data; //just an std::vector
data.resize(size);
diff --git a/indra/newview/lllocalbitmaps.cpp b/indra/newview/lllocalbitmaps.cpp
index 31c9eb8966..dbddf8e72a 100644
--- a/indra/newview/lllocalbitmaps.cpp
+++ b/indra/newview/lllocalbitmaps.cpp
@@ -191,7 +191,7 @@ bool LLLocalBitmap::updateSelf(EUpdateType optional_firstupdate)
#ifndef LL_WINDOWS
const std::time_t temp_time = boost::filesystem::last_write_time(boost::filesystem::path(mFilename));
#else
- const std::time_t temp_time = boost::filesystem::last_write_time(boost::filesystem::path(utf8str_to_utf16str(mFilename)));
+ const std::time_t temp_time = boost::filesystem::last_write_time(boost::filesystem::path(ll_convert<std::wstring>(mFilename)));
#endif
LLSD new_last_modified = asctime(localtime(&temp_time));
diff --git a/indra/newview/lllocalgltfmaterials.cpp b/indra/newview/lllocalgltfmaterials.cpp
index fab18f2d26..d6facad23d 100644
--- a/indra/newview/lllocalgltfmaterials.cpp
+++ b/indra/newview/lllocalgltfmaterials.cpp
@@ -134,7 +134,7 @@ bool LLLocalGLTFMaterial::updateSelf()
#ifndef LL_WINDOWS
const std::time_t temp_time = boost::filesystem::last_write_time(boost::filesystem::path(mFilename));
#else
- const std::time_t temp_time = boost::filesystem::last_write_time(boost::filesystem::path(utf8str_to_utf16str(mFilename)));
+ const std::time_t temp_time = boost::filesystem::last_write_time(boost::filesystem::path(ll_convert<std::wstring>(mFilename)));
#endif
LLSD new_last_modified = asctime(localtime(&temp_time));
diff --git a/indra/newview/llmachineid.cpp b/indra/newview/llmachineid.cpp
index aa03001389..51c38aba3a 100644
--- a/indra/newview/llmachineid.cpp
+++ b/indra/newview/llmachineid.cpp
@@ -293,7 +293,7 @@ bool LLWMIMethods::getGenericSerialNumber(const BSTR &select, const LPCWSTR &var
if (validate_as_uuid)
{
std::wstring ws(serialNumber, serial_size);
- std::string str = ll_convert_wide_to_string(ws);
+ std::string str = ll_convert<std::string>(ws);
if (!LLUUID::validate(str))
{
@@ -315,7 +315,7 @@ bool LLWMIMethods::getGenericSerialNumber(const BSTR &select, const LPCWSTR &var
continue;
}
}
- LL_INFOS("AppInit") << " Serial Number : " << vtProp.bstrVal << LL_ENDL;
+ LL_INFOS("AppInit") << " Serial Number : " << ll_convert_wide_to_string(std::wstring(vtProp.bstrVal, SysStringLen(vtProp.bstrVal))) << LL_ENDL;
unsigned int j = 0;
diff --git a/indra/newview/llviewerjoystick.cpp b/indra/newview/llviewerjoystick.cpp
index 7543fb3743..13d101f881 100644
--- a/indra/newview/llviewerjoystick.cpp
+++ b/indra/newview/llviewerjoystick.cpp
@@ -144,7 +144,7 @@ BOOL CALLBACK di8_devices_callback(LPCDIDEVICEINSTANCE device_instance_ptr, LPVO
// Capable of detecting devices like Oculus Rift
if (device_instance_ptr)
{
- std::string product_name = utf16str_to_utf8str(llutf16string(device_instance_ptr->tszProductName));
+ std::string product_name = ll_convert<std::string>(std::wstring(device_instance_ptr->tszProductName));
LLSD guid = LLViewerJoystick::getInstance()->getDeviceUUID();
@@ -211,7 +211,7 @@ BOOL CALLBACK di8_devices_callback(LPCDIDEVICEINSTANCE device_instance_ptr, LPVO
// This is GUID2 so teoretically it can be memcpy copied into LLUUID
void guid_from_string(GUID &guid, const std::string &input)
{
- CLSIDFromString(utf8str_to_utf16str(input).c_str(), &guid);
+ CLSIDFromString(ll_convert<std::wstring>(input).c_str(), &guid);
}
std::string string_from_guid(const GUID &guid)
@@ -221,7 +221,7 @@ std::string string_from_guid(const GUID &guid)
// use guidString...
- std::string res = utf16str_to_utf8str(llutf16string(guidString));
+ std::string res = ll_convert<std::string>(std::wstring(guidString));
// ensure memory is freed
::CoTaskMemFree(guidString);
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index 1795d62adc..b8404ec249 100644
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -4773,7 +4773,7 @@ void LLViewerWindow::saveImageLocal(LLImageFormatted *image, const snapshot_save
// Check if there is enough free space to save snapshot
#ifdef LL_WINDOWS
- boost::filesystem::path b_path(utf8str_to_utf16str(lastSnapshotDir));
+ boost::filesystem::path b_path(ll_convert<std::wstring>(lastSnapshotDir));
#else
boost::filesystem::path b_path(lastSnapshotDir);
#endif