summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
Diffstat (limited to 'indra')
-rw-r--r--indra/CMakeLists.txt3
-rw-r--r--indra/llcommon/fsyspath.h56
-rw-r--r--indra/llcommon/llkeybind.cpp20
-rw-r--r--indra/llcommon/llkeybind.h4
-rw-r--r--indra/llcommon/llpointer.h256
-rw-r--r--indra/llcommon/llqueuedthread.cpp4
-rw-r--r--indra/llcommon/lua_function.cpp8
-rw-r--r--indra/llmath/llinterp.h4
-rw-r--r--indra/llmath/llmath.h6
-rw-r--r--indra/llmath/llvolume.cpp28
-rw-r--r--indra/llmath/raytrace.cpp2
-rw-r--r--indra/llrender/llimagegl.cpp2
-rw-r--r--indra/llui/llluafloater.cpp4
-rw-r--r--indra/llwindow/llwindowmacosx.cpp8
-rw-r--r--indra/newview/gltfscenemanager.cpp2
-rw-r--r--indra/newview/llcylinder.cpp2
-rw-r--r--indra/newview/llluamanager.cpp8
-rw-r--r--indra/newview/llmeshrepository.cpp6
-rw-r--r--indra/newview/llmeshrepository.h4
-rw-r--r--indra/newview/llpanelemojicomplete.cpp2
-rw-r--r--indra/newview/llpanelprimmediacontrols.cpp2
-rw-r--r--indra/newview/llsky.cpp2
-rw-r--r--indra/newview/llsprite.cpp2
-rw-r--r--indra/newview/lltexturefetch.cpp6
-rw-r--r--indra/newview/llviewermedia.cpp4
-rw-r--r--indra/newview/llviewerwindow.cpp2
-rw-r--r--indra/newview/llvoicewebrtc.cpp20
-rw-r--r--indra/newview/llworldmipmap.cpp2
-rw-r--r--indra/newview/tests/llluamanager_test.cpp6
-rw-r--r--indra/viewer_components/login/lllogin.cpp3
30 files changed, 175 insertions, 303 deletions
diff --git a/indra/CMakeLists.txt b/indra/CMakeLists.txt
index 422927704a..bf0a051799 100644
--- a/indra/CMakeLists.txt
+++ b/indra/CMakeLists.txt
@@ -29,6 +29,9 @@ else()
set( USE_AUTOBUILD_3P ON )
endif()
+set(CMAKE_CXX_STANDARD 20)
+set(CMAKE_CXX_STANDARD_REQUIRED ON)
+
include(Variables)
include(BuildVersion)
diff --git a/indra/llcommon/fsyspath.h b/indra/llcommon/fsyspath.h
index 1b4aec09b4..f66970ed8f 100644
--- a/indra/llcommon/fsyspath.h
+++ b/indra/llcommon/fsyspath.h
@@ -12,7 +12,10 @@
#if ! defined(LL_FSYSPATH_H)
#define LL_FSYSPATH_H
+#include <boost/iterator/transform_iterator.hpp>
#include <filesystem>
+#include <string>
+#include <string_view>
// 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
@@ -33,42 +36,55 @@
// 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<char8_t> 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.
+// 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;
+ // In C++20 (__cpp_lib_char8_t), std::filesystem::u8path() is deprecated.
+ // std::filesystem::path(iter, iter) performs UTF-8 conversions when the
+ // value_type of the iterators is char8_t. While we could copy into a
+ // temporary std::u8string and from there into std::filesystem::path, to
+ // minimize string copying we'll define a transform_iterator that accepts
+ // a std::string_view::iterator and dereferences to char8_t.
+ struct u8ify
+ {
+ char8_t operator()(char c) const { return char8_t(c); }
+ };
+ using u8iter = boost::transform_iterator<u8ify, std::string_view::iterator>;
+
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 UTF-8 encoded string
+ fsyspath(const std::string& path): fsyspath(std::string_view(path)) {}
+ fsyspath(const char* path): fsyspath(std::string_view(path)) {}
+ fsyspath(std::string_view path):
+ super(u8iter(path.begin(), u8ify()), u8iter(path.end(), u8ify()))
+ {}
// 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)
+ fsyspath& operator=(const super& p) { super::operator=(p); return *this; }
+ fsyspath& operator=(const std::string& p) { return (*this) = std::string_view(p); }
+ fsyspath& operator=(const char* p) { return (*this) = std::string_view(p); }
+ fsyspath& operator=(std::string_view p)
{
- super::operator=(std::filesystem::u8path(p));
+ assign(u8iter(p.begin(), u8ify()), u8iter(p.end(), u8ify()));
return *this;
}
// shadow base-class string() method with UTF-8 aware method
- std::string string() const { return super::u8string(); }
+ std::string string() const
+ {
+ // Short of forbidden type punning, I see no way to avoid copying this
+ // std::u8string to a std::string.
+ auto u8str{ super::u8string() };
+ // from https://github.com/tahonermann/char8_t-remediation/blob/master/char8_t-remediation.h#L180-L182
+ return { u8str.begin(), u8str.end() };
+ }
// 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
diff --git a/indra/llcommon/llkeybind.cpp b/indra/llcommon/llkeybind.cpp
index e36c1d0a4c..34254f3ef5 100644
--- a/indra/llcommon/llkeybind.cpp
+++ b/indra/llcommon/llkeybind.cpp
@@ -123,22 +123,18 @@ LLKeyData& LLKeyData::operator=(const LLKeyData& rhs)
return *this;
}
-bool LLKeyData::operator==(const LLKeyData& rhs)
+bool LLKeyData::operator==(const LLKeyData& rhs) const
{
- if (mMouse != rhs.mMouse) return false;
- if (mKey != rhs.mKey) return false;
- if (mMask != rhs.mMask) return false;
- if (mIgnoreMasks != rhs.mIgnoreMasks) return false;
- return true;
+ return
+ (mMouse == rhs.mMouse) &&
+ (mKey == rhs.mKey) &&
+ (mMask == rhs.mMask) &&
+ (mIgnoreMasks == rhs.mIgnoreMasks);
}
-bool LLKeyData::operator!=(const LLKeyData& rhs)
+bool LLKeyData::operator!=(const LLKeyData& rhs) const
{
- if (mMouse != rhs.mMouse) return true;
- if (mKey != rhs.mKey) return true;
- if (mMask != rhs.mMask) return true;
- if (mIgnoreMasks != rhs.mIgnoreMasks) return true;
- return false;
+ return ! (*this == rhs);
}
bool LLKeyData::canHandle(const LLKeyData& data) const
diff --git a/indra/llcommon/llkeybind.h b/indra/llcommon/llkeybind.h
index 1bbb2fadb5..68efe38689 100644
--- a/indra/llcommon/llkeybind.h
+++ b/indra/llcommon/llkeybind.h
@@ -44,8 +44,8 @@ public:
bool empty() const { return isEmpty(); };
void reset();
LLKeyData& operator=(const LLKeyData& rhs);
- bool operator==(const LLKeyData& rhs);
- bool operator!=(const LLKeyData& rhs);
+ bool operator==(const LLKeyData& rhs) const;
+ bool operator!=(const LLKeyData& rhs) const;
bool canHandle(const LLKeyData& data) const;
bool canHandle(EMouseClickType mouse, KEY key, MASK mask) const;
diff --git a/indra/llcommon/llpointer.h b/indra/llcommon/llpointer.h
index 048547e4cc..71c955c4c5 100644
--- a/indra/llcommon/llpointer.h
+++ b/indra/llcommon/llpointer.h
@@ -28,6 +28,7 @@
#include "llerror.h" // *TODO: consider eliminating this
#include "llmutex.h"
+#include <utility> // std::swap()
//----------------------------------------------------------------------------
// RefCount objects should generally only be accessed by way of LLPointer<>'s
@@ -60,6 +61,13 @@ public:
ref();
}
+ // Even though the template constructors below accepting
+ // (const LLPointer<Subclass>&) and (LLPointer<Subclass>&&) appear to
+ // subsume these specific (const LLPointer<Type>&) and (LLPointer<Type>&&)
+ // constructors, the compiler recognizes these as The Copy Constructor and
+ // The Move Constructor, respectively. In other words, even in the
+ // presence of the LLPointer<Subclass> constructors, we still must specify
+ // the LLPointer<Type> constructors.
LLPointer(const LLPointer<Type>& ptr) :
mPointer(ptr.mPointer)
{
@@ -105,32 +113,46 @@ public:
bool notNull() const { return (mPointer != nullptr); }
operator Type*() const { return mPointer; }
- bool operator !=(Type* ptr) const { return (mPointer != ptr); }
- bool operator ==(Type* ptr) const { return (mPointer == ptr); }
- bool operator ==(const LLPointer<Type>& ptr) const { return (mPointer == ptr.mPointer); }
- bool operator < (const LLPointer<Type>& ptr) const { return (mPointer < ptr.mPointer); }
- bool operator > (const LLPointer<Type>& ptr) const { return (mPointer > ptr.mPointer); }
+ template <typename Type1>
+ bool operator !=(Type1* ptr) const { return (mPointer != ptr); }
+ template <typename Type1>
+ bool operator ==(Type1* ptr) const { return (mPointer == ptr); }
+ template <typename Type1>
+ bool operator !=(const LLPointer<Type1>& ptr) const { return (mPointer != ptr.mPointer); }
+ template <typename Type1>
+ bool operator ==(const LLPointer<Type1>& ptr) const { return (mPointer == ptr.mPointer); }
+ bool operator < (const LLPointer<Type>& ptr) const { return (mPointer < ptr.mPointer); }
+ bool operator > (const LLPointer<Type>& ptr) const { return (mPointer > ptr.mPointer); }
LLPointer<Type>& operator =(Type* ptr)
{
- assign(ptr);
+ // copy-and-swap idiom, see http://gotw.ca/gotw/059.htm
+ LLPointer temp(ptr);
+ using std::swap; // per Swappable convention
+ swap(*this, temp);
return *this;
}
+ // Even though the template assignment operators below accepting
+ // (const LLPointer<Subclass>&) and (LLPointer<Subclass>&&) appear to
+ // subsume these specific (const LLPointer<Type>&) and (LLPointer<Type>&&)
+ // assignment operators, the compiler recognizes these as Copy Assignment
+ // and Move Assignment, respectively. In other words, even in the presence
+ // of the LLPointer<Subclass> assignment operators, we still must specify
+ // the LLPointer<Type> operators.
LLPointer<Type>& operator =(const LLPointer<Type>& ptr)
{
- assign(ptr);
+ LLPointer temp(ptr);
+ using std::swap; // per Swappable convention
+ swap(*this, temp);
return *this;
}
LLPointer<Type>& operator =(LLPointer<Type>&& ptr)
{
- if (mPointer != ptr.mPointer)
- {
- unref();
- mPointer = ptr.mPointer;
- ptr.mPointer = nullptr;
- }
+ LLPointer temp(std::move(ptr));
+ using std::swap; // per Swappable convention
+ swap(*this, temp);
return *this;
}
@@ -138,28 +160,32 @@ public:
template<typename Subclass>
LLPointer<Type>& operator =(const LLPointer<Subclass>& ptr)
{
- assign(ptr.get());
+ LLPointer temp(ptr);
+ using std::swap; // per Swappable convention
+ swap(*this, temp);
return *this;
}
template<typename Subclass>
LLPointer<Type>& operator =(LLPointer<Subclass>&& ptr)
{
- if (mPointer != ptr.mPointer)
- {
- unref();
- mPointer = ptr.mPointer;
- ptr.mPointer = nullptr;
- }
+ LLPointer temp(std::move(ptr));
+ using std::swap; // per Swappable convention
+ swap(*this, temp);
return *this;
}
// Just exchange the pointers, which will not change the reference counts.
static void swap(LLPointer<Type>& a, LLPointer<Type>& b)
{
- Type* temp = a.mPointer;
- a.mPointer = b.mPointer;
- b.mPointer = temp;
+ using std::swap; // per Swappable convention
+ swap(a.mPointer, b.mPointer);
+ }
+
+ // Put swap() overload in the global namespace, per Swappable convention
+ friend void swap(LLPointer<Type>& a, LLPointer<Type>& b)
+ {
+ LLPointer<Type>::swap(a, b);
}
protected:
@@ -191,184 +217,12 @@ protected:
}
#endif // LL_LIBRARY_INCLUDE
- void assign(const LLPointer<Type>& ptr)
- {
- if (mPointer != ptr.mPointer)
- {
- unref();
- mPointer = ptr.mPointer;
- ref();
- }
- }
-
protected:
Type* mPointer;
};
-template <class Type> class LLConstPointer
-{
- template<typename Subclass>
- friend class LLConstPointer;
-public:
- LLConstPointer() :
- mPointer(nullptr)
- {
- }
-
- LLConstPointer(const Type* ptr) :
- mPointer(ptr)
- {
- ref();
- }
-
- LLConstPointer(const LLConstPointer<Type>& ptr) :
- mPointer(ptr.mPointer)
- {
- ref();
- }
-
- LLConstPointer(LLConstPointer<Type>&& ptr) noexcept
- {
- mPointer = ptr.mPointer;
- ptr.mPointer = nullptr;
- }
-
- // support conversion up the type hierarchy. See Item 45 in Effective C++, 3rd Ed.
- template<typename Subclass>
- LLConstPointer(const LLConstPointer<Subclass>& ptr) :
- mPointer(ptr.get())
- {
- ref();
- }
-
- template<typename Subclass>
- LLConstPointer(LLConstPointer<Subclass>&& ptr) noexcept :
- mPointer(ptr.get())
- {
- ptr.mPointer = nullptr;
- }
-
- ~LLConstPointer()
- {
- unref();
- }
-
- const Type* get() const { return mPointer; }
- const Type* operator->() const { return mPointer; }
- const Type& operator*() const { return *mPointer; }
-
- operator BOOL() const { return (mPointer != nullptr); }
- operator bool() const { return (mPointer != nullptr); }
- bool operator!() const { return (mPointer == nullptr); }
- bool isNull() const { return (mPointer == nullptr); }
- bool notNull() const { return (mPointer != nullptr); }
-
- operator const Type*() const { return mPointer; }
- bool operator !=(const Type* ptr) const { return (mPointer != ptr); }
- bool operator ==(const Type* ptr) const { return (mPointer == ptr); }
- bool operator ==(const LLConstPointer<Type>& ptr) const { return (mPointer == ptr.mPointer); }
- bool operator < (const LLConstPointer<Type>& ptr) const { return (mPointer < ptr.mPointer); }
- bool operator > (const LLConstPointer<Type>& ptr) const { return (mPointer > ptr.mPointer); }
-
- LLConstPointer<Type>& operator =(const Type* ptr)
- {
- if( mPointer != ptr )
- {
- unref();
- mPointer = ptr;
- ref();
- }
-
- return *this;
- }
-
- LLConstPointer<Type>& operator =(const LLConstPointer<Type>& ptr)
- {
- if( mPointer != ptr.mPointer )
- {
- unref();
- mPointer = ptr.mPointer;
- ref();
- }
- return *this;
- }
-
- LLConstPointer<Type>& operator =(LLConstPointer<Type>&& ptr)
- {
- if (mPointer != ptr.mPointer)
- {
- unref();
- mPointer = ptr.mPointer;
- ptr.mPointer = nullptr;
- }
- return *this;
- }
-
- // support assignment up the type hierarchy. See Item 45 in Effective C++, 3rd Ed.
- template<typename Subclass>
- LLConstPointer<Type>& operator =(const LLConstPointer<Subclass>& ptr)
- {
- if( mPointer != ptr.get() )
- {
- unref();
- mPointer = ptr.get();
- ref();
- }
- return *this;
- }
-
- template<typename Subclass>
- LLConstPointer<Type>& operator =(LLConstPointer<Subclass>&& ptr)
- {
- if (mPointer != ptr.mPointer)
- {
- unref();
- mPointer = ptr.mPointer;
- ptr.mPointer = nullptr;
- }
- return *this;
- }
-
- // Just exchange the pointers, which will not change the reference counts.
- static void swap(LLConstPointer<Type>& a, LLConstPointer<Type>& b)
- {
- const Type* temp = a.mPointer;
- a.mPointer = b.mPointer;
- b.mPointer = temp;
- }
-
-protected:
-#ifdef LL_LIBRARY_INCLUDE
- void ref();
- void unref();
-#else // LL_LIBRARY_INCLUDE
- void ref()
- {
- if (mPointer)
- {
- mPointer->ref();
- }
- }
-
- void unref()
- {
- if (mPointer)
- {
- const Type *temp = mPointer;
- mPointer = nullptr;
- temp->unref();
- if (mPointer != nullptr)
- {
- LL_WARNS() << "Unreference did assignment to non-NULL because of destructor" << LL_ENDL;
- unref();
- }
- }
- }
-#endif // LL_LIBRARY_INCLUDE
-
-protected:
- const Type* mPointer;
-};
+template <typename Type>
+using LLConstPointer = LLPointer<const Type>;
template<typename Type>
class LLCopyOnWritePointer : public LLPointer<Type>
@@ -418,14 +272,14 @@ private:
bool mStayUnique;
};
-template<typename Type>
-bool operator!=(Type* lhs, const LLPointer<Type>& rhs)
+template<typename Type0, typename Type1>
+bool operator!=(Type0* lhs, const LLPointer<Type1>& rhs)
{
return (lhs != rhs.get());
}
-template<typename Type>
-bool operator==(Type* lhs, const LLPointer<Type>& rhs)
+template<typename Type0, typename Type1>
+bool operator==(Type0* lhs, const LLPointer<Type1>& rhs)
{
return (lhs == rhs.get());
}
diff --git a/indra/llcommon/llqueuedthread.cpp b/indra/llcommon/llqueuedthread.cpp
index 1c4ac5a7bf..0196a24b18 100644
--- a/indra/llcommon/llqueuedthread.cpp
+++ b/indra/llcommon/llqueuedthread.cpp
@@ -146,7 +146,7 @@ size_t LLQueuedThread::updateQueue(F32 max_time_ms)
// schedule a call to threadedUpdate for every call to updateQueue
if (!isQuitting())
{
- mRequestQueue.post([=]()
+ mRequestQueue.post([=, this]()
{
LL_PROFILE_ZONE_NAMED_CATEGORY_THREAD("qt - update");
mIdleThread = false;
@@ -474,7 +474,7 @@ void LLQueuedThread::processRequest(LLQueuedThread::QueuedRequest* req)
#else
using namespace std::chrono_literals;
auto retry_time = LL::WorkQueue::TimePoint::clock::now() + 16ms;
- mRequestQueue.post([=]
+ mRequestQueue.post([=, this]
{
LL_PROFILE_ZONE_NAMED("processRequest - retry");
if (LL::WorkQueue::TimePoint::clock::now() < retry_time)
diff --git a/indra/llcommon/lua_function.cpp b/indra/llcommon/lua_function.cpp
index a9f88f3170..de06dab264 100644
--- a/indra/llcommon/lua_function.cpp
+++ b/indra/llcommon/lua_function.cpp
@@ -170,7 +170,7 @@ fsyspath source_path(lua_State* L)
{
lua_getinfo(L, i, "s", &ar);
}
- return ar.source;
+ return { ar.source };
}
} // namespace lluau
@@ -1108,7 +1108,7 @@ lua_function(source_path, "source_path(): return the source path of the running
{
lua_checkdelta(L, 1);
lluau_checkstack(L, 1);
- lua_pushstdstring(L, lluau::source_path(L).u8string());
+ lua_pushstdstring(L, lluau::source_path(L));
return 1;
}
@@ -1119,7 +1119,7 @@ lua_function(source_dir, "source_dir(): return the source directory of the runni
{
lua_checkdelta(L, 1);
lluau_checkstack(L, 1);
- lua_pushstdstring(L, lluau::source_path(L).parent_path().u8string());
+ lua_pushstdstring(L, fsyspath(lluau::source_path(L).parent_path()));
return 1;
}
@@ -1132,7 +1132,7 @@ lua_function(abspath, "abspath(path): "
lua_checkdelta(L);
auto path{ lua_tostdstring(L, 1) };
lua_pop(L, 1);
- lua_pushstdstring(L, (lluau::source_path(L).parent_path() / path).u8string());
+ lua_pushstdstring(L, fsyspath(lluau::source_path(L).parent_path() / path));
return 1;
}
diff --git a/indra/llmath/llinterp.h b/indra/llmath/llinterp.h
index f4faa82a82..386679ffe9 100644
--- a/indra/llmath/llinterp.h
+++ b/indra/llmath/llinterp.h
@@ -29,11 +29,11 @@
#if defined(LL_WINDOWS)
// macro definitions for common math constants (e.g. M_PI) are declared under the _USE_MATH_DEFINES
// on Windows system.
-// So, let's define _USE_MATH_DEFINES before including math.h
+// So, let's define _USE_MATH_DEFINES before including cmath
#define _USE_MATH_DEFINES
#endif
-#include "math.h"
+#include <cmath>
// Class from which different types of interpolators can be derived
diff --git a/indra/llmath/llmath.h b/indra/llmath/llmath.h
index fa315291a3..1d6d986207 100644
--- a/indra/llmath/llmath.h
+++ b/indra/llmath/llmath.h
@@ -358,7 +358,11 @@ inline F32 snap_to_sig_figs(F32 foo, S32 sig_figs)
return new_foo;
}
-inline F32 lerp(F32 a, F32 b, F32 u)
+using std::lerp;
+// Even though there's now a std::lerp() function that appears to do the same
+// as this function, in some cases MSVC likes this one better: some calls to
+// std::lerp() produce fatal argument conversion warnings.
+inline F32 flerp(F32 a, F32 b, F32 u)
{
return a + ((b - a) * u);
}
diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp
index 700e61467b..275e5bcb43 100644
--- a/indra/llmath/llvolume.cpp
+++ b/indra/llmath/llvolume.cpp
@@ -1294,9 +1294,9 @@ void LLPath::genNGon(const LLPathParams& params, S32 sides, F32 startOff, F32 en
c = cos(ang)*lerp(radius_start, radius_end, t);
- pt->mPos.set(0 + lerp(0,params.getShear().mV[0],s)
- + lerp(-skew ,skew, t) * 0.5f,
- c + lerp(0,params.getShear().mV[1],s),
+ pt->mPos.set(0 + flerp(0,params.getShear().mV[0],s)
+ + flerp(-skew ,skew, t) * 0.5f,
+ c + flerp(0,params.getShear().mV[1],s),
s);
pt->mScale.set(hole_x * lerp(taper_x_begin, taper_x_end, t),
hole_y * lerp(taper_y_begin, taper_y_end, t),
@@ -1327,9 +1327,9 @@ void LLPath::genNGon(const LLPathParams& params, S32 sides, F32 startOff, F32 en
c = cos(ang)*lerp(radius_start, radius_end, t);
s = sin(ang)*lerp(radius_start, radius_end, t);
- pt->mPos.set(0 + lerp(0,params.getShear().mV[0],s)
- + lerp(-skew ,skew, t) * 0.5f,
- c + lerp(0,params.getShear().mV[1],s),
+ pt->mPos.set(0 + flerp(0,params.getShear().mV[0],s)
+ + flerp(-skew ,skew, t) * 0.5f,
+ c + flerp(0,params.getShear().mV[1],s),
s);
pt->mScale.set(hole_x * lerp(taper_x_begin, taper_x_end, t),
@@ -1354,9 +1354,9 @@ void LLPath::genNGon(const LLPathParams& params, S32 sides, F32 startOff, F32 en
c = cos(ang)*lerp(radius_start, radius_end, t);
s = sin(ang)*lerp(radius_start, radius_end, t);
- pt->mPos.set(0 + lerp(0,params.getShear().mV[0],s)
- + lerp(-skew ,skew, t) * 0.5f,
- c + lerp(0,params.getShear().mV[1],s),
+ pt->mPos.set(0 + flerp(0,params.getShear().mV[0],s)
+ + flerp(-skew ,skew, t) * 0.5f,
+ c + flerp(0,params.getShear().mV[1],s),
s);
pt->mScale.set(hole_x * lerp(taper_x_begin, taper_x_end, t),
hole_y * lerp(taper_y_begin, taper_y_end, t),
@@ -1494,8 +1494,8 @@ bool LLPath::generate(const LLPathParams& params, F32 detail, S32 split,
for (S32 i=0;i<np;i++)
{
F32 t = lerp(params.getBegin(),params.getEnd(),(F32)i * mStep);
- mPath[i].mPos.set(lerp(0,params.getShear().mV[0],t),
- lerp(0,params.getShear().mV[1],t),
+ mPath[i].mPos.set(flerp(0,params.getShear().mV[0],t),
+ flerp(0,params.getShear().mV[1],t),
t - 0.5f);
LLQuaternion quat;
quat.setQuat(lerp(F_PI * params.getTwistBegin(),F_PI * params.getTwist(),t),0,0,1);
@@ -1559,10 +1559,10 @@ bool LLPath::generate(const LLPathParams& params, F32 detail, S32 split,
{
F32 t = (F32)i * mStep;
mPath[i].mPos.set(0,
- lerp(0, -sin(F_PI*params.getTwist()*t)*0.5f,t),
+ flerp(0, -sin(F_PI*params.getTwist()*t)*0.5f,t),
lerp(-0.5f, cos(F_PI*params.getTwist()*t)*0.5f,t));
- mPath[i].mScale.set(lerp(1,params.getScale().mV[0],t),
- lerp(1,params.getScale().mV[1],t), 0,1);
+ mPath[i].mScale.set(flerp(1,params.getScale().mV[0],t),
+ flerp(1,params.getScale().mV[1],t), 0,1);
mPath[i].mTexT = t;
LLQuaternion quat;
quat.setQuat(F_PI * params.getTwist() * t,1,0,0);
diff --git a/indra/llmath/raytrace.cpp b/indra/llmath/raytrace.cpp
index 893bf1fc70..1251ab9f8d 100644
--- a/indra/llmath/raytrace.cpp
+++ b/indra/llmath/raytrace.cpp
@@ -26,7 +26,7 @@
#include "linden_common.h"
-#include "math.h"
+#include <cmath>
//#include "vmath.h"
#include "v3math.h"
#include "llquaternion.h"
diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp
index 67b4ada62f..ba77c6f1a4 100644
--- a/indra/llrender/llimagegl.cpp
+++ b/indra/llrender/llimagegl.cpp
@@ -1777,7 +1777,7 @@ void LLImageGL::syncToMainThread(LLGLuint new_tex_name)
ref();
LL::WorkQueue::postMaybe(
mMainQueue,
- [=]()
+ [=, this]()
{
LL_PROFILE_ZONE_NAMED("cglt - delete callback");
syncTexName(new_tex_name);
diff --git a/indra/llui/llluafloater.cpp b/indra/llui/llluafloater.cpp
index ccdadc6ae0..91c0cfeec9 100644
--- a/indra/llui/llluafloater.cpp
+++ b/indra/llui/llluafloater.cpp
@@ -301,11 +301,11 @@ void LLLuaFloater::postEvent(LLSD data, const std::string &event_name)
void LLLuaFloater::showLuaFloater(const LLSD &data)
{
fsyspath fs_path(data["xml_path"].asString());
- std::string path = fs_path.lexically_normal().u8string();
+ fsyspath path = fs_path.lexically_normal();
if (!fs_path.is_absolute())
{
std::string lib_path = gDirUtilp->getExpandedFilename(LL_PATH_SCRIPTS, "lua");
- path = (fsyspath(lib_path) / path).u8string();
+ path = fsyspath(fsyspath(lib_path) / path);
}
LLLuaFloater *floater = new LLLuaFloater(data);
diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp
index e95ad4d970..f1f1633d87 100644
--- a/indra/llwindow/llwindowmacosx.cpp
+++ b/indra/llwindow/llwindowmacosx.cpp
@@ -1040,7 +1040,7 @@ F32 LLWindowMacOSX::getGamma()
&greenGamma,
&blueMin,
&blueMax,
- &blueGamma) == noErr)
+ &blueGamma) == static_cast<CGError>(noErr))
{
// So many choices...
// Let's just return the green channel gamma for now.
@@ -1091,7 +1091,7 @@ bool LLWindowMacOSX::setGamma(const F32 gamma)
&greenGamma,
&blueMin,
&blueMax,
- &blueGamma) != noErr)
+ &blueGamma) != static_cast<CGError>(noErr))
{
return false;
}
@@ -1106,7 +1106,7 @@ bool LLWindowMacOSX::setGamma(const F32 gamma)
gamma,
blueMin,
blueMax,
- gamma) != noErr)
+ gamma) != static_cast<CGError>(noErr))
{
return false;
}
@@ -1158,7 +1158,7 @@ bool LLWindowMacOSX::setCursorPosition(const LLCoordWindow position)
newPosition.y = screen_pos.mY;
CGSetLocalEventsSuppressionInterval(0.0);
- if(CGWarpMouseCursorPosition(newPosition) == noErr)
+ if(CGWarpMouseCursorPosition(newPosition) == static_cast<CGError>(noErr))
{
result = true;
}
diff --git a/indra/newview/gltfscenemanager.cpp b/indra/newview/gltfscenemanager.cpp
index ed66753267..f596ce04f8 100644
--- a/indra/newview/gltfscenemanager.cpp
+++ b/indra/newview/gltfscenemanager.cpp
@@ -500,7 +500,7 @@ void GLTFSceneManager::update()
LLNewBufferedResourceUploadInfo::uploadFinish_f finish = [this, buffer](LLUUID assetId, LLSD response)
{
LLAppViewer::instance()->postToMainCoro(
- [=]()
+ [=, this]()
{
if (mUploadingAsset)
{
diff --git a/indra/newview/llcylinder.cpp b/indra/newview/llcylinder.cpp
index c347d3e1be..d5f1e25151 100644
--- a/indra/newview/llcylinder.cpp
+++ b/indra/newview/llcylinder.cpp
@@ -29,7 +29,7 @@
#include "llcylinder.h"
#include "llerror.h"
-#include "math.h"
+#include <cmath>
#include "llmath.h"
#include "noise.h"
#include "v3math.h"
diff --git a/indra/newview/llluamanager.cpp b/indra/newview/llluamanager.cpp
index 7fe5c1ece0..322717fbb9 100644
--- a/indra/newview/llluamanager.cpp
+++ b/indra/newview/llluamanager.cpp
@@ -317,7 +317,7 @@ LLRequireResolver::LLRequireResolver(lua_State *L, const std::string& path) :
void LLRequireResolver::findModule()
{
// If mPathToResolve is absolute, this replaces mSourceDir.
- auto absolutePath = (mSourceDir / mPathToResolve).u8string();
+ fsyspath absolutePath(mSourceDir / mPathToResolve);
// Push _MODULES table on stack for checking and saving to the cache
luaL_findtable(L, LUA_REGISTRYINDEX, "_MODULES", 1);
@@ -333,7 +333,7 @@ void LLRequireResolver::findModule()
// not already cached - prep error message just in case
auto fail{
- [L=L, path=mPathToResolve.u8string()]()
+ [L=L, path=mPathToResolve.string()]()
{ luaL_error(L, "could not find require('%s')", path.data()); }};
if (mPathToResolve.is_absolute())
@@ -348,10 +348,10 @@ void LLRequireResolver::findModule()
{
// if path is already absolute, operator/() preserves it
auto abspath(fsyspath(gDirUtilp->getAppRODataDir()) / path.asString());
- std::string absolutePathOpt = (abspath / mPathToResolve).u8string();
+ fsyspath absolutePathOpt = (abspath / mPathToResolve);
if (absolutePathOpt.empty())
- luaL_error(L, "error requiring module '%s'", mPathToResolve.u8string().data());
+ luaL_error(L, "error requiring module '%s'", mPathToResolve.string().data());
if (findModuleImpl(absolutePathOpt))
return;
diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp
index a8585c7f23..86126829fd 100644
--- a/indra/newview/llmeshrepository.cpp
+++ b/indra/newview/llmeshrepository.cpp
@@ -548,8 +548,8 @@ LLViewerFetchedTexture* LLMeshUploadThread::FindViewerTexture(const LLImportMate
return ppTex ? (*ppTex).get() : NULL;
}
-volatile S32 LLMeshRepoThread::sActiveHeaderRequests = 0;
-volatile S32 LLMeshRepoThread::sActiveLODRequests = 0;
+std::atomic<S32> LLMeshRepoThread::sActiveHeaderRequests = 0;
+std::atomic<S32> LLMeshRepoThread::sActiveLODRequests = 0;
U32 LLMeshRepoThread::sMaxConcurrentRequests = 1;
S32 LLMeshRepoThread::sRequestLowWater = REQUEST2_LOW_WATER_MIN;
S32 LLMeshRepoThread::sRequestHighWater = REQUEST2_HIGH_WATER_MIN;
@@ -3957,7 +3957,7 @@ void LLMeshRepository::notifyLoadedMeshes()
}
// erase from background thread
- mThread->mWorkQueue.post([=]()
+ mThread->mWorkQueue.post([=, this]()
{
mThread->mSkinMap.erase(id);
});
diff --git a/indra/newview/llmeshrepository.h b/indra/newview/llmeshrepository.h
index d864a07615..c7572c9cbf 100644
--- a/indra/newview/llmeshrepository.h
+++ b/indra/newview/llmeshrepository.h
@@ -256,8 +256,8 @@ class LLMeshRepoThread : public LLThread
{
public:
- volatile static S32 sActiveHeaderRequests;
- volatile static S32 sActiveLODRequests;
+ static std::atomic<S32> sActiveHeaderRequests;
+ static std::atomic<S32> sActiveLODRequests;
static U32 sMaxConcurrentRequests;
static S32 sRequestLowWater;
static S32 sRequestHighWater;
diff --git a/indra/newview/llpanelemojicomplete.cpp b/indra/newview/llpanelemojicomplete.cpp
index 0d6ca1cb94..2d659cd19d 100644
--- a/indra/newview/llpanelemojicomplete.cpp
+++ b/indra/newview/llpanelemojicomplete.cpp
@@ -440,7 +440,7 @@ void LLPanelEmojiComplete::updateConstraints()
{
mRenderRect = getLocalRect();
- mEmojiWidth = (U16)(mIconFont->getWidthF32(u8"\U0001F431") + mPadding * 2);
+ mEmojiWidth = (U16)(mIconFont->getWidthF32(LLWString(1, 0x1F431).c_str()) + mPadding * 2);
if (mVertical)
{
mEmojiHeight = mIconFont->getLineHeight() + mPadding * 2;
diff --git a/indra/newview/llpanelprimmediacontrols.cpp b/indra/newview/llpanelprimmediacontrols.cpp
index 1af585708e..1a092234fb 100644
--- a/indra/newview/llpanelprimmediacontrols.cpp
+++ b/indra/newview/llpanelprimmediacontrols.cpp
@@ -777,7 +777,7 @@ void LLPanelPrimMediaControls::draw()
else if(mFadeTimer.getStarted())
{
F32 time = mFadeTimer.getElapsedTimeF32();
- alpha *= llmax(lerp(1.0, 0.0, time / mControlFadeTime), 0.0f);
+ alpha *= llmax(flerp(1.0, 0.0, time / mControlFadeTime), 0.0f);
if(time >= mControlFadeTime)
{
diff --git a/indra/newview/llsky.cpp b/indra/newview/llsky.cpp
index 82caa14433..66fbe0029a 100644
--- a/indra/newview/llsky.cpp
+++ b/indra/newview/llsky.cpp
@@ -39,7 +39,7 @@
// linden library includes
#include "llerror.h"
#include "llmath.h"
-#include "math.h"
+#include <cmath>
#include "v4color.h"
#include "llviewerobjectlist.h"
diff --git a/indra/newview/llsprite.cpp b/indra/newview/llsprite.cpp
index e51aeb6080..09c57eaf1d 100644
--- a/indra/newview/llsprite.cpp
+++ b/indra/newview/llsprite.cpp
@@ -37,7 +37,7 @@
#include "llsprite.h"
-#include "math.h"
+#include <cmath>
#include "lldrawable.h"
#include "llface.h"
diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp
index 69c40066b4..ee98728ff1 100644
--- a/indra/newview/lltexturefetch.cpp
+++ b/indra/newview/lltexturefetch.cpp
@@ -2832,7 +2832,7 @@ bool LLTextureFetch::getRequestFinished(const LLUUID& id, S32& discard_level,
bool LLTextureFetch::updateRequestPriority(const LLUUID& id, F32 priority)
{
LL_PROFILE_ZONE_SCOPED;
- mRequestQueue.tryPost([=]()
+ mRequestQueue.tryPost([=, this]()
{
LLTextureFetchWorker* worker = getWorker(id);
if (worker)
@@ -3523,8 +3523,8 @@ TFReqSendMetrics::doWork(LLTextureFetch * fetcher)
//if (! gViewerAssetStatsThread1)
// return true;
- static volatile bool reporting_started(false);
- static volatile S32 report_sequence(0);
+ static std::atomic<bool> reporting_started(false);
+ static std::atomic<S32> report_sequence(0);
// In mStatsSD, we have a copy we own of the LLSD representation
// of the asset stats. Add some additional fields and ship it off.
diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp
index 92db598410..9633e54f29 100644
--- a/indra/newview/llviewermedia.cpp
+++ b/indra/newview/llviewermedia.cpp
@@ -2903,14 +2903,14 @@ void LLViewerMediaImpl::update()
media_tex->ref();
main_queue->postTo(
mTexUpdateQueue, // Worker thread queue
- [=]() // work done on update worker thread
+ [=, this]() // work done on update worker thread
{
#if LL_IMAGEGL_THREAD_CHECK
media_tex->getGLTexture()->mActiveThread = LLThread::currentID();
#endif
doMediaTexUpdate(media_tex, data, data_width, data_height, x_pos, y_pos, width, height, true);
},
- [=]() // callback to main thread
+ [=, this]() // callback to main thread
{
#if LL_IMAGEGL_THREAD_CHECK
media_tex->getGLTexture()->mActiveThread = LLThread::currentID();
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index bef667e3bb..fa696d2d87 100644
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -1331,7 +1331,7 @@ LLWindowCallbacks::DragNDropResult LLViewerWindow::handleDragNDrop( LLWindow *wi
// Check the whitelist, if there's media (otherwise just show it)
if (te->getMediaData() == NULL || te->getMediaData()->checkCandidateUrl(url))
{
- if ( obj != mDragHoveredObject)
+ if (obj != mDragHoveredObject)
{
// Highlight the dragged object
LLSelectMgr::getInstance()->unhighlightObjectOnly(mDragHoveredObject);
diff --git a/indra/newview/llvoicewebrtc.cpp b/indra/newview/llvoicewebrtc.cpp
index 7161f5af5e..4da348d090 100644
--- a/indra/newview/llvoicewebrtc.cpp
+++ b/indra/newview/llvoicewebrtc.cpp
@@ -551,7 +551,7 @@ void LLWebRTCVoiceClient::voiceConnectionCoro()
}
}
LL::WorkQueue::postMaybe(mMainQueue,
- [=] {
+ [=, this] {
if (sShuttingDown)
{
return;
@@ -669,7 +669,7 @@ void LLWebRTCVoiceClient::OnDevicesChanged(const llwebrtc::LLWebRTCVoiceDeviceLi
{
LL::WorkQueue::postMaybe(mMainQueue,
- [=]
+ [=, this]
{
OnDevicesChangedImpl(render_devices, capture_devices);
});
@@ -2205,7 +2205,7 @@ LLVoiceWebRTCConnection::~LLVoiceWebRTCConnection()
void LLVoiceWebRTCConnection::OnIceGatheringState(llwebrtc::LLWebRTCSignalingObserver::EIceGatheringState state)
{
LL::WorkQueue::postMaybe(mMainQueue,
- [=] {
+ [=, this] {
LL_DEBUGS("Voice") << "Ice Gathering voice account. " << state << LL_ENDL;
switch (state)
@@ -2228,7 +2228,7 @@ void LLVoiceWebRTCConnection::OnIceGatheringState(llwebrtc::LLWebRTCSignalingObs
// callback from llwebrtc
void LLVoiceWebRTCConnection::OnIceCandidate(const llwebrtc::LLWebRTCIceCandidate& candidate)
{
- LL::WorkQueue::postMaybe(mMainQueue, [=] { mIceCandidates.push_back(candidate); });
+ LL::WorkQueue::postMaybe(mMainQueue, [=, this] { mIceCandidates.push_back(candidate); });
}
void LLVoiceWebRTCConnection::processIceUpdates()
@@ -2346,7 +2346,7 @@ void LLVoiceWebRTCConnection::processIceUpdatesCoro(connectionPtr_t connection)
void LLVoiceWebRTCConnection::OnOfferAvailable(const std::string &sdp)
{
LL::WorkQueue::postMaybe(mMainQueue,
- [=] {
+ [=, this] {
if (mShutDown)
{
return;
@@ -2373,7 +2373,7 @@ void LLVoiceWebRTCConnection::OnOfferAvailable(const std::string &sdp)
void LLVoiceWebRTCConnection::OnAudioEstablished(llwebrtc::LLWebRTCAudioInterface* audio_interface)
{
LL::WorkQueue::postMaybe(mMainQueue,
- [=] {
+ [=, this] {
if (mShutDown)
{
return;
@@ -2395,7 +2395,7 @@ void LLVoiceWebRTCConnection::OnAudioEstablished(llwebrtc::LLWebRTCAudioInterfac
void LLVoiceWebRTCConnection::OnRenegotiationNeeded()
{
LL::WorkQueue::postMaybe(mMainQueue,
- [=] {
+ [=, this] {
LL_DEBUGS("Voice") << "Voice channel requires renegotiation." << LL_ENDL;
if (!mShutDown)
{
@@ -2409,7 +2409,7 @@ void LLVoiceWebRTCConnection::OnRenegotiationNeeded()
void LLVoiceWebRTCConnection::OnPeerConnectionClosed()
{
LL::WorkQueue::postMaybe(mMainQueue,
- [=] {
+ [=, this] {
LL_DEBUGS("Voice") << "Peer connection has closed." << LL_ENDL;
if (mVoiceConnectionState == VOICE_STATE_WAIT_FOR_CLOSE)
{
@@ -2881,7 +2881,7 @@ bool LLVoiceWebRTCConnection::connectionStateMachine()
// llwebrtc callback
void LLVoiceWebRTCConnection::OnDataReceived(const std::string& data, bool binary)
{
- LL::WorkQueue::postMaybe(mMainQueue, [=] { LLVoiceWebRTCConnection::OnDataReceivedImpl(data, binary); });
+ LL::WorkQueue::postMaybe(mMainQueue, [=, this] { LLVoiceWebRTCConnection::OnDataReceivedImpl(data, binary); });
}
//
@@ -3037,7 +3037,7 @@ void LLVoiceWebRTCConnection::OnDataReceivedImpl(const std::string &data, bool b
void LLVoiceWebRTCConnection::OnDataChannelReady(llwebrtc::LLWebRTCDataInterface *data_interface)
{
LL::WorkQueue::postMaybe(mMainQueue,
- [=] {
+ [=, this] {
if (mShutDown)
{
return;
diff --git a/indra/newview/llworldmipmap.cpp b/indra/newview/llworldmipmap.cpp
index d8ea2b884f..d198f7a33b 100644
--- a/indra/newview/llworldmipmap.cpp
+++ b/indra/newview/llworldmipmap.cpp
@@ -30,7 +30,7 @@
#include "llviewercontrol.h" // LLControlGroup
#include "llviewertexturelist.h"
-#include "math.h" // log()
+#include <cmath> // log()
// Turn this on to output tile stats in the standard output
#define DEBUG_TILES_STAT 0
diff --git a/indra/newview/tests/llluamanager_test.cpp b/indra/newview/tests/llluamanager_test.cpp
index f0a1b32eed..9687b68451 100644
--- a/indra/newview/tests/llluamanager_test.cpp
+++ b/indra/newview/tests/llluamanager_test.cpp
@@ -55,14 +55,14 @@ namespace tut
// indra/newview/tests/llluamanager_test.cpp =>
// indra/newview
auto newview{ fsyspath(__FILE__).parent_path().parent_path() };
- auto settings{ newview / "app_settings" / "settings.xml" };
+ fsyspath settings{ newview / "app_settings" / "settings.xml" };
// true suppresses implicit declare; implicit declare requires
// that every variable in settings.xml has a Comment, which many don't.
- gSavedSettings.loadFromFile(settings.u8string(), true);
+ gSavedSettings.loadFromFile(settings, true);
// At test time, since we don't have the app bundle available,
// extend LuaRequirePath to include the require directory in the
// source tree.
- auto require{ (newview / "scripts" / "lua" / "require").u8string() };
+ std::string require{ fsyspath(newview / "scripts" / "lua" / "require") };
auto paths{ gSavedSettings.getLLSD("LuaRequirePath") };
bool found = false;
for (const auto& path : llsd::inArray(paths))
diff --git a/indra/viewer_components/login/lllogin.cpp b/indra/viewer_components/login/lllogin.cpp
index bdabab70e0..cb330eba9b 100644
--- a/indra/viewer_components/login/lllogin.cpp
+++ b/indra/viewer_components/login/lllogin.cpp
@@ -129,8 +129,7 @@ void LLLogin::Impl::connect(const std::string& uri, const LLSD& login_params)
// Launch a coroutine with our login_() method. Run the coroutine until
// its first wait; at that point, return here.
- std::string coroname =
- LLCoros::instance().launch("LLLogin::Impl::login_", [=]() { loginCoro(uri, login_params); });
+ std::string coroname = LLCoros::instance().launch("LLLogin::Impl::login_", [=, this]() { loginCoro(uri, login_params); });
LL_DEBUGS("LLLogin") << " connected with uri '" << uri << "', login_params " << login_params << LL_ENDL;
}