From 4607df13b96a79d702dd1848b4d435f5831eb622 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Tue, 14 Oct 2014 16:25:06 -0400 Subject: Reorder LLEventDetail::listenerNameForCoro[Impl]() decls for Xcode 6. --- indra/llcommon/lleventcoro.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/lleventcoro.h b/indra/llcommon/lleventcoro.h index a42af63b65..f55b74ac7e 100755 --- a/indra/llcommon/lleventcoro.h +++ b/indra/llcommon/lleventcoro.h @@ -102,6 +102,9 @@ LLVoidListener voidlistener(const LISTENER& listener) namespace LLEventDetail { + /// Implementation for listenerNameForCoro(), see below + LL_COMMON_API std::string listenerNameForCoroImpl(const void* self_id); + /** * waitForEventOn() permits a coroutine to temporarily listen on an * LLEventPump any number of times. We don't really want to have to ask @@ -129,9 +132,6 @@ namespace LLEventDetail return listenerNameForCoroImpl(self.get_id()); } - /// Implementation for listenerNameForCoro() - LL_COMMON_API std::string listenerNameForCoroImpl(const void* self_id); - /** * Implement behavior described for postAndWait()'s @a replyPumpNamePath * parameter: -- cgit v1.2.3 From f45b809bd7f0b9afb4d530ec0acb2d06eaafe41b Mon Sep 17 00:00:00 2001 From: callum_linden Date: Fri, 17 Oct 2014 12:39:09 -0700 Subject: Update to build on Xcode 6.0: reorder code and additional scoing in template classes to make clang happy --- indra/llcommon/llunittype.h | 92 +++++++++++++++++++++++---------------------- 1 file changed, 47 insertions(+), 45 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llunittype.h b/indra/llcommon/llunittype.h index 0e05ecd683..ac8504ca61 100644 --- a/indra/llcommon/llunittype.h +++ b/indra/llcommon/llunittype.h @@ -87,6 +87,40 @@ struct LLUnit : mValue(value) {} + + LL_FORCE_INLINE static self_t convert(self_t v) + { + return v; + } + + template + LL_FORCE_INLINE static self_t convert(LLUnit v) + { + self_t result; + result.mValue = (STORAGE_TYPE)v.value(); + return result; + } + + template + LL_FORCE_INLINE static self_t convert(LLUnit v) + { + self_t result; + STORAGE_TYPE divisor = ll_convert_units(v, result); + result.mValue /= divisor; + return result; + } + + template + LL_FORCE_INLINE static self_t convert(LLUnit v) + { + typedef typename LLResultTypePromote::type_t result_storage_t; + LLUnit result; + result_storage_t divisor = ll_convert_units(v, result); + result.value(result.value() / divisor); + return self_t(result.value()); + } + + // unit initialization and conversion template LL_FORCE_INLINE LLUnit(LLUnit other) @@ -183,38 +217,6 @@ struct LLUnit return mValue >= convert(other).value(); } - LL_FORCE_INLINE static self_t convert(self_t v) - { - return v; - } - - template - LL_FORCE_INLINE static self_t convert(LLUnit v) - { - self_t result; - result.mValue = (STORAGE_TYPE)v.value(); - return result; - } - - template - LL_FORCE_INLINE static self_t convert(LLUnit v) - { - self_t result; - STORAGE_TYPE divisor = ll_convert_units(v, result); - result.mValue /= divisor; - return result; - } - - template - LL_FORCE_INLINE static self_t convert(LLUnit v) - { - typedef typename LLResultTypePromote::type_t result_storage_t; - LLUnit result; - result_storage_t divisor = ll_convert_units(v, result); - result.value(result.value() / divisor); - return self_t(result.value()); - } - protected: storage_t mValue; }; @@ -269,7 +271,7 @@ struct LLUnitImplicit : public LLUnit template LL_FORCE_INLINE void operator += (LLUnitImplicit other) { - base_t::mValue += convert(other).value(); + base_t::mValue += base_t::convert(other).value(); } using base_t::operator -=; @@ -283,19 +285,19 @@ struct LLUnitImplicit : public LLUnit template LL_FORCE_INLINE void operator -= (LLUnitImplicit other) { - base_t::mValue -= convert(other).value(); + base_t::mValue -= base_t::convert(other).value(); } template LL_FORCE_INLINE bool operator == (LLUnit other) const { - return base_t::mValue == convert(other).value(); + return base_t::mValue == base_t::convert(other).value(); } template LL_FORCE_INLINE bool operator == (LLUnitImplicit other) const { - return base_t::mValue == convert(other).value(); + return base_t::mValue == base_t::convert(other).value(); } template @@ -313,7 +315,7 @@ struct LLUnitImplicit : public LLUnit template LL_FORCE_INLINE bool operator != (LLUnitImplicit other) const { - return base_t::mValue != convert(other).value(); + return base_t::mValue != base_t::convert(other).value(); } template @@ -325,13 +327,13 @@ struct LLUnitImplicit : public LLUnit template LL_FORCE_INLINE bool operator < (LLUnit other) const { - return base_t::mValue < convert(other).value(); + return base_t::mValue < base_t::convert(other).value(); } template LL_FORCE_INLINE bool operator < (LLUnitImplicit other) const { - return base_t::mValue < convert(other).value(); + return base_t::mValue < base_t::convert(other).value(); } template @@ -343,13 +345,13 @@ struct LLUnitImplicit : public LLUnit template LL_FORCE_INLINE bool operator <= (LLUnit other) const { - return base_t::mValue <= convert(other).value(); + return base_t::mValue <= base_t::convert(other).value(); } template LL_FORCE_INLINE bool operator <= (LLUnitImplicit other) const { - return base_t::mValue <= convert(other).value(); + return base_t::mValue <= base_t::convert(other).value(); } template @@ -361,13 +363,13 @@ struct LLUnitImplicit : public LLUnit template LL_FORCE_INLINE bool operator > (LLUnit other) const { - return base_t::mValue > convert(other).value(); + return base_t::mValue > base_t::convert(other).value(); } template LL_FORCE_INLINE bool operator > (LLUnitImplicit other) const { - return base_t::mValue > convert(other).value(); + return base_t::mValue > base_t::convert(other).value(); } template @@ -379,13 +381,13 @@ struct LLUnitImplicit : public LLUnit template LL_FORCE_INLINE bool operator >= (LLUnit other) const { - return base_t::mValue >= convert(other).value(); + return base_t::mValue >= base_t::convert(other).value(); } template LL_FORCE_INLINE bool operator >= (LLUnitImplicit other) const { - return base_t::mValue >= convert(other).value(); + return base_t::mValue >= base_t::convert(other).value(); } template -- cgit v1.2.3 From aca7976b8770aa7464bdba717d508372732f0e39 Mon Sep 17 00:00:00 2001 From: callum_linden Date: Fri, 17 Oct 2014 13:05:04 -0700 Subject: Update to build on Xcode 6.0: turn BACK ON warnings as errors for overloaded virtuals [-Woverloaded-virtual] and fix up first (of many) files --- indra/llcommon/llfile.cpp | 2 +- indra/llcommon/llfile.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llfile.cpp b/indra/llcommon/llfile.cpp index 259187c52f..aabc195ba8 100755 --- a/indra/llcommon/llfile.cpp +++ b/indra/llcommon/llfile.cpp @@ -807,7 +807,7 @@ std::streamsize llstdio_filebuf::xsgetn(char_type* __s, std::streamsize __n) return __ret; } -std::streamsize llstdio_filebuf::xsputn(char_type* __s, std::streamsize __n) +std::streamsize llstdio_filebuf::xsputn(const char_type* __s, std::streamsize __n) { // Optimization in the always_noconv() case, to be generalized in the // future: when __n is sufficiently large we write directly instead of diff --git a/indra/llcommon/llfile.h b/indra/llcommon/llfile.h index f56b22bf9a..0612071d67 100755 --- a/indra/llcommon/llfile.h +++ b/indra/llcommon/llfile.h @@ -188,7 +188,7 @@ protected: /*virtual*/ int sync(); std::streamsize xsgetn(char_type*, std::streamsize); - std::streamsize xsputn(char_type*, std::streamsize); + std::streamsize xsputn(const char_type*, std::streamsize); #endif }; -- cgit v1.2.3 From 4785da9b9f786d761828f711cfda401974cd9238 Mon Sep 17 00:00:00 2001 From: callum_linden Date: Fri, 17 Oct 2014 13:27:48 -0700 Subject: Update to build on Xcode 6.0: TEMP fix to remove broken code (clang) until it's true purpose becomes clear --- indra/llcommon/llpredicate.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llpredicate.h b/indra/llcommon/llpredicate.h index a0e970a799..91d96e64f5 100644 --- a/indra/llcommon/llpredicate.h +++ b/indra/llcommon/llpredicate.h @@ -141,7 +141,8 @@ namespace LLPredicate void require(ENUM e) { - mRule.set(e, require); + // TEMP XCODE6FIX checkin while i figure out what the heck this is supposed to mean + // mRule.set(e, require); } void allow(ENUM e) -- cgit v1.2.3 From 791858f517dcb7df1f056323439966ee685410c4 Mon Sep 17 00:00:00 2001 From: callum_linden Date: Fri, 17 Oct 2014 13:36:05 -0700 Subject: Update to build on Xcode 6.0: remove unused variable [-Wunused-const-variable] --- indra/llcommon/llframetimer.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llframetimer.cpp b/indra/llcommon/llframetimer.cpp index 1af2cb8afd..1e9920746b 100755 --- a/indra/llcommon/llframetimer.cpp +++ b/indra/llcommon/llframetimer.cpp @@ -37,7 +37,6 @@ U64 LLFrameTimer::sTotalTime = 0; F64 LLFrameTimer::sTotalSeconds = 0.0; S32 LLFrameTimer::sFrameCount = 0; U64 LLFrameTimer::sFrameDeltaTime = 0; -const F64 USEC_PER_SECOND = 1000000.0; const F64 USEC_TO_SEC_F64 = 0.000001; // static -- cgit v1.2.3 From 41712d35fbc0517854f21a4ccf54fafeda336aa3 Mon Sep 17 00:00:00 2001 From: callum_linden Date: Fri, 17 Oct 2014 13:40:15 -0700 Subject: Update to build on Xcode 6.0: additional scoping required for clang --- indra/llcommon/llinitparam.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llinitparam.h b/indra/llcommon/llinitparam.h index 7aa87fcd0e..be3552cb46 100755 --- a/indra/llcommon/llinitparam.h +++ b/indra/llcommon/llinitparam.h @@ -1123,7 +1123,7 @@ namespace LLInitParam void set(const value_t& val, bool flag_as_provided = true) { named_value_t::clearValueName(); - setValue(val); + named_value_t::setValue(val); setProvided(flag_as_provided); } @@ -1287,7 +1287,7 @@ namespace LLInitParam // assign block contents to this param-that-is-a-block void set(const value_t& val, bool flag_as_provided = true) { - setValue(val); + named_value_t::setValue(val); named_value_t::clearValueName(); setProvided(flag_as_provided); } @@ -2054,7 +2054,7 @@ namespace LLInitParam Optional& operator =(const value_t& val) { - set(val); + super_t::set(val); return *this; } @@ -2084,7 +2084,7 @@ namespace LLInitParam Mandatory& operator =(const value_t& val) { - set(val); + super_t::set(val); return *this; } @@ -2120,7 +2120,7 @@ namespace LLInitParam Multiple& operator =(const container_t& val) { - set(val); + super_t::set(val); return *this; } -- cgit v1.2.3 From b826dbcb84f7c047dca5684d36ee1f6f94b7be88 Mon Sep 17 00:00:00 2001 From: callum_linden Date: Fri, 17 Oct 2014 13:48:03 -0700 Subject: Update to build on Xcode 6.0: remove unused member variable that makes clang sad --- indra/llcommon/llsdparam.h | 1 - 1 file changed, 1 deletion(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llsdparam.h b/indra/llcommon/llsdparam.h index 1542f95e68..09f1bdf1e3 100755 --- a/indra/llcommon/llsdparam.h +++ b/indra/llcommon/llsdparam.h @@ -106,7 +106,6 @@ private: Parser::name_stack_t mNameStack; const LLSD* mCurReadSD; LLSD* mWriteRootSD; - LLSD* mCurWriteSD; }; -- cgit v1.2.3 From b2d84b5fc68e947e59b96289a357bd2f515c896c Mon Sep 17 00:00:00 2001 From: callum_linden Date: Fri, 17 Oct 2014 13:50:06 -0700 Subject: Update to build on Xcode 6.0: remove unused function that makes clang sad --- indra/llcommon/llprocessor.cpp | 15 --------------- 1 file changed, 15 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llprocessor.cpp b/indra/llcommon/llprocessor.cpp index 69043dc173..1ee3c7edb0 100755 --- a/indra/llcommon/llprocessor.cpp +++ b/indra/llcommon/llprocessor.cpp @@ -204,21 +204,6 @@ namespace return "Unknown"; } - std::string compute_CPUFamilyName(const char* cpu_vendor, int composed_family) - { - const char* intel_string = "GenuineIntel"; - const char* amd_string = "AuthenticAMD"; - if(!strncmp(cpu_vendor, intel_string, strlen(intel_string))) - { - return intel_CPUFamilyName(composed_family); - } - else if(!strncmp(cpu_vendor, amd_string, strlen(amd_string))) - { - return amd_CPUFamilyName(composed_family); - } - return "Unknown"; - } - std::string compute_CPUFamilyName(const char* cpu_vendor, int family, int ext_family) { const char* intel_string = "GenuineIntel"; -- cgit v1.2.3 From 5c5821b7583bf55889bb13147376919553727a01 Mon Sep 17 00:00:00 2001 From: callum_linden Date: Fri, 17 Oct 2014 14:01:08 -0700 Subject: Update to build on Xcode 6.0: clang warned about comparison of unsigned int to >=0 - correct ifx here is to retype the variable as signed --- indra/llcommon/llsdutil.cpp | 2 +- indra/llcommon/llsdutil.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llsdutil.cpp b/indra/llcommon/llsdutil.cpp index 562fd26658..6ad4a97149 100755 --- a/indra/llcommon/llsdutil.cpp +++ b/indra/llcommon/llsdutil.cpp @@ -572,7 +572,7 @@ std::string llsd_matches(const LLSD& prototype, const LLSD& data, const std::str return match_types(prototype.type(), TypeVector(), data.type(), pfx); } -bool llsd_equals(const LLSD& lhs, const LLSD& rhs, unsigned bits) +bool llsd_equals(const LLSD& lhs, const LLSD& rhs, int bits) { // We're comparing strict equality of LLSD representation rather than // performing any conversions. So if the types aren't equal, the LLSD diff --git a/indra/llcommon/llsdutil.h b/indra/llcommon/llsdutil.h index d0b536c39a..99cb79aa54 100755 --- a/indra/llcommon/llsdutil.h +++ b/indra/llcommon/llsdutil.h @@ -126,7 +126,7 @@ LL_COMMON_API std::string llsd_matches(const LLSD& prototype, const LLSD& data, /// Deep equality. If you want to compare LLSD::Real values for approximate /// equality rather than bitwise equality, pass @a bits as for /// is_approx_equal_fraction(). -LL_COMMON_API bool llsd_equals(const LLSD& lhs, const LLSD& rhs, unsigned bits=-1); +LL_COMMON_API bool llsd_equals(const LLSD& lhs, const LLSD& rhs, int bits=-1); // Simple function to copy data out of input & output iterators if // there is no need for casting. -- cgit v1.2.3 From 8db1250b73b89727b60ba852bb65cf09ff824993 Mon Sep 17 00:00:00 2001 From: callum_linden Date: Fri, 17 Oct 2014 14:08:58 -0700 Subject: Update to build on Xcode 6.0: collection of similar const var not used warnings/errors [-Wunused-const-variable] --- indra/llcommon/llsys.cpp | 4 ---- indra/llcommon/lltimer.cpp | 4 ---- 2 files changed, 8 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llsys.cpp b/indra/llcommon/llsys.cpp index 06e118aa44..c9db73eb99 100755 --- a/indra/llcommon/llsys.cpp +++ b/indra/llcommon/llsys.cpp @@ -99,8 +99,6 @@ const char MEMINFO_FILE[] = "/proc/meminfo"; extern int errno; #endif - -static const S32 CPUINFO_BUFFER_SIZE = 16383; LLCPUInfo gSysCPU; // Don't log memory info any more often than this. It also serves as our @@ -672,8 +670,6 @@ const std::string& LLOSInfo::getOSVersionString() const return mOSVersionString; } -const S32 STATUS_SIZE = 8192; - //static U32 LLOSInfo::getProcessVirtualSizeKB() { diff --git a/indra/llcommon/lltimer.cpp b/indra/llcommon/lltimer.cpp index ab105a82e6..76e892212a 100755 --- a/indra/llcommon/lltimer.cpp +++ b/indra/llcommon/lltimer.cpp @@ -39,14 +39,10 @@ # error "architecture not supported" #endif - // // Locally used constants // -const F64 SEC_TO_MICROSEC = 1000000.f; const U64 SEC_TO_MICROSEC_U64 = 1000000; -const F64 USEC_TO_SEC_F64 = 0.000001; - //--------------------------------------------------------------------------- // Globals and statics -- cgit v1.2.3 From b23afb709d194d5000963de55c2eb8d19031b0f7 Mon Sep 17 00:00:00 2001 From: callum_linden Date: Fri, 17 Oct 2014 20:24:02 -0700 Subject: Update to build on Xcode 6.0: fix Boost intrusive_ptr scoping issue --- indra/llcommon/llrefcount.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llrefcount.h b/indra/llcommon/llrefcount.h index 72011d04a0..52b6f8eaa9 100755 --- a/indra/llcommon/llrefcount.h +++ b/indra/llcommon/llrefcount.h @@ -151,8 +151,8 @@ private: * intrusive pointer support for LLThreadSafeRefCount * this allows you to use boost::intrusive_ptr with any LLThreadSafeRefCount-derived type */ -namespace boost -{ +// namespace boost +// { inline void intrusive_ptr_add_ref(LLThreadSafeRefCount* p) { p->ref(); @@ -172,7 +172,7 @@ namespace boost { p->unref(); } -}; +//}; -- cgit v1.2.3 From 3d35d2f78da8a12336df3f12374d91614db2f035 Mon Sep 17 00:00:00 2001 From: callum_linden Date: Fri, 17 Oct 2014 20:24:58 -0700 Subject: Update to build on Xcode 6.0: fix Boost intrusive_ptr scoping issue (part 2 - tidy up) --- indra/llcommon/llrefcount.h | 36 ++++++++++++++++-------------------- 1 file changed, 16 insertions(+), 20 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llrefcount.h b/indra/llcommon/llrefcount.h index 52b6f8eaa9..3836a9b5fb 100755 --- a/indra/llcommon/llrefcount.h +++ b/indra/llcommon/llrefcount.h @@ -151,29 +151,25 @@ private: * intrusive pointer support for LLThreadSafeRefCount * this allows you to use boost::intrusive_ptr with any LLThreadSafeRefCount-derived type */ -// namespace boost -// { - inline void intrusive_ptr_add_ref(LLThreadSafeRefCount* p) - { - p->ref(); - } - inline void intrusive_ptr_release(LLThreadSafeRefCount* p) - { - p->unref(); - } - - inline void intrusive_ptr_add_ref(LLRefCount* p) - { - p->ref(); - } +inline void intrusive_ptr_add_ref(LLThreadSafeRefCount* p) +{ + p->ref(); +} - inline void intrusive_ptr_release(LLRefCount* p) - { - p->unref(); - } -//}; +inline void intrusive_ptr_release(LLThreadSafeRefCount* p) +{ + p->unref(); +} +inline void intrusive_ptr_add_ref(LLRefCount* p) +{ + p->ref(); +} +inline void intrusive_ptr_release(LLRefCount* p) +{ + p->unref(); +} #endif -- cgit v1.2.3 From cad1df584be0ed62e4ae0393b84e57f192009da5 Mon Sep 17 00:00:00 2001 From: callum_linden Date: Mon, 20 Oct 2014 15:20:10 -0700 Subject: Update to build on Xcode 6.0: fix typo in functions params --- indra/llcommon/llpredicate.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llpredicate.h b/indra/llcommon/llpredicate.h index 91d96e64f5..e6c56a5711 100644 --- a/indra/llcommon/llpredicate.h +++ b/indra/llcommon/llpredicate.h @@ -139,10 +139,9 @@ namespace LLPredicate Rule() {} - void require(ENUM e) + void require(ENUM e, bool match) { - // TEMP XCODE6FIX checkin while i figure out what the heck this is supposed to mean - // mRule.set(e, require); + mRule.set(e, match); } void allow(ENUM e) -- cgit v1.2.3 From ade93d5d19490a1c94df0b749a42c5514d4d88a7 Mon Sep 17 00:00:00 2001 From: callum_linden Date: Tue, 21 Oct 2014 11:38:20 -0700 Subject: Update to build on Xcode 6.0: remove release build unused function --- indra/llcommon/llsd.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llsd.cpp b/indra/llcommon/llsd.cpp index d8bbb3a74f..57aa7d9c07 100755 --- a/indra/llcommon/llsd.cpp +++ b/indra/llcommon/llsd.cpp @@ -789,10 +789,7 @@ namespace { inline LLSD::Impl& safe(LLSD::Impl* impl) { return LLSD::Impl::safe(impl); } - - inline const LLSD::Impl& safe(const LLSD::Impl* impl) - { return LLSD::Impl::safe(impl); } - + inline ImplMap& makeMap(LLSD::Impl*& var) { return safe(var).makeMap(var); } -- cgit v1.2.3 From 98d8313847c51b415009c9131a0aed14380de1a6 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Wed, 22 Oct 2014 12:00:03 -0400 Subject: added skip to llerror_test of nested logging, noted in todo file --- indra/llcommon/tests/llerror_test.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/tests/llerror_test.cpp b/indra/llcommon/tests/llerror_test.cpp index 3cefe83440..8084a05288 100755 --- a/indra/llcommon/tests/llerror_test.cpp +++ b/indra/llcommon/tests/llerror_test.cpp @@ -38,6 +38,7 @@ namespace { +# pragma clang diagnostic ignored "-Wunused-function" static bool fatalWasCalled; void fatalCall(const std::string&) { fatalWasCalled = true; } } @@ -383,8 +384,8 @@ namespace if (n1 == std::string::npos) { std::stringstream ss; - ss << message << ": " << "expected to find a copy of " << expected - << " in actual " << actual; + ss << message << ": " << "expected to find a copy of '" << expected + << "' in actual '" << actual << "'"; throw tut::failure(ss.str().c_str()); } } @@ -476,6 +477,7 @@ namespace tut // handle nested logging void ErrorTestObject::test<7>() { + skip("Fails on clang TODO"); outerLogger(); ensure_message_contains(0, "inside"); ensure_message_contains(1, "outside(moo)"); -- cgit v1.2.3 From 745151936e44347b98d48932174168634b72256b Mon Sep 17 00:00:00 2001 From: callum_linden Date: Wed, 22 Oct 2014 10:09:24 -0700 Subject: Update to build on Xcode 6.0 (fix unit tests): fix up Boost linker errors --- indra/llcommon/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/CMakeLists.txt b/indra/llcommon/CMakeLists.txt index 763f5a3521..63d25225c9 100755 --- a/indra/llcommon/CMakeLists.txt +++ b/indra/llcommon/CMakeLists.txt @@ -301,7 +301,7 @@ if (LL_TESTS) LL_ADD_INTEGRATION_TEST(llunits "" "${test_libs}") LL_ADD_INTEGRATION_TEST(stringize "" "${test_libs}") LL_ADD_INTEGRATION_TEST(lleventdispatcher "" "${test_libs}") - LL_ADD_INTEGRATION_TEST(lleventcoro "" "${test_libs};${BOOST_CONTEXT_LIBRARY};${BOOST_COROUTINE_LIBRARY};${BOOST_SYSTEM_LIBRARY}") + LL_ADD_INTEGRATION_TEST(lleventcoro "" "${test_libs};${BOOST_CONTEXT_LIBRARY};${BOOST_THREAD_LIBRARY};${BOOST_COROUTINE_LIBRARY};${BOOST_SYSTEM_LIBRARY}") LL_ADD_INTEGRATION_TEST(llprocess "" "${test_libs}") LL_ADD_INTEGRATION_TEST(llleap "" "${test_libs}") LL_ADD_INTEGRATION_TEST(llstreamqueue "" "${test_libs}") -- cgit v1.2.3 From 428adcb35c2d68700adfebfd14ab1dbae3af654e Mon Sep 17 00:00:00 2001 From: callum_linden Date: Wed, 22 Oct 2014 10:12:36 -0700 Subject: Update to build on Xcode 6.0 (fix unit tests): remove unused functions that trigger clang warnings --- indra/llcommon/tests/llerror_test.cpp | 13 ------------- 1 file changed, 13 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/tests/llerror_test.cpp b/indra/llcommon/tests/llerror_test.cpp index a5aaff10c5..3cefe83440 100755 --- a/indra/llcommon/tests/llerror_test.cpp +++ b/indra/llcommon/tests/llerror_test.cpp @@ -36,14 +36,6 @@ #include "../test/lltut.h" -namespace -{ - void test_that_error_h_includes_enough_things_to_compile_a_message() - { - LL_INFOS() << "!" << LL_ENDL; - } -} - namespace { static bool fatalWasCalled; @@ -381,8 +373,6 @@ namespace }; std::string logFromNamespace(bool id) { return Foo::logFromNamespace(id); } - std::string logFromClassWithNoLogTypeMember(bool id) { ClassWithNoLogType c; return c.logFromMember(id); } - std::string logFromClassWithNoLogTypeStatic(bool id) { return ClassWithNoLogType::logFromStatic(id); } std::string logFromClassWithLogTypeMember(bool id) { ClassWithLogType c; return c.logFromMember(id); } std::string logFromClassWithLogTypeStatic(bool id) { return ClassWithLogType::logFromStatic(id); } @@ -435,9 +425,6 @@ namespace tut testLogName(mRecorder, logFromStatic); testLogName(mRecorder, logFromAnon); testLogName(mRecorder, logFromNamespace); - //testLogName(mRecorder, logFromClassWithNoLogTypeMember, "ClassWithNoLogType"); - //testLogName(mRecorder, logFromClassWithNoLogTypeStatic, "ClassWithNoLogType"); - // XXX: figure out what the exepcted response is for these testLogName(mRecorder, logFromClassWithLogTypeMember, "ClassWithLogType"); testLogName(mRecorder, logFromClassWithLogTypeStatic, "ClassWithLogType"); } -- cgit v1.2.3 From 0bcfb017cec463f6bf79efcc45754dbe6ddb20a2 Mon Sep 17 00:00:00 2001 From: callum_linden Date: Wed, 22 Oct 2014 11:03:00 -0700 Subject: Update to build on Xcode 6.0 (fix unit tests): skip llerror_test test for now - operator << issues on clang --- indra/llcommon/tests/llerror_test.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'indra/llcommon') diff --git a/indra/llcommon/tests/llerror_test.cpp b/indra/llcommon/tests/llerror_test.cpp index 3cefe83440..2939ae1ece 100755 --- a/indra/llcommon/tests/llerror_test.cpp +++ b/indra/llcommon/tests/llerror_test.cpp @@ -476,6 +476,9 @@ namespace tut // handle nested logging void ErrorTestObject::test<7>() { +#if LL_DARWIN + skip("Skip known failure on clang and intelc due to operator << differences"); +#endif outerLogger(); ensure_message_contains(0, "inside"); ensure_message_contains(1, "outside(moo)"); -- cgit v1.2.3 From 221c521f23e7c661e0c36fcd7a8b40b9db18608f Mon Sep 17 00:00:00 2001 From: callum_linden Date: Wed, 22 Oct 2014 11:38:56 -0700 Subject: Update to build on Xcode 6.0 (fix unit tests): remove unused statement warning --- indra/llcommon/tests/lleventcoro_test.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/tests/lleventcoro_test.cpp b/indra/llcommon/tests/lleventcoro_test.cpp index cb5e15eff2..2096807e53 100755 --- a/indra/llcommon/tests/lleventcoro_test.cpp +++ b/indra/llcommon/tests/lleventcoro_test.cpp @@ -94,7 +94,6 @@ using coroutines::coroutine; template bool match(Iter first, Iter last, std::string match) { std::string::iterator i = match.begin(); - i != match.end(); for(; (first != last) && (i != match.end()); ++i) { if (*first != *i) return false; -- cgit v1.2.3 From 04291ba319a6e68f2c2e9bd8e299878b93424452 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Wed, 22 Oct 2014 16:42:18 -0400 Subject: correct merge error in llerror_test.cpp --- indra/llcommon/tests/llerror_test.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'indra/llcommon') diff --git a/indra/llcommon/tests/llerror_test.cpp b/indra/llcommon/tests/llerror_test.cpp index 8084a05288..febfa782ca 100755 --- a/indra/llcommon/tests/llerror_test.cpp +++ b/indra/llcommon/tests/llerror_test.cpp @@ -39,6 +39,14 @@ namespace { # pragma clang diagnostic ignored "-Wunused-function" + void test_that_error_h_includes_enough_things_to_compile_a_message() + { + LL_INFOS() << "!" << LL_ENDL; + } +} + +namespace +{ static bool fatalWasCalled; void fatalCall(const std::string&) { fatalWasCalled = true; } } -- cgit v1.2.3 From 9e9779d3f88a35bd9d3eb949b6fa08a36b505d5f Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Wed, 22 Oct 2014 21:20:10 -0400 Subject: Remove unit test case that relied on undefined order of evaluation in: 'cout << a() << b()' the order of evaluation of a() and b() is undefined. --- indra/llcommon/tests/llerror_test.cpp | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/tests/llerror_test.cpp b/indra/llcommon/tests/llerror_test.cpp index 1ac72d13bf..fee9492618 100755 --- a/indra/llcommon/tests/llerror_test.cpp +++ b/indra/llcommon/tests/llerror_test.cpp @@ -453,11 +453,6 @@ namespace return "bar"; } - void uberLogger() - { - LL_INFOS() << "uber(" << outerLogger() << "," << innerLogger() << ")" << LL_ENDL; - } - class LogWhileLogging { public: @@ -485,25 +480,15 @@ namespace tut // handle nested logging void ErrorTestObject::test<7>() { -#if LL_DARWIN - skip("Skip known failure on clang and intelc due to operator << differences"); -#endif outerLogger(); ensure_message_contains(0, "inside"); ensure_message_contains(1, "outside(moo)"); ensure_message_count(2); - uberLogger(); - ensure_message_contains(2, "inside"); - ensure_message_contains(3, "inside"); - ensure_message_contains(4, "outside(moo)"); - ensure_message_contains(5, "uber(bar,moo)"); - ensure_message_count(6); - metaLogger(); - ensure_message_contains(6, "logging"); - ensure_message_contains(7, "meta(baz)"); - ensure_message_count(8); + ensure_message_contains(2, "logging"); + ensure_message_contains(3, "meta(baz)"); + ensure_message_count(4); } template<> template<> -- cgit v1.2.3 From e66844570e42601c1c653d7169c694fd8310fb56 Mon Sep 17 00:00:00 2001 From: callum_linden Date: Wed, 22 Oct 2014 21:31:15 -0700 Subject: Update to build on Xcode 6.0 (fix unit tests): minor fix for debug only unit test --- indra/llcommon/llstring.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llstring.cpp b/indra/llcommon/llstring.cpp index 76979f29f6..617969ab2a 100755 --- a/indra/llcommon/llstring.cpp +++ b/indra/llcommon/llstring.cpp @@ -1397,7 +1397,7 @@ void LLStringUtilBase::testHarness() s2.erase( 4, 1 ); llassert( s2 == "hell"); - s2.insert( 0, 'y' ); + s2.insert( 0, "y" ); llassert( s2 == "yhell"); s2.erase( 1, 3 ); llassert( s2 == "yl"); -- cgit v1.2.3 From 918e2b629bd3dadfbe5288c0d72d93bcca1b8cfe Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Thu, 23 Oct 2014 20:23:08 -0700 Subject: Bring in new TUT library build. Clean up ensure_equals() overloads. The new TUT library build eliminates the ambiguity about ensure_equals(const char*, ...) versus ensure_equals(const std::string&, ...). Now it's all based on const std::string&. Remove pointless const char* overloads and ambiguous forwarding templates. With clang in Xcode 6, any new datatypes we intend to use with ensure_equals() must have operator<<(std::ostream&, datatype) declared BEFORE lltut.h #includes tut.hpp. Reorder code in certain test source files to guarantee that visibility. --- indra/llcommon/tests/lldependencies_test.cpp | 46 +++++++++++++++++----------- indra/llcommon/tests/llstring_test.cpp | 4 +-- 2 files changed, 30 insertions(+), 20 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/tests/lldependencies_test.cpp b/indra/llcommon/tests/lldependencies_test.cpp index 5395d785b6..b5e189a465 100755 --- a/indra/llcommon/tests/lldependencies_test.cpp +++ b/indra/llcommon/tests/lldependencies_test.cpp @@ -37,29 +37,14 @@ // associated header #include "../lldependencies.h" // other Linden headers -#include "../test/lltut.h" - -using boost::assign::list_of; #if LL_WINDOWS #pragma warning (disable : 4675) // "resolved by ADL" -- just as I want! #endif -typedef LLDependencies<> StringDeps; -typedef StringDeps::KeyList StringList; - -// We use the very cool boost::assign::list_of() construct to specify vectors -// of strings inline. For reasons on which I'm not entirely clear, though, it -// needs a helper function. You can use list_of() to construct an implicit -// StringList (std::vector) by conversion, e.g. for a function -// parameter -- but if you simply write StringList(list_of("etc.")), you get -// ambiguity errors. Shrug! -template -CONTAINER make(const CONTAINER& data) -{ - return data; -} - +/***************************************************************************** +* Display helpers: must be defined BEFORE lltut.h! +*****************************************************************************/ // Display an arbitary value as itself... template std::ostream& display(std::ostream& out, const T& value) @@ -113,6 +98,31 @@ std::ostream& operator<<(std::ostream& out, const std::set& set) return out; } +/***************************************************************************** +* Now we can #include lltut.h +*****************************************************************************/ +#include "../test/lltut.h" + +/***************************************************************************** +* Other helpers +*****************************************************************************/ +using boost::assign::list_of; + +typedef LLDependencies<> StringDeps; +typedef StringDeps::KeyList StringList; + +// We use the very cool boost::assign::list_of() construct to specify vectors +// of strings inline. For reasons on which I'm not entirely clear, though, it +// needs a helper function. You can use list_of() to construct an implicit +// StringList (std::vector) by conversion, e.g. for a function +// parameter -- but if you simply write StringList(list_of("etc.")), you get +// ambiguity errors. Shrug! +template +CONTAINER make(const CONTAINER& data) +{ + return data; +} + const std::string& extract_key(const LLDependencies<>::value_type& entry) { return entry.first; diff --git a/indra/llcommon/tests/llstring_test.cpp b/indra/llcommon/tests/llstring_test.cpp index 93d3968dbf..a7aa347222 100755 --- a/indra/llcommon/tests/llstring_test.cpp +++ b/indra/llcommon/tests/llstring_test.cpp @@ -27,11 +27,11 @@ */ #include "linden_common.h" -#include "../test/lltut.h" #include #include "../llstring.h" -#include "StringVec.h" +#include "StringVec.h" // must come BEFORE lltut.h +#include "../test/lltut.h" using boost::assign::list_of; -- cgit v1.2.3 From 6991eb58c315fc777d30fd4481b4c9f06d935df2 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Fri, 14 Nov 2014 12:09:55 -0500 Subject: Skip LLFrameTimer test<3>, which fails with Xcode 6.x builds. Hopefully this is temporary until we figure out the real problem! --- indra/llcommon/tests/llframetimer_test.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/llcommon') diff --git a/indra/llcommon/tests/llframetimer_test.cpp b/indra/llcommon/tests/llframetimer_test.cpp index 8ac1c91a3a..40a028867c 100755 --- a/indra/llcommon/tests/llframetimer_test.cpp +++ b/indra/llcommon/tests/llframetimer_test.cpp @@ -84,6 +84,7 @@ namespace tut template<> template<> void frametimer_object_t::test<3>() { + skip("fails with Xcode 6.x builds"); F64 seconds_since_epoch = LLFrameTimer::getTotalSeconds(); seconds_since_epoch += 2.0; LLFrameTimer timer; -- cgit v1.2.3 From 014065015a6a3a79c7786f22b65c99f856e413a0 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Fri, 14 Nov 2014 16:29:00 -0500 Subject: Convert llhash() to use boost::hash, per Cinder's suggestion. --- indra/llcommon/llhash.h | 43 ++++++++++++------------------------------- 1 file changed, 12 insertions(+), 31 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llhash.h b/indra/llcommon/llhash.h index c077ebe93f..4b58e81565 100755 --- a/indra/llcommon/llhash.h +++ b/indra/llcommon/llhash.h @@ -27,26 +27,7 @@ #ifndef LL_LLHASH_H #define LL_LLHASH_H -#include "llpreprocessor.h" // for GCC_VERSION - -#if (LL_WINDOWS) -#include -#include -#elif LL_DARWIN || LL_LINUX -# if GCC_VERSION >= 40300 // gcc 4.3 and up -# include -# elif GCC_VERSION >= 30400 // gcc 3.4 and up -# include -# elif __GNUC__ >= 3 -# include -# else -# include -# endif -#elif LL_SOLARIS -#include -#else -#error Please define your platform. -#endif +#include // Warning - an earlier template-based version of this routine did not do // the correct thing on Windows. Since this is only used to get @@ -55,17 +36,17 @@ inline size_t llhash( const char * value ) { -#if LL_WINDOWS - return stdext::hash_value(value); -#elif ( (defined _STLPORT_VERSION) || ((LL_LINUX) && (__GNUC__ <= 2)) ) - std::hash H; - return H(value); -#elif LL_DARWIN || LL_LINUX || LL_SOLARIS - __gnu_cxx::hash H; - return H(value); -#else -#error Please define your platform. -#endif + // boost::hash is defined for std::string and for char, but there's no + // special overload for const char*. The lazy approach would be to + // instantiate a std::string and take its hash, but that might be more + // overhead than our callers want. Or we could use boost::hash_range() -- + // but that would require a preliminary pass over the value to determine + // the end iterator. Instead, use boost::hash_combine() to hash individual + // characters. + std::size_t seed = 0; + for ( ; *value; ++value) + boost::hash_combine(seed, *value); + return seed; } #endif -- cgit v1.2.3 From dbdbcbbd3cc3ba21b255f992fae291ab3f13edcf Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Fri, 14 Nov 2014 17:22:26 -0500 Subject: rewrite an llframetimer test to be less sensitive to extended ms_sleep calls --- indra/llcommon/tests/llframetimer_test.cpp | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/tests/llframetimer_test.cpp b/indra/llcommon/tests/llframetimer_test.cpp index 8ac1c91a3a..46fc4ce93a 100755 --- a/indra/llcommon/tests/llframetimer_test.cpp +++ b/indra/llcommon/tests/llframetimer_test.cpp @@ -88,21 +88,24 @@ namespace tut seconds_since_epoch += 2.0; LLFrameTimer timer; timer.setExpiryAt(seconds_since_epoch); - ensure("timer not expired on create", !timer.hasExpired()); - int ii; - for(ii = 0; ii < 10; ++ii) + /* + * Note that the ms_sleep(200) below is only guaranteed to return + * in 200ms _or_more_, so it should be true that by the 10th + * iteration we've gotten to the 2 seconds requested above + * and the timer should expire, but it can expire in fewer iterations + * if one or more of the ms_sleep calls takes longer. + * (as it did when we moved to Mac OS X 10.10) + */ + int iterations_until_expiration = 0; + while ( !timer.hasExpired() ) { - ms_sleep(150); - LLFrameTimer::updateFrameTime(); - } - ensure("timer not expired after a bit", !timer.hasExpired()); - for(ii = 0; ii < 10; ++ii) - { - ms_sleep(100); - LLFrameTimer::updateFrameTime(); + ms_sleep(200); + LLFrameTimer::updateFrameTime(); + iterations_until_expiration++; } - ensure("timer expired", timer.hasExpired()); + ensure("timer took too long to expire", iterations_until_expiration <= 10); } + /* template<> template<> void frametimer_object_t::test<4>() -- cgit v1.2.3 From a74d0d44d15d5cdc8f86b1b80153721415afa82e Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Fri, 14 Nov 2014 22:34:13 -0500 Subject: remove skip from llframetimer_test now that it is fixed --- indra/llcommon/tests/llframetimer_test.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/tests/llframetimer_test.cpp b/indra/llcommon/tests/llframetimer_test.cpp index 47e7913cf9..46fc4ce93a 100755 --- a/indra/llcommon/tests/llframetimer_test.cpp +++ b/indra/llcommon/tests/llframetimer_test.cpp @@ -84,7 +84,6 @@ namespace tut template<> template<> void frametimer_object_t::test<3>() { - skip("fails with Xcode 6.x builds"); F64 seconds_since_epoch = LLFrameTimer::getTotalSeconds(); seconds_since_epoch += 2.0; LLFrameTimer timer; -- cgit v1.2.3 From 5f608c0a23487ae78cdc134b1e685a6c3cd4ec19 Mon Sep 17 00:00:00 2001 From: Cinder Date: Wed, 19 Nov 2014 08:01:28 -0700 Subject: OPEN-282 Use pthreads for TLS on mac --- indra/llcommon/llthread.cpp | 16 ++-------------- indra/llcommon/llthreadlocalstorage.h | 31 ++----------------------------- 2 files changed, 4 insertions(+), 43 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llthread.cpp b/indra/llcommon/llthread.cpp index 51c89e1eaf..22e8179b6c 100755 --- a/indra/llcommon/llthread.cpp +++ b/indra/llcommon/llthread.cpp @@ -92,11 +92,9 @@ void set_thread_name( DWORD dwThreadID, const char* threadName) // //---------------------------------------------------------------------------- -#if LL_DARWIN -// statically allocated thread local storage not supported in Darwin executable formats -#elif LL_WINDOWS +#if LL_WINDOWS U32 __declspec(thread) sThreadID = 0; -#elif LL_LINUX +#else U32 __thread sThreadID = 0; #endif @@ -115,9 +113,7 @@ LL_COMMON_API void assert_main_thread() void LLThread::registerThreadID() { -#if !LL_DARWIN sThreadID = ++sIDIter; -#endif } // @@ -134,9 +130,7 @@ void *APR_THREAD_FUNC LLThread::staticRun(apr_thread_t *apr_threadp, void *datap // for now, hard code all LLThreads to report to single master thread recorder, which is known to be running on main thread threadp->mRecorder = new LLTrace::ThreadRecorder(*LLTrace::get_master_thread_recorder()); -#if !LL_DARWIN sThreadID = threadp->mID; -#endif // Run the user supplied function threadp->run(); @@ -347,13 +341,7 @@ void LLThread::setQuitting() // static U32 LLThread::currentID() { -#if LL_DARWIN - // statically allocated thread local storage not supported in Darwin executable formats - return (U32)apr_os_thread_current(); -#else return sThreadID; -#endif - } // static diff --git a/indra/llcommon/llthreadlocalstorage.h b/indra/llcommon/llthreadlocalstorage.h index ec3b52c8cb..da648902aa 100644 --- a/indra/llcommon/llthreadlocalstorage.h +++ b/indra/llcommon/llthreadlocalstorage.h @@ -130,56 +130,29 @@ class LLThreadLocalSingletonPointer public: LL_FORCE_INLINE static DERIVED_TYPE* getInstance() { -#if LL_DARWIN - createTLSKey(); - return (DERIVED_TYPE*)pthread_getspecific(sInstanceKey); -#else return sInstance; -#endif } static void setInstance(DERIVED_TYPE* instance) { -#if LL_DARWIN - createTLSKey(); - pthread_setspecific(sInstanceKey, (void*)instance); -#else sInstance = instance; -#endif } private: #if LL_WINDOWS static __declspec(thread) DERIVED_TYPE* sInstance; -#elif LL_LINUX +#else static __thread DERIVED_TYPE* sInstance; -#elif LL_DARWIN - static void TLSError() - { - LL_ERRS() << "Could not create thread local storage" << LL_ENDL; - } - static void createTLSKey() - { - static S32 key_created = pthread_key_create(&sInstanceKey, NULL); - if (key_created != 0) - { - LL_ERRS() << "Could not create thread local storage" << LL_ENDL; - } - } - static pthread_key_t sInstanceKey; #endif }; #if LL_WINDOWS template __declspec(thread) DERIVED_TYPE* LLThreadLocalSingletonPointer::sInstance = NULL; -#elif LL_LINUX +#else template __thread DERIVED_TYPE* LLThreadLocalSingletonPointer::sInstance = NULL; -#elif LL_DARWIN -template -pthread_key_t LLThreadLocalSingletonPointer::sInstanceKey; #endif #endif // LL_LLTHREADLOCALSTORAGE_H -- cgit v1.2.3 From 6df6aef62176328c3b0fafa43fd611d4e25ef35c Mon Sep 17 00:00:00 2001 From: Cinder Date: Wed, 19 Nov 2014 22:27:36 -0700 Subject: OPEN-282 - Define LL_THREAD_LOCAL for our platforms in order to unify TLS support --- indra/llcommon/llpreprocessor.h | 5 +++++ indra/llcommon/llthread.cpp | 6 +----- indra/llcommon/llthreadlocalstorage.h | 14 ++------------ 3 files changed, 8 insertions(+), 17 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llpreprocessor.h b/indra/llcommon/llpreprocessor.h index 309165da7f..2c4bcc91f6 100755 --- a/indra/llcommon/llpreprocessor.h +++ b/indra/llcommon/llpreprocessor.h @@ -101,6 +101,11 @@ #endif +#if LL_WINDOWS +# define LL_THREAD_LOCAL __declspec(thread) +#else +# define LL_THREAD_LOCAL __thread +#endif // Static linking with apr on windows needs to be declared. #if LL_WINDOWS && !LL_COMMON_LINK_SHARED diff --git a/indra/llcommon/llthread.cpp b/indra/llcommon/llthread.cpp index 22e8179b6c..c3f235c6ee 100755 --- a/indra/llcommon/llthread.cpp +++ b/indra/llcommon/llthread.cpp @@ -92,11 +92,7 @@ void set_thread_name( DWORD dwThreadID, const char* threadName) // //---------------------------------------------------------------------------- -#if LL_WINDOWS -U32 __declspec(thread) sThreadID = 0; -#else -U32 __thread sThreadID = 0; -#endif +U32 LL_THREAD_LOCAL sThreadID = 0; U32 LLThread::sIDIter = 0; diff --git a/indra/llcommon/llthreadlocalstorage.h b/indra/llcommon/llthreadlocalstorage.h index da648902aa..3b5786023f 100644 --- a/indra/llcommon/llthreadlocalstorage.h +++ b/indra/llcommon/llthreadlocalstorage.h @@ -139,20 +139,10 @@ public: } private: - -#if LL_WINDOWS - static __declspec(thread) DERIVED_TYPE* sInstance; -#else - static __thread DERIVED_TYPE* sInstance; -#endif + static LL_THREAD_LOCAL DERIVED_TYPE* sInstance; }; -#if LL_WINDOWS -template -__declspec(thread) DERIVED_TYPE* LLThreadLocalSingletonPointer::sInstance = NULL; -#else template -__thread DERIVED_TYPE* LLThreadLocalSingletonPointer::sInstance = NULL; -#endif +LL_THREAD_LOCAL DERIVED_TYPE* LLThreadLocalSingletonPointer::sInstance = NULL; #endif // LL_LLTHREADLOCALSTORAGE_H -- cgit v1.2.3 From 0b1259a0847b3d6f2d0d1f2af0ec4e25d7c3551b Mon Sep 17 00:00:00 2001 From: callum_linden Date: Tue, 9 Dec 2014 17:29:07 -0800 Subject: no implicit conversion from ofsteam to bool in VS2013!!!! --- indra/llcommon/llerror.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llerror.cpp b/indra/llcommon/llerror.cpp index 22cd861c72..8119b14887 100755 --- a/indra/llcommon/llerror.cpp +++ b/indra/llcommon/llerror.cpp @@ -126,7 +126,7 @@ namespace { mFile.close(); } - bool okay() { return mFile; } + bool okay() { return mFile.good(); } virtual void recordMessage(LLError::ELevel level, const std::string& message) -- cgit v1.2.3 From 3d94afafb530b9841c151a24799a08f064b70ede Mon Sep 17 00:00:00 2001 From: callum_linden Date: Wed, 10 Dec 2014 08:56:13 -0800 Subject: Fix for build problems with LLTrace::AccumulatorBuffer copy ctor in VS2013 (only) --- indra/llcommon/lltraceaccumulators.h | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/lltraceaccumulators.h b/indra/llcommon/lltraceaccumulators.h index 42fad8a793..6e048535e3 100644 --- a/indra/llcommon/lltraceaccumulators.h +++ b/indra/llcommon/lltraceaccumulators.h @@ -62,16 +62,16 @@ namespace LLTrace {} public: - - AccumulatorBuffer(const AccumulatorBuffer& other = *getDefaultBuffer()) - : mStorageSize(0), - mStorage(NULL) - { - resize(sNextStorageSlot); - for (S32 i = 0; i < sNextStorageSlot; i++) - { - mStorage[i] = other.mStorage[i]; - } + AccumulatorBuffer() + : mStorageSize(0), + mStorage(NULL) + { + const AccumulatorBuffer& other = *getDefaultBuffer(); + resize(sNextStorageSlot); + for (S32 i = 0; i < sNextStorageSlot; i++) + { + mStorage[i] = other.mStorage[i]; + } } ~AccumulatorBuffer() @@ -93,6 +93,18 @@ namespace LLTrace return mStorage[index]; } + + AccumulatorBuffer(const AccumulatorBuffer& other) + : mStorageSize(0), + mStorage(NULL) + { + resize(sNextStorageSlot); + for (S32 i = 0; i < sNextStorageSlot; i++) + { + mStorage[i] = other.mStorage[i]; + } + } + void addSamples(const AccumulatorBuffer& other, EBufferAppendType append_type) { llassert(mStorageSize >= sNextStorageSlot && other.mStorageSize >= sNextStorageSlot); -- cgit v1.2.3 From 0f1cf6e40542e0992f6988e67b75b2f74ba4142b Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Wed, 10 Dec 2014 12:20:33 -0500 Subject: Clarify for VS 2013 that an operator bool() method returns bool. For some reason VS 2013 (unlike its predecessors and other current compilers) needs us to explicitly convert an operator bool() method's return expression to bool. :-P --- indra/llcommon/lleventcoro.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/lleventcoro.h b/indra/llcommon/lleventcoro.h index f55b74ac7e..abbeeaa373 100755 --- a/indra/llcommon/lleventcoro.h +++ b/indra/llcommon/lleventcoro.h @@ -67,7 +67,7 @@ public: LLEventPumpOrPumpName() {} operator LLEventPump& () const { return *mPump; } LLEventPump& getPump() const { return *mPump; } - operator bool() const { return mPump; } + operator bool() const { return bool(mPump); } bool operator!() const { return ! mPump; } private: -- cgit v1.2.3 From a2bb483f2d56362e5ea77b8e6471cc0f03740956 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Thu, 11 Dec 2014 13:12:20 -0500 Subject: Disambiguate a few ensure() calls. These were of the form ensure(std::string, something convertible to bool). Not sure what the ambiguity was, but ensure(std::string, bool(something)) works better. --- indra/llcommon/tests/llprocess_test.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/tests/llprocess_test.cpp b/indra/llcommon/tests/llprocess_test.cpp index e4e766d51b..5ba343b183 100755 --- a/indra/llcommon/tests/llprocess_test.cpp +++ b/indra/llcommon/tests/llprocess_test.cpp @@ -85,7 +85,7 @@ static std::string readfile(const std::string& pathname, const std::string& desc } std::ifstream inf(pathname.c_str()); std::string output; - tut::ensure(STRINGIZE("No output " << use_desc), std::getline(inf, output)); + tut::ensure(STRINGIZE("No output " << use_desc), bool(std::getline(inf, output))); std::string more; while (std::getline(inf, more)) { @@ -154,7 +154,7 @@ struct PythonProcessLauncher void launch() { mPy = LLProcess::create(mParams); - tut::ensure(STRINGIZE("Couldn't launch " << mDesc << " script"), mPy); + tut::ensure(STRINGIZE("Couldn't launch " << mDesc << " script"), bool(mPy)); } /// Run Python script and wait for it to complete. @@ -873,7 +873,7 @@ namespace tut std::string threw; \ /* Both the following calls should work. */ \ (PROCESS).GETPIPE(VALID); \ - ensure(#GETOPTPIPE "(" #VALID ") failed", (PROCESS).GETOPTPIPE(VALID)); \ + ensure(#GETOPTPIPE "(" #VALID ") failed", bool((PROCESS).GETOPTPIPE(VALID))); \ /* pass obviously bogus PIPESLOT */ \ CATCH_IN(threw, LLProcess::NoPipe, (PROCESS).GETPIPE(LLProcess::FILESLOT(4))); \ ensure_contains("didn't reject bad slot", threw, "no slot"); \ -- cgit v1.2.3 From eae38f7d57be5576199294b501e082c6d850473c Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Fri, 12 Dec 2014 13:46:41 -0800 Subject: Eliminate use of boost::lambda with boost::function (Trac #10864). https://svn.boost.org/trac/boost/ticket/10864 I've used boost::lambda with boost::function in a number of creative ways over the years. But the clang 6 shipped with Xcode 6 seems to have somehow broken lambda + function in Boost 1.57. boost::phoenix is a partial workaround. Sadly, lambda's comma-operator overload doesn't seem to be supported, necessitating a couple ugly workarounds. With real lambdas now supported by current compilers, I'm sure the Boost community has little incentive to repair the lambda + function problem. Presumably we'll be able to use such features ourselves Real Soon Now... --- indra/llcommon/tests/llleap_test.cpp | 10 ++++---- indra/llcommon/tests/llsdserialize_test.cpp | 40 ++++++++++++++++------------- 2 files changed, 27 insertions(+), 23 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/tests/llleap_test.cpp b/indra/llcommon/tests/llleap_test.cpp index 9ea822cb8d..653b043de4 100755 --- a/indra/llcommon/tests/llleap_test.cpp +++ b/indra/llcommon/tests/llleap_test.cpp @@ -17,7 +17,7 @@ // std headers // external library headers #include -#include +#include #include // other Linden headers #include "../test/lltut.h" @@ -109,7 +109,7 @@ namespace tut llleap_data(): reader(".py", // This logic is adapted from vita.viewerclient.receiveEvent() - boost::lambda::_1 << + boost::phoenix::placeholders::arg1 << "import re\n" "import os\n" "import sys\n" @@ -403,7 +403,7 @@ namespace tut AckAPI api; Result result; NamedTempFile script("py", - boost::lambda::_1 << + boost::phoenix::placeholders::arg1 << "from " << reader_module << " import *\n" // make a request on our little API "request(pump='" << api.getName() << "', data={})\n" @@ -441,7 +441,7 @@ namespace tut ReqIDAPI api; Result result; NamedTempFile script("py", - boost::lambda::_1 << + boost::phoenix::placeholders::arg1 << "import sys\n" "from " << reader_module << " import *\n" // Note that since reader imports llsd, this @@ -484,7 +484,7 @@ namespace tut ReqIDAPI api; Result result; NamedTempFile script("py", - boost::lambda::_1 << + boost::phoenix::placeholders::arg1 << "import sys\n" "from " << reader_module << " import *\n" // Generate a very large string value. diff --git a/indra/llcommon/tests/llsdserialize_test.cpp b/indra/llcommon/tests/llsdserialize_test.cpp index b5893135ea..afd4e7c8c1 100755 --- a/indra/llcommon/tests/llsdserialize_test.cpp +++ b/indra/llcommon/tests/llsdserialize_test.cpp @@ -46,9 +46,9 @@ typedef U32 uint32_t; #include "boost/range.hpp" #include "boost/foreach.hpp" #include "boost/function.hpp" -#include "boost/lambda/lambda.hpp" -#include "boost/lambda/bind.hpp" -namespace lambda = boost::lambda; +#include "boost/phoenix/bind/bind_function.hpp" +#include "boost/phoenix/core/argument.hpp" +using namespace boost::phoenix; #include "../llsd.h" #include "../llsdserialize.h" @@ -1612,6 +1612,20 @@ namespace tut "print 'Running on', sys.platform\n"); } + // helper for test<3> + static void writeLLSDArray(std::ostream& out, const LLSD& array) + { + BOOST_FOREACH(LLSD item, llsd::inArray(array)) + { + LLSDSerialize::toNotation(item, out); + // It's important to separate with newlines because Python's llsd + // module doesn't support parsing from a file stream, only from a + // string, so we have to know how much of the file to read into a + // string. + out << '\n'; + } + } + template<> template<> void TestPythonCompatibleObject::test<3>() { @@ -1639,26 +1653,16 @@ namespace tut " assert False, 'Too many data items'\n"; // Create an llsdXXXXXX file containing 'data' serialized to - // notation. It's important to separate with newlines because Python's - // llsd module doesn't support parsing from a file stream, only from a - // string, so we have to know how much of the file to read into a - // string. + // notation. NamedTempFile file("llsd", // NamedTempFile's boost::function constructor // takes a callable. To this callable it passes the // std::ostream with which it's writing the - // NamedTempFile. This lambda-based expression - // first calls LLSD::Serialize() with that ostream, - // then streams a newline to it, etc. - (lambda::bind(LLSDSerialize::toNotation, cdata[0], lambda::_1), - lambda::_1 << '\n', - lambda::bind(LLSDSerialize::toNotation, cdata[1], lambda::_1), - lambda::_1 << '\n', - lambda::bind(LLSDSerialize::toNotation, cdata[2], lambda::_1), - lambda::_1 << '\n')); + // NamedTempFile. + bind(writeLLSDArray, placeholders::arg1, cdata)); python("read C++ notation", - lambda::_1 << + placeholders::arg1 << import_llsd << "def parse_each(iterable):\n" " for item in iterable:\n" @@ -1679,7 +1683,7 @@ namespace tut NamedTempFile file("llsd", ""); python("write Python notation", - lambda::_1 << + placeholders::arg1 << "from __future__ import with_statement\n" << import_llsd << "DATA = [\n" -- cgit v1.2.3 From e6a7ce08ed368e31c495156b5146a5f256583669 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Fri, 12 Dec 2014 17:21:24 -0500 Subject: fix dos line endings --- indra/llcommon/lltraceaccumulators.h | 40 ++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 20 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/lltraceaccumulators.h b/indra/llcommon/lltraceaccumulators.h index 6e048535e3..6f27b97dff 100644 --- a/indra/llcommon/lltraceaccumulators.h +++ b/indra/llcommon/lltraceaccumulators.h @@ -62,16 +62,16 @@ namespace LLTrace {} public: - AccumulatorBuffer() - : mStorageSize(0), - mStorage(NULL) - { - const AccumulatorBuffer& other = *getDefaultBuffer(); - resize(sNextStorageSlot); - for (S32 i = 0; i < sNextStorageSlot; i++) - { - mStorage[i] = other.mStorage[i]; - } + AccumulatorBuffer() + : mStorageSize(0), + mStorage(NULL) + { + const AccumulatorBuffer& other = *getDefaultBuffer(); + resize(sNextStorageSlot); + for (S32 i = 0; i < sNextStorageSlot; i++) + { + mStorage[i] = other.mStorage[i]; + } } ~AccumulatorBuffer() @@ -94,16 +94,16 @@ namespace LLTrace } - AccumulatorBuffer(const AccumulatorBuffer& other) - : mStorageSize(0), - mStorage(NULL) - { - resize(sNextStorageSlot); - for (S32 i = 0; i < sNextStorageSlot; i++) - { - mStorage[i] = other.mStorage[i]; - } - } + AccumulatorBuffer(const AccumulatorBuffer& other) + : mStorageSize(0), + mStorage(NULL) + { + resize(sNextStorageSlot); + for (S32 i = 0; i < sNextStorageSlot; i++) + { + mStorage[i] = other.mStorage[i]; + } + } void addSamples(const AccumulatorBuffer& other, EBufferAppendType append_type) { -- cgit v1.2.3 From 1bd8a67dcbc2645565a2b95fa1424ffd0eb8d538 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Tue, 16 Dec 2014 13:54:29 -0500 Subject: Isolate #pragma clang to __clang__ compilations. It's very irritating that Visual Studio produces a warning for unrecognized #pragmas, which we then merrily turn into an error -- #pragma is inherently compiler-specific! --- indra/llcommon/tests/llerror_test.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/llcommon') diff --git a/indra/llcommon/tests/llerror_test.cpp b/indra/llcommon/tests/llerror_test.cpp index fee9492618..f51279e817 100755 --- a/indra/llcommon/tests/llerror_test.cpp +++ b/indra/llcommon/tests/llerror_test.cpp @@ -38,7 +38,9 @@ namespace { +#ifdef __clang__ # pragma clang diagnostic ignored "-Wunused-function" +#endif void test_that_error_h_includes_enough_things_to_compile_a_message() { LL_INFOS() << "!" << LL_ENDL; -- cgit v1.2.3 From 3b7d3cb1ea8c6f5f51d727732bbff8a6d89f3d33 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Tue, 16 Dec 2014 15:17:24 -0500 Subject: For one use case, boost::bind() better than boost::phoenix::bind(). We use boost::phoenix::placeholders::arg1 to imply a whole lambda expression, replacing boost::lambda. But to bind a plain function in a more straightforward way, seems classic boost::bind() works while boost::phoenix::bind() does not. --- indra/llcommon/tests/llsdserialize_test.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/tests/llsdserialize_test.cpp b/indra/llcommon/tests/llsdserialize_test.cpp index afd4e7c8c1..6fbb9abfc0 100755 --- a/indra/llcommon/tests/llsdserialize_test.cpp +++ b/indra/llcommon/tests/llsdserialize_test.cpp @@ -46,6 +46,7 @@ typedef U32 uint32_t; #include "boost/range.hpp" #include "boost/foreach.hpp" #include "boost/function.hpp" +#include "boost/bind.hpp" #include "boost/phoenix/bind/bind_function.hpp" #include "boost/phoenix/core/argument.hpp" using namespace boost::phoenix; @@ -1659,7 +1660,7 @@ namespace tut // takes a callable. To this callable it passes the // std::ostream with which it's writing the // NamedTempFile. - bind(writeLLSDArray, placeholders::arg1, cdata)); + boost::bind(writeLLSDArray, _1, cdata)); python("read C++ notation", placeholders::arg1 << -- cgit v1.2.3 From 111900150d7e80f4f97f26ceb413aea2a5965d73 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Mon, 22 Dec 2014 16:42:55 -0500 Subject: work arounds to compile on linux --- indra/llcommon/llprocessor.cpp | 2 +- indra/llcommon/llsys.cpp | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llprocessor.cpp b/indra/llcommon/llprocessor.cpp index 1ee3c7edb0..e3e1d0c391 100755 --- a/indra/llcommon/llprocessor.cpp +++ b/indra/llcommon/llprocessor.cpp @@ -778,7 +778,7 @@ private: setInfo(eFamily, family); } - setInfo(eFamilyName, compute_CPUFamilyName(cpuinfo["vendor_id"].c_str(), family)); + setInfo(eFamilyName, compute_CPUFamilyName(cpuinfo["vendor_id"].c_str(), family, 0)); // setInfo(eExtendedModel, getSysctlInt("machdep.cpu.extmodel")); // setInfo(eBrandID, getSysctlInt("machdep.cpu.brand")); diff --git a/indra/llcommon/llsys.cpp b/indra/llcommon/llsys.cpp index c9db73eb99..1a66612e87 100755 --- a/indra/llcommon/llsys.cpp +++ b/indra/llcommon/llsys.cpp @@ -677,6 +677,7 @@ U32 LLOSInfo::getProcessVirtualSizeKB() #if LL_WINDOWS #endif #if LL_LINUX +# define STATUS_SIZE 2048 LLFILE* status_filep = LLFile::fopen("/proc/self/status", "rb"); if (status_filep) { -- cgit v1.2.3 From a54188cb3d215db94e0392cb33e7ef999963335a Mon Sep 17 00:00:00 2001 From: callum_linden Date: Mon, 22 Dec 2014 14:19:19 -0800 Subject: Investigative check-in to see if system clock() function can be used to time ms_sleep() calls and adjust expectations accordingly --- indra/llcommon/tests/llframetimer_test.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/tests/llframetimer_test.cpp b/indra/llcommon/tests/llframetimer_test.cpp index 46fc4ce93a..c36b6a1c42 100755 --- a/indra/llcommon/tests/llframetimer_test.cpp +++ b/indra/llcommon/tests/llframetimer_test.cpp @@ -83,7 +83,13 @@ namespace tut } template<> template<> void frametimer_object_t::test<3>() - { + { + clock_t t1 = clock(); + ms_sleep(200); + clock_t t2 = clock(); + clock_t elapsed = t2 - t1 + 1; + std::cout << "Note: using clock(), ms_sleep() actually took " << (long)elapsed << "ms" << std::endl; + F64 seconds_since_epoch = LLFrameTimer::getTotalSeconds(); seconds_since_epoch += 2.0; LLFrameTimer timer; -- cgit v1.2.3 From d91fe250ace0ebbc0f22bbe8b60a3a542cb1e6be Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Tue, 23 Dec 2014 11:12:19 -0500 Subject: fix dos line endings --- indra/llcommon/tests/llframetimer_test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/tests/llframetimer_test.cpp b/indra/llcommon/tests/llframetimer_test.cpp index c36b6a1c42..be372bb855 100755 --- a/indra/llcommon/tests/llframetimer_test.cpp +++ b/indra/llcommon/tests/llframetimer_test.cpp @@ -83,7 +83,7 @@ namespace tut } template<> template<> void frametimer_object_t::test<3>() - { + { clock_t t1 = clock(); ms_sleep(200); clock_t t2 = clock(); -- cgit v1.2.3 From 33649e848b34dcaa5f4be49862fcbf0a49b46df3 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Mon, 12 Jan 2015 12:11:37 -0500 Subject: Experimentally try full-size LLLeap stream test on Windows. The new toolchain may (!) have fixed a longstanding bug in LLLeap / APR when we try to pump large volumes of data through a Windows named pipe using APR nonblocking I/O. This used to fail pretty consistently because the APR nonblocking write call would sometimes spuriously return "would block" when in fact the data buffer was completely written; the caller would later retry, which of course would duplicate some of the data in the pipe. Preliminary experiments with VS 2013 suggest this may have been resolved. This changeset is to propagate the experiment to a wider range of Windows systems; we may need to revert it if in fact the bug persists. --- indra/llcommon/tests/llleap_test.cpp | 17 ----------------- 1 file changed, 17 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/tests/llleap_test.cpp b/indra/llcommon/tests/llleap_test.cpp index 653b043de4..2d88e2c676 100755 --- a/indra/llcommon/tests/llleap_test.cpp +++ b/indra/llcommon/tests/llleap_test.cpp @@ -38,24 +38,7 @@ StringVec sv(const StringVec& listof) { return listof; } #define sleep(secs) _sleep((secs) * 1000) #endif -#if ! LL_WINDOWS const size_t BUFFERED_LENGTH = 1023*1024; // try wrangling just under a megabyte of data -#else -// "Then there's Windows... sigh." The "very large message" test is flaky in a -// way that seems to point to either the OS (nonblocking writes to pipes) or -// possibly the apr_file_write() function. Poring over log messages reveals -// that at some point along the way apr_file_write() returns 11 (Resource -// temporarily unavailable, i.e. EAGAIN) and says it wrote 0 bytes -- even -// though it did write the chunk! Our next write attempt retries the same -// chunk, resulting in the chunk being duplicated at the child end, corrupting -// the data stream. Much as I would love to be able to fix it for real, such a -// fix would appear to require distinguishing bogus EAGAIN returns from real -// ones -- how?? Empirically this behavior is only observed when writing a -// "very large message". To be able to move forward at all, try to bypass this -// particular failure by adjusting the size of a "very large message" on -// Windows. -const size_t BUFFERED_LENGTH = 65336; -#endif // LL_WINDOWS void waitfor(const std::vector& instances, int timeout=60) { -- cgit v1.2.3 From feb341d37c1cf8712a26ab44714fccb1dcd722aa Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Fri, 16 Jan 2015 19:54:35 +0000 Subject: Continue gradually replacing Boost.Lambda with Boost.Phoenix. For some reason, after the upgrade to Boost 1.57, gcc 4.6.3 has trouble with the boost::lambda::_1 usage in stringize.h. This is consistent with other cases we've encountered in which Boost.Lambda appears to be unmaintained and losing its compatibility with other libraries. Fortunately Phoenix provides a functional equivalent, albeit spelled differently. --- indra/llcommon/stringize.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/stringize.h b/indra/llcommon/stringize.h index 2df008febb..a5a90d7297 100755 --- a/indra/llcommon/stringize.h +++ b/indra/llcommon/stringize.h @@ -30,7 +30,7 @@ #define LL_STRINGIZE_H #include -#include +#include #include /** @@ -108,7 +108,7 @@ std::string stringize_f(Functor const & f) * return out.str(); * @endcode */ -#define STRINGIZE(EXPRESSION) (stringize_f(boost::lambda::_1 << EXPRESSION)) +#define STRINGIZE(EXPRESSION) (stringize_f(boost::phoenix::placeholders::arg1 << EXPRESSION)) /** @@ -144,7 +144,7 @@ void destringize_f(std::string const & str, Functor const & f) * in >> item1 >> item2 >> item3 ... ; * @endcode */ -#define DESTRINGIZE(STR, EXPRESSION) (destringize_f((STR), (boost::lambda::_1 >> EXPRESSION))) +#define DESTRINGIZE(STR, EXPRESSION) (destringize_f((STR), (boost::phoenix::placeholders::arg1 >> EXPRESSION))) #endif /* ! defined(LL_STRINGIZE_H) */ -- cgit v1.2.3 From ba43a216fdd1ee5f77f3aece4ce9dbf441bab3e6 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Thu, 22 Jan 2015 01:38:38 +0000 Subject: Disambiguate constructor's initialization call to its base class. A particular LLInitParam::TypeValuesHelper specialization is derived from a different TypeValuesHelper specialization. The subclass constructor TypeValuesHelper(...) has previously forwarded the call to its base-class constructor with: TypeValuesHelper(val): TypeValuesHelper(val) {} This is the first time I've looked at that; I'm a bit surprised that previous compilers blithely accept it, and apparently understand the intent. gcc 4.7 complains that we would need to turn on -std=c++11 to support delegating constructors; obviously the second TypeValuesHelper is now assumed to be the class being defined, rather than its base class. Fortunately the class already has typedefs for both specializations, fully qualified with all template parameters, so I simply replaced the second TypeValuesHelper reference with base_t. --- indra/llcommon/llinitparam.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llinitparam.h b/indra/llcommon/llinitparam.h index be3552cb46..c65b05f610 100755 --- a/indra/llcommon/llinitparam.h +++ b/indra/llcommon/llinitparam.h @@ -435,7 +435,7 @@ namespace LLInitParam typedef self_t type_value_t; TypeValuesHelper(const std::string& val) - : TypeValuesHelper(val) + : base_t(val) {} void operator ()(const std::string& name) -- cgit v1.2.3 From ae6440eecc4d6c018a3634c2c06052757bde962f Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Wed, 28 Jan 2015 15:55:18 -0500 Subject: MAINT-4744: Eliminate viewer dependency on (old) GNU libstdc++. To be more accurate, this changeset doesn't actually eliminate the dependency: it eliminates the use cases for the llifstream / llofstream feature that requires it. Currently you can construct an llifstream or llofstream from an open LLFILE* file handle (or, except on Windows, an int file descriptor). But rather than containing a streambuf implementation based on FILE*, llfile.h relies on the fact that the Windows std::filebuf happens to support that as a nonstandard extension; also on a nonstandard GNU extension __gnu_cxx::stdio_filebuf. To move from GNU libstdc++ to clang's libc++ (the direction on Mac), we could code a streambuf that supports FILE*. But before doing that, it's worth asking whether anyone actually uses this questionable feature. In fact there were only two methods: LLWearable::exportFile() and importFile() -- and only one call to either, in LLViewerWearable::saveNewAsset(). The code in saveNewAsset() opened the LLFILE* immediately before calling exportFile(), meaning we could reasonably push the open operation down into exportFile(). That logic was complex anyway due to the need for the caller to close the LLFILE* regardless of the success of the exportFile(). Change LLWearable::exportFile() and importFile() to accept a std::string filename rather than an open LLFILE*. Change LLViewerWearable::saveNewAsset() to simply call exportFile(filename) rather than horsing around with an LLFILE* handle. (This improves the code in another way too: it encapsulates the need to open the relevant file in binary mode. Previously, each caller had to remember to do that.) To prevent inadvertent reintroduction of ll[io]fstream(LLFILE*) code, add llstream_LLFILE preprocessor macro (default 0) to control access to the relevant constructors. Also suppress rdbuf() override, the only method whose signature references llstdio_filebuf. --- indra/llcommon/llfile.cpp | 4 ++++ indra/llcommon/llfile.h | 14 ++++++++++++++ 2 files changed, 18 insertions(+) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llfile.cpp b/indra/llcommon/llfile.cpp index aabc195ba8..304d702979 100755 --- a/indra/llcommon/llfile.cpp +++ b/indra/llcommon/llfile.cpp @@ -919,6 +919,7 @@ llifstream::llifstream(const char* _Filename, #endif +#if llstream_LLFILE // explicit llifstream::llifstream(_Filet *_File, ios_base::openmode _Mode, size_t _Size) : @@ -942,6 +943,7 @@ llifstream::llifstream(int __fd, this->init(&_M_filebuf); } #endif +#endif // llstream_LLFILE bool llifstream::is_open() const { // test if C stream has been opened @@ -1039,6 +1041,7 @@ llofstream::llofstream(const char* _Filename, } #endif +#if llstream_LLFILE // explicit llofstream::llofstream(_Filet *_File, ios_base::openmode _Mode, size_t _Size) : @@ -1062,6 +1065,7 @@ llofstream::llofstream(int __fd, this->init(&_M_filebuf); } #endif +#endif // llstream_LLFILE bool llofstream::is_open() const { // test if C stream has been opened diff --git a/indra/llcommon/llfile.h b/indra/llcommon/llfile.h index 0612071d67..44a1e42fa5 100755 --- a/indra/llcommon/llfile.h +++ b/indra/llcommon/llfile.h @@ -86,6 +86,12 @@ public: static const char * tmpdir(); }; +// Remove ll[io]fstream support for [LL]FILE*, preparing to remove dependency +// on GNU's standard library. +#if ! defined(llstream_LLFILE) +#define llstream_LLFILE 0 +#endif + /** * @brief Provides a layer of compatibility for C/POSIX. * @@ -228,6 +234,7 @@ public: explicit llifstream(const char* _Filename, ios_base::openmode _Mode = ios_base::in); +#if llstream_LLFILE /** * @brief Create a stream using an open c file stream. * @param File An open @c FILE*. @@ -253,6 +260,7 @@ public: //size_t _Size = static_cast(BUFSIZ)); size_t _Size = static_cast(1)); #endif +#endif // llstream_LLFILE /** * @brief The destructor does nothing. @@ -263,6 +271,7 @@ public: virtual ~llifstream() {} // Members: +#if llstream_LLFILE /** * @brief Accessing the underlying buffer. * @return The current basic_filebuf buffer. @@ -271,6 +280,7 @@ public: */ llstdio_filebuf* rdbuf() const { return const_cast(&_M_filebuf); } +#endif // llstream_LLFILE /** * @brief Wrapper to test for an open file. @@ -340,6 +350,7 @@ public: explicit llofstream(const char* _Filename, ios_base::openmode _Mode = ios_base::out|ios_base::trunc); +#if llstream_LLFILE /** * @brief Create a stream using an open c file stream. * @param File An open @c FILE*. @@ -365,6 +376,7 @@ public: //size_t _Size = static_cast(BUFSIZ)); size_t _Size = static_cast(1)); #endif +#endif // llstream_LLFILE /** * @brief The destructor does nothing. @@ -375,6 +387,7 @@ public: virtual ~llofstream() {} // Members: +#if llstream_LLFILE /** * @brief Accessing the underlying buffer. * @return The current basic_filebuf buffer. @@ -383,6 +396,7 @@ public: */ llstdio_filebuf* rdbuf() const { return const_cast(&_M_filebuf); } +#endif // llstream_LLFILE /** * @brief Wrapper to test for an open file. -- cgit v1.2.3 From 77d25204ea5ea4378e0c10e1f57e56148980fce2 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Thu, 2 Apr 2015 15:41:45 -0400 Subject: clarity and logging cleanup --- indra/llcommon/lllivefile.cpp | 85 +++++++++++++++++++++++-------------------- 1 file changed, 46 insertions(+), 39 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/lllivefile.cpp b/indra/llcommon/lllivefile.cpp index c1987baf55..ea485c2d86 100755 --- a/indra/llcommon/lllivefile.cpp +++ b/indra/llcommon/lllivefile.cpp @@ -51,6 +51,8 @@ public: bool mLastExists; LLEventTimer* mEventTimer; +private: + LOG_CLASS(LLLiveFile); }; LLLiveFile::Impl::Impl(const std::string& filename, const F32 refresh_period) @@ -83,46 +85,51 @@ LLLiveFile::~LLLiveFile() bool LLLiveFile::Impl::check() { - if (!mForceCheck && mRefreshTimer.getElapsedTimeF32() < mRefreshPeriod) + bool detected_change = false; + // Skip the check if not enough time has elapsed and we're not + // forcing a check of the file + if (mForceCheck || mRefreshTimer.getElapsedTimeF32() >= mRefreshPeriod) { - // Skip the check if not enough time has elapsed and we're not - // forcing a check of the file - return false; - } - mForceCheck = false; - mRefreshTimer.reset(); - - // Stat the file to see if it exists and when it was last modified. - llstat stat_data; - int res = LLFile::stat(mFilename, &stat_data); - - if (res) - { - // Couldn't stat the file, that means it doesn't exist or is - // broken somehow. Clear flags and return. - if (mLastExists) - { - mLastExists = false; - return true; // no longer existing is a change! - } - return false; - } - - // The file exists, decide if we want to load it. - if (mLastExists) - { - // The file existed last time, don't read it if it hasn't changed since - // last time. - if (stat_data.st_mtime <= mLastModTime) - { - return false; - } - } - - // We want to read the file. Update status info for the file. - mLastExists = true; - mLastStatTime = stat_data.st_mtime; - return true; + mForceCheck = false; // force only forces one check + mRefreshTimer.reset(); // don't check again until mRefreshPeriod has passed + + // Stat the file to see if it exists and when it was last modified. + llstat stat_data; + if (LLFile::stat(mFilename, &stat_data)) + { + // Couldn't stat the file, that means it doesn't exist or is + // broken somehow. + if (mLastExists) + { + mLastExists = false; + detected_change = true; // no longer existing is a change! + LL_DEBUGS() << "detected deleted file '" << mFilename << "'" << LL_ENDL; + } + } + else + { + // The file exists + if ( ! mLastExists ) + { + // last check, it did not exist - that counts as a change + LL_DEBUGS() << "detected created file '" << mFilename << "'" << LL_ENDL; + detected_change = true; + } + else if ( stat_data.st_mtime > mLastModTime ) + { + // file modification time is newer than last check + LL_DEBUGS() << "detected updated file '" << mFilename << "'" << LL_ENDL; + detected_change = true; + } + mLastExists = true; + mLastStatTime = stat_data.st_mtime; + } + } + if (detected_change) + { + LL_INFOS() << "detected file change '" << mFilename << "'" << LL_ENDL; + } + return detected_change; } void LLLiveFile::Impl::changed() -- cgit v1.2.3 From 3a57b18896eacb6fea6680d0eccaaeddb0b700b0 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Tue, 7 Apr 2015 17:28:05 -0400 Subject: convert llifstream and llofstream to std::ifstream and std::ofstream respectively --- indra/llcommon/llerror.cpp | 4 +- indra/llcommon/llfile.cpp | 85 +++++++++++--------------------- indra/llcommon/llfile.h | 99 +++----------------------------------- indra/llcommon/llliveappconfig.cpp | 2 +- indra/llcommon/llstring.cpp | 2 +- 5 files changed, 37 insertions(+), 155 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llerror.cpp b/indra/llcommon/llerror.cpp index 8119b14887..2100989316 100755 --- a/indra/llcommon/llerror.cpp +++ b/indra/llcommon/llerror.cpp @@ -113,7 +113,7 @@ namespace { public: RecordToFile(const std::string& filename) { - mFile.open(filename, llofstream::out | llofstream::app); + mFile.open(filename.c_str(), std::ios_base::out | std::ios_base::app); if (!mFile) { LL_INFOS() << "Error setting log file to " << filename << LL_ENDL; @@ -335,7 +335,7 @@ namespace LLSD configuration; { - llifstream file(filename()); + llifstream file(filename().c_str()); if (file.is_open()) { LLSDSerialize::fromXML(configuration, file); diff --git a/indra/llcommon/llfile.cpp b/indra/llcommon/llfile.cpp index 304d702979..77a9657306 100755 --- a/indra/llcommon/llfile.cpp +++ b/indra/llcommon/llfile.cpp @@ -865,6 +865,7 @@ int llstdio_filebuf::sync() } #endif +#if 0 // @TBDeleted /************** input file stream ********************************/ @@ -919,32 +920,6 @@ llifstream::llifstream(const char* _Filename, #endif -#if llstream_LLFILE -// explicit -llifstream::llifstream(_Filet *_File, - ios_base::openmode _Mode, size_t _Size) : - _M_filebuf(_File, _Mode, _Size), -#if LL_WINDOWS - std::istream(&_M_filebuf) {} -#else - std::istream() -{ - this->init(&_M_filebuf); -} -#endif - -#if !LL_WINDOWS -// explicit -llifstream::llifstream(int __fd, - ios_base::openmode _Mode, size_t _Size) : - _M_filebuf(__fd, _Mode, _Size), - std::istream() -{ - this->init(&_M_filebuf); -} -#endif -#endif // llstream_LLFILE - bool llifstream::is_open() const { // test if C stream has been opened return _M_filebuf.is_open(); @@ -993,9 +968,9 @@ void llifstream::close() llofstream::llofstream() : _M_filebuf(), #if LL_WINDOWS - std::ostream(&_M_filebuf) {} + std::ofstream(&_M_filebuf) {} #else - std::ostream() + std::ofstream() { this->init(&_M_filebuf); } @@ -1005,7 +980,7 @@ llofstream::llofstream() : _M_filebuf(), llofstream::llofstream(const std::string& _Filename, ios_base::openmode _Mode) : _M_filebuf(), #if LL_WINDOWS - std::ostream(&_M_filebuf) + std::ofstream(&_M_filebuf) { llutf16string wideName = utf8str_to_utf16str( _Filename ); if (_M_filebuf.open( wideName.c_str(), _Mode | ios_base::out) == 0) @@ -1014,7 +989,7 @@ llofstream::llofstream(const std::string& _Filename, } } #else - std::ostream() + std::ofstream() { this->init(&_M_filebuf); this->open(_Filename.c_str(), _Mode | ios_base::out); @@ -1025,7 +1000,7 @@ llofstream::llofstream(const std::string& _Filename, llofstream::llofstream(const char* _Filename, ios_base::openmode _Mode) : _M_filebuf(), #if LL_WINDOWS - std::ostream(&_M_filebuf) + std::ofstream(&_M_filebuf) { llutf16string wideName = utf8str_to_utf16str( _Filename ); if (_M_filebuf.open( wideName.c_str(), _Mode | ios_base::out) == 0) @@ -1034,39 +1009,13 @@ llofstream::llofstream(const char* _Filename, } } #else - std::ostream() + std::ofstream() { this->init(&_M_filebuf); this->open(_Filename, _Mode | ios_base::out); } #endif -#if llstream_LLFILE -// explicit -llofstream::llofstream(_Filet *_File, - ios_base::openmode _Mode, size_t _Size) : - _M_filebuf(_File, _Mode, _Size), -#if LL_WINDOWS - std::ostream(&_M_filebuf) {} -#else - std::ostream() -{ - this->init(&_M_filebuf); -} -#endif - -#if !LL_WINDOWS -// explicit -llofstream::llofstream(int __fd, - ios_base::openmode _Mode, size_t _Size) : - _M_filebuf(__fd, _Mode, _Size), - std::ostream() -{ - this->init(&_M_filebuf); -} -#endif -#endif // llstream_LLFILE - bool llofstream::is_open() const { // test if C stream has been opened return _M_filebuf.is_open(); @@ -1108,6 +1057,25 @@ void llofstream::close() } } +void llofstream::~llofstream() +{ + try: + { + if ( is_open() ) + { + flush(); + } + } + catch (std::exception& e) + { + LL_WARNS() << "llofstream std::exception: " << e.what() << LL_ENDL; + } + catch (...) + { + LL_WARNS() << "llofstream non-std exception" << LL_ENDL; + } +} + /************** helper functions ********************************/ std::streamsize llifstream_size(llifstream& ifstr) @@ -1135,3 +1103,4 @@ std::streamsize llofstream_size(llofstream& ofstr) } +#endif // @TBDeleted diff --git a/indra/llcommon/llfile.h b/indra/llcommon/llfile.h index 44a1e42fa5..bd750b8c3c 100755 --- a/indra/llcommon/llfile.h +++ b/indra/llcommon/llfile.h @@ -86,12 +86,6 @@ public: static const char * tmpdir(); }; -// Remove ll[io]fstream support for [LL]FILE*, preparing to remove dependency -// on GNU's standard library. -#if ! defined(llstream_LLFILE) -#define llstream_LLFILE 0 -#endif - /** * @brief Provides a layer of compatibility for C/POSIX. * @@ -198,7 +192,9 @@ protected: #endif }; - +typedef std::ifstream llifstream; +typedef std::ofstream llofstream; +#if 0 /* @TBDeleted */ /** * @brief Controlling input for files. * @@ -234,34 +230,6 @@ public: explicit llifstream(const char* _Filename, ios_base::openmode _Mode = ios_base::in); -#if llstream_LLFILE - /** - * @brief Create a stream using an open c file stream. - * @param File An open @c FILE*. - @param Mode Same meaning as in a standard filebuf. - @param Size Optimal or preferred size of internal buffer, in chars. - Defaults to system's @c BUFSIZ. - */ - explicit llifstream(_Filet *_File, - ios_base::openmode _Mode = ios_base::in, - //size_t _Size = static_cast(BUFSIZ)); - size_t _Size = static_cast(1)); - - /** - * @brief Create a stream using an open file descriptor. - * @param fd An open file descriptor. - @param Mode Same meaning as in a standard filebuf. - @param Size Optimal or preferred size of internal buffer, in chars. - Defaults to system's @c BUFSIZ. - */ -#if !LL_WINDOWS - explicit llifstream(int __fd, - ios_base::openmode _Mode = ios_base::in, - //size_t _Size = static_cast(BUFSIZ)); - size_t _Size = static_cast(1)); -#endif -#endif // llstream_LLFILE - /** * @brief The destructor does nothing. * @@ -271,17 +239,6 @@ public: virtual ~llifstream() {} // Members: -#if llstream_LLFILE - /** - * @brief Accessing the underlying buffer. - * @return The current basic_filebuf buffer. - * - * This hides both signatures of std::basic_ios::rdbuf(). - */ - llstdio_filebuf* rdbuf() const - { return const_cast(&_M_filebuf); } -#endif // llstream_LLFILE - /** * @brief Wrapper to test for an open file. * @return @c rdbuf()->is_open() @@ -324,7 +281,7 @@ private: * which allows construction using a pre-exisintg file stream buffer. * We refer to this std::basic_filebuf (or derivative) as @c sb. */ -class LL_COMMON_API llofstream : public std::ostream +class LL_COMMON_API llofstream : public std::ofstream { public: // Constructors: @@ -350,60 +307,15 @@ public: explicit llofstream(const char* _Filename, ios_base::openmode _Mode = ios_base::out|ios_base::trunc); -#if llstream_LLFILE - /** - * @brief Create a stream using an open c file stream. - * @param File An open @c FILE*. - @param Mode Same meaning as in a standard filebuf. - @param Size Optimal or preferred size of internal buffer, in chars. - Defaults to system's @c BUFSIZ. - */ - explicit llofstream(_Filet *_File, - ios_base::openmode _Mode = ios_base::out, - //size_t _Size = static_cast(BUFSIZ)); - size_t _Size = static_cast(1)); - - /** - * @brief Create a stream using an open file descriptor. - * @param fd An open file descriptor. - @param Mode Same meaning as in a standard filebuf. - @param Size Optimal or preferred size of internal buffer, in chars. - Defaults to system's @c BUFSIZ. - */ -#if !LL_WINDOWS - explicit llofstream(int __fd, - ios_base::openmode _Mode = ios_base::out, - //size_t _Size = static_cast(BUFSIZ)); - size_t _Size = static_cast(1)); -#endif -#endif // llstream_LLFILE - /** * @brief The destructor does nothing. * * The file is closed by the filebuf object, not the formatting * stream. */ - virtual ~llofstream() {} + virtual ~llofstream(); // Members: -#if llstream_LLFILE - /** - * @brief Accessing the underlying buffer. - * @return The current basic_filebuf buffer. - * - * This hides both signatures of std::basic_ios::rdbuf(). - */ - llstdio_filebuf* rdbuf() const - { return const_cast(&_M_filebuf); } -#endif // llstream_LLFILE - - /** - * @brief Wrapper to test for an open file. - * @return @c rdbuf()->is_open() - */ - bool is_open() const; - /** * @brief Opens an external file. * @param Filename The name of the file. @@ -440,5 +352,6 @@ private: */ std::streamsize LL_COMMON_API llifstream_size(llifstream& fstr); std::streamsize LL_COMMON_API llofstream_size(llofstream& fstr); +#endif /* @TBDeleted */ #endif // not LL_LLFILE_H diff --git a/indra/llcommon/llliveappconfig.cpp b/indra/llcommon/llliveappconfig.cpp index 7c87c5a1a0..a9b1cdf4f6 100755 --- a/indra/llcommon/llliveappconfig.cpp +++ b/indra/llcommon/llliveappconfig.cpp @@ -49,7 +49,7 @@ bool LLLiveAppConfig::loadFile() { LL_INFOS() << "LLLiveAppConfig::loadFile(): reading from " << filename() << LL_ENDL; - llifstream file(filename()); + llifstream file(filename().c_str()); LLSD config; if (file.is_open()) { diff --git a/indra/llcommon/llstring.cpp b/indra/llcommon/llstring.cpp index 617969ab2a..f3b8999883 100755 --- a/indra/llcommon/llstring.cpp +++ b/indra/llcommon/llstring.cpp @@ -107,7 +107,7 @@ bool iswindividual(llwchar elem) bool _read_file_into_string(std::string& str, const std::string& filename) { - llifstream ifs(filename, llifstream::binary); + llifstream ifs(filename.c_str(), llifstream::binary); if (!ifs.is_open()) { LL_INFOS() << "Unable to open file " << filename << LL_ENDL; -- cgit v1.2.3 From 8b42c7898ef756a4a81daa08b2a5acce2894f4b8 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Tue, 7 Apr 2015 17:59:28 -0400 Subject: replace llifstream and llofstream with std::ifstream and std::ofstream respectively --- indra/llcommon/llerror.cpp | 4 +- indra/llcommon/llfile.cpp | 239 ------------------------------------- indra/llcommon/llfile.h | 162 ------------------------- indra/llcommon/llliveappconfig.cpp | 2 +- indra/llcommon/llstring.cpp | 2 +- 5 files changed, 4 insertions(+), 405 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llerror.cpp b/indra/llcommon/llerror.cpp index 2100989316..3cb81b4e47 100755 --- a/indra/llcommon/llerror.cpp +++ b/indra/llcommon/llerror.cpp @@ -135,7 +135,7 @@ namespace { } private: - llofstream mFile; + std::ofstream mFile; }; @@ -335,7 +335,7 @@ namespace LLSD configuration; { - llifstream file(filename().c_str()); + std::ifstream file(filename().c_str()); if (file.is_open()) { LLSDSerialize::fromXML(configuration, file); diff --git a/indra/llcommon/llfile.cpp b/indra/llcommon/llfile.cpp index 77a9657306..ab432a923d 100755 --- a/indra/llcommon/llfile.cpp +++ b/indra/llcommon/llfile.cpp @@ -865,242 +865,3 @@ int llstdio_filebuf::sync() } #endif -#if 0 // @TBDeleted -/************** input file stream ********************************/ - - -llifstream::llifstream() : _M_filebuf(), -#if LL_WINDOWS - std::istream(&_M_filebuf) {} -#else - std::istream() -{ - this->init(&_M_filebuf); -} -#endif - -// explicit -llifstream::llifstream(const std::string& _Filename, - ios_base::openmode _Mode) : _M_filebuf(), -#if LL_WINDOWS - std::istream(&_M_filebuf) -{ - llutf16string wideName = utf8str_to_utf16str( _Filename ); - if (_M_filebuf.open(wideName.c_str(), _Mode | ios_base::in) == 0) - { - _Myios::setstate(ios_base::failbit); - } -} -#else - std::istream() -{ - this->init(&_M_filebuf); - this->open(_Filename.c_str(), _Mode | ios_base::in); -} -#endif - -// explicit -llifstream::llifstream(const char* _Filename, - ios_base::openmode _Mode) : _M_filebuf(), -#if LL_WINDOWS - std::istream(&_M_filebuf) -{ - llutf16string wideName = utf8str_to_utf16str( _Filename ); - if (_M_filebuf.open(wideName.c_str(), _Mode | ios_base::in) == 0) - { - _Myios::setstate(ios_base::failbit); - } -} -#else - std::istream() -{ - this->init(&_M_filebuf); - this->open(_Filename, _Mode | ios_base::in); -} -#endif - - -bool llifstream::is_open() const -{ // test if C stream has been opened - return _M_filebuf.is_open(); -} - -void llifstream::open(const char* _Filename, ios_base::openmode _Mode) -{ // open a C stream with specified mode - -#if LL_WINDOWS - llutf16string wideName = utf8str_to_utf16str( _Filename ); - if (_M_filebuf.open( wideName.c_str(), _Mode | ios_base::in) == 0) - { - _Myios::setstate(ios_base::failbit); - } - else - { - _Myios::clear(); - } -#else - if (_M_filebuf.open(_Filename, _Mode | ios_base::in) == 0) - { - this->setstate(ios_base::failbit); - } - else - { - this->clear(); - } -#endif -} - -void llifstream::close() -{ // close the C stream - if (_M_filebuf.close() == 0) - { -#if LL_WINDOWS - _Myios::setstate(ios_base::failbit); -#else - this->setstate(ios_base::failbit); -#endif - } -} - - -/************** output file stream ********************************/ - - -llofstream::llofstream() : _M_filebuf(), -#if LL_WINDOWS - std::ofstream(&_M_filebuf) {} -#else - std::ofstream() -{ - this->init(&_M_filebuf); -} -#endif - -// explicit -llofstream::llofstream(const std::string& _Filename, - ios_base::openmode _Mode) : _M_filebuf(), -#if LL_WINDOWS - std::ofstream(&_M_filebuf) -{ - llutf16string wideName = utf8str_to_utf16str( _Filename ); - if (_M_filebuf.open( wideName.c_str(), _Mode | ios_base::out) == 0) - { - _Myios::setstate(ios_base::failbit); - } -} -#else - std::ofstream() -{ - this->init(&_M_filebuf); - this->open(_Filename.c_str(), _Mode | ios_base::out); -} -#endif - -// explicit -llofstream::llofstream(const char* _Filename, - ios_base::openmode _Mode) : _M_filebuf(), -#if LL_WINDOWS - std::ofstream(&_M_filebuf) -{ - llutf16string wideName = utf8str_to_utf16str( _Filename ); - if (_M_filebuf.open( wideName.c_str(), _Mode | ios_base::out) == 0) - { - _Myios::setstate(ios_base::failbit); - } -} -#else - std::ofstream() -{ - this->init(&_M_filebuf); - this->open(_Filename, _Mode | ios_base::out); -} -#endif - -bool llofstream::is_open() const -{ // test if C stream has been opened - return _M_filebuf.is_open(); -} - -void llofstream::open(const char* _Filename, ios_base::openmode _Mode) -{ // open a C stream with specified mode -#if LL_WINDOWS - llutf16string wideName = utf8str_to_utf16str( _Filename ); - if (_M_filebuf.open( wideName.c_str(), _Mode | ios_base::out) == 0) - { - _Myios::setstate(ios_base::failbit); - } - else - { - _Myios::clear(); - } -#else - if (_M_filebuf.open(_Filename, _Mode | ios_base::out) == 0) - { - this->setstate(ios_base::failbit); - } - else - { - this->clear(); - } -#endif -} - -void llofstream::close() -{ // close the C stream - if (_M_filebuf.close() == 0) - { -#if LL_WINDOWS - _Myios::setstate(ios_base::failbit); -#else - this->setstate(ios_base::failbit); -#endif - } -} - -void llofstream::~llofstream() -{ - try: - { - if ( is_open() ) - { - flush(); - } - } - catch (std::exception& e) - { - LL_WARNS() << "llofstream std::exception: " << e.what() << LL_ENDL; - } - catch (...) - { - LL_WARNS() << "llofstream non-std exception" << LL_ENDL; - } -} - -/************** helper functions ********************************/ - -std::streamsize llifstream_size(llifstream& ifstr) -{ - if(!ifstr.is_open()) return 0; - std::streampos pos_old = ifstr.tellg(); - ifstr.seekg(0, ios_base::beg); - std::streampos pos_beg = ifstr.tellg(); - ifstr.seekg(0, ios_base::end); - std::streampos pos_end = ifstr.tellg(); - ifstr.seekg(pos_old, ios_base::beg); - return pos_end - pos_beg; -} - -std::streamsize llofstream_size(llofstream& ofstr) -{ - if(!ofstr.is_open()) return 0; - std::streampos pos_old = ofstr.tellp(); - ofstr.seekp(0, ios_base::beg); - std::streampos pos_beg = ofstr.tellp(); - ofstr.seekp(0, ios_base::end); - std::streampos pos_end = ofstr.tellp(); - ofstr.seekp(pos_old, ios_base::beg); - return pos_end - pos_beg; -} - - -#endif // @TBDeleted diff --git a/indra/llcommon/llfile.h b/indra/llcommon/llfile.h index bd750b8c3c..e310d47325 100755 --- a/indra/llcommon/llfile.h +++ b/indra/llcommon/llfile.h @@ -192,166 +192,4 @@ protected: #endif }; -typedef std::ifstream llifstream; -typedef std::ofstream llofstream; -#if 0 /* @TBDeleted */ -/** - * @brief Controlling input for files. - * - * This class supports reading from named files, using the inherited - * functions from std::basic_istream. To control the associated - * sequence, an instance of std::basic_filebuf (or a platform-specific derivative) - * which allows construction using a pre-exisintg file stream buffer. - * We refer to this std::basic_filebuf (or derivative) as @c sb. -*/ -class LL_COMMON_API llifstream : public std::istream -{ - // input stream associated with a C stream -public: - // Constructors: - /** - * @brief Default constructor. - * - * Initializes @c sb using its default constructor, and passes - * @c &sb to the base class initializer. Does not open any files - * (you haven't given it a filename to open). - */ - llifstream(); - - /** - * @brief Create an input file stream. - * @param Filename String specifying the filename. - * @param Mode Open file in specified mode (see std::ios_base). - * - * @c ios_base::in is automatically included in @a mode. - */ - explicit llifstream(const std::string& _Filename, - ios_base::openmode _Mode = ios_base::in); - explicit llifstream(const char* _Filename, - ios_base::openmode _Mode = ios_base::in); - - /** - * @brief The destructor does nothing. - * - * The file is closed by the filebuf object, not the formatting - * stream. - */ - virtual ~llifstream() {} - - // Members: - /** - * @brief Wrapper to test for an open file. - * @return @c rdbuf()->is_open() - */ - bool is_open() const; - - /** - * @brief Opens an external file. - * @param Filename The name of the file. - * @param Node The open mode flags. - * - * Calls @c llstdio_filebuf::open(s,mode|in). If that function - * fails, @c failbit is set in the stream's error state. - */ - void open(const std::string& _Filename, - ios_base::openmode _Mode = ios_base::in) - { open(_Filename.c_str(), _Mode); } - void open(const char* _Filename, - ios_base::openmode _Mode = ios_base::in); - - /** - * @brief Close the file. - * - * Calls @c llstdio_filebuf::close(). If that function - * fails, @c failbit is set in the stream's error state. - */ - void close(); - -private: - llstdio_filebuf _M_filebuf; -}; - - -/** - * @brief Controlling output for files. - * - * This class supports writing to named files, using the inherited - * functions from std::basic_ostream. To control the associated - * sequence, an instance of std::basic_filebuf (or a platform-specific derivative) - * which allows construction using a pre-exisintg file stream buffer. - * We refer to this std::basic_filebuf (or derivative) as @c sb. -*/ -class LL_COMMON_API llofstream : public std::ofstream -{ -public: - // Constructors: - /** - * @brief Default constructor. - * - * Initializes @c sb using its default constructor, and passes - * @c &sb to the base class initializer. Does not open any files - * (you haven't given it a filename to open). - */ - llofstream(); - - /** - * @brief Create an output file stream. - * @param Filename String specifying the filename. - * @param Mode Open file in specified mode (see std::ios_base). - * - * @c ios_base::out|ios_base::trunc is automatically included in - * @a mode. - */ - explicit llofstream(const std::string& _Filename, - ios_base::openmode _Mode = ios_base::out|ios_base::trunc); - explicit llofstream(const char* _Filename, - ios_base::openmode _Mode = ios_base::out|ios_base::trunc); - - /** - * @brief The destructor does nothing. - * - * The file is closed by the filebuf object, not the formatting - * stream. - */ - virtual ~llofstream(); - - // Members: - /** - * @brief Opens an external file. - * @param Filename The name of the file. - * @param Node The open mode flags. - * - * Calls @c llstdio_filebuf::open(s,mode|out). If that function - * fails, @c failbit is set in the stream's error state. - */ - void open(const std::string& _Filename, - ios_base::openmode _Mode = ios_base::out|ios_base::trunc) - { open(_Filename.c_str(), _Mode); } - void open(const char* _Filename, - ios_base::openmode _Mode = ios_base::out|ios_base::trunc); - - /** - * @brief Close the file. - * - * Calls @c llstdio_filebuf::close(). If that function - * fails, @c failbit is set in the stream's error state. - */ - void close(); - -private: - llstdio_filebuf _M_filebuf; -}; - - -/** - * @breif filesize helpers. - * - * The file size helpers are not considered particularly efficient, - * and should only be used for config files and the like -- not in a - * loop. - */ -std::streamsize LL_COMMON_API llifstream_size(llifstream& fstr); -std::streamsize LL_COMMON_API llofstream_size(llofstream& fstr); -#endif /* @TBDeleted */ - #endif // not LL_LLFILE_H diff --git a/indra/llcommon/llliveappconfig.cpp b/indra/llcommon/llliveappconfig.cpp index a9b1cdf4f6..f955194009 100755 --- a/indra/llcommon/llliveappconfig.cpp +++ b/indra/llcommon/llliveappconfig.cpp @@ -49,7 +49,7 @@ bool LLLiveAppConfig::loadFile() { LL_INFOS() << "LLLiveAppConfig::loadFile(): reading from " << filename() << LL_ENDL; - llifstream file(filename().c_str()); + std::ifstream file(filename().c_str()); LLSD config; if (file.is_open()) { diff --git a/indra/llcommon/llstring.cpp b/indra/llcommon/llstring.cpp index f3b8999883..227f81e88f 100755 --- a/indra/llcommon/llstring.cpp +++ b/indra/llcommon/llstring.cpp @@ -107,7 +107,7 @@ bool iswindividual(llwchar elem) bool _read_file_into_string(std::string& str, const std::string& filename) { - llifstream ifs(filename.c_str(), llifstream::binary); + std::ifstream ifs(filename.c_str(), std::ifstream::binary); if (!ifs.is_open()) { LL_INFOS() << "Unable to open file " << filename << LL_ENDL; -- cgit v1.2.3 From 5c6cf3e7fb9f592e3a293921175b64b515bac23f Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Fri, 10 Apr 2015 11:02:37 -0400 Subject: restore the ll[io]fstream because we need them as wrappers on Windows for wide char paths; on other platforms they are now just typedefs to the std classes --- indra/llcommon/llerror.cpp | 4 +- indra/llcommon/llfile.cpp | 170 +++++++++++++++++++++++++++++---- indra/llcommon/llfile.h | 191 +++++++++++++++++++++++++++++++++++++ indra/llcommon/llliveappconfig.cpp | 2 +- indra/llcommon/llstring.cpp | 2 +- 5 files changed, 345 insertions(+), 24 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llerror.cpp b/indra/llcommon/llerror.cpp index 3cb81b4e47..2100989316 100755 --- a/indra/llcommon/llerror.cpp +++ b/indra/llcommon/llerror.cpp @@ -135,7 +135,7 @@ namespace { } private: - std::ofstream mFile; + llofstream mFile; }; @@ -335,7 +335,7 @@ namespace LLSD configuration; { - std::ifstream file(filename().c_str()); + llifstream file(filename().c_str()); if (file.is_open()) { LLSDSerialize::fromXML(configuration, file); diff --git a/indra/llcommon/llfile.cpp b/indra/llcommon/llfile.cpp index ab432a923d..295c97eac8 100755 --- a/indra/llcommon/llfile.cpp +++ b/indra/llcommon/llfile.cpp @@ -424,26 +424,6 @@ LLFILE * LLFile::_Fiopen(const std::string& filename, /************** llstdio file buffer ********************************/ -//llstdio_filebuf* llstdio_filebuf::open(const char *_Filename, -// ios_base::openmode _Mode) -//{ -//#if LL_WINDOWS -// _Filet *_File; -// if (is_open() || (_File = LLFILE::_Fiopen(_Filename, _Mode)) == 0) -// return (0); // open failed -// -// _Init(_File, _Openfl); -// _Initcvt(&_USE(_Mysb::getloc(), _Cvt)); -// return (this); // open succeeded -//#else -// std::filebuf* _file = std::filebuf::open(_Filename, _Mode); -// if (NULL == _file) return NULL; -// return this; -//#endif -//} - - -// *TODO: Seek the underlying c stream for better cross-platform compatibility? #if !LL_WINDOWS llstdio_filebuf::int_type llstdio_filebuf::overflow(llstdio_filebuf::int_type __c) { @@ -865,3 +845,153 @@ int llstdio_filebuf::sync() } #endif +#if LL_WINDOWS +/************** input file stream ********************************/ + +llifstream::llifstream() : + _M_filebuf(), + std::istream(&_M_filebuf) +{ +} + +// explicit +llifstream::llifstream(const std::string& _Filename, + ios_base::openmode _Mode) : + _M_filebuf(), + std::istream(&_M_filebuf) +{ + llutf16string wideName = utf8str_to_utf16str( _Filename ); + if (_M_filebuf.open(wideName.c_str(), _Mode | ios_base::in) == 0) + { + _Myios::setstate(ios_base::failbit); + } +} + +// explicit +llifstream::llifstream(const char* _Filename, + ios_base::openmode _Mode) : + _M_filebuf(), + std::istream(&_M_filebuf) +{ + llutf16string wideName = utf8str_to_utf16str( _Filename ); + if (_M_filebuf.open(wideName.c_str(), _Mode | ios_base::in) == 0) + { + _Myios::setstate(ios_base::failbit); + } +} + +bool llifstream::is_open() const +{ // test if C stream has been opened + return _M_filebuf.is_open(); +} + +void llifstream::open(const char* _Filename, ios_base::openmode _Mode) +{ // open a C stream with specified mode + llutf16string wideName = utf8str_to_utf16str( _Filename ); + if (_M_filebuf.open( wideName.c_str(), _Mode | ios_base::in) == 0) + { + _Myios::setstate(ios_base::failbit); + } + else + { + _Myios::clear(); + } +} + +void llifstream::close() +{ // close the C stream + if (_M_filebuf.close() == 0) + { + _Myios::setstate(ios_base::failbit); + } +} + + +/************** output file stream ********************************/ + + +llofstream::llofstream() : + _M_filebuf(), + std::ostream(&_M_filebuf) +{ +} + +// explicit +llofstream::llofstream(const std::string& _Filename, + ios_base::openmode _Mode) : + _M_filebuf(), + std::ostream(&_M_filebuf) +{ + llutf16string wideName = utf8str_to_utf16str( _Filename ); + if (_M_filebuf.open( wideName.c_str(), _Mode | ios_base::out) == 0) + { + _Myios::setstate(ios_base::failbit); + } +} + +// explicit +llofstream::llofstream(const char* _Filename, + ios_base::openmode _Mode) : + _M_filebuf(), + std::ostream(&_M_filebuf) +{ + llutf16string wideName = utf8str_to_utf16str( _Filename ); + if (_M_filebuf.open( wideName.c_str(), _Mode | ios_base::out) == 0) + { + _Myios::setstate(ios_base::failbit); + } +} + +bool llofstream::is_open() const +{ // test if C stream has been opened + return _M_filebuf.is_open(); +} + +void llofstream::open(const char* _Filename, ios_base::openmode _Mode) +{ // open a C stream with specified mode + llutf16string wideName = utf8str_to_utf16str( _Filename ); + if (_M_filebuf.open( wideName.c_str(), _Mode | ios_base::out) == 0) + { + _Myios::setstate(ios_base::failbit); + } + else + { + _Myios::clear(); + } +} + +void llofstream::close() +{ // close the C stream + if (_M_filebuf.close() == 0) + { + _Myios::setstate(ios_base::failbit); + } +} + +/************** helper functions ********************************/ + +std::streamsize llifstream_size(llifstream& ifstr) +{ + if(!ifstr.is_open()) return 0; + std::streampos pos_old = ifstr.tellg(); + ifstr.seekg(0, ios_base::beg); + std::streampos pos_beg = ifstr.tellg(); + ifstr.seekg(0, ios_base::end); + std::streampos pos_end = ifstr.tellg(); + ifstr.seekg(pos_old, ios_base::beg); + return pos_end - pos_beg; +} + +std::streamsize llofstream_size(llofstream& ofstr) +{ + if(!ofstr.is_open()) return 0; + std::streampos pos_old = ofstr.tellp(); + ofstr.seekp(0, ios_base::beg); + std::streampos pos_beg = ofstr.tellp(); + ofstr.seekp(0, ios_base::end); + std::streampos pos_end = ofstr.tellp(); + ofstr.seekp(pos_old, ios_base::beg); + return pos_end - pos_beg; +} + +#endif // LL_WINDOWS diff --git a/indra/llcommon/llfile.h b/indra/llcommon/llfile.h index e310d47325..347c9867aa 100755 --- a/indra/llcommon/llfile.h +++ b/indra/llcommon/llfile.h @@ -192,4 +192,195 @@ protected: #endif }; +#if LL_WINDOWS +/** + * @brief Controlling input for files. + * + * This class supports reading from named files, using the inherited + * functions from std::basic_istream. To control the associated + * sequence, an instance of std::basic_filebuf (or a platform-specific derivative) + * which allows construction using a pre-exisintg file stream buffer. + * We refer to this std::basic_filebuf (or derivative) as @c sb. + */ +class LL_COMMON_API llifstream : public std::istream +{ + // input stream associated with a C stream + public: + // Constructors: + /** + * @brief Default constructor. + * + * Initializes @c sb using its default constructor, and passes + * @c &sb to the base class initializer. Does not open any files + * (you haven't given it a filename to open). + */ + llifstream(); + + /** + * @brief Create an input file stream. + * @param Filename String specifying the filename. + * @param Mode Open file in specified mode (see std::ios_base). + * + * @c ios_base::in is automatically included in @a mode. + */ + explicit llifstream(const std::string& _Filename, + ios_base::openmode _Mode = ios_base::in); + explicit llifstream(const char* _Filename, + ios_base::openmode _Mode = ios_base::in); + + /** + * @brief The destructor does nothing. + * + * The file is closed by the filebuf object, not the formatting + * stream. + */ + virtual ~llifstream() {} + + // Members: + /** + * @brief Accessing the underlying buffer. + * @return The current basic_filebuf buffer. + * + * This hides both signatures of std::basic_ios::rdbuf(). + */ + llstdio_filebuf* rdbuf() const + { return const_cast(&_M_filebuf); } + + /** + * @brief Wrapper to test for an open file. + * @return @c rdbuf()->is_open() + */ + bool is_open() const; + + /** + * @brief Opens an external file. + * @param Filename The name of the file. + * @param Node The open mode flags. + * + * Calls @c llstdio_filebuf::open(s,mode|in). If that function + * fails, @c failbit is set in the stream's error state. + */ + void open(const std::string& _Filename, + ios_base::openmode _Mode = ios_base::in) + { open(_Filename.c_str(), _Mode); } + void open(const char* _Filename, + ios_base::openmode _Mode = ios_base::in); + + /** + * @brief Close the file. + * + * Calls @c llstdio_filebuf::close(). If that function + * fails, @c failbit is set in the stream's error state. + */ + void close(); + + private: + llstdio_filebuf _M_filebuf; +}; + + +/** + * @brief Controlling output for files. + * + * This class supports writing to named files, using the inherited + * functions from std::basic_ostream. To control the associated + * sequence, an instance of std::basic_filebuf (or a platform-specific derivative) + * which allows construction using a pre-exisintg file stream buffer. + * We refer to this std::basic_filebuf (or derivative) as @c sb. +*/ +class LL_COMMON_API llofstream : public std::ostream +{ + public: + // Constructors: + /** + * @brief Default constructor. + * + * Initializes @c sb using its default constructor, and passes + * @c &sb to the base class initializer. Does not open any files + * (you haven't given it a filename to open). + */ + llofstream(); + + /** + * @brief Create an output file stream. + * @param Filename String specifying the filename. + * @param Mode Open file in specified mode (see std::ios_base). + * + * @c ios_base::out|ios_base::trunc is automatically included in + * @a mode. + */ + explicit llofstream(const std::string& _Filename, + ios_base::openmode _Mode = ios_base::out|ios_base::trunc); + explicit llofstream(const char* _Filename, + ios_base::openmode _Mode = ios_base::out|ios_base::trunc); + + /** + * @brief The destructor does nothing. + * + * The file is closed by the filebuf object, not the formatting + * stream. + */ + virtual ~llofstream() {} + + // Members: + /** + * @brief Accessing the underlying buffer. + * @return The current basic_filebuf buffer. + * + * This hides both signatures of std::basic_ios::rdbuf(). + */ + llstdio_filebuf* rdbuf() const + { return const_cast(&_M_filebuf); } + + /** + * @brief Wrapper to test for an open file. + * @return @c rdbuf()->is_open() + */ + bool is_open() const; + + /** + * @brief Opens an external file. + * @param Filename The name of the file. + * @param Node The open mode flags. + * + * Calls @c llstdio_filebuf::open(s,mode|out). If that function + * fails, @c failbit is set in the stream's error state. + */ + void open(const std::string& _Filename, + ios_base::openmode _Mode = ios_base::out|ios_base::trunc) + { open(_Filename.c_str(), _Mode); } + void open(const char* _Filename, + ios_base::openmode _Mode = ios_base::out|ios_base::trunc); + + /** + * @brief Close the file. + * + * Calls @c llstdio_filebuf::close(). If that function + * fails, @c failbit is set in the stream's error state. + */ + void close(); + + private: + llstdio_filebuf _M_filebuf; +}; + + +/** + * @breif filesize helpers. + * + * The file size helpers are not considered particularly efficient, + * and should only be used for config files and the like -- not in a + * loop. + */ +std::streamsize LL_COMMON_API llifstream_size(llifstream& fstr); +std::streamsize LL_COMMON_API llofstream_size(llofstream& fstr); + +#else // ! LL_WINDOWS + +// on non-windows, llifstream and llofstream are just mapped directly to the std:: equivalents +typedef std::ifstream llifstream; +typedef std::ofstream llofstream; + +#endif // LL_WINDOWS or ! LL_WINDOWS + #endif // not LL_LLFILE_H diff --git a/indra/llcommon/llliveappconfig.cpp b/indra/llcommon/llliveappconfig.cpp index f955194009..a9b1cdf4f6 100755 --- a/indra/llcommon/llliveappconfig.cpp +++ b/indra/llcommon/llliveappconfig.cpp @@ -49,7 +49,7 @@ bool LLLiveAppConfig::loadFile() { LL_INFOS() << "LLLiveAppConfig::loadFile(): reading from " << filename() << LL_ENDL; - std::ifstream file(filename().c_str()); + llifstream file(filename().c_str()); LLSD config; if (file.is_open()) { diff --git a/indra/llcommon/llstring.cpp b/indra/llcommon/llstring.cpp index 227f81e88f..f3b8999883 100755 --- a/indra/llcommon/llstring.cpp +++ b/indra/llcommon/llstring.cpp @@ -107,7 +107,7 @@ bool iswindividual(llwchar elem) bool _read_file_into_string(std::string& str, const std::string& filename) { - std::ifstream ifs(filename.c_str(), std::ifstream::binary); + llifstream ifs(filename.c_str(), llifstream::binary); if (!ifs.is_open()) { LL_INFOS() << "Unable to open file " << filename << LL_ENDL; -- cgit v1.2.3 From 5a282abe184323643f1a88f2aba662648059b4e2 Mon Sep 17 00:00:00 2001 From: Cinder Date: Sat, 11 Apr 2015 15:23:06 -0600 Subject: STORM-2113 - uri parsing cleanup and fixes --- indra/llcommon/lluriparser.cpp | 11 +++++++---- indra/llcommon/lluriparser.h | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/lluriparser.cpp b/indra/llcommon/lluriparser.cpp index ef4481d32f..0ff6657b87 100644 --- a/indra/llcommon/lluriparser.cpp +++ b/indra/llcommon/lluriparser.cpp @@ -118,11 +118,14 @@ void LLUriParser::fragment(const std::string& s) void LLUriParser::textRangeToString(UriTextRangeA& textRange, std::string& str) { - S32 len = textRange.afterLast - textRange.first; - if (len) + if (textRange.first != NULL && textRange.afterLast != NULL && textRange.first < textRange.afterLast) { - str = textRange.first; - str = str.substr(0, len); + const ptrdiff_t len = textRange.afterLast - textRange.first; + str.assign(textRange.first, static_cast(len)); + } + else + { + str = LLStringUtil::null; } } diff --git a/indra/llcommon/lluriparser.h b/indra/llcommon/lluriparser.h index 719f916837..3e7a5c2a57 100644 --- a/indra/llcommon/lluriparser.h +++ b/indra/llcommon/lluriparser.h @@ -36,7 +36,7 @@ class LL_COMMON_API LLUriParser { public: LLUriParser(const std::string& u); - virtual ~LLUriParser(); + ~LLUriParser(); const char * scheme() const; void sheme (const std::string& s); -- cgit v1.2.3 From bef5a95cafdf6e20a243f4091b4fbcf426fb529b Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Tue, 14 Apr 2015 05:00:58 -0400 Subject: minimal changes to compile on Xcode 6.2 --- indra/llcommon/lluriparser.cpp | 29 +++++------------------------ 1 file changed, 5 insertions(+), 24 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/lluriparser.cpp b/indra/llcommon/lluriparser.cpp index 8270c630d8..d98bc297e5 100644 --- a/indra/llcommon/lluriparser.cpp +++ b/indra/llcommon/lluriparser.cpp @@ -118,38 +118,19 @@ void LLUriParser::fragment(const std::string& s) void LLUriParser::textRangeToString(UriTextRangeA& textRange, std::string& str) { - str = ""; - - if(&textRange == NULL) - { - return; - } - - if(textRange.first == NULL) - { - return; - } - - if(textRange.afterLast == NULL) + if (textRange.first != NULL && textRange.afterLast != NULL && textRange.first < textRange.afterLast) { - return; + const ptrdiff_t len = textRange.afterLast - textRange.first; + str.assign(textRange.first, static_cast(len)); } - - S32 len = textRange.afterLast - textRange.first; - if (len) + else { - str.assign(textRange.first, len); + str = LLStringUtil::null; } } void LLUriParser::extractParts() { - if(&mUri == NULL) - { - LL_WARNS() << "mUri is NULL for uri: " << mNormalizedUri << LL_ENDL; - return; - } - if (mTmpScheme || mNormalizedTmp) { mScheme.clear(); -- cgit v1.2.3