summaryrefslogtreecommitdiff
path: root/indra/llcommon
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llcommon')
-rw-r--r--indra/llcommon/llerrorthread.cpp2
-rw-r--r--indra/llcommon/llsd.cpp2
-rw-r--r--indra/llcommon/llsd.h26
-rw-r--r--indra/llcommon/llsdserialize.cpp26
-rw-r--r--indra/llcommon/llsdserialize.h2
-rw-r--r--indra/llcommon/llsdutil.h69
-rw-r--r--indra/llcommon/lltimer.cpp11
-rw-r--r--indra/llcommon/stdtypes.h2
-rw-r--r--indra/llcommon/tests/lleventdispatcher_test.cpp182
-rw-r--r--indra/llcommon/tests/llprocess_test.cpp40
-rw-r--r--indra/llcommon/tests/llsdserialize_test.cpp8
11 files changed, 152 insertions, 218 deletions
diff --git a/indra/llcommon/llerrorthread.cpp b/indra/llcommon/llerrorthread.cpp
index f6bc68b5c1..4f8f0a88ad 100644
--- a/indra/llcommon/llerrorthread.cpp
+++ b/indra/llcommon/llerrorthread.cpp
@@ -108,11 +108,9 @@ void LLErrorThread::run()
// application state as APP_STATUS_ERROR.
LL_INFOS() << "thread_error - Waiting for an error" << LL_ENDL;
- S32 counter = 0;
while (! (LLApp::isError() || LLApp::isStopped()))
{
ms_sleep(10);
- counter++;
}
if (LLApp::isError())
{
diff --git a/indra/llcommon/llsd.cpp b/indra/llcommon/llsd.cpp
index a645e624f8..590915e9d2 100644
--- a/indra/llcommon/llsd.cpp
+++ b/indra/llcommon/llsd.cpp
@@ -622,7 +622,7 @@ namespace
if (index >= mData.size())
{
- mData.resize(i + 1);
+ mData.resize(index + 1);
}
return mData[index];
diff --git a/indra/llcommon/llsd.h b/indra/llcommon/llsd.h
index 4e9fcc77ee..cdb9a7ed8a 100644
--- a/indra/llcommon/llsd.h
+++ b/indra/llcommon/llsd.h
@@ -30,7 +30,6 @@
#include <map>
#include <string>
#include <vector>
-#include <type_traits>
#include "stdtypes.h"
@@ -216,21 +215,15 @@ public:
void assign(const Date&);
void assign(const URI&);
void assign(const Binary&);
-
- // support assignment from size_t et al.
- template <typename VALUE,
- typename std::enable_if<std::is_integral<VALUE>::value &&
- ! std::is_same<VALUE, Boolean>::value,
- bool>::type = true>
- void assign(VALUE v) { assign(Integer(narrow(v))); }
- // support assignment from F32 et al.
- template <typename VALUE,
- typename std::enable_if<std::is_floating_point<VALUE>::value,
- bool>::type = true>
- void assign(VALUE v) { assign(Real(narrow(v))); }
-
- template <typename VALUE>
- LLSD& operator=(VALUE v) { assign(v); return *this; }
+
+ LLSD& operator=(Boolean v) { assign(v); return *this; }
+ LLSD& operator=(Integer v) { assign(v); return *this; }
+ LLSD& operator=(Real v) { assign(v); return *this; }
+ LLSD& operator=(const String& v) { assign(v); return *this; }
+ LLSD& operator=(const UUID& v) { assign(v); return *this; }
+ LLSD& operator=(const Date& v) { assign(v); return *this; }
+ LLSD& operator=(const URI& v) { assign(v); return *this; }
+ LLSD& operator=(const Binary& v) { assign(v); return *this; }
//@}
/**
@@ -292,6 +285,7 @@ public:
//@{
LLSD(const char*);
void assign(const char*);
+ LLSD& operator=(const char* v) { assign(v); return *this; }
//@}
/** @name Map Values */
diff --git a/indra/llcommon/llsdserialize.cpp b/indra/llcommon/llsdserialize.cpp
index e7482b601d..3db456ddb3 100644
--- a/indra/llcommon/llsdserialize.cpp
+++ b/indra/llcommon/llsdserialize.cpp
@@ -125,14 +125,20 @@ bool LLSDSerialize::deserialize(LLSD& sd, std::istream& str, llssize max_bytes)
char hdr_buf[MAX_HDR_LEN + 1] = ""; /* Flawfinder: ignore */
bool fail_if_not_legacy = false;
- /*
- * Get the first line before anything. Don't read more than max_bytes:
- * this get() overload reads no more than (count-1) bytes into the
- * specified buffer. In the usual case when max_bytes exceeds
- * sizeof(hdr_buf), get() will read no more than sizeof(hdr_buf)-2.
- */
- str.get(hdr_buf, llmin(max_bytes+1, sizeof(hdr_buf)-1), '\n');
+ /*
+ * Get the first line before anything. Don't read more than max_bytes:
+ * this get() overload reads no more than (count-1) bytes into the
+ * specified buffer. In the usual case when max_bytes exceeds
+ * sizeof(hdr_buf), get() will read no more than sizeof(hdr_buf)-2.
+ */
+ llssize max_hdr_read = MAX_HDR_LEN;
+ if (max_bytes != LLSDSerialize::SIZE_UNLIMITED)
+ {
+ max_hdr_read = llmin(max_bytes + 1, max_hdr_read);
+ }
+ str.get(hdr_buf, max_hdr_read, '\n');
auto inbuf = str.gcount();
+
// https://en.cppreference.com/w/cpp/io/basic_istream/get
// When the get() above sees the specified delimiter '\n', it stops there
// without pulling it from the stream. If it turns out that the stream
@@ -2242,9 +2248,9 @@ LLUZipHelper::EZipRresult LLUZipHelper::unzip_llsd(LLSD& data, std::istream& is,
LLUZipHelper::EZipRresult LLUZipHelper::unzip_llsd(LLSD& data, const U8* in, S32 size)
{
U8* result = NULL;
- U32 cur_size = 0;
+ llssize cur_size = 0;
z_stream strm;
-
+
constexpr U32 CHUNK = 1024 * 512;
static thread_local std::unique_ptr<U8[]> out;
@@ -2437,7 +2443,7 @@ U8* unzip_llsdNavMesh( bool& valid, size_t& outsize, std::istream& is, S32 size
return result;
}
-char* strip_deprecated_header(char* in, U32& cur_size, U32* header_size)
+char* strip_deprecated_header(char* in, llssize& cur_size, llssize* header_size)
{
const char* deprecated_header = "<? LLSD/Binary ?>";
constexpr size_t deprecated_header_size = 17;
diff --git a/indra/llcommon/llsdserialize.h b/indra/llcommon/llsdserialize.h
index 2f12c6d1ff..676b7bfd6a 100644
--- a/indra/llcommon/llsdserialize.h
+++ b/indra/llcommon/llsdserialize.h
@@ -873,5 +873,5 @@ LL_COMMON_API std::string zip_llsd(LLSD& data);
LL_COMMON_API U8* unzip_llsdNavMesh( bool& valid, size_t& outsize,std::istream& is, S32 size);
// returns a pointer to the array or past the array if the deprecated header exists
-LL_COMMON_API char* strip_deprecated_header(char* in, U32& cur_size, U32* header_size = nullptr);
+LL_COMMON_API char* strip_deprecated_header(char* in, llssize& cur_size, llssize* header_size = nullptr);
#endif // LL_LLSDSERIALIZE_H
diff --git a/indra/llcommon/llsdutil.h b/indra/llcommon/llsdutil.h
index 1321615805..372278c51a 100644
--- a/indra/llcommon/llsdutil.h
+++ b/indra/llcommon/llsdutil.h
@@ -191,75 +191,6 @@ LLSD& drill_ref( LLSD& blob, const LLSD& path);
}
-/*****************************************************************************
-* LLSDArray
-*****************************************************************************/
-/**
- * Construct an LLSD::Array inline, with implicit conversion to LLSD. Usage:
- *
- * @code
- * void somefunc(const LLSD&);
- * ...
- * somefunc(LLSDArray("text")(17)(3.14));
- * @endcode
- *
- * For completeness, LLSDArray() with no args constructs an empty array, so
- * <tt>LLSDArray()("text")(17)(3.14)</tt> produces an array equivalent to the
- * above. But for most purposes, LLSD() is already equivalent to an empty
- * array, and if you explicitly want an empty isArray(), there's
- * LLSD::emptyArray(). However, supporting a no-args LLSDArray() constructor
- * follows the principle of least astonishment.
- */
-class LLSDArray
-{
-public:
- LLSDArray():
- _data(LLSD::emptyArray())
- {}
-
- /**
- * Need an explicit copy constructor. Consider the following:
- *
- * @code
- * LLSD array_of_arrays(LLSDArray(LLSDArray(17)(34))
- * (LLSDArray("x")("y")));
- * @endcode
- *
- * The coder intends to construct [[17, 34], ["x", "y"]].
- *
- * With the compiler's implicit copy constructor, s/he gets instead
- * [17, 34, ["x", "y"]].
- *
- * The expression LLSDArray(17)(34) constructs an LLSDArray with those two
- * values. The reader assumes it should be converted to LLSD, as we always
- * want with LLSDArray, before passing it to the @em outer LLSDArray
- * constructor! This copy constructor makes that happen.
- */
- LLSDArray(const LLSDArray& inner):
- _data(LLSD::emptyArray())
- {
- _data.append(inner);
- }
-
- LLSDArray(const LLSD& value):
- _data(LLSD::emptyArray())
- {
- _data.append(value);
- }
-
- LLSDArray& operator()(const LLSD& value)
- {
- _data.append(value);
- return *this;
- }
-
- operator LLSD() const { return _data; }
- LLSD get() const { return _data; }
-
-private:
- LLSD _data;
-};
-
namespace llsd
{
diff --git a/indra/llcommon/lltimer.cpp b/indra/llcommon/lltimer.cpp
index 74ec62d347..58bedacf43 100644
--- a/indra/llcommon/lltimer.cpp
+++ b/indra/llcommon/lltimer.cpp
@@ -121,9 +121,14 @@ U32 micro_sleep(U64 us, U32 max_yields)
U64 start = get_clock_count();
// This is kernel dependent. Currently, our kernel generates software clock
// interrupts at 250 Hz (every 4,000 microseconds).
- const U64 KERNEL_SLEEP_INTERVAL_US = 4000;
-
- auto num_sleep_intervals = (us - (KERNEL_SLEEP_INTERVAL_US >> 1)) / KERNEL_SLEEP_INTERVAL_US;
+ const S64 KERNEL_SLEEP_INTERVAL_US = 4000;
+
+ // Use signed arithmetic to discover whether a sleep is even necessary. If
+ // either 'us' or KERNEL_SLEEP_INTERVAL_US is unsigned, the compiler
+ // promotes the difference to unsigned. If 'us' is less than half
+ // KERNEL_SLEEP_INTERVAL_US, the unsigned difference will be hugely
+ // positive, resulting in a crazy long wait.
+ auto num_sleep_intervals = (S64(us) - (KERNEL_SLEEP_INTERVAL_US >> 1)) / KERNEL_SLEEP_INTERVAL_US;
if (num_sleep_intervals > 0)
{
U64 sleep_time = (num_sleep_intervals * KERNEL_SLEEP_INTERVAL_US) - (KERNEL_SLEEP_INTERVAL_US >> 1);
diff --git a/indra/llcommon/stdtypes.h b/indra/llcommon/stdtypes.h
index da8512169c..0b43d7ad4b 100644
--- a/indra/llcommon/stdtypes.h
+++ b/indra/llcommon/stdtypes.h
@@ -41,7 +41,7 @@ typedef unsigned int U32;
// to express an index that might go negative
// (ssize_t is provided by SOME compilers, don't collide)
-typedef typename std::make_signed<size_t>::type llssize;
+typedef typename std::make_signed<std::size_t>::type llssize;
#if LL_WINDOWS
// https://docs.microsoft.com/en-us/cpp/build/reference/zc-wchar-t-wchar-t-is-native-type
diff --git a/indra/llcommon/tests/lleventdispatcher_test.cpp b/indra/llcommon/tests/lleventdispatcher_test.cpp
index 966dc2c5aa..466f11f52a 100644
--- a/indra/llcommon/tests/lleventdispatcher_test.cpp
+++ b/indra/llcommon/tests/lleventdispatcher_test.cpp
@@ -345,7 +345,7 @@ namespace tut
lleventdispatcher_data():
work("test dispatcher", "op"),
// map {d=double, array=[3 elements]}
- required(LLSDMap("d", LLSD::Real(0))("array", LLSDArray(LLSD())(LLSD())(LLSD()))),
+ required(LLSDMap("d", LLSD::Real(0))("array", llsd::array(LLSD(), LLSD(), LLSD()))),
// first several params are required, last couple optional
partial_offset(3)
{
@@ -434,8 +434,8 @@ namespace tut
// freena(), methodna(), cmethodna(), smethodna() all take same param list.
// Same for freenb() et al.
- params = LLSDMap("a", LLSDArray("b")("i")("f")("d")("cp"))
- ("b", LLSDArray("s")("uuid")("date")("uri")("bin"));
+ params = LLSDMap("a", llsd::array("b", "i", "f", "d", "cp"))
+ ("b", llsd::array("s", "uuid", "date", "uri", "bin"));
debug("params:\n",
params, "\n"
"params[\"a\"]:\n",
@@ -452,12 +452,12 @@ namespace tut
// LLDate values are, as long as they're different from the
// LLUUID() and LLDate() default values so inspect() will report
// them.
- dft_array_full = LLSDMap("a", LLSDArray(true)(17)(3.14)(123456.78)("classic"))
- ("b", LLSDArray("string")
- (LLUUID::generateNewID())
- (LLDate::now())
- (LLURI("http://www.ietf.org/rfc/rfc3986.txt"))
- (binary));
+ dft_array_full = LLSDMap("a", llsd::array(true, 17, 3.14, 123456.78, "classic"))
+ ("b", llsd::array("string",
+ LLUUID::generateNewID(),
+ LLDate::now(),
+ LLURI("http://www.ietf.org/rfc/rfc3986.txt"),
+ binary));
debug("dft_array_full:\n",
dft_array_full);
// Partial defaults arrays.
@@ -723,7 +723,7 @@ namespace tut
{
set_test_name("map-style registration with non-array params");
// Pass "param names" as scalar or as map
- LLSD attempts(LLSDArray(17)(LLSDMap("pi", 3.14)("two", 2)));
+ LLSD attempts(llsd::array(17, LLSDMap("pi", 3.14)("two", 2)));
foreach(LLSD ae, inArray(attempts))
{
std::string threw = catch_what<std::exception>([this, &ae](){
@@ -738,7 +738,7 @@ namespace tut
{
set_test_name("map-style registration with badly-formed defaults");
std::string threw = catch_what<std::exception>([this](){
- work.add("freena_err", "freena", freena, LLSDArray("a")("b"), 17);
+ work.add("freena_err", "freena", freena, llsd::array("a", "b"), 17);
});
ensure_has(threw, "must be a map or an array");
}
@@ -749,8 +749,8 @@ namespace tut
set_test_name("map-style registration with too many array defaults");
std::string threw = catch_what<std::exception>([this](){
work.add("freena_err", "freena", freena,
- LLSDArray("a")("b"),
- LLSDArray(17)(0.9)("gack"));
+ llsd::array("a", "b"),
+ llsd::array(17, 0.9, "gack"));
});
ensure_has(threw, "shorter than");
}
@@ -761,7 +761,7 @@ namespace tut
set_test_name("map-style registration with too many map defaults");
std::string threw = catch_what<std::exception>([this](){
work.add("freena_err", "freena", freena,
- LLSDArray("a")("b"),
+ llsd::array("a", "b"),
LLSDMap("b", 17)("foo", 3.14)("bar", "sinister"));
});
ensure_has(threw, "nonexistent params");
@@ -798,7 +798,7 @@ namespace tut
void object::test<8>()
{
set_test_name("query Callables with/out required params");
- LLSD names(LLSDArray("free1")("Dmethod1")("Dcmethod1")("method1"));
+ LLSD names(llsd::array("free1", "Dmethod1", "Dcmethod1", "method1"));
foreach(LLSD nm, inArray(names))
{
LLSD metadata(getMetadata(nm));
@@ -821,13 +821,13 @@ namespace tut
{
set_test_name("query array-style functions/methods");
// Associate each registered name with expected arity.
- LLSD expected(LLSDArray
- (LLSDArray
- (0)(LLSDArray("free0_array")("smethod0_array")("method0_array")))
- (LLSDArray
- (5)(LLSDArray("freena_array")("smethodna_array")("methodna_array")))
- (LLSDArray
- (5)(LLSDArray("freenb_array")("smethodnb_array")("methodnb_array"))));
+ LLSD expected(llsd::array
+ (llsd::array
+ (0, llsd::array("free0_array", "smethod0_array", "method0_array")),
+ llsd::array
+ (5, llsd::array("freena_array", "smethodna_array", "methodna_array")),
+ llsd::array
+ (5, llsd::array("freenb_array", "smethodnb_array", "methodnb_array"))));
foreach(LLSD ae, inArray(expected))
{
LLSD::Integer arity(ae[0].asInteger());
@@ -853,7 +853,7 @@ namespace tut
set_test_name("query map-style no-params functions/methods");
// - (Free function | non-static method), map style, no params (ergo
// no defaults)
- LLSD names(LLSDArray("free0_map")("smethod0_map")("method0_map"));
+ LLSD names(llsd::array("free0_map", "smethod0_map", "method0_map"));
foreach(LLSD nm, inArray(names))
{
LLSD metadata(getMetadata(nm));
@@ -877,13 +877,13 @@ namespace tut
// there should (!) be no difference beween array defaults and map
// defaults. Verify, so we can ignore the distinction for all other
// tests.
- LLSD equivalences(LLSDArray
- (LLSDArray("freena_map_adft")("freena_map_mdft"))
- (LLSDArray("freenb_map_adft")("freenb_map_mdft"))
- (LLSDArray("smethodna_map_adft")("smethodna_map_mdft"))
- (LLSDArray("smethodnb_map_adft")("smethodnb_map_mdft"))
- (LLSDArray("methodna_map_adft")("methodna_map_mdft"))
- (LLSDArray("methodnb_map_adft")("methodnb_map_mdft")));
+ LLSD equivalences(llsd::array
+ (llsd::array("freena_map_adft", "freena_map_mdft"),
+ llsd::array("freenb_map_adft", "freenb_map_mdft"),
+ llsd::array("smethodna_map_adft", "smethodna_map_mdft"),
+ llsd::array("smethodnb_map_adft", "smethodnb_map_mdft"),
+ llsd::array("methodna_map_adft", "methodna_map_mdft"),
+ llsd::array("methodnb_map_adft", "methodnb_map_mdft")));
foreach(LLSD eq, inArray(equivalences))
{
LLSD adft(eq[0]);
@@ -953,42 +953,42 @@ namespace tut
debug("skipreq:\n",
skipreq);
- LLSD groups(LLSDArray // array of groups
+ LLSD groups(llsd::array // array of groups
- (LLSDArray // group
- (LLSDArray("freena_map_allreq")("smethodna_map_allreq")("methodna_map_allreq"))
- (LLSDArray(allreq["a"])(LLSD()))) // required, optional
+ (llsd::array // group
+ (llsd::array("freena_map_allreq", "smethodna_map_allreq", "methodna_map_allreq"),
+ llsd::array(allreq["a"], LLSD())), // required, optional
- (LLSDArray // group
- (LLSDArray("freenb_map_allreq")("smethodnb_map_allreq")("methodnb_map_allreq"))
- (LLSDArray(allreq["b"])(LLSD()))) // required, optional
+ llsd::array // group
+ (llsd::array("freenb_map_allreq", "smethodnb_map_allreq", "methodnb_map_allreq"),
+ llsd::array(allreq["b"], LLSD())), // required, optional
- (LLSDArray // group
- (LLSDArray("freena_map_leftreq")("smethodna_map_leftreq")("methodna_map_leftreq"))
- (LLSDArray(leftreq["a"])(rightdft["a"]))) // required, optional
+ llsd::array // group
+ (llsd::array("freena_map_leftreq", "smethodna_map_leftreq", "methodna_map_leftreq"),
+ llsd::array(leftreq["a"], rightdft["a"])), // required, optional
- (LLSDArray // group
- (LLSDArray("freenb_map_leftreq")("smethodnb_map_leftreq")("methodnb_map_leftreq"))
- (LLSDArray(leftreq["b"])(rightdft["b"]))) // required, optional
+ llsd::array // group
+ (llsd::array("freenb_map_leftreq", "smethodnb_map_leftreq", "methodnb_map_leftreq"),
+ llsd::array(leftreq["b"], rightdft["b"])), // required, optional
- (LLSDArray // group
- (LLSDArray("freena_map_skipreq")("smethodna_map_skipreq")("methodna_map_skipreq"))
- (LLSDArray(skipreq["a"])(dft_map_partial["a"]))) // required, optional
+ llsd::array // group
+ (llsd::array("freena_map_skipreq", "smethodna_map_skipreq", "methodna_map_skipreq"),
+ llsd::array(skipreq["a"], dft_map_partial["a"])), // required, optional
- (LLSDArray // group
- (LLSDArray("freenb_map_skipreq")("smethodnb_map_skipreq")("methodnb_map_skipreq"))
- (LLSDArray(skipreq["b"])(dft_map_partial["b"]))) // required, optional
+ llsd::array // group
+ (llsd::array("freenb_map_skipreq", "smethodnb_map_skipreq", "methodnb_map_skipreq"),
+ llsd::array(skipreq["b"], dft_map_partial["b"])), // required, optional
- // We only need mention the full-map-defaults ("_mdft" suffix)
- // registrations, having established their equivalence with the
- // full-array-defaults ("_adft" suffix) registrations in another test.
- (LLSDArray // group
- (LLSDArray("freena_map_mdft")("smethodna_map_mdft")("methodna_map_mdft"))
- (LLSDArray(LLSD::emptyMap())(dft_map_full["a"]))) // required, optional
+ // We only need mention the full-map-defaults ("_mdft" suffix)
+ // registrations, having established their equivalence with the
+ // full-array-defaults ("_adft" suffix) registrations in another test.
+ llsd::array // group
+ (llsd::array("freena_map_mdft", "smethodna_map_mdft", "methodna_map_mdft"),
+ llsd::array(LLSD::emptyMap(), dft_map_full["a"])), // required, optional
- (LLSDArray // group
- (LLSDArray("freenb_map_mdft")("smethodnb_map_mdft")("methodnb_map_mdft"))
- (LLSDArray(LLSD::emptyMap())(dft_map_full["b"])))); // required, optional
+ llsd::array // group
+ (llsd::array("freenb_map_mdft", "smethodnb_map_mdft", "methodnb_map_mdft"),
+ llsd::array(LLSD::emptyMap(), dft_map_full["b"])))); // required, optional
foreach(LLSD grp, inArray(groups))
{
@@ -1077,7 +1077,7 @@ namespace tut
// with 'required'.
LLSD answer(42);
// LLSD value matching 'required' according to llsd_matches() rules.
- LLSD matching(LLSDMap("d", 3.14)("array", LLSDArray("answer")(true)(answer)));
+ LLSD matching(LLSDMap("d", 3.14)("array", llsd::array("answer", true, answer)));
// Okay, walk through 'tests'.
foreach(const CallablesTriple& tr, tests)
{
@@ -1114,17 +1114,17 @@ namespace tut
call_exc("free0_map", 17, map_exc);
// Passing an array to a map-style function works now! No longer an
// error case!
-// call_exc("free0_map", LLSDArray("a")("b"), map_exc);
+// call_exc("free0_map", llsd::array("a", "b"), map_exc);
}
template<> template<>
void object::test<18>()
{
set_test_name("call no-args functions");
- LLSD names(LLSDArray
- ("free0_array")("free0_map")
- ("smethod0_array")("smethod0_map")
- ("method0_array")("method0_map"));
+ LLSD names(llsd::array
+ ("free0_array", "free0_map",
+ "smethod0_array", "smethod0_map",
+ "method0_array", "method0_map"));
foreach(LLSD name, inArray(names))
{
// Look up the Vars instance for this function.
@@ -1142,10 +1142,10 @@ namespace tut
}
// Break out this data because we use it in a couple different tests.
- LLSD array_funcs(LLSDArray
- (LLSDMap("a", "freena_array") ("b", "freenb_array"))
- (LLSDMap("a", "smethodna_array")("b", "smethodnb_array"))
- (LLSDMap("a", "methodna_array") ("b", "methodnb_array")));
+ LLSD array_funcs(llsd::array
+ (LLSDMap("a", "freena_array") ("b", "freenb_array"),
+ LLSDMap("a", "smethodna_array")("b", "smethodnb_array"),
+ LLSDMap("a", "methodna_array") ("b", "methodnb_array")));
template<> template<>
void object::test<19>()
@@ -1153,7 +1153,7 @@ namespace tut
set_test_name("call array-style functions with too-short arrays");
// Could have two different too-short arrays, one for *na and one for
// *nb, but since they both take 5 params...
- LLSD tooshort(LLSDArray("this")("array")("too")("short"));
+ LLSD tooshort(llsd::array("this", "array", "too", "short"));
foreach(const LLSD& funcsab, inArray(array_funcs))
{
foreach(const llsd::MapEntry& e, inMap(funcsab))
@@ -1172,12 +1172,12 @@ namespace tut
{
binary.push_back((U8)h);
}
- LLSD args(LLSDMap("a", LLSDArray(true)(17)(3.14)(123.456)("char*"))
- ("b", LLSDArray("string")
- (LLUUID("01234567-89ab-cdef-0123-456789abcdef"))
- (LLDate("2011-02-03T15:07:00Z"))
- (LLURI("http://secondlife.com"))
- (binary)));
+ LLSD args(LLSDMap("a", llsd::array(true, 17, 3.14, 123.456, "char*"))
+ ("b", llsd::array("string",
+ LLUUID("01234567-89ab-cdef-0123-456789abcdef"),
+ LLDate("2011-02-03T15:07:00Z"),
+ LLURI("http://secondlife.com"),
+ binary)));
LLSD argsplus(args);
argsplus["a"].append("bogus");
argsplus["b"].append("bogus");
@@ -1191,7 +1191,7 @@ namespace tut
debug("expect: ", expect);
// Use substantially the same logic for args and argsplus
- LLSD argsarrays(LLSDArray(args)(argsplus));
+ LLSD argsarrays(llsd::array(args, argsplus));
// So i==0 selects 'args', i==1 selects argsplus
for (LLSD::Integer i(0), iend(argsarrays.size()); i < iend; ++i)
{
@@ -1236,8 +1236,8 @@ namespace tut
set_test_name("call map-style functions with (full | oversized) (arrays | maps)");
const char binary[] = "\x99\x88\x77\x66\x55";
LLSD array_full(LLSDMap
- ("a", LLSDArray(false)(255)(98.6)(1024.5)("pointer"))
- ("b", LLSDArray("object")(LLUUID::generateNewID())(LLDate::now())(LLURI("http://wiki.lindenlab.com/wiki"))(LLSD::Binary(boost::begin(binary), boost::end(binary)))));
+ ("a", llsd::array(false, 255, 98.6, 1024.5, "pointer"))
+ ("b", llsd::array("object", LLUUID::generateNewID(), LLDate::now(), LLURI("http://wiki.lindenlab.com/wiki"), LLSD::Binary(boost::begin(binary), boost::end(binary)))));
LLSD array_overfull(array_full);
foreach(LLSD::String a, ab)
{
@@ -1280,20 +1280,20 @@ namespace tut
// parameter defaults should make NO DIFFERENCE WHATSOEVER. Every call
// should pass all params.
LLSD names(LLSDMap
- ("a", LLSDArray
- ("freena_map_allreq") ("smethodna_map_allreq") ("methodna_map_allreq")
- ("freena_map_leftreq")("smethodna_map_leftreq")("methodna_map_leftreq")
- ("freena_map_skipreq")("smethodna_map_skipreq")("methodna_map_skipreq")
- ("freena_map_adft") ("smethodna_map_adft") ("methodna_map_adft")
- ("freena_map_mdft") ("smethodna_map_mdft") ("methodna_map_mdft"))
- ("b", LLSDArray
- ("freenb_map_allreq") ("smethodnb_map_allreq") ("methodnb_map_allreq")
- ("freenb_map_leftreq")("smethodnb_map_leftreq")("methodnb_map_leftreq")
- ("freenb_map_skipreq")("smethodnb_map_skipreq")("methodnb_map_skipreq")
- ("freenb_map_adft") ("smethodnb_map_adft") ("methodnb_map_adft")
- ("freenb_map_mdft") ("smethodnb_map_mdft") ("methodnb_map_mdft")));
+ ("a", llsd::array
+ ("freena_map_allreq", "smethodna_map_allreq", "methodna_map_allreq",
+ "freena_map_leftreq", "smethodna_map_leftreq", "methodna_map_leftreq",
+ "freena_map_skipreq", "smethodna_map_skipreq", "methodna_map_skipreq",
+ "freena_map_adft", "smethodna_map_adft", "methodna_map_adft",
+ "freena_map_mdft", "smethodna_map_mdft", "methodna_map_mdft"))
+ ("b", llsd::array
+ ("freenb_map_allreq", "smethodnb_map_allreq", "methodnb_map_allreq",
+ "freenb_map_leftreq", "smethodnb_map_leftreq", "methodnb_map_leftreq",
+ "freenb_map_skipreq", "smethodnb_map_skipreq", "methodnb_map_skipreq",
+ "freenb_map_adft", "smethodnb_map_adft", "methodnb_map_adft",
+ "freenb_map_mdft", "smethodnb_map_mdft", "methodnb_map_mdft")));
// Treat (full | overfull) (array | map) the same.
- LLSD argssets(LLSDArray(array_full)(array_overfull)(map_full)(map_overfull));
+ LLSD argssets(llsd::array(array_full, array_overfull, map_full, map_overfull));
foreach(const LLSD& args, inArray(argssets))
{
foreach(LLSD::String a, ab)
diff --git a/indra/llcommon/tests/llprocess_test.cpp b/indra/llcommon/tests/llprocess_test.cpp
index 999d432079..81449b4a42 100644
--- a/indra/llcommon/tests/llprocess_test.cpp
+++ b/indra/llcommon/tests/llprocess_test.cpp
@@ -356,7 +356,7 @@ namespace tut
// Create a script file in a temporary place.
NamedTempFile script("py",
- "from __future__ import print_function" EOL
+ "from __future__ import print_function" EOL
"import sys" EOL
"import time" EOL
EOL
@@ -366,7 +366,7 @@ namespace tut
"time.sleep(2)" EOL
"print('stderr after wait',file=sys.stderr)" EOL
"sys.stderr.flush()" EOL
- );
+ );
// Arrange to track the history of our interaction with child: what we
// fetched, which pipe it came from, how many tries it took before we
@@ -862,8 +862,8 @@ namespace tut
set_test_name("'bogus' test");
CaptureLog recorder;
PythonProcessLauncher py(get_test_name(),
- "from __future__ import print_function\n"
- "print('Hello world')\n");
+ "from __future__ import print_function\n"
+ "print('Hello world')\n");
py.mParams.files.add(LLProcess::FileParam("bogus"));
py.mPy = LLProcess::create(py.mParams);
ensure("should have rejected 'bogus'", ! py.mPy);
@@ -878,8 +878,8 @@ namespace tut
// Replace this test with one or more real 'file' tests when we
// implement 'file' support
PythonProcessLauncher py(get_test_name(),
- "from __future__ import print_function\n"
- "print('Hello world')\n");
+ "from __future__ import print_function\n"
+ "print('Hello world')\n");
py.mParams.files.add(LLProcess::FileParam());
py.mParams.files.add(LLProcess::FileParam("file"));
py.mPy = LLProcess::create(py.mParams);
@@ -894,8 +894,8 @@ namespace tut
// implement 'tpipe' support
CaptureLog recorder;
PythonProcessLauncher py(get_test_name(),
- "from __future__ import print_function\n"
- "print('Hello world')\n");
+ "from __future__ import print_function\n"
+ "print('Hello world')\n");
py.mParams.files.add(LLProcess::FileParam());
py.mParams.files.add(LLProcess::FileParam("tpipe"));
py.mPy = LLProcess::create(py.mParams);
@@ -912,8 +912,8 @@ namespace tut
// implement 'npipe' support
CaptureLog recorder;
PythonProcessLauncher py(get_test_name(),
- "from __future__ import print_function\n"
- "print('Hello world')\n");
+ "from __future__ import print_function\n"
+ "print('Hello world')\n");
py.mParams.files.add(LLProcess::FileParam());
py.mParams.files.add(LLProcess::FileParam());
py.mParams.files.add(LLProcess::FileParam("npipe"));
@@ -989,20 +989,20 @@ namespace tut
{
set_test_name("get*Pipe() validation");
PythonProcessLauncher py(get_test_name(),
- "from __future__ import print_function\n"
- "print('this output is expected')\n");
+ "from __future__ import print_function\n"
+ "print('this output is expected')\n");
py.mParams.files.add(LLProcess::FileParam("pipe")); // pipe for stdin
py.mParams.files.add(LLProcess::FileParam()); // inherit stdout
py.mParams.files.add(LLProcess::FileParam("pipe")); // pipe for stderr
py.run();
TEST_getPipe(*py.mPy, getWritePipe, getOptWritePipe,
- LLProcess::STDIN, // VALID
- LLProcess::STDOUT, // NOPIPE
- LLProcess::STDERR); // BADPIPE
+ LLProcess::STDIN, // VALID
+ LLProcess::STDOUT, // NOPIPE
+ LLProcess::STDERR); // BADPIPE
TEST_getPipe(*py.mPy, getReadPipe, getOptReadPipe,
- LLProcess::STDERR, // VALID
- LLProcess::STDOUT, // NOPIPE
- LLProcess::STDIN); // BADPIPE
+ LLProcess::STDERR, // VALID
+ LLProcess::STDOUT, // NOPIPE
+ LLProcess::STDIN); // BADPIPE
}
template<> template<>
@@ -1129,8 +1129,8 @@ namespace tut
{
set_test_name("ReadPipe \"eof\" event");
PythonProcessLauncher py(get_test_name(),
- "from __future__ import print_function\n"
- "print('Hello from Python!')\n");
+ "from __future__ import print_function\n"
+ "print('Hello from Python!')\n");
py.mParams.files.add(LLProcess::FileParam()); // stdin
py.mParams.files.add(LLProcess::FileParam("pipe")); // stdout
py.launch();
diff --git a/indra/llcommon/tests/llsdserialize_test.cpp b/indra/llcommon/tests/llsdserialize_test.cpp
index 618f33cc13..acb2953b5b 100644
--- a/indra/llcommon/tests/llsdserialize_test.cpp
+++ b/indra/llcommon/tests/llsdserialize_test.cpp
@@ -1922,10 +1922,10 @@ namespace tut
static void toPythonUsing(const std::string& desc,
const FormatterFunction& serialize)
{
- LLSD cdata(LLSDArray(17)(3.14)
- ("This string\n"
- "has several\n"
- "lines."));
+ LLSD cdata(llsd::array(17, 3.14,
+ "This string\n"
+ "has several\n"
+ "lines."));
const char pydata[] =
"def verify(iterable):\n"