summaryrefslogtreecommitdiff
path: root/indra/llcommon
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llcommon')
-rw-r--r--indra/llcommon/CMakeLists.txt1
-rw-r--r--indra/llcommon/llfasttimer_class.cpp4
-rw-r--r--indra/llcommon/llsdserialize.cpp74
-rw-r--r--indra/llcommon/llstring.cpp2
-rw-r--r--indra/llcommon/llstring.h2
-rw-r--r--indra/llcommon/llversionviewer.h2
-rw-r--r--indra/llcommon/stdenums.h4
-rw-r--r--indra/llcommon/tests/bitpack_test.cpp2
-rw-r--r--indra/llcommon/tests/commonmisc_test.cpp6
-rw-r--r--indra/llcommon/tests/llbase64_test.cpp2
-rw-r--r--indra/llcommon/tests/lldate_test.cpp2
-rw-r--r--indra/llcommon/tests/lldependencies_test.cpp2
-rw-r--r--indra/llcommon/tests/llframetimer_test.cpp2
-rw-r--r--indra/llcommon/tests/llprocessor_test.cpp2
-rw-r--r--indra/llcommon/tests/llrand_test.cpp2
-rw-r--r--indra/llcommon/tests/llsdserialize_test.cpp2
-rw-r--r--indra/llcommon/tests/llstring_test.cpp2
-rw-r--r--indra/llcommon/tests/lltreeiterators_test.cpp2
-rw-r--r--indra/llcommon/tests/stringize_test.cpp2
19 files changed, 81 insertions, 36 deletions
diff --git a/indra/llcommon/CMakeLists.txt b/indra/llcommon/CMakeLists.txt
index 2a036df06e..858e483036 100644
--- a/indra/llcommon/CMakeLists.txt
+++ b/indra/llcommon/CMakeLists.txt
@@ -157,6 +157,7 @@ set(llcommon_HEADER_FILES
lleventemitter.h
llextendedstatus.h
llfasttimer.h
+ llfasttimer_class.h
llfile.h
llfindlocale.h
llfixedbuffer.h
diff --git a/indra/llcommon/llfasttimer_class.cpp b/indra/llcommon/llfasttimer_class.cpp
index dfbae09864..e9ac709254 100644
--- a/indra/llcommon/llfasttimer_class.cpp
+++ b/indra/llcommon/llfasttimer_class.cpp
@@ -474,9 +474,9 @@ void LLFastTimer::NamedTimer::accumulateTimings()
int hidx = cur_frame % HISTORY_NUM;
timerp->mCountHistory[hidx] = timerp->mTotalTimeCounter;
- timerp->mCountAverage = (timerp->mCountAverage * cur_frame + timerp->mTotalTimeCounter) / (cur_frame+1);
+ timerp->mCountAverage = ((U64)timerp->mCountAverage * cur_frame + timerp->mTotalTimeCounter) / (cur_frame+1);
timerp->mCallHistory[hidx] = timerp->getFrameState().mCalls;
- timerp->mCallAverage = (timerp->mCallAverage * cur_frame + timerp->getFrameState().mCalls) / (cur_frame+1);
+ timerp->mCallAverage = ((U64)timerp->mCallAverage * cur_frame + timerp->getFrameState().mCalls) / (cur_frame+1);
}
}
}
diff --git a/indra/llcommon/llsdserialize.cpp b/indra/llcommon/llsdserialize.cpp
index fdeb93e27f..fe7072d01a 100644
--- a/indra/llcommon/llsdserialize.cpp
+++ b/indra/llcommon/llsdserialize.cpp
@@ -78,7 +78,7 @@ void LLSDSerialize::serialize(const LLSD& sd, std::ostream& str, ELLSD_Serialize
break;
default:
- llwarns << "serialize request for unkown ELLSD_Serialize" << llendl;
+ llwarns << "serialize request for unknown ELLSD_Serialize" << llendl;
}
if (f.notNull())
@@ -1999,7 +1999,9 @@ std::string zip_llsd(LLSD& data)
{
std::stringstream llsd_strm;
- LLSDSerialize::serialize(data, llsd_strm, LLSDSerialize::LLSD_BINARY);
+ LLSDSerialize::toBinary(data, llsd_strm);
+
+ const U32 CHUNK = 65536;
z_stream strm;
strm.zalloc = Z_NULL;
@@ -2015,24 +2017,57 @@ std::string zip_llsd(LLSD& data)
std::string source = llsd_strm.str();
+ U8 out[CHUNK];
+
strm.avail_in = source.size();
strm.next_in = (U8*) source.data();
- U8* output = new U8[strm.avail_in];
- strm.avail_out = strm.avail_in;
- strm.next_out = output;
- ret = deflate(&strm, Z_FINISH);
- if (ret != Z_STREAM_END)
+ U8* output = NULL;
+
+ U32 cur_size = 0;
+
+ U32 have = 0;
+
+ do
{
- delete [] output;
- llwarns << "Failed to compress LLSD block." << llendl;
- return std::string();
+ strm.avail_out = CHUNK;
+ strm.next_out = out;
+
+ ret = deflate(&strm, Z_FINISH);
+ if (ret == Z_OK || ret == Z_STREAM_END)
+ { //copy result into output
+ if (strm.avail_out >= CHUNK)
+ {
+ llerrs << "WTF?" << llendl;
+ }
+
+ have = CHUNK-strm.avail_out;
+ output = (U8*) realloc(output, cur_size+have);
+ memcpy(output+cur_size, out, have);
+ cur_size += have;
+ }
+ else
+ {
+ free(output);
+ llwarns << "Failed to compress LLSD block." << llendl;
+ return std::string();
+ }
}
+ while (ret == Z_OK);
- std::string::size_type size = source.size()-strm.avail_out;
+ std::string::size_type size = cur_size;
std::string result((char*) output, size);
deflateEnd(&strm);
- delete [] output;
+ free(output);
+
+#if 0 //verify results work with unzip_llsd
+ std::istringstream test(result);
+ LLSD test_sd;
+ if (!unzip_llsd(test_sd, test, result.size()))
+ {
+ llerrs << "Invalid compression result!" << llendl;
+ }
+#endif
return result;
}
@@ -2098,7 +2133,7 @@ bool unzip_llsd(LLSD& data, std::istream& is, S32 size)
memcpy(result+cur_size, out, have);
cur_size += have;
- } while (strm.avail_out == 0);
+ } while (ret == Z_OK);
inflateEnd(&strm);
delete [] in;
@@ -2112,9 +2147,18 @@ bool unzip_llsd(LLSD& data, std::istream& is, S32 size)
//result now points to the decompressed LLSD block
{
std::string res_str((char*) result, cur_size);
- std::istringstream istr(res_str);
- if (!LLSDSerialize::deserialize(data, istr, cur_size))
+ std::string deprecated_header("<? LLSD/Binary ?>");
+
+ if (res_str.substr(0, deprecated_header.size()) == deprecated_header)
+ {
+ res_str = res_str.substr(deprecated_header.size()+1, cur_size);
+ }
+ cur_size = res_str.size();
+
+ std::istringstream istr(res_str);
+
+ if (!LLSDSerialize::fromBinary(data, istr, cur_size))
{
llwarns << "Failed to unzip LLSD block" << llendl;
free(result);
diff --git a/indra/llcommon/llstring.cpp b/indra/llcommon/llstring.cpp
index faf7aa51f1..d99e7afc67 100644
--- a/indra/llcommon/llstring.cpp
+++ b/indra/llcommon/llstring.cpp
@@ -1118,7 +1118,7 @@ bool LLStringUtil::formatDatetime(std::string& replacement, std::string token,
else if(LLStringOps::sMonthList.size() == 12 && code == "%B")
{
struct tm * gmt = gmtime (&loc_seconds);
- replacement = LLStringOps::sWeekDayList[gmt->tm_mon];
+ replacement = LLStringOps::sMonthList[gmt->tm_mon];
}
else if( !LLStringOps::sDayFormat.empty() && code == "%d" )
{
diff --git a/indra/llcommon/llstring.h b/indra/llcommon/llstring.h
index 41fac0f8cc..80115085c2 100644
--- a/indra/llcommon/llstring.h
+++ b/indra/llcommon/llstring.h
@@ -441,7 +441,7 @@ LL_COMMON_API bool iswindividual(llwchar elem);
*/
// Make the incoming string a utf8 string. Replaces any unknown glyph
-// with the UNKOWN_CHARACTER. Once any unknown glph is found, the rest
+// with the UNKNOWN_CHARACTER. Once any unknown glyph is found, the rest
// of the data may not be recovered.
LL_COMMON_API std::string rawstr_to_utf8(const std::string& raw);
diff --git a/indra/llcommon/llversionviewer.h b/indra/llcommon/llversionviewer.h
index c430a60ff0..7b842b8483 100644
--- a/indra/llcommon/llversionviewer.h
+++ b/indra/llcommon/llversionviewer.h
@@ -34,7 +34,7 @@
#define LL_LLVERSIONVIEWER_H
const S32 LL_VERSION_MAJOR = 2;
-const S32 LL_VERSION_MINOR = 1;
+const S32 LL_VERSION_MINOR = 2;
const S32 LL_VERSION_PATCH = 1;
const S32 LL_VERSION_BUILD = 0;
diff --git a/indra/llcommon/stdenums.h b/indra/llcommon/stdenums.h
index 6eead924da..e4eb53a56f 100644
--- a/indra/llcommon/stdenums.h
+++ b/indra/llcommon/stdenums.h
@@ -120,8 +120,8 @@ enum EObjectPropertiesExtraID
enum EAddPosition
{
ADD_TOP,
- ADD_SORTED,
- ADD_BOTTOM
+ ADD_BOTTOM,
+ ADD_DEFAULT
};
enum LLGroupChange
diff --git a/indra/llcommon/tests/bitpack_test.cpp b/indra/llcommon/tests/bitpack_test.cpp
index 09fd037f02..9f1423f5a7 100644
--- a/indra/llcommon/tests/bitpack_test.cpp
+++ b/indra/llcommon/tests/bitpack_test.cpp
@@ -46,7 +46,7 @@ namespace tut
};
typedef test_group<bit_pack> bit_pack_t;
typedef bit_pack_t::object bit_pack_object_t;
- tut::bit_pack_t tut_bit_pack("bitpack");
+ tut::bit_pack_t tut_bit_pack("LLBitPack");
// pack -> unpack
template<> template<>
diff --git a/indra/llcommon/tests/commonmisc_test.cpp b/indra/llcommon/tests/commonmisc_test.cpp
index ca27fe9b23..0b89d99f16 100644
--- a/indra/llcommon/tests/commonmisc_test.cpp
+++ b/indra/llcommon/tests/commonmisc_test.cpp
@@ -65,7 +65,7 @@ namespace tut
};
typedef test_group<sd_data> sd_test;
typedef sd_test::object sd_object;
- tut::sd_test sd("llsd");
+ tut::sd_test sd("LLSD");
template<> template<>
void sd_object::test<1>()
@@ -456,7 +456,7 @@ namespace tut
};
typedef test_group<mem_data> mem_test;
typedef mem_test::object mem_object;
- tut::mem_test mem_stream("memory_stream");
+ tut::mem_test mem_stream("LLMemoryStream");
template<> template<>
void mem_object::test<1>()
@@ -649,7 +649,7 @@ namespace tut
};
typedef test_group<hash_data> hash_test;
typedef hash_test::object hash_object;
- tut::hash_test hash_tester("hash_test");
+ tut::hash_test hash_tester("LLHash");
template<> template<>
void hash_object::test<1>()
diff --git a/indra/llcommon/tests/llbase64_test.cpp b/indra/llcommon/tests/llbase64_test.cpp
index 6009788b22..b19a811c0e 100644
--- a/indra/llcommon/tests/llbase64_test.cpp
+++ b/indra/llcommon/tests/llbase64_test.cpp
@@ -47,7 +47,7 @@ namespace tut
};
typedef test_group<base64_data> base64_test;
typedef base64_test::object base64_object;
- tut::base64_test base64("base64");
+ tut::base64_test base64("LLBase64");
template<> template<>
void base64_object::test<1>()
diff --git a/indra/llcommon/tests/lldate_test.cpp b/indra/llcommon/tests/lldate_test.cpp
index c31259227a..4d978af25b 100644
--- a/indra/llcommon/tests/lldate_test.cpp
+++ b/indra/llcommon/tests/lldate_test.cpp
@@ -77,7 +77,7 @@ namespace tut
};
typedef test_group<date_test> date_test_t;
typedef date_test_t::object date_test_object_t;
- tut::date_test_t tut_date_test("date_test");
+ tut::date_test_t tut_date_test("LLDate");
/* format validation */
template<> template<>
diff --git a/indra/llcommon/tests/lldependencies_test.cpp b/indra/llcommon/tests/lldependencies_test.cpp
index f3c25de8b5..5c6126a472 100644
--- a/indra/llcommon/tests/lldependencies_test.cpp
+++ b/indra/llcommon/tests/lldependencies_test.cpp
@@ -128,7 +128,7 @@ namespace tut
};
typedef test_group<deps_data> deps_group;
typedef deps_group::object deps_object;
- tut::deps_group depsgr("lldependencies");
+ tut::deps_group depsgr("LLDependencies");
template<> template<>
void deps_object::test<1>()
diff --git a/indra/llcommon/tests/llframetimer_test.cpp b/indra/llcommon/tests/llframetimer_test.cpp
index 1d047e41f8..5bc6b19967 100644
--- a/indra/llcommon/tests/llframetimer_test.cpp
+++ b/indra/llcommon/tests/llframetimer_test.cpp
@@ -49,7 +49,7 @@ namespace tut
};
typedef test_group<frametimer_test> frametimer_group_t;
typedef frametimer_group_t::object frametimer_object_t;
- tut::frametimer_group_t frametimer_instance("frametimer");
+ tut::frametimer_group_t frametimer_instance("LLFrameTimer");
template<> template<>
void frametimer_object_t::test<1>()
diff --git a/indra/llcommon/tests/llprocessor_test.cpp b/indra/llcommon/tests/llprocessor_test.cpp
index a9e312b70b..065f6e946e 100644
--- a/indra/llcommon/tests/llprocessor_test.cpp
+++ b/indra/llcommon/tests/llprocessor_test.cpp
@@ -44,7 +44,7 @@ namespace tut
typedef test_group<processor> processor_t;
typedef processor_t::object processor_object_t;
- tut::processor_t tut_processor("processor");
+ tut::processor_t tut_processor("LLProcessor");
template<> template<>
void processor_object_t::test<1>()
diff --git a/indra/llcommon/tests/llrand_test.cpp b/indra/llcommon/tests/llrand_test.cpp
index 1f178d6fc9..b58802a93c 100644
--- a/indra/llcommon/tests/llrand_test.cpp
+++ b/indra/llcommon/tests/llrand_test.cpp
@@ -45,7 +45,7 @@ namespace tut
typedef test_group<random> random_t;
typedef random_t::object random_object_t;
- tut::random_t tut_random("random");
+ tut::random_t tut_random("LLSeedRand");
template<> template<>
void random_object_t::test<1>()
diff --git a/indra/llcommon/tests/llsdserialize_test.cpp b/indra/llcommon/tests/llsdserialize_test.cpp
index 6ab48ec34a..b5d89ffd30 100644
--- a/indra/llcommon/tests/llsdserialize_test.cpp
+++ b/indra/llcommon/tests/llsdserialize_test.cpp
@@ -80,7 +80,7 @@ namespace tut
typedef test_group<sd_xml_data> sd_xml_test;
typedef sd_xml_test::object sd_xml_object;
- tut::sd_xml_test sd_xml_stream("sd_xml_serialization");
+ tut::sd_xml_test sd_xml_stream("LLSDXMLFormatter");
template<> template<>
void sd_xml_object::test<1>()
diff --git a/indra/llcommon/tests/llstring_test.cpp b/indra/llcommon/tests/llstring_test.cpp
index beba55416a..35f5a11394 100644
--- a/indra/llcommon/tests/llstring_test.cpp
+++ b/indra/llcommon/tests/llstring_test.cpp
@@ -44,7 +44,7 @@ namespace tut
};
typedef test_group<string_index> string_index_t;
typedef string_index_t::object string_index_object_t;
- tut::string_index_t tut_string_index("string_test");
+ tut::string_index_t tut_string_index("LLString");
template<> template<>
void string_index_object_t::test<1>()
diff --git a/indra/llcommon/tests/lltreeiterators_test.cpp b/indra/llcommon/tests/lltreeiterators_test.cpp
index 31c70b4daa..29efefa0c8 100644
--- a/indra/llcommon/tests/lltreeiterators_test.cpp
+++ b/indra/llcommon/tests/lltreeiterators_test.cpp
@@ -62,7 +62,7 @@ namespace tut
};
typedef test_group<iter_data> iter_group;
typedef iter_group::object iter_object;
- tut::iter_group ig("lltreeiterators");
+ tut::iter_group ig("LLTreeIterators");
} // namespace tut
/*****************************************************************************
diff --git a/indra/llcommon/tests/stringize_test.cpp b/indra/llcommon/tests/stringize_test.cpp
index dd69787a1c..6762afe393 100644
--- a/indra/llcommon/tests/stringize_test.cpp
+++ b/indra/llcommon/tests/stringize_test.cpp
@@ -86,7 +86,7 @@ namespace tut
};
typedef test_group<stringize_data> stringize_group;
typedef stringize_group::object stringize_object;
- tut::stringize_group strzgrp("stringize");
+ tut::stringize_group strzgrp("stringize_h");
template<> template<>
void stringize_object::test<1>()