From 7429ee1f84161103affefa97a7d4f40803445364 Mon Sep 17 00:00:00 2001 From: Rye Date: Tue, 28 Oct 2025 09:28:55 -0400 Subject: Fix multiple unicode file io handling issues with llofstream and llifstream Signed-off-by: Rye --- indra/test/test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/test/test.cpp') diff --git a/indra/test/test.cpp b/indra/test/test.cpp index 172b6e3542..b611e52835 100644 --- a/indra/test/test.cpp +++ b/indra/test/test.cpp @@ -108,7 +108,7 @@ public: void replay(std::ostream& out) { mFile.close(); - std::ifstream inf(mTempFile.getName().c_str()); + llifstream inf(mTempFile.getName().c_str()); std::string line; while (std::getline(inf, line)) { -- cgit v1.3 From 76837f96554a683462bb9a28457b7b0d9c078bff Mon Sep 17 00:00:00 2001 From: Rye Date: Sun, 2 Nov 2025 01:05:40 -0500 Subject: Fix support for setting thread names on linux and macos Signed-off-by: Rye --- .../llimage_libtest/llimage_libtest.cpp | 5 +++ indra/llappearanceutility/appearance_utility.cpp | 5 +++ indra/llcommon/llthread.cpp | 46 ++++++++++------------ indra/llcommon/llthread.h | 8 +--- indra/llcommon/threadpool.cpp | 1 + indra/llcorehttp/_httpservice.cpp | 3 +- indra/test/test.cpp | 5 +++ 7 files changed, 40 insertions(+), 33 deletions(-) (limited to 'indra/test/test.cpp') diff --git a/indra/integration_tests/llimage_libtest/llimage_libtest.cpp b/indra/integration_tests/llimage_libtest/llimage_libtest.cpp index 1bd1bb2d2b..b82ced2f8d 100644 --- a/indra/integration_tests/llimage_libtest/llimage_libtest.cpp +++ b/indra/integration_tests/llimage_libtest/llimage_libtest.cpp @@ -345,6 +345,11 @@ public: int main(int argc, char** argv) { + // Call Tracy first thing to have it allocate memory + // https://github.com/wolfpld/tracy/issues/196 + LL_PROFILER_FRAME_END; + LL_PROFILER_SET_THREAD_NAME("App"); + // List of input and output files std::list input_filenames; std::list output_filenames; diff --git a/indra/llappearanceutility/appearance_utility.cpp b/indra/llappearanceutility/appearance_utility.cpp index 88034cd171..a9a310eb89 100644 --- a/indra/llappearanceutility/appearance_utility.cpp +++ b/indra/llappearanceutility/appearance_utility.cpp @@ -34,6 +34,11 @@ int main(int argc, char** argv) { + // Call Tracy first thing to have it allocate memory + // https://github.com/wolfpld/tracy/issues/196 + LL_PROFILER_FRAME_END; + LL_PROFILER_SET_THREAD_NAME("App"); + // Create an application instance. ll_init_apr(); LLAppAppearanceUtility* app = new LLAppAppearanceUtility(argc, argv); diff --git a/indra/llcommon/llthread.cpp b/indra/llcommon/llthread.cpp index 692941a892..e1f0d531cf 100644 --- a/indra/llcommon/llthread.cpp +++ b/indra/llcommon/llthread.cpp @@ -42,6 +42,10 @@ #include #endif +#if LL_DARWIN || LL_LINUX +#include +#endif + #ifdef LL_WINDOWS @@ -56,25 +60,32 @@ typedef struct tagTHREADNAME_INFO DWORD dwFlags; // Reserved for future use, must be zero. } THREADNAME_INFO; #pragma pack(pop) +#endif -void set_thread_name( DWORD dwThreadID, const char* threadName) +void set_thread_name(const char* threadName) { +#if LL_WINDOWS THREADNAME_INFO info; - info.dwType = 0x1000; - info.szName = threadName; - info.dwThreadID = dwThreadID; - info.dwFlags = 0; + info.dwType = 0x1000; + info.szName = threadName; + info.dwThreadID = GetCurrentThreadId(); + info.dwFlags = 0; __try { - ::RaiseException( MS_VC_EXCEPTION, 0, sizeof(info)/sizeof(DWORD), (ULONG_PTR*)&info ); + ::RaiseException(MS_VC_EXCEPTION, 0, sizeof(info) / sizeof(DWORD), (ULONG_PTR*)&info); } - __except(EXCEPTION_CONTINUE_EXECUTION) + __except (EXCEPTION_CONTINUE_EXECUTION) { } -} +#elif LL_DARWIN + std::string truncated_name(std::string_view(threadName).substr(0, 15)); + pthread_setname_np(truncated_name.c_str()); +#elif LL_LINUX + std::string truncated_name(std::string_view(threadName).substr(0, 15)); + pthread_setname_np(pthread_self(), truncated_name.c_str()); #endif - +} //---------------------------------------------------------------------------- // Usage: @@ -148,27 +159,12 @@ LL_COMMON_API bool assert_main_thread() return false; } -// this function has become moot -void LLThread::registerThreadID() {} - // // Handed to the APR thread creation function // void LLThread::threadRun() { -#ifdef LL_WINDOWS - set_thread_name(-1, mName.c_str()); - -#if 0 // probably a bad idea, see usage of SetThreadIdealProcessor in LLWindowWin32) - HANDLE hThread = GetCurrentThread(); - if (hThread) - { - SetThreadAffinityMask(hThread, (DWORD_PTR) 0xFFFFFFFFFFFFFFFE); - } -#endif - -#endif - + set_thread_name(mName.c_str()); LL_PROFILER_SET_THREAD_NAME( mName.c_str() ); // this is the first point at which we're actually running in the new thread diff --git a/indra/llcommon/llthread.h b/indra/llcommon/llthread.h index 8794ac93aa..b97d479abc 100644 --- a/indra/llcommon/llthread.h +++ b/indra/llcommon/llthread.h @@ -28,10 +28,11 @@ #define LL_LLTHREAD_H #include "llapr.h" -#include "boost/intrusive_ptr.hpp" #include "llrefcount.h" #include +extern void set_thread_name(const char* threadName); + namespace LLTrace { class ThreadRecorder; @@ -86,11 +87,6 @@ public: id_t getID() const { return mID; } - // Called by threads *not* created via LLThread to register some - // internal state used by LLMutex. You must call this once early - // in the running thread to prevent collisions with the main thread. - static void registerThreadID(); - private: bool mPaused; std::thread::native_handle_type mNativeHandle; // for termination in case of issues diff --git a/indra/llcommon/threadpool.cpp b/indra/llcommon/threadpool.cpp index 451e60c083..6adbdffba8 100644 --- a/indra/llcommon/threadpool.cpp +++ b/indra/llcommon/threadpool.cpp @@ -78,6 +78,7 @@ void LL::ThreadPoolBase::start() std::string tname{ stringize(mName, ':', (i+1), '/', mThreadCount) }; mThreads.emplace_back(tname, [this, tname]() { + set_thread_name(tname.c_str()); LL_PROFILER_SET_THREAD_NAME(tname.c_str()); run(tname); }); diff --git a/indra/llcorehttp/_httpservice.cpp b/indra/llcorehttp/_httpservice.cpp index 5880fb7e87..03a2eab8e3 100644 --- a/indra/llcorehttp/_httpservice.cpp +++ b/indra/llcorehttp/_httpservice.cpp @@ -283,12 +283,11 @@ void HttpService::shutdown() // requested to stop. void HttpService::threadRun(LLCoreInt::HttpThread * thread) { + set_thread_name("HttpService"); LL_PROFILER_SET_THREAD_NAME("HttpService"); boost::this_thread::disable_interruption di; - LLThread::registerThreadID(); - ELoopSpeed loop(REQUEST_SLEEP); while (! mExitRequested) { diff --git a/indra/test/test.cpp b/indra/test/test.cpp index b611e52835..bf685ef20f 100644 --- a/indra/test/test.cpp +++ b/indra/test/test.cpp @@ -505,6 +505,11 @@ static LLTrace::ThreadRecorder* sMasterThreadRecorder = NULL; int main(int argc, char **argv) { + // Call Tracy first thing to have it allocate memory + // https://github.com/wolfpld/tracy/issues/196 + LL_PROFILER_FRAME_END; + LL_PROFILER_SET_THREAD_NAME("App"); + ll_init_apr(); apr_getopt_t* os = NULL; if(APR_SUCCESS != apr_getopt_init(&os, gAPRPoolp, argc, argv)) -- cgit v1.3 From 2d40a1cfa9930f96570cccf415f6038d6dcc657c Mon Sep 17 00:00:00 2001 From: Rye Date: Mon, 15 Dec 2025 17:41:05 -0500 Subject: Clean up dead legacy headers and compiler work arounds Clean up dead macos files Clean up dead windows build files Signed-off-by: Rye --- indra/llcommon/CMakeLists.txt | 3 - indra/llcommon/ctype_workaround.h | 54 ------- indra/llcommon/fix_macros.h | 21 --- indra/llcommon/llapr.h | 2 +- indra/llcommon/llcond.h | 2 +- indra/llcommon/llcoros.h | 2 +- indra/llcommon/llfixedbuffer.h | 2 +- indra/llcommon/llinstancetracker.h | 2 +- indra/llcommon/llmutex.h | 2 +- indra/llcommon/llsingleton.h | 2 +- indra/llcommon/llthreadsafequeue.h | 2 +- indra/llcommon/lockstatic.h | 2 +- indra/llcommon/mutex.h | 22 --- indra/llcommon/timer.h | 26 ---- indra/llcorehttp/_refcounted.h | 1 - indra/llfilesystem/lldiriterator.cpp | 1 - indra/llmath/CMakeLists.txt | 2 - indra/llmath/camera.h | 27 ---- indra/llmath/coordframe.h | 27 ---- indra/llwindow/llwindowmacosx.h | 5 - indra/newview/CMakeLists.txt | 2 - indra/newview/Info-SecondLifeVorbis.plist | 28 ---- indra/newview/VertexCache.h | 105 -------------- indra/newview/VorbisFramework.h | 80 ----------- indra/newview/build_win32_appConfig.py | 68 --------- indra/newview/lllocalbitmaps.cpp | 2 - indra/newview/lllocalgltfmaterials.cpp | 2 - indra/newview/macutil_Prefix.h | 38 ----- indra/newview/macview_Prefix.h | 229 ------------------------------ indra/test/test.cpp | 11 -- 30 files changed, 9 insertions(+), 763 deletions(-) delete mode 100644 indra/llcommon/ctype_workaround.h delete mode 100644 indra/llcommon/fix_macros.h delete mode 100644 indra/llcommon/mutex.h delete mode 100644 indra/llcommon/timer.h delete mode 100644 indra/llmath/camera.h delete mode 100644 indra/llmath/coordframe.h delete mode 100644 indra/newview/Info-SecondLifeVorbis.plist delete mode 100644 indra/newview/VertexCache.h delete mode 100644 indra/newview/VorbisFramework.h delete mode 100755 indra/newview/build_win32_appConfig.py delete mode 100644 indra/newview/macutil_Prefix.h delete mode 100644 indra/newview/macview_Prefix.h (limited to 'indra/test/test.cpp') diff --git a/indra/llcommon/CMakeLists.txt b/indra/llcommon/CMakeLists.txt index 7311c6faf6..980b8ca05c 100644 --- a/indra/llcommon/CMakeLists.txt +++ b/indra/llcommon/CMakeLists.txt @@ -117,8 +117,6 @@ set(llcommon_HEADER_FILES chrono.h classic_callback.h commoncontrol.h - ctype_workaround.h - fix_macros.h fsyspath.h function_types.h indra_constants.h @@ -249,7 +247,6 @@ set(llcommon_HEADER_FILES threadpool.h threadpool_fwd.h threadsafeschedule.h - timer.h tuple.h u64.h workqueue.h diff --git a/indra/llcommon/ctype_workaround.h b/indra/llcommon/ctype_workaround.h deleted file mode 100644 index 89a47fe3db..0000000000 --- a/indra/llcommon/ctype_workaround.h +++ /dev/null @@ -1,54 +0,0 @@ -/** - * @file ctype_workaround.h - * @brief The workaround is to create some legacy symbols that point - * to the correct symbols, which avoids link errors. - * - * $LicenseInfo:firstyear=2006&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef _CTYPE_WORKAROUND_H_ -#define _CTYPE_WORKAROUND_H_ - -/** - * the CTYPE_WORKAROUND is needed for linux dev stations that don't - * have the broken libc6 packages needed by our out-of-date static - * libs (such as libcrypto and libcurl). - * - * -- Leviathan 20060113 -*/ - -#include - -__const unsigned short int *__ctype_b; -__const __int32_t *__ctype_tolower; -__const __int32_t *__ctype_toupper; - -// call this function at the beginning of main() -void ctype_workaround() -{ - __ctype_b = *(__ctype_b_loc()); - __ctype_toupper = *(__ctype_toupper_loc()); - __ctype_tolower = *(__ctype_tolower_loc()); -} - -#endif - diff --git a/indra/llcommon/fix_macros.h b/indra/llcommon/fix_macros.h deleted file mode 100644 index ed6c26a371..0000000000 --- a/indra/llcommon/fix_macros.h +++ /dev/null @@ -1,21 +0,0 @@ -/** - * @file fix_macros.h - * @author Nat Goodspeed - * @date 2012-11-16 - * @brief The Mac system headers seem to #define macros with obnoxiously - * generic names, preventing any library from using those names. We've - * had to fix these in so many places that it's worth making a header - * file to handle it. - * - * $LicenseInfo:firstyear=2012&license=viewerlgpl$ - * Copyright (c) 2012, Linden Research, Inc. - * $/LicenseInfo$ - */ - -// DON'T use an #include guard: every time we encounter this header, #undef -// these macros all over again. - -// who injects MACROS with such generic names?! Grr. -#ifdef check -#undef check -#endif diff --git a/indra/llcommon/llapr.h b/indra/llcommon/llapr.h index 11e474b5dd..0e1e4277e7 100644 --- a/indra/llcommon/llapr.h +++ b/indra/llcommon/llapr.h @@ -40,7 +40,7 @@ #include "llstring.h" -#include "mutex.h" +#include struct apr_dso_handle_t; /** diff --git a/indra/llcommon/llcond.h b/indra/llcommon/llcond.h index 2df1719941..b72ea33dea 100644 --- a/indra/llcommon/llcond.h +++ b/indra/llcommon/llcond.h @@ -17,7 +17,7 @@ #include "llunits.h" #include "llcoros.h" #include LLCOROS_MUTEX_HEADER -#include "mutex.h" +#include #include /** diff --git a/indra/llcommon/llcoros.h b/indra/llcommon/llcoros.h index 9df52b6ed5..602c65b9ba 100644 --- a/indra/llcommon/llcoros.h +++ b/indra/llcommon/llcoros.h @@ -34,10 +34,10 @@ #include #include #include -#include "mutex.h" #include "llsingleton.h" #include "llinstancetracker.h" #include +#include #include #include #include diff --git a/indra/llcommon/llfixedbuffer.h b/indra/llcommon/llfixedbuffer.h index 1234d2014f..d2cd660c18 100644 --- a/indra/llcommon/llfixedbuffer.h +++ b/indra/llcommon/llfixedbuffer.h @@ -27,7 +27,7 @@ #ifndef LL_LLFIXEDBUFFER_H #define LL_LLFIXEDBUFFER_H -#include "timer.h" +#include "lltimer.h" #include #include #include "llstring.h" diff --git a/indra/llcommon/llinstancetracker.h b/indra/llcommon/llinstancetracker.h index 5a7f27e688..734365767d 100644 --- a/indra/llcommon/llinstancetracker.h +++ b/indra/llcommon/llinstancetracker.h @@ -37,7 +37,7 @@ #include #include -#include "mutex.h" +#include #include #include diff --git a/indra/llcommon/llmutex.h b/indra/llcommon/llmutex.h index f3615a1270..bc3d8fed06 100644 --- a/indra/llcommon/llmutex.h +++ b/indra/llcommon/llmutex.h @@ -30,7 +30,7 @@ #include "stdtypes.h" #include "llthread.h" -#include "mutex.h" +#include #include #include #include diff --git a/indra/llcommon/llsingleton.h b/indra/llcommon/llsingleton.h index 3fba8602ee..81e69ab63c 100644 --- a/indra/llcommon/llsingleton.h +++ b/indra/llcommon/llsingleton.h @@ -30,7 +30,7 @@ #include #include #include -#include "mutex.h" +#include #include "lockstatic.h" #include "llthread.h" // on_main_thread() #include "llmainthreadtask.h" diff --git a/indra/llcommon/llthreadsafequeue.h b/indra/llcommon/llthreadsafequeue.h index 1a1d06a6fd..2a18b4a438 100644 --- a/indra/llcommon/llthreadsafequeue.h +++ b/indra/llcommon/llthreadsafequeue.h @@ -32,7 +32,7 @@ #include #include LLCOROS_CONDVAR_HEADER #include "llexception.h" -#include "mutex.h" +#include #include #include #include diff --git a/indra/llcommon/lockstatic.h b/indra/llcommon/lockstatic.h index 7cc9b7eec0..db4c7af0ec 100644 --- a/indra/llcommon/lockstatic.h +++ b/indra/llcommon/lockstatic.h @@ -13,7 +13,7 @@ #if ! defined(LL_LOCKSTATIC_H) #define LL_LOCKSTATIC_H -#include "mutex.h" // std::unique_lock +#include // std::unique_lock namespace llthread { diff --git a/indra/llcommon/mutex.h b/indra/llcommon/mutex.h deleted file mode 100644 index 82e46315e2..0000000000 --- a/indra/llcommon/mutex.h +++ /dev/null @@ -1,22 +0,0 @@ -/** - * @file mutex.h - * @author Nat Goodspeed - * @date 2019-12-03 - * @brief Wrap in odious boilerplate - * - * $LicenseInfo:firstyear=2019&license=viewerlgpl$ - * Copyright (c) 2019, Linden Research, Inc. - * $/LicenseInfo$ - */ - -#if LL_WINDOWS -#pragma warning (push) -#pragma warning (disable:4265) -#endif -// warning C4265: 'std::_Pad' : class has virtual functions, but destructor is not virtual - -#include - -#if LL_WINDOWS -#pragma warning (pop) -#endif diff --git a/indra/llcommon/timer.h b/indra/llcommon/timer.h deleted file mode 100644 index aaa0cf0775..0000000000 --- a/indra/llcommon/timer.h +++ /dev/null @@ -1,26 +0,0 @@ -/** - * @file timer.h - * @brief Legacy wrapper header. - * - * $LicenseInfo:firstyear=2000&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ -#include "lltimer.h" diff --git a/indra/llcorehttp/_refcounted.h b/indra/llcorehttp/_refcounted.h index 1a01d66d14..bc90f8274d 100644 --- a/indra/llcorehttp/_refcounted.h +++ b/indra/llcorehttp/_refcounted.h @@ -30,7 +30,6 @@ #include "linden_common.h" -#include "fix_macros.h" #include #include "llatomic.h" diff --git a/indra/llfilesystem/lldiriterator.cpp b/indra/llfilesystem/lldiriterator.cpp index b736a577bd..57d4912c94 100644 --- a/indra/llfilesystem/lldiriterator.cpp +++ b/indra/llfilesystem/lldiriterator.cpp @@ -28,7 +28,6 @@ #include "lldiriterator.h" -#include "fix_macros.h" #include "llregex.h" #include diff --git a/indra/llmath/CMakeLists.txt b/indra/llmath/CMakeLists.txt index fb57e5db11..a4e4d0a50b 100644 --- a/indra/llmath/CMakeLists.txt +++ b/indra/llmath/CMakeLists.txt @@ -46,8 +46,6 @@ set(llmath_SOURCE_FILES set(llmath_HEADER_FILES CMakeLists.txt - camera.h - coordframe.h llbbox.h llbboxlocal.h llcalc.h diff --git a/indra/llmath/camera.h b/indra/llmath/camera.h deleted file mode 100644 index 14a08c5985..0000000000 --- a/indra/llmath/camera.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * @file camera.h - * @brief Legacy wrapper header. - * - * $LicenseInfo:firstyear=2000&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#include "llcamera.h" diff --git a/indra/llmath/coordframe.h b/indra/llmath/coordframe.h deleted file mode 100644 index e7395b1212..0000000000 --- a/indra/llmath/coordframe.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * @file coordframe.h - * @brief Legacy wrapper header. - * - * $LicenseInfo:firstyear=2000&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#include "llcoordframe.h" diff --git a/indra/llwindow/llwindowmacosx.h b/indra/llwindow/llwindowmacosx.h index d703a84d02..dc8b7504c9 100644 --- a/indra/llwindow/llwindowmacosx.h +++ b/indra/llwindow/llwindowmacosx.h @@ -36,11 +36,6 @@ #include #include -// AssertMacros.h does bad things. -#include "fix_macros.h" -#undef verify -#undef require - class LLWindowMacOSX : public LLWindow { public: diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 09fb54faf4..c2b1473e8f 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -1430,8 +1430,6 @@ set(viewer_HEADER_FILES noise.h pipeline.h roles_constants.h - VertexCache.h - VorbisFramework.h ) source_group("CMake Rules" FILES ViewerInstall.cmake) diff --git a/indra/newview/Info-SecondLifeVorbis.plist b/indra/newview/Info-SecondLifeVorbis.plist deleted file mode 100644 index 9cb367eec1..0000000000 --- a/indra/newview/Info-SecondLifeVorbis.plist +++ /dev/null @@ -1,28 +0,0 @@ - - - - - CFBundleDevelopmentRegion - English - CFBundleExecutable - SecondLifeVorbis - CFBundleGetInfoString - - CFBundleIconFile - - CFBundleIdentifier - com.secondlife.indra.vorbis - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - SecondLifeVorbis - CFBundlePackageType - FMWK - CFBundleShortVersionString - - CFBundleSignature - ???? - CFBundleVersion - 0.0.1d1 - - diff --git a/indra/newview/VertexCache.h b/indra/newview/VertexCache.h deleted file mode 100644 index edb231feb1..0000000000 --- a/indra/newview/VertexCache.h +++ /dev/null @@ -1,105 +0,0 @@ -/** - * @file VertexCache.h - * @brief VertexCache class definition - * - * $LicenseInfo:firstyear=2002&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - - -#ifndef VERTEX_CACHE_H - -#define VERTEX_CACHE_H - -class VertexCache -{ - -public: - - VertexCache(int size) - { - numEntries = size; - - entries = new int[numEntries]; - - for(int i = 0; i < numEntries; i++) - entries[i] = -1; - } - - VertexCache() { VertexCache(16); } - ~VertexCache() { delete[] entries; entries = 0; } - - bool InCache(int entry) - { - bool returnVal = false; - for(int i = 0; i < numEntries; i++) - { - if(entries[i] == entry) - { - returnVal = true; - break; - } - } - - return returnVal; - } - - int AddEntry(int entry) - { - int removed; - - removed = entries[numEntries - 1]; - - //push everything right one - for(int i = numEntries - 2; i >= 0; i--) - { - entries[i + 1] = entries[i]; - } - - entries[0] = entry; - - return removed; - } - - void Clear() - { - memset(entries, -1, sizeof(int) * numEntries); - } - - void Copy(VertexCache* inVcache) - { - for(int i = 0; i < numEntries; i++) - { - inVcache->Set(i, entries[i]); - } - } - - int At(int index) { return entries[index]; } - void Set(int index, int value) { entries[index] = value; } - -private: - - int *entries; - int numEntries; - -}; - -#endif diff --git a/indra/newview/VorbisFramework.h b/indra/newview/VorbisFramework.h deleted file mode 100644 index 7ee9a8c411..0000000000 --- a/indra/newview/VorbisFramework.h +++ /dev/null @@ -1,80 +0,0 @@ -/** - * @file VorbisFramework.h - * @author Dave Camp - * @date Fri Oct 10 2003 - * @brief For the Macview project - * - * $LicenseInfo:firstyear=2003&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "ogg/ogg.h" -#include "vorbis/codec.h" -#include "vorbis/vorbisenc.h" - -extern int mac_vorbis_analysis(vorbis_block *vb,ogg_packet *op); - -extern int mac_vorbis_analysis_headerout(vorbis_dsp_state *v, - vorbis_comment *vc, - ogg_packet *op, - ogg_packet *op_comm, - ogg_packet *op_code); - -extern int mac_vorbis_analysis_init(vorbis_dsp_state *v,vorbis_info *vi); - -extern int mac_vorbis_encode_ctl(vorbis_info *vi,int number,void *arg); - -extern int mac_vorbis_encode_setup_init(vorbis_info *vi); - -extern int mac_vorbis_encode_setup_managed(vorbis_info *vi, - long channels, - long rate, - - long max_bitrate, - long nominal_bitrate, - long min_bitrate); - -extern void mac_vorbis_info_init(vorbis_info *vi); -extern void mac_vorbis_info_clear(vorbis_info *vi); -extern void mac_vorbis_comment_init(vorbis_comment *vc); -extern void mac_vorbis_comment_clear(vorbis_comment *vc); -extern int mac_vorbis_block_init(vorbis_dsp_state *v, vorbis_block *vb); -extern int mac_vorbis_block_clear(vorbis_block *vb); -extern void mac_vorbis_dsp_clear(vorbis_dsp_state *v); -extern float **mac_vorbis_analysis_buffer(vorbis_dsp_state *v,int vals); -extern int mac_vorbis_analysis_wrote(vorbis_dsp_state *v,int vals); -extern int mac_vorbis_analysis_blockout(vorbis_dsp_state *v,vorbis_block *vb); - -extern int mac_ogg_stream_packetin(ogg_stream_state *os, ogg_packet *op); -extern int mac_ogg_stream_init(ogg_stream_state *os,int serialno); -extern int mac_ogg_stream_flush(ogg_stream_state *os, ogg_page *og); -extern int mac_ogg_stream_pageout(ogg_stream_state *os, ogg_page *og); -extern int mac_ogg_page_eos(ogg_page *og); -extern int mac_ogg_stream_clear(ogg_stream_state *os); - - -#ifdef __cplusplus -} -#endif diff --git a/indra/newview/build_win32_appConfig.py b/indra/newview/build_win32_appConfig.py deleted file mode 100755 index 1bfcc7a9bc..0000000000 --- a/indra/newview/build_win32_appConfig.py +++ /dev/null @@ -1,68 +0,0 @@ -# @file build_win32_appConfig.py -# @brief Create the windows app.config file to redirect crt linkage. -# -# $LicenseInfo:firstyear=2009&license=viewerlgpl$ -# Second Life Viewer Source Code -# Copyright (C) 2010, Linden Research, Inc. -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; -# version 2.1 of the License only. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -# -# Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA -# $/LicenseInfo$ - -import sys, os, re -from xml.dom.minidom import parse - -def munge_binding_redirect_version(src_manifest_name, src_config_name, dst_config_name): - manifest_dom = parse(src_manifest_name) - node = manifest_dom.getElementsByTagName('assemblyIdentity')[0] - manifest_assm_ver = node.getAttribute('version') - - config_dom = parse(src_config_name) - node = config_dom.getElementsByTagName('bindingRedirect')[0] - node.setAttribute('newVersion', manifest_assm_ver) - src_old_ver = re.match('([^-]*-).*', node.getAttribute('oldVersion')).group(1) - node.setAttribute('oldVersion', src_old_ver + manifest_assm_ver) - comment = config_dom.createComment("This file is automatically generated by the build. see indra/newview/build_win32_appConfig.py") - config_dom.insertBefore(comment, config_dom.childNodes[0]) - - print("Writing: " + dst_config_name) - f = open(dst_config_name, 'w') - config_dom.writexml(f) - f.close() - - - -def main(): - config = sys.argv[1] - src_dir = sys.argv[2] - dst_dir = sys.argv[3] - dst_name = sys.argv[4] - - if config.lower() == 'debug': - src_manifest_name = dst_dir + '/Microsoft.VC80.DebugCRT.manifest' - src_config_name = src_dir + '/SecondLifeDebug.exe.config' - else: - src_manifest_name = dst_dir + '/Microsoft.VC80.CRT.manifest' - src_config_name = src_dir + '/SecondLife.exe.config' - - dst_config_name = dst_dir + '/' + dst_name - - munge_binding_redirect_version(src_manifest_name, src_config_name, dst_config_name) - - return 0 - -if __name__ == "__main__": - main() diff --git a/indra/newview/lllocalbitmaps.cpp b/indra/newview/lllocalbitmaps.cpp index 6e56aac270..a5ab5538e7 100644 --- a/indra/newview/lllocalbitmaps.cpp +++ b/indra/newview/lllocalbitmaps.cpp @@ -31,8 +31,6 @@ /* own header */ #include "lllocalbitmaps.h" -/* boost: will not compile unless equivalent is undef'd, beware. */ -#include "fix_macros.h" #include /* image compression headers. */ diff --git a/indra/newview/lllocalgltfmaterials.cpp b/indra/newview/lllocalgltfmaterials.cpp index d6facad23d..aeae7cb56a 100644 --- a/indra/newview/lllocalgltfmaterials.cpp +++ b/indra/newview/lllocalgltfmaterials.cpp @@ -30,8 +30,6 @@ /* own header */ #include "lllocalgltfmaterials.h" -/* boost: will not compile unless equivalent is undef'd, beware. */ -#include "fix_macros.h" #include /* time headers */ diff --git a/indra/newview/macutil_Prefix.h b/indra/newview/macutil_Prefix.h deleted file mode 100644 index 4972ee4fa5..0000000000 --- a/indra/newview/macutil_Prefix.h +++ /dev/null @@ -1,38 +0,0 @@ -/** - * @file macutil_Prefix.h - * @brief Precompiled prefix file - * - * $LicenseInfo:firstyear=2005&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -/* - * - * Precompiled prefix file used for - * AutoUpdater - * crashreporter - * - */ - -#include "fix_macros.h" - -#undef verify -#undef require diff --git a/indra/newview/macview_Prefix.h b/indra/newview/macview_Prefix.h deleted file mode 100644 index faad8fa704..0000000000 --- a/indra/newview/macview_Prefix.h +++ /dev/null @@ -1,229 +0,0 @@ -/** - * @file macview_Prefix.h - * @brief Prefix header for all source files of the 'newview' target in the 'newview' project. - * - * $LicenseInfo:firstyear=2003&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -// MBW -- This doesn't work. There are some conflicts between things in Carbon.h and some of the linden source. -//#include - -////////////////// From llagent.cpp -#include "llpreprocessor.h" -#include "stdtypes.h" -#include "stdenums.h" - -#include "llagent.h" - -#include "llcoordframe.h" -#include "indra_constants.h" -#include "llmath.h" -#include "llcriticaldamp.h" -#include "llfocusmgr.h" -#include "llparcel.h" -#include "llpermissions.h" -#include "llregionhandle.h" -#include "m3math.h" -#include "m4math.h" -#include "message.h" -#include "qmath.h" -#include "v3math.h" -#include "v4math.h" -#include "vmath.h" -//#include "llteleportflags.h" - -#include "llbox.h" -#include "llbutton.h" -#include "llconsole.h" -#include "lldrawable.h" -#include "llfirstuse.h" -#include "llfloater.h" -#include "llfloaterbuildoptions.h" -#include "llfloaterchat.h" -#include "llfloatergroups.h" -#include "llfloaterworldmap.h" -#include "llfloatermute.h" -#include "llconversation.h" -#include "llfloatertools.h" -#include "llhudeffectlookat.h" -#include "llhudmanager.h" -#include "lljoystickbutton.h" -#include "llmenugl.h" -#include "llmorphview.h" -#include "llmoveview.h" -#include "llselectmgr.h" -#include "llsky.h" -#include "llrendersphere.h" -#include "llstatusbar.h" -#include "lltalkview.h" -#include "lltool.h" -#include "lltoolfocus.h" -#include "lltoolcomp.h" // for gToolGun -#include "lltoolgrab.h" -#include "lltoolmgr.h" -#include "lltoolpie.h" -#include "llui.h" // for make_ui_sound -#include "llviewercamera.h" -#include "llviewermenu.h" -#include "llviewerobjectlist.h" -#include "llviewerparcelmgr.h" -#include "llviewerparceloverlay.h" -#include "llviewerregion.h" -#include "llviewerstats.h" -#include "llviewerwindow.h" -#include "llvoavatar.h" -#include "llvoground.h" -#include "llvosky.h" -#include "llworld.h" -#include "pipeline.h" - -/////////////////// From llfloater.cpp -#include "llbutton.h" -#include "lldraghandle.h" -#include "llfocusmgr.h" -#include "llresizebar.h" -#include "llresizehandle.h" -#include "llresmgr.h" -#include "llui.h" -#include "llviewborder.h" -#include "lluictrlfactory.h" - - -/////////////////// From lldrawpool.cpp -#include "llface.h" -#include "llcontrol.h" -#include "pipeline.h" - -#include "llviewerobjectlist.h" // For debug listing. - -//extern LLPipeline gPipeline; - -#include "lldrawpoolsimple.h" -#include "lldrawpoolalpha.h" -#include "lldrawpoolavatar.h" -#include "lldrawpooltree.h" -#include "lldrawpoolterrain.h" -#include "lldrawpoolsky.h" -#include "lldrawpoolwater.h" -#include "lldrawpoolground.h" -#include "lldrawpoolbump.h" - -/////////////////// From llface.cpp -#include "llgl.h" -#include "llviewerimage.h" -#include "llsky.h" -#include "llvosky.h" -#include "llcontrol.h" -#include "v3color.h" -#include "pipeline.h" -#include "llvolume.h" -#include "llviewercamera.h" -#include "lllightconstants.h" - -#include "llvovolume.h" -#include "m3math.h" -#include "lldrawpoolbump.h" - - - -/////////////////// From llpanel.cpp -#include "llpanel.h" - -#include "llfontgl.h" -#include "llrect.h" -#include "llerror.h" -#include "lltimer.h" - -#include "llmenugl.h" -#include "llstatusbar.h" -#include "llui.h" -#include "llkeyboard.h" -#include "llviewerwindow.h" -#include "llcontrol.h" -#include "lluictrl.h" -#include "lluictrlfactory.h" -#include "llviewborder.h" -#include "llviewerimagelist.h" -#include "llbutton.h" -#include "llfocusmgr.h" - - - -/////////////////// From llvovolume.cpp -#include "llvovolume.h" -#include "llviewerimagelist.h" - -#include "llcontrol.h" - -#include "object_flags.h" - -#include "material_codes.h" -#include "llagent.h" -#include "llworld.h" -#include "llviewerregion.h" -#include "llprimitive.h" -#include "llvolume.h" -#include "lldrawable.h" -#include "llface.h" -#include "llvolumemgr.h" -#include "llsky.h" - -#include "pipeline.h" -#include "llmaterialtable.h" -#include "message.h" -#include "llviewertextureanim.h" -#include "llviewercamera.h" -#include "lldrawpoolbump.h" - - -/////////////////// From llagentpilot.cpp -#include "llagentpilot.h" -#include "llagent.h" -#include "llframestats.h" -#include "viewer.h" -#include "llcontrol.h" - - -/////////////////// From llloginview.cpp -#include "llloginview.h" - -#include "indra_constants.h" // for key and mask constants -#include "llfontgl.h" -#include "v4color.h" -#include "llwindow_impl.h" - -#include "llbutton.h" -#include "llcheckboxctrl.h" -#include "llcombobox.h" -#include "llcontrol.h" -#include "lllineeditor.h" -#include "lltextbox.h" -#include "llui.h" -//#include "lluiconstants.h" -#include "llviewerimagelist.h" -#include "llviewermenu.h" // for handle_preferences() -#include "llviewerwindow.h" // to link into child list -#include "llfocusmgr.h" -#include "llmd5.h" -#include "llversion.h" -#include "viewer.h" - diff --git a/indra/test/test.cpp b/indra/test/test.cpp index fd8034b811..d515cea3fa 100644 --- a/indra/test/test.cpp +++ b/indra/test/test.cpp @@ -46,13 +46,6 @@ #include "apr_pools.h" #include "apr_getopt.h" -// the CTYPE_WORKAROUND is needed for linux dev stations that don't -// have the broken libc6 packages needed by our out-of-date static -// libs (such as libcrypto and libcurl). -- Leviathan 20060113 -#ifdef CTYPE_WORKAROUND -# include "ctype_workaround.h" -#endif - #include #include @@ -619,10 +612,6 @@ int main(int argc, char **argv) LLFile::remove(test_log); LLError::logToFile(test_log); -#ifdef CTYPE_WORKAROUND - ctype_workaround(); -#endif - if (!sMasterThreadRecorder) { sMasterThreadRecorder = new LLTrace::ThreadRecorder(); -- cgit v1.3 From 09482ada93182772b3009c9587021c4c4c9d8f1e Mon Sep 17 00:00:00 2001 From: Rye Date: Mon, 15 Dec 2025 15:15:50 -0500 Subject: Clean up dead TeamCity build output and work arounds from tests Signed-off-by: Rye --- indra/llcorehttp/tests/test_httprequest.hpp | 15 ---- indra/test/test.cpp | 126 +--------------------------- 2 files changed, 1 insertion(+), 140 deletions(-) (limited to 'indra/test/test.cpp') diff --git a/indra/llcorehttp/tests/test_httprequest.hpp b/indra/llcorehttp/tests/test_httprequest.hpp index 77ed8df066..68f8c4f71f 100644 --- a/indra/llcorehttp/tests/test_httprequest.hpp +++ b/indra/llcorehttp/tests/test_httprequest.hpp @@ -2744,13 +2744,6 @@ void HttpRequestTestObjectType::test<22>() set_test_name("BUG-2295"); -#if LL_WINDOWS && ADDRESS_SIZE == 64 - // teamcity win64 builds freeze on this test, if you figure out the cause, please fix it - if (getenv("TEAMCITY_PROJECT_NAME")) - { - skip("BUG-2295 - partial load on W64 causes freeze"); - } -#endif // Handler can be stack-allocated *if* there are no dangling // references to it after completion of this method. // Create before memory record as the string copy will bump numbers. @@ -2924,14 +2917,6 @@ void HttpRequestTestObjectType::test<23>() set_test_name("HttpRequest GET 503s with 'Retry-After'"); -#if LL_WINDOWS && ADDRESS_SIZE == 64 - // teamcity win64 builds freeze on this test, if you figure out the cause, please fix it - if (getenv("TEAMCITY_PROJECT_NAME")) - { - skip("llcorehttp 503-with-retry test hangs on Windows 64"); - } -#endif - // This tests mainly that the code doesn't fall over if // various well- and mis-formed Retry-After headers are // sent along with the response. Direct inspection of diff --git a/indra/test/test.cpp b/indra/test/test.cpp index d515cea3fa..5b36bb618d 100644 --- a/indra/test/test.cpp +++ b/indra/test/test.cpp @@ -309,122 +309,6 @@ protected: std::shared_ptr mReplayer; }; -// TeamCity specific class which emits service messages -// http://confluence.jetbrains.net/display/TCD3/Build+Script+Interaction+with+TeamCity;#BuildScriptInteractionwithTeamCity-testReporting - -class LLTCTestCallback : public LLTestCallback -{ -public: - LLTCTestCallback(bool verbose_mode, std::ostream *stream, - std::shared_ptr replayer) : - LLTestCallback(verbose_mode, stream, replayer) - { - } - - ~LLTCTestCallback() - { - } - - virtual void group_started(const std::string& name) { - LLTestCallback::group_started(name); - std::cout << "\n##teamcity[testSuiteStarted name='" << escape(name) << "']" << std::endl; - } - - virtual void group_completed(const std::string& name) { - LLTestCallback::group_completed(name); - std::cout << "##teamcity[testSuiteFinished name='" << escape(name) << "']" << std::endl; - } - - virtual void test_completed(const tut::test_result& tr) - { - std::string testname(STRINGIZE(tr.group << "." << tr.test)); - if (! tr.name.empty()) - { - testname.append(":"); - testname.append(tr.name); - } - testname = escape(testname); - - // Sadly, tut::callback doesn't give us control at test start; have to - // backfill start message into TC output. - std::cout << "##teamcity[testStarted name='" << testname << "']" << std::endl; - - // now forward call to base class so any output produced there is in - // the right TC context - LLTestCallback::test_completed(tr); - - switch(tr.result) - { - case tut::test_result::ok: - break; - - case tut::test_result::fail: - case tut::test_result::ex: - case tut::test_result::warn: - case tut::test_result::term: - std::cout << "##teamcity[testFailed name='" << testname - << "' message='" << escape(tr.message) << "']" << std::endl; - break; - - case tut::test_result::skip: - std::cout << "##teamcity[testIgnored name='" << testname << "']" << std::endl; - break; - - default: - break; - } - - std::cout << "##teamcity[testFinished name='" << testname << "']" << std::endl; - } - - static std::string escape(const std::string& str) - { - // Per http://confluence.jetbrains.net/display/TCD65/Build+Script+Interaction+with+TeamCity#BuildScriptInteractionwithTeamCity-ServiceMessages - std::string result; - for (char c : str) - { - switch (c) - { - case '\'': - result.append("|'"); - break; - case '\n': - result.append("|n"); - break; - case '\r': - result.append("|r"); - break; -/*==========================================================================*| - // These are not possible 'char' values from a std::string. - case '\u0085': // next line - result.append("|x"); - break; - case '\u2028': // line separator - result.append("|l"); - break; - case '\u2029': // paragraph separator - result.append("|p"); - break; -|*==========================================================================*/ - case '|': - result.append("||"); - break; - case '[': - result.append("|["); - break; - case ']': - result.append("|]"); - break; - default: - result.push_back(c); - break; - } - } - return result; - } -}; - - static const apr_getopt_option_t TEST_CL_OPTIONS[] = { {"help", 'h', 0, "Print the help message."}, @@ -620,15 +504,7 @@ int main(int argc, char **argv) // run the tests - LLTestCallback* mycallback; - if (getenv("TEAMCITY_PROJECT_NAME")) - { - mycallback = new LLTCTestCallback(verbose_mode, output.get(), replayer); - } - else - { - mycallback = new LLTestCallback(verbose_mode, output.get(), replayer); - } + LLTestCallback* mycallback = new LLTestCallback(verbose_mode, output.get(), replayer); // a chained_callback subclass must be linked with previous mycallback->link(); -- cgit v1.3 From 615b1bcec74f4d6d759d69ecf9965b7d2b423c52 Mon Sep 17 00:00:00 2001 From: Rye Date: Mon, 29 Dec 2025 07:29:11 -0500 Subject: Replace remaining boost::filesystem usage with std::filesystem Signed-off-by: Rye --- indra/llcommon/tests/llleap_test.cpp | 20 +++--- indra/llcommon/tests/llprocess_test.cpp | 52 +++++++-------- indra/llcommon/tests/llsdserialize_test.cpp | 12 ++-- indra/llfilesystem/lldir_mac.cpp | 16 +++-- indra/llfilesystem/lldiriterator.cpp | 10 +-- indra/llfilesystem/lldiskcache.cpp | 98 ++++++++++++----------------- indra/newview/llappdelegate-objc.mm | 8 +-- indra/newview/lllocalbitmaps.cpp | 18 +----- indra/newview/lllocalbitmaps.h | 3 +- indra/newview/lllocalgltfmaterials.cpp | 18 +----- indra/newview/lllocalgltfmaterials.h | 3 +- indra/newview/llsnapshotlivepreview.cpp | 1 - indra/newview/llviewerwindow.cpp | 19 ++---- indra/test/namedtempfile.h | 45 +++++++------ indra/test/test.cpp | 6 +- 15 files changed, 142 insertions(+), 187 deletions(-) (limited to 'indra/test/test.cpp') diff --git a/indra/llcommon/tests/llleap_test.cpp b/indra/llcommon/tests/llleap_test.cpp index fa48bcdefd..ae20e7ed27 100644 --- a/indra/llcommon/tests/llleap_test.cpp +++ b/indra/llcommon/tests/llleap_test.cpp @@ -190,7 +190,7 @@ namespace tut // computation, so I don't mind calling it twice.) Then take the // basename. reader_module(LLProcess::basename( - reader.getName().substr(0, reader.getName().length()-3))), + reader.getPath().string().substr(0, reader.getPath().string().length()-3))), PYTHON(LLStringUtil::getenv("PYTHON")) { ensure("Set PYTHON to interpreter pathname", !PYTHON.empty()); @@ -212,9 +212,9 @@ namespace tut "time.sleep(1)\n"); LLLeapVector instances; instances.push_back(LLLeap::create(get_test_name(), - StringVec{PYTHON, script.getName()})->getWeak()); + StringVec{PYTHON, script.getPath().string()})->getWeak()); instances.push_back(LLLeap::create(get_test_name(), - StringVec{PYTHON, script.getName()})->getWeak()); + StringVec{PYTHON, script.getPath().string()})->getWeak()); // In this case we're simply establishing that two LLLeap instances // can coexist without throwing exceptions or bombing in any other // way. Wait for them to terminate. @@ -229,7 +229,7 @@ namespace tut "import sys\n" "sys.stderr.write('''Hello from Python!\n" "note partial line''')\n"); - StringVec vcommand{ PYTHON, script.getName() }; + StringVec vcommand{ PYTHON, script.getPath().string() }; CaptureLog log(LLError::LEVEL_INFO); waitfor(LLLeap::create(get_test_name(), vcommand)); log.messageWith("Hello from Python!"); @@ -244,7 +244,7 @@ namespace tut "print('Hello from Python!')\n"); CaptureLog log(LLError::LEVEL_WARN); waitfor(LLLeap::create(get_test_name(), - StringVec{PYTHON, script.getName()})); + StringVec{PYTHON, script.getPath().string()})); ensure_contains("error log line", log.messageWith("invalid protocol"), "Hello from Python!"); } @@ -259,7 +259,7 @@ namespace tut "sys.stdout.write('Hello from Python!')\n"); CaptureLog log(LLError::LEVEL_WARN); waitfor(LLLeap::create(get_test_name(), - StringVec{PYTHON, script.getName()})); + StringVec{PYTHON, script.getPath().string()})); ensure_contains("error log line", log.messageWith("Discarding"), "Hello from Python!"); } @@ -273,7 +273,7 @@ namespace tut "sys.stdout.write('5a2:something')\n"); CaptureLog log(LLError::LEVEL_WARN); waitfor(LLLeap::create(get_test_name(), - StringVec{PYTHON, script.getName()})); + StringVec{PYTHON, script.getPath().string()})); ensure_contains("error log line", log.messageWith("invalid protocol"), "5a2:"); } @@ -386,7 +386,7 @@ namespace tut " else 'bad: ' + str(resp)\n" "send(pump='" << result.getName() << "', data=result)\n";}); waitfor(LLLeap::create(get_test_name(), - StringVec{PYTHON, script.getName()})); + StringVec{PYTHON, script.getPath().string()})); result.ensure(); } @@ -445,7 +445,7 @@ namespace tut " result = 'expected reqid=%s in %s' % (i, resp)\n" " break\n" "send(pump='" << result.getName() << "', data=result)\n";}); - waitfor(LLLeap::create(get_test_name(), StringVec{PYTHON, script.getName()}), + waitfor(LLLeap::create(get_test_name(), StringVec{PYTHON, script.getPath().string()}), 300); // needs more realtime than most tests result.ensure(); } @@ -512,7 +512,7 @@ namespace tut " (start, large[start:end], echoed[start:end]))\n" "sys.exit(1)\n";}); waitfor(LLLeap::create(test_name, - StringVec{PYTHON, script.getName(), stringize(size)}), + StringVec{PYTHON, script.getPath().string(), stringize(size)}), 180); // try a longer timeout result.ensure(); } diff --git a/indra/llcommon/tests/llprocess_test.cpp b/indra/llcommon/tests/llprocess_test.cpp index cdf9f70b6e..5e653d0ba0 100644 --- a/indra/llcommon/tests/llprocess_test.cpp +++ b/indra/llcommon/tests/llprocess_test.cpp @@ -87,12 +87,12 @@ static void aprchk_(const char* call, apr_status_t rv, apr_status_t expected=APR * @param desc Optional description of the file for error message; * defaults to "in " */ -static std::string readfile(const std::string& pathname, const std::string& desc="") +static std::string readfile(const std::filesystem::path& pathname, const std::string& desc="") { std::string use_desc(desc); if (use_desc.empty()) { - use_desc = "in " + pathname; + use_desc = "in " + pathname.string(); } llifstream inf(pathname.c_str()); std::string output; @@ -165,7 +165,7 @@ struct PythonProcessLauncher mParams.desc = desc + " script"; mParams.executable = PYTHON; - mParams.args.add(mScript.getName()); + mParams.args.add(mScript.getPath().string()); } /// Launch Python script; verify that it launched @@ -233,11 +233,11 @@ struct PythonProcessLauncher { NamedTempFile out("out", ""); // placeholder // pass name of this temporary file to the script - mParams.args.add(out.getName()); + mParams.args.add(out.getPath().string()); run(); // assuming the script wrote to that file, read it std::string desc = "from " + mDesc + " script"; - return readfile(out.getName(), desc); + return readfile(out.getPath(), desc); } LLProcess::Params mParams; @@ -271,23 +271,23 @@ public: NamedTempDir(): mPath(NamedTempFile::temp_path()), - mCreated(boost::filesystem::create_directories(mPath)) + mCreated(std::filesystem::create_directories(mPath)) { - mPath = boost::filesystem::canonical(mPath); + mPath = std::filesystem::canonical(mPath); } ~NamedTempDir() { if (mCreated) { - boost::filesystem::remove_all(mPath); + std::filesystem::remove_all(mPath); } } std::string getName() const { return mPath.string(); } private: - boost::filesystem::path mPath; + std::filesystem::path mPath; bool mCreated; }; @@ -440,7 +440,7 @@ namespace tut #endif // Have to have a named copy of this std::string so its c_str() value // will persist. - std::string scriptname(script.getName()); + std::string scriptname(script.getPath().string()); argv.push_back(scriptname.c_str()); argv.push_back(NULL); @@ -719,14 +719,14 @@ namespace tut "with open(sys.argv[1], 'w') as f:\n" " f.write('bad')\n"); NamedTempFile out("out", "not started"); - py.mParams.args.add(out.getName()); + py.mParams.args.add(out.getPath().string()); py.launch(); // Wait for the script to wake up and do its first write int i = 0, timeout = 60; for ( ; i < timeout; ++i) { yield(); - if (readfile(out.getName(), "from kill() script") == "ok") + if (readfile(out.getPath(), "from kill() script") == "ok") break; } // If we broke this loop because of the counter, something's wrong @@ -745,7 +745,7 @@ namespace tut // If kill() failed, the script would have woken up on its own and // overwritten the file with 'bad'. But if kill() succeeded, it should // not have had that chance. - ensure_equals(get_test_name() + " script output", readfile(out.getName()), "ok"); + ensure_equals(get_test_name() + " script output", readfile(out.getPath()), "ok"); } template<> template<> @@ -765,7 +765,7 @@ namespace tut "# if caller hasn't managed to kill by now, bad\n" "with open(sys.argv[1], 'w') as f:\n" " f.write('bad')\n"); - py.mParams.args.add(out.getName()); + py.mParams.args.add(out.getPath().string()); py.launch(); // Capture handle for later phandle = py.mPy->getProcessHandle(); @@ -774,7 +774,7 @@ namespace tut for ( ; i < timeout; ++i) { yield(); - if (readfile(out.getName(), "from kill() script") == "ok") + if (readfile(out.getPath(), "from kill() script") == "ok") break; } // If we broke this loop because of the counter, something's wrong @@ -787,7 +787,7 @@ namespace tut // If kill() failed, the script would have woken up on its own and // overwritten the file with 'bad'. But if kill() succeeded, it should // not have had that chance. - ensure_equals(get_test_name() + " script output", readfile(out.getName()), "ok"); + ensure_equals(get_test_name() + " script output", readfile(out.getPath()), "ok"); } template<> template<> @@ -817,8 +817,8 @@ namespace tut "# okay, saw 'go', write 'ack'\n" "with open(sys.argv[1], 'w') as f:\n" " f.write('ack')\n"); - py.mParams.args.add(from.getName()); - py.mParams.args.add(to.getName()); + py.mParams.args.add(from.getPath().string()); + py.mParams.args.add(to.getPath().string()); py.mParams.autokill = false; py.launch(); // Capture handle for later @@ -828,7 +828,7 @@ namespace tut for ( ; i < timeout; ++i) { yield(); - if (readfile(from.getName(), "from autokill script") == "ok") + if (readfile(from.getPath(), "from autokill script") == "ok") break; } // If we broke this loop because of the counter, something's wrong @@ -840,14 +840,14 @@ namespace tut // How do we know it's not terminated? By making it respond to // a specific stimulus in a specific way. { - llofstream outf(to.getName().c_str()); + llofstream outf(to.getPath()); outf << "go"; } // flush and close. // now wait for the script to terminate... one way or another. waitfor(phandle, "autokill script"); // If the LLProcess destructor implicitly called kill(), the // script could not have written 'ack' as we expect. - ensure_equals(get_test_name() + " script output", readfile(from.getName()), "ack"); + ensure_equals(get_test_name() + " script output", readfile(from.getPath()), "ack"); } template<> template<> @@ -879,8 +879,8 @@ namespace tut "# okay, saw 'go', write 'ack'\n" "with open(sys.argv[1], 'w') as f:\n" " f.write('ack')\n"); - py.mParams.args.add(from.getName()); - py.mParams.args.add(to.getName()); + py.mParams.args.add(from.getPath().string()); + py.mParams.args.add(to.getPath().string()); py.mParams.autokill = true; py.mParams.attached = false; py.launch(); @@ -891,7 +891,7 @@ namespace tut for ( ; i < timeout; ++i) { yield(); - if (readfile(from.getName(), "from autokill script") == "ok") + if (readfile(from.getPath(), "from autokill script") == "ok") break; } // If we broke this loop because of the counter, something's wrong @@ -903,14 +903,14 @@ namespace tut // How do we know it's not terminated? By making it respond to // a specific stimulus in a specific way. { - llofstream outf(to.getName().c_str()); + llofstream outf(to.getPath()); outf << "go"; } // flush and close. // now wait for the script to terminate... one way or another. waitfor(phandle, "autokill script"); // If the LLProcess destructor implicitly called kill(), the // script could not have written 'ack' as we expect. - ensure_equals(get_test_name() + " script output", readfile(from.getName()), "ack"); + ensure_equals(get_test_name() + " script output", readfile(from.getPath()), "ack"); } template<> template<> diff --git a/indra/llcommon/tests/llsdserialize_test.cpp b/indra/llcommon/tests/llsdserialize_test.cpp index 272eb55521..a7abfda099 100644 --- a/indra/llcommon/tests/llsdserialize_test.cpp +++ b/indra/llcommon/tests/llsdserialize_test.cpp @@ -1808,7 +1808,7 @@ namespace tut #if LL_WINDOWS std::string q("\""); std::string qPYTHON(q + PYTHON + q); - std::string qscript(q + scriptfile.getName() + q); + std::string qscript(q + scriptfile.getPath().string() + q); int rc = (int)_spawnl(_P_WAIT, PYTHON.c_str(), qPYTHON.c_str(), qscript.c_str(), std::forward(args)..., NULL); if (rc == -1) @@ -1825,7 +1825,7 @@ namespace tut #else // LL_DARWIN, LL_LINUX LLProcess::Params params; params.executable = PYTHON; - params.args.add(scriptfile.getName()); + params.args.add(scriptfile.getPath().string()); for (const std::string& arg : StringVec{ std::forward(args)... }) { params.args.add(arg); @@ -2002,8 +2002,8 @@ namespace tut " yield frombytes\n" << pydata << // Don't forget raw-string syntax for Windows pathnames. - "debug = open(r'" << debug.getName() << "', 'w')\n" - "verify(parse_each(open(r'" << file.getName() << "', 'rb')))\n";}); + "debug = open(r'" << debug.getPath().string() << "', 'w')\n" + "verify(parse_each(open(r'" << file.getPath().string() << "', 'rb')))\n";}); } catch (const failure&) { @@ -2111,13 +2111,13 @@ namespace tut "]\n" // Don't forget raw-string syntax for Windows pathnames. // N.B. Using 'print' implicitly adds newlines. - "with open(r'" << file.getName() << "', 'wb') as f:\n" + "with open(r'" << (const char*)file.getPath().u8string().c_str() << "', 'wb') as f:\n" " for item in DATA:\n" " serialized = llsd." << pyformatter << "(item)\n" " f.write(lenformat.pack(len(serialized)))\n" " f.write(serialized)\n";}); - llifstream inf(file.getName().c_str()); + llifstream inf(file.getPath()); LLSD item; try { diff --git a/indra/llfilesystem/lldir_mac.cpp b/indra/llfilesystem/lldir_mac.cpp index 7bddee0f75..b13e72ff15 100644 --- a/indra/llfilesystem/lldir_mac.cpp +++ b/indra/llfilesystem/lldir_mac.cpp @@ -35,7 +35,7 @@ #include #include #include -#include +#include #include "lldir_utils_objc.h" // -------------------------------------------------------------------------------- @@ -45,15 +45,15 @@ static bool CreateDirectory(const std::string &parent, std::string *fullname) { - boost::filesystem::path p(parent); + std::filesystem::path p(parent); p /= child; if (fullname) *fullname = std::string(p.string()); - if (! boost::filesystem::create_directory(p)) + if (! std::filesystem::create_directory(p)) { - return (boost::filesystem::is_directory(p)); + return (std::filesystem::is_directory(p)); } return true; } @@ -75,10 +75,8 @@ LLDir_Mac::LLDir_Mac() // mExecutablePathAndName mExecutablePathAndName = executablepathstr; - boost::filesystem::path executablepath(executablepathstr); + std::filesystem::path executablepath(executablepathstr); -# ifndef BOOST_SYSTEM_NO_DEPRECATED -#endif mExecutableFilename = executablepath.filename().string(); mExecutableDir = executablepath.parent_path().string(); @@ -140,7 +138,7 @@ LLDir_Mac::LLDir_Mac() mOSUserAppDir = mOSUserDir; // mTempDir - //Aura 120920 boost::filesystem::temp_directory_path() not yet implemented on mac. :( + //Aura 120920 std::filesystem::temp_directory_path() not yet implemented on mac. :( std::string tmpdir = getSystemTempFolder(); if (!tmpdir.empty()) { @@ -174,7 +172,7 @@ void LLDir_Mac::initAppDirs(const std::string &app_name, std::string LLDir_Mac::getCurPath() { - return boost::filesystem::path( boost::filesystem::current_path() ).string(); + return std::filesystem::path( std::filesystem::current_path() ).string(); } /*virtual*/ std::string LLDir_Mac::getLLPluginLauncher() diff --git a/indra/llfilesystem/lldiriterator.cpp b/indra/llfilesystem/lldiriterator.cpp index 57d4912c94..60b55c7bf3 100644 --- a/indra/llfilesystem/lldiriterator.cpp +++ b/indra/llfilesystem/lldiriterator.cpp @@ -29,9 +29,9 @@ #include "lldiriterator.h" #include "llregex.h" -#include +#include -namespace fs = boost::filesystem; +namespace fs = std::filesystem; static std::string glob_to_regex(const std::string& glob); @@ -52,11 +52,7 @@ private: LLDirIterator::Impl::Impl(const std::string &dirname, const std::string &mask) : mIsValid(false) { -#ifdef LL_WINDOWS // or BOOST_WINDOWS_API - fs::path dir_path(ll_convert(dirname)); -#else - fs::path dir_path(dirname); -#endif + fs::path dir_path = fsyspath(dirname); bool is_dir = false; diff --git a/indra/llfilesystem/lldiskcache.cpp b/indra/llfilesystem/lldiskcache.cpp index 3430bec925..e971e324a0 100644 --- a/indra/llfilesystem/lldiskcache.cpp +++ b/indra/llfilesystem/lldiskcache.cpp @@ -34,8 +34,8 @@ #include "llapp.h" #include "llassettype.h" #include "lldir.h" -#include #include +#include #include "lldiskcache.h" @@ -67,7 +67,7 @@ LLDiskCache::LLDiskCache(const std::string& cache_dir, // Interaction through the filesystem itself should be safe. Let’s say thread // A is accessing the cache file for reading/writing and thread B is trimming // the cache. Let’s also assume using llifstream to open a file and -// boost::filesystem::remove are not atomic (which will be pretty much the +// std::filesystem::remove are not atomic (which will be pretty much the // case). // Now, A is trying to open the file using llifstream ctor. It does some @@ -83,7 +83,7 @@ LLDiskCache::LLDiskCache(const std::string& cache_dir, // garbage.) // Other situation: B is trimming the cache and A wants to read a file that is -// about to get deleted. boost::filesystem::remove does whatever it is doing +// about to get deleted. std::filesystem::remove does whatever it is doing // before actually deleting the file. If A opens the file before the file is // actually gone, the OS call from B to delete the file will fail since the OS // will prevent this. B continues with the next file. If the file is already @@ -96,38 +96,34 @@ void LLDiskCache::purge() LL_INFOS() << "Total dir size before purge is " << dirFileSize(sCacheDir) << LL_ENDL; } - boost::system::error_code ec; + std::error_code ec; auto start_time = std::chrono::high_resolution_clock::now(); - typedef std::pair> file_info_t; + typedef std::pair> file_info_t; std::vector file_info; -#if LL_WINDOWS - std::wstring cache_path(ll_convert(sCacheDir)); -#else - std::string cache_path(sCacheDir); -#endif - if (boost::filesystem::is_directory(cache_path, ec) && !ec.failed()) + std::filesystem::path cache_path = fsyspath(sCacheDir); + if (std::filesystem::is_directory(cache_path, ec) && !ec) { - boost::filesystem::directory_iterator iter(cache_path, ec); - while (iter != boost::filesystem::directory_iterator() && !ec.failed()) + std::filesystem::directory_iterator iter(cache_path, ec); + while (iter != std::filesystem::directory_iterator() && !ec) { if(!LLApp::isRunning()) { return; } - if (boost::filesystem::is_regular_file(*iter, ec) && !ec.failed()) + if (std::filesystem::is_regular_file(*iter, ec) && !ec) { if ((*iter).path().string().find(CACHE_FILENAME_PREFIX) != std::string::npos) { - uintmax_t file_size = boost::filesystem::file_size(*iter, ec); - if (ec.failed()) + uintmax_t file_size = std::filesystem::file_size(*iter, ec); + if (ec) { continue; } const std::string file_path = (*iter).path().string(); - const std::time_t file_time = boost::filesystem::last_write_time(*iter, ec); - if (ec.failed()) + const std::filesystem::file_time_type file_time = std::filesystem::last_write_time(*iter, ec); + if (ec) { continue; } @@ -167,8 +163,8 @@ void LLDiskCache::purge() } if (should_remove) { - boost::filesystem::remove(entry.second.second, ec); - if (ec.failed()) + std::filesystem::remove(entry.second.second, ec); + if (ec) { LL_WARNS() << "Failed to delete cache file " << entry.second.second << ": " << ec.message() << LL_ENDL; } @@ -196,7 +192,7 @@ void LLDiskCache::purge() std::ostringstream line; line << action << " "; - line << entry.first << " "; + line << S64(entry.first.time_since_epoch().count()) << " "; line << entry.second.first << " "; line << entry.second.second; line << " (" << file_size_total << "/" << mMaxSizeBytes << ")"; @@ -238,23 +234,19 @@ void LLDiskCache::clearCache() * the component files but it's called infrequently so it's * likely just fine */ - boost::system::error_code ec; -#if LL_WINDOWS - std::wstring cache_path(ll_convert(sCacheDir)); -#else - std::string cache_path(sCacheDir); -#endif - if (boost::filesystem::is_directory(cache_path, ec) && !ec.failed()) + std::error_code ec; + std::filesystem::path cache_path = fsyspath(sCacheDir); + if (std::filesystem::is_directory(cache_path, ec) && !ec) { - boost::filesystem::directory_iterator iter(cache_path, ec); - while (iter != boost::filesystem::directory_iterator() && !ec.failed()) + std::filesystem::directory_iterator iter(cache_path, ec); + while (iter != std::filesystem::directory_iterator() && !ec) { - if (boost::filesystem::is_regular_file(*iter, ec) && !ec.failed()) + if (std::filesystem::is_regular_file(*iter, ec) && !ec) { if ((*iter).path().string().find(CACHE_FILENAME_PREFIX) != std::string::npos) { - boost::filesystem::remove(*iter, ec); - if (ec.failed()) + std::filesystem::remove(*iter, ec); + if (ec) { LL_WARNS() << "Failed to delete cache file " << *iter << ": " << ec.message() << LL_ENDL; } @@ -271,24 +263,20 @@ void LLDiskCache::removeOldVFSFiles() static const char CACHE_FORMAT[] = "inv.llsd"; static const char DB_FORMAT[] = "db2.x"; - boost::system::error_code ec; -#if LL_WINDOWS - std::wstring cache_path(ll_convert(gDirUtilp->getExpandedFilename(LL_PATH_CACHE, ""))); -#else - std::string cache_path(gDirUtilp->getExpandedFilename(LL_PATH_CACHE, "")); -#endif - if (boost::filesystem::is_directory(cache_path, ec) && !ec.failed()) + std::error_code ec; + std::filesystem::path cache_path = fsyspath(gDirUtilp->getExpandedFilename(LL_PATH_CACHE, "")); + if (std::filesystem::is_directory(cache_path, ec) && !ec) { - boost::filesystem::directory_iterator iter(cache_path, ec); - while (iter != boost::filesystem::directory_iterator() && !ec.failed()) + std::filesystem::directory_iterator iter(cache_path, ec); + while (iter != std::filesystem::directory_iterator() && !ec) { - if (boost::filesystem::is_regular_file(*iter, ec) && !ec.failed()) + if (std::filesystem::is_regular_file(*iter, ec) && !ec) { if (((*iter).path().string().find(CACHE_FORMAT) != std::string::npos) || ((*iter).path().string().find(DB_FORMAT) != std::string::npos)) { - boost::filesystem::remove(*iter, ec); - if (ec.failed()) + std::filesystem::remove(*iter, ec); + if (ec) { LL_WARNS() << "Failed to delete cache file " << *iter << ": " << ec.message() << LL_ENDL; } @@ -312,23 +300,19 @@ uintmax_t LLDiskCache::dirFileSize(const std::string& dir) * so if performance is ever an issue, optimizing this or removing it altogether, * is an easy win. */ - boost::system::error_code ec; -#if LL_WINDOWS - std::wstring dir_path(ll_convert(dir)); -#else - std::string dir_path(dir); -#endif - if (boost::filesystem::is_directory(dir_path, ec) && !ec.failed()) + std::error_code ec; + std::filesystem::path dir_path = fsyspath(dir); + if (std::filesystem::is_directory(dir_path, ec) && !ec) { - boost::filesystem::directory_iterator iter(dir_path, ec); - while (iter != boost::filesystem::directory_iterator() && !ec.failed()) + std::filesystem::directory_iterator iter(dir_path, ec); + while (iter != std::filesystem::directory_iterator() && !ec) { - if (boost::filesystem::is_regular_file(*iter, ec) && !ec.failed()) + if (std::filesystem::is_regular_file(*iter, ec) && !ec) { if ((*iter).path().string().find(CACHE_FILENAME_PREFIX) != std::string::npos) { - uintmax_t file_size = boost::filesystem::file_size(*iter, ec); - if (!ec.failed()) + uintmax_t file_size = std::filesystem::file_size(*iter, ec); + if (!ec) { total_file_size += file_size; } diff --git a/indra/newview/llappdelegate-objc.mm b/indra/newview/llappdelegate-objc.mm index 409671d939..23a4effd87 100644 --- a/indra/newview/llappdelegate-objc.mm +++ b/indra/newview/llappdelegate-objc.mm @@ -26,7 +26,7 @@ #import "llappdelegate-objc.h" #if defined(LL_BUGSPLAT) -#include +#include #include @import CrashReporter; @import HockeySDK; @@ -252,7 +252,7 @@ if(!secondLogPath.empty()) { - boost::filesystem::remove(secondLogPath); + std::filesystem::remove(secondLogPath); } clearDumpLogsDir(); } @@ -326,7 +326,7 @@ struct AttachmentInfo { AttachmentInfo(const std::string& path, const std::string& type): pathname(path), - basename(boost::filesystem::path(path).filename().string()), + basename(std::filesystem::path(path).filename().string()), mimetype(type) {} @@ -361,7 +361,7 @@ struct AttachmentInfo // the log data to a browser, so take this opportunity to rename the file // from .crash to _log.txt info[0].basename = - boost::filesystem::path(info[0].pathname).stem().string() + "_log.txt"; + std::filesystem::path(info[0].pathname).stem().string() + "_log.txt"; infos("attachmentsForBugsplatStartupManager attaching log " + info[0].basename); NSMutableArray *attachments = [[NSMutableArray alloc] init]; diff --git a/indra/newview/lllocalbitmaps.cpp b/indra/newview/lllocalbitmaps.cpp index a5ab5538e7..d80d9058e2 100644 --- a/indra/newview/lllocalbitmaps.cpp +++ b/indra/newview/lllocalbitmaps.cpp @@ -31,8 +31,6 @@ /* own header */ #include "lllocalbitmaps.h" -#include - /* image compression headers. */ #include "llimagebmp.h" #include "llimagetga.h" @@ -40,11 +38,8 @@ #include "llimagejpeg.h" #include "llimagepng.h" -/* time headers */ -#include -#include - /* misc headers */ +#include "fsyspath.h" #include "llgltfmaterial.h" #include "llscrolllistctrl.h" #include "lllocaltextureobject.h" @@ -190,15 +185,8 @@ bool LLLocalBitmap::updateSelf(EUpdateType optional_firstupdate) if (gDirUtilp->fileExists(mFilename)) { // verifying that the file has indeed been modified - -#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(ll_convert(mFilename))); -#endif - LLSD new_last_modified = asctime(localtime(&temp_time)); - - if (mLastModified.asString() != new_last_modified.asString()) + const std::filesystem::file_time_type new_last_modified = std::filesystem::last_write_time(fsyspath(mFilename)); + if (mLastModified != new_last_modified) { /* loading the image file and decoding it, here is a critical point which, if fails, invalidates the whole update (or unit creation) process. */ diff --git a/indra/newview/lllocalbitmaps.h b/indra/newview/lllocalbitmaps.h index 6c9d65e3b6..c4aaeae719 100644 --- a/indra/newview/lllocalbitmaps.h +++ b/indra/newview/lllocalbitmaps.h @@ -32,6 +32,7 @@ #include "lleventtimer.h" #include "llpointer.h" #include "llwearabletype.h" +#include class LLScrollListCtrl; class LLImageRaw; @@ -99,7 +100,7 @@ class LLLocalBitmap LLUUID mTrackingID; LLUUID mWorldID; bool mValid; - LLSD mLastModified; + std::filesystem::file_time_type mLastModified; EExtension mExtension; ELinkStatus mLinkStatus; S32 mUpdateRetries; diff --git a/indra/newview/lllocalgltfmaterials.cpp b/indra/newview/lllocalgltfmaterials.cpp index aeae7cb56a..e9f2299be7 100644 --- a/indra/newview/lllocalgltfmaterials.cpp +++ b/indra/newview/lllocalgltfmaterials.cpp @@ -30,13 +30,8 @@ /* own header */ #include "lllocalgltfmaterials.h" -#include - -/* time headers */ -#include -#include - /* misc headers */ +#include "fsyspath.h" #include "llgltfmateriallist.h" #include "llimage.h" #include "llinventoryicon.h" @@ -128,15 +123,8 @@ bool LLLocalGLTFMaterial::updateSelf() if (gDirUtilp->fileExists(mFilename)) { // verifying that the file has indeed been modified - -#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(ll_convert(mFilename))); -#endif - LLSD new_last_modified = asctime(localtime(&temp_time)); - - if (mLastModified.asString() != new_last_modified.asString()) + const std::filesystem::file_time_type new_last_modified = std::filesystem::last_write_time(fsyspath(mFilename)); + if (mLastModified != new_last_modified) { if (loadMaterial()) { diff --git a/indra/newview/lllocalgltfmaterials.h b/indra/newview/lllocalgltfmaterials.h index b806b54508..bf9a8c68ae 100644 --- a/indra/newview/lllocalgltfmaterials.h +++ b/indra/newview/lllocalgltfmaterials.h @@ -30,6 +30,7 @@ #include "lleventtimer.h" #include "llpointer.h" #include "llgltfmateriallist.h" +#include class LLScrollListCtrl; class LLGLTFMaterial; @@ -73,7 +74,7 @@ private: /* members */ std::string mShortName; LLUUID mTrackingID; LLUUID mWorldID; - LLSD mLastModified; + std::filesystem::file_time_type mLastModified; EExtension mExtension; ELinkStatus mLinkStatus; S32 mUpdateRetries; diff --git a/indra/newview/llsnapshotlivepreview.cpp b/indra/newview/llsnapshotlivepreview.cpp index 3a894996e4..7d2828a872 100644 --- a/indra/newview/llsnapshotlivepreview.cpp +++ b/indra/newview/llsnapshotlivepreview.cpp @@ -54,7 +54,6 @@ #include "llviewertexturelist.h" #include "llwindow.h" #include "llworld.h" -#include constexpr F32 AUTO_SNAPSHOT_TIME_DELAY = 1.f; diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 0980c4a291..c77dd9cc08 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -33,9 +33,6 @@ #include #include #include -#include -#include -#include #include "llagent.h" #include "llagentcamera.h" @@ -4837,14 +4834,10 @@ void LLViewerWindow::saveImageLocal(LLImageFormatted *image, const snapshot_save return; } -// Check if there is enough free space to save snapshot -#ifdef LL_WINDOWS - boost::filesystem::path b_path(ll_convert(lastSnapshotDir)); -#else - boost::filesystem::path b_path(lastSnapshotDir); -#endif - boost::system::error_code ec; - if (!boost::filesystem::is_directory(b_path, ec) || ec.failed()) + // Check if there is enough free space to save snapshot + std::filesystem::path b_path = fsyspath(lastSnapshotDir); + std::error_code ec; + if (!std::filesystem::is_directory(b_path, ec) || ec) { LLSD args; args["PATH"] = lastSnapshotDir; @@ -4853,8 +4846,8 @@ void LLViewerWindow::saveImageLocal(LLImageFormatted *image, const snapshot_save failure_cb(); return; } - boost::filesystem::space_info b_space = boost::filesystem::space(b_path, ec); - if (ec.failed()) + std::filesystem::space_info b_space = std::filesystem::space(b_path, ec); + if (ec) { LLSD args; args["PATH"] = lastSnapshotDir; diff --git a/indra/test/namedtempfile.h b/indra/test/namedtempfile.h index 8027f95728..a38746759f 100644 --- a/indra/test/namedtempfile.h +++ b/indra/test/namedtempfile.h @@ -12,26 +12,29 @@ #if ! defined(LL_NAMEDTEMPFILE_H) #define LL_NAMEDTEMPFILE_H +#include "fsyspath.h" #include "llerror.h" #include "llstring.h" #include "stringize.h" #include -#include -#include -#include +#include #include #include #include #include +#include /** * Create a text file with specified content "somewhere in the * filesystem," cleaning up when it goes out of scope. */ -class NamedTempFile: public boost::noncopyable +class NamedTempFile { LOG_CLASS(NamedTempFile); public: + NamedTempFile(const NamedTempFile&) = delete; + NamedTempFile& operator=(const NamedTempFile&) = delete; + NamedTempFile(const std::string_view& pfx, const std::string_view& content, const std::string_view& sfx=std::string_view("")) @@ -62,16 +65,16 @@ public: virtual ~NamedTempFile() { - boost::filesystem::remove(mPath); + std::filesystem::remove(mPath); } - std::string getName() const { return mPath.string(); } + const std::filesystem::path& getPath() const { return mPath; } template void peep_via(CALLABLE&& callable) const { std::forward(callable)(stringize("File '", mPath, "' contains:")); - boost::filesystem::ifstream reader(mPath, std::ios::binary); + std::ifstream reader(mPath, std::ios::binary); std::string line; while (std::getline(reader, line)) std::forward(callable)(line); @@ -94,23 +97,27 @@ public: return out; } - static boost::filesystem::path temp_path(const std::string_view& pfx="", + static std::filesystem::path temp_path(const std::string_view& pfx="", const std::string_view& sfx="") { // This variable is set by GitHub actions and is the recommended place // to put temp files belonging to an actions job. const char* RUNNER_TEMP = getenv("RUNNER_TEMP"); - boost::filesystem::path tempdir{ + std::filesystem::path tempdir{ // if RUNNER_TEMP is set and not empty (RUNNER_TEMP && *RUNNER_TEMP)? - boost::filesystem::path(RUNNER_TEMP) : // use RUNNER_TEMP if available - boost::filesystem::temp_directory_path()}; // else canonical temp dir - boost::filesystem::path tempname{ - // use filename template recommended by unique_path() doc, but - // with underscores instead of hyphens: some use cases involve - // temporary Python scripts - tempdir / stringize(pfx, "%%%%_%%%%_%%%%_%%%%", sfx) }; - return boost::filesystem::unique_path(tempname); + fsyspath::path(RUNNER_TEMP) : // use RUNNER_TEMP if available + std::filesystem::temp_directory_path()}; // else canonical temp dir + + static std::mt19937 random_generator{std::random_device{}()}; + static std::uniform_int_distribution<> distribution{0, std::numeric_limits::max()}; + std::string tempname{}; + static constexpr auto num_bits = 128; + for (auto i = 0; i < (num_bits / std::numeric_limits::digits); ++i) { + tempname += llformat("%02x", distribution(random_generator)); + } + tempname = std::string(pfx) + tempname + std::string(sfx); + return tempdir / tempname; } protected: @@ -120,12 +127,12 @@ protected: { // Create file in a temporary place. mPath = temp_path(pfx, sfx); - boost::filesystem::ofstream out{ mPath, std::ios::binary }; + std::ofstream out{ mPath, std::ios::binary }; // Write desired content. func(out); } - boost::filesystem::path mPath; + std::filesystem::path mPath; }; /** diff --git a/indra/test/test.cpp b/indra/test/test.cpp index 5b36bb618d..cee8b84438 100644 --- a/indra/test/test.cpp +++ b/indra/test/test.cpp @@ -79,7 +79,7 @@ public: RecordToTempFile() : LLError::Recorder(), mTempFile("log", ""), - mFile(mTempFile.getName().c_str()) + mFile(mTempFile.getPath()) { } @@ -97,13 +97,13 @@ public: void reset() { mFile.close(); - mFile.open(mTempFile.getName().c_str()); + mFile.open(mTempFile.getPath()); } void replay(std::ostream& out) { mFile.close(); - llifstream inf(mTempFile.getName().c_str()); + llifstream inf(mTempFile.getPath()); std::string line; while (std::getline(inf, line)) { -- cgit v1.3