diff --git a/.clang-format b/.clang-format
index 90124fb04b..f5a49845d0 100644
--- a/.clang-format
+++ b/.clang-format
@@ -2,7 +2,7 @@
# clang-format version 10.0.0+
Language: Cpp
# BasedOnStyle: Microsoft
-AccessModifierOffset: -2
+AccessModifierOffset: -4
AlignAfterOpenBracket: Align
AlignConsecutiveMacros: true
AlignConsecutiveAssignments: true
@@ -15,14 +15,14 @@ AllowAllConstructorInitializersOnNextLine: false
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: Always
AllowShortCaseLabelsOnASingleLine: false
-AllowShortFunctionsOnASingleLine: All
-AllowShortLambdasOnASingleLine: All
+AllowShortFunctionsOnASingleLine: InlineOnly
+AllowShortLambdasOnASingleLine: Inline
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
-AlwaysBreakTemplateDeclarations: MultiLine
+AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: true
BinPackParameters: true
BreakBeforeBinaryOperators: None
@@ -67,7 +67,7 @@ IndentCaseLabels: true
IndentGotoLabels: true
IndentPPDirectives: None
IndentWidth: 4
-IndentWrappedFunctionNames: false
+IndentWrappedFunctionNames: true
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: false
@@ -91,9 +91,9 @@ PointerAlignment: Left
ReflowComments: true
SortIncludes: false
SortUsingDeclarations: true
-SpaceAfterCStyleCast: true
+SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
-SpaceAfterTemplateKeyword: true
+SpaceAfterTemplateKeyword: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
@@ -102,8 +102,8 @@ SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyBlock: false
SpaceInEmptyParentheses: false
-SpacesBeforeTrailingComments: 2
-SpacesInAngles: false
+SpacesBeforeTrailingComments: 1
+SpacesInAngles: Never
SpacesInContainerLiterals: false
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs
index 0851d20be0..c68131402b 100644
--- a/.git-blame-ignore-revs
+++ b/.git-blame-ignore-revs
@@ -5,7 +5,11 @@
a0b3021bdcf76859054fda8e30abb3ed47749e83
8444cd9562a6a7b755fcb075864e205122354192
863c541ce0b2e3e1e566cc88423d3e87aaedb6ca
+743a1a6d8eabf069d95777c96e5b657cb8702593
+4a00da1ada89af6f313cee30f5177634b0b180a9
# Wrong line endings
1b67dd855c41f5a0cda7ec2a68d98071986ca703
6cc7dd09d5e69cf57e6de7fb568a0ad2693f9c9a
e2e37cced861b98de8c1a7c9c0d3a50d2d90e433
+# multiple problems
+5370a6d323e14d7b4e32a3f41ef78f7744e361c5
diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml
index 2cb94c9c90..7d6bcd2bc4 100644
--- a/.github/workflows/build.yaml
+++ b/.github/workflows/build.yaml
@@ -42,7 +42,7 @@ jobs:
needs: setup
strategy:
matrix:
- runner: [windows-large, macos-12-xl]
+ runner: [windows-large, macos-12-large]
configuration: ${{ fromJSON(needs.setup.outputs.configurations) }}
runs-on: ${{ matrix.runner }}
outputs:
diff --git a/.github/workflows/cla.yaml b/.github/workflows/cla.yaml
index 3f4bf21864..013adc9ca8 100644
--- a/.github/workflows/cla.yaml
+++ b/.github/workflows/cla.yaml
@@ -13,7 +13,7 @@ jobs:
steps:
- name: CLA Assistant
if: (github.event.comment.body == 'recheck' || github.event.comment.body == 'I have read the CLA Document and I hereby sign the CLA') || github.event_name == 'pull_request_target'
- uses: secondlife-3p/contributor-assistant@v2
+ uses: secondlife-3p/contributor-assistant@v2.6.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PERSONAL_ACCESS_TOKEN: ${{ secrets.SHARED_CLA_TOKEN }}
diff --git a/autobuild.xml b/autobuild.xml
index a03c186539..7ad3b24dc6 100644
--- a/autobuild.xml
+++ b/autobuild.xml
@@ -2386,11 +2386,11 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors
archive
name
darwin64
@@ -2400,11 +2400,11 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors
archive
name
linux64
@@ -2414,11 +2414,11 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors
archive
name
windows64
@@ -2497,6 +2497,68 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors
description
Secure Sockets Layer (SSL v2/v3) and Transport Layer Security (TLS v1) Library
+ openxr
+
pcre
platforms
diff --git a/build.sh b/build.sh
index fd15794ee8..8294ce0c17 100755
--- a/build.sh
+++ b/build.sh
@@ -514,15 +514,6 @@ then
fi
fi
-# Some of the uploads takes a long time to finish in the codeticket backend,
-# causing the next codeticket upload attempt to fail.
-# Inserting this after each potentially large upload may prevent those errors.
-# JJ is making changes to Codeticket that we hope will eliminate this failure, then this can be removed
-wait_for_codeticket()
-{
- sleep $(( 60 * 6 ))
-}
-
# check status and upload results to S3
if $succeeded
then
diff --git a/doc/contributions.txt b/doc/contributions.txt
index 852d35630a..b7be5486ff 100755
--- a/doc/contributions.txt
+++ b/doc/contributions.txt
@@ -1216,6 +1216,7 @@ PanteraPolnocy
SL-18937
SL-19207
SL-19681
+ secondlife/viewer#2483
Parvati Silverweb
Patric Mills
VWR-2645
diff --git a/indra/cmake/00-Common.cmake b/indra/cmake/00-Common.cmake
index c660f87e33..91bbf1d53d 100644
--- a/indra/cmake/00-Common.cmake
+++ b/indra/cmake/00-Common.cmake
@@ -84,9 +84,12 @@ if (WINDOWS)
/NODEFAULTLIB:LIBCMT
/IGNORE:4099)
- add_definitions(
- -DNOMINMAX
-# /DDOM_DYNAMIC # For shared library colladadom
+ add_compile_definitions(
+ WIN32_LEAN_AND_MEAN
+ NOMINMAX
+# DOM_DYNAMIC # For shared library colladadom
+ _CRT_SECURE_NO_WARNINGS # Allow use of sprintf etc
+ _WINSOCK_DEPRECATED_NO_WARNINGS # Disable deprecated WinSock API warnings
)
add_compile_options(
/Zo
@@ -132,9 +135,6 @@ if (WINDOWS)
string(REPLACE "/Zi" "/Z7" CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}")
string(REPLACE "/Zi" "/Z7" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
endif()
-
- # Allow use of sprintf etc
- add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
endif (WINDOWS)
diff --git a/indra/cmake/CMakeLists.txt b/indra/cmake/CMakeLists.txt
index eeaf986709..6b73b366d3 100644
--- a/indra/cmake/CMakeLists.txt
+++ b/indra/cmake/CMakeLists.txt
@@ -27,6 +27,7 @@ set(cmake_SOURCE_FILES
FreeType.cmake
GLEXT.cmake
GLH.cmake
+ GLM.cmake
GLOD.cmake # Bring back GLOD
Havok.cmake
Hunspell.cmake
diff --git a/indra/cmake/OpenXR.cmake b/indra/cmake/OpenXR.cmake
new file mode 100644
index 0000000000..2cc862b927
--- /dev/null
+++ b/indra/cmake/OpenXR.cmake
@@ -0,0 +1,22 @@
+# -*- cmake -*-
+
+include(Prebuilt)
+
+include_guard()
+add_library( ll::openxr INTERFACE IMPORTED )
+
+if(USE_CONAN )
+ target_link_libraries( ll::openxr INTERFACE CONAN_PKG::openxr )
+ return()
+endif()
+
+use_prebuilt_binary(openxr)
+if (WINDOWS)
+ target_link_libraries( ll::openxr INTERFACE ${ARCH_PREBUILT_DIRS_RELEASE}/openxr_loader.lib )
+else()
+ target_link_libraries( ll::openxr INTERFACE ${ARCH_PREBUILT_DIRS_RELEASE}/libopenxr_loader.a )
+endif (WINDOWS)
+
+if( NOT LINUX )
+ target_include_directories( ll::openxr SYSTEM INTERFACE ${LIBS_PREBUILT_DIR}/include)
+endif()
diff --git a/indra/cmake/Tracy.cmake b/indra/cmake/Tracy.cmake
index 937f5f2c72..381c6a0a33 100644
--- a/indra/cmake/Tracy.cmake
+++ b/indra/cmake/Tracy.cmake
@@ -6,7 +6,7 @@ add_library( ll::tracy INTERFACE IMPORTED )
# default Tracy profiling on for test builds, but off for all others
string(TOLOWER ${VIEWER_CHANNEL} channel_lower)
-if(WINDOWS AND channel_lower MATCHES "^second life test")
+if(channel_lower MATCHES "^second life test")
option(USE_TRACY "Use Tracy profiler." ON)
else()
option(USE_TRACY "Use Tracy profiler." OFF)
@@ -30,6 +30,11 @@ if (USE_TRACY)
target_compile_definitions(ll::tracy INTERFACE -DTRACY_NO_BROADCAST=1 -DTRACY_ONLY_LOCALHOST=1)
endif ()
+ # GHA runners don't always provide invariant TSC support, but always build with LL_TESTS enabled
+ if (DARWIN AND LL_TESTS)
+ target_compile_definitions(ll::tracy INTERFACE -DTRACY_TIMER_FALLBACK=1)
+ endif ()
+
# See: indra/llcommon/llprofiler.h
add_compile_definitions(LL_PROFILER_CONFIGURATION=3)
endif (USE_TRACY)
diff --git a/indra/lib/python/indra/util/llmanifest.py b/indra/lib/python/indra/util/llmanifest.py
index 90bae43db9..79fa9d3f88 100755
--- a/indra/lib/python/indra/util/llmanifest.py
+++ b/indra/lib/python/indra/util/llmanifest.py
@@ -656,7 +656,7 @@ class LLManifest(object, metaclass=LLManifestRegistry):
'vers':'_'.join(self.args['version'])}
print("Creating unpacked file:", unpacked_file_name)
# could add a gz here but that doubles the time it takes to do this step
- tf = tarfile.open(self.src_path_of(unpacked_file_name), 'w:')
+ tf = tarfile.open(self.build_path_of(unpacked_file_name), 'w:')
# add the entire installation package, at the very top level
tf.add(self.get_dst_prefix(), "")
tf.close()
diff --git a/indra/llappearance/llavatarappearancedefines.cpp b/indra/llappearance/llavatarappearancedefines.cpp
index 580e6433c5..5f98f2c8c1 100644
--- a/indra/llappearance/llavatarappearancedefines.cpp
+++ b/indra/llappearance/llavatarappearancedefines.cpp
@@ -28,8 +28,8 @@
#include "llavatarappearancedefines.h"
#include "indra_constants.h"
-const S32 LLAvatarAppearanceDefines::SCRATCH_TEX_WIDTH = 1024;
-const S32 LLAvatarAppearanceDefines::SCRATCH_TEX_HEIGHT = 1024;
+const S32 LLAvatarAppearanceDefines::SCRATCH_TEX_WIDTH = 2048;
+const S32 LLAvatarAppearanceDefines::SCRATCH_TEX_HEIGHT = 2048;
using namespace LLAvatarAppearanceDefines;
diff --git a/indra/llcharacter/llkeyframemotion.cpp b/indra/llcharacter/llkeyframemotion.cpp
index 1888195f58..7b7a893ff1 100644
--- a/indra/llcharacter/llkeyframemotion.cpp
+++ b/indra/llcharacter/llkeyframemotion.cpp
@@ -2429,9 +2429,15 @@ void LLKeyframeMotion::onLoadComplete(const LLUUID& asset_uuid,
LLCharacter* character = *char_iter;
// look for an existing instance of this motion
- LLKeyframeMotion* motionp = static_cast (character->findMotion(asset_uuid));
- if (motionp)
+ if (LLMotion* asset = character->findMotion(asset_uuid))
{
+ LLKeyframeMotion* motionp = dynamic_cast(asset);
+ if (!motionp)
+ {
+ // This motion is not LLKeyframeMotion (e.g., LLEmote)
+ return;
+ }
+
if (0 == status)
{
if (motionp->mAssetStatus == ASSET_LOADED)
diff --git a/indra/llcommon/CMakeLists.txt b/indra/llcommon/CMakeLists.txt
index 428aa842e6..4f9371002e 100644
--- a/indra/llcommon/CMakeLists.txt
+++ b/indra/llcommon/CMakeLists.txt
@@ -119,6 +119,7 @@ set(llcommon_HEADER_FILES
commoncontrol.h
ctype_workaround.h
fix_macros.h
+ fsyspath.h
function_types.h
indra_constants.h
lazyeventapi.h
@@ -240,7 +241,6 @@ set(llcommon_HEADER_FILES
lluriparser.h
lluuid.h
llwin32headers.h
- llwin32headerslean.h
llworkerthread.h
hbxxh.h
lockstatic.h
diff --git a/indra/llcommon/fsyspath.h b/indra/llcommon/fsyspath.h
new file mode 100644
index 0000000000..1b4aec09b4
--- /dev/null
+++ b/indra/llcommon/fsyspath.h
@@ -0,0 +1,79 @@
+/**
+ * @file fsyspath.h
+ * @author Nat Goodspeed
+ * @date 2024-04-03
+ * @brief Adapt our UTF-8 std::strings for std::filesystem::path
+ *
+ * $LicenseInfo:firstyear=2024&license=viewerlgpl$
+ * Copyright (c) 2024, Linden Research, Inc.
+ * $/LicenseInfo$
+ */
+
+#if ! defined(LL_FSYSPATH_H)
+#define LL_FSYSPATH_H
+
+#include
+
+// While std::filesystem::path can be directly constructed from std::string on
+// both Posix and Windows, that's not what we want on Windows. Per
+// https://en.cppreference.com/w/cpp/filesystem/path/path:
+
+// ... the method of conversion to the native character set depends on the
+// character type used by source.
+//
+// * If the source character type is char, the encoding of the source is
+// assumed to be the native narrow encoding (so no conversion takes place on
+// POSIX systems).
+// * If the source character type is char8_t, conversion from UTF-8 to native
+// filesystem encoding is used. (since C++20)
+// * If the source character type is wchar_t, the input is assumed to be the
+// native wide encoding (so no conversion takes places on Windows).
+
+// The trouble is that on Windows, from std::string ("source character type is
+// char"), the "native narrow encoding" isn't UTF-8, so file paths containing
+// non-ASCII characters get mangled.
+//
+// Once we're building with C++20, we could pass a UTF-8 std::string through a
+// vector to engage std::filesystem::path's own UTF-8 conversion. But
+// sigh, as of 2024-04-03 we're not yet there.
+//
+// Anyway, encapsulating the important UTF-8 conversions in our own subclass
+// allows us to migrate forward to C++20 conventions without changing
+// referencing code.
+
+class fsyspath: public std::filesystem::path
+{
+ using super = std::filesystem::path;
+
+public:
+ // default
+ fsyspath() {}
+ // construct from UTF-8 encoded std::string
+ fsyspath(const std::string& path): super(std::filesystem::u8path(path)) {}
+ // construct from UTF-8 encoded const char*
+ fsyspath(const char* path): super(std::filesystem::u8path(path)) {}
+ // construct from existing path
+ fsyspath(const super& path): super(path) {}
+
+ fsyspath& operator=(const super& p) { super::operator=(p); return *this; }
+ fsyspath& operator=(const std::string& p)
+ {
+ super::operator=(std::filesystem::u8path(p));
+ return *this;
+ }
+ fsyspath& operator=(const char* p)
+ {
+ super::operator=(std::filesystem::u8path(p));
+ return *this;
+ }
+
+ // shadow base-class string() method with UTF-8 aware method
+ std::string string() const { return super::u8string(); }
+ // On Posix systems, where value_type is already char, this operator
+ // std::string() method shadows the base class operator string_type()
+ // method. But on Windows, where value_type is wchar_t, the base class
+ // doesn't have operator std::string(). Provide it.
+ operator std::string() const { return string(); }
+};
+
+#endif /* ! defined(LL_FSYSPATH_H) */
diff --git a/indra/llcommon/hexdump.h b/indra/llcommon/hexdump.h
new file mode 100755
index 0000000000..ab5ba2b16d
--- /dev/null
+++ b/indra/llcommon/hexdump.h
@@ -0,0 +1,106 @@
+/**
+ * @file hexdump.h
+ * @author Nat Goodspeed
+ * @date 2023-10-03
+ * @brief iostream manipulators to stream hex, or string with nonprinting chars
+ *
+ * $LicenseInfo:firstyear=2023&license=viewerlgpl$
+ * Copyright (c) 2023, Linden Research, Inc.
+ * $/LicenseInfo$
+ */
+
+#if ! defined(LL_HEXDUMP_H)
+#define LL_HEXDUMP_H
+
+#include
+#include
+#include
+#include
+
+namespace LL
+{
+
+// Format a given byte string as 2-digit hex values, no separators
+// Usage: std::cout << hexdump(somestring) << ...
+class hexdump
+{
+public:
+ hexdump(const std::string_view& data):
+ hexdump(data.data(), data.length())
+ {}
+
+ hexdump(const char* data, size_t len):
+ hexdump(reinterpret_cast(data), len)
+ {}
+
+ hexdump(const std::vector& data):
+ hexdump(data.data(), data.size())
+ {}
+
+ hexdump(const unsigned char* data, size_t len):
+ mData(data, data + len)
+ {}
+
+ friend std::ostream& operator<<(std::ostream& out, const hexdump& self)
+ {
+ auto oldfmt{ out.flags() };
+ auto oldfill{ out.fill() };
+ out.setf(std::ios_base::hex, std::ios_base::basefield);
+ out.fill('0');
+ for (auto c : self.mData)
+ {
+ out << std::setw(2) << unsigned(c);
+ }
+ out.setf(oldfmt, std::ios_base::basefield);
+ out.fill(oldfill);
+ return out;
+ }
+
+private:
+ std::vector mData;
+};
+
+// Format a given byte string as a mix of printable characters and, for each
+// non-printable character, "\xnn"
+// Usage: std::cout << hexmix(somestring) << ...
+class hexmix
+{
+public:
+ hexmix(const std::string_view& data):
+ mData(data)
+ {}
+
+ hexmix(const char* data, size_t len):
+ mData(data, len)
+ {}
+
+ friend std::ostream& operator<<(std::ostream& out, const hexmix& self)
+ {
+ auto oldfmt{ out.flags() };
+ auto oldfill{ out.fill() };
+ out.setf(std::ios_base::hex, std::ios_base::basefield);
+ out.fill('0');
+ for (auto c : self.mData)
+ {
+ // std::isprint() must be passed an unsigned char!
+ if (std::isprint(static_cast(c)))
+ {
+ out << c;
+ }
+ else
+ {
+ out << "\\x" << std::setw(2) << unsigned(c);
+ }
+ }
+ out.setf(oldfmt, std::ios_base::basefield);
+ out.fill(oldfill);
+ return out;
+ }
+
+private:
+ std::string mData;
+};
+
+} // namespace LL
+
+#endif /* ! defined(LL_HEXDUMP_H) */
diff --git a/indra/llcommon/llapp.cpp b/indra/llcommon/llapp.cpp
index a1692ad18b..0fe12188cd 100644
--- a/indra/llcommon/llapp.cpp
+++ b/indra/llcommon/llapp.cpp
@@ -88,10 +88,6 @@ LLApp* LLApp::sApplication = NULL;
// and disables crashlogger
bool LLApp::sDisableCrashlogger = false;
-// Local flag for whether or not to do logging in signal handlers.
-//static
-bool LLApp::sLogInSignal = true;
-
// static
// Keeps track of application status
LLScalarCond LLApp::sStatus{LLApp::APP_STATUS_STOPPED};
@@ -226,7 +222,7 @@ bool LLApp::parseCommandOptions(int argc, wchar_t** wargv)
if(wargv[ii][0] != '-')
{
LL_INFOS() << "Did not find option identifier while parsing token: "
- << wargv[ii] << LL_ENDL;
+ << (intptr_t)wargv[ii] << LL_ENDL;
return false;
}
int offset = 1;
@@ -602,6 +598,10 @@ void default_unix_signal_handler(int signum, siginfo_t *info, void *)
// We do the somewhat sketchy operation of blocking in here until the error handler
// has gracefully stopped the app.
+ // FIXME(brad) - we are using this handler for asynchronous signals as well, so sLogInSignal is currently
+ // disabled for safety. we need to find a way to selectively reenable it when it is safe.
+ // see issue secondlife/viewer#2566
+
if (LLApp::sLogInSignal)
{
LL_INFOS() << "Signal handler - Got signal " << signum << " - " << apr_signal_description_get(signum) << LL_ENDL;
diff --git a/indra/llcommon/llapp.h b/indra/llcommon/llapp.h
index d90ecdf661..3d18864b80 100644
--- a/indra/llcommon/llapp.h
+++ b/indra/llcommon/llapp.h
@@ -339,8 +339,12 @@ private:
friend void default_unix_signal_handler(int signum, siginfo_t *info, void *);
#endif
-public:
- static bool sLogInSignal;
+private:
+#ifdef LL_RELEASE_FOR_DOWNLOAD
+ static constexpr bool sLogInSignal = false;
+#else
+ static constexpr bool sLogInSignal = true;
+#endif
};
#endif // LL_LLAPP_H
diff --git a/indra/llcommon/llapr.h b/indra/llcommon/llapr.h
index 27497c777d..a574732073 100644
--- a/indra/llcommon/llapr.h
+++ b/indra/llcommon/llapr.h
@@ -34,7 +34,7 @@
#endif
#include
-#include "llwin32headerslean.h"
+#include "llwin32headers.h"
#include "apr_thread_proc.h"
#include "apr_getopt.h"
#include "apr_signal.h"
diff --git a/indra/llcommon/llcommon.cpp b/indra/llcommon/llcommon.cpp
index 953e04665c..d9d654ad17 100644
--- a/indra/llcommon/llcommon.cpp
+++ b/indra/llcommon/llcommon.cpp
@@ -55,7 +55,7 @@ void* ll_tracy_new(size_t size)
{
throw std::bad_alloc();
}
- TracyAlloc(ptr, size);
+ LL_PROFILE_ALLOC(ptr, size);
return ptr;
}
@@ -71,7 +71,7 @@ void* operator new[](std::size_t count)
void ll_tracy_delete(void* ptr)
{
- TracyFree(ptr);
+ LL_PROFILE_FREE(ptr);
if (gProfilerEnabled)
{
//LL_PROFILE_ZONE_SCOPED_CATEGORY_MEMORY;
@@ -103,13 +103,13 @@ void operator delete[](void* ptr) noexcept
void *tracy_aligned_malloc(size_t size, size_t alignment)
{
auto ptr = ll_aligned_malloc_fallback(size, alignment);
- if (ptr) TracyAlloc(ptr, size);
+ if (ptr) LL_PROFILE_ALLOC(ptr, size);
return ptr;
}
void tracy_aligned_free(void *memblock)
{
- TracyFree(memblock);
+ LL_PROFILE_FREE(memblock);
ll_aligned_free_fallback(memblock);
}
diff --git a/indra/llcommon/llerror.cpp b/indra/llcommon/llerror.cpp
index f4bd6cc293..5a3f2cbc5c 100644
--- a/indra/llcommon/llerror.cpp
+++ b/indra/llcommon/llerror.cpp
@@ -110,7 +110,7 @@ namespace {
virtual void recordMessage(LLError::ELevel level,
const std::string& message) override
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_LOGGING
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_LOGGING;
int syslogPriority = LOG_CRIT;
switch (level) {
case LLError::LEVEL_DEBUG: syslogPriority = LOG_DEBUG; break;
diff --git a/indra/llcommon/llfile.cpp b/indra/llcommon/llfile.cpp
index d49a7d1f36..bc04485688 100644
--- a/indra/llcommon/llfile.cpp
+++ b/indra/llcommon/llfile.cpp
@@ -34,7 +34,7 @@
#include "stringize.h"
#if LL_WINDOWS
-#include "llwin32headerslean.h"
+#include "llwin32headers.h"
#include // Windows errno
#include
#else
diff --git a/indra/llcommon/llmainthreadtask.h b/indra/llcommon/llmainthreadtask.h
index cec95b2356..c3ed7fef52 100644
--- a/indra/llcommon/llmainthreadtask.h
+++ b/indra/llcommon/llmainthreadtask.h
@@ -89,10 +89,10 @@ private:
}
// Given arbitrary CALLABLE, which might be a lambda, how are we
// supposed to obtain its signature for std::packaged_task? It seems
- // redundant to have to add an argument list to engage result_of, then
+ // redundant to have to add an argument list to engage invoke_result_t, then
// add the argument list again to complete the signature. At least we
// only support a nullary CALLABLE.
- std::packaged_task::type()> mTask;
+ std::packaged_task()> mTask;
};
};
diff --git a/indra/llcommon/llmd5.cpp b/indra/llcommon/llmd5.cpp
index f64f54c262..e999b8f597 100644
--- a/indra/llcommon/llmd5.cpp
+++ b/indra/llcommon/llmd5.cpp
@@ -68,10 +68,6 @@ documentation and/or software.
*/
-
-
-
-
#include "linden_common.h"
#include "llmd5.h"
@@ -81,232 +77,203 @@ documentation and/or software.
// how many bytes to grab at a time when checking files
const int LLMD5::BLOCK_LEN = 4096;
-
// LLMD5 simple initialization method
-
LLMD5::LLMD5()
{
- init();
+ init();
}
-
-
-
// MD5 block update operation. Continues an MD5 message-digest
// operation, processing another message block, and updating the
// context.
+void LLMD5::update(const uint8_t* input, const size_t input_length)
+{
+ size_t input_index, buffer_index;
+ size_t buffer_space; // how much space is left in buffer
-void LLMD5::update (const uint8_t *input, const size_t input_length) {
+ if (finalized)
+ { // so we can't update!
+ std::cerr << "LLMD5::update: Can't update a finalized digest!" << std::endl;
+ return;
+ }
- size_t input_index, buffer_index;
- size_t buffer_space; // how much space is left in buffer
+ // Compute number of bytes mod 64
+ buffer_index = size_t((count >> 3) & 0x3F);
- if (finalized){ // so we can't update!
- std::cerr << "LLMD5::update: Can't update a finalized digest!" << std::endl;
- return;
- }
+ // Update number of bits
+ count += input_length << 3;
- // Compute number of bytes mod 64
- buffer_index = size_t((count >> 3) & 0x3F);
+ buffer_space = 64 - buffer_index; // how much space is left in buffer
- // Update number of bits
- count += input_length << 3;
+ // now, transform each 64-byte piece of the input, bypassing the buffer
+ if (input == NULL || input_length == 0)
+ {
+ std::cerr << "LLMD5::update: Invalid input!" << std::endl;
+ return;
+ }
- buffer_space = 64 - buffer_index; // how much space is left in buffer
+ // Transform as many times as possible.
+ if (input_length >= buffer_space) // ie. we have enough to fill the buffer
+ {
+ // fill the rest of the buffer and transform
+ memcpy(/* Flawfinder: ignore */
+ buffer + buffer_index,
+ input,
+ buffer_space);
+ transform(buffer);
- // now, transform each 64-byte piece of the input, bypassing the buffer
- if (input == NULL || input_length == 0){
- std::cerr << "LLMD5::update: Invalid input!" << std::endl;
- return;
- }
+ for (input_index = buffer_space; input_index + 63 < input_length; input_index += 64)
+ transform(input + input_index);
- // Transform as many times as possible.
- if (input_length >= buffer_space) { // ie. we have enough to fill the buffer
- // fill the rest of the buffer and transform
- memcpy( /* Flawfinder: ignore */
- buffer + buffer_index,
- input,
- buffer_space);
- transform (buffer);
+ buffer_index = 0; // so we can buffer remaining
+ }
+ else
+ input_index = 0; // so we can buffer the whole input
- for (input_index = buffer_space; input_index + 63 < input_length;
- input_index += 64)
- transform (input+input_index);
-
- buffer_index = 0; // so we can buffer remaining
- }
- else
- input_index=0; // so we can buffer the whole input
-
-
- // and here we do the buffering:
- memcpy(buffer+buffer_index, input+input_index, input_length-input_index); /* Flawfinder: ignore */
+ // and here we do the buffering:
+ memcpy(buffer + buffer_index, input + input_index, input_length - input_index); /* Flawfinder: ignore */
}
-
-
// MD5 update for files.
// Like above, except that it works on files (and uses above as a primitive.)
+void LLMD5::update(FILE* file)
+{
+ unsigned char buffer[BLOCK_LEN]; /* Flawfinder: ignore */
+ int len;
-void LLMD5::update(FILE* file){
-
- unsigned char buffer[BLOCK_LEN]; /* Flawfinder: ignore */
- int len;
-
- while ( (len=(int)fread(buffer, 1, BLOCK_LEN, file)) )
- update(buffer, len);
-
- fclose (file);
+ while ((len = (int)fread(buffer, 1, BLOCK_LEN, file)))
+ update(buffer, len);
+ fclose(file);
}
// MD5 update for istreams.
// Like update for files; see above.
+void LLMD5::update(std::istream& stream)
+{
+ unsigned char buffer[BLOCK_LEN]; /* Flawfinder: ignore */
+ int len;
-void LLMD5::update(std::istream& stream){
-
- unsigned char buffer[BLOCK_LEN]; /* Flawfinder: ignore */
- int len;
-
- while (stream.good()){
- stream.read( (char*)buffer, BLOCK_LEN); /* Flawfinder: ignore */ // note that return value of read is unusable.
- len=(int)stream.gcount();
- update(buffer, len);
- }
-
+ while (stream.good())
+ {
+ stream.read((char*)buffer, BLOCK_LEN); /* Flawfinder: ignore */ // note that return value of read is unusable.
+ len = (int)stream.gcount();
+ update(buffer, len);
+ }
}
-void LLMD5::update(const std::string& s)
+void LLMD5::update(const std::string& s)
{
- update((unsigned char *)s.c_str(),s.length());
+ update((unsigned char*)s.c_str(), s.length());
}
// MD5 finalization. Ends an MD5 message-digest operation, writing the
// the message digest and zeroizing the context.
-
-
-void LLMD5::finalize (){
-
- unsigned char bits[8]; /* Flawfinder: ignore */
- size_t index, padLen;
- static uint8_t PADDING[64]={
- 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+void LLMD5::finalize()
+{
+ unsigned char bits[8]; /* Flawfinder: ignore */
+ size_t index, padLen;
+ static uint8_t PADDING[64] =
+ {
+ 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
- if (finalized){
- std::cerr << "LLMD5::finalize: Already finalized this digest!" << std::endl;
- return;
- }
+ if (finalized)
+ {
+ std::cerr << "LLMD5::finalize: Already finalized this digest!" << std::endl;
+ return;
+ }
- // Save number of bits.
- // Treat count, a uint64_t, as uint32_t[2].
- encode (bits, reinterpret_cast(&count), 8);
+ // Save number of bits.
+ // Treat count, a uint64_t, as uint32_t[2].
+ encode(bits, reinterpret_cast(&count), 8);
- // Pad out to 56 mod 64.
- index = size_t((count >> 3) & 0x3f);
- padLen = (index < 56) ? (56 - index) : (120 - index);
- update (PADDING, padLen);
+ // Pad out to 56 mod 64.
+ index = size_t((count >> 3) & 0x3f);
+ padLen = (index < 56) ? (56 - index) : (120 - index);
+ update(PADDING, padLen);
- // Append length (before padding)
- update (bits, 8);
+ // Append length (before padding)
+ update(bits, 8);
- // Store state in digest
- encode (digest, state, 16);
+ // Store state in digest
+ encode(digest, state, 16);
- // Zeroize sensitive information
- memset (buffer, 0, sizeof(*buffer));
-
- finalized=1;
+ // Zeroize sensitive information
+ memset(buffer, 0, sizeof(buffer));
+ finalized = true;
}
-
-
-
-LLMD5::LLMD5(FILE *file){
-
- init(); // must be called be all constructors
- update(file);
- finalize ();
+LLMD5::LLMD5(FILE* file)
+{
+ init(); // must be called be all constructors
+ update(file);
+ finalize();
}
-
-
-
-LLMD5::LLMD5(std::istream& stream){
-
- init(); // must called by all constructors
- update (stream);
- finalize();
+LLMD5::LLMD5(std::istream& stream)
+{
+ init(); // must called by all constructors
+ update(stream);
+ finalize();
}
// Digest a string of the format ("%s:%i" % (s, number))
-LLMD5::LLMD5(const unsigned char *string, const unsigned int number)
+LLMD5::LLMD5(const unsigned char* string, const unsigned int number)
{
- const char *colon = ":";
- char tbuf[16]; /* Flawfinder: ignore */
+ const char* colon = ":";
+ char tbuf[16]; /* Flawfinder: ignore */
init();
- update(string, (U32)strlen((const char *) string)); /* Flawfinder: ignore */
- update((const unsigned char *) colon, (U32)strlen(colon)); /* Flawfinder: ignore */
- snprintf(tbuf, sizeof(tbuf), "%i", number); /* Flawfinder: ignore */
- update((const unsigned char *) tbuf, (U32)strlen(tbuf)); /* Flawfinder: ignore */
+ update(string, (U32)strlen((const char*)string)); /* Flawfinder: ignore */
+ update((const unsigned char*)colon, (U32)strlen(colon)); /* Flawfinder: ignore */
+ snprintf(tbuf, sizeof(tbuf), "%i", number); /* Flawfinder: ignore */
+ update((const unsigned char*)tbuf, (U32)strlen(tbuf)); /* Flawfinder: ignore */
finalize();
}
// Digest a string
-LLMD5::LLMD5(const unsigned char *s)
+LLMD5::LLMD5(const unsigned char* s)
{
init();
- update(s, (U32)strlen((const char *) s)); /* Flawfinder: ignore */
+ update(s, (U32)strlen((const char*)s)); /* Flawfinder: ignore */
finalize();
}
-void LLMD5::raw_digest(unsigned char *s) const
+void LLMD5::raw_digest(unsigned char* s) const
{
if (!finalized)
{
- std::cerr << "LLMD5::raw_digest: Can't get digest if you haven't "<<
- "finalized the digest!" << std::endl;
+ std::cerr << "LLMD5::raw_digest: Can't get digest if you haven't "
+ << "finalized the digest!" << std::endl;
s[0] = '\0';
return;
}
- memcpy(s, digest, 16); /* Flawfinder: ignore */
- return;
+ memcpy(s, digest, 16); /* Flawfinder: ignore */
}
-
-
-void LLMD5::hex_digest(char *s) const
+void LLMD5::hex_digest(char* s) const
{
- int i;
-
if (!finalized)
{
- std::cerr << "LLMD5::hex_digest: Can't get digest if you haven't "<<
- "finalized the digest!" <> (32-(n))))
+#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32 - (n))))
/* FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4.
Rotation is separate from addition to prevent recomputation.
*/
-#define FF(a, b, c, d, x, s, ac) { \
- (a) += F ((b), (c), (d)) + (x) + (U32)(ac); \
- (a) = ROTATE_LEFT ((a), (s)); \
- (a) += (b); \
- }
-#define GG(a, b, c, d, x, s, ac) { \
- (a) += G ((b), (c), (d)) + (x) + (U32)(ac); \
- (a) = ROTATE_LEFT ((a), (s)); \
- (a) += (b); \
- }
-#define HH(a, b, c, d, x, s, ac) { \
- (a) += H ((b), (c), (d)) + (x) + (U32)(ac); \
- (a) = ROTATE_LEFT ((a), (s)); \
- (a) += (b); \
- }
-#define II(a, b, c, d, x, s, ac) { \
- (a) += I ((b), (c), (d)) + (x) + (U32)(ac); \
- (a) = ROTATE_LEFT ((a), (s)); \
- (a) += (b); \
- }
-
-
+#define FF(a, b, c, d, x, s, ac) \
+ { \
+ (a) += F((b), (c), (d)) + (x) + (U32)(ac); \
+ (a) = ROTATE_LEFT((a), (s)); \
+ (a) += (b); \
+ }
+#define GG(a, b, c, d, x, s, ac) \
+ { \
+ (a) += G((b), (c), (d)) + (x) + (U32)(ac); \
+ (a) = ROTATE_LEFT((a), (s)); \
+ (a) += (b); \
+ }
+#define HH(a, b, c, d, x, s, ac) \
+ { \
+ (a) += H((b), (c), (d)) + (x) + (U32)(ac); \
+ (a) = ROTATE_LEFT((a), (s)); \
+ (a) += (b); \
+ }
+#define II(a, b, c, d, x, s, ac) \
+ { \
+ (a) += I((b), (c), (d)) + (x) + (U32)(ac); \
+ (a) = ROTATE_LEFT((a), (s)); \
+ (a) += (b); \
+ }
// LLMD5 basic transformation. Transforms state based on block.
-void LLMD5::transform (const U8 block[64]){
+void LLMD5::transform(const U8 block[64])
+{
+ uint32_t a = state[0], b = state[1], c = state[2], d = state[3], x[16];
- uint32_t a = state[0], b = state[1], c = state[2], d = state[3], x[16];
+ decode(x, block, 64);
- decode (x, block, 64);
+ assert(!finalized); // not just a user error, since the method is private
- assert(!finalized); // not just a user error, since the method is private
+ /* Round 1 */
+ FF(a, b, c, d, x[0], S11, 0xd76aa478); /* 1 */
+ FF(d, a, b, c, x[1], S12, 0xe8c7b756); /* 2 */
+ FF(c, d, a, b, x[2], S13, 0x242070db); /* 3 */
+ FF(b, c, d, a, x[3], S14, 0xc1bdceee); /* 4 */
+ FF(a, b, c, d, x[4], S11, 0xf57c0faf); /* 5 */
+ FF(d, a, b, c, x[5], S12, 0x4787c62a); /* 6 */
+ FF(c, d, a, b, x[6], S13, 0xa8304613); /* 7 */
+ FF(b, c, d, a, x[7], S14, 0xfd469501); /* 8 */
+ FF(a, b, c, d, x[8], S11, 0x698098d8); /* 9 */
+ FF(d, a, b, c, x[9], S12, 0x8b44f7af); /* 10 */
+ FF(c, d, a, b, x[10], S13, 0xffff5bb1); /* 11 */
+ FF(b, c, d, a, x[11], S14, 0x895cd7be); /* 12 */
+ FF(a, b, c, d, x[12], S11, 0x6b901122); /* 13 */
+ FF(d, a, b, c, x[13], S12, 0xfd987193); /* 14 */
+ FF(c, d, a, b, x[14], S13, 0xa679438e); /* 15 */
+ FF(b, c, d, a, x[15], S14, 0x49b40821); /* 16 */
- /* Round 1 */
- FF (a, b, c, d, x[ 0], S11, 0xd76aa478); /* 1 */
- FF (d, a, b, c, x[ 1], S12, 0xe8c7b756); /* 2 */
- FF (c, d, a, b, x[ 2], S13, 0x242070db); /* 3 */
- FF (b, c, d, a, x[ 3], S14, 0xc1bdceee); /* 4 */
- FF (a, b, c, d, x[ 4], S11, 0xf57c0faf); /* 5 */
- FF (d, a, b, c, x[ 5], S12, 0x4787c62a); /* 6 */
- FF (c, d, a, b, x[ 6], S13, 0xa8304613); /* 7 */
- FF (b, c, d, a, x[ 7], S14, 0xfd469501); /* 8 */
- FF (a, b, c, d, x[ 8], S11, 0x698098d8); /* 9 */
- FF (d, a, b, c, x[ 9], S12, 0x8b44f7af); /* 10 */
- FF (c, d, a, b, x[10], S13, 0xffff5bb1); /* 11 */
- FF (b, c, d, a, x[11], S14, 0x895cd7be); /* 12 */
- FF (a, b, c, d, x[12], S11, 0x6b901122); /* 13 */
- FF (d, a, b, c, x[13], S12, 0xfd987193); /* 14 */
- FF (c, d, a, b, x[14], S13, 0xa679438e); /* 15 */
- FF (b, c, d, a, x[15], S14, 0x49b40821); /* 16 */
+ /* Round 2 */
+ GG(a, b, c, d, x[1], S21, 0xf61e2562); /* 17 */
+ GG(d, a, b, c, x[6], S22, 0xc040b340); /* 18 */
+ GG(c, d, a, b, x[11], S23, 0x265e5a51); /* 19 */
+ GG(b, c, d, a, x[0], S24, 0xe9b6c7aa); /* 20 */
+ GG(a, b, c, d, x[5], S21, 0xd62f105d); /* 21 */
+ GG(d, a, b, c, x[10], S22, 0x2441453); /* 22 */
+ GG(c, d, a, b, x[15], S23, 0xd8a1e681); /* 23 */
+ GG(b, c, d, a, x[4], S24, 0xe7d3fbc8); /* 24 */
+ GG(a, b, c, d, x[9], S21, 0x21e1cde6); /* 25 */
+ GG(d, a, b, c, x[14], S22, 0xc33707d6); /* 26 */
+ GG(c, d, a, b, x[3], S23, 0xf4d50d87); /* 27 */
+ GG(b, c, d, a, x[8], S24, 0x455a14ed); /* 28 */
+ GG(a, b, c, d, x[13], S21, 0xa9e3e905); /* 29 */
+ GG(d, a, b, c, x[2], S22, 0xfcefa3f8); /* 30 */
+ GG(c, d, a, b, x[7], S23, 0x676f02d9); /* 31 */
+ GG(b, c, d, a, x[12], S24, 0x8d2a4c8a); /* 32 */
- /* Round 2 */
- GG (a, b, c, d, x[ 1], S21, 0xf61e2562); /* 17 */
- GG (d, a, b, c, x[ 6], S22, 0xc040b340); /* 18 */
- GG (c, d, a, b, x[11], S23, 0x265e5a51); /* 19 */
- GG (b, c, d, a, x[ 0], S24, 0xe9b6c7aa); /* 20 */
- GG (a, b, c, d, x[ 5], S21, 0xd62f105d); /* 21 */
- GG (d, a, b, c, x[10], S22, 0x2441453); /* 22 */
- GG (c, d, a, b, x[15], S23, 0xd8a1e681); /* 23 */
- GG (b, c, d, a, x[ 4], S24, 0xe7d3fbc8); /* 24 */
- GG (a, b, c, d, x[ 9], S21, 0x21e1cde6); /* 25 */
- GG (d, a, b, c, x[14], S22, 0xc33707d6); /* 26 */
- GG (c, d, a, b, x[ 3], S23, 0xf4d50d87); /* 27 */
- GG (b, c, d, a, x[ 8], S24, 0x455a14ed); /* 28 */
- GG (a, b, c, d, x[13], S21, 0xa9e3e905); /* 29 */
- GG (d, a, b, c, x[ 2], S22, 0xfcefa3f8); /* 30 */
- GG (c, d, a, b, x[ 7], S23, 0x676f02d9); /* 31 */
- GG (b, c, d, a, x[12], S24, 0x8d2a4c8a); /* 32 */
+ /* Round 3 */
+ HH(a, b, c, d, x[5], S31, 0xfffa3942); /* 33 */
+ HH(d, a, b, c, x[8], S32, 0x8771f681); /* 34 */
+ HH(c, d, a, b, x[11], S33, 0x6d9d6122); /* 35 */
+ HH(b, c, d, a, x[14], S34, 0xfde5380c); /* 36 */
+ HH(a, b, c, d, x[1], S31, 0xa4beea44); /* 37 */
+ HH(d, a, b, c, x[4], S32, 0x4bdecfa9); /* 38 */
+ HH(c, d, a, b, x[7], S33, 0xf6bb4b60); /* 39 */
+ HH(b, c, d, a, x[10], S34, 0xbebfbc70); /* 40 */
+ HH(a, b, c, d, x[13], S31, 0x289b7ec6); /* 41 */
+ HH(d, a, b, c, x[0], S32, 0xeaa127fa); /* 42 */
+ HH(c, d, a, b, x[3], S33, 0xd4ef3085); /* 43 */
+ HH(b, c, d, a, x[6], S34, 0x4881d05); /* 44 */
+ HH(a, b, c, d, x[9], S31, 0xd9d4d039); /* 45 */
+ HH(d, a, b, c, x[12], S32, 0xe6db99e5); /* 46 */
+ HH(c, d, a, b, x[15], S33, 0x1fa27cf8); /* 47 */
+ HH(b, c, d, a, x[2], S34, 0xc4ac5665); /* 48 */
- /* Round 3 */
- HH (a, b, c, d, x[ 5], S31, 0xfffa3942); /* 33 */
- HH (d, a, b, c, x[ 8], S32, 0x8771f681); /* 34 */
- HH (c, d, a, b, x[11], S33, 0x6d9d6122); /* 35 */
- HH (b, c, d, a, x[14], S34, 0xfde5380c); /* 36 */
- HH (a, b, c, d, x[ 1], S31, 0xa4beea44); /* 37 */
- HH (d, a, b, c, x[ 4], S32, 0x4bdecfa9); /* 38 */
- HH (c, d, a, b, x[ 7], S33, 0xf6bb4b60); /* 39 */
- HH (b, c, d, a, x[10], S34, 0xbebfbc70); /* 40 */
- HH (a, b, c, d, x[13], S31, 0x289b7ec6); /* 41 */
- HH (d, a, b, c, x[ 0], S32, 0xeaa127fa); /* 42 */
- HH (c, d, a, b, x[ 3], S33, 0xd4ef3085); /* 43 */
- HH (b, c, d, a, x[ 6], S34, 0x4881d05); /* 44 */
- HH (a, b, c, d, x[ 9], S31, 0xd9d4d039); /* 45 */
- HH (d, a, b, c, x[12], S32, 0xe6db99e5); /* 46 */
- HH (c, d, a, b, x[15], S33, 0x1fa27cf8); /* 47 */
- HH (b, c, d, a, x[ 2], S34, 0xc4ac5665); /* 48 */
+ /* Round 4 */
+ II(a, b, c, d, x[0], S41, 0xf4292244); /* 49 */
+ II(d, a, b, c, x[7], S42, 0x432aff97); /* 50 */
+ II(c, d, a, b, x[14], S43, 0xab9423a7); /* 51 */
+ II(b, c, d, a, x[5], S44, 0xfc93a039); /* 52 */
+ II(a, b, c, d, x[12], S41, 0x655b59c3); /* 53 */
+ II(d, a, b, c, x[3], S42, 0x8f0ccc92); /* 54 */
+ II(c, d, a, b, x[10], S43, 0xffeff47d); /* 55 */
+ II(b, c, d, a, x[1], S44, 0x85845dd1); /* 56 */
+ II(a, b, c, d, x[8], S41, 0x6fa87e4f); /* 57 */
+ II(d, a, b, c, x[15], S42, 0xfe2ce6e0); /* 58 */
+ II(c, d, a, b, x[6], S43, 0xa3014314); /* 59 */
+ II(b, c, d, a, x[13], S44, 0x4e0811a1); /* 60 */
+ II(a, b, c, d, x[4], S41, 0xf7537e82); /* 61 */
+ II(d, a, b, c, x[11], S42, 0xbd3af235); /* 62 */
+ II(c, d, a, b, x[2], S43, 0x2ad7d2bb); /* 63 */
+ II(b, c, d, a, x[9], S44, 0xeb86d391); /* 64 */
- /* Round 4 */
- II (a, b, c, d, x[ 0], S41, 0xf4292244); /* 49 */
- II (d, a, b, c, x[ 7], S42, 0x432aff97); /* 50 */
- II (c, d, a, b, x[14], S43, 0xab9423a7); /* 51 */
- II (b, c, d, a, x[ 5], S44, 0xfc93a039); /* 52 */
- II (a, b, c, d, x[12], S41, 0x655b59c3); /* 53 */
- II (d, a, b, c, x[ 3], S42, 0x8f0ccc92); /* 54 */
- II (c, d, a, b, x[10], S43, 0xffeff47d); /* 55 */
- II (b, c, d, a, x[ 1], S44, 0x85845dd1); /* 56 */
- II (a, b, c, d, x[ 8], S41, 0x6fa87e4f); /* 57 */
- II (d, a, b, c, x[15], S42, 0xfe2ce6e0); /* 58 */
- II (c, d, a, b, x[ 6], S43, 0xa3014314); /* 59 */
- II (b, c, d, a, x[13], S44, 0x4e0811a1); /* 60 */
- II (a, b, c, d, x[ 4], S41, 0xf7537e82); /* 61 */
- II (d, a, b, c, x[11], S42, 0xbd3af235); /* 62 */
- II (c, d, a, b, x[ 2], S43, 0x2ad7d2bb); /* 63 */
- II (b, c, d, a, x[ 9], S44, 0xeb86d391); /* 64 */
-
- state[0] += a;
- state[1] += b;
- state[2] += c;
- state[3] += d;
-
- // Zeroize sensitive information.
- memset ( (uint8_t *) x, 0, sizeof(x));
+ state[0] += a;
+ state[1] += b;
+ state[2] += c;
+ state[3] += d;
+ // Zeroize sensitive information.
+ memset(x, 0, sizeof(x));
}
-
-
// Encodes input (uint32_t) into output (unsigned char). Assumes len is
// a multiple of 4.
-void LLMD5::encode (uint8_t *output, const uint32_t *input, const size_t len) {
-
- size_t i, j;
-
- for (i = 0, j = 0; j < len; i++, j += 4) {
- output[j] = (uint8_t) (input[i] & 0xff);
- output[j+1] = (uint8_t) ((input[i] >> 8) & 0xff);
- output[j+2] = (uint8_t) ((input[i] >> 16) & 0xff);
- output[j+3] = (uint8_t) ((input[i] >> 24) & 0xff);
- }
+void LLMD5::encode(uint8_t* output, const uint32_t* input, const size_t len)
+{
+ for (size_t i = 0, j = 0; j < len; i++, j += 4)
+ {
+ output[j] = (uint8_t)(input[i] & 0xff);
+ output[j + 1] = (uint8_t)((input[i] >> 8) & 0xff);
+ output[j + 2] = (uint8_t)((input[i] >> 16) & 0xff);
+ output[j + 3] = (uint8_t)((input[i] >> 24) & 0xff);
+ }
}
-
-
-
// Decodes input (unsigned char) into output (uint32_t). Assumes len is
// a multiple of 4.
-void LLMD5::decode (uint32_t *output, const uint8_t *input, const size_t len){
-
- size_t i, j;
-
- for (i = 0, j = 0; j < len; i++, j += 4)
- output[i] = ((uint32_t)input[j]) | (((uint32_t)input[j+1]) << 8) |
- (((uint32_t)input[j+2]) << 16) | (((uint32_t)input[j+3]) << 24);
+void LLMD5::decode(uint32_t* output, const uint8_t* input, const size_t len)
+{
+ for (size_t i = 0, j = 0; j < len; i++, j += 4)
+ output[i] = ((uint32_t)input[j]) | (((uint32_t)input[j+1]) << 8) |
+ (((uint32_t)input[j+2]) << 16) | (((uint32_t)input[j+3]) << 24);
}
-
-
diff --git a/indra/llcommon/llmd5.h b/indra/llcommon/llmd5.h
index 46c79cf5a2..ad063fda46 100644
--- a/indra/llcommon/llmd5.h
+++ b/indra/llcommon/llmd5.h
@@ -67,59 +67,57 @@ documentation and/or software.
*/
-#include // uint32_t et al.
+#include // uint32_t et al.
// use for the raw digest output
const int MD5RAW_BYTES = 16;
// use for outputting hex digests
-const int MD5HEX_STR_SIZE = 33; // char hex[MD5HEX_STR_SIZE]; with null
+const int MD5HEX_STR_SIZE = 33; // char hex[MD5HEX_STR_SIZE]; with null
const int MD5HEX_STR_BYTES = 32; // message system fixed size
-class LL_COMMON_API LLMD5 {
-// how many bytes to grab at a time when checking files
- static const int BLOCK_LEN;
+class LL_COMMON_API LLMD5
+{
+ // how many bytes to grab at a time when checking files
+ static const int BLOCK_LEN;
public:
-// methods for controlled operation:
- LLMD5 (); // simple initializer
- void update (const uint8_t *input, const size_t input_length);
- void update (std::istream& stream);
- void update (FILE *file);
- void update (const std::string& str);
- void finalize ();
+ // methods for controlled operation:
+ LLMD5(); // simple initializer
+ void update(const uint8_t* input, const size_t input_length);
+ void update(std::istream& stream);
+ void update(FILE* file);
+ void update(const std::string& str);
+ void finalize();
-// constructors for special circumstances. All these constructors finalize
-// the MD5 context.
- LLMD5 (const unsigned char *string); // digest string, finalize
- LLMD5 (std::istream& stream); // digest stream, finalize
- LLMD5 (FILE *file); // digest file, close, finalize
- LLMD5 (const unsigned char *string, const unsigned int number);
+ // constructors for special circumstances. All these constructors finalize
+ // the MD5 context.
+ LLMD5(const unsigned char* string); // digest string, finalize
+ LLMD5(std::istream& stream); // digest stream, finalize
+ LLMD5(FILE* file); // digest file, close, finalize
+ LLMD5(const unsigned char* string, const unsigned int number);
-// methods to acquire finalized result
- void raw_digest(unsigned char *array) const; // provide 16-byte array for binary data
- void hex_digest(char *string) const; // provide 33-byte array for ascii-hex string
+ // methods to acquire finalized result
+ void raw_digest(unsigned char* array) const; // provide 16-byte array for binary data
+ void hex_digest(char* string) const; // provide 33-byte array for ascii-hex string
- friend LL_COMMON_API std::ostream& operator<< (std::ostream&, LLMD5 context);
+ friend LL_COMMON_API std::ostream& operator<<(std::ostream&, const LLMD5& context);
private:
+ // next, the private data:
+ uint32_t state[4];
+ uint64_t count; // number of *bits*, mod 2^64
+ uint8_t buffer[64]; // input buffer
+ uint8_t digest[16];
+ bool finalized;
+ // last, the private methods, mostly static:
+ void init(); // called by all constructors
+ void transform(const uint8_t* buffer); // does the real update work. Note
+ // that length is implied to be 64.
-// next, the private data:
- uint32_t state[4];
- uint64_t count; // number of *bits*, mod 2^64
- uint8_t buffer[64]; // input buffer
- uint8_t digest[16];
- uint8_t finalized;
-
-// last, the private methods, mostly static:
- void init (); // called by all constructors
- void transform (const uint8_t *buffer); // does the real update work. Note
- // that length is implied to be 64.
-
- static void encode (uint8_t *dest, const uint32_t *src, const size_t length);
- static void decode (uint32_t *dest, const uint8_t *src, const size_t length);
-
+ static void encode(uint8_t* dest, const uint32_t* src, const size_t length);
+ static void decode(uint32_t* dest, const uint8_t* src, const size_t length);
};
LL_COMMON_API bool operator==(const LLMD5& a, const LLMD5& b);
diff --git a/indra/llcommon/llmemory.h b/indra/llcommon/llmemory.h
index cd927b0f4b..fc3bd0b3f2 100644
--- a/indra/llcommon/llmemory.h
+++ b/indra/llcommon/llmemory.h
@@ -222,7 +222,7 @@ inline void* ll_aligned_realloc_16(void* ptr, size_t size, size_t old_size) // r
ll_aligned_free_16(ptr);
}
#endif
- LL_PROFILE_ALLOC(ptr, size);
+ LL_PROFILE_ALLOC(ret, size);
return ret;
}
diff --git a/indra/llcommon/llmutex.h b/indra/llcommon/llmutex.h
index 6e8cf9643b..62943845a5 100644
--- a/indra/llcommon/llmutex.h
+++ b/indra/llcommon/llmutex.h
@@ -194,6 +194,18 @@ public:
mSharedMutex->unlock();
}
+ void lock()
+ {
+ if (mSharedMutex)
+ mSharedMutex->lock();
+ }
+
+ void unlock()
+ {
+ if (mSharedMutex)
+ mSharedMutex->unlock();
+ }
+
private:
LLSharedMutex* mSharedMutex;
};
diff --git a/indra/llcommon/llpointer.h b/indra/llcommon/llpointer.h
index 3b0d569c70..0afde6cd2c 100644
--- a/indra/llcommon/llpointer.h
+++ b/indra/llcommon/llpointer.h
@@ -418,6 +418,17 @@ private:
bool mStayUnique;
};
+template
+bool operator!=(Type* lhs, const LLPointer& rhs)
+{
+ return (lhs != rhs.get());
+}
+
+template
+bool operator==(Type* lhs, const LLPointer& rhs)
+{
+ return (lhs == rhs.get());
+}
// boost hash adapter
template
diff --git a/indra/llcommon/llpredicate.h b/indra/llcommon/llpredicate.h
index 7c6874d279..91c623eae1 100644
--- a/indra/llcommon/llpredicate.h
+++ b/indra/llcommon/llpredicate.h
@@ -139,7 +139,7 @@ namespace LLPredicate
Rule()
{}
- void require(ENUM e, bool match)
+ void mandate(ENUM e, bool match)
{
mRule.set(e, match);
}
@@ -154,7 +154,7 @@ namespace LLPredicate
return (mRule && value).someSet();
}
- bool requires(const Value value) const
+ bool mandates(const Value value) const
{
return (mRule && value).someSet() && (!mRule && value).noneSet();
}
diff --git a/indra/llcommon/llpreprocessor.h b/indra/llcommon/llpreprocessor.h
index 60a63ce1c2..3db0d73efa 100644
--- a/indra/llcommon/llpreprocessor.h
+++ b/indra/llcommon/llpreprocessor.h
@@ -114,15 +114,6 @@
# define LL_THREAD_LOCAL __thread
#endif
-// Static linking with apr on windows needs to be declared.
-#if LL_WINDOWS && !LL_COMMON_LINK_SHARED
-#ifndef APR_DECLARE_STATIC
-#define APR_DECLARE_STATIC // For APR on Windows
-#endif
-#ifndef APU_DECLARE_STATIC
-#define APU_DECLARE_STATIC // For APR util on Windows
-#endif
-#endif
#if defined(LL_WINDOWS)
#define BOOST_REGEX_NO_LIB 1
@@ -135,13 +126,6 @@
// Deal with VC++ problems
#if LL_MSVC
-#ifndef _CRT_SECURE_NO_WARNINGS
-#define _CRT_SECURE_NO_WARNINGS // disable warnings for methods considered unsafe
-#endif
-#ifndef _WINSOCK_DEPRECATED_NO_WARNINGS
-#define _WINSOCK_DEPRECATED_NO_WARNINGS // disable deprecated WinSock API warnings
-#endif
-
// level 4 warnings that we need to disable:
#pragma warning (disable : 4251) // member needs to have dll-interface to be used by clients of class
#pragma warning (disable : 4275) // non dll-interface class used as base for dll-interface class
diff --git a/indra/llcommon/llprocess.h b/indra/llcommon/llprocess.h
index 39ed29c1b4..cc2d6566fc 100644
--- a/indra/llcommon/llprocess.h
+++ b/indra/llcommon/llprocess.h
@@ -29,7 +29,6 @@
#include "llinitparam.h"
#include "llsdparam.h"
-#include "llwin32headerslean.h"
#include "llexception.h"
#include "apr_thread_proc.h"
#include
@@ -38,7 +37,7 @@
#include // std::ostream
#if LL_WINDOWS
-#include "llwin32headerslean.h" // for HANDLE
+#include "llwin32headers.h" // for HANDLE
#elif LL_LINUX
#if defined(Status)
#undef Status
diff --git a/indra/llcommon/llprocessor.cpp b/indra/llcommon/llprocessor.cpp
index 513294a29d..a76dbdb8bb 100644
--- a/indra/llcommon/llprocessor.cpp
+++ b/indra/llcommon/llprocessor.cpp
@@ -34,7 +34,7 @@
//#include
#if LL_WINDOWS
-# include "llwin32headerslean.h"
+# include "llwin32headers.h"
# define _interlockedbittestandset _renamed_interlockedbittestandset
# define _interlockedbittestandreset _renamed_interlockedbittestandreset
# include
@@ -692,7 +692,8 @@ private:
memset(cpu_vendor, 0, len);
sysctlbyname("machdep.cpu.vendor", (void*)cpu_vendor, &len, NULL, 0);
cpu_vendor[0x1f] = 0;
- setInfo(eVendor, cpu_vendor);
+ // M series CPUs don't provide this field so if empty, just fall back to Apple.
+ setInfo(eVendor, (cpu_vendor[0] != '\0') ? cpu_vendor : "Apple");
setInfo(eStepping, getSysctlInt("machdep.cpu.stepping"));
setInfo(eModel, getSysctlInt("machdep.cpu.model"));
diff --git a/indra/llcommon/llsdjson.cpp b/indra/llcommon/llsdjson.cpp
index 5d38e55686..655869a704 100644
--- a/indra/llcommon/llsdjson.cpp
+++ b/indra/llcommon/llsdjson.cpp
@@ -61,12 +61,21 @@ LLSD LlsdFromJson(const boost::json::value& val)
result = LLSD(val.as_bool());
break;
case boost::json::kind::array:
+ {
result = LLSD::emptyArray();
- for (const auto &element : val.as_array())
+ const boost::json::array& array = val.as_array();
+ size_t size = array.size();
+ // allocate elements 0 .. (size() - 1) to avoid incremental allocation
+ if (! array.empty())
{
- result.append(LlsdFromJson(element));
+ result[size - 1] = LLSD();
+ }
+ for (size_t i = 0; i < size; i++)
+ {
+ result[i] = (LlsdFromJson(array[i]));
}
break;
+ }
case boost::json::kind::object:
result = LLSD::emptyMap();
for (const auto& element : val.as_object())
@@ -106,6 +115,7 @@ boost::json::value LlsdToJson(const LLSD &val)
case LLSD::TypeMap:
{
boost::json::object& obj = result.emplace_object();
+ obj.reserve(val.size());
for (const auto& llsd_dat : llsd::inMap(val))
{
obj[llsd_dat.first] = LlsdToJson(llsd_dat.second);
@@ -115,6 +125,7 @@ boost::json::value LlsdToJson(const LLSD &val)
case LLSD::TypeArray:
{
boost::json::array& json_array = result.emplace_array();
+ json_array.reserve(val.size());
for (const auto& llsd_dat : llsd::inArray(val))
{
json_array.push_back(LlsdToJson(llsd_dat));
@@ -123,7 +134,8 @@ boost::json::value LlsdToJson(const LLSD &val)
}
case LLSD::TypeBinary:
default:
- LL_ERRS("LlsdToJson") << "Unsupported conversion to JSON from LLSD type (" << val.type() << ")." << LL_ENDL;
+ LL_ERRS("LlsdToJson") << "Unsupported conversion to JSON from LLSD type ("
+ << val.type() << ")." << LL_ENDL;
break;
}
diff --git a/indra/llcommon/llsdutil.cpp b/indra/llcommon/llsdutil.cpp
index df52be6ff4..ac86f4ff6f 100644
--- a/indra/llcommon/llsdutil.cpp
+++ b/indra/llcommon/llsdutil.cpp
@@ -32,8 +32,7 @@
#include
#if LL_WINDOWS
-# define WIN32_LEAN_AND_MEAN
-# include // for htonl
+# include "llwin32headers.h" // for htonl
#elif LL_LINUX
# include
#elif LL_DARWIN
diff --git a/indra/llcommon/llstacktrace.cpp b/indra/llcommon/llstacktrace.cpp
index ca8f4299d9..c223c26bb0 100644
--- a/indra/llcommon/llstacktrace.cpp
+++ b/indra/llcommon/llstacktrace.cpp
@@ -32,7 +32,7 @@
#include
#include
-#include "llwin32headerslean.h"
+#include "llwin32headers.h"
#include
typedef USHORT NTAPI RtlCaptureStackBackTrace_Function(
diff --git a/indra/llcommon/llstrider.h b/indra/llcommon/llstrider.h
index 06cf8d3480..d756aca62b 100644
--- a/indra/llcommon/llstrider.h
+++ b/indra/llcommon/llstrider.h
@@ -41,6 +41,13 @@ public:
LLStrider(Object* first) { mObjectp = first; mSkip = sizeof(Object); }
~LLStrider() { }
+ const LLStrider