diff options
author | Oz Linden <oz@lindenlab.com> | 2014-12-17 14:28:58 -0500 |
---|---|---|
committer | Oz Linden <oz@lindenlab.com> | 2014-12-17 14:28:58 -0500 |
commit | 4666497507b2489004a4ebcf77c0e33723291bcd (patch) | |
tree | 677050cb13533b17e2c5e170a8438aef221b85ca /indra/llcommon | |
parent | 11ecd9a2d97f2daeba932bcda557d3ae17956ed8 (diff) | |
parent | f8ed44f8ec80916e684c2783da02f89474710de6 (diff) |
merge up to latest changes from callum and nat
Diffstat (limited to 'indra/llcommon')
-rwxr-xr-x | indra/llcommon/llerror.cpp | 2 | ||||
-rwxr-xr-x | indra/llcommon/lleventcoro.h | 2 | ||||
-rw-r--r-- | indra/llcommon/lltraceaccumulators.h | 18 | ||||
-rwxr-xr-x | indra/llcommon/tests/llerror_test.cpp | 2 | ||||
-rwxr-xr-x | indra/llcommon/tests/llleap_test.cpp | 10 | ||||
-rwxr-xr-x | indra/llcommon/tests/llprocess_test.cpp | 6 | ||||
-rwxr-xr-x | indra/llcommon/tests/llsdserialize_test.cpp | 41 |
7 files changed, 50 insertions, 31 deletions
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) 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: diff --git a/indra/llcommon/lltraceaccumulators.h b/indra/llcommon/lltraceaccumulators.h index 42fad8a793..6f27b97dff 100644 --- a/indra/llcommon/lltraceaccumulators.h +++ b/indra/llcommon/lltraceaccumulators.h @@ -62,11 +62,11 @@ namespace LLTrace {} public: - - AccumulatorBuffer(const AccumulatorBuffer& other = *getDefaultBuffer()) - : mStorageSize(0), + AccumulatorBuffer() + : mStorageSize(0), mStorage(NULL) { + const AccumulatorBuffer& other = *getDefaultBuffer(); resize(sNextStorageSlot); for (S32 i = 0; i < sNextStorageSlot; i++) { @@ -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<ACCUMULATOR>& other, EBufferAppendType append_type) { llassert(mStorageSize >= sNextStorageSlot && other.mStorageSize >= sNextStorageSlot); 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; 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 <boost/assign/list_of.hpp> -#include <boost/lambda/lambda.hpp> +#include <boost/phoenix/core/argument.hpp> #include <boost/foreach.hpp> // 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/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"); \ diff --git a/indra/llcommon/tests/llsdserialize_test.cpp b/indra/llcommon/tests/llsdserialize_test.cpp index b5893135ea..6fbb9abfc0 100755 --- a/indra/llcommon/tests/llsdserialize_test.cpp +++ b/indra/llcommon/tests/llsdserialize_test.cpp @@ -46,9 +46,10 @@ 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/bind.hpp" +#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 +1613,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 +1654,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. + boost::bind(writeLLSDArray, _1, cdata)); python("read C++ notation", - lambda::_1 << + placeholders::arg1 << import_llsd << "def parse_each(iterable):\n" " for item in iterable:\n" @@ -1679,7 +1684,7 @@ namespace tut NamedTempFile file("llsd", ""); python("write Python notation", - lambda::_1 << + placeholders::arg1 << "from __future__ import with_statement\n" << import_llsd << "DATA = [\n" |