diff options
| author | Callum Linden <113564339+callumlinden@users.noreply.github.com> | 2025-09-04 14:51:34 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-09-04 14:51:34 -0700 |
| commit | 66ccfabdd39a8a54a94d5dbf15364ff7f94a13c2 (patch) | |
| tree | fae8bca7bb3f3ac05972803e2fefc05de8542408 /indra/llfilesystem | |
| parent | 0ae3de8f1e78dc74914ea70e725c8324390f3e97 (diff) | |
| parent | 90aa693f2a9ece9f1c624dba245f202e126bca5b (diff) | |
Merge branch 'project/mac_universal' into callum/viewer-cef-2025-08
Diffstat (limited to 'indra/llfilesystem')
| -rw-r--r-- | indra/llfilesystem/lldir.cpp | 4 | ||||
| -rw-r--r-- | indra/llfilesystem/lldir_win32.cpp | 12 | ||||
| -rw-r--r-- | indra/llfilesystem/lldir_win32.h | 2 | ||||
| -rw-r--r-- | indra/llfilesystem/lldirguard.h | 7 | ||||
| -rw-r--r-- | indra/llfilesystem/lldiriterator.cpp | 2 | ||||
| -rw-r--r-- | indra/llfilesystem/lldiskcache.cpp | 8 | ||||
| -rw-r--r-- | indra/llfilesystem/llfilesystem.cpp | 4 | ||||
| -rw-r--r-- | indra/llfilesystem/tests/lldir_test.cpp | 2 |
8 files changed, 22 insertions, 19 deletions
diff --git a/indra/llfilesystem/lldir.cpp b/indra/llfilesystem/lldir.cpp index b80243c22e..ea33a3bb90 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 @@ -197,7 +197,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/llfilesystem/tests/lldir_test.cpp b/indra/llfilesystem/tests/lldir_test.cpp index 6e191ad096..d7d57fa86f 100644 --- a/indra/llfilesystem/tests/lldir_test.cpp +++ b/indra/llfilesystem/tests/lldir_test.cpp @@ -435,7 +435,7 @@ namespace tut for (counter=0, foundUnused=false; !foundUnused; counter++ ) { char counterStr[3]; - sprintf(counterStr, "%02d", counter); + snprintf(counterStr, sizeof(counterStr), "%02d", counter); uniqueDir = dirbase + counterStr; foundUnused = ! ( LLFile::isdir(uniqueDir) || LLFile::isfile(uniqueDir) ); } |
