From 179b29252d8bb28e11686a1852c8e8ffcd98ecc0 Mon Sep 17 00:00:00 2001 From: Rye Date: Tue, 11 Feb 2025 05:02:45 -0500 Subject: Rework windows to use zc:wchar_t for better c++ conformance and compatibility with modern libraries --- autobuild.xml | 150 ++++++++++++++++---------------- indra/llcommon/llapp.cpp | 4 +- indra/llcommon/llerror.cpp | 2 +- indra/llcommon/llfile.cpp | 38 +++----- indra/llcommon/llsys.cpp | 4 +- indra/llcommon/tests/stringize_test.cpp | 12 +++ indra/llcrashlogger/llcrashlock.cpp | 4 +- indra/llfilesystem/lldir.cpp | 4 +- indra/llfilesystem/lldir_win32.cpp | 12 +-- indra/llfilesystem/lldir_win32.h | 2 +- indra/llfilesystem/lldirguard.h | 7 +- indra/llfilesystem/lldiriterator.cpp | 2 +- indra/llfilesystem/lldiskcache.cpp | 8 +- indra/llfilesystem/llfilesystem.cpp | 4 +- indra/llwindow/lldxhardware.cpp | 6 +- indra/llwindow/llwindowwin32.cpp | 37 ++++---- indra/newview/llappviewerwin32.cpp | 20 ++--- indra/newview/llfilepicker.cpp | 10 +-- indra/newview/llfloaterjoystick.cpp | 2 +- indra/newview/lllocalbitmaps.cpp | 2 +- indra/newview/lllocalgltfmaterials.cpp | 2 +- indra/newview/llmachineid.cpp | 4 +- indra/newview/llviewerjoystick.cpp | 6 +- indra/newview/llviewerwindow.cpp | 2 +- 24 files changed, 174 insertions(+), 170 deletions(-) diff --git a/autobuild.xml b/autobuild.xml index ad563eccc6..2d2f221fa0 100644 --- a/autobuild.xml +++ b/autobuild.xml @@ -116,11 +116,11 @@ archive hash - 320a8b76b1d30e5c1e7095c0c8315e8d0b68cbc5 + a4553df5b8fde2e9cd54ebb94c6efb8eb5fe3c38 hash_algorithm sha1 url - https://github.com/secondlife/3p-boost/releases/download/v1.86.0-dfe318c/boost-1.86-darwin64-11977000894.tar.zst + https://github.com/secondlife/3p-boost/releases/download/v1.86.0-be1a669/boost-1.86-darwin64-13246092114.tar.zst name darwin64 @@ -130,11 +130,11 @@ archive hash - 589a3577448190f87dc1c3bb8149ff57780772d8 + 4a2a19dc5cb555e157ad894ba917f5a83a35b20d hash_algorithm sha1 url - https://github.com/secondlife/3p-boost/releases/download/v1.86.0-dfe318c/boost-1.86-linux64-11977000894.tar.zst + https://github.com/secondlife/3p-boost/releases/download/v1.86.0-be1a669/boost-1.86-linux64-13246092114.tar.zst name linux64 @@ -144,11 +144,11 @@ archive hash - 28a268d88e26f081bc2341400ca6a5bc72ac78a8 + 8a1fa9366bfe49009286e4805d7aaedb7c3df82e hash_algorithm sha1 url - https://github.com/secondlife/3p-boost/releases/download/v1.86.0-dfe318c/boost-1.86-windows64-11977000894.tar.zst + https://github.com/secondlife/3p-boost/releases/download/v1.86.0-be1a669/boost-1.86-windows64-13246092114.tar.zst name windows64 @@ -220,11 +220,11 @@ archive hash - 3a8de0ed0611279bd393df1cb224dfd3bbb907b7 + bf2fe4e8272e990bc8687b3b37bf4bb2b2ad6eb4 hash_algorithm sha1 url - https://github.com/secondlife/3p-colladadom/releases/download/v2.3-r9/colladadom-2.3.0-r9-darwin64-12258978859.tar.zst + https://github.com/secondlife/3p-colladadom/releases/download/v2.3-r10/colladadom-2.3.0-r10-darwin64-13259816660.tar.zst name darwin64 @@ -234,11 +234,11 @@ archive hash - c2cc015c86536cb4a77d909af1644e54a031ee6f + 118e509ca464182ef4b94ee8c4aa5b14a6c52a94 hash_algorithm sha1 url - https://github.com/secondlife/3p-colladadom/releases/download/v2.3-r9/colladadom-2.3.0-r9-linux64-12258978859.tar.zst + https://github.com/secondlife/3p-colladadom/releases/download/v2.3-r10/colladadom-2.3.0-r10-linux64-13259816660.tar.zst name linux64 @@ -248,18 +248,18 @@ archive hash - c4807fd3352e6c175f7a28128e0269e524b051cb + d7aee1b2ec17bd88a2c27359281b58a11ec52d48 hash_algorithm sha1 url - https://github.com/secondlife/3p-colladadom/releases/download/v2.3-r9/colladadom-2.3.0-r9-windows64-12258978859.tar.zst + https://github.com/secondlife/3p-colladadom/releases/download/v2.3-r10/colladadom-2.3.0-r10-windows64-13259816660.tar.zst name windows64 version - 2.3.0-r9 + 2.3.0-r10 cubemaptoequirectangular @@ -328,11 +328,11 @@ archive hash - 4f2f5ea4de2891d2ffcc707f984729ddb523d5e1 + e742b1e2d0a58d607b023bf55411041ac65e8a76 hash_algorithm sha1 url - https://github.com/secondlife/3p-curl/releases/download/v7.54.1-r2/curl-7.54.1-12258966289-darwin64-12258966289.tar.zst + https://github.com/secondlife/3p-curl/releases/download/v7.54.1-r3/curl-7.54.1-13259824618-darwin64-13259824618.tar.zst name darwin64 @@ -342,11 +342,11 @@ archive hash - a4d6303c59f9c9760c5243b6d4d7b7b199ba9356 + 49621c70f385d37c95bcb69a9a24d86ac25f4781 hash_algorithm sha1 url - https://github.com/secondlife/3p-curl/releases/download/v7.54.1-r2/curl-7.54.1-12258966289-linux64-12258966289.tar.zst + https://github.com/secondlife/3p-curl/releases/download/v7.54.1-r3/curl-7.54.1-13259824618-linux64-13259824618.tar.zst name linux64 @@ -356,11 +356,11 @@ archive hash - ec0d4717e4b841107b19cab7bd705f327a89f397 + 2522201692116cf0adb7203e169be9126885108c hash_algorithm sha1 url - https://github.com/secondlife/3p-curl/releases/download/v7.54.1-r2/curl-7.54.1-12258966289-windows64-12258966289.tar.zst + https://github.com/secondlife/3p-curl/releases/download/v7.54.1-r3/curl-7.54.1-13259824618-windows64-13259824618.tar.zst name windows64 @@ -373,7 +373,7 @@ copyright Copyright (c) 1996 - 2014, Daniel Stenberg, (daniel@haxx.se). version - 7.54.1-12258966289 + 7.54.1-13259824618 name curl description @@ -644,11 +644,11 @@ archive hash - e079a1b6f47d02ed63ca5cffec79ac75532f6eaf + 5e6c7b9aaf73d90d7feab846a4024193c48eff6c hash_algorithm sha1 url - https://github.com/secondlife/3p-freetype/releases/download/v2.13.3-r2/freetype-2.13.3-r2-darwin64-12259007838.tar.zst + https://github.com/secondlife/3p-freetype/releases/download/v2.13.3-r3/freetype-2.13.3-r3-darwin64-13259804885.tar.zst name darwin64 @@ -658,11 +658,11 @@ archive hash - 6e33a17fb9360a670dfbac51efbe5f4c2bb88c81 + a9a3c371958e64a49b07d7be8f59218dfd6b0352 hash_algorithm sha1 url - https://github.com/secondlife/3p-freetype/releases/download/v2.13.3-r2/freetype-2.13.3-r2-linux64-12259007838.tar.zst + https://github.com/secondlife/3p-freetype/releases/download/v2.13.3-r3/freetype-2.13.3-r3-linux64-13259804885.tar.zst name linux64 @@ -672,18 +672,18 @@ archive hash - 6a543ab76d8e2095f811e46cf4e8a2f454934f77 + ad7fbc4a01607ec43d86035a49dadd43d6f2a4e5 hash_algorithm sha1 url - https://github.com/secondlife/3p-freetype/releases/download/v2.13.3-r2/freetype-2.13.3-r2-windows64-12259007838.tar.zst + https://github.com/secondlife/3p-freetype/releases/download/v2.13.3-r3/freetype-2.13.3-r3-windows64-13259804885.tar.zst name windows64 version - 2.13.3-r2 + 2.13.3-r3 glext @@ -1210,11 +1210,11 @@ archive hash - 75ff1513c5527a541bac0b685a90a49afb086156 + a453355ee032f79aea4142218a957085a22c7656 hash_algorithm sha1 url - https://github.com/secondlife/3p-libpng/releases/download/v1.6.44-r1/libpng-1.6.44-r1-darwin64-11965237099.tar.zst + https://github.com/secondlife/3p-libpng/releases/download/v1.6.44-r2/libpng-1.6.44-r2-darwin64-13246065198.tar.zst name darwin64 @@ -1224,11 +1224,11 @@ archive hash - 23967758d45afc1e2243c3669ca045945de588a7 + 75c7608646c9f5b99b1a9e3946326e2804a304d7 hash_algorithm sha1 url - https://github.com/secondlife/3p-libpng/releases/download/v1.6.44-r1/libpng-1.6.44-r1-linux64-11965237099.tar.zst + https://github.com/secondlife/3p-libpng/releases/download/v1.6.44-r2/libpng-1.6.44-r2-linux64-13246065198.tar.zst name linux64 @@ -1238,11 +1238,11 @@ archive hash - 19ac0a301438a0cbe8cb65179ce9e130f5fd827a + 09af51774c4ee7c03fe67a87dfc52e846aa625ea hash_algorithm sha1 url - https://github.com/secondlife/3p-libpng/releases/download/v1.6.44-r1/libpng-1.6.44-r1-windows64-11965237099.tar.zst + https://github.com/secondlife/3p-libpng/releases/download/v1.6.44-r2/libpng-1.6.44-r2-windows64-13246065198.tar.zst name windows64 @@ -1255,7 +1255,7 @@ copyright Copyright (c) 2004, 2006-2013 Glenn Randers-Pehrson version - 1.6.44-r1 + 1.6.44-r2 name libpng description @@ -1300,11 +1300,11 @@ archive hash - a7062e4feef42461b9acb4bfcef99bea5c89945e + 372c92936d940b1cfb5ba34310691d4bb435c161 hash_algorithm sha1 url - https://github.com/secondlife/3p-libxml2/releases/download/v2.13.5-r1/libxml2-2.13.5-r1-darwin64-11967192668.tar.zst + https://github.com/secondlife/3p-libxml2/releases/download/v2.13.5-r2/libxml2-2.13.5-r2-darwin64-13246071272.tar.zst name darwin64 @@ -1314,11 +1314,11 @@ archive hash - 991aad5931d5f05e43b8750ad81ae59ac6013e59 + ba6fbc34112b1acab1c8615dcd13de983f3678d3 hash_algorithm sha1 url - https://github.com/secondlife/3p-libxml2/releases/download/v2.13.5-r1/libxml2-2.13.5-r1-linux64-11967192668.tar.zst + https://github.com/secondlife/3p-libxml2/releases/download/v2.13.5-r2/libxml2-2.13.5-r2-linux64-13246071272.tar.zst name linux64 @@ -1328,11 +1328,11 @@ archive hash - 4c00019229adc761673808567b8dcd64c7ba4a85 + 71968c4b621636e8ae0c5680e631f4aa67561944 hash_algorithm sha1 url - https://github.com/secondlife/3p-libxml2/releases/download/v2.13.5-r1/libxml2-2.13.5-r1-windows64-11967192668.tar.zst + https://github.com/secondlife/3p-libxml2/releases/download/v2.13.5-r2/libxml2-2.13.5-r2-windows64-13246071272.tar.zst name windows64 @@ -1345,7 +1345,7 @@ copyright Copyright (C) 1998-2012 Daniel Veillard. All Rights Reserved. version - 2.13.5-r1 + 2.13.5-r2 name libxml2 description @@ -1739,11 +1739,11 @@ archive hash - 40ef787f43a47acb18fd06cb9605f2f1ec6273fd + b628d088e1f368a0cd51a6b66292aaf9a025e2d4 hash_algorithm sha1 url - https://github.com/secondlife/3p-minizip-ng/releases/download/v4.0.7-r2/minizip_ng-4.0.7-r2-darwin64-11967198844.tar.zst + https://github.com/secondlife/3p-minizip-ng/releases/download/v4.0.7-r3/minizip_ng-4.0.7-r3-darwin64-13246046977.tar.zst name darwin64 @@ -1753,11 +1753,11 @@ archive hash - 2c403efb5c59e7189b5e86a9001bb4f9e0647f6e + 492ce9175b730d43df63821c4481685e035af623 hash_algorithm sha1 url - https://github.com/secondlife/3p-minizip-ng/releases/download/v4.0.7-r2/minizip_ng-4.0.7-r2-linux64-11967198844.tar.zst + https://github.com/secondlife/3p-minizip-ng/releases/download/v4.0.7-r3/minizip_ng-4.0.7-r3-linux64-13246046977.tar.zst name linux64 @@ -1767,11 +1767,11 @@ archive hash - 18a3d4adf09074f4ed97f7d086b30ce828d3508b + 58773e707ff3490822b7b8217d7729ade2186632 hash_algorithm sha1 url - https://github.com/secondlife/3p-minizip-ng/releases/download/v4.0.7-r2/minizip_ng-4.0.7-r2-windows64-11967198844.tar.zst + https://github.com/secondlife/3p-minizip-ng/releases/download/v4.0.7-r3/minizip_ng-4.0.7-r3-windows64-13246046977.tar.zst name windows64 @@ -1784,7 +1784,7 @@ copyright This project uses the zlib license. Copyright (C) 1995-2013 Jean-loup Gailly and Mark Adler version - 4.0.7-r2 + 4.0.7-r3 name minizip-ng canonical_repo @@ -1857,11 +1857,11 @@ archive hash - dd0c79ac49e5e81cd153d44061c044d1db950fdc + f45ea5a42d6a419f9b605dd3f976fbcb3850d736 hash_algorithm sha1 url - https://github.com/secondlife/3p-nghttp2/releases/download/v1.64.0-r1/nghttp2-1.64.0-r1-darwin64-11965382595.tar.zst + https://github.com/secondlife/3p-nghttp2/releases/download/v1.64.0-r2/nghttp2-1.64.0-r1-darwin64-13184359419.tar.zst name darwin64 @@ -1871,11 +1871,11 @@ archive hash - 0ba810156e0f1ceee8fcc9f9115b91111323fabd + c6e450fa41f24f1b4103d2006d706595f2a36c59 hash_algorithm sha1 url - https://github.com/secondlife/3p-nghttp2/releases/download/v1.64.0-r1/nghttp2-1.64.0-r1-linux64-11965382595.tar.zst + https://github.com/secondlife/3p-nghttp2/releases/download/v1.64.0-r2/nghttp2-1.64.0-r1-linux64-13184359419.tar.zst name linux64 @@ -1885,11 +1885,11 @@ archive hash - 182e03f4ef36eff082c571c33b13111d4cd6c8dd + 3bd92f892e155104740570fe244ea4dbb0b57d4b hash_algorithm sha1 url - https://github.com/secondlife/3p-nghttp2/releases/download/v1.64.0-r1/nghttp2-1.64.0-r1-windows64-11965382595.tar.zst + https://github.com/secondlife/3p-nghttp2/releases/download/v1.64.0-r2/nghttp2-1.64.0-r1-windows64-13184359419.tar.zst name windows64 @@ -2027,11 +2027,11 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors archive hash - 9250e12d4d88f0a437e49be2b32d107f6b4270d0 + a3cc405d48a48a474d05b3de3d28da2005d80037 hash_algorithm sha1 url - https://github.com/secondlife/3p-openal-soft/releases/download/v1.24.0-r1/openal-1.24.0-r1-darwin64-11968917548.tar.zst + https://github.com/secondlife/3p-openal-soft/releases/download/v1.24.2-r1/openal-1.24.2-r1-darwin64-13245988487.tar.zst name darwin64 @@ -2041,11 +2041,11 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors archive hash - 1e50db24586fba434a2be62f94fdc687569379ca + a2b63f0f85ca156c59ee1d34ef96c8e50b89153c hash_algorithm sha1 url - https://github.com/secondlife/3p-openal-soft/releases/download/v1.24.0-r1/openal-1.24.0-r1-linux64-11968917548.tar.zst + https://github.com/secondlife/3p-openal-soft/releases/download/v1.24.2-r1/openal-1.24.2-r1-linux64-13245988487.tar.zst name linux64 @@ -2055,11 +2055,11 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors archive hash - 2ec7b2b1f4c37e5bd1b473e4a26935ec374ee208 + 8ad24fba1191c9cb0d2ab36e64b04b4648a99f43 hash_algorithm sha1 url - https://github.com/secondlife/3p-openal-soft/releases/download/v1.24.0-r1/openal-1.24.0-r1-windows64-11968917548.tar.zst + https://github.com/secondlife/3p-openal-soft/releases/download/v1.24.2-r1/openal-1.24.2-r1-windows64-13245988487.tar.zst name windows64 @@ -2072,7 +2072,7 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors copyright Copyright (C) 1999-2007 by authors. version - 1.24.0-r1 + 1.24.2-r1 name openal description @@ -2147,11 +2147,11 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors archive hash - f6fdad42168b30932384310866642b072465af11 + 157193699127ac5056c5fc1a410f9c98d39731e2 hash_algorithm sha1 url - https://github.com/secondlife/3p-openssl/releases/download/v1.1.1w-r2/openssl-1.1.1w-r2-darwin64-11965633361.tar.zst + https://github.com/secondlife/3p-openssl/releases/download/v1.1.1w-r3/openssl-1.1.1w-r3-darwin64-13246054022.tar.zst name darwin64 @@ -2161,11 +2161,11 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors archive hash - 7a5048c806b053768c461d6dbac854324a597ee0 + 2e29c127dbd002d64ae55bc000f8b6ed0249fad7 hash_algorithm sha1 url - https://github.com/secondlife/3p-openssl/releases/download/v1.1.1w-r2/openssl-1.1.1w-r2-linux64-11965633361.tar.zst + https://github.com/secondlife/3p-openssl/releases/download/v1.1.1w-r3/openssl-1.1.1w-r3-linux64-13246054022.tar.zst name linux64 @@ -2175,11 +2175,11 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors archive hash - 3d16fa02ca44a6a1eeeb7c83d62af2dc8ef2e7e9 + ae9ced89051e03a99628c99b9ac78530fdea1e5a hash_algorithm sha1 url - https://github.com/secondlife/3p-openssl/releases/download/v1.1.1w-r2/openssl-1.1.1w-r2-windows64-11965633361.tar.zst + https://github.com/secondlife/3p-openssl/releases/download/v1.1.1w-r3/openssl-1.1.1w-r3-windows64-13246054022.tar.zst name windows64 @@ -2192,7 +2192,7 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors copyright Copyright (c) 1998-2011 The OpenSSL Project. All rights reserved; Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) version - 1.1.1w-r2 + 1.1.1w-r3 name openssl description @@ -2825,11 +2825,11 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors archive hash - 4d437afc7fc3988cf0c78ed05853a211cc6bf8b8 + e363e3b889c52fda7601d7aeaa9832307034651e hash_algorithm sha1 url - https://github.com/secondlife/3p-zlib-ng/releases/download/v2.2.2-r1/zlib_ng-2.2.2-dev0.gcaa101e.d20241120-darwin64-11943461931.tar.zst + https://github.com/secondlife/3p-zlib-ng/releases/download/v2.2.3-r1/zlib_ng-2.2.3-dev0.g8aa13e3.d20250206-darwin64-13183604450.tar.zst name darwin64 @@ -2839,11 +2839,11 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors archive hash - 70c1d8728b85481bd42904c1213ed50264e77be1 + 3cdd52f7fb3691789d50f0b40ed6f5642321ff32 hash_algorithm sha1 url - https://github.com/secondlife/3p-zlib-ng/releases/download/v2.2.2-r1/zlib_ng-2.2.2-dev0.gcaa101e.d20241120-linux64-11943461931.tar.zst + https://github.com/secondlife/3p-zlib-ng/releases/download/v2.2.3-r1/zlib_ng-2.2.3-dev0.g8aa13e3.d20250206-linux64-13183604450.tar.zst name linux64 @@ -2853,11 +2853,11 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors archive hash - f98c30b20120511ecceab8bf1b5eba048b10aade + e802a28139328bb2421ad39e13d996d350d8106d hash_algorithm sha1 url - https://github.com/secondlife/3p-zlib-ng/releases/download/v2.2.2-r1/zlib_ng-2.2.2-dev0.gcaa101e.d20241120-windows64-11943461931.tar.zst + https://github.com/secondlife/3p-zlib-ng/releases/download/v2.2.3-r1/zlib_ng-2.2.3-dev0.g8aa13e3.d20250206-windows64-13183604450.tar.zst name windows64 @@ -2870,7 +2870,7 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors copyright Copyright (C) 1995-2013 Jean-loup Gailly and Mark Adler version - 2.2.2-dev0.gcaa101e.d20241120 + 2.2.3-dev0.g8aa13e3.d20250206 name zlib-ng canonical_repo 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(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(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(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(filename); + std::wstring utf16mode = ll_convert(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(filename); + std::wstring utf16mode = ll_convert(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(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(filename); + std::wstring utf16newname = ll_convert(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(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( _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(_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( _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( _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(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(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(wstringize(c)), ll_convert(std::wstring(L"c"))); + ensure_equals(ll_convert(wstringize(s)), ll_convert(std::wstring(L"17"))); + ensure_equals(ll_convert(wstringize(i)), ll_convert(std::wstring(L"34"))); + ensure_equals(ll_convert(wstringize(l)), ll_convert(std::wstring(L"68"))); + ensure_equals(ll_convert(wstringize(f)), ll_convert(std::wstring(L"3.14159"))); + ensure_equals(ll_convert(wstringize(d)), ll_convert(std::wstring(L"3.14159"))); + ensure_equals(ll_convert(wstringize(abc)), ll_convert(std::wstring(L"abc def"))); + ensure_equals(ll_convert(wstringize(abc)), ll_convert(wstringize(abc.c_str()))); + ensure_equals(ll_convert(wstringize(def)), ll_convert(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(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(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 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(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(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::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::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::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(dirname); + pathname += ll_convert(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::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::wstring(mOrigDir)); + std::string mFinalDirUtf8 = ll_convert(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(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; #if LL_WINDOWS - std::wstring cache_path(utf8str_to_utf16str(sCacheDir)); + std::wstring cache_path(ll_convert(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(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(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(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(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(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::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::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::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::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(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(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(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(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(text); const DWORD required_size = sizeof(RECONVERTSTRING) + (static_cast(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(app_name); + wsprintf(reinterpret_cast(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(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(exe_name); NvAPI_UnicodeString profile_app_name; - wsprintf(profile_app_name, L"%s", w_exe_name.c_str()); + wsprintf(reinterpret_cast(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(application.appName), L"%s", w_exe_name.c_str()); + wsprintf(reinterpret_cast(application.userFriendlyName), L"%s", w_exe_name.c_str()); + wsprintf(reinterpret_cast(application.launcher), L"%s", w_exe_name.c_str()); + wsprintf(reinterpret_cast(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(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::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::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::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(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::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::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(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(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(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::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(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::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(lastSnapshotDir)); #else boost::filesystem::path b_path(lastSnapshotDir); #endif -- cgit v1.2.3