aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llcommon
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/llcommon')
-rw-r--r--linden/indra/llcommon/CMakeLists.txt2
-rw-r--r--linden/indra/llcommon/bitpack.h3
-rw-r--r--linden/indra/llcommon/ctype_workaround.h3
-rw-r--r--linden/indra/llcommon/doublelinkedlist.h3
-rw-r--r--linden/indra/llcommon/imageids.h4
-rw-r--r--linden/indra/llcommon/indra_constants.h13
-rw-r--r--linden/indra/llcommon/is_approx_equal_fraction.h85
-rw-r--r--linden/indra/llcommon/linden_common.h3
-rw-r--r--linden/indra/llcommon/linked_lists.h3
-rw-r--r--linden/indra/llcommon/llagentconstants.h3
-rw-r--r--linden/indra/llcommon/llapp.cpp35
-rw-r--r--linden/indra/llcommon/llapp.h13
-rw-r--r--linden/indra/llcommon/llapr.cpp515
-rw-r--r--linden/indra/llcommon/llapr.h128
-rw-r--r--linden/indra/llcommon/llassettype.cpp3
-rw-r--r--linden/indra/llcommon/llassettype.h3
-rw-r--r--linden/indra/llcommon/llassoclist.h3
-rw-r--r--linden/indra/llcommon/llavatarconstants.h3
-rw-r--r--linden/indra/llcommon/llbase32.cpp11
-rw-r--r--linden/indra/llcommon/llbase32.h3
-rw-r--r--linden/indra/llcommon/llbase64.cpp3
-rw-r--r--linden/indra/llcommon/llbase64.h3
-rw-r--r--linden/indra/llcommon/llboost.h3
-rw-r--r--linden/indra/llcommon/llchat.h7
-rw-r--r--linden/indra/llcommon/llclickaction.h3
-rw-r--r--linden/indra/llcommon/llcommon.cpp3
-rw-r--r--linden/indra/llcommon/llcommon.h3
-rw-r--r--linden/indra/llcommon/llcrc.cpp7
-rw-r--r--linden/indra/llcommon/llcrc.h3
-rw-r--r--linden/indra/llcommon/llcriticaldamp.cpp3
-rw-r--r--linden/indra/llcommon/llcriticaldamp.h3
-rw-r--r--linden/indra/llcommon/llcursortypes.cpp90
-rw-r--r--linden/indra/llcommon/llcursortypes.h82
-rw-r--r--linden/indra/llcommon/lldarray.h3
-rw-r--r--linden/indra/llcommon/lldarrayptr.h3
-rw-r--r--linden/indra/llcommon/lldate.cpp20
-rw-r--r--linden/indra/llcommon/lldate.h41
-rw-r--r--linden/indra/llcommon/lldefs.h3
-rw-r--r--linden/indra/llcommon/lldepthstack.h3
-rw-r--r--linden/indra/llcommon/lldlinked.h3
-rw-r--r--linden/indra/llcommon/lldqueueptr.h3
-rw-r--r--linden/indra/llcommon/llendianswizzle.h3
-rw-r--r--linden/indra/llcommon/llenum.h3
-rw-r--r--linden/indra/llcommon/llerror.cpp191
-rw-r--r--linden/indra/llcommon/llerror.h39
-rw-r--r--linden/indra/llcommon/llerrorcontrol.h3
-rw-r--r--linden/indra/llcommon/llerrorlegacy.h4
-rw-r--r--linden/indra/llcommon/llerrorthread.cpp3
-rw-r--r--linden/indra/llcommon/llerrorthread.h3
-rw-r--r--linden/indra/llcommon/llevent.cpp3
-rw-r--r--linden/indra/llcommon/llevent.h3
-rw-r--r--linden/indra/llcommon/lleventemitter.h3
-rw-r--r--linden/indra/llcommon/llextendedstatus.h3
-rw-r--r--linden/indra/llcommon/llfasttimer.cpp5
-rw-r--r--linden/indra/llcommon/llfasttimer.h15
-rw-r--r--linden/indra/llcommon/llfile.cpp3
-rw-r--r--linden/indra/llcommon/llfile.h3
-rw-r--r--linden/indra/llcommon/llfindlocale.cpp9
-rw-r--r--linden/indra/llcommon/llfindlocale.h3
-rw-r--r--linden/indra/llcommon/llfixedbuffer.cpp10
-rw-r--r--linden/indra/llcommon/llfixedbuffer.h13
-rw-r--r--linden/indra/llcommon/llformat.cpp3
-rw-r--r--linden/indra/llcommon/llformat.h3
-rw-r--r--linden/indra/llcommon/llframetimer.cpp3
-rw-r--r--linden/indra/llcommon/llframetimer.h3
-rw-r--r--linden/indra/llcommon/llhash.h18
-rw-r--r--linden/indra/llcommon/llheartbeat.cpp3
-rw-r--r--linden/indra/llcommon/llheartbeat.h3
-rw-r--r--linden/indra/llcommon/llhttpstatuscodes.h3
-rw-r--r--linden/indra/llcommon/llindexedqueue.h3
-rw-r--r--linden/indra/llcommon/llindraconfigfile.cpp25
-rw-r--r--linden/indra/llcommon/llindraconfigfile.h25
-rw-r--r--linden/indra/llcommon/llkeythrottle.h3
-rw-r--r--linden/indra/llcommon/llkeyusetracker.h3
-rw-r--r--linden/indra/llcommon/lllinkedqueue.h3
-rw-r--r--linden/indra/llcommon/llliveappconfig.cpp3
-rw-r--r--linden/indra/llcommon/llliveappconfig.h3
-rw-r--r--linden/indra/llcommon/lllivefile.cpp3
-rw-r--r--linden/indra/llcommon/lllivefile.h3
-rw-r--r--linden/indra/llcommon/lllocalidhashmap.h3
-rw-r--r--linden/indra/llcommon/lllog.cpp15
-rw-r--r--linden/indra/llcommon/lllog.h7
-rw-r--r--linden/indra/llcommon/lllslconstants.h17
-rw-r--r--linden/indra/llcommon/llmap.h3
-rw-r--r--linden/indra/llcommon/llmd5.cpp3
-rw-r--r--linden/indra/llcommon/llmd5.h3
-rw-r--r--linden/indra/llcommon/llmemory.cpp33
-rw-r--r--linden/indra/llcommon/llmemory.h62
-rw-r--r--linden/indra/llcommon/llmemorystream.cpp3
-rw-r--r--linden/indra/llcommon/llmemorystream.h3
-rw-r--r--linden/indra/llcommon/llmemtype.h3
-rw-r--r--linden/indra/llcommon/llmetrics.cpp3
-rw-r--r--linden/indra/llcommon/llmetrics.h3
-rw-r--r--linden/indra/llcommon/llmortician.cpp3
-rw-r--r--linden/indra/llcommon/llmortician.h3
-rw-r--r--linden/indra/llcommon/llnametable.h3
-rw-r--r--linden/indra/llcommon/llpreprocessor.h14
-rw-r--r--linden/indra/llcommon/llpriqueuemap.h3
-rw-r--r--linden/indra/llcommon/llprocessor.cpp40
-rw-r--r--linden/indra/llcommon/llprocessor.h3
-rw-r--r--linden/indra/llcommon/llptrskiplist.h3
-rw-r--r--linden/indra/llcommon/llptrskipmap.h3
-rw-r--r--linden/indra/llcommon/llqueuedthread.cpp6
-rw-r--r--linden/indra/llcommon/llqueuedthread.h3
-rw-r--r--linden/indra/llcommon/llrand.cpp3
-rw-r--r--linden/indra/llcommon/llrand.h3
-rw-r--r--linden/indra/llcommon/llrun.cpp3
-rw-r--r--linden/indra/llcommon/llrun.h3
-rw-r--r--linden/indra/llcommon/llsd.cpp43
-rw-r--r--linden/indra/llcommon/llsd.h7
-rw-r--r--linden/indra/llcommon/llsdserialize.cpp3
-rw-r--r--linden/indra/llcommon/llsdserialize.h3
-rw-r--r--linden/indra/llcommon/llsdserialize_xml.cpp179
-rw-r--r--linden/indra/llcommon/llsdserialize_xml.h3
-rw-r--r--linden/indra/llcommon/llsdutil.cpp3
-rw-r--r--linden/indra/llcommon/llsdutil.h3
-rw-r--r--linden/indra/llcommon/llsecondlifeurls.cpp3
-rw-r--r--linden/indra/llcommon/llsecondlifeurls.h3
-rw-r--r--linden/indra/llcommon/llsimplehash.h3
-rw-r--r--linden/indra/llcommon/llskiplist.h3
-rw-r--r--linden/indra/llcommon/llskipmap.h3
-rw-r--r--linden/indra/llcommon/llsmoothstep.h3
-rw-r--r--linden/indra/llcommon/llstack.h3
-rw-r--r--linden/indra/llcommon/llstat.cpp3
-rw-r--r--linden/indra/llcommon/llstat.h3
-rw-r--r--linden/indra/llcommon/llstatenums.h3
-rw-r--r--linden/indra/llcommon/llstl.h3
-rw-r--r--linden/indra/llcommon/llstreamtools.cpp3
-rw-r--r--linden/indra/llcommon/llstreamtools.h3
-rw-r--r--linden/indra/llcommon/llstrider.h3
-rw-r--r--linden/indra/llcommon/llstring.cpp57
-rw-r--r--linden/indra/llcommon/llstring.h55
-rw-r--r--linden/indra/llcommon/llstringtable.cpp3
-rw-r--r--linden/indra/llcommon/llstringtable.h3
-rw-r--r--linden/indra/llcommon/llsys.cpp37
-rw-r--r--linden/indra/llcommon/llsys.h3
-rw-r--r--linden/indra/llcommon/llthread.cpp11
-rw-r--r--linden/indra/llcommon/llthread.h11
-rw-r--r--linden/indra/llcommon/lltimer.cpp11
-rw-r--r--linden/indra/llcommon/lltimer.h7
-rw-r--r--linden/indra/llcommon/lluri.cpp8
-rw-r--r--linden/indra/llcommon/lluri.h6
-rw-r--r--linden/indra/llcommon/lluuid.cpp25
-rw-r--r--linden/indra/llcommon/lluuid.h8
-rw-r--r--linden/indra/llcommon/lluuidhashmap.h3
-rw-r--r--linden/indra/llcommon/llversionserver.h9
-rw-r--r--linden/indra/llcommon/llversionviewer.h9
-rw-r--r--linden/indra/llcommon/llworkerthread.cpp21
-rw-r--r--linden/indra/llcommon/llworkerthread.h9
-rw-r--r--linden/indra/llcommon/metaclass.cpp3
-rw-r--r--linden/indra/llcommon/metaclass.h3
-rw-r--r--linden/indra/llcommon/metaclasst.h3
-rw-r--r--linden/indra/llcommon/metaproperty.cpp3
-rw-r--r--linden/indra/llcommon/metaproperty.h3
-rw-r--r--linden/indra/llcommon/metapropertyt.h3
-rw-r--r--linden/indra/llcommon/processor.h3
-rw-r--r--linden/indra/llcommon/reflective.cpp3
-rw-r--r--linden/indra/llcommon/reflective.h3
-rw-r--r--linden/indra/llcommon/reflectivet.h3
-rw-r--r--linden/indra/llcommon/roles_constants.h3
-rw-r--r--linden/indra/llcommon/stdenums.h3
-rw-r--r--linden/indra/llcommon/stdtypes.h6
-rw-r--r--linden/indra/llcommon/string_table.h3
-rw-r--r--linden/indra/llcommon/timer.h3
-rw-r--r--linden/indra/llcommon/timing.cpp3
-rw-r--r--linden/indra/llcommon/timing.h3
-rw-r--r--linden/indra/llcommon/u64.cpp3
-rw-r--r--linden/indra/llcommon/u64.h3
168 files changed, 1949 insertions, 516 deletions
diff --git a/linden/indra/llcommon/CMakeLists.txt b/linden/indra/llcommon/CMakeLists.txt
index 4001e1f..3f14be6 100644
--- a/linden/indra/llcommon/CMakeLists.txt
+++ b/linden/indra/llcommon/CMakeLists.txt
@@ -20,6 +20,7 @@ set(llcommon_SOURCE_FILES
20 llcommon.cpp 20 llcommon.cpp
21 llcrc.cpp 21 llcrc.cpp
22 llcriticaldamp.cpp 22 llcriticaldamp.cpp
23 llcursortypes.cpp
23 lldate.cpp 24 lldate.cpp
24 llerror.cpp 25 llerror.cpp
25 llerrorthread.cpp 26 llerrorthread.cpp
@@ -90,6 +91,7 @@ set(llcommon_HEADER_FILES
90 llcommon.h 91 llcommon.h
91 llcrc.h 92 llcrc.h
92 llcriticaldamp.h 93 llcriticaldamp.h
94 llcursortypes.h
93 lldarray.h 95 lldarray.h
94 lldarrayptr.h 96 lldarrayptr.h
95 lldate.h 97 lldate.h
diff --git a/linden/indra/llcommon/bitpack.h b/linden/indra/llcommon/bitpack.h
index bcbc880..cb9c70c 100644
--- a/linden/indra/llcommon/bitpack.h
+++ b/linden/indra/llcommon/bitpack.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/ctype_workaround.h b/linden/indra/llcommon/ctype_workaround.h
index ee35986..32ccb86 100644
--- a/linden/indra/llcommon/ctype_workaround.h
+++ b/linden/indra/llcommon/ctype_workaround.h
@@ -18,7 +18,8 @@
18 * There are special exceptions to the terms and conditions of the GPL as 18 * There are special exceptions to the terms and conditions of the GPL as
19 * it is applied to this Source Code. View the full text of the exception 19 * it is applied to this Source Code. View the full text of the exception
20 * in the file doc/FLOSS-exception.txt in this software distribution, or 20 * in the file doc/FLOSS-exception.txt in this software distribution, or
21 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 21 * online at
22 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 * 23 *
23 * By copying, modifying or distributing this software, you acknowledge 24 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above, 25 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/doublelinkedlist.h b/linden/indra/llcommon/doublelinkedlist.h
index 993ef00..a87860c 100644
--- a/linden/indra/llcommon/doublelinkedlist.h
+++ b/linden/indra/llcommon/doublelinkedlist.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/imageids.h b/linden/indra/llcommon/imageids.h
index 73ab1b8..832708c 100644
--- a/linden/indra/llcommon/imageids.h
+++ b/linden/indra/llcommon/imageids.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
@@ -55,6 +56,7 @@ const LLUUID IMG_SPARK ("d2e75ac1-d0fb-4532-820e-a20034ac814d"); // dataserver
55const LLUUID IMG_FIRE ("aca40aa8-44cf-44ca-a0fa-93e1a2986f82"); // dataserver 56const LLUUID IMG_FIRE ("aca40aa8-44cf-44ca-a0fa-93e1a2986f82"); // dataserver
56const LLUUID IMG_FACE_SELECT ("a85ac674-cb75-4af6-9499-df7c5aaf7a28"); // face selector 57const LLUUID IMG_FACE_SELECT ("a85ac674-cb75-4af6-9499-df7c5aaf7a28"); // face selector
57const LLUUID IMG_DEFAULT_AVATAR ("c228d1cf-4b5d-4ba8-84f4-899a0796aa97"); // dataserver 58const LLUUID IMG_DEFAULT_AVATAR ("c228d1cf-4b5d-4ba8-84f4-899a0796aa97"); // dataserver
59const LLUUID IMG_INVISIBLE ("3a367d1c-bef1-6d43-7595-e88c1e3aadb3"); // dataserver
58 60
59const LLUUID IMG_EXPLOSION ("68edcf47-ccd7-45b8-9f90-1649d7f12806"); // On dataserver 61const LLUUID IMG_EXPLOSION ("68edcf47-ccd7-45b8-9f90-1649d7f12806"); // On dataserver
60const LLUUID IMG_EXPLOSION_2 ("21ce046c-83fe-430a-b629-c7660ac78d7c"); // On dataserver 62const LLUUID IMG_EXPLOSION_2 ("21ce046c-83fe-430a-b629-c7660ac78d7c"); // On dataserver
diff --git a/linden/indra/llcommon/indra_constants.h b/linden/indra/llcommon/indra_constants.h
index e2d48da..ae7863d 100644
--- a/linden/indra/llcommon/indra_constants.h
+++ b/linden/indra/llcommon/indra_constants.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
@@ -117,6 +118,7 @@ const char* const DEFAULT_AGNI_DATA_SERVER = "63.211.139.100";
117const char* const DEFAULT_AGNI_ASSET_SERVER = "http://asset.agni.lindenlab.com:80"; 118const char* const DEFAULT_AGNI_ASSET_SERVER = "http://asset.agni.lindenlab.com:80";
118 119
119// Information about what ports are for what services is in the wiki Name Space Ports page 120// Information about what ports are for what services is in the wiki Name Space Ports page
121// https://wiki.lindenlab.com/wiki/Name_Space_Ports
120const char* const DEFAULT_LOCAL_ASSET_SERVER = "http://localhost:12041/asset/tmp"; 122const char* const DEFAULT_LOCAL_ASSET_SERVER = "http://localhost:12041/asset/tmp";
121const char* const LOCAL_ASSET_URL_FORMAT = "http://%s:12041/asset"; 123const char* const LOCAL_ASSET_URL_FORMAT = "http://%s:12041/asset";
122 124
@@ -137,6 +139,10 @@ const U32 DEFAULT_CAP_PROXY_PORT = 12043;
137const U32 DEFAULT_INV_DATA_SERVER_PORT = 12044; 139const U32 DEFAULT_INV_DATA_SERVER_PORT = 12044;
138const U32 DEFAULT_CGI_SERVICES_PORT = 12045; 140const U32 DEFAULT_CGI_SERVICES_PORT = 12045;
139 141
142// Mapserver uses ports 12124 - 12139 to allow multiple mapservers to run
143// on a single host for map tile generation. JC
144const U32 DEFAULT_MAPSERVER_PORT = 12124;
145
140// For automatic port discovery when running multiple viewers on one host 146// For automatic port discovery when running multiple viewers on one host
141const U32 PORT_DISCOVERY_RANGE_MIN = 13000; 147const U32 PORT_DISCOVERY_RANGE_MIN = 13000;
142const U32 PORT_DISCOVERY_RANGE_MAX = PORT_DISCOVERY_RANGE_MIN + 50; 148const U32 PORT_DISCOVERY_RANGE_MAX = PORT_DISCOVERY_RANGE_MIN + 50;
@@ -238,12 +244,11 @@ const F32 DEFAULT_WATER_HEIGHT = 20.0f;
238 244
239// Maturity ratings for simulators 245// Maturity ratings for simulators
240const U8 SIM_ACCESS_MIN = 0; // Treated as 'unknown', usually ends up being SIM_ACCESS_PG 246const U8 SIM_ACCESS_MIN = 0; // Treated as 'unknown', usually ends up being SIM_ACCESS_PG
241const U8 SIM_ACCESS_TRIAL = 7;
242const U8 SIM_ACCESS_PG = 13; 247const U8 SIM_ACCESS_PG = 13;
243const U8 SIM_ACCESS_MATURE = 21; 248const U8 SIM_ACCESS_MATURE = 21;
244const U8 SIM_ACCESS_ADULT = 42; // Seriously Adult Only 249const U8 SIM_ACCESS_ADULT = 42; // Seriously Adult Only
245const U8 SIM_ACCESS_DOWN = 254; 250const U8 SIM_ACCESS_DOWN = 254;
246const U8 SIM_ACCESS_MAX = SIM_ACCESS_MATURE; 251const U8 SIM_ACCESS_MAX = SIM_ACCESS_ADULT;
247 252
248// group constants 253// group constants
249const S32 MAX_AGENT_GROUPS = 25; 254const S32 MAX_AGENT_GROUPS = 25;
@@ -354,6 +359,8 @@ const U32 MAP_ITEM_POPULAR = 0x04;
354const U32 MAP_ITEM_AGENT_LOCATIONS = 0x06; 359const U32 MAP_ITEM_AGENT_LOCATIONS = 0x06;
355const U32 MAP_ITEM_LAND_FOR_SALE = 0x07; 360const U32 MAP_ITEM_LAND_FOR_SALE = 0x07;
356const U32 MAP_ITEM_CLASSIFIED = 0x08; 361const U32 MAP_ITEM_CLASSIFIED = 0x08;
362const U32 MAP_ITEM_ADULT_EVENT = 0x09;
363const U32 MAP_ITEM_LAND_FOR_SALE_ADULT = 0x0a;
357 364
358// Crash reporter behavior 365// Crash reporter behavior
359const char* const CRASH_SETTINGS_FILE = "settings_crash_behavior.xml"; 366const char* const CRASH_SETTINGS_FILE = "settings_crash_behavior.xml";
diff --git a/linden/indra/llcommon/is_approx_equal_fraction.h b/linden/indra/llcommon/is_approx_equal_fraction.h
new file mode 100644
index 0000000..d369fbc
--- /dev/null
+++ b/linden/indra/llcommon/is_approx_equal_fraction.h
@@ -0,0 +1,85 @@
1/**
2 * @file is_approx_equal_fraction.h
3 * @author Nat Goodspeed
4 * @date 2009-01-28
5 * @brief lltut.h uses is_approx_equal_fraction(). Moved to this header
6 * file in llcommon so we can use lltut.h for llcommon tests without
7 * making llcommon depend on llmath.
8 *
9 * $LicenseInfo:firstyear=2009&license=viewergpl$
10 *
11 * Copyright (c) 2009, Linden Research, Inc.
12 *
13 * Second Life Viewer Source Code
14 * The source code in this file ("Source Code") is provided by Linden Lab
15 * to you under the terms of the GNU General Public License, version 2.0
16 * ("GPL"), unless you have obtained a separate licensing agreement
17 * ("Other License"), formally executed by you and Linden Lab. Terms of
18 * the GPL can be found in doc/GPL-license.txt in this distribution, or
19 * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
20 *
21 * There are special exceptions to the terms and conditions of the GPL as
22 * it is applied to this Source Code. View the full text of the exception
23 * in the file doc/FLOSS-exception.txt in this software distribution, or
24 * online at
25 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
26 *
27 * By copying, modifying or distributing this software, you acknowledge
28 * that you have read and understood your obligations described above,
29 * and agree to abide by those obligations.
30 *
31 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
32 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
33 * COMPLETENESS OR PERFORMANCE.
34 * $/LicenseInfo$
35 */
36
37#if ! defined(LL_IS_APPROX_EQUAL_FRACTION_H)
38#define LL_IS_APPROX_EQUAL_FRACTION_H
39
40#include "lldefs.h"
41#include <cmath>
42
43/**
44 * Originally llmath.h contained two complete implementations of
45 * is_approx_equal_fraction(), with signatures as below, bodies identical save
46 * where they specifically mentioned F32/F64. Unifying these into a template
47 * makes sense -- but to preserve the compiler's overload-selection behavior,
48 * we still wrap the template implementation with the specific overloaded
49 * signatures.
50 */
51template <typename FTYPE>
52inline BOOL is_approx_equal_fraction_impl(FTYPE x, FTYPE y, U32 frac_bits)
53{
54 BOOL ret = TRUE;
55 FTYPE diff = (FTYPE) fabs(x - y);
56
57 S32 diffInt = (S32) diff;
58 S32 diffFracTolerance = (S32) ((diff - (FTYPE) diffInt) * (1 << frac_bits));
59
60 // if integer portion is not equal, not enough bits were used for packing
61 // so error out since either the use case is not correct OR there is
62 // an issue with pack/unpack. should fail in either case.
63 // for decimal portion, make sure that the delta is no more than 1
64 // based on the number of bits used for packing decimal portion.
65 if (diffInt != 0 || diffFracTolerance > 1)
66 {
67 ret = FALSE;
68 }
69
70 return ret;
71}
72
73/// F32 flavor
74inline BOOL is_approx_equal_fraction(F32 x, F32 y, U32 frac_bits)
75{
76 return is_approx_equal_fraction_impl<F32>(x, y, frac_bits);
77}
78
79/// F64 flavor
80inline BOOL is_approx_equal_fraction(F64 x, F64 y, U32 frac_bits)
81{
82 return is_approx_equal_fraction_impl<F64>(x, y, frac_bits);
83}
84
85#endif /* ! defined(LL_IS_APPROX_EQUAL_FRACTION_H) */
diff --git a/linden/indra/llcommon/linden_common.h b/linden/indra/llcommon/linden_common.h
index 70803ff..f9d5877 100644
--- a/linden/indra/llcommon/linden_common.h
+++ b/linden/indra/llcommon/linden_common.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/linked_lists.h b/linden/indra/llcommon/linked_lists.h
index f173d61..3d89a05 100644
--- a/linden/indra/llcommon/linked_lists.h
+++ b/linden/indra/llcommon/linked_lists.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/llagentconstants.h b/linden/indra/llcommon/llagentconstants.h
index fda8e9d..282db0a 100644
--- a/linden/indra/llcommon/llagentconstants.h
+++ b/linden/indra/llcommon/llagentconstants.h
@@ -18,7 +18,8 @@
18 * There are special exceptions to the terms and conditions of the GPL as 18 * There are special exceptions to the terms and conditions of the GPL as
19 * it is applied to this Source Code. View the full text of the exception 19 * it is applied to this Source Code. View the full text of the exception
20 * in the file doc/FLOSS-exception.txt in this software distribution, or 20 * in the file doc/FLOSS-exception.txt in this software distribution, or
21 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 21 * online at
22 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 * 23 *
23 * By copying, modifying or distributing this software, you acknowledge 24 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above, 25 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/llapp.cpp b/linden/indra/llcommon/llapp.cpp
index 6406d12..199315f 100644
--- a/linden/indra/llcommon/llapp.cpp
+++ b/linden/indra/llcommon/llapp.cpp
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
@@ -57,7 +58,7 @@ void default_unix_signal_handler(int signum, siginfo_t *info, void *);
57/* OSX doesn't support SIGRT* */ 58/* OSX doesn't support SIGRT* */
58S32 LL_SMACKDOWN_SIGNAL = SIGUSR1; 59S32 LL_SMACKDOWN_SIGNAL = SIGUSR1;
59S32 LL_HEARTBEAT_SIGNAL = SIGUSR2; 60S32 LL_HEARTBEAT_SIGNAL = SIGUSR2;
60# else 61# else // linux or (assumed) other similar unixoid
61/* We want reliable delivery of our signals - SIGRT* is it. */ 62/* We want reliable delivery of our signals - SIGRT* is it. */
62/* Old LinuxThreads versions eat SIGRTMIN+0 to SIGRTMIN+2, avoid those. */ 63/* Old LinuxThreads versions eat SIGRTMIN+0 to SIGRTMIN+2, avoid those. */
63/* Note that SIGRTMIN/SIGRTMAX may expand to a glibc function call with a 64/* Note that SIGRTMIN/SIGRTMAX may expand to a glibc function call with a
@@ -89,6 +90,12 @@ LLAppChildCallback LLApp::sDefaultChildCallback = NULL;
89 90
90LLApp::LLApp() : mThreadErrorp(NULL) 91LLApp::LLApp() : mThreadErrorp(NULL)
91{ 92{
93 commonCtor();
94 startErrorThread();
95}
96
97void LLApp::commonCtor()
98{
92 // Set our status to running 99 // Set our status to running
93 setStatus(APP_STATUS_RUNNING); 100 setStatus(APP_STATUS_RUNNING);
94 101
@@ -96,9 +103,9 @@ LLApp::LLApp() : mThreadErrorp(NULL)
96 103
97#if !LL_WINDOWS 104#if !LL_WINDOWS
98 // This must be initialized before the error handler. 105 // This must be initialized before the error handler.
99 sSigChildCount = new LLAtomicU32(0); 106 sSigChildCount = new LLAtomicU32(0);
100#endif 107#endif
101 108
102 // Setup error handling 109 // Setup error handling
103 setupErrorHandling(); 110 setupErrorHandling();
104 111
@@ -118,6 +125,13 @@ LLApp::LLApp() : mThreadErrorp(NULL)
118 125
119 // Set the application to this instance. 126 // Set the application to this instance.
120 sApplication = this; 127 sApplication = this;
128
129}
130
131LLApp::LLApp(LLErrorThread *error_thread) :
132 mThreadErrorp(error_thread)
133{
134 commonCtor();
121} 135}
122 136
123 137
@@ -261,17 +275,20 @@ void LLApp::setupErrorHandling()
261 275
262#endif 276#endif
263 277
278}
279
280void LLApp::startErrorThread()
281{
264 // 282 //
265 // Start the error handling thread, which is responsible for taking action 283 // Start the error handling thread, which is responsible for taking action
266 // when the app goes into the APP_STATUS_ERROR state 284 // when the app goes into the APP_STATUS_ERROR state
267 // 285 //
268 llinfos << "LLApp::setupErrorHandling - Starting error thread" << llendl; 286 llinfos << "Starting error thread" << llendl;
269 mThreadErrorp = new LLErrorThread(); 287 mThreadErrorp = new LLErrorThread();
270 mThreadErrorp->setUserData((void *) this); 288 mThreadErrorp->setUserData((void *) this);
271 mThreadErrorp->start(); 289 mThreadErrorp->start();
272} 290}
273 291
274
275void LLApp::setErrorHandler(LLAppErrorHandler handler) 292void LLApp::setErrorHandler(LLAppErrorHandler handler)
276{ 293{
277 LLApp::sErrorHandler = handler; 294 LLApp::sErrorHandler = handler;
@@ -542,7 +559,9 @@ void setup_signals()
542 sigaction(LL_SMACKDOWN_SIGNAL, &act, NULL); 559 sigaction(LL_SMACKDOWN_SIGNAL, &act, NULL);
543 560
544 // Asynchronous signals that are normally ignored 561 // Asynchronous signals that are normally ignored
562#ifndef LL_IGNORE_SIGCHLD
545 sigaction(SIGCHLD, &act, NULL); 563 sigaction(SIGCHLD, &act, NULL);
564#endif // LL_IGNORE_SIGCHLD
546 sigaction(SIGUSR2, &act, NULL); 565 sigaction(SIGUSR2, &act, NULL);
547 566
548 // Asynchronous signals that result in attempted graceful exit 567 // Asynchronous signals that result in attempted graceful exit
@@ -576,7 +595,9 @@ void clear_signals()
576 sigaction(LL_SMACKDOWN_SIGNAL, &act, NULL); 595 sigaction(LL_SMACKDOWN_SIGNAL, &act, NULL);
577 596
578 // Asynchronous signals that are normally ignored 597 // Asynchronous signals that are normally ignored
598#ifndef LL_IGNORE_SIGCHLD
579 sigaction(SIGCHLD, &act, NULL); 599 sigaction(SIGCHLD, &act, NULL);
600#endif // LL_IGNORE_SIGCHLD
580 601
581 // Asynchronous signals that result in attempted graceful exit 602 // Asynchronous signals that result in attempted graceful exit
582 sigaction(SIGHUP, &act, NULL); 603 sigaction(SIGHUP, &act, NULL);
diff --git a/linden/indra/llcommon/llapp.h b/linden/indra/llcommon/llapp.h
index b5e72f5..f8a593c 100644
--- a/linden/indra/llcommon/llapp.h
+++ b/linden/indra/llcommon/llapp.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
@@ -77,6 +78,11 @@ public:
77 LLApp(); 78 LLApp();
78 virtual ~LLApp(); 79 virtual ~LLApp();
79 80
81protected:
82 LLApp(LLErrorThread* error_thread);
83 void commonCtor();
84public:
85
80 /** 86 /**
81 * @brief Return the static app instance if one was created. 87 * @brief Return the static app instance if one was created.
82 */ 88 */
@@ -183,6 +189,8 @@ public:
183#if !LL_WINDOWS 189#if !LL_WINDOWS
184 static U32 getSigChildCount(); 190 static U32 getSigChildCount();
185 static void incSigChildCount(); 191 static void incSigChildCount();
192#else
193#define getpid GetCurrentProcessId
186#endif 194#endif
187 static int getPid(); 195 static int getPid();
188 196
@@ -245,8 +253,9 @@ protected:
245 void stepFrame(); 253 void stepFrame();
246 254
247private: 255private:
256 void startErrorThread();
257
248 void setupErrorHandling(); // Do platform-specific error-handling setup (signals, structured exceptions) 258 void setupErrorHandling(); // Do platform-specific error-handling setup (signals, structured exceptions)
249
250 static void runErrorHandler(); // run shortly after we detect an error, ran in the relatively robust context of the LLErrorThread - preferred. 259 static void runErrorHandler(); // run shortly after we detect an error, ran in the relatively robust context of the LLErrorThread - preferred.
251 static void runSyncErrorHandler(); // run IMMEDIATELY when we get an error, ran in the context of the faulting thread. 260 static void runSyncErrorHandler(); // run IMMEDIATELY when we get an error, ran in the context of the faulting thread.
252 261
diff --git a/linden/indra/llcommon/llapr.cpp b/linden/indra/llcommon/llapr.cpp
index 589d3f5..669afc5 100644
--- a/linden/indra/llcommon/llapr.cpp
+++ b/linden/indra/llcommon/llapr.cpp
@@ -19,7 +19,8 @@
19 * There are special exceptions to the terms and conditions of the GPL as 19 * There are special exceptions to the terms and conditions of the GPL as
20 * it is applied to this Source Code. View the full text of the exception 20 * it is applied to this Source Code. View the full text of the exception
21 * in the file doc/FLOSS-exception.txt in this software distribution, or 21 * in the file doc/FLOSS-exception.txt in this software distribution, or
22 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 22 * online at
23 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
23 * 24 *
24 * By copying, modifying or distributing this software, you acknowledge 25 * By copying, modifying or distributing this software, you acknowledge
25 * that you have read and understood your obligations described above, 26 * that you have read and understood your obligations described above,
@@ -35,8 +36,11 @@
35#include "llapr.h" 36#include "llapr.h"
36 37
37apr_pool_t *gAPRPoolp = NULL; // Global APR memory pool 38apr_pool_t *gAPRPoolp = NULL; // Global APR memory pool
39LLVolatileAPRPool *LLAPRFile::sAPRFilePoolp = NULL ; //global volatile APR memory pool.
38apr_thread_mutex_t *gLogMutexp = NULL; 40apr_thread_mutex_t *gLogMutexp = NULL;
41apr_thread_mutex_t *gCallStacksLogMutexp = NULL;
39 42
43const S32 FULL_VOLATILE_APR_POOL = 1024 ; //number of references to LLVolatileAPRPool
40 44
41void ll_init_apr() 45void ll_init_apr()
42{ 46{
@@ -45,9 +49,15 @@ void ll_init_apr()
45 // Initialize APR and create the global pool 49 // Initialize APR and create the global pool
46 apr_initialize(); 50 apr_initialize();
47 apr_pool_create(&gAPRPoolp, NULL); 51 apr_pool_create(&gAPRPoolp, NULL);
48 52
49 // Initialize the logging mutex 53 // Initialize the logging mutex
50 apr_thread_mutex_create(&gLogMutexp, APR_THREAD_MUTEX_UNNESTED, gAPRPoolp); 54 apr_thread_mutex_create(&gLogMutexp, APR_THREAD_MUTEX_UNNESTED, gAPRPoolp);
55 apr_thread_mutex_create(&gCallStacksLogMutexp, APR_THREAD_MUTEX_UNNESTED, gAPRPoolp);
56 }
57
58 if(!LLAPRFile::sAPRFilePoolp)
59 {
60 LLAPRFile::sAPRFilePoolp = new LLVolatileAPRPool() ;
51 } 61 }
52} 62}
53 63
@@ -64,36 +74,140 @@ void ll_cleanup_apr()
64 apr_thread_mutex_destroy(gLogMutexp); 74 apr_thread_mutex_destroy(gLogMutexp);
65 gLogMutexp = NULL; 75 gLogMutexp = NULL;
66 } 76 }
77 if (gCallStacksLogMutexp)
78 {
79 // Clean up the logging mutex
80
81 // All other threads NEED to be done before we clean up APR, so this is okay.
82 apr_thread_mutex_destroy(gCallStacksLogMutexp);
83 gCallStacksLogMutexp = NULL;
84 }
67 if (gAPRPoolp) 85 if (gAPRPoolp)
68 { 86 {
69 apr_pool_destroy(gAPRPoolp); 87 apr_pool_destroy(gAPRPoolp);
70 gAPRPoolp = NULL; 88 gAPRPoolp = NULL;
71 } 89 }
90 if (LLAPRFile::sAPRFilePoolp)
91 {
92 delete LLAPRFile::sAPRFilePoolp ;
93 LLAPRFile::sAPRFilePoolp = NULL ;
94 }
72 apr_terminate(); 95 apr_terminate();
73} 96}
74 97
75// 98//
99//
76//LLAPRPool 100//LLAPRPool
77// 101//
78LLAPRPool::LLAPRPool(apr_pool_t *parent, apr_size_t size) 102LLAPRPool::LLAPRPool(apr_pool_t *parent, apr_size_t size, BOOL releasePoolFlag)
103{
104 mParent = parent ;
105 mReleasePoolFlag = releasePoolFlag ;
106 mMaxSize = size ;
107 mPool = NULL ;
108
109 createAPRPool() ;
110}
111
112LLAPRPool::~LLAPRPool()
79{ 113{
80 mStatus = apr_pool_create(&mPool, parent); 114 releaseAPRPool() ;
115}
81 116
82 if(size > 0) //size is the number of blocks (which is usually 4K), NOT bytes. 117void LLAPRPool::createAPRPool()
118{
119 if(mPool)
120 {
121 return ;
122 }
123
124 mStatus = apr_pool_create(&mPool, mParent);
125 ll_apr_warn_status(mStatus) ;
126
127 if(mMaxSize > 0) //size is the number of blocks (which is usually 4K), NOT bytes.
83 { 128 {
84 apr_allocator_t *allocator = apr_pool_allocator_get(mPool); 129 apr_allocator_t *allocator = apr_pool_allocator_get(mPool);
85 if (allocator) 130 if (allocator)
86 { 131 {
87 apr_allocator_max_free_set(allocator, size) ; 132 apr_allocator_max_free_set(allocator, mMaxSize) ;
88 } 133 }
89 } 134 }
90} 135}
91 136
92LLAPRPool::~LLAPRPool() 137void LLAPRPool::releaseAPRPool()
93{ 138{
94 apr_pool_destroy(mPool) ; 139 if(!mPool)
140 {
141 return ;
142 }
143
144 if(!mParent || mReleasePoolFlag)
145 {
146 apr_pool_destroy(mPool) ;
147 mPool = NULL ;
148 }
149}
150
151apr_pool_t* LLAPRPool::getAPRPool()
152{
153 if(!mPool)
154 {
155 createAPRPool() ;
156 }
157
158 return mPool ;
159}
160LLVolatileAPRPool::LLVolatileAPRPool(apr_pool_t *parent, apr_size_t size, BOOL releasePoolFlag)
161 : LLAPRPool(parent, size, releasePoolFlag)
162{
163 mNumActiveRef = 0 ;
164 mNumTotalRef = 0 ;
165}
166
167apr_pool_t* LLVolatileAPRPool::getVolatileAPRPool()
168{
169 mNumTotalRef++ ;
170 mNumActiveRef++ ;
171 return getAPRPool() ;
95} 172}
96 173
174void LLVolatileAPRPool::clearVolatileAPRPool()
175{
176 if(mNumActiveRef > 0)
177 {
178 mNumActiveRef--;
179 if(mNumActiveRef < 1)
180 {
181 if(isFull())
182 {
183 mNumTotalRef = 0 ;
184
185 //destroy the apr_pool.
186 releaseAPRPool() ;
187 }
188 else
189 {
190 //This does not actually free the memory,
191 //it just allows the pool to re-use this memory for the next allocation.
192 apr_pool_clear(mPool) ;
193 }
194 }
195 }
196 else
197 {
198 llassert_always(mNumActiveRef > 0) ;
199 }
200
201 //paranoia check if the pool is jammed.
202 //will remove the check before going to release.
203 llassert_always(mNumTotalRef < (FULL_VOLATILE_APR_POOL << 2)) ;
204}
205
206BOOL LLVolatileAPRPool::isFull()
207{
208 return mNumTotalRef > FULL_VOLATILE_APR_POOL ;
209}
210//---------------------------------------------------------------------
97// 211//
98// LLScopedLock 212// LLScopedLock
99// 213//
@@ -132,9 +246,8 @@ void LLScopedLock::unlock()
132 } 246 }
133} 247}
134 248
135// 249//---------------------------------------------------------------------
136// Misc functions 250
137//
138bool ll_apr_warn_status(apr_status_t status) 251bool ll_apr_warn_status(apr_status_t status)
139{ 252{
140 if(APR_SUCCESS == status) return false; 253 if(APR_SUCCESS == status) return false;
@@ -150,55 +263,110 @@ void ll_apr_assert_status(apr_status_t status)
150 llassert(ll_apr_warn_status(status) == false); 263 llassert(ll_apr_warn_status(status) == false);
151} 264}
152 265
153// File I/O 266//---------------------------------------------------------------------
154apr_file_t* ll_apr_file_open(const std::string& filename, apr_int32_t flags, S32* sizep, apr_pool_t* pool) 267//
268// LLAPRFile functions
269//
270LLAPRFile::LLAPRFile()
271{
272 mFile = NULL ;
273 mCurrentFilePoolp = NULL ;
274}
275LLAPRFile::~LLAPRFile()
276{
277 close() ;
278}
279
280apr_status_t LLAPRFile::close()
281{
282 apr_status_t ret = APR_SUCCESS ;
283 if(mFile)
284 {
285 ret = apr_file_close(mFile);
286 mFile = NULL ;
287 }
288
289 if(mCurrentFilePoolp)
290 {
291 mCurrentFilePoolp->clearVolatileAPRPool() ;
292 mCurrentFilePoolp = NULL ;
293 }
294
295 return ret ;
296}
297
298apr_status_t LLAPRFile::open(LLVolatileAPRPool* pool, const std::string& filename, apr_int32_t flags, S32* sizep)
299{
300 apr_status_t s ;
301 s = open(filename, flags, pool ? pool->getVolatileAPRPool() : NULL, sizep) ;
302
303 if(!mCurrentFilePoolp)
304 {
305 mCurrentFilePoolp = pool ;
306
307 if(!mFile)
308 {
309 close() ;
310 }
311 }
312
313 return s ;
314}
315apr_status_t LLAPRFile::open(const std::string& filename, apr_int32_t flags, apr_pool_t* pool, S32* sizep)
155{ 316{
156 apr_file_t* apr_file;
157 apr_status_t s; 317 apr_status_t s;
158 if (pool == NULL) pool = gAPRPoolp; 318
159 s = apr_file_open(&apr_file, filename.c_str(), flags, APR_OS_DEFAULT, pool); 319 //check if already open some file
160 if (s != APR_SUCCESS) 320 llassert_always(!mFile) ;
321 llassert_always(!mCurrentFilePoolp) ;
322
323 s = apr_file_open(&mFile, filename.c_str(), flags, APR_OS_DEFAULT, getAPRFilePool(pool));
324 if (s != APR_SUCCESS || !mFile)
161 { 325 {
326 mFile = NULL ;
327 close() ;
162 if (sizep) 328 if (sizep)
163 { 329 {
164 *sizep = 0; 330 *sizep = 0;
165 } 331 }
166 return NULL; 332 return s;
167 } 333 }
168 334
169 if (sizep) 335 if (sizep)
170 { 336 {
171 S32 file_size = 0; 337 S32 file_size = 0;
172 apr_off_t offset = 0; 338 apr_off_t offset = 0;
173 if (apr_file_seek(apr_file, APR_END, &offset) == APR_SUCCESS) 339 if (apr_file_seek(mFile, APR_END, &offset) == APR_SUCCESS)
174 { 340 {
175 llassert_always(offset <= 0x7fffffff); 341 llassert_always(offset <= 0x7fffffff);
176 file_size = (S32)offset; 342 file_size = (S32)offset;
177 offset = 0; 343 offset = 0;
178 apr_file_seek(apr_file, APR_SET, &offset); 344 apr_file_seek(mFile, APR_SET, &offset);
179 } 345 }
180 *sizep = file_size; 346 *sizep = file_size;
181 } 347 }
182 348
183 return apr_file; 349 return s;
184} 350}
185apr_file_t* ll_apr_file_open(const std::string& filename, apr_int32_t flags, S32* sizep) 351
186{ 352apr_pool_t* LLAPRFile::getAPRFilePool(apr_pool_t* pool)
187 return ll_apr_file_open(filename, flags, sizep, NULL); 353{
188} 354 if(!pool)
189apr_file_t* ll_apr_file_open(const std::string& filename, apr_int32_t flags, apr_pool_t* pool) 355 {
190{ 356 mCurrentFilePoolp = sAPRFilePoolp ;
191 return ll_apr_file_open(filename, flags, NULL, pool); 357 return mCurrentFilePoolp->getVolatileAPRPool() ;
192} 358 }
193apr_file_t* ll_apr_file_open(const std::string& filename, apr_int32_t flags) 359
194{ 360 return pool ;
195 return ll_apr_file_open(filename, flags, NULL, NULL);
196} 361}
197 362
198S32 ll_apr_file_read(apr_file_t* apr_file, void *buf, S32 nbytes) 363// File I/O
364S32 LLAPRFile::read(void *buf, S32 nbytes)
199{ 365{
366 llassert_always(mFile) ;
367
200 apr_size_t sz = nbytes; 368 apr_size_t sz = nbytes;
201 apr_status_t s = apr_file_read(apr_file, buf, &sz); 369 apr_status_t s = apr_file_read(mFile, buf, &sz);
202 if (s != APR_SUCCESS) 370 if (s != APR_SUCCESS)
203 { 371 {
204 return 0; 372 return 0;
@@ -210,165 +378,273 @@ S32 ll_apr_file_read(apr_file_t* apr_file, void *buf, S32 nbytes)
210 } 378 }
211} 379}
212 380
213S32 ll_apr_file_read_ex(const std::string& filename, apr_pool_t* pool, void *buf, S32 offset, S32 nbytes) 381S32 LLAPRFile::write(const void *buf, S32 nbytes)
214{ 382{
215 if (pool == NULL) pool = gAPRPoolp; 383 llassert_always(mFile) ;
216 apr_file_t* filep = ll_apr_file_open(filename, APR_READ|APR_BINARY, pool); 384
217 if (!filep) 385 apr_size_t sz = nbytes;
386 apr_status_t s = apr_file_write(mFile, buf, &sz);
387 if (s != APR_SUCCESS)
218 { 388 {
219 return 0; 389 return 0;
220 } 390 }
221 S32 off;
222 if (offset < 0)
223 off = ll_apr_file_seek(filep, APR_END, 0);
224 else 391 else
225 off = ll_apr_file_seek(filep, APR_SET, offset);
226 S32 bytes_read;
227 if (off < 0)
228 { 392 {
229 bytes_read = 0; 393 llassert_always(sz <= 0x7fffffff);
394 return (S32)sz;
230 } 395 }
231 else 396}
397
398S32 LLAPRFile::seek(apr_seek_where_t where, S32 offset)
399{
400 return LLAPRFile::seek(mFile, where, offset) ;
401}
402
403//
404//*******************************************************************************************************************************
405//static components of LLAPRFile
406//
407
408//static
409apr_status_t LLAPRFile::close(apr_file_t* file_handle, LLVolatileAPRPool* pool)
410{
411 apr_status_t ret = APR_SUCCESS ;
412 if(file_handle)
413 {
414 ret = apr_file_close(file_handle);
415 file_handle = NULL ;
416 }
417
418 if(pool)
232 { 419 {
233 bytes_read = ll_apr_file_read(filep, buf, nbytes ); 420 pool->clearVolatileAPRPool() ;
234 } 421 }
235 apr_file_close(filep);
236 422
237 return bytes_read; 423 return ret ;
238} 424}
239 425
240S32 ll_apr_file_write(apr_file_t* apr_file, const void *buf, S32 nbytes) 426//static
427apr_file_t* LLAPRFile::open(const std::string& filename, LLVolatileAPRPool* pool, apr_int32_t flags)
241{ 428{
242 apr_size_t sz = nbytes; 429 apr_status_t s;
243 apr_status_t s = apr_file_write(apr_file, buf, &sz); 430 apr_file_t* file_handle ;
431
432 pool = pool ? pool : LLAPRFile::sAPRFilePoolp ;
433
434 s = apr_file_open(&file_handle, filename.c_str(), flags, APR_OS_DEFAULT, pool->getVolatileAPRPool());
435 if (s != APR_SUCCESS || !file_handle)
436 {
437 file_handle = NULL ;
438 close(file_handle, pool) ;
439 return NULL;
440 }
441
442 return file_handle ;
443}
444
445//static
446S32 LLAPRFile::seek(apr_file_t* file_handle, apr_seek_where_t where, S32 offset)
447{
448 if(!file_handle)
449 {
450 return -1 ;
451 }
452
453 apr_status_t s;
454 apr_off_t apr_offset;
455 if (offset >= 0)
456 {
457 apr_offset = (apr_off_t)offset;
458 s = apr_file_seek(file_handle, where, &apr_offset);
459 }
460 else
461 {
462 apr_offset = 0;
463 s = apr_file_seek(file_handle, APR_END, &apr_offset);
464 }
244 if (s != APR_SUCCESS) 465 if (s != APR_SUCCESS)
245 { 466 {
467 return -1;
468 }
469 else
470 {
471 llassert_always(apr_offset <= 0x7fffffff);
472 return (S32)apr_offset;
473 }
474}
475
476//static
477S32 LLAPRFile::readEx(const std::string& filename, void *buf, S32 offset, S32 nbytes, LLVolatileAPRPool* pool)
478{
479 //*****************************************
480 apr_file_t* file_handle = open(filename, pool, APR_READ|APR_BINARY);
481 //*****************************************
482 if (!file_handle)
483 {
246 return 0; 484 return 0;
247 } 485 }
486
487 S32 off;
488 if (offset < 0)
489 off = LLAPRFile::seek(file_handle, APR_END, 0);
490 else
491 off = LLAPRFile::seek(file_handle, APR_SET, offset);
492
493 apr_size_t bytes_read;
494 if (off < 0)
495 {
496 bytes_read = 0;
497 }
248 else 498 else
249 { 499 {
250 llassert_always(sz <= 0x7fffffff); 500 bytes_read = nbytes ;
251 return (S32)sz; 501 apr_status_t s = apr_file_read(file_handle, buf, &bytes_read);
502 if (s != APR_SUCCESS)
503 {
504 bytes_read = 0;
505 }
506 else
507 {
508 llassert_always(bytes_read <= 0x7fffffff);
509 }
252 } 510 }
511
512 //*****************************************
513 close(file_handle, pool) ;
514 //*****************************************
515 return (S32)bytes_read;
253} 516}
254 517
255S32 ll_apr_file_write_ex(const std::string& filename, apr_pool_t* pool, void *buf, S32 offset, S32 nbytes) 518//static
519S32 LLAPRFile::writeEx(const std::string& filename, void *buf, S32 offset, S32 nbytes, LLVolatileAPRPool* pool)
256{ 520{
257 if (pool == NULL) pool = gAPRPoolp;
258 apr_int32_t flags = APR_CREATE|APR_WRITE|APR_BINARY; 521 apr_int32_t flags = APR_CREATE|APR_WRITE|APR_BINARY;
259 if (offset < 0) 522 if (offset < 0)
260 { 523 {
261 flags |= APR_APPEND; 524 flags |= APR_APPEND;
262 offset = 0; 525 offset = 0;
263 } 526 }
264 apr_file_t* filep = ll_apr_file_open(filename, flags, pool); 527
265 if (!filep) 528 //*****************************************
529 apr_file_t* file_handle = open(filename, pool, flags);
530 //*****************************************
531 if (!file_handle)
266 { 532 {
267 return 0; 533 return 0;
268 } 534 }
535
269 if (offset > 0) 536 if (offset > 0)
270 { 537 {
271 offset = ll_apr_file_seek(filep, APR_SET, offset); 538 offset = LLAPRFile::seek(file_handle, APR_SET, offset);
272 } 539 }
273 S32 bytes_written; 540
541 apr_size_t bytes_written;
274 if (offset < 0) 542 if (offset < 0)
275 { 543 {
276 bytes_written = 0; 544 bytes_written = 0;
277 } 545 }
278 else 546 else
279 { 547 {
280 bytes_written = ll_apr_file_write(filep, buf, nbytes ); 548 bytes_written = nbytes ;
549 apr_status_t s = apr_file_write(file_handle, buf, &bytes_written);
550 if (s != APR_SUCCESS)
551 {
552 bytes_written = 0;
553 }
554 else
555 {
556 llassert_always(bytes_written <= 0x7fffffff);
557 }
281 } 558 }
282 apr_file_close(filep);
283 559
284 return bytes_written; 560 //*****************************************
285} 561 LLAPRFile::close(file_handle, pool);
562 //*****************************************
286 563
287S32 ll_apr_file_seek(apr_file_t* apr_file, apr_seek_where_t where, S32 offset) 564 return (S32)bytes_written;
288{
289 apr_status_t s;
290 apr_off_t apr_offset;
291 if (offset >= 0)
292 {
293 apr_offset = (apr_off_t)offset;
294 s = apr_file_seek(apr_file, where, &apr_offset);
295 }
296 else
297 {
298 apr_offset = 0;
299 s = apr_file_seek(apr_file, APR_END, &apr_offset);
300 }
301 if (s != APR_SUCCESS)
302 {
303 return -1;
304 }
305 else
306 {
307 llassert_always(apr_offset <= 0x7fffffff);
308 return (S32)apr_offset;
309 }
310} 565}
311 566
312bool ll_apr_file_remove(const std::string& filename, apr_pool_t* pool) 567//static
568bool LLAPRFile::remove(const std::string& filename, LLVolatileAPRPool* pool)
313{ 569{
314 apr_status_t s; 570 apr_status_t s;
315 if (pool == NULL) pool = gAPRPoolp; 571
316 s = apr_file_remove(filename.c_str(), pool); 572 pool = pool ? pool : LLAPRFile::sAPRFilePoolp ;
573 s = apr_file_remove(filename.c_str(), pool->getVolatileAPRPool());
574 pool->clearVolatileAPRPool() ;
575
317 if (s != APR_SUCCESS) 576 if (s != APR_SUCCESS)
318 { 577 {
319 LL_DEBUGS("APR") << "ll_apr_file_remove failed on file: " << filename << LL_ENDL; 578 LL_DEBUGS("APR") << "LLAPRFile::remove failed on file: " << filename << LL_ENDL;
320 ll_apr_warn_status(s); 579 ll_apr_warn_status(s);
321 return false; 580 return false;
322 } 581 }
323 return true; 582 return true;
324} 583}
325 584
326bool ll_apr_file_rename(const std::string& filename, const std::string& newname, apr_pool_t* pool) 585//static
586bool LLAPRFile::rename(const std::string& filename, const std::string& newname, LLVolatileAPRPool* pool)
327{ 587{
328 apr_status_t s; 588 apr_status_t s;
329 if (pool == NULL) pool = gAPRPoolp; 589
330 s = apr_file_rename(filename.c_str(), newname.c_str(), pool); 590 pool = pool ? pool : LLAPRFile::sAPRFilePoolp ;
591 s = apr_file_rename(filename.c_str(), newname.c_str(), pool->getVolatileAPRPool());
592 pool->clearVolatileAPRPool() ;
593
331 if (s != APR_SUCCESS) 594 if (s != APR_SUCCESS)
332 { 595 {
333 LL_DEBUGS("APR") << "ll_apr_file_rename failed on file: " << filename << LL_ENDL; 596 LL_DEBUGS("APR") << "LLAPRFile::rename failed on file: " << filename << LL_ENDL;
334 ll_apr_warn_status(s); 597 ll_apr_warn_status(s);
335 return false; 598 return false;
336 } 599 }
337 return true; 600 return true;
338} 601}
339 602
340bool ll_apr_file_exists(const std::string& filename, apr_pool_t* pool) 603//static
604bool LLAPRFile::isExist(const std::string& filename, LLVolatileAPRPool* pool, apr_int32_t flags)
341{ 605{
342 apr_file_t* apr_file; 606 apr_file_t* apr_file;
343 apr_status_t s; 607 apr_status_t s;
344 if (pool == NULL) pool = gAPRPoolp; 608
345 s = apr_file_open(&apr_file, filename.c_str(), APR_READ, APR_OS_DEFAULT, pool); 609 pool = pool ? pool : LLAPRFile::sAPRFilePoolp ;
610 s = apr_file_open(&apr_file, filename.c_str(), flags, APR_OS_DEFAULT, pool->getVolatileAPRPool());
611
346 if (s != APR_SUCCESS || !apr_file) 612 if (s != APR_SUCCESS || !apr_file)
347 { 613 {
614 pool->clearVolatileAPRPool() ;
348 return false; 615 return false;
349 } 616 }
350 else 617 else
351 { 618 {
352 apr_file_close(apr_file); 619 apr_file_close(apr_file) ;
620 pool->clearVolatileAPRPool() ;
353 return true; 621 return true;
354 } 622 }
355} 623}
356 624
357S32 ll_apr_file_size(const std::string& filename, apr_pool_t* pool) 625//static
626S32 LLAPRFile::size(const std::string& filename, LLVolatileAPRPool* pool)
358{ 627{
359 apr_file_t* apr_file; 628 apr_file_t* apr_file;
360 apr_finfo_t info; 629 apr_finfo_t info;
361 apr_status_t s; 630 apr_status_t s;
362 if (pool == NULL) pool = gAPRPoolp; 631
363 s = apr_file_open(&apr_file, filename.c_str(), APR_READ, APR_OS_DEFAULT, pool); 632 pool = pool ? pool : LLAPRFile::sAPRFilePoolp ;
633 s = apr_file_open(&apr_file, filename.c_str(), APR_READ, APR_OS_DEFAULT, pool->getVolatileAPRPool());
634
364 if (s != APR_SUCCESS || !apr_file) 635 if (s != APR_SUCCESS || !apr_file)
365 { 636 {
637 pool->clearVolatileAPRPool() ;
638
366 return 0; 639 return 0;
367 } 640 }
368 else 641 else
369 { 642 {
370 apr_status_t s = apr_file_info_get(&info, APR_FINFO_SIZE, apr_file); 643 apr_status_t s = apr_file_info_get(&info, APR_FINFO_SIZE, apr_file);
371 apr_file_close(apr_file); 644
645 apr_file_close(apr_file) ;
646 pool->clearVolatileAPRPool() ;
647
372 if (s == APR_SUCCESS) 648 if (s == APR_SUCCESS)
373 { 649 {
374 return (S32)info.size; 650 return (S32)info.size;
@@ -380,31 +656,42 @@ S32 ll_apr_file_size(const std::string& filename, apr_pool_t* pool)
380 } 656 }
381} 657}
382 658
383bool ll_apr_dir_make(const std::string& dirname, apr_pool_t* pool) 659//static
660bool LLAPRFile::makeDir(const std::string& dirname, LLVolatileAPRPool* pool)
384{ 661{
385 apr_status_t s; 662 apr_status_t s;
386 if (pool == NULL) pool = gAPRPoolp; 663
387 s = apr_dir_make(dirname.c_str(), APR_FPROT_OS_DEFAULT, pool); 664 pool = pool ? pool : LLAPRFile::sAPRFilePoolp ;
665 s = apr_dir_make(dirname.c_str(), APR_FPROT_OS_DEFAULT, pool->getVolatileAPRPool());
666 pool->clearVolatileAPRPool() ;
667
388 if (s != APR_SUCCESS) 668 if (s != APR_SUCCESS)
389 { 669 {
390 LL_DEBUGS("APR") << "ll_apr_dir_make failed on file: " << dirname << LL_ENDL; 670 LL_DEBUGS("APR") << "LLAPRFile::makeDir failed on file: " << dirname << LL_ENDL;
391 ll_apr_warn_status(s); 671 ll_apr_warn_status(s);
392 return false; 672 return false;
393 } 673 }
394 return true; 674 return true;
395} 675}
396 676
397bool ll_apr_dir_remove(const std::string& dirname, apr_pool_t* pool) 677//static
678bool LLAPRFile::removeDir(const std::string& dirname, LLVolatileAPRPool* pool)
398{ 679{
399 apr_status_t s; 680 apr_status_t s;
400 if (pool == NULL) pool = gAPRPoolp; 681
401 s = apr_file_remove(dirname.c_str(), pool); 682 pool = pool ? pool : LLAPRFile::sAPRFilePoolp ;
683 s = apr_file_remove(dirname.c_str(), pool->getVolatileAPRPool());
684 pool->clearVolatileAPRPool() ;
685
402 if (s != APR_SUCCESS) 686 if (s != APR_SUCCESS)
403 { 687 {
404 LL_DEBUGS("APR") << "ll_apr_dir_remove failed on file: " << dirname << LL_ENDL; 688 LL_DEBUGS("APR") << "LLAPRFile::removeDir failed on file: " << dirname << LL_ENDL;
405 ll_apr_warn_status(s); 689 ll_apr_warn_status(s);
406 return false; 690 return false;
407 } 691 }
408 return true; 692 return true;
409} 693}
410 694//
695//end of static components of LLAPRFile
696//*******************************************************************************************************************************
697//
diff --git a/linden/indra/llcommon/llapr.h b/linden/indra/llcommon/llapr.h
index a80c1d6..63130a8 100644
--- a/linden/indra/llcommon/llapr.h
+++ b/linden/indra/llcommon/llapr.h
@@ -19,7 +19,8 @@
19 * There are special exceptions to the terms and conditions of the GPL as 19 * There are special exceptions to the terms and conditions of the GPL as
20 * it is applied to this Source Code. View the full text of the exception 20 * it is applied to this Source Code. View the full text of the exception
21 * in the file doc/FLOSS-exception.txt in this software distribution, or 21 * in the file doc/FLOSS-exception.txt in this software distribution, or
22 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 22 * online at
23 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
23 * 24 *
24 * By copying, modifying or distributing this software, you acknowledge 25 * By copying, modifying or distributing this software, you acknowledge
25 * that you have read and understood your obligations described above, 26 * that you have read and understood your obligations described above,
@@ -48,6 +49,7 @@
48#include "llstring.h" 49#include "llstring.h"
49 50
50extern apr_thread_mutex_t* gLogMutexp; 51extern apr_thread_mutex_t* gLogMutexp;
52extern apr_thread_mutex_t* gCallStacksLogMutexp;
51 53
52/** 54/**
53 * @brief initialize the common apr constructs -- apr itself, the 55 * @brief initialize the common apr constructs -- apr itself, the
@@ -60,18 +62,51 @@ void ll_init_apr();
60 */ 62 */
61void ll_cleanup_apr(); 63void ll_cleanup_apr();
62 64
65//
66//LL apr_pool
67//manage apr_pool_t, destroy allocated apr_pool in the destruction function.
68//
63class LLAPRPool 69class LLAPRPool
64{ 70{
65public: 71public:
66 LLAPRPool(apr_pool_t *parent = NULL, apr_size_t size = 0) ; 72 LLAPRPool(apr_pool_t *parent = NULL, apr_size_t size = 0, BOOL releasePoolFlag = TRUE) ;
67 ~LLAPRPool() ; 73 ~LLAPRPool() ;
68 74
69 apr_pool_t* getAPRPool() {return mPool ; } 75 apr_pool_t* getAPRPool() ;
70 apr_status_t getStatus() {return mStatus ; } 76 apr_status_t getStatus() {return mStatus ; }
71 77
78protected:
79 void releaseAPRPool() ;
80 void createAPRPool() ;
81
82protected:
83 apr_pool_t* mPool ; //pointing to an apr_pool
84 apr_pool_t* mParent ; //parent pool
85 apr_size_t mMaxSize ; //max size of mPool, mPool should return memory to system if allocated memory beyond this limit. However it seems not to work.
86 apr_status_t mStatus ; //status when creating the pool
87 BOOL mReleasePoolFlag ; //if set, mPool is destroyed when LLAPRPool is deleted. default value is true.
88};
89
90//
91//volatile LL apr_pool
92//which clears memory automatically.
93//so it can not hold static data or data after memory is cleared
94//
95class LLVolatileAPRPool : public LLAPRPool
96{
97public:
98 LLVolatileAPRPool(apr_pool_t *parent = NULL, apr_size_t size = 0, BOOL releasePoolFlag = TRUE);
99 ~LLVolatileAPRPool(){}
100
101 apr_pool_t* getVolatileAPRPool() ;
102
103 void clearVolatileAPRPool() ;
104
105 BOOL isFull() ;
106 BOOL isEmpty() {return !mNumActiveRef ;}
72private: 107private:
73 apr_pool_t* mPool ; 108 S32 mNumActiveRef ; //number of active pointers pointing to the apr_pool.
74 apr_status_t mStatus ; 109 S32 mNumTotalRef ; //number of total pointers pointing to the apr_pool since last creating.
75} ; 110} ;
76 111
77/** 112/**
@@ -144,24 +179,71 @@ typedef LLAtomic32<S32> LLAtomicS32;
144#define LL_APR_WB (APR_CREATE|APR_TRUNCATE|APR_WRITE|APR_BINARY) // "wb" 179#define LL_APR_WB (APR_CREATE|APR_TRUNCATE|APR_WRITE|APR_BINARY) // "wb"
145#define LL_APR_RPB (APR_READ|APR_WRITE|APR_BINARY) // "r+b" 180#define LL_APR_RPB (APR_READ|APR_WRITE|APR_BINARY) // "r+b"
146#define LL_APR_WPB (APR_CREATE|APR_TRUNCATE|APR_READ|APR_WRITE|APR_BINARY) // "w+b" 181#define LL_APR_WPB (APR_CREATE|APR_TRUNCATE|APR_READ|APR_WRITE|APR_BINARY) // "w+b"
147apr_file_t* ll_apr_file_open(const std::string& filename, apr_int32_t flags, S32* sizep, apr_pool_t* pool); 182
148apr_file_t* ll_apr_file_open(const std::string& filename, apr_int32_t flags, S32* sizep); 183//
149apr_file_t* ll_apr_file_open(const std::string& filename, apr_int32_t flags, apr_pool_t* pool); 184//apr_file manager
150apr_file_t* ll_apr_file_open(const std::string& filename, apr_int32_t flags); 185//which: 1)only keeps one file open;
151// Returns actual offset, -1 if seek fails 186// 2)closes the open file in the destruction function
152S32 ll_apr_file_seek(apr_file_t* apr_file, apr_seek_where_t where, S32 offset); 187// 3)informs the apr_pool to clean the memory when the file is closed.
153// Returns bytes read/written, 0 if read/write fails: 188//Note: please close an open file at the earliest convenience.
154S32 ll_apr_file_read(apr_file_t* apr_file, void* buf, S32 nbytes); 189// especially do not put some time-costly operations between open() and close().
155S32 ll_apr_file_read_ex(const std::string& filename, apr_pool_t* pool, void *buf, S32 offset, S32 nbytes); 190// otherwise it might lock the APRFilePool.
156S32 ll_apr_file_write(apr_file_t* apr_file, const void* buf, S32 nbytes); 191//there are two different apr_pools the APRFile can use:
157S32 ll_apr_file_write_ex(const std::string& filename, apr_pool_t* pool, void *buf, S32 offset, S32 nbytes); 192// 1, a temperary pool passed to an APRFile function, which is used within this function and only once.
158// returns false if failure: 193// 2, a global pool.
159bool ll_apr_file_remove(const std::string& filename, apr_pool_t* pool = NULL); 194//
160bool ll_apr_file_rename(const std::string& filename, const std::string& newname, apr_pool_t* pool = NULL); 195class LLAPRFile
161bool ll_apr_file_exists(const std::string& filename, apr_pool_t* pool = NULL); 196{
162S32 ll_apr_file_size(const std::string& filename, apr_pool_t* pool = NULL); 197private:
163bool ll_apr_dir_make(const std::string& dirname, apr_pool_t* pool = NULL); 198 apr_file_t* mFile ;
164bool ll_apr_dir_remove(const std::string& dirname, apr_pool_t* pool = NULL); 199 LLVolatileAPRPool *mCurrentFilePoolp ; //currently in use apr_pool, could be one of them: sAPRFilePoolp, or a temp pool.
200
201public:
202 LLAPRFile() ;
203 ~LLAPRFile() ;
204
205 apr_status_t open(LLVolatileAPRPool* pool, const std::string& filename, apr_int32_t flags, S32* sizep = NULL);
206 apr_status_t open(const std::string& filename, apr_int32_t flags, apr_pool_t* pool = NULL, S32* sizep = NULL);
207 apr_status_t close() ;
208
209 // Returns actual offset, -1 if seek fails
210 S32 seek(apr_seek_where_t where, S32 offset);
211 apr_status_t eof() { return apr_file_eof(mFile);}
212
213 // Returns bytes read/written, 0 if read/write fails:
214 S32 read(void* buf, S32 nbytes);
215 S32 write(const void* buf, S32 nbytes);
216
217 apr_file_t* getFileHandle() {return mFile;}
218
219private:
220 apr_pool_t* getAPRFilePool(apr_pool_t* pool) ;
221
222//
223//*******************************************************************************************************************************
224//static components
225//
226public:
227 static LLVolatileAPRPool *sAPRFilePoolp ; //a global apr_pool for APRFile, which is used only when local pool does not exist.
228
229private:
230 static apr_file_t* open(const std::string& filename, LLVolatileAPRPool* pool, apr_int32_t flags);
231 static apr_status_t close(apr_file_t* file, LLVolatileAPRPool* pool) ;
232 static S32 seek(apr_file_t* file, apr_seek_where_t where, S32 offset);
233public:
234 // returns false if failure:
235 static bool remove(const std::string& filename, LLVolatileAPRPool* pool = NULL);
236 static bool rename(const std::string& filename, const std::string& newname, LLVolatileAPRPool* pool = NULL);
237 static bool isExist(const std::string& filename, LLVolatileAPRPool* pool = NULL, apr_int32_t flags = APR_READ);
238 static S32 size(const std::string& filename, LLVolatileAPRPool* pool = NULL);
239 static bool makeDir(const std::string& dirname, LLVolatileAPRPool* pool = NULL);
240 static bool removeDir(const std::string& dirname, LLVolatileAPRPool* pool = NULL);
241
242 // Returns bytes read/written, 0 if read/write fails:
243 static S32 readEx(const std::string& filename, void *buf, S32 offset, S32 nbytes, LLVolatileAPRPool* pool = NULL);
244 static S32 writeEx(const std::string& filename, void *buf, S32 offset, S32 nbytes, LLVolatileAPRPool* pool = NULL);
245//*******************************************************************************************************************************
246};
165 247
166/** 248/**
167 * @brief Function which approprately logs error or remains quiet on 249 * @brief Function which approprately logs error or remains quiet on
diff --git a/linden/indra/llcommon/llassettype.cpp b/linden/indra/llcommon/llassettype.cpp
index 33e23e8..cf3bf89 100644
--- a/linden/indra/llcommon/llassettype.cpp
+++ b/linden/indra/llcommon/llassettype.cpp
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/llassettype.h b/linden/indra/llcommon/llassettype.h
index 35b993d..4077b8d 100644
--- a/linden/indra/llcommon/llassettype.h
+++ b/linden/indra/llcommon/llassettype.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/llassoclist.h b/linden/indra/llcommon/llassoclist.h
index 722d29f..5aa26ea 100644
--- a/linden/indra/llcommon/llassoclist.h
+++ b/linden/indra/llcommon/llassoclist.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/llavatarconstants.h b/linden/indra/llcommon/llavatarconstants.h
index 1b385b8..6517b70 100644
--- a/linden/indra/llcommon/llavatarconstants.h
+++ b/linden/indra/llcommon/llavatarconstants.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/llbase32.cpp b/linden/indra/llcommon/llbase32.cpp
index 79f560f..5e6ced9 100644
--- a/linden/indra/llcommon/llbase32.cpp
+++ b/linden/indra/llcommon/llbase32.cpp
@@ -22,7 +22,8 @@
22 * There are special exceptions to the terms and conditions of the GPL as 22 * There are special exceptions to the terms and conditions of the GPL as
23 * it is applied to this Source Code. View the full text of the exception 23 * it is applied to this Source Code. View the full text of the exception
24 * in the file doc/FLOSS-exception.txt in this software distribution, or 24 * in the file doc/FLOSS-exception.txt in this software distribution, or
25 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 25 * online at
26 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
26 * 27 *
27 * By copying, modifying or distributing this software, you acknowledge 28 * By copying, modifying or distributing this software, you acknowledge
28 * that you have read and understood your obligations described above, 29 * that you have read and understood your obligations described above,
@@ -145,8 +146,6 @@ base32_encode(char *dst, size_t size, const void *data, size_t len)
145 146
146/* *TODO: Implement base32 encode. 147/* *TODO: Implement base32 encode.
147 148
148#define ARRAY_LEN(a) (sizeof (a) / sizeof((a)[0]))
149
150static inline int 149static inline int
151ascii_toupper(int c) 150ascii_toupper(int c)
152{ 151{
@@ -172,7 +171,7 @@ base32_decode(char *dst, size_t size, const void *data, size_t len)
172 unsigned max_pad = 3; 171 unsigned max_pad = 3;
173 172
174 if (0 == base32_map[0]) { 173 if (0 == base32_map[0]) {
175 for (i = 0; i < ARRAY_LEN(base32_map); i++) { 174 for (i = 0; i < LL_ARRAY_SIZE(base32_map); i++) {
176 const char *x; 175 const char *x;
177 176
178 x = memchr(base32_alphabet, ascii_toupper(i), sizeof base32_alphabet); 177 x = memchr(base32_alphabet, ascii_toupper(i), sizeof base32_alphabet);
@@ -196,7 +195,7 @@ base32_decode(char *dst, size_t size, const void *data, size_t len)
196 } 195 }
197 } 196 }
198 197
199 j = i % ARRAY_LEN(s); 198 j = i % LL_ARRAY_SIZE(s);
200 s[j] = c; 199 s[j] = c;
201 200
202 if (7 == j) { 201 if (7 == j) {
@@ -208,7 +207,7 @@ base32_decode(char *dst, size_t size, const void *data, size_t len)
208 b[3] = ((s[4] & 1) << 7) | ((s[5] & 0x1f) << 2) | ((s[6] >> 3) & 0x03); 207 b[3] = ((s[4] & 1) << 7) | ((s[5] & 0x1f) << 2) | ((s[6] >> 3) & 0x03);
209 b[4] = ((s[6] & 0x07) << 5) | (s[7] & 0x1f); 208 b[4] = ((s[6] & 0x07) << 5) | (s[7] & 0x1f);
210 209
211 for (j = 0; j < ARRAY_LEN(b); j++) { 210 for (j = 0; j < LL_ARRAY_SIZE(b); j++) {
212 if (q != end) 211 if (q != end)
213 *q = b[j]; 212 *q = b[j];
214 q++; 213 q++;
diff --git a/linden/indra/llcommon/llbase32.h b/linden/indra/llcommon/llbase32.h
index 667d8eb..63a93e1 100644
--- a/linden/indra/llcommon/llbase32.h
+++ b/linden/indra/llcommon/llbase32.h
@@ -18,7 +18,8 @@
18 * There are special exceptions to the terms and conditions of the GPL as 18 * There are special exceptions to the terms and conditions of the GPL as
19 * it is applied to this Source Code. View the full text of the exception 19 * it is applied to this Source Code. View the full text of the exception
20 * in the file doc/FLOSS-exception.txt in this software distribution, or 20 * in the file doc/FLOSS-exception.txt in this software distribution, or
21 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 21 * online at
22 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 * 23 *
23 * By copying, modifying or distributing this software, you acknowledge 24 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above, 25 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/llbase64.cpp b/linden/indra/llcommon/llbase64.cpp
index 304fd08..7020a79 100644
--- a/linden/indra/llcommon/llbase64.cpp
+++ b/linden/indra/llcommon/llbase64.cpp
@@ -18,7 +18,8 @@
18 * There are special exceptions to the terms and conditions of the GPL as 18 * There are special exceptions to the terms and conditions of the GPL as
19 * it is applied to this Source Code. View the full text of the exception 19 * it is applied to this Source Code. View the full text of the exception
20 * in the file doc/FLOSS-exception.txt in this software distribution, or 20 * in the file doc/FLOSS-exception.txt in this software distribution, or
21 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 21 * online at
22 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 * 23 *
23 * By copying, modifying or distributing this software, you acknowledge 24 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above, 25 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/llbase64.h b/linden/indra/llcommon/llbase64.h
index 24c3f3e..58414bb 100644
--- a/linden/indra/llcommon/llbase64.h
+++ b/linden/indra/llcommon/llbase64.h
@@ -18,7 +18,8 @@
18 * There are special exceptions to the terms and conditions of the GPL as 18 * There are special exceptions to the terms and conditions of the GPL as
19 * it is applied to this Source Code. View the full text of the exception 19 * it is applied to this Source Code. View the full text of the exception
20 * in the file doc/FLOSS-exception.txt in this software distribution, or 20 * in the file doc/FLOSS-exception.txt in this software distribution, or
21 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 21 * online at
22 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 * 23 *
23 * By copying, modifying or distributing this software, you acknowledge 24 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above, 25 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/llboost.h b/linden/indra/llcommon/llboost.h
index 9eb7cd7..4df9dbf 100644
--- a/linden/indra/llcommon/llboost.h
+++ b/linden/indra/llcommon/llboost.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/llchat.h b/linden/indra/llcommon/llchat.h
index 1bb3f3b..7b010d6 100644
--- a/linden/indra/llcommon/llchat.h
+++ b/linden/indra/llcommon/llchat.h
@@ -18,7 +18,8 @@
18 * There are special exceptions to the terms and conditions of the GPL as 18 * There are special exceptions to the terms and conditions of the GPL as
19 * it is applied to this Source Code. View the full text of the exception 19 * it is applied to this Source Code. View the full text of the exception
20 * in the file doc/FLOSS-exception.txt in this software distribution, or 20 * in the file doc/FLOSS-exception.txt in this software distribution, or
21 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 21 * online at
22 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 * 23 *
23 * By copying, modifying or distributing this software, you acknowledge 24 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above, 25 * that you have read and understood your obligations described above,
@@ -77,7 +78,8 @@ public:
77 mAudible(CHAT_AUDIBLE_FULLY), 78 mAudible(CHAT_AUDIBLE_FULLY),
78 mMuted(FALSE), 79 mMuted(FALSE),
79 mTime(0.0), 80 mTime(0.0),
80 mPosAgent() 81 mPosAgent(),
82 mURL()
81 { } 83 { }
82 84
83 std::string mText; // UTF-8 line of text 85 std::string mText; // UTF-8 line of text
@@ -89,6 +91,7 @@ public:
89 BOOL mMuted; // pass muted chat to maintain list of chatters 91 BOOL mMuted; // pass muted chat to maintain list of chatters
90 F64 mTime; // viewer only, seconds from viewer start 92 F64 mTime; // viewer only, seconds from viewer start
91 LLVector3 mPosAgent; 93 LLVector3 mPosAgent;
94 std::string mURL;
92}; 95};
93 96
94#endif 97#endif
diff --git a/linden/indra/llcommon/llclickaction.h b/linden/indra/llcommon/llclickaction.h
index 1193c32..8048724 100644
--- a/linden/indra/llcommon/llclickaction.h
+++ b/linden/indra/llcommon/llclickaction.h
@@ -18,7 +18,8 @@
18 * There are special exceptions to the terms and conditions of the GPL as 18 * There are special exceptions to the terms and conditions of the GPL as
19 * it is applied to this Source Code. View the full text of the exception 19 * it is applied to this Source Code. View the full text of the exception
20 * in the file doc/FLOSS-exception.txt in this software distribution, or 20 * in the file doc/FLOSS-exception.txt in this software distribution, or
21 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 21 * online at
22 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 * 23 *
23 * By copying, modifying or distributing this software, you acknowledge 24 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above, 25 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/llcommon.cpp b/linden/indra/llcommon/llcommon.cpp
index 1875044..2cbb718 100644
--- a/linden/indra/llcommon/llcommon.cpp
+++ b/linden/indra/llcommon/llcommon.cpp
@@ -16,7 +16,8 @@
16 * There are special exceptions to the terms and conditions of the GPL as 16 * There are special exceptions to the terms and conditions of the GPL as
17 * it is applied to this Source Code. View the full text of the exception 17 * it is applied to this Source Code. View the full text of the exception
18 * in the file doc/FLOSS-exception.txt in this software distribution, or 18 * in the file doc/FLOSS-exception.txt in this software distribution, or
19 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 19 * online at
20 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
20 * 21 *
21 * By copying, modifying or distributing this software, you acknowledge 22 * By copying, modifying or distributing this software, you acknowledge
22 * that you have read and understood your obligations described above, 23 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/llcommon.h b/linden/indra/llcommon/llcommon.h
index 0cb5c0e..5f77988 100644
--- a/linden/indra/llcommon/llcommon.h
+++ b/linden/indra/llcommon/llcommon.h
@@ -16,7 +16,8 @@
16 * There are special exceptions to the terms and conditions of the GPL as 16 * There are special exceptions to the terms and conditions of the GPL as
17 * it is applied to this Source Code. View the full text of the exception 17 * it is applied to this Source Code. View the full text of the exception
18 * in the file doc/FLOSS-exception.txt in this software distribution, or 18 * in the file doc/FLOSS-exception.txt in this software distribution, or
19 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 19 * online at
20 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
20 * 21 *
21 * By copying, modifying or distributing this software, you acknowledge 22 * By copying, modifying or distributing this software, you acknowledge
22 * that you have read and understood your obligations described above, 23 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/llcrc.cpp b/linden/indra/llcommon/llcrc.cpp
index 593a385..7f183dc 100644
--- a/linden/indra/llcommon/llcrc.cpp
+++ b/linden/indra/llcommon/llcrc.cpp
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
@@ -196,6 +197,10 @@ void LLCRC::update(const std::string& filename)
196 update(data, nread); 197 update(data, nread);
197 delete[] data; 198 delete[] data;
198 } 199 }
200 else
201 {
202 fclose(fp);
203 }
199 } 204 }
200} 205}
201 206
diff --git a/linden/indra/llcommon/llcrc.h b/linden/indra/llcommon/llcrc.h
index 3dd2b3f..27fae7d 100644
--- a/linden/indra/llcommon/llcrc.h
+++ b/linden/indra/llcommon/llcrc.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/llcriticaldamp.cpp b/linden/indra/llcommon/llcriticaldamp.cpp
index cc0caed..b6f715b 100644
--- a/linden/indra/llcommon/llcriticaldamp.cpp
+++ b/linden/indra/llcommon/llcriticaldamp.cpp
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/llcriticaldamp.h b/linden/indra/llcommon/llcriticaldamp.h
index 17659da..ad98284 100644
--- a/linden/indra/llcommon/llcriticaldamp.h
+++ b/linden/indra/llcommon/llcriticaldamp.h
@@ -18,7 +18,8 @@
18 * There are special exceptions to the terms and conditions of the GPL as 18 * There are special exceptions to the terms and conditions of the GPL as
19 * it is applied to this Source Code. View the full text of the exception 19 * it is applied to this Source Code. View the full text of the exception
20 * in the file doc/FLOSS-exception.txt in this software distribution, or 20 * in the file doc/FLOSS-exception.txt in this software distribution, or
21 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 21 * online at
22 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 * 23 *
23 * By copying, modifying or distributing this software, you acknowledge 24 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above, 25 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/llcursortypes.cpp b/linden/indra/llcommon/llcursortypes.cpp
new file mode 100644
index 0000000..7444115
--- /dev/null
+++ b/linden/indra/llcommon/llcursortypes.cpp
@@ -0,0 +1,90 @@
1/**
2 * @file llcursortypes.cpp
3 * @brief Cursor types and lookup of types from a string
4 *
5 * $LicenseInfo:firstyear=2008&license=viewergpl$
6 *
7 * Copyright (c) 2008-2009, Linden Research, Inc.
8 *
9 * Second Life Viewer Source Code
10 * The source code in this file ("Source Code") is provided by Linden Lab
11 * to you under the terms of the GNU General Public License, version 2.0
12 * ("GPL"), unless you have obtained a separate licensing agreement
13 * ("Other License"), formally executed by you and Linden Lab. Terms of
14 * the GPL can be found in doc/GPL-license.txt in this distribution, or
15 * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
16 *
17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 *
23 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above,
25 * and agree to abide by those obligations.
26 *
27 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
28 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
29 * COMPLETENESS OR PERFORMANCE.
30 * $/LicenseInfo$
31 */
32
33#include "llcursortypes.h"
34
35ECursorType getCursorFromString(const std::string& cursor_string)
36{
37 static std::map<std::string,U32> cursor_string_table;
38 if (cursor_string_table.empty())
39 {
40 cursor_string_table["UI_CURSOR_ARROW"] = UI_CURSOR_ARROW;
41 cursor_string_table["UI_CURSOR_WAIT"] = UI_CURSOR_WAIT;
42 cursor_string_table["UI_CURSOR_HAND"] = UI_CURSOR_HAND;
43 cursor_string_table["UI_CURSOR_IBEAM"] = UI_CURSOR_IBEAM;
44 cursor_string_table["UI_CURSOR_CROSS"] = UI_CURSOR_CROSS;
45 cursor_string_table["UI_CURSOR_SIZENWSE"] = UI_CURSOR_SIZENWSE;
46 cursor_string_table["UI_CURSOR_SIZENESW"] = UI_CURSOR_SIZENESW;
47 cursor_string_table["UI_CURSOR_SIZEWE"] = UI_CURSOR_SIZEWE;
48 cursor_string_table["UI_CURSOR_SIZENS"] = UI_CURSOR_SIZENS;
49 cursor_string_table["UI_CURSOR_NO"] = UI_CURSOR_NO;
50 cursor_string_table["UI_CURSOR_WORKING"] = UI_CURSOR_WORKING;
51 cursor_string_table["UI_CURSOR_TOOLGRAB"] = UI_CURSOR_TOOLGRAB;
52 cursor_string_table["UI_CURSOR_TOOLLAND"] = UI_CURSOR_TOOLLAND;
53 cursor_string_table["UI_CURSOR_TOOLFOCUS"] = UI_CURSOR_TOOLFOCUS;
54 cursor_string_table["UI_CURSOR_TOOLCREATE"] = UI_CURSOR_TOOLCREATE;
55 cursor_string_table["UI_CURSOR_ARROWDRAG"] = UI_CURSOR_ARROWDRAG;
56 cursor_string_table["UI_CURSOR_ARROWCOPY"] = UI_CURSOR_ARROWCOPY;
57 cursor_string_table["UI_CURSOR_ARROWDRAGMULTI"] = UI_CURSOR_ARROWDRAGMULTI;
58 cursor_string_table["UI_CURSOR_ARROWCOPYMULTI"] = UI_CURSOR_ARROWCOPYMULTI;
59 cursor_string_table["UI_CURSOR_NOLOCKED"] = UI_CURSOR_NOLOCKED;
60 cursor_string_table["UI_CURSOR_ARROWLOCKED"] = UI_CURSOR_ARROWLOCKED;
61 cursor_string_table["UI_CURSOR_GRABLOCKED"] = UI_CURSOR_GRABLOCKED;
62 cursor_string_table["UI_CURSOR_TOOLTRANSLATE"] = UI_CURSOR_TOOLTRANSLATE;
63 cursor_string_table["UI_CURSOR_TOOLROTATE"] = UI_CURSOR_TOOLROTATE;
64 cursor_string_table["UI_CURSOR_TOOLSCALE"] = UI_CURSOR_TOOLSCALE;
65 cursor_string_table["UI_CURSOR_TOOLCAMERA"] = UI_CURSOR_TOOLCAMERA;
66 cursor_string_table["UI_CURSOR_TOOLPAN"] = UI_CURSOR_TOOLPAN;
67 cursor_string_table["UI_CURSOR_TOOLZOOMIN"] = UI_CURSOR_TOOLZOOMIN;
68 cursor_string_table["UI_CURSOR_TOOLPICKOBJECT3"] = UI_CURSOR_TOOLPICKOBJECT3;
69 cursor_string_table["UI_CURSOR_TOOLSIT"] = UI_CURSOR_TOOLSIT;
70 cursor_string_table["UI_CURSOR_TOOLBUY"] = UI_CURSOR_TOOLBUY;
71 cursor_string_table["UI_CURSOR_TOOLPAY"] = UI_CURSOR_TOOLPAY;
72 cursor_string_table["UI_CURSOR_TOOLOPEN"] = UI_CURSOR_TOOLOPEN;
73 cursor_string_table["UI_CURSOR_TOOLPLAY"] = UI_CURSOR_TOOLPLAY;
74 cursor_string_table["UI_CURSOR_TOOLPAUSE"] = UI_CURSOR_TOOLPAUSE;
75 cursor_string_table["UI_CURSOR_TOOLMEDIAOPEN"] = UI_CURSOR_TOOLMEDIAOPEN;
76 cursor_string_table["UI_CURSOR_PIPETTE"] = UI_CURSOR_PIPETTE;
77 }
78
79 std::map<std::string,U32>::const_iterator iter = cursor_string_table.find(cursor_string);
80
81 if (iter != cursor_string_table.end())
82 {
83 return (ECursorType)iter->second;
84 }
85
86 return UI_CURSOR_ARROW;
87}
88
89
90
diff --git a/linden/indra/llcommon/llcursortypes.h b/linden/indra/llcommon/llcursortypes.h
new file mode 100644
index 0000000..bea7035
--- /dev/null
+++ b/linden/indra/llcommon/llcursortypes.h
@@ -0,0 +1,82 @@
1/**
2 * @file llcursortypes.h
3 * @brief Cursor types
4 *
5 * $LicenseInfo:firstyear=2008&license=viewergpl$
6 *
7 * Copyright (c) 2008-2009, Linden Research, Inc.
8 *
9 * Second Life Viewer Source Code
10 * The source code in this file ("Source Code") is provided by Linden Lab
11 * to you under the terms of the GNU General Public License, version 2.0
12 * ("GPL"), unless you have obtained a separate licensing agreement
13 * ("Other License"), formally executed by you and Linden Lab. Terms of
14 * the GPL can be found in doc/GPL-license.txt in this distribution, or
15 * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
16 *
17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 *
23 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above,
25 * and agree to abide by those obligations.
26 *
27 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
28 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
29 * COMPLETENESS OR PERFORMANCE.
30 * $/LicenseInfo$
31 */
32
33#ifndef LL_LLCURSORTYPES_H
34#define LL_LLCURSORTYPES_H
35
36#include "linden_common.h"
37
38// If you add types here, add them in LLCursor::getCursorFromString
39enum ECursorType {
40 UI_CURSOR_ARROW,
41 UI_CURSOR_WAIT,
42 UI_CURSOR_HAND,
43 UI_CURSOR_IBEAM,
44 UI_CURSOR_CROSS,
45 UI_CURSOR_SIZENWSE,
46 UI_CURSOR_SIZENESW,
47 UI_CURSOR_SIZEWE,
48 UI_CURSOR_SIZENS,
49 UI_CURSOR_NO,
50 UI_CURSOR_WORKING,
51 UI_CURSOR_TOOLGRAB,
52 UI_CURSOR_TOOLLAND,
53 UI_CURSOR_TOOLFOCUS,
54 UI_CURSOR_TOOLCREATE,
55 UI_CURSOR_ARROWDRAG,
56 UI_CURSOR_ARROWCOPY, // drag with copy
57 UI_CURSOR_ARROWDRAGMULTI,
58 UI_CURSOR_ARROWCOPYMULTI, // drag with copy
59 UI_CURSOR_NOLOCKED,
60 UI_CURSOR_ARROWLOCKED,
61 UI_CURSOR_GRABLOCKED,
62 UI_CURSOR_TOOLTRANSLATE,
63 UI_CURSOR_TOOLROTATE,
64 UI_CURSOR_TOOLSCALE,
65 UI_CURSOR_TOOLCAMERA,
66 UI_CURSOR_TOOLPAN,
67 UI_CURSOR_TOOLZOOMIN,
68 UI_CURSOR_TOOLPICKOBJECT3,
69 UI_CURSOR_TOOLSIT,
70 UI_CURSOR_TOOLBUY,
71 UI_CURSOR_TOOLPAY,
72 UI_CURSOR_TOOLOPEN,
73 UI_CURSOR_TOOLPLAY,
74 UI_CURSOR_TOOLPAUSE,
75 UI_CURSOR_TOOLMEDIAOPEN,
76 UI_CURSOR_PIPETTE,
77 UI_CURSOR_COUNT // Number of elements in this enum (NOT a cursor)
78};
79
80ECursorType getCursorFromString(const std::string& cursor_string);
81
82#endif // LL_LLCURSORTYPES_H
diff --git a/linden/indra/llcommon/lldarray.h b/linden/indra/llcommon/lldarray.h
index 3b84aab..0e56a11 100644
--- a/linden/indra/llcommon/lldarray.h
+++ b/linden/indra/llcommon/lldarray.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/lldarrayptr.h b/linden/indra/llcommon/lldarrayptr.h
index 06336a7..7fde52b 100644
--- a/linden/indra/llcommon/lldarrayptr.h
+++ b/linden/indra/llcommon/lldarrayptr.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/lldate.cpp b/linden/indra/llcommon/lldate.cpp
index 512b3ee..41a3af3 100644
--- a/linden/indra/llcommon/lldate.cpp
+++ b/linden/indra/llcommon/lldate.cpp
@@ -19,7 +19,8 @@
19 * There are special exceptions to the terms and conditions of the GPL as 19 * There are special exceptions to the terms and conditions of the GPL as
20 * it is applied to this Source Code. View the full text of the exception 20 * it is applied to this Source Code. View the full text of the exception
21 * in the file doc/FLOSS-exception.txt in this software distribution, or 21 * in the file doc/FLOSS-exception.txt in this software distribution, or
22 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 22 * online at
23 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
23 * 24 *
24 * By copying, modifying or distributing this software, you acknowledge 25 * By copying, modifying or distributing this software, you acknowledge
25 * that you have read and understood your obligations described above, 26 * that you have read and understood your obligations described above,
@@ -36,9 +37,12 @@
36 37
37#include "apr_time.h" 38#include "apr_time.h"
38 39
40#include <time.h>
39#include <iomanip> 41#include <iomanip>
40#include <sstream> 42#include <sstream>
41 43
44#include "lltimer.h"
45
42static const F64 DATE_EPOCH = 0.0; 46static const F64 DATE_EPOCH = 0.0;
43 47
44static const F64 LL_APR_USEC_PER_SEC = 1000000.0; 48static const F64 LL_APR_USEC_PER_SEC = 1000000.0;
@@ -122,7 +126,7 @@ void LLDate::toHTTPDateStream(std::ostream& s) const
122 << " GMT"; 126 << " GMT";
123 127
124 // RFC 1123 date does not use microseconds 128 // RFC 1123 date does not use microseconds
125 llinfos << "Date in RFC 1123 format is " << s << llendl; 129 //llinfos << "Date in RFC 1123 format is " << s << llendl;
126} 130}
127 131
128void LLDate::toStream(std::ostream& s) const 132void LLDate::toStream(std::ostream& s) const
@@ -234,6 +238,17 @@ void LLDate::secondsSinceEpoch(F64 seconds)
234 mSecondsSinceEpoch = seconds; 238 mSecondsSinceEpoch = seconds;
235} 239}
236 240
241/* static */ LLDate LLDate::now()
242{
243 // time() returns seconds, we want fractions of a second, which LLTimer provides --RN
244 return LLDate(LLTimer::getTotalSeconds());
245}
246
247bool LLDate::operator<(const LLDate& rhs) const
248{
249 return mSecondsSinceEpoch < rhs.mSecondsSinceEpoch;
250}
251
237std::ostream& operator<<(std::ostream& s, const LLDate& date) 252std::ostream& operator<<(std::ostream& s, const LLDate& date)
238{ 253{
239 date.toStream(s); 254 date.toStream(s);
@@ -245,3 +260,4 @@ std::istream& operator>>(std::istream& s, LLDate& date)
245 date.fromStream(s); 260 date.fromStream(s);
246 return s; 261 return s;
247} 262}
263
diff --git a/linden/indra/llcommon/lldate.h b/linden/indra/llcommon/lldate.h
index 7adf724..7cc9c8a 100644
--- a/linden/indra/llcommon/lldate.h
+++ b/linden/indra/llcommon/lldate.h
@@ -19,7 +19,8 @@
19 * There are special exceptions to the terms and conditions of the GPL as 19 * There are special exceptions to the terms and conditions of the GPL as
20 * it is applied to this Source Code. View the full text of the exception 20 * it is applied to this Source Code. View the full text of the exception
21 * in the file doc/FLOSS-exception.txt in this software distribution, or 21 * in the file doc/FLOSS-exception.txt in this software distribution, or
22 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 22 * online at
23 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
23 * 24 *
24 * By copying, modifying or distributing this software, you acknowledge 25 * By copying, modifying or distributing this software, you acknowledge
25 * that you have read and understood your obligations described above, 26 * that you have read and understood your obligations described above,
@@ -35,6 +36,7 @@
35#define LL_LLDATE_H 36#define LL_LLDATE_H
36 37
37#include <iosfwd> 38#include <iosfwd>
39#include <string>
38 40
39#include "stdtypes.h" 41#include "stdtypes.h"
40 42
@@ -53,7 +55,7 @@ public:
53 LLDate(); 55 LLDate();
54 56
55 /** 57 /**
56 * @brief Construct a date equal to epoch. 58 * @brief Construct a date equal to the source date.
57 */ 59 */
58 LLDate(const LLDate& date); 60 LLDate(const LLDate& date);
59 61
@@ -111,12 +113,45 @@ public:
111 * @param seconds The number of seconds since epoch UTC. 113 * @param seconds The number of seconds since epoch UTC.
112 */ 114 */
113 void secondsSinceEpoch(F64 seconds); 115 void secondsSinceEpoch(F64 seconds);
116
117 /**
118 * @brief Create an LLDate object set to the current time.
119 *
120 * @return The number of seconds since epoch UTC.
121 */
122 static LLDate now();
123
124 /**
125 * @brief Compare dates using operator< so we can order them using STL.
126 *
127 * @param rhs -- the right hand side of the comparison operator
128 */
129 bool operator<(const LLDate& rhs) const;
130
131 /**
132 * @brief Remaining comparison operators in terms of operator<
133 * This conforms to the expectation of STL.
134 *
135 * @param rhs -- the right hand side of the comparison operator
136 */
137 bool operator>(const LLDate& rhs) const { return rhs < *this; }
138 bool operator<=(const LLDate& rhs) const { return !(rhs < *this); }
139 bool operator>=(const LLDate& rhs) const { return !(*this < rhs); }
140 bool operator!=(const LLDate& rhs) const { return (*this < rhs) || (rhs < *this); }
141 bool operator==(const LLDate& rhs) const { return !(*this != rhs); }
142
143 /**
144 * @brief Compare to epoch UTC.
145 */
146
147 bool isNull() const { return mSecondsSinceEpoch == 0.0; }
148 bool notNull() const { return mSecondsSinceEpoch != 0.0; }
149
114 150
115private: 151private:
116 F64 mSecondsSinceEpoch; 152 F64 mSecondsSinceEpoch;
117}; 153};
118 154
119
120// Helper function to stream out a date 155// Helper function to stream out a date
121std::ostream& operator<<(std::ostream& s, const LLDate& date); 156std::ostream& operator<<(std::ostream& s, const LLDate& date);
122 157
diff --git a/linden/indra/llcommon/lldefs.h b/linden/indra/llcommon/lldefs.h
index c0ff00b..f3b5ca3 100644
--- a/linden/indra/llcommon/lldefs.h
+++ b/linden/indra/llcommon/lldefs.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/lldepthstack.h b/linden/indra/llcommon/lldepthstack.h
index c099f13..accc11f 100644
--- a/linden/indra/llcommon/lldepthstack.h
+++ b/linden/indra/llcommon/lldepthstack.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/lldlinked.h b/linden/indra/llcommon/lldlinked.h
index 0d8e812..8b68532 100644
--- a/linden/indra/llcommon/lldlinked.h
+++ b/linden/indra/llcommon/lldlinked.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/lldqueueptr.h b/linden/indra/llcommon/lldqueueptr.h
index eede159..77df47b 100644
--- a/linden/indra/llcommon/lldqueueptr.h
+++ b/linden/indra/llcommon/lldqueueptr.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/llendianswizzle.h b/linden/indra/llcommon/llendianswizzle.h
index f119a5b..043d330 100644
--- a/linden/indra/llcommon/llendianswizzle.h
+++ b/linden/indra/llcommon/llendianswizzle.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/llenum.h b/linden/indra/llcommon/llenum.h
index a93eb31..ac6d46b 100644
--- a/linden/indra/llcommon/llenum.h
+++ b/linden/indra/llcommon/llenum.h
@@ -18,7 +18,8 @@
18 * There are special exceptions to the terms and conditions of the GPL as 18 * There are special exceptions to the terms and conditions of the GPL as
19 * it is applied to this Source Code. View the full text of the exception 19 * it is applied to this Source Code. View the full text of the exception
20 * in the file doc/FLOSS-exception.txt in this software distribution, or 20 * in the file doc/FLOSS-exception.txt in this software distribution, or
21 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 21 * online at
22 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 * 23 *
23 * By copying, modifying or distributing this software, you acknowledge 24 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above, 25 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/llerror.cpp b/linden/indra/llcommon/llerror.cpp
index cf4b341..30b61a9 100644
--- a/linden/indra/llcommon/llerror.cpp
+++ b/linden/indra/llcommon/llerror.cpp
@@ -18,7 +18,8 @@
18 * There are special exceptions to the terms and conditions of the GPL as 18 * There are special exceptions to the terms and conditions of the GPL as
19 * it is applied to this Source Code. View the full text of the exception 19 * it is applied to this Source Code. View the full text of the exception
20 * in the file doc/FLOSS-exception.txt in this software distribution, or 20 * in the file doc/FLOSS-exception.txt in this software distribution, or
21 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 21 * online at
22 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 * 23 *
23 * By copying, modifying or distributing this software, you acknowledge 24 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above, 25 * that you have read and understood your obligations described above,
@@ -987,6 +988,38 @@ namespace LLError
987 988
988 return new std::ostringstream; 989 return new std::ostringstream;
989 } 990 }
991
992 void Log::flush(std::ostringstream* out, char* message)
993 {
994 LogLock lock;
995 if (!lock.ok())
996 {
997 return;
998 }
999
1000 if(strlen(out->str().c_str()) < 128)
1001 {
1002 strcpy(message, out->str().c_str());
1003 }
1004 else
1005 {
1006 strncpy(message, out->str().c_str(), 127);
1007 message[127] = '\0' ;
1008 }
1009
1010 Globals& g = Globals::get();
1011 if (out == &g.messageStream)
1012 {
1013 g.messageStream.clear();
1014 g.messageStream.str("");
1015 g.messageStreamInUse = false;
1016 }
1017 else
1018 {
1019 delete out;
1020 }
1021 return ;
1022 }
990 1023
991 void Log::flush(std::ostringstream* out, const CallSite& site) 1024 void Log::flush(std::ostringstream* out, const CallSite& site)
992 { 1025 {
@@ -1202,3 +1235,159 @@ namespace LLError
1202 } 1235 }
1203} 1236}
1204 1237
1238namespace LLError
1239{
1240 char** LLCallStacks::sBuffer = NULL ;
1241 S32 LLCallStacks::sIndex = 0 ;
1242
1243 class CallStacksLogLock
1244 {
1245 public:
1246 CallStacksLogLock();
1247 ~CallStacksLogLock();
1248 bool ok() const { return mOK; }
1249 private:
1250 bool mLocked;
1251 bool mOK;
1252 };
1253
1254 CallStacksLogLock::CallStacksLogLock()
1255 : mLocked(false), mOK(false)
1256 {
1257 if (!gCallStacksLogMutexp)
1258 {
1259 mOK = true;
1260 return;
1261 }
1262
1263 const int MAX_RETRIES = 5;
1264 for (int attempts = 0; attempts < MAX_RETRIES; ++attempts)
1265 {
1266 apr_status_t s = apr_thread_mutex_trylock(gCallStacksLogMutexp);
1267 if (!APR_STATUS_IS_EBUSY(s))
1268 {
1269 mLocked = true;
1270 mOK = true;
1271 return;
1272 }
1273
1274 ms_sleep(1);
1275 }
1276
1277 // We're hosed, we can't get the mutex. Blah.
1278 std::cerr << "CallStacksLogLock::CallStacksLogLock: failed to get mutex for log"
1279 << std::endl;
1280 }
1281
1282 CallStacksLogLock::~CallStacksLogLock()
1283 {
1284 if (mLocked)
1285 {
1286 apr_thread_mutex_unlock(gCallStacksLogMutexp);
1287 }
1288 }
1289
1290 //static
1291 void LLCallStacks::push(const char* function, const int line)
1292 {
1293 CallStacksLogLock lock;
1294 if (!lock.ok())
1295 {
1296 return;
1297 }
1298
1299 if(!sBuffer)
1300 {
1301 sBuffer = new char*[512] ;
1302 sBuffer[0] = new char[512 * 128] ;
1303 for(S32 i = 1 ; i < 512 ; i++)
1304 {
1305 sBuffer[i] = sBuffer[i-1] + 128 ;
1306 }
1307 sIndex = 0 ;
1308 }
1309
1310 if(sIndex > 511)
1311 {
1312 clear() ;
1313 }
1314
1315 strcpy(sBuffer[sIndex], function) ;
1316 sprintf(sBuffer[sIndex] + strlen(function), " line: %d ", line) ;
1317 sIndex++ ;
1318
1319 return ;
1320 }
1321
1322 //static
1323 std::ostringstream* LLCallStacks::insert(const char* function, const int line)
1324 {
1325 std::ostringstream* _out = LLError::Log::out();
1326 *_out << function << " line " << line << " " ;
1327
1328 return _out ;
1329 }
1330
1331 //static
1332 void LLCallStacks::end(std::ostringstream* _out)
1333 {
1334 CallStacksLogLock lock;
1335 if (!lock.ok())
1336 {
1337 return;
1338 }
1339
1340 if(!sBuffer)
1341 {
1342 sBuffer = new char*[512] ;
1343 sBuffer[0] = new char[512 * 128] ;
1344 for(S32 i = 1 ; i < 512 ; i++)
1345 {
1346 sBuffer[i] = sBuffer[i-1] + 128 ;
1347 }
1348 sIndex = 0 ;
1349 }
1350
1351 if(sIndex > 511)
1352 {
1353 clear() ;
1354 }
1355
1356 LLError::Log::flush(_out, sBuffer[sIndex++]) ;
1357 }
1358
1359 //static
1360 void LLCallStacks::print()
1361 {
1362 CallStacksLogLock lock;
1363 if (!lock.ok())
1364 {
1365 return;
1366 }
1367
1368 if(sIndex > 0)
1369 {
1370 llinfos << " ************* PRINT OUT LL CALL STACKS ************* " << llendl ;
1371 while(sIndex > 0)
1372 {
1373 sIndex-- ;
1374 llinfos << sBuffer[sIndex] << llendl ;
1375 }
1376 llinfos << " *************** END OF LL CALL STACKS *************** " << llendl ;
1377 }
1378
1379 if(sBuffer)
1380 {
1381 delete[] sBuffer[0] ;
1382 delete[] sBuffer ;
1383 sBuffer = NULL ;
1384 }
1385 }
1386
1387 //static
1388 void LLCallStacks::clear()
1389 {
1390 sIndex = 0 ;
1391 }
1392}
1393
diff --git a/linden/indra/llcommon/llerror.h b/linden/indra/llcommon/llerror.h
index 211f89f..6794be4 100644
--- a/linden/indra/llcommon/llerror.h
+++ b/linden/indra/llcommon/llerror.h
@@ -18,7 +18,8 @@
18 * There are special exceptions to the terms and conditions of the GPL as 18 * There are special exceptions to the terms and conditions of the GPL as
19 * it is applied to this Source Code. View the full text of the exception 19 * it is applied to this Source Code. View the full text of the exception
20 * in the file doc/FLOSS-exception.txt in this software distribution, or 20 * in the file doc/FLOSS-exception.txt in this software distribution, or
21 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 21 * online at
22 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 * 23 *
23 * By copying, modifying or distributing this software, you acknowledge 24 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above, 25 * that you have read and understood your obligations described above,
@@ -37,6 +38,7 @@
37#include <typeinfo> 38#include <typeinfo>
38 39
39#include "llerrorlegacy.h" 40#include "llerrorlegacy.h"
41#include "stdtypes.h"
40 42
41 43
42/* Error Logging Facility 44/* Error Logging Facility
@@ -134,6 +136,7 @@ namespace LLError
134 public: 136 public:
135 static bool shouldLog(CallSite&); 137 static bool shouldLog(CallSite&);
136 static std::ostringstream* out(); 138 static std::ostringstream* out();
139 static void flush(std::ostringstream* out, char* message) ;
137 static void flush(std::ostringstream*, const CallSite&); 140 static void flush(std::ostringstream*, const CallSite&);
138 }; 141 };
139 142
@@ -178,9 +181,41 @@ namespace LLError
178 181
179 class NoClassInfo { }; 182 class NoClassInfo { };
180 // used to indicate no class info known for logging 183 // used to indicate no class info known for logging
181}
182 184
185 //LLCallStacks keeps track of call stacks and output the call stacks to log file
186 //when LLAppViewer::handleViewerCrash() is triggered.
187 //
188 //Note: to be simple, efficient and necessary to keep track of correct call stacks,
189 //LLCallStacks is designed not to be thread-safe.
190 //so try not to use it in multiple parallel threads at same time.
191 //Used in a single thread at a time is fine.
192 class LLCallStacks
193 {
194 private:
195 static char** sBuffer ;
196 static S32 sIndex ;
197
198 public:
199 static void push(const char* function, const int line) ;
200 static std::ostringstream* insert(const char* function, const int line) ;
201 static void print() ;
202 static void clear() ;
203 static void end(std::ostringstream* _out) ;
204 };
205}
183 206
207//this is cheaper than llcallstacks if no need to output other variables to call stacks.
208#define llpushcallstacks LLError::LLCallStacks::push(__FUNCTION__, __LINE__)
209#define llcallstacks \
210 {\
211 std::ostringstream* _out = LLError::LLCallStacks::insert(__FUNCTION__, __LINE__) ; \
212 (*_out)
213#define llcallstacksendl \
214 LLError::End(); \
215 LLError::LLCallStacks::end(_out) ; \
216 }
217#define llclearcallstacks LLError::LLCallStacks::clear()
218#define llprintcallstacks LLError::LLCallStacks::print()
184 219
185/* 220/*
186 Class type information for logging 221 Class type information for logging
diff --git a/linden/indra/llcommon/llerrorcontrol.h b/linden/indra/llcommon/llerrorcontrol.h
index 9888444..a55d706 100644
--- a/linden/indra/llcommon/llerrorcontrol.h
+++ b/linden/indra/llcommon/llerrorcontrol.h
@@ -18,7 +18,8 @@
18 * There are special exceptions to the terms and conditions of the GPL as 18 * There are special exceptions to the terms and conditions of the GPL as
19 * it is applied to this Source Code. View the full text of the exception 19 * it is applied to this Source Code. View the full text of the exception
20 * in the file doc/FLOSS-exception.txt in this software distribution, or 20 * in the file doc/FLOSS-exception.txt in this software distribution, or
21 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 21 * online at
22 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 * 23 *
23 * By copying, modifying or distributing this software, you acknowledge 24 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above, 25 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/llerrorlegacy.h b/linden/indra/llcommon/llerrorlegacy.h
index 71cec83..143fe20 100644
--- a/linden/indra/llcommon/llerrorlegacy.h
+++ b/linden/indra/llcommon/llerrorlegacy.h
@@ -18,7 +18,8 @@
18 * There are special exceptions to the terms and conditions of the GPL as 18 * There are special exceptions to the terms and conditions of the GPL as
19 * it is applied to this Source Code. View the full text of the exception 19 * it is applied to this Source Code. View the full text of the exception
20 * in the file doc/FLOSS-exception.txt in this software distribution, or 20 * in the file doc/FLOSS-exception.txt in this software distribution, or
21 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 21 * online at
22 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 * 23 *
23 * By copying, modifying or distributing this software, you acknowledge 24 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above, 25 * that you have read and understood your obligations described above,
@@ -52,6 +53,7 @@ const int LL_ERR_FILE_NOT_FOUND = -43;
52const int LL_ERR_FILE_EMPTY = -44; 53const int LL_ERR_FILE_EMPTY = -44;
53const int LL_ERR_TCP_TIMEOUT = -23016; 54const int LL_ERR_TCP_TIMEOUT = -23016;
54const int LL_ERR_CIRCUIT_GONE = -23017; 55const int LL_ERR_CIRCUIT_GONE = -23017;
56const int LL_ERR_PRICE_MISMATCH = -23018;
55 57
56 58
57 59
diff --git a/linden/indra/llcommon/llerrorthread.cpp b/linden/indra/llcommon/llerrorthread.cpp
index d3e522d..4c779c5 100644
--- a/linden/indra/llcommon/llerrorthread.cpp
+++ b/linden/indra/llcommon/llerrorthread.cpp
@@ -16,7 +16,8 @@
16 * There are special exceptions to the terms and conditions of the GPL as 16 * There are special exceptions to the terms and conditions of the GPL as
17 * it is applied to this Source Code. View the full text of the exception 17 * it is applied to this Source Code. View the full text of the exception
18 * in the file doc/FLOSS-exception.txt in this software distribution, or 18 * in the file doc/FLOSS-exception.txt in this software distribution, or
19 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 19 * online at
20 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
20 * 21 *
21 * By copying, modifying or distributing this software, you acknowledge 22 * By copying, modifying or distributing this software, you acknowledge
22 * that you have read and understood your obligations described above, 23 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/llerrorthread.h b/linden/indra/llcommon/llerrorthread.h
index 56d2a23..f1d6ffc 100644
--- a/linden/indra/llcommon/llerrorthread.h
+++ b/linden/indra/llcommon/llerrorthread.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/llevent.cpp b/linden/indra/llcommon/llevent.cpp
index 8b81837..24be6e8 100644
--- a/linden/indra/llcommon/llevent.cpp
+++ b/linden/indra/llcommon/llevent.cpp
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/llevent.h b/linden/indra/llcommon/llevent.h
index 3b20a61..60887a0 100644
--- a/linden/indra/llcommon/llevent.h
+++ b/linden/indra/llcommon/llevent.h
@@ -18,7 +18,8 @@
18 * There are special exceptions to the terms and conditions of the GPL as 18 * There are special exceptions to the terms and conditions of the GPL as
19 * it is applied to this Source Code. View the full text of the exception 19 * it is applied to this Source Code. View the full text of the exception
20 * in the file doc/FLOSS-exception.txt in this software distribution, or 20 * in the file doc/FLOSS-exception.txt in this software distribution, or
21 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 21 * online at
22 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 * 23 *
23 * By copying, modifying or distributing this software, you acknowledge 24 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above, 25 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/lleventemitter.h b/linden/indra/llcommon/lleventemitter.h
index e3f143b..2d15b01 100644
--- a/linden/indra/llcommon/lleventemitter.h
+++ b/linden/indra/llcommon/lleventemitter.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/llextendedstatus.h b/linden/indra/llcommon/llextendedstatus.h
index 56cd872..4f954ff 100644
--- a/linden/indra/llcommon/llextendedstatus.h
+++ b/linden/indra/llcommon/llextendedstatus.h
@@ -18,7 +18,8 @@
18 * There are special exceptions to the terms and conditions of the GPL as 18 * There are special exceptions to the terms and conditions of the GPL as
19 * it is applied to this Source Code. View the full text of the exception 19 * it is applied to this Source Code. View the full text of the exception
20 * in the file doc/FLOSS-exception.txt in this software distribution, or 20 * in the file doc/FLOSS-exception.txt in this software distribution, or
21 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 21 * online at
22 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 * 23 *
23 * By copying, modifying or distributing this software, you acknowledge 24 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above, 25 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/llfasttimer.cpp b/linden/indra/llcommon/llfasttimer.cpp
index 3304528..cdaadb0 100644
--- a/linden/indra/llcommon/llfasttimer.cpp
+++ b/linden/indra/llcommon/llfasttimer.cpp
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
@@ -48,6 +49,8 @@
48////////////////////////////////////////////////////////////////////////////// 49//////////////////////////////////////////////////////////////////////////////
49// statics 50// statics
50 51
52
53LLFastTimer::EFastTimerType LLFastTimer::sCurType = LLFastTimer::FTM_OTHER;
51int LLFastTimer::sCurDepth = 0; 54int LLFastTimer::sCurDepth = 0;
52U64 LLFastTimer::sStart[LLFastTimer::FTM_MAX_DEPTH]; 55U64 LLFastTimer::sStart[LLFastTimer::FTM_MAX_DEPTH];
53U64 LLFastTimer::sCounter[LLFastTimer::FTM_NUM_TYPES]; 56U64 LLFastTimer::sCounter[LLFastTimer::FTM_NUM_TYPES];
diff --git a/linden/indra/llcommon/llfasttimer.h b/linden/indra/llcommon/llfasttimer.h
index a32da18..94b5111 100644
--- a/linden/indra/llcommon/llfasttimer.h
+++ b/linden/indra/llcommon/llfasttimer.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
@@ -70,6 +71,14 @@ public:
70 FTM_UPDATE_AVATAR, 71 FTM_UPDATE_AVATAR,
71 72
72 // common render components 73 // common render components
74 FTM_SHADOW_GEOMETRY,
75 FTM_SHADOW_RENDER,
76 FTM_SHADOW_TERRAIN,
77 FTM_SHADOW_AVATAR,
78 FTM_SHADOW_SIMPLE,
79 FTM_SHADOW_ALPHA,
80 FTM_SHADOW_TREE,
81
73 FTM_RENDER_GEOMETRY, 82 FTM_RENDER_GEOMETRY,
74 FTM_RENDER_TERRAIN, 83 FTM_RENDER_TERRAIN,
75 FTM_RENDER_SIMPLE, 84 FTM_RENDER_SIMPLE,
@@ -185,11 +194,13 @@ public:
185 enum { FTM_MAX_DEPTH = 64 }; 194 enum { FTM_MAX_DEPTH = 64 };
186 195
187public: 196public:
197 static LLFastTimer::EFastTimerType sCurType;
198
188 LLFastTimer(EFastTimerType type) 199 LLFastTimer(EFastTimerType type)
189 { 200 {
190#if FAST_TIMER_ON 201#if FAST_TIMER_ON
191 mType = type; 202 mType = type;
192 203 sCurType = type;
193 // These don't get counted, because they use CPU clockticks 204 // These don't get counted, because they use CPU clockticks
194 //gTimerBins[gCurTimerBin]++; 205 //gTimerBins[gCurTimerBin]++;
195 //LLTimer::sNumTimerCalls++; 206 //LLTimer::sNumTimerCalls++;
diff --git a/linden/indra/llcommon/llfile.cpp b/linden/indra/llcommon/llfile.cpp
index 7395d24..2a76f7f 100644
--- a/linden/indra/llcommon/llfile.cpp
+++ b/linden/indra/llcommon/llfile.cpp
@@ -20,7 +20,8 @@
20 * There are special exceptions to the terms and conditions of the GPL as 20 * There are special exceptions to the terms and conditions of the GPL as
21 * it is applied to this Source Code. View the full text of the exception 21 * it is applied to this Source Code. View the full text of the exception
22 * in the file doc/FLOSS-exception.txt in this software distribution, or 22 * in the file doc/FLOSS-exception.txt in this software distribution, or
23 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 23 * online at
24 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
24 * 25 *
25 * By copying, modifying or distributing this software, you acknowledge 26 * By copying, modifying or distributing this software, you acknowledge
26 * that you have read and understood your obligations described above, 27 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/llfile.h b/linden/indra/llcommon/llfile.h
index d0a0b8e..c6092f7 100644
--- a/linden/indra/llcommon/llfile.h
+++ b/linden/indra/llcommon/llfile.h
@@ -20,7 +20,8 @@
20 * There are special exceptions to the terms and conditions of the GPL as 20 * There are special exceptions to the terms and conditions of the GPL as
21 * it is applied to this Source Code. View the full text of the exception 21 * it is applied to this Source Code. View the full text of the exception
22 * in the file doc/FLOSS-exception.txt in this software distribution, or 22 * in the file doc/FLOSS-exception.txt in this software distribution, or
23 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 23 * online at
24 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
24 * 25 *
25 * By copying, modifying or distributing this software, you acknowledge 26 * By copying, modifying or distributing this software, you acknowledge
26 * that you have read and understood your obligations described above, 27 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/llfindlocale.cpp b/linden/indra/llcommon/llfindlocale.cpp
index c0d4aff..505f5c5 100644
--- a/linden/indra/llcommon/llfindlocale.cpp
+++ b/linden/indra/llcommon/llfindlocale.cpp
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
@@ -416,10 +417,8 @@ static const IDToCode primary_to_code[] = {
416/*{LANG_WALON, "wa"},*/ 417/*{LANG_WALON, "wa"},*/
417 {LANG_CHINESE, "zh"}, 418 {LANG_CHINESE, "zh"},
418}; 419};
419static int num_primary_to_code = 420static int num_primary_to_code = LL_ARRAY_SIZE(primary_to_code);
420 sizeof(primary_to_code) / sizeof(*primary_to_code); 421static int num_both_to_code = LL_ARRAY_SIZE(both_to_code);
421static int num_both_to_code =
422 sizeof(both_to_code) / sizeof(*both_to_code);
423 422
424static const int 423static const int
425lcid_to_fl(LCID lcid, 424lcid_to_fl(LCID lcid,
diff --git a/linden/indra/llcommon/llfindlocale.h b/linden/indra/llcommon/llfindlocale.h
index 56ec976..f17c774 100644
--- a/linden/indra/llcommon/llfindlocale.h
+++ b/linden/indra/llcommon/llfindlocale.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/llfixedbuffer.cpp b/linden/indra/llcommon/llfixedbuffer.cpp
index a819150..e9d6029 100644
--- a/linden/indra/llcommon/llfixedbuffer.cpp
+++ b/linden/indra/llcommon/llfixedbuffer.cpp
@@ -16,7 +16,8 @@
16 * There are special exceptions to the terms and conditions of the GPL as 16 * There are special exceptions to the terms and conditions of the GPL as
17 * it is applied to this Source Code. View the full text of the exception 17 * it is applied to this Source Code. View the full text of the exception
18 * in the file doc/FLOSS-exception.txt in this software distribution, or 18 * in the file doc/FLOSS-exception.txt in this software distribution, or
19 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 19 * online at
20 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
20 * 21 *
21 * By copying, modifying or distributing this software, you acknowledge 22 * By copying, modifying or distributing this software, you acknowledge
22 * that you have read and understood your obligations described above, 23 * that you have read and understood your obligations described above,
@@ -32,6 +33,7 @@
32#include "llfixedbuffer.h" 33#include "llfixedbuffer.h"
33 34
34LLFixedBuffer::LLFixedBuffer(const U32 max_lines) 35LLFixedBuffer::LLFixedBuffer(const U32 max_lines)
36 : mMutex(NULL)
35{ 37{
36 mMaxLines = max_lines; 38 mMaxLines = max_lines;
37 mTimer.reset(); 39 mTimer.reset();
@@ -46,9 +48,11 @@ LLFixedBuffer::~LLFixedBuffer()
46 48
47void LLFixedBuffer::clear() 49void LLFixedBuffer::clear()
48{ 50{
51 mMutex.lock() ;
49 mLines.clear(); 52 mLines.clear();
50 mAddTimes.clear(); 53 mAddTimes.clear();
51 mLineLengths.clear(); 54 mLineLengths.clear();
55 mMutex.unlock() ;
52 56
53 mTimer.reset(); 57 mTimer.reset();
54} 58}
@@ -69,9 +73,11 @@ void LLFixedBuffer::addLine(const LLWString& line)
69 73
70 removeExtraLines(); 74 removeExtraLines();
71 75
76 mMutex.lock() ;
72 mLines.push_back(line); 77 mLines.push_back(line);
73 mLineLengths.push_back((S32)line.length()); 78 mLineLengths.push_back((S32)line.length());
74 mAddTimes.push_back(mTimer.getElapsedTimeF32()); 79 mAddTimes.push_back(mTimer.getElapsedTimeF32());
80 mMutex.unlock() ;
75} 81}
76 82
77 83
@@ -85,10 +91,12 @@ void LLFixedBuffer::setMaxLines(S32 max_lines)
85 91
86void LLFixedBuffer::removeExtraLines() 92void LLFixedBuffer::removeExtraLines()
87{ 93{
94 mMutex.lock() ;
88 while ((S32)mLines.size() > llmax((S32)0, (S32)(mMaxLines - 1))) 95 while ((S32)mLines.size() > llmax((S32)0, (S32)(mMaxLines - 1)))
89 { 96 {
90 mLines.pop_front(); 97 mLines.pop_front();
91 mAddTimes.pop_front(); 98 mAddTimes.pop_front();
92 mLineLengths.pop_front(); 99 mLineLengths.pop_front();
93 } 100 }
101 mMutex.unlock() ;
94} 102}
diff --git a/linden/indra/llcommon/llfixedbuffer.h b/linden/indra/llcommon/llfixedbuffer.h
index dcd4dfb..992a024 100644
--- a/linden/indra/llcommon/llfixedbuffer.h
+++ b/linden/indra/llcommon/llfixedbuffer.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
@@ -36,6 +37,7 @@
36#include <deque> 37#include <deque>
37#include <string> 38#include <string>
38#include "llstring.h" 39#include "llstring.h"
40#include "llthread.h"
39 41
40// Fixed size buffer for console output and other things. 42// Fixed size buffer for console output and other things.
41 43
@@ -52,14 +54,19 @@ public:
52 std::deque<S32> mLineLengths; 54 std::deque<S32> mLineLengths;
53 55
54 void clear(); // Clear the buffer, and reset it. 56 void clear(); // Clear the buffer, and reset it.
55 virtual void addLine(const std::string& utf8line); 57
56 virtual void addLine(const LLWString& line); 58 //do not make these two "virtual"
59 void addLine(const std::string& utf8line);
60 void addLine(const LLWString& line);
57 61
58 // Get lines currently in the buffer, up to max_size chars, max_length lines 62 // Get lines currently in the buffer, up to max_size chars, max_length lines
59 char *getLines(U32 max_size = 0, U32 max_length = 0); 63 char *getLines(U32 max_size = 0, U32 max_length = 0);
60 void setMaxLines(S32 max_lines); 64 void setMaxLines(S32 max_lines);
61protected: 65protected:
62 virtual void removeExtraLines(); 66 virtual void removeExtraLines();
67
68protected:
69 LLMutex mMutex ;
63}; 70};
64 71
65const U32 FIXED_BUF_MAX_LINE_LEN = 255; // Not including termnating 0 72const U32 FIXED_BUF_MAX_LINE_LEN = 255; // Not including termnating 0
diff --git a/linden/indra/llcommon/llformat.cpp b/linden/indra/llcommon/llformat.cpp
index 4a9fce6..cf509be 100644
--- a/linden/indra/llcommon/llformat.cpp
+++ b/linden/indra/llcommon/llformat.cpp
@@ -18,7 +18,8 @@
18 * There are special exceptions to the terms and conditions of the GPL as 18 * There are special exceptions to the terms and conditions of the GPL as
19 * it is applied to this Source Code. View the full text of the exception 19 * it is applied to this Source Code. View the full text of the exception
20 * in the file doc/FLOSS-exception.txt in this software distribution, or 20 * in the file doc/FLOSS-exception.txt in this software distribution, or
21 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 21 * online at
22 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 * 23 *
23 * By copying, modifying or distributing this software, you acknowledge 24 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above, 25 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/llformat.h b/linden/indra/llcommon/llformat.h
index a29afcc..44c62d9 100644
--- a/linden/indra/llcommon/llformat.h
+++ b/linden/indra/llcommon/llformat.h
@@ -18,7 +18,8 @@
18 * There are special exceptions to the terms and conditions of the GPL as 18 * There are special exceptions to the terms and conditions of the GPL as
19 * it is applied to this Source Code. View the full text of the exception 19 * it is applied to this Source Code. View the full text of the exception
20 * in the file doc/FLOSS-exception.txt in this software distribution, or 20 * in the file doc/FLOSS-exception.txt in this software distribution, or
21 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 21 * online at
22 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 * 23 *
23 * By copying, modifying or distributing this software, you acknowledge 24 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above, 25 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/llframetimer.cpp b/linden/indra/llcommon/llframetimer.cpp
index aca1ec5..138c67a 100644
--- a/linden/indra/llcommon/llframetimer.cpp
+++ b/linden/indra/llcommon/llframetimer.cpp
@@ -16,7 +16,8 @@
16 * There are special exceptions to the terms and conditions of the GPL as 16 * There are special exceptions to the terms and conditions of the GPL as
17 * it is applied to this Source Code. View the full text of the exception 17 * it is applied to this Source Code. View the full text of the exception
18 * in the file doc/FLOSS-exception.txt in this software distribution, or 18 * in the file doc/FLOSS-exception.txt in this software distribution, or
19 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 19 * online at
20 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
20 * 21 *
21 * By copying, modifying or distributing this software, you acknowledge 22 * By copying, modifying or distributing this software, you acknowledge
22 * that you have read and understood your obligations described above, 23 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/llframetimer.h b/linden/indra/llcommon/llframetimer.h
index fa88af6..8f51272 100644
--- a/linden/indra/llcommon/llframetimer.h
+++ b/linden/indra/llcommon/llframetimer.h
@@ -18,7 +18,8 @@
18 * There are special exceptions to the terms and conditions of the GPL as 18 * There are special exceptions to the terms and conditions of the GPL as
19 * it is applied to this Source Code. View the full text of the exception 19 * it is applied to this Source Code. View the full text of the exception
20 * in the file doc/FLOSS-exception.txt in this software distribution, or 20 * in the file doc/FLOSS-exception.txt in this software distribution, or
21 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 21 * online at
22 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 * 23 *
23 * By copying, modifying or distributing this software, you acknowledge 24 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above, 25 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/llhash.h b/linden/indra/llcommon/llhash.h
index 0344d63..0ce1088 100644
--- a/linden/indra/llcommon/llhash.h
+++ b/linden/indra/llcommon/llhash.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
@@ -53,15 +54,20 @@
53#error Please define your platform. 54#error Please define your platform.
54#endif 55#endif
55 56
56template<class T> inline size_t llhash(T value) 57// Warning - an earlier template-based version of this routine did not do
57{ 58// the correct thing on Windows. Since this is only used to get
59// a string hash, it was converted to a regular routine and
60// unit tests added.
61
62inline size_t llhash( const char * value )
63{
58#if LL_WINDOWS 64#if LL_WINDOWS
59 return stdext::hash_value<T>(value); 65 return stdext::hash_value(value);
60#elif ( (defined _STLPORT_VERSION) || ((LL_LINUX) && (__GNUC__ <= 2)) ) 66#elif ( (defined _STLPORT_VERSION) || ((LL_LINUX) && (__GNUC__ <= 2)) )
61 std::hash<T> H; 67 std::hash<const char *> H;
62 return H(value); 68 return H(value);
63#elif LL_DARWIN || LL_LINUX || LL_SOLARIS 69#elif LL_DARWIN || LL_LINUX || LL_SOLARIS
64 __gnu_cxx::hash<T> H; 70 __gnu_cxx::hash<const char *> H;
65 return H(value); 71 return H(value);
66#else 72#else
67#error Please define your platform. 73#error Please define your platform.
diff --git a/linden/indra/llcommon/llheartbeat.cpp b/linden/indra/llcommon/llheartbeat.cpp
index 0777ac3..49c0ad5 100644
--- a/linden/indra/llcommon/llheartbeat.cpp
+++ b/linden/indra/llcommon/llheartbeat.cpp
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/llheartbeat.h b/linden/indra/llcommon/llheartbeat.h
index 7cfdda6..fecb5b1 100644
--- a/linden/indra/llcommon/llheartbeat.h
+++ b/linden/indra/llcommon/llheartbeat.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/llhttpstatuscodes.h b/linden/indra/llcommon/llhttpstatuscodes.h
index 9f625a0..83dde17 100644
--- a/linden/indra/llcommon/llhttpstatuscodes.h
+++ b/linden/indra/llcommon/llhttpstatuscodes.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/llindexedqueue.h b/linden/indra/llcommon/llindexedqueue.h
index d41da6b..1b80e6e 100644
--- a/linden/indra/llcommon/llindexedqueue.h
+++ b/linden/indra/llcommon/llindexedqueue.h
@@ -18,7 +18,8 @@
18 * There are special exceptions to the terms and conditions of the GPL as 18 * There are special exceptions to the terms and conditions of the GPL as
19 * it is applied to this Source Code. View the full text of the exception 19 * it is applied to this Source Code. View the full text of the exception
20 * in the file doc/FLOSS-exception.txt in this software distribution, or 20 * in the file doc/FLOSS-exception.txt in this software distribution, or
21 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 21 * online at
22 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 * 23 *
23 * By copying, modifying or distributing this software, you acknowledge 24 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above, 25 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/llindraconfigfile.cpp b/linden/indra/llcommon/llindraconfigfile.cpp
index d64bc8f..ca63e28 100644
--- a/linden/indra/llcommon/llindraconfigfile.cpp
+++ b/linden/indra/llcommon/llindraconfigfile.cpp
@@ -5,16 +5,27 @@
5 * This class is an LLLiveFile that has config info for indra 5 * This class is an LLLiveFile that has config info for indra
6 * Currently only whether it's blacklisted 6 * Currently only whether it's blacklisted
7 * 7 *
8 * $LicenseInfo:firstyear=2007&license=internal$ 8 * $LicenseInfo:firstyear=2007&license=viewergpl$
9 * 9 *
10 * Copyright (c) 2007-2009, Linden Research, Inc. 10 * Copyright (c) 2007-2009, Linden Research, Inc.
11 * 11 *
12 * The following source code is PROPRIETARY AND CONFIDENTIAL. Use of 12 * Second Life Viewer Source Code
13 * this source code is governed by the Linden Lab Source Code Disclosure 13 * The source code in this file ("Source Code") is provided by Linden Lab
14 * Agreement ("Agreement") previously entered between you and Linden 14 * to you under the terms of the GNU General Public License, version 2.0
15 * Lab. By accessing, using, copying, modifying or distributing this 15 * ("GPL"), unless you have obtained a separate licensing agreement
16 * software, you acknowledge that you have been informed of your 16 * ("Other License"), formally executed by you and Linden Lab. Terms of
17 * obligations under the Agreement and agree to abide by those obligations. 17 * the GPL can be found in doc/GPL-license.txt in this distribution, or
18 * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
19 *
20 * There are special exceptions to the terms and conditions of the GPL as
21 * it is applied to this Source Code. View the full text of the exception
22 * in the file doc/FLOSS-exception.txt in this software distribution, or
23 * online at
24 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
25 *
26 * By copying, modifying or distributing this software, you acknowledge
27 * that you have read and understood your obligations described above,
28 * and agree to abide by those obligations.
18 * 29 *
19 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO 30 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
20 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, 31 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
diff --git a/linden/indra/llcommon/llindraconfigfile.h b/linden/indra/llcommon/llindraconfigfile.h
index c426276..232e408 100644
--- a/linden/indra/llcommon/llindraconfigfile.h
+++ b/linden/indra/llcommon/llindraconfigfile.h
@@ -2,16 +2,27 @@
2 * @file llindraconfigfile.h 2 * @file llindraconfigfile.h
3 * @brief manages configuration file for indra.xml 3 * @brief manages configuration file for indra.xml
4 * 4 *
5 * $LicenseInfo:firstyear=2007&license=internal$ 5 * $LicenseInfo:firstyear=2007&license=viewergpl$
6 * 6 *
7 * Copyright (c) 2007-2009, Linden Research, Inc. 7 * Copyright (c) 2007-2009, Linden Research, Inc.
8 * 8 *
9 * The following source code is PROPRIETARY AND CONFIDENTIAL. Use of 9 * Second Life Viewer Source Code
10 * this source code is governed by the Linden Lab Source Code Disclosure 10 * The source code in this file ("Source Code") is provided by Linden Lab
11 * Agreement ("Agreement") previously entered between you and Linden 11 * to you under the terms of the GNU General Public License, version 2.0
12 * Lab. By accessing, using, copying, modifying or distributing this 12 * ("GPL"), unless you have obtained a separate licensing agreement
13 * software, you acknowledge that you have been informed of your 13 * ("Other License"), formally executed by you and Linden Lab. Terms of
14 * obligations under the Agreement and agree to abide by those obligations. 14 * the GPL can be found in doc/GPL-license.txt in this distribution, or
15 * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
16 *
17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 *
23 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above,
25 * and agree to abide by those obligations.
15 * 26 *
16 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO 27 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
17 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, 28 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
diff --git a/linden/indra/llcommon/llkeythrottle.h b/linden/indra/llcommon/llkeythrottle.h
index 3b5e595..873f50a 100644
--- a/linden/indra/llcommon/llkeythrottle.h
+++ b/linden/indra/llcommon/llkeythrottle.h
@@ -16,7 +16,8 @@
16 * There are special exceptions to the terms and conditions of the GPL as 16 * There are special exceptions to the terms and conditions of the GPL as
17 * it is applied to this Source Code. View the full text of the exception 17 * it is applied to this Source Code. View the full text of the exception
18 * in the file doc/FLOSS-exception.txt in this software distribution, or 18 * in the file doc/FLOSS-exception.txt in this software distribution, or
19 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 19 * online at
20 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
20 * 21 *
21 * By copying, modifying or distributing this software, you acknowledge 22 * By copying, modifying or distributing this software, you acknowledge
22 * that you have read and understood your obligations described above, 23 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/llkeyusetracker.h b/linden/indra/llcommon/llkeyusetracker.h
index 1c196bc..1dc29ce 100644
--- a/linden/indra/llcommon/llkeyusetracker.h
+++ b/linden/indra/llcommon/llkeyusetracker.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/lllinkedqueue.h b/linden/indra/llcommon/lllinkedqueue.h
index 7b87909..3f0eb18 100644
--- a/linden/indra/llcommon/lllinkedqueue.h
+++ b/linden/indra/llcommon/lllinkedqueue.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/llliveappconfig.cpp b/linden/indra/llcommon/llliveappconfig.cpp
index 21b646b..e1bfc11 100644
--- a/linden/indra/llcommon/llliveappconfig.cpp
+++ b/linden/indra/llcommon/llliveappconfig.cpp
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/llliveappconfig.h b/linden/indra/llcommon/llliveappconfig.h
index 2a96661..55d84a4 100644
--- a/linden/indra/llcommon/llliveappconfig.h
+++ b/linden/indra/llcommon/llliveappconfig.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/lllivefile.cpp b/linden/indra/llcommon/lllivefile.cpp
index a1e2d8f..810ae70 100644
--- a/linden/indra/llcommon/lllivefile.cpp
+++ b/linden/indra/llcommon/lllivefile.cpp
@@ -16,7 +16,8 @@
16 * There are special exceptions to the terms and conditions of the GPL as 16 * There are special exceptions to the terms and conditions of the GPL as
17 * it is applied to this Source Code. View the full text of the exception 17 * it is applied to this Source Code. View the full text of the exception
18 * in the file doc/FLOSS-exception.txt in this software distribution, or 18 * in the file doc/FLOSS-exception.txt in this software distribution, or
19 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 19 * online at
20 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
20 * 21 *
21 * By copying, modifying or distributing this software, you acknowledge 22 * By copying, modifying or distributing this software, you acknowledge
22 * that you have read and understood your obligations described above, 23 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/lllivefile.h b/linden/indra/llcommon/lllivefile.h
index 8bf0371..fddf006 100644
--- a/linden/indra/llcommon/lllivefile.h
+++ b/linden/indra/llcommon/lllivefile.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/lllocalidhashmap.h b/linden/indra/llcommon/lllocalidhashmap.h
index c264ac0..a58ae2e 100644
--- a/linden/indra/llcommon/lllocalidhashmap.h
+++ b/linden/indra/llcommon/lllocalidhashmap.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/lllog.cpp b/linden/indra/llcommon/lllog.cpp
index d5fb2a0..db5d25d 100644
--- a/linden/indra/llcommon/lllog.cpp
+++ b/linden/indra/llcommon/lllog.cpp
@@ -19,7 +19,8 @@
19 * There are special exceptions to the terms and conditions of the GPL as 19 * There are special exceptions to the terms and conditions of the GPL as
20 * it is applied to this Source Code. View the full text of the exception 20 * it is applied to this Source Code. View the full text of the exception
21 * in the file doc/FLOSS-exception.txt in this software distribution, or 21 * in the file doc/FLOSS-exception.txt in this software distribution, or
22 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 22 * online at
23 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
23 * 24 *
24 * By copying, modifying or distributing this software, you acknowledge 25 * By copying, modifying or distributing this software, you acknowledge
25 * that you have read and understood your obligations described above, 26 * that you have read and understood your obligations described above,
@@ -45,8 +46,8 @@ public:
45 LLLogImpl(LLApp* app) : mApp(app) {} 46 LLLogImpl(LLApp* app) : mApp(app) {}
46 ~LLLogImpl() {} 47 ~LLLogImpl() {}
47 48
48 void log(const std::string message, LLSD& info); 49 void log(const std::string &message, LLSD& info);
49 bool useLegacyLogMessage(const std::string message); 50 bool useLegacyLogMessage(const std::string &message);
50 51
51private: 52private:
52 LLApp* mApp; 53 LLApp* mApp;
@@ -54,7 +55,7 @@ private:
54 55
55 56
56//@brief Function to log a message to syslog for streambase to collect. 57//@brief Function to log a message to syslog for streambase to collect.
57void LLLogImpl::log(const std::string message, LLSD& info) 58void LLLogImpl::log(const std::string &message, LLSD& info)
58{ 59{
59 static S32 sequence = 0; 60 static S32 sequence = 0;
60 LLSD log_config = mApp->getOption("log-messages"); 61 LLSD log_config = mApp->getOption("log-messages");
@@ -74,7 +75,7 @@ void LLLogImpl::log(const std::string message, LLSD& info)
74} 75}
75 76
76//@brief Function to check if specified legacy log message should be sent. 77//@brief Function to check if specified legacy log message should be sent.
77bool LLLogImpl::useLegacyLogMessage(const std::string message) 78bool LLLogImpl::useLegacyLogMessage(const std::string &message)
78{ 79{
79 LLSD log_config = mApp->getOption("log-messages"); 80 LLSD log_config = mApp->getOption("log-messages");
80 if (log_config.has(message)) 81 if (log_config.has(message))
@@ -100,12 +101,12 @@ LLLog::~LLLog()
100 mImpl = NULL; 101 mImpl = NULL;
101} 102}
102 103
103void LLLog::log(const std::string message, LLSD& info) 104void LLLog::log(const std::string &message, LLSD& info)
104{ 105{
105 if (mImpl) mImpl->log(message, info); 106 if (mImpl) mImpl->log(message, info);
106} 107}
107 108
108bool LLLog::useLegacyLogMessage(const std::string message) 109bool LLLog::useLegacyLogMessage(const std::string &message)
109{ 110{
110 if (mImpl) 111 if (mImpl)
111 { 112 {
diff --git a/linden/indra/llcommon/lllog.h b/linden/indra/llcommon/lllog.h
index 200f48a..7ac6c8a 100644
--- a/linden/indra/llcommon/lllog.h
+++ b/linden/indra/llcommon/lllog.h
@@ -19,7 +19,8 @@
19 * There are special exceptions to the terms and conditions of the GPL as 19 * There are special exceptions to the terms and conditions of the GPL as
20 * it is applied to this Source Code. View the full text of the exception 20 * it is applied to this Source Code. View the full text of the exception
21 * in the file doc/FLOSS-exception.txt in this software distribution, or 21 * in the file doc/FLOSS-exception.txt in this software distribution, or
22 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 22 * online at
23 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
23 * 24 *
24 * By copying, modifying or distributing this software, you acknowledge 25 * By copying, modifying or distributing this software, you acknowledge
25 * that you have read and understood your obligations described above, 26 * that you have read and understood your obligations described above,
@@ -46,8 +47,8 @@ public:
46 LLLog(LLApp* app); 47 LLLog(LLApp* app);
47 virtual ~LLLog(); 48 virtual ~LLLog();
48 49
49 virtual void log(const std::string message, LLSD& info); 50 virtual void log(const std::string &message, LLSD& info);
50 virtual bool useLegacyLogMessage(const std::string message); 51 virtual bool useLegacyLogMessage(const std::string &message);
51 52
52private: 53private:
53 LLLogImpl* mImpl; 54 LLLogImpl* mImpl;
diff --git a/linden/indra/llcommon/lllslconstants.h b/linden/indra/llcommon/lllslconstants.h
index 3aa38b8..7cd854f 100644
--- a/linden/indra/llcommon/lllslconstants.h
+++ b/linden/indra/llcommon/lllslconstants.h
@@ -18,7 +18,8 @@
18 * There are special exceptions to the terms and conditions of the GPL as 18 * There are special exceptions to the terms and conditions of the GPL as
19 * it is applied to this Source Code. View the full text of the exception 19 * it is applied to this Source Code. View the full text of the exception
20 * in the file doc/FLOSS-exception.txt in this software distribution, or 20 * in the file doc/FLOSS-exception.txt in this software distribution, or
21 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 21 * online at
22 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 * 23 *
23 * By copying, modifying or distributing this software, you acknowledge 24 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above, 25 * that you have read and understood your obligations described above,
@@ -187,4 +188,18 @@ const S32 OBJECT_CREATOR = 8;
187// llTextBox() magic token string - yes this is a hack. sue me. 188// llTextBox() magic token string - yes this is a hack. sue me.
188const std::string TEXTBOX_MAGIC_TOKEN = "!!llTextBox!!"; 189const std::string TEXTBOX_MAGIC_TOKEN = "!!llTextBox!!";
189 190
191// changed() event flags
192const U32 CHANGED_NONE = 0x0;
193const U32 CHANGED_INVENTORY = 0x1;
194const U32 CHANGED_COLOR = 0x2;
195const U32 CHANGED_SHAPE = 0x4;
196const U32 CHANGED_SCALE = 0x8;
197const U32 CHANGED_TEXTURE = 0x10;
198const U32 CHANGED_LINK = 0x20;
199const U32 CHANGED_ALLOWED_DROP = 0x40;
200const U32 CHANGED_OWNER = 0x80;
201const U32 CHANGED_REGION = 0x100;
202const U32 CHANGED_TELEPORT = 0x200;
203const U32 CHANGED_REGION_START = 0x400;
204
190#endif 205#endif
diff --git a/linden/indra/llcommon/llmap.h b/linden/indra/llcommon/llmap.h
index 71a168b..c94d4d4 100644
--- a/linden/indra/llcommon/llmap.h
+++ b/linden/indra/llcommon/llmap.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/llmd5.cpp b/linden/indra/llcommon/llmd5.cpp
index c58461f..14b4f9f 100644
--- a/linden/indra/llcommon/llmd5.cpp
+++ b/linden/indra/llcommon/llmd5.cpp
@@ -16,7 +16,8 @@
16 * There are special exceptions to the terms and conditions of the GPL as 16 * There are special exceptions to the terms and conditions of the GPL as
17 * it is applied to this Source Code. View the full text of the exception 17 * it is applied to this Source Code. View the full text of the exception
18 * in the file doc/FLOSS-exception.txt in this software distribution, or 18 * in the file doc/FLOSS-exception.txt in this software distribution, or
19 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 19 * online at
20 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
20 * 21 *
21 * By copying, modifying or distributing this software, you acknowledge 22 * By copying, modifying or distributing this software, you acknowledge
22 * that you have read and understood your obligations described above, 23 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/llmd5.h b/linden/indra/llcommon/llmd5.h
index 2d0205d..d8bca03 100644
--- a/linden/indra/llcommon/llmd5.h
+++ b/linden/indra/llcommon/llmd5.h
@@ -16,7 +16,8 @@
16 * There are special exceptions to the terms and conditions of the GPL as 16 * There are special exceptions to the terms and conditions of the GPL as
17 * it is applied to this Source Code. View the full text of the exception 17 * it is applied to this Source Code. View the full text of the exception
18 * in the file doc/FLOSS-exception.txt in this software distribution, or 18 * in the file doc/FLOSS-exception.txt in this software distribution, or
19 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 19 * online at
20 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
20 * 21 *
21 * By copying, modifying or distributing this software, you acknowledge 22 * By copying, modifying or distributing this software, you acknowledge
22 * that you have read and understood your obligations described above, 23 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/llmemory.cpp b/linden/indra/llcommon/llmemory.cpp
index a03fe9d..a6de3d2 100644
--- a/linden/indra/llcommon/llmemory.cpp
+++ b/linden/indra/llcommon/llmemory.cpp
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
@@ -38,7 +39,7 @@
38# include <sys/types.h> 39# include <sys/types.h>
39# include <mach/task.h> 40# include <mach/task.h>
40# include <mach/mach_init.h> 41# include <mach/mach_init.h>
41#elif defined(LL_LINUX) 42#elif LL_LINUX || LL_SOLARIS
42# include <unistd.h> 43# include <unistd.h>
43#endif 44#endif
44 45
@@ -388,6 +389,34 @@ bail:
388 return rss; 389 return rss;
389} 390}
390 391
392#elif LL_SOLARIS
393#include <sys/types.h>
394#include <sys/stat.h>
395#include <fcntl.h>
396#define _STRUCTURED_PROC 1
397#include <sys/procfs.h>
398
399U64 getCurrentRSS()
400{
401 char path [LL_MAX_PATH]; /* Flawfinder: ignore */
402
403 sprintf(path, "/proc/%d/psinfo", (int)getpid());
404 int proc_fd = -1;
405 if((proc_fd = open(path, O_RDONLY)) == -1){
406 llwarns << "LLmemory::getCurrentRSS() unable to open " << path << ". Returning 0 RSS!" << llendl;
407 return 0;
408 }
409 psinfo_t proc_psinfo;
410 if(read(proc_fd, &proc_psinfo, sizeof(psinfo_t)) != sizeof(psinfo_t)){
411 llwarns << "LLmemory::getCurrentRSS() Unable to read from " << path << ". Returning 0 RSS!" << llendl;
412 close(proc_fd);
413 return 0;
414 }
415
416 close(proc_fd);
417
418 return((U64)proc_psinfo.pr_rssize * 1024);
419}
391#else 420#else
392 421
393U64 getCurrentRSS() 422U64 getCurrentRSS()
diff --git a/linden/indra/llcommon/llmemory.h b/linden/indra/llcommon/llmemory.h
index 7b3426f..b5c0711 100644
--- a/linden/indra/llcommon/llmemory.h
+++ b/linden/indra/llcommon/llmemory.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
@@ -409,53 +410,58 @@ protected:
409// 410//
410// class Foo: public LLSingleton<Foo>{}; 411// class Foo: public LLSingleton<Foo>{};
411// 412//
412// Foo* instance = Foo::getInstance(); 413// Foo& instance = Foo::instance();
413// 414//
414// The second way is to define a seperate class that exposes the singleton 415// The second way is to use the singleton class directly, without inheritance:
415// interface:
416// 416//
417// class FooSingleton: public LLSingleton<Foo>{}; 417// typedef LLSingleton<Foo> FooSingleton;
418// 418//
419// Foo* instance = FooSingleton::getInstance(); 419// Foo& instance = FooSingleton::instance();
420//
421// In this case, the class being managed as a singleton needs to provide an
422// initSingleton() method since the LLSingleton virtual method won't be
423// available
420// 424//
421// As currently written, it is not thread-safe. 425// As currently written, it is not thread-safe.
422#if LL_WINDOWS && _MSC_VER < 1400 // this is Visual C++ 2003 or earlier
423// workaround for VC7 compiler bug
424// adapted from http://www.codeproject.com/KB/tips/VC2003MeyersSingletonBug.aspx
425// our version doesn't introduce a nested struct so that you can still declare LLSingleton<MyClass>
426// a friend and hide your constructor
427
428template <typename T> 426template <typename T>
429class LLSingleton 427class LLSingleton
430{ 428{
431public: 429public:
432 static T* getInstance() 430 virtual ~LLSingleton() {}
431#ifdef LL_MSVC7
432// workaround for VC7 compiler bug
433// adapted from http://www.codeproject.com/KB/tips/VC2003MeyersSingletonBug.aspx
434// our version doesn't introduce a nested struct so that you can still declare LLSingleton<MyClass>
435// a friend and hide your constructor
436 static T* getInstance()
433 { 437 {
434 LLSingleton<T> singleton; 438 LLSingleton<T> singleton;
435 return singleton.get(); 439 return singleton.vsHack();
436 }
437private:
438 T* get()
439 {
440 static T instance;
441 return &instance;
442 } 440 }
443 441
444}; 442 T* vsHack()
445#else 443#else
446
447template <typename T>
448class LLSingleton
449{
450public:
451 static T* getInstance() 444 static T* getInstance()
445#endif
452 { 446 {
453 static T instance; 447 static T instance;
448 static bool needs_init = true;
449 if (needs_init)
450 {
451 needs_init = false;
452 instance.initSingleton();
453 }
454 return &instance; 454 return &instance;
455 } 455 }
456};
457 456
458#endif 457 static T& instance()
458 {
459 return *getInstance();
460 }
461
462private:
463 virtual void initSingleton() {}
464};
459 465
460//---------------------------------------------------------------------------- 466//----------------------------------------------------------------------------
461 467
diff --git a/linden/indra/llcommon/llmemorystream.cpp b/linden/indra/llcommon/llmemorystream.cpp
index 362c7d1..5c01c95 100644
--- a/linden/indra/llcommon/llmemorystream.cpp
+++ b/linden/indra/llcommon/llmemorystream.cpp
@@ -19,7 +19,8 @@
19 * There are special exceptions to the terms and conditions of the GPL as 19 * There are special exceptions to the terms and conditions of the GPL as
20 * it is applied to this Source Code. View the full text of the exception 20 * it is applied to this Source Code. View the full text of the exception
21 * in the file doc/FLOSS-exception.txt in this software distribution, or 21 * in the file doc/FLOSS-exception.txt in this software distribution, or
22 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 22 * online at
23 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
23 * 24 *
24 * By copying, modifying or distributing this software, you acknowledge 25 * By copying, modifying or distributing this software, you acknowledge
25 * that you have read and understood your obligations described above, 26 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/llmemorystream.h b/linden/indra/llcommon/llmemorystream.h
index 89abb7b..f348632 100644
--- a/linden/indra/llcommon/llmemorystream.h
+++ b/linden/indra/llcommon/llmemorystream.h
@@ -19,7 +19,8 @@
19 * There are special exceptions to the terms and conditions of the GPL as 19 * There are special exceptions to the terms and conditions of the GPL as
20 * it is applied to this Source Code. View the full text of the exception 20 * it is applied to this Source Code. View the full text of the exception
21 * in the file doc/FLOSS-exception.txt in this software distribution, or 21 * in the file doc/FLOSS-exception.txt in this software distribution, or
22 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 22 * online at
23 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
23 * 24 *
24 * By copying, modifying or distributing this software, you acknowledge 25 * By copying, modifying or distributing this software, you acknowledge
25 * that you have read and understood your obligations described above, 26 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/llmemtype.h b/linden/indra/llcommon/llmemtype.h
index 27091ff..a9ebc20 100644
--- a/linden/indra/llcommon/llmemtype.h
+++ b/linden/indra/llcommon/llmemtype.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/llmetrics.cpp b/linden/indra/llcommon/llmetrics.cpp
index 73748c8..8db3284 100644
--- a/linden/indra/llcommon/llmetrics.cpp
+++ b/linden/indra/llcommon/llmetrics.cpp
@@ -19,7 +19,8 @@
19 * There are special exceptions to the terms and conditions of the GPL as 19 * There are special exceptions to the terms and conditions of the GPL as
20 * it is applied to this Source Code. View the full text of the exception 20 * it is applied to this Source Code. View the full text of the exception
21 * in the file doc/FLOSS-exception.txt in this software distribution, or 21 * in the file doc/FLOSS-exception.txt in this software distribution, or
22 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 22 * online at
23 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
23 * 24 *
24 * By copying, modifying or distributing this software, you acknowledge 25 * By copying, modifying or distributing this software, you acknowledge
25 * that you have read and understood your obligations described above, 26 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/llmetrics.h b/linden/indra/llcommon/llmetrics.h
index 1b763ba..1d91e8c 100644
--- a/linden/indra/llcommon/llmetrics.h
+++ b/linden/indra/llcommon/llmetrics.h
@@ -19,7 +19,8 @@
19 * There are special exceptions to the terms and conditions of the GPL as 19 * There are special exceptions to the terms and conditions of the GPL as
20 * it is applied to this Source Code. View the full text of the exception 20 * it is applied to this Source Code. View the full text of the exception
21 * in the file doc/FLOSS-exception.txt in this software distribution, or 21 * in the file doc/FLOSS-exception.txt in this software distribution, or
22 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 22 * online at
23 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
23 * 24 *
24 * By copying, modifying or distributing this software, you acknowledge 25 * By copying, modifying or distributing this software, you acknowledge
25 * that you have read and understood your obligations described above, 26 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/llmortician.cpp b/linden/indra/llcommon/llmortician.cpp
index bb93843..c800b65 100644
--- a/linden/indra/llcommon/llmortician.cpp
+++ b/linden/indra/llcommon/llmortician.cpp
@@ -16,7 +16,8 @@
16 * There are special exceptions to the terms and conditions of the GPL as 16 * There are special exceptions to the terms and conditions of the GPL as
17 * it is applied to this Source Code. View the full text of the exception 17 * it is applied to this Source Code. View the full text of the exception
18 * in the file doc/FLOSS-exception.txt in this software distribution, or 18 * in the file doc/FLOSS-exception.txt in this software distribution, or
19 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 19 * online at
20 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
20 * 21 *
21 * By copying, modifying or distributing this software, you acknowledge 22 * By copying, modifying or distributing this software, you acknowledge
22 * that you have read and understood your obligations described above, 23 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/llmortician.h b/linden/indra/llcommon/llmortician.h
index 5a8aae6..fcda3df 100644
--- a/linden/indra/llcommon/llmortician.h
+++ b/linden/indra/llcommon/llmortician.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/llnametable.h b/linden/indra/llcommon/llnametable.h
index 35a40af..335a191 100644
--- a/linden/indra/llcommon/llnametable.h
+++ b/linden/indra/llcommon/llnametable.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/llpreprocessor.h b/linden/indra/llcommon/llpreprocessor.h
index 9bc2847..2e4fd47 100644
--- a/linden/indra/llcommon/llpreprocessor.h
+++ b/linden/indra/llcommon/llpreprocessor.h
@@ -18,7 +18,8 @@
18 * There are special exceptions to the terms and conditions of the GPL as 18 * There are special exceptions to the terms and conditions of the GPL as
19 * it is applied to this Source Code. View the full text of the exception 19 * it is applied to this Source Code. View the full text of the exception
20 * in the file doc/FLOSS-exception.txt in this software distribution, or 20 * in the file doc/FLOSS-exception.txt in this software distribution, or
21 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 21 * online at
22 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 * 23 *
23 * By copying, modifying or distributing this software, you acknowledge 24 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above, 25 * that you have read and understood your obligations described above,
@@ -39,7 +40,16 @@
39#include <endian.h> 40#include <endian.h>
40#endif // LL_LINUX 41#endif // LL_LINUX
41 42
42#if (defined(LL_WINDOWS) || (defined(LL_LINUX) && (__BYTE_ORDER == __LITTLE_ENDIAN)) || (defined(LL_DARWIN) && defined(__LITTLE_ENDIAN__))) 43#if LL_SOLARIS
44# ifdef __sparc // Since we're talking Solaris 10 and up, only 64 bit is supported.
45# define LL_BIG_ENDIAN 1
46# define LL_SOLARIS_ALIGNED_CPU 1 // used to designate issues where SPARC alignment is addressed
47# define LL_SOLARIS_NON_MESA_GL 1 // The SPARC GL does not provide a MESA-based GL API
48# endif
49# include <sys/isa_defs.h> // ensure we know which end is up
50#endif // LL_SOLARIS
51
52#if (defined(LL_WINDOWS) || (defined(LL_LINUX) && (__BYTE_ORDER == __LITTLE_ENDIAN)) || (defined(LL_DARWIN) && defined(__LITTLE_ENDIAN__)) || (defined(LL_SOLARIS) && defined(__i386)))
43#define LL_LITTLE_ENDIAN 1 53#define LL_LITTLE_ENDIAN 1
44#else 54#else
45#define LL_BIG_ENDIAN 1 55#define LL_BIG_ENDIAN 1
diff --git a/linden/indra/llcommon/llpriqueuemap.h b/linden/indra/llcommon/llpriqueuemap.h
index 13b2887..a861ac1 100644
--- a/linden/indra/llcommon/llpriqueuemap.h
+++ b/linden/indra/llcommon/llpriqueuemap.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/llprocessor.cpp b/linden/indra/llcommon/llprocessor.cpp
index 1857fdc..469e544 100644
--- a/linden/indra/llcommon/llprocessor.cpp
+++ b/linden/indra/llcommon/llprocessor.cpp
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
@@ -278,7 +279,7 @@ bool CProcessor::AnalyzeIntelProcessor()
278 279
279 // Only override the brand if we have it in the lookup table. We should 280 // Only override the brand if we have it in the lookup table. We should
280 // already have a string here from GetCPUInfo(). JC 281 // already have a string here from GetCPUInfo(). JC
281 if (CPUInfo.uiBrandID < (sizeof(INTEL_BRAND)/sizeof(INTEL_BRAND[0]))) 282 if ( CPUInfo.uiBrandID < LL_ARRAY_SIZE(INTEL_BRAND) )
282 { 283 {
283 strcpy(CPUInfo.strBrandID, INTEL_BRAND[CPUInfo.uiBrandID]); 284 strcpy(CPUInfo.strBrandID, INTEL_BRAND[CPUInfo.uiBrandID]);
284 285
@@ -1664,6 +1665,10 @@ const ProcessorInfo *CProcessor::GetCPUInfo()
1664#elif LL_SOLARIS 1665#elif LL_SOLARIS
1665#include <kstat.h> 1666#include <kstat.h>
1666 1667
1668#if defined(__i386)
1669#include <sys/auxv.h>
1670#endif
1671
1667// ====================== 1672// ======================
1668// Class constructor: 1673// Class constructor:
1669///////////////////////// 1674/////////////////////////
@@ -1777,6 +1782,37 @@ const ProcessorInfo *CProcessor::GetCPUInfo()
1777 1782
1778 // DEBUG llinfo << "The system has " << ncpus << " CPUs with a clock rate of " << uqwFrequency << "MHz." << llendl; 1783 // DEBUG llinfo << "The system has " << ncpus << " CPUs with a clock rate of " << uqwFrequency << "MHz." << llendl;
1779 1784
1785#if defined (__i386) // we really don't care about the CPU extensions on SPARC but on x86...
1786
1787 // Now get cpu extensions
1788
1789 uint_t ui;
1790
1791 (void) getisax(&ui, 1);
1792
1793 if(ui & AV_386_FPU)
1794 CPUInfo._Ext.FPU_FloatingPointUnit = true;
1795 if(ui & AV_386_CX8)
1796 CPUInfo._Ext.CX8_COMPXCHG8B_Instruction = true;
1797 if(ui & AV_386_MMX)
1798 CPUInfo._Ext.MMX_MultimediaExtensions = true;
1799 if(ui & AV_386_AMD_MMX)
1800 CPUInfo._Ext.MMX_MultimediaExtensions = true;
1801 if(ui & AV_386_FXSR)
1802 CPUInfo._Ext.FXSR_FastStreamingSIMD_ExtensionsSaveRestore = true;
1803 if(ui & AV_386_SSE)
1804 CPUInfo._Ext.SSE_StreamingSIMD_Extensions = true;
1805 if(ui & AV_386_SSE2)
1806 CPUInfo._Ext.SSE2_StreamingSIMD2_Extensions = true;
1807/* Left these here since they may get used later
1808 if(ui & AV_386_SSE3)
1809 CPUInfo._Ext.... = true;
1810 if(ui & AV_386_AMD_3DNow)
1811 CPUInfo._Ext.... = true;
1812 if(ui & AV_386_AMD_3DNowx)
1813 CPUInfo._Ext.... = true;
1814*/
1815#endif
1780 return (&CPUInfo); 1816 return (&CPUInfo);
1781} 1817}
1782 1818
diff --git a/linden/indra/llcommon/llprocessor.h b/linden/indra/llcommon/llprocessor.h
index f5ffd5e..746d007 100644
--- a/linden/indra/llcommon/llprocessor.h
+++ b/linden/indra/llcommon/llprocessor.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/llptrskiplist.h b/linden/indra/llcommon/llptrskiplist.h
index 453171d..6878165 100644
--- a/linden/indra/llcommon/llptrskiplist.h
+++ b/linden/indra/llcommon/llptrskiplist.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/llptrskipmap.h b/linden/indra/llcommon/llptrskipmap.h
index b568fef..20d0019 100644
--- a/linden/indra/llcommon/llptrskipmap.h
+++ b/linden/indra/llcommon/llptrskipmap.h
@@ -18,7 +18,8 @@
18 * There are special exceptions to the terms and conditions of the GPL as 18 * There are special exceptions to the terms and conditions of the GPL as
19 * it is applied to this Source Code. View the full text of the exception 19 * it is applied to this Source Code. View the full text of the exception
20 * in the file doc/FLOSS-exception.txt in this software distribution, or 20 * in the file doc/FLOSS-exception.txt in this software distribution, or
21 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 21 * online at
22 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 * 23 *
23 * By copying, modifying or distributing this software, you acknowledge 24 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above, 25 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/llqueuedthread.cpp b/linden/indra/llcommon/llqueuedthread.cpp
index dfe3d6f..cd53e70 100644
--- a/linden/indra/llcommon/llqueuedthread.cpp
+++ b/linden/indra/llcommon/llqueuedthread.cpp
@@ -16,7 +16,8 @@
16 * There are special exceptions to the terms and conditions of the GPL as 16 * There are special exceptions to the terms and conditions of the GPL as
17 * it is applied to this Source Code. View the full text of the exception 17 * it is applied to this Source Code. View the full text of the exception
18 * in the file doc/FLOSS-exception.txt in this software distribution, or 18 * in the file doc/FLOSS-exception.txt in this software distribution, or
19 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 19 * online at
20 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
20 * 21 *
21 * By copying, modifying or distributing this software, you acknowledge 22 * By copying, modifying or distributing this software, you acknowledge
22 * that you have read and understood your obligations described above, 23 * that you have read and understood your obligations described above,
@@ -196,8 +197,9 @@ LLQueuedThread::handle_t LLQueuedThread::generateHandle()
196 { 197 {
197 mNextHandle++; 198 mNextHandle++;
198 } 199 }
200 const LLQueuedThread::handle_t res = mNextHandle++;
199 unlockData(); 201 unlockData();
200 return mNextHandle++; 202 return res;
201} 203}
202 204
203// MAIN thread 205// MAIN thread
diff --git a/linden/indra/llcommon/llqueuedthread.h b/linden/indra/llcommon/llqueuedthread.h
index 180ff42..3ba43e1 100644
--- a/linden/indra/llcommon/llqueuedthread.h
+++ b/linden/indra/llcommon/llqueuedthread.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/llrand.cpp b/linden/indra/llcommon/llrand.cpp
index 80335bb..0b2f8b8 100644
--- a/linden/indra/llcommon/llrand.cpp
+++ b/linden/indra/llcommon/llrand.cpp
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/llrand.h b/linden/indra/llcommon/llrand.h
index 3634918..d12597b 100644
--- a/linden/indra/llcommon/llrand.h
+++ b/linden/indra/llcommon/llrand.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/llrun.cpp b/linden/indra/llcommon/llrun.cpp
index 12e3f69..e2f69ff 100644
--- a/linden/indra/llcommon/llrun.cpp
+++ b/linden/indra/llcommon/llrun.cpp
@@ -19,7 +19,8 @@
19 * There are special exceptions to the terms and conditions of the GPL as 19 * There are special exceptions to the terms and conditions of the GPL as
20 * it is applied to this Source Code. View the full text of the exception 20 * it is applied to this Source Code. View the full text of the exception
21 * in the file doc/FLOSS-exception.txt in this software distribution, or 21 * in the file doc/FLOSS-exception.txt in this software distribution, or
22 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 22 * online at
23 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
23 * 24 *
24 * By copying, modifying or distributing this software, you acknowledge 25 * By copying, modifying or distributing this software, you acknowledge
25 * that you have read and understood your obligations described above, 26 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/llrun.h b/linden/indra/llcommon/llrun.h
index 736a355..77b23d9 100644
--- a/linden/indra/llcommon/llrun.h
+++ b/linden/indra/llcommon/llrun.h
@@ -19,7 +19,8 @@
19 * There are special exceptions to the terms and conditions of the GPL as 19 * There are special exceptions to the terms and conditions of the GPL as
20 * it is applied to this Source Code. View the full text of the exception 20 * it is applied to this Source Code. View the full text of the exception
21 * in the file doc/FLOSS-exception.txt in this software distribution, or 21 * in the file doc/FLOSS-exception.txt in this software distribution, or
22 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 22 * online at
23 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
23 * 24 *
24 * By copying, modifying or distributing this software, you acknowledge 25 * By copying, modifying or distributing this software, you acknowledge
25 * that you have read and understood your obligations described above, 26 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/llsd.cpp b/linden/indra/llcommon/llsd.cpp
index 19471a0..2cc94c2 100644
--- a/linden/indra/llcommon/llsd.cpp
+++ b/linden/indra/llcommon/llsd.cpp
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
@@ -349,7 +350,7 @@ namespace
349 350
350 virtual bool has(const LLSD::String&) const; 351 virtual bool has(const LLSD::String&) const;
351 virtual LLSD get(const LLSD::String&) const; 352 virtual LLSD get(const LLSD::String&) const;
352 void insert(const LLSD::String& k, const LLSD& v); 353 LLSD& insert(const LLSD::String& k, const LLSD& v);
353 virtual void erase(const LLSD::String&); 354 virtual void erase(const LLSD::String&);
354 LLSD& ref(const LLSD::String&); 355 LLSD& ref(const LLSD::String&);
355 virtual const LLSD& ref(const LLSD::String&) const; 356 virtual const LLSD& ref(const LLSD::String&) const;
@@ -388,9 +389,14 @@ namespace
388 return (i != mData.end()) ? i->second : LLSD(); 389 return (i != mData.end()) ? i->second : LLSD();
389 } 390 }
390 391
391 void ImplMap::insert(const LLSD::String& k, const LLSD& v) 392 LLSD& ImplMap::insert(const LLSD::String& k, const LLSD& v)
392 { 393 {
393 mData.insert(DataMap::value_type(k, v)); 394 mData.insert(DataMap::value_type(k, v));
395 #ifdef LL_MSVC7
396 return *((LLSD*)this);
397 #else
398 return *dynamic_cast<LLSD*>(this);
399 #endif
394 } 400 }
395 401
396 void ImplMap::erase(const LLSD::String& k) 402 void ImplMap::erase(const LLSD::String& k)
@@ -436,7 +442,7 @@ namespace
436 virtual int size() const; 442 virtual int size() const;
437 virtual LLSD get(LLSD::Integer) const; 443 virtual LLSD get(LLSD::Integer) const;
438 void set(LLSD::Integer, const LLSD&); 444 void set(LLSD::Integer, const LLSD&);
439 void insert(LLSD::Integer, const LLSD&); 445 LLSD& insert(LLSD::Integer, const LLSD&);
440 void append(const LLSD&); 446 void append(const LLSD&);
441 virtual void erase(LLSD::Integer); 447 virtual void erase(LLSD::Integer);
442 LLSD& ref(LLSD::Integer); 448 LLSD& ref(LLSD::Integer);
@@ -485,9 +491,15 @@ namespace
485 mData[index] = v; 491 mData[index] = v;
486 } 492 }
487 493
488 void ImplArray::insert(LLSD::Integer i, const LLSD& v) 494 LLSD& ImplArray::insert(LLSD::Integer i, const LLSD& v)
489 { 495 {
490 if (i < 0) { return; } 496 if (i < 0) {
497 #ifdef LL_MSVC7
498 return *((LLSD*)this);
499 #else
500 return *dynamic_cast<LLSD*>(this);
501 #endif
502 }
491 DataVector::size_type index = i; 503 DataVector::size_type index = i;
492 504
493 if (index >= mData.size()) 505 if (index >= mData.size())
@@ -496,6 +508,11 @@ namespace
496 } 508 }
497 509
498 mData.insert(mData.begin() + index, v); 510 mData.insert(mData.begin() + index, v);
511 #ifdef LL_MSVC7
512 return *((LLSD*)this);
513 #else
514 return *dynamic_cast<LLSD*>(this);
515 #endif
499 } 516 }
500 517
501 void ImplArray::append(const LLSD& v) 518 void ImplArray::append(const LLSD& v)
@@ -739,8 +756,11 @@ LLSD LLSD::emptyMap()
739bool LLSD::has(const String& k) const { return safe(impl).has(k); } 756bool LLSD::has(const String& k) const { return safe(impl).has(k); }
740LLSD LLSD::get(const String& k) const { return safe(impl).get(k); } 757LLSD LLSD::get(const String& k) const { return safe(impl).get(k); }
741 758
742void LLSD::insert(const String& k, const LLSD& v) 759LLSD& LLSD::insert(const String& k, const LLSD& v)
743 { makeMap(impl).insert(k, v); } 760 {
761 makeMap(impl).insert(k, v);
762 return *dynamic_cast<LLSD*>(this);
763 }
744void LLSD::erase(const String& k) { makeMap(impl).erase(k); } 764void LLSD::erase(const String& k) { makeMap(impl).erase(k); }
745 765
746LLSD& LLSD::operator[](const String& k) 766LLSD& LLSD::operator[](const String& k)
@@ -761,8 +781,11 @@ int LLSD::size() const { return safe(impl).size(); }
761LLSD LLSD::get(Integer i) const { return safe(impl).get(i); } 781LLSD LLSD::get(Integer i) const { return safe(impl).get(i); }
762void LLSD::set(Integer i, const LLSD& v){ makeArray(impl).set(i, v); } 782void LLSD::set(Integer i, const LLSD& v){ makeArray(impl).set(i, v); }
763 783
764void LLSD::insert(Integer i, const LLSD& v) 784LLSD& LLSD::insert(Integer i, const LLSD& v)
765 { makeArray(impl).insert(i, v); } 785 {
786 makeArray(impl).insert(i, v);
787 return *this;
788 }
766void LLSD::append(const LLSD& v) { makeArray(impl).append(v); } 789void LLSD::append(const LLSD& v) { makeArray(impl).append(v); }
767void LLSD::erase(Integer i) { makeArray(impl).erase(i); } 790void LLSD::erase(Integer i) { makeArray(impl).erase(i); }
768 791
diff --git a/linden/indra/llcommon/llsd.h b/linden/indra/llcommon/llsd.h
index 31b519f..d2845a3 100644
--- a/linden/indra/llcommon/llsd.h
+++ b/linden/indra/llcommon/llsd.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
@@ -222,7 +223,7 @@ public:
222 223
223 bool has(const String&) const; 224 bool has(const String&) const;
224 LLSD get(const String&) const; 225 LLSD get(const String&) const;
225 void insert(const String&, const LLSD&); 226 LLSD& insert(const String&, const LLSD&);
226 void erase(const String&); 227 void erase(const String&);
227 228
228 LLSD& operator[](const String&); 229 LLSD& operator[](const String&);
@@ -237,7 +238,7 @@ public:
237 238
238 LLSD get(Integer) const; 239 LLSD get(Integer) const;
239 void set(Integer, const LLSD&); 240 void set(Integer, const LLSD&);
240 void insert(Integer, const LLSD&); 241 LLSD& insert(Integer, const LLSD&);
241 void append(const LLSD&); 242 void append(const LLSD&);
242 void erase(Integer); 243 void erase(Integer);
243 244
diff --git a/linden/indra/llcommon/llsdserialize.cpp b/linden/indra/llcommon/llsdserialize.cpp
index 0ee1d73..9f4ce64 100644
--- a/linden/indra/llcommon/llsdserialize.cpp
+++ b/linden/indra/llcommon/llsdserialize.cpp
@@ -19,7 +19,8 @@
19 * There are special exceptions to the terms and conditions of the GPL as 19 * There are special exceptions to the terms and conditions of the GPL as
20 * it is applied to this Source Code. View the full text of the exception 20 * it is applied to this Source Code. View the full text of the exception
21 * in the file doc/FLOSS-exception.txt in this software distribution, or 21 * in the file doc/FLOSS-exception.txt in this software distribution, or
22 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 22 * online at
23 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
23 * 24 *
24 * By copying, modifying or distributing this software, you acknowledge 25 * By copying, modifying or distributing this software, you acknowledge
25 * that you have read and understood your obligations described above, 26 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/llsdserialize.h b/linden/indra/llcommon/llsdserialize.h
index f56e45c..f7cd91b 100644
--- a/linden/indra/llcommon/llsdserialize.h
+++ b/linden/indra/llcommon/llsdserialize.h
@@ -19,7 +19,8 @@
19 * There are special exceptions to the terms and conditions of the GPL as 19 * There are special exceptions to the terms and conditions of the GPL as
20 * it is applied to this Source Code. View the full text of the exception 20 * it is applied to this Source Code. View the full text of the exception
21 * in the file doc/FLOSS-exception.txt in this software distribution, or 21 * in the file doc/FLOSS-exception.txt in this software distribution, or
22 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 22 * online at
23 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
23 * 24 *
24 * By copying, modifying or distributing this software, you acknowledge 25 * By copying, modifying or distributing this software, you acknowledge
25 * that you have read and understood your obligations described above, 26 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/llsdserialize_xml.cpp b/linden/indra/llcommon/llsdserialize_xml.cpp
index 6734ed4..c12ca35 100644
--- a/linden/indra/llcommon/llsdserialize_xml.cpp
+++ b/linden/indra/llcommon/llsdserialize_xml.cpp
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
@@ -318,8 +319,8 @@ private:
318 bool mSkipping; 319 bool mSkipping;
319 int mSkipThrough; 320 int mSkipThrough;
320 321
321 std::string mCurrentKey; 322 std::string mCurrentKey; // Current XML <tag>
322 std::ostringstream mCurrentContent; 323 std::string mCurrentContent; // String data between <tag> and </tag>
323}; 324};
324 325
325 326
@@ -556,16 +557,50 @@ void LLSDXMLParser::Impl::parsePart(const char* buf, int len)
556 } 557 }
557} 558}
558 559
560// Performance testing code
561//#define XML_PARSER_PERFORMANCE_TESTS
562
563#ifdef XML_PARSER_PERFORMANCE_TESTS
564
565extern U64 totalTime();
566U64 readElementTime = 0;
567U64 startElementTime = 0;
568U64 endElementTime = 0;
569U64 charDataTime = 0;
570U64 parseTime = 0;
571
572class XML_Timer
573{
574public:
575 XML_Timer( U64 * sum ) : mSum( sum )
576 {
577 mStart = totalTime();
578 }
579 ~XML_Timer()
580 {
581 *mSum += (totalTime() - mStart);
582 }
583
584 U64 * mSum;
585 U64 mStart;
586};
587#endif // XML_PARSER_PERFORMANCE_TESTS
588
559void LLSDXMLParser::Impl::startElementHandler(const XML_Char* name, const XML_Char** attributes) 589void LLSDXMLParser::Impl::startElementHandler(const XML_Char* name, const XML_Char** attributes)
560{ 590{
591 #ifdef XML_PARSER_PERFORMANCE_TESTS
592 XML_Timer timer( &startElementTime );
593 #endif // XML_PARSER_PERFORMANCE_TESTS
594
561 ++mDepth; 595 ++mDepth;
562 if (mSkipping) 596 if (mSkipping)
563 { 597 {
564 return; 598 return;
565 } 599 }
566 600
567 Element element = readElement(name); 601 Element element = readElement(name);
568 mCurrentContent.str(""); 602
603 mCurrentContent.clear();
569 604
570 switch (element) 605 switch (element)
571 { 606 {
@@ -645,6 +680,10 @@ void LLSDXMLParser::Impl::startElementHandler(const XML_Char* name, const XML_Ch
645 680
646void LLSDXMLParser::Impl::endElementHandler(const XML_Char* name) 681void LLSDXMLParser::Impl::endElementHandler(const XML_Char* name)
647{ 682{
683 #ifdef XML_PARSER_PERFORMANCE_TESTS
684 XML_Timer timer( &endElementTime );
685 #endif // XML_PARSER_PERFORMANCE_TESTS
686
648 --mDepth; 687 --mDepth;
649 if (mSkipping) 688 if (mSkipping)
650 { 689 {
@@ -669,7 +708,7 @@ void LLSDXMLParser::Impl::endElementHandler(const XML_Char* name)
669 return; 708 return;
670 709
671 case ELEMENT_KEY: 710 case ELEMENT_KEY:
672 mCurrentKey = mCurrentContent.str(); 711 mCurrentKey = mCurrentContent;
673 return; 712 return;
674 713
675 default: 714 default:
@@ -682,9 +721,6 @@ void LLSDXMLParser::Impl::endElementHandler(const XML_Char* name)
682 LLSD& value = *mStack.back(); 721 LLSD& value = *mStack.back();
683 mStack.pop_back(); 722 mStack.pop_back();
684 723
685 std::string content = mCurrentContent.str();
686 mCurrentContent.str("");
687
688 switch (element) 724 switch (element)
689 { 725 {
690 case ELEMENT_UNDEF: 726 case ELEMENT_UNDEF:
@@ -692,39 +728,59 @@ void LLSDXMLParser::Impl::endElementHandler(const XML_Char* name)
692 break; 728 break;
693 729
694 case ELEMENT_BOOL: 730 case ELEMENT_BOOL:
695 value = content == "true" || content == "1"; 731 value = (mCurrentContent == "true" || mCurrentContent == "1");
696 break; 732 break;
697 733
698 case ELEMENT_INTEGER: 734 case ELEMENT_INTEGER:
699 value = LLSD(content).asInteger(); 735 {
736 S32 i;
737 if ( sscanf(mCurrentContent.c_str(), "%d", &i ) == 1 )
738 { // See if sscanf works - it's faster
739 value = i;
740 }
741 else
742 {
743 value = LLSD(mCurrentContent).asInteger();
744 }
745 }
700 break; 746 break;
701 747
702 case ELEMENT_REAL: 748 case ELEMENT_REAL:
703 value = LLSD(content).asReal(); 749 {
750 F64 r;
751 if ( sscanf(mCurrentContent.c_str(), "%lf", &r ) == 1 )
752 { // See if sscanf works - it's faster
753 value = r;
754 }
755 else
756 {
757 value = LLSD(mCurrentContent).asReal();
758 }
759 }
704 break; 760 break;
705 761
706 case ELEMENT_STRING: 762 case ELEMENT_STRING:
707 value = content; 763 value = mCurrentContent;
708 break; 764 break;
709 765
710 case ELEMENT_UUID: 766 case ELEMENT_UUID:
711 value = LLSD(content).asUUID(); 767 value = LLSD(mCurrentContent).asUUID();
712 break; 768 break;
713 769
714 case ELEMENT_DATE: 770 case ELEMENT_DATE:
715 value = LLSD(content).asDate(); 771 value = LLSD(mCurrentContent).asDate();
716 break; 772 break;
717 773
718 case ELEMENT_URI: 774 case ELEMENT_URI:
719 value = LLSD(content).asURI(); 775 value = LLSD(mCurrentContent).asURI();
720 break; 776 break;
721 777
722 case ELEMENT_BINARY: 778 case ELEMENT_BINARY:
723 { 779 {
724 S32 len = apr_base64_decode_len(content.c_str()); 780 S32 len = apr_base64_decode_len(mCurrentContent.c_str());
725 std::vector<U8> data; 781 std::vector<U8> data;
726 data.resize(len); 782 data.resize(len);
727 len = apr_base64_decode_binary(&data[0], content.c_str()); 783 len = apr_base64_decode_binary(&data[0], mCurrentContent.c_str());
728 data.resize(len); 784 data.resize(len);
729 value = data; 785 value = data;
730 break; 786 break;
@@ -738,11 +794,17 @@ void LLSDXMLParser::Impl::endElementHandler(const XML_Char* name)
738 // other values, map and array, have already been set 794 // other values, map and array, have already been set
739 break; 795 break;
740 } 796 }
797
798 mCurrentContent.clear();
741} 799}
742 800
743void LLSDXMLParser::Impl::characterDataHandler(const XML_Char* data, int length) 801void LLSDXMLParser::Impl::characterDataHandler(const XML_Char* data, int length)
744{ 802{
745 mCurrentContent.write(data, length); 803 #ifdef XML_PARSER_PERFORMANCE_TESTS
804 XML_Timer timer( &charDataTime );
805 #endif // XML_PARSER_PERFORMANCE_TESTS
806
807 mCurrentContent.append(data, length);
746} 808}
747 809
748 810
@@ -765,22 +827,69 @@ void LLSDXMLParser::Impl::sCharacterDataHandler(
765} 827}
766 828
767 829
830/*
831 This code is time critical
832
833 This is a sample of tag occurances of text in simstate file with ~8000 objects.
834 A tag pair (<key>something</key>) counts is counted as two:
835
836 key - 2680178
837 real - 1818362
838 integer - 906078
839 array - 295682
840 map - 191818
841 uuid - 177903
842 binary - 175748
843 string - 53482
844 undef - 40353
845 boolean - 33874
846 llsd - 16332
847 uri - 38
848 date - 1
849*/
768LLSDXMLParser::Impl::Element LLSDXMLParser::Impl::readElement(const XML_Char* name) 850LLSDXMLParser::Impl::Element LLSDXMLParser::Impl::readElement(const XML_Char* name)
769{ 851{
770 if (strcmp(name, "llsd") == 0) { return ELEMENT_LLSD; } 852 #ifdef XML_PARSER_PERFORMANCE_TESTS
771 if (strcmp(name, "undef") == 0) { return ELEMENT_UNDEF; } 853 XML_Timer timer( &readElementTime );
772 if (strcmp(name, "boolean") == 0) { return ELEMENT_BOOL; } 854 #endif // XML_PARSER_PERFORMANCE_TESTS
773 if (strcmp(name, "integer") == 0) { return ELEMENT_INTEGER; } 855
774 if (strcmp(name, "real") == 0) { return ELEMENT_REAL; } 856 XML_Char c = *name;
775 if (strcmp(name, "string") == 0) { return ELEMENT_STRING; } 857 switch (c)
776 if (strcmp(name, "uuid") == 0) { return ELEMENT_UUID; } 858 {
777 if (strcmp(name, "date") == 0) { return ELEMENT_DATE; } 859 case 'k':
778 if (strcmp(name, "uri") == 0) { return ELEMENT_URI; } 860 if (strcmp(name, "key") == 0) { return ELEMENT_KEY; }
779 if (strcmp(name, "binary") == 0) { return ELEMENT_BINARY; } 861 break;
780 if (strcmp(name, "map") == 0) { return ELEMENT_MAP; } 862 case 'r':
781 if (strcmp(name, "array") == 0) { return ELEMENT_ARRAY; } 863 if (strcmp(name, "real") == 0) { return ELEMENT_REAL; }
782 if (strcmp(name, "key") == 0) { return ELEMENT_KEY; } 864 break;
783 865 case 'i':
866 if (strcmp(name, "integer") == 0) { return ELEMENT_INTEGER; }
867 break;
868 case 'a':
869 if (strcmp(name, "array") == 0) { return ELEMENT_ARRAY; }
870 break;
871 case 'm':
872 if (strcmp(name, "map") == 0) { return ELEMENT_MAP; }
873 break;
874 case 'u':
875 if (strcmp(name, "uuid") == 0) { return ELEMENT_UUID; }
876 if (strcmp(name, "undef") == 0) { return ELEMENT_UNDEF; }
877 if (strcmp(name, "uri") == 0) { return ELEMENT_URI; }
878 break;
879 case 'b':
880 if (strcmp(name, "binary") == 0) { return ELEMENT_BINARY; }
881 if (strcmp(name, "boolean") == 0) { return ELEMENT_BOOL; }
882 break;
883 case 's':
884 if (strcmp(name, "string") == 0) { return ELEMENT_STRING; }
885 break;
886 case 'l':
887 if (strcmp(name, "llsd") == 0) { return ELEMENT_LLSD; }
888 break;
889 case 'd':
890 if (strcmp(name, "date") == 0) { return ELEMENT_DATE; }
891 break;
892 }
784 return ELEMENT_UNKNOWN; 893 return ELEMENT_UNKNOWN;
785} 894}
786 895
@@ -808,6 +917,10 @@ void LLSDXMLParser::parsePart(const char *buf, int len)
808// virtual 917// virtual
809S32 LLSDXMLParser::doParse(std::istream& input, LLSD& data) const 918S32 LLSDXMLParser::doParse(std::istream& input, LLSD& data) const
810{ 919{
920 #ifdef XML_PARSER_PERFORMANCE_TESTS
921 XML_Timer timer( &parseTime );
922 #endif // XML_PARSER_PERFORMANCE_TESTS
923
811 if (mParseLines) 924 if (mParseLines)
812 { 925 {
813 // Use line-based reading (faster code) 926 // Use line-based reading (faster code)
diff --git a/linden/indra/llcommon/llsdserialize_xml.h b/linden/indra/llcommon/llsdserialize_xml.h
index 1cbc345..53aa09f 100644
--- a/linden/indra/llcommon/llsdserialize_xml.h
+++ b/linden/indra/llcommon/llsdserialize_xml.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/llsdutil.cpp b/linden/indra/llcommon/llsdutil.cpp
index 37b7f24..aa0e0f3 100644
--- a/linden/indra/llcommon/llsdutil.cpp
+++ b/linden/indra/llcommon/llsdutil.cpp
@@ -19,7 +19,8 @@
19 * There are special exceptions to the terms and conditions of the GPL as 19 * There are special exceptions to the terms and conditions of the GPL as
20 * it is applied to this Source Code. View the full text of the exception 20 * it is applied to this Source Code. View the full text of the exception
21 * in the file doc/FLOSS-exception.txt in this software distribution, or 21 * in the file doc/FLOSS-exception.txt in this software distribution, or
22 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 22 * online at
23 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
23 * 24 *
24 * By copying, modifying or distributing this software, you acknowledge 25 * By copying, modifying or distributing this software, you acknowledge
25 * that you have read and understood your obligations described above, 26 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/llsdutil.h b/linden/indra/llcommon/llsdutil.h
index db5ede3..b67ad52 100644
--- a/linden/indra/llcommon/llsdutil.h
+++ b/linden/indra/llcommon/llsdutil.h
@@ -19,7 +19,8 @@
19 * There are special exceptions to the terms and conditions of the GPL as 19 * There are special exceptions to the terms and conditions of the GPL as
20 * it is applied to this Source Code. View the full text of the exception 20 * it is applied to this Source Code. View the full text of the exception
21 * in the file doc/FLOSS-exception.txt in this software distribution, or 21 * in the file doc/FLOSS-exception.txt in this software distribution, or
22 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 22 * online at
23 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
23 * 24 *
24 * By copying, modifying or distributing this software, you acknowledge 25 * By copying, modifying or distributing this software, you acknowledge
25 * that you have read and understood your obligations described above, 26 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/llsecondlifeurls.cpp b/linden/indra/llcommon/llsecondlifeurls.cpp
index 579313c..d7de8d8 100644
--- a/linden/indra/llcommon/llsecondlifeurls.cpp
+++ b/linden/indra/llcommon/llsecondlifeurls.cpp
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/llsecondlifeurls.h b/linden/indra/llcommon/llsecondlifeurls.h
index 73ada00..9fd75c3 100644
--- a/linden/indra/llcommon/llsecondlifeurls.h
+++ b/linden/indra/llcommon/llsecondlifeurls.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/llsimplehash.h b/linden/indra/llcommon/llsimplehash.h
index 24edf82..0ba2a30 100644
--- a/linden/indra/llcommon/llsimplehash.h
+++ b/linden/indra/llcommon/llsimplehash.h
@@ -16,7 +16,8 @@
16 * There are special exceptions to the terms and conditions of the GPL as 16 * There are special exceptions to the terms and conditions of the GPL as
17 * it is applied to this Source Code. View the full text of the exception 17 * it is applied to this Source Code. View the full text of the exception
18 * in the file doc/FLOSS-exception.txt in this software distribution, or 18 * in the file doc/FLOSS-exception.txt in this software distribution, or
19 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 19 * online at
20 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
20 * 21 *
21 * By copying, modifying or distributing this software, you acknowledge 22 * By copying, modifying or distributing this software, you acknowledge
22 * that you have read and understood your obligations described above, 23 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/llskiplist.h b/linden/indra/llcommon/llskiplist.h
index 514f3ba..33a8687 100644
--- a/linden/indra/llcommon/llskiplist.h
+++ b/linden/indra/llcommon/llskiplist.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/llskipmap.h b/linden/indra/llcommon/llskipmap.h
index d0f557f..6bbca8f 100644
--- a/linden/indra/llcommon/llskipmap.h
+++ b/linden/indra/llcommon/llskipmap.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/llsmoothstep.h b/linden/indra/llcommon/llsmoothstep.h
index 86cc884..153c83d 100644
--- a/linden/indra/llcommon/llsmoothstep.h
+++ b/linden/indra/llcommon/llsmoothstep.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/llstack.h b/linden/indra/llcommon/llstack.h
index b36cfb7..66175c7 100644
--- a/linden/indra/llcommon/llstack.h
+++ b/linden/indra/llcommon/llstack.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/llstat.cpp b/linden/indra/llcommon/llstat.cpp
index 31a72e2..cbf5a2e 100644
--- a/linden/indra/llcommon/llstat.cpp
+++ b/linden/indra/llcommon/llstat.cpp
@@ -16,7 +16,8 @@
16 * There are special exceptions to the terms and conditions of the GPL as 16 * There are special exceptions to the terms and conditions of the GPL as
17 * it is applied to this Source Code. View the full text of the exception 17 * it is applied to this Source Code. View the full text of the exception
18 * in the file doc/FLOSS-exception.txt in this software distribution, or 18 * in the file doc/FLOSS-exception.txt in this software distribution, or
19 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 19 * online at
20 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
20 * 21 *
21 * By copying, modifying or distributing this software, you acknowledge 22 * By copying, modifying or distributing this software, you acknowledge
22 * that you have read and understood your obligations described above, 23 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/llstat.h b/linden/indra/llcommon/llstat.h
index eceb5e3..66521a3 100644
--- a/linden/indra/llcommon/llstat.h
+++ b/linden/indra/llcommon/llstat.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/llstatenums.h b/linden/indra/llcommon/llstatenums.h
index febd958..f8bf07f 100644
--- a/linden/indra/llcommon/llstatenums.h
+++ b/linden/indra/llcommon/llstatenums.h
@@ -16,7 +16,8 @@
16 * There are special exceptions to the terms and conditions of the GPL as 16 * There are special exceptions to the terms and conditions of the GPL as
17 * it is applied to this Source Code. View the full text of the exception 17 * it is applied to this Source Code. View the full text of the exception
18 * in the file doc/FLOSS-exception.txt in this software distribution, or 18 * in the file doc/FLOSS-exception.txt in this software distribution, or
19 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 19 * online at
20 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
20 * 21 *
21 * By copying, modifying or distributing this software, you acknowledge 22 * By copying, modifying or distributing this software, you acknowledge
22 * that you have read and understood your obligations described above, 23 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/llstl.h b/linden/indra/llcommon/llstl.h
index 13fd9a7..7886179 100644
--- a/linden/indra/llcommon/llstl.h
+++ b/linden/indra/llcommon/llstl.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/llstreamtools.cpp b/linden/indra/llcommon/llstreamtools.cpp
index cd903d8..ee4f463 100644
--- a/linden/indra/llcommon/llstreamtools.cpp
+++ b/linden/indra/llcommon/llstreamtools.cpp
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/llstreamtools.h b/linden/indra/llcommon/llstreamtools.h
index 70cff4d..a6dc4d5 100644
--- a/linden/indra/llcommon/llstreamtools.h
+++ b/linden/indra/llcommon/llstreamtools.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/llstrider.h b/linden/indra/llcommon/llstrider.h
index 645f3c1..369b06b 100644
--- a/linden/indra/llcommon/llstrider.h
+++ b/linden/indra/llcommon/llstrider.h
@@ -16,7 +16,8 @@
16 * There are special exceptions to the terms and conditions of the GPL as 16 * There are special exceptions to the terms and conditions of the GPL as
17 * it is applied to this Source Code. View the full text of the exception 17 * it is applied to this Source Code. View the full text of the exception
18 * in the file doc/FLOSS-exception.txt in this software distribution, or 18 * in the file doc/FLOSS-exception.txt in this software distribution, or
19 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 19 * online at
20 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
20 * 21 *
21 * By copying, modifying or distributing this software, you acknowledge 22 * By copying, modifying or distributing this software, you acknowledge
22 * that you have read and understood your obligations described above, 23 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/llstring.cpp b/linden/indra/llcommon/llstring.cpp
index dfd131b..1f653c1 100644
--- a/linden/indra/llcommon/llstring.cpp
+++ b/linden/indra/llcommon/llstring.cpp
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
@@ -662,7 +663,8 @@ S32 LLStringOps::collate(const llwchar* a, const llwchar* b)
662 663
663namespace LLStringFn 664namespace LLStringFn
664{ 665{
665 void replace_nonprintable(std::basic_string<char>& string, char replacement) 666 // NOTE - this restricts output to ascii
667 void replace_nonprintable_in_ascii(std::basic_string<char>& string, char replacement)
666 { 668 {
667 const char MIN = 0x20; 669 const char MIN = 0x20;
668 std::basic_string<char>::size_type len = string.size(); 670 std::basic_string<char>::size_type len = string.size();
@@ -675,23 +677,9 @@ namespace LLStringFn
675 } 677 }
676 } 678 }
677 679
678 void replace_nonprintable(
679 std::basic_string<llwchar>& string,
680 llwchar replacement)
681 {
682 const llwchar MIN = 0x20;
683 const llwchar MAX = 0x7f;
684 std::basic_string<llwchar>::size_type len = string.size();
685 for(std::basic_string<llwchar>::size_type ii = 0; ii < len; ++ii)
686 {
687 if((string[ii] < MIN) || (string[ii] > MAX))
688 {
689 string[ii] = replacement;
690 }
691 }
692 }
693 680
694 void replace_nonprintable_and_pipe(std::basic_string<char>& str, 681 // NOTE - this restricts output to ascii
682 void replace_nonprintable_and_pipe_in_ascii(std::basic_string<char>& str,
695 char replacement) 683 char replacement)
696 { 684 {
697 const char MIN = 0x20; 685 const char MIN = 0x20;
@@ -706,22 +694,6 @@ namespace LLStringFn
706 } 694 }
707 } 695 }
708 696
709 void replace_nonprintable_and_pipe(std::basic_string<llwchar>& str,
710 llwchar replacement)
711 {
712 const llwchar MIN = 0x20;
713 const llwchar MAX = 0x7f;
714 const llwchar PIPE = 0x7c;
715 std::basic_string<llwchar>::size_type len = str.size();
716 for(std::basic_string<llwchar>::size_type ii = 0; ii < len; ++ii)
717 {
718 if( (str[ii] < MIN) || (str[ii] > MAX) || (str[ii] == PIPE) )
719 {
720 str[ii] = replacement;
721 }
722 }
723 }
724
725 // https://wiki.lindenlab.com/wiki/Unicode_Guidelines has details on 697 // https://wiki.lindenlab.com/wiki/Unicode_Guidelines has details on
726 // allowable code points for XML. Specifically, they are: 698 // allowable code points for XML. Specifically, they are:
727 // 0x09, 0x0a, 0x0d, and 0x20 on up. JC 699 // 0x09, 0x0a, 0x0d, and 0x20 on up. JC
@@ -747,6 +719,23 @@ namespace LLStringFn
747 return output; 719 return output;
748 } 720 }
749 721
722 /**
723 * @brief Replace all control characters (c < 0x20) with replacement in
724 * string.
725 */
726 void replace_ascii_controlchars(std::basic_string<char>& string, char replacement)
727 {
728 const unsigned char MIN = 0x20;
729 std::basic_string<char>::size_type len = string.size();
730 for(std::basic_string<char>::size_type ii = 0; ii < len; ++ii)
731 {
732 const unsigned char c = (unsigned char) string[ii];
733 if(c < MIN)
734 {
735 string[ii] = replacement;
736 }
737 }
738 }
750} 739}
751 740
752 741
diff --git a/linden/indra/llcommon/llstring.h b/linden/indra/llcommon/llstring.h
index 720b163..99a9b9e 100644
--- a/linden/indra/llcommon/llstring.h
+++ b/linden/indra/llcommon/llstring.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
@@ -32,15 +33,27 @@
32#ifndef LL_LLSTRING_H 33#ifndef LL_LLSTRING_H
33#define LL_LLSTRING_H 34#define LL_LLSTRING_H
34 35
36#include <string>
37
35#if LL_LINUX || LL_SOLARIS 38#if LL_LINUX || LL_SOLARIS
36#include <wctype.h> 39#include <wctype.h>
37#include <wchar.h> 40#include <wchar.h>
38#endif 41#endif
39 42
43#include <string.h>
44
45#if LL_SOLARIS
46// stricmp and strnicmp do not exist on Solaris:
47#define stricmp strcasecmp
48#define strnicmp strncasecmp
49#endif
50
40const char LL_UNKNOWN_CHAR = '?'; 51const char LL_UNKNOWN_CHAR = '?';
41 52
42#if LL_DARWIN || LL_LINUX || LL_SOLARIS 53#if LL_DARWIN || LL_LINUX || LL_SOLARIS
43// Template specialization of char_traits for U16s. Only necessary on Mac and Linux (exists on Windows already) 54// Template specialization of char_traits for U16s. Only necessary on Mac and Linux (exists on Windows already)
55#include <cstring>
56
44namespace std 57namespace std
45{ 58{
46template<> 59template<>
@@ -486,48 +499,29 @@ namespace LLStringFn
486 /** 499 /**
487 * @brief Replace all non-printable characters with replacement in 500 * @brief Replace all non-printable characters with replacement in
488 * string. 501 * string.
502 * NOTE - this will zap non-ascii
489 * 503 *
490 * @param [in,out] string the to modify. out value is the string 504 * @param [in,out] string the to modify. out value is the string
491 * with zero non-printable characters. 505 * with zero non-printable characters.
492 * @param The replacement character. use LL_UNKNOWN_CHAR if unsure. 506 * @param The replacement character. use LL_UNKNOWN_CHAR if unsure.
493 */ 507 */
494 void replace_nonprintable( 508 void replace_nonprintable_in_ascii(
495 std::basic_string<char>& string, 509 std::basic_string<char>& string,
496 char replacement); 510 char replacement);
497 511
498 /**
499 * @brief Replace all non-printable characters with replacement in
500 * a wide string.
501 *
502 * @param [in,out] string the to modify. out value is the string
503 * with zero non-printable characters.
504 * @param The replacement character. use LL_UNKNOWN_CHAR if unsure.
505 */
506 void replace_nonprintable(
507 std::basic_string<llwchar>& string,
508 llwchar replacement);
509 512
510 /** 513 /**
511 * @brief Replace all non-printable characters and pipe characters 514 * @brief Replace all non-printable characters and pipe characters
512 * with replacement in a string. 515 * with replacement in a string.
516 * NOTE - this will zap non-ascii
513 * 517 *
514 * @param [in,out] the string to modify. out value is the string 518 * @param [in,out] the string to modify. out value is the string
515 * with zero non-printable characters and zero pipe characters. 519 * with zero non-printable characters and zero pipe characters.
516 * @param The replacement character. use LL_UNKNOWN_CHAR if unsure. 520 * @param The replacement character. use LL_UNKNOWN_CHAR if unsure.
517 */ 521 */
518 void replace_nonprintable_and_pipe(std::basic_string<char>& str, 522 void replace_nonprintable_and_pipe_in_ascii(std::basic_string<char>& str,
519 char replacement); 523 char replacement);
520 524
521 /**
522 * @brief Replace all non-printable characters and pipe characters
523 * with replacement in a wide string.
524 *
525 * @param [in,out] the string to modify. out value is the string
526 * with zero non-printable characters and zero pipe characters.
527 * @param The replacement wide character. use LL_UNKNOWN_CHAR if unsure.
528 */
529 void replace_nonprintable_and_pipe(std::basic_string<llwchar>& str,
530 llwchar replacement);
531 525
532 /** 526 /**
533 * @brief Remove all characters that are not allowed in XML 1.0. 527 * @brief Remove all characters that are not allowed in XML 1.0.
@@ -535,6 +529,19 @@ namespace LLStringFn
535 * Works with US ASCII and UTF-8 encoded strings. JC 529 * Works with US ASCII and UTF-8 encoded strings. JC
536 */ 530 */
537 std::string strip_invalid_xml(const std::string& input); 531 std::string strip_invalid_xml(const std::string& input);
532
533
534 /**
535 * @brief Replace all control characters (0 <= c < 0x20) with replacement in
536 * string. This is safe for utf-8
537 *
538 * @param [in,out] string the to modify. out value is the string
539 * with zero non-printable characters.
540 * @param The replacement character. use LL_UNKNOWN_CHAR if unsure.
541 */
542 void replace_ascii_controlchars(
543 std::basic_string<char>& string,
544 char replacement);
538} 545}
539 546
540//////////////////////////////////////////////////////////// 547////////////////////////////////////////////////////////////
diff --git a/linden/indra/llcommon/llstringtable.cpp b/linden/indra/llcommon/llstringtable.cpp
index c5f575f..27f9036 100644
--- a/linden/indra/llcommon/llstringtable.cpp
+++ b/linden/indra/llcommon/llstringtable.cpp
@@ -18,7 +18,8 @@
18 * There are special exceptions to the terms and conditions of the GPL as 18 * There are special exceptions to the terms and conditions of the GPL as
19 * it is applied to this Source Code. View the full text of the exception 19 * it is applied to this Source Code. View the full text of the exception
20 * in the file doc/FLOSS-exception.txt in this software distribution, or 20 * in the file doc/FLOSS-exception.txt in this software distribution, or
21 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 21 * online at
22 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 * 23 *
23 * By copying, modifying or distributing this software, you acknowledge 24 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above, 25 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/llstringtable.h b/linden/indra/llcommon/llstringtable.h
index e7a2edd..4492063 100644
--- a/linden/indra/llcommon/llstringtable.h
+++ b/linden/indra/llcommon/llstringtable.h
@@ -18,7 +18,8 @@
18 * There are special exceptions to the terms and conditions of the GPL as 18 * There are special exceptions to the terms and conditions of the GPL as
19 * it is applied to this Source Code. View the full text of the exception 19 * it is applied to this Source Code. View the full text of the exception
20 * in the file doc/FLOSS-exception.txt in this software distribution, or 20 * in the file doc/FLOSS-exception.txt in this software distribution, or
21 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 21 * online at
22 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 * 23 *
23 * By copying, modifying or distributing this software, you acknowledge 24 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above, 25 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/llsys.cpp b/linden/indra/llcommon/llsys.cpp
index 06982f0..2e93b2a 100644
--- a/linden/indra/llcommon/llsys.cpp
+++ b/linden/indra/llcommon/llsys.cpp
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
@@ -58,6 +59,17 @@
58# include <sys/sysinfo.h> 59# include <sys/sysinfo.h>
59const char MEMINFO_FILE[] = "/proc/meminfo"; 60const char MEMINFO_FILE[] = "/proc/meminfo";
60const char CPUINFO_FILE[] = "/proc/cpuinfo"; 61const char CPUINFO_FILE[] = "/proc/cpuinfo";
62#elif LL_SOLARIS
63# include <stdio.h>
64# include <unistd.h>
65# include <sys/utsname.h>
66# define _STRUCTURED_PROC 1
67# include <sys/procfs.h>
68# include <sys/types.h>
69# include <sys/stat.h>
70# include <fcntl.h>
71# include <errno.h>
72extern int errno;
61#endif 73#endif
62 74
63 75
@@ -288,19 +300,22 @@ U32 LLOSInfo::getProcessVirtualSizeKB()
288#endif 300#endif
289#if LL_LINUX 301#if LL_LINUX
290 LLFILE* status_filep = LLFile::fopen("/proc/self/status", "rb"); 302 LLFILE* status_filep = LLFile::fopen("/proc/self/status", "rb");
291 S32 numRead = 0; 303 if (status_filep)
292 char buff[STATUS_SIZE]; /* Flawfinder: ignore */ 304 {
305 S32 numRead = 0;
306 char buff[STATUS_SIZE]; /* Flawfinder: ignore */
293 307
294 size_t nbytes = fread(buff, 1, STATUS_SIZE-1, status_filep); 308 size_t nbytes = fread(buff, 1, STATUS_SIZE-1, status_filep);
295 buff[nbytes] = '\0'; 309 buff[nbytes] = '\0';
296 310
297 // All these guys return numbers in KB 311 // All these guys return numbers in KB
298 char *memp = strstr(buff, "VmSize:"); 312 char *memp = strstr(buff, "VmSize:");
299 if (memp) 313 if (memp)
300 { 314 {
301 numRead += sscanf(memp, "%*s %u", &virtual_size); 315 numRead += sscanf(memp, "%*s %u", &virtual_size);
316 }
317 fclose(status_filep);
302 } 318 }
303 fclose(status_filep);
304#elif LL_SOLARIS 319#elif LL_SOLARIS
305 char proc_ps[LL_MAX_PATH]; 320 char proc_ps[LL_MAX_PATH];
306 sprintf(proc_ps, "/proc/%d/psinfo", (int)getpid()); 321 sprintf(proc_ps, "/proc/%d/psinfo", (int)getpid());
diff --git a/linden/indra/llcommon/llsys.h b/linden/indra/llcommon/llsys.h
index b2e9624..03f48ca 100644
--- a/linden/indra/llcommon/llsys.h
+++ b/linden/indra/llcommon/llsys.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/llthread.cpp b/linden/indra/llcommon/llthread.cpp
index af055a9..37b03a4 100644
--- a/linden/indra/llcommon/llthread.cpp
+++ b/linden/indra/llcommon/llthread.cpp
@@ -16,7 +16,8 @@
16 * There are special exceptions to the terms and conditions of the GPL as 16 * There are special exceptions to the terms and conditions of the GPL as
17 * it is applied to this Source Code. View the full text of the exception 17 * it is applied to this Source Code. View the full text of the exception
18 * in the file doc/FLOSS-exception.txt in this software distribution, or 18 * in the file doc/FLOSS-exception.txt in this software distribution, or
19 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 19 * online at
20 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
20 * 21 *
21 * By copying, modifying or distributing this software, you acknowledge 22 * By copying, modifying or distributing this software, you acknowledge
22 * that you have read and understood your obligations described above, 23 * that you have read and understood your obligations described above,
@@ -101,12 +102,20 @@ LLThread::LLThread(const std::string& name, apr_pool_t *poolp) :
101 apr_pool_create(&mAPRPoolp, NULL); // Create a subpool for this thread 102 apr_pool_create(&mAPRPoolp, NULL); // Create a subpool for this thread
102 } 103 }
103 mRunCondition = new LLCondition(mAPRPoolp); 104 mRunCondition = new LLCondition(mAPRPoolp);
105
106 mLocalAPRFilePoolp = NULL ;
104} 107}
105 108
106 109
107LLThread::~LLThread() 110LLThread::~LLThread()
108{ 111{
109 shutdown(); 112 shutdown();
113
114 if(mLocalAPRFilePoolp)
115 {
116 delete mLocalAPRFilePoolp ;
117 mLocalAPRFilePoolp = NULL ;
118 }
110} 119}
111 120
112void LLThread::shutdown() 121void LLThread::shutdown()
diff --git a/linden/indra/llcommon/llthread.h b/linden/indra/llcommon/llthread.h
index 036c330..457f45b 100644
--- a/linden/indra/llcommon/llthread.h
+++ b/linden/indra/llcommon/llthread.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
@@ -82,7 +83,8 @@ public:
82 void start(void); 83 void start(void);
83 84
84 apr_pool_t *getAPRPool() { return mAPRPoolp; } 85 apr_pool_t *getAPRPool() { return mAPRPoolp; }
85 86 LLVolatileAPRPool* getLocalAPRFilePool() { return mLocalAPRFilePoolp ; }
87
86private: 88private:
87 bool mPaused; 89 bool mPaused;
88 90
@@ -98,6 +100,11 @@ protected:
98 bool mIsLocalPool; 100 bool mIsLocalPool;
99 EThreadStatus mStatus; 101 EThreadStatus mStatus;
100 102
103 //a local apr_pool for APRFile operations in this thread. If it exists, LLAPRFile::sAPRFilePoolp should not be used.
104 //Note: this pool is used by APRFile ONLY, do NOT use it for any other purposes.
105 // otherwise it will cause severe memory leaking!!! --bao
106 LLVolatileAPRPool *mLocalAPRFilePoolp ;
107
101 void setQuitting(); 108 void setQuitting();
102 109
103 // virtual function overridden by subclass -- this will be called when the thread runs 110 // virtual function overridden by subclass -- this will be called when the thread runs
diff --git a/linden/indra/llcommon/lltimer.cpp b/linden/indra/llcommon/lltimer.cpp
index f5b5ef0..fa6efaf 100644
--- a/linden/indra/llcommon/lltimer.cpp
+++ b/linden/indra/llcommon/lltimer.cpp
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
@@ -569,6 +570,14 @@ LLEventTimer::LLEventTimer(F32 period)
569 sActiveList.push_back(this); 570 sActiveList.push_back(this);
570} 571}
571 572
573LLEventTimer::LLEventTimer(const LLDate& time)
574: mEventTimer()
575{
576 mPeriod = (F32)(time.secondsSinceEpoch() - LLDate::now().secondsSinceEpoch());
577 sActiveList.push_back(this);
578}
579
580
572LLEventTimer::~LLEventTimer() 581LLEventTimer::~LLEventTimer()
573{ 582{
574 sActiveList.remove(this); 583 sActiveList.remove(this);
diff --git a/linden/indra/llcommon/lltimer.h b/linden/indra/llcommon/lltimer.h
index a8ec0cc..e2cf1c7 100644
--- a/linden/indra/llcommon/lltimer.h
+++ b/linden/indra/llcommon/lltimer.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
@@ -32,12 +33,13 @@
32#ifndef LL_TIMER_H 33#ifndef LL_TIMER_H
33#define LL_TIMER_H 34#define LL_TIMER_H
34 35
35#if LL_LINUX || LL_DARWIN 36#if LL_LINUX || LL_DARWIN || LL_SOLARIS
36#include <sys/time.h> 37#include <sys/time.h>
37#endif 38#endif
38#include <limits.h> 39#include <limits.h>
39 40
40#include "stdtypes.h" 41#include "stdtypes.h"
42#include "lldate.h"
41 43
42#include <string> 44#include <string>
43#include <list> 45#include <list>
@@ -173,6 +175,7 @@ class LLEventTimer
173{ 175{
174public: 176public:
175 LLEventTimer(F32 period); // period is the amount of time between each call to tick() in seconds 177 LLEventTimer(F32 period); // period is the amount of time between each call to tick() in seconds
178 LLEventTimer(const LLDate& time);
176 virtual ~LLEventTimer(); 179 virtual ~LLEventTimer();
177 180
178 //function to be called at the supplied frequency 181 //function to be called at the supplied frequency
diff --git a/linden/indra/llcommon/lluri.cpp b/linden/indra/llcommon/lluri.cpp
index 1c78b2d..3dbc837 100644
--- a/linden/indra/llcommon/lluri.cpp
+++ b/linden/indra/llcommon/lluri.cpp
@@ -19,7 +19,8 @@
19 * There are special exceptions to the terms and conditions of the GPL as 19 * There are special exceptions to the terms and conditions of the GPL as
20 * it is applied to this Source Code. View the full text of the exception 20 * it is applied to this Source Code. View the full text of the exception
21 * in the file doc/FLOSS-exception.txt in this software distribution, or 21 * in the file doc/FLOSS-exception.txt in this software distribution, or
22 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 22 * online at
23 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
23 * 24 *
24 * By copying, modifying or distributing this software, you acknowledge 25 * By copying, modifying or distributing this software, you acknowledge
25 * that you have read and understood your obligations described above, 26 * that you have read and understood your obligations described above,
@@ -599,3 +600,8 @@ std::string LLURI::mapToQueryString(const LLSD& queryMap)
599 } 600 }
600 return query_string; 601 return query_string;
601} 602}
603
604bool operator!=(const LLURI& first, const LLURI& second)
605{
606 return (first.asString() != second.asString());
607}
diff --git a/linden/indra/llcommon/lluri.h b/linden/indra/llcommon/lluri.h
index 9271349..156d80b 100644
--- a/linden/indra/llcommon/lluri.h
+++ b/linden/indra/llcommon/lluri.h
@@ -19,7 +19,8 @@
19 * There are special exceptions to the terms and conditions of the GPL as 19 * There are special exceptions to the terms and conditions of the GPL as
20 * it is applied to this Source Code. View the full text of the exception 20 * it is applied to this Source Code. View the full text of the exception
21 * in the file doc/FLOSS-exception.txt in this software distribution, or 21 * in the file doc/FLOSS-exception.txt in this software distribution, or
22 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 22 * online at
23 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
23 * 24 *
24 * By copying, modifying or distributing this software, you acknowledge 25 * By copying, modifying or distributing this software, you acknowledge
25 * that you have read and understood your obligations described above, 26 * that you have read and understood your obligations described above,
@@ -187,4 +188,7 @@ private:
187 std::string mEscapedQuery; 188 std::string mEscapedQuery;
188}; 189};
189 190
191// this operator required for tut
192bool operator!=(const LLURI& first, const LLURI& second);
193
190#endif // LL_LLURI_H 194#endif // LL_LLURI_H
diff --git a/linden/indra/llcommon/lluuid.cpp b/linden/indra/llcommon/lluuid.cpp
index 4f0f95e..bcbae06 100644
--- a/linden/indra/llcommon/lluuid.cpp
+++ b/linden/indra/llcommon/lluuid.cpp
@@ -16,7 +16,8 @@
16 * There are special exceptions to the terms and conditions of the GPL as 16 * There are special exceptions to the terms and conditions of the GPL as
17 * it is applied to this Source Code. View the full text of the exception 17 * it is applied to this Source Code. View the full text of the exception
18 * in the file doc/FLOSS-exception.txt in this software distribution, or 18 * in the file doc/FLOSS-exception.txt in this software distribution, or
19 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 19 * online at
20 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
20 * 21 *
21 * By copying, modifying or distributing this software, you acknowledge 22 * By copying, modifying or distributing this software, you acknowledge
22 * that you have read and understood your obligations described above, 23 * that you have read and understood your obligations described above,
@@ -208,7 +209,7 @@ std::string LLUUID::asString() const
208 209
209BOOL LLUUID::set(const char* in_string, BOOL emit) 210BOOL LLUUID::set(const char* in_string, BOOL emit)
210{ 211{
211 return set(ll_safe_string(in_string)); 212 return set(ll_safe_string(in_string),emit);
212} 213}
213 214
214BOOL LLUUID::set(const std::string& in_string, BOOL emit) 215BOOL LLUUID::set(const std::string& in_string, BOOL emit)
@@ -230,7 +231,7 @@ BOOL LLUUID::set(const std::string& in_string, BOOL emit)
230 { 231 {
231 if(emit) 232 if(emit)
232 { 233 {
233 llinfos << "Warning! Using broken UUID string format" << llendl; 234 llwarns << "Warning! Using broken UUID string format" << llendl;
234 } 235 }
235 broken_format = TRUE; 236 broken_format = TRUE;
236 } 237 }
@@ -239,7 +240,8 @@ BOOL LLUUID::set(const std::string& in_string, BOOL emit)
239 // Bad UUID string. Spam as INFO, as most cases we don't care. 240 // Bad UUID string. Spam as INFO, as most cases we don't care.
240 if(emit) 241 if(emit)
241 { 242 {
242 llinfos << "Bad UUID string: " << in_string << llendl; 243 //don't spam the logs because a resident can't spell.
244 llwarns << "Bad UUID string: " << in_string << llendl;
243 } 245 }
244 setNull(); 246 setNull();
245 return FALSE; 247 return FALSE;
@@ -908,6 +910,21 @@ BOOL LLUUID::parseUUID(const std::string& buf, LLUUID* value)
908 return FALSE; 910 return FALSE;
909} 911}
910 912
913//static
914LLUUID LLUUID::generateNewID(std::string hash_string)
915{
916 LLUUID new_id;
917 if (hash_string.empty())
918 {
919 new_id.generate();
920 }
921 else
922 {
923 new_id.generate(hash_string);
924 }
925 return new_id;
926}
927
911LLAssetID LLTransactionID::makeAssetID(const LLUUID& session) const 928LLAssetID LLTransactionID::makeAssetID(const LLUUID& session) const
912{ 929{
913 LLAssetID result; 930 LLAssetID result;
diff --git a/linden/indra/llcommon/lluuid.h b/linden/indra/llcommon/lluuid.h
index 876941f..4b32138 100644
--- a/linden/indra/llcommon/lluuid.h
+++ b/linden/indra/llcommon/lluuid.h
@@ -16,7 +16,8 @@
16 * There are special exceptions to the terms and conditions of the GPL as 16 * There are special exceptions to the terms and conditions of the GPL as
17 * it is applied to this Source Code. View the full text of the exception 17 * it is applied to this Source Code. View the full text of the exception
18 * in the file doc/FLOSS-exception.txt in this software distribution, or 18 * in the file doc/FLOSS-exception.txt in this software distribution, or
19 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 19 * online at
20 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
20 * 21 *
21 * By copying, modifying or distributing this software, you acknowledge 22 * By copying, modifying or distributing this software, you acknowledge
22 * that you have read and understood your obligations described above, 23 * that you have read and understood your obligations described above,
@@ -65,6 +66,9 @@ public:
65 // 66 //
66 void generate(); // Generate a new UUID 67 void generate(); // Generate a new UUID
67 void generate(const std::string& stream); //Generate a new UUID based on hash of input stream 68 void generate(const std::string& stream); //Generate a new UUID based on hash of input stream
69
70 static LLUUID generateNewID(std::string stream = ""); //static version of above for use in initializer expressions such as constructor params, etc.
71
68 BOOL set(const char *in_string, BOOL emit = TRUE); // Convert from string, if emit is FALSE, do not emit warnings 72 BOOL set(const char *in_string, BOOL emit = TRUE); // Convert from string, if emit is FALSE, do not emit warnings
69 BOOL set(const std::string& in_string, BOOL emit = TRUE); // Convert from string, if emit is FALSE, do not emit warnings 73 BOOL set(const std::string& in_string, BOOL emit = TRUE); // Convert from string, if emit is FALSE, do not emit warnings
70 void setNull(); // Faster than setting to LLUUID::null. 74 void setNull(); // Faster than setting to LLUUID::null.
@@ -124,7 +128,7 @@ public:
124 static S32 getNodeID(unsigned char * node_id); 128 static S32 getNodeID(unsigned char * node_id);
125 129
126 static BOOL parseUUID(const std::string& buf, LLUUID* value); 130 static BOOL parseUUID(const std::string& buf, LLUUID* value);
127 131
128 U8 mData[UUID_BYTES]; 132 U8 mData[UUID_BYTES];
129}; 133};
130 134
diff --git a/linden/indra/llcommon/lluuidhashmap.h b/linden/indra/llcommon/lluuidhashmap.h
index 67921e6..c45e413 100644
--- a/linden/indra/llcommon/lluuidhashmap.h
+++ b/linden/indra/llcommon/lluuidhashmap.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/llversionserver.h b/linden/indra/llcommon/llversionserver.h
index 79f4630..479b06d 100644
--- a/linden/indra/llcommon/llversionserver.h
+++ b/linden/indra/llcommon/llversionserver.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
@@ -33,9 +34,9 @@
33#define LL_LLVERSIONSERVER_H 34#define LL_LLVERSIONSERVER_H
34 35
35const S32 LL_VERSION_MAJOR = 1; 36const S32 LL_VERSION_MAJOR = 1;
36const S32 LL_VERSION_MINOR = 24; 37const S32 LL_VERSION_MINOR = 27;
37const S32 LL_VERSION_PATCH = 9; 38const S32 LL_VERSION_PATCH = 0;
38const S32 LL_VERSION_BUILD = 98650; 39const S32 LL_VERSION_BUILD = 123523;
39 40
40const char * const LL_CHANNEL = "Second Life Server"; 41const char * const LL_CHANNEL = "Second Life Server";
41 42
diff --git a/linden/indra/llcommon/llversionviewer.h b/linden/indra/llcommon/llversionviewer.h
index 34fb615..826111f 100644
--- a/linden/indra/llcommon/llversionviewer.h
+++ b/linden/indra/llcommon/llversionviewer.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
@@ -33,9 +34,9 @@
33#define LL_LLVERSIONVIEWER_H 34#define LL_LLVERSIONVIEWER_H
34 35
35const S32 LL_VERSION_MAJOR = 1; 36const S32 LL_VERSION_MAJOR = 1;
36const S32 LL_VERSION_MINOR = 22; 37const S32 LL_VERSION_MINOR = 23;
37const S32 LL_VERSION_PATCH = 11; 38const S32 LL_VERSION_PATCH = 4;
38const S32 LL_VERSION_BUILD = 0; 39const S32 LL_VERSION_BUILD = 123523;
39 40
40const char * const LL_CHANNEL = "Imprudence"; 41const char * const LL_CHANNEL = "Imprudence";
41 42
diff --git a/linden/indra/llcommon/llworkerthread.cpp b/linden/indra/llcommon/llworkerthread.cpp
index 96a957b..5dda600 100644
--- a/linden/indra/llcommon/llworkerthread.cpp
+++ b/linden/indra/llcommon/llworkerthread.cpp
@@ -16,7 +16,8 @@
16 * There are special exceptions to the terms and conditions of the GPL as 16 * There are special exceptions to the terms and conditions of the GPL as
17 * it is applied to this Source Code. View the full text of the exception 17 * it is applied to this Source Code. View the full text of the exception
18 * in the file doc/FLOSS-exception.txt in this software distribution, or 18 * in the file doc/FLOSS-exception.txt in this software distribution, or
19 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 19 * online at
20 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
20 * 21 *
21 * By copying, modifying or distributing this software, you acknowledge 22 * By copying, modifying or distributing this software, you acknowledge
22 * that you have read and understood your obligations described above, 23 * that you have read and understood your obligations described above,
@@ -36,16 +37,18 @@
36#include "llframecallbackmanager.h" 37#include "llframecallbackmanager.h"
37#endif 38#endif
38 39
39BOOL LLWorkerClass::sDeleteLock = FALSE ;
40//============================================================================ 40//============================================================================
41// Run on MAIN thread 41// Run on MAIN thread
42 42
43LLWorkerThread::LLWorkerThread(const std::string& name, bool threaded) : 43LLWorkerThread::LLWorkerThread(const std::string& name, bool threaded) :
44 LLQueuedThread(name, threaded), 44 LLQueuedThread(name, threaded)
45 mWorkerAPRPoolp(NULL)
46{ 45{
47 apr_pool_create(&mWorkerAPRPoolp, NULL); 46 mDeleteMutex = new LLMutex(NULL);
48 mDeleteMutex = new LLMutex(getAPRPool()); 47
48 if(!mLocalAPRFilePoolp)
49 {
50 mLocalAPRFilePoolp = new LLVolatileAPRPool() ;
51 }
49} 52}
50 53
51LLWorkerThread::~LLWorkerThread() 54LLWorkerThread::~LLWorkerThread()
@@ -95,7 +98,6 @@ S32 LLWorkerThread::update(U32 max_time_ms)
95 { 98 {
96 (*iter)->abortWork(false); 99 (*iter)->abortWork(false);
97 } 100 }
98 LLWorkerClass::sDeleteLock = TRUE ;
99 for (std::vector<LLWorkerClass*>::iterator iter = delete_list.begin(); 101 for (std::vector<LLWorkerClass*>::iterator iter = delete_list.begin();
100 iter != delete_list.end(); ++iter) 102 iter != delete_list.end(); ++iter)
101 { 103 {
@@ -109,8 +111,7 @@ S32 LLWorkerThread::update(U32 max_time_ms)
109 } 111 }
110 delete *iter; 112 delete *iter;
111 } 113 }
112 LLWorkerClass::sDeleteLock = FALSE ; 114 // delete and aborted entries mean there's still work to do
113 // delete and aborted entries mean there's still work to do
114 res += delete_list.size() + abort_list.size(); 115 res += delete_list.size() + abort_list.size();
115 return res; 116 return res;
116} 117}
@@ -187,7 +188,7 @@ LLWorkerClass::LLWorkerClass(LLWorkerThread* workerthread, const std::string& na
187 : mWorkerThread(workerthread), 188 : mWorkerThread(workerthread),
188 mWorkerClassName(name), 189 mWorkerClassName(name),
189 mRequestHandle(LLWorkerThread::nullHandle()), 190 mRequestHandle(LLWorkerThread::nullHandle()),
190 mMutex(workerthread->getWorkerAPRPool()), 191 mMutex(NULL),
191 mWorkFlags(0) 192 mWorkFlags(0)
192{ 193{
193 if (!mWorkerThread) 194 if (!mWorkerThread)
diff --git a/linden/indra/llcommon/llworkerthread.h b/linden/indra/llcommon/llworkerthread.h
index 62b0696..19407f4 100644
--- a/linden/indra/llcommon/llworkerthread.h
+++ b/linden/indra/llcommon/llworkerthread.h
@@ -16,7 +16,8 @@
16 * There are special exceptions to the terms and conditions of the GPL as 16 * There are special exceptions to the terms and conditions of the GPL as
17 * it is applied to this Source Code. View the full text of the exception 17 * it is applied to this Source Code. View the full text of the exception
18 * in the file doc/FLOSS-exception.txt in this software distribution, or 18 * in the file doc/FLOSS-exception.txt in this software distribution, or
19 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 19 * online at
20 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
20 * 21 *
21 * By copying, modifying or distributing this software, you acknowledge 22 * By copying, modifying or distributing this software, you acknowledge
22 * that you have read and understood your obligations described above, 23 * that you have read and understood your obligations described above,
@@ -37,6 +38,7 @@
37#include <set> 38#include <set>
38 39
39#include "llqueuedthread.h" 40#include "llqueuedthread.h"
41#include "llapr.h"
40 42
41#define USE_FRAME_CALLBACK_MANAGER 0 43#define USE_FRAME_CALLBACK_MANAGER 0
42 44
@@ -81,14 +83,11 @@ private:
81 typedef std::list<LLWorkerClass*> delete_list_t; 83 typedef std::list<LLWorkerClass*> delete_list_t;
82 delete_list_t mDeleteList; 84 delete_list_t mDeleteList;
83 LLMutex* mDeleteMutex; 85 LLMutex* mDeleteMutex;
84 apr_pool_t* mWorkerAPRPoolp;
85 86
86public: 87public:
87 LLWorkerThread(const std::string& name, bool threaded = true); 88 LLWorkerThread(const std::string& name, bool threaded = true);
88 ~LLWorkerThread(); 89 ~LLWorkerThread();
89 90
90 apr_pool_t* getWorkerAPRPool() { return mWorkerAPRPoolp; }
91
92 /*virtual*/ S32 update(U32 max_time_ms); 91 /*virtual*/ S32 update(U32 max_time_ms);
93 92
94 handle_t addWorkRequest(LLWorkerClass* workerclass, S32 param, U32 priority = PRIORITY_NORMAL); 93 handle_t addWorkRequest(LLWorkerClass* workerclass, S32 param, U32 priority = PRIORITY_NORMAL);
@@ -120,8 +119,6 @@ class LLWorkerClass
120 friend class LLWorkerThread::WorkRequest; 119 friend class LLWorkerThread::WorkRequest;
121 120
122public: 121public:
123 static BOOL sDeleteLock ;
124public:
125 typedef LLWorkerThread::handle_t handle_t; 122 typedef LLWorkerThread::handle_t handle_t;
126 enum FLAGS 123 enum FLAGS
127 { 124 {
diff --git a/linden/indra/llcommon/metaclass.cpp b/linden/indra/llcommon/metaclass.cpp
index 760d568..90679d3 100644
--- a/linden/indra/llcommon/metaclass.cpp
+++ b/linden/indra/llcommon/metaclass.cpp
@@ -19,7 +19,8 @@
19 * There are special exceptions to the terms and conditions of the GPL as 19 * There are special exceptions to the terms and conditions of the GPL as
20 * it is applied to this Source Code. View the full text of the exception 20 * it is applied to this Source Code. View the full text of the exception
21 * in the file doc/FLOSS-exception.txt in this software distribution, or 21 * in the file doc/FLOSS-exception.txt in this software distribution, or
22 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 22 * online at
23 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
23 * 24 *
24 * By copying, modifying or distributing this software, you acknowledge 25 * By copying, modifying or distributing this software, you acknowledge
25 * that you have read and understood your obligations described above, 26 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/metaclass.h b/linden/indra/llcommon/metaclass.h
index 3ee7b6f..cc10f16 100644
--- a/linden/indra/llcommon/metaclass.h
+++ b/linden/indra/llcommon/metaclass.h
@@ -19,7 +19,8 @@
19 * There are special exceptions to the terms and conditions of the GPL as 19 * There are special exceptions to the terms and conditions of the GPL as
20 * it is applied to this Source Code. View the full text of the exception 20 * it is applied to this Source Code. View the full text of the exception
21 * in the file doc/FLOSS-exception.txt in this software distribution, or 21 * in the file doc/FLOSS-exception.txt in this software distribution, or
22 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 22 * online at
23 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
23 * 24 *
24 * By copying, modifying or distributing this software, you acknowledge 25 * By copying, modifying or distributing this software, you acknowledge
25 * that you have read and understood your obligations described above, 26 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/metaclasst.h b/linden/indra/llcommon/metaclasst.h
index 6266c62..0d6a450 100644
--- a/linden/indra/llcommon/metaclasst.h
+++ b/linden/indra/llcommon/metaclasst.h
@@ -16,7 +16,8 @@
16 * There are special exceptions to the terms and conditions of the GPL as 16 * There are special exceptions to the terms and conditions of the GPL as
17 * it is applied to this Source Code. View the full text of the exception 17 * it is applied to this Source Code. View the full text of the exception
18 * in the file doc/FLOSS-exception.txt in this software distribution, or 18 * in the file doc/FLOSS-exception.txt in this software distribution, or
19 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 19 * online at
20 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
20 * 21 *
21 * By copying, modifying or distributing this software, you acknowledge 22 * By copying, modifying or distributing this software, you acknowledge
22 * that you have read and understood your obligations described above, 23 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/metaproperty.cpp b/linden/indra/llcommon/metaproperty.cpp
index a017318..784a52a 100644
--- a/linden/indra/llcommon/metaproperty.cpp
+++ b/linden/indra/llcommon/metaproperty.cpp
@@ -19,7 +19,8 @@
19 * There are special exceptions to the terms and conditions of the GPL as 19 * There are special exceptions to the terms and conditions of the GPL as
20 * it is applied to this Source Code. View the full text of the exception 20 * it is applied to this Source Code. View the full text of the exception
21 * in the file doc/FLOSS-exception.txt in this software distribution, or 21 * in the file doc/FLOSS-exception.txt in this software distribution, or
22 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 22 * online at
23 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
23 * 24 *
24 * By copying, modifying or distributing this software, you acknowledge 25 * By copying, modifying or distributing this software, you acknowledge
25 * that you have read and understood your obligations described above, 26 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/metaproperty.h b/linden/indra/llcommon/metaproperty.h
index 8d8e1c6..e5ac359 100644
--- a/linden/indra/llcommon/metaproperty.h
+++ b/linden/indra/llcommon/metaproperty.h
@@ -19,7 +19,8 @@
19 * There are special exceptions to the terms and conditions of the GPL as 19 * There are special exceptions to the terms and conditions of the GPL as
20 * it is applied to this Source Code. View the full text of the exception 20 * it is applied to this Source Code. View the full text of the exception
21 * in the file doc/FLOSS-exception.txt in this software distribution, or 21 * in the file doc/FLOSS-exception.txt in this software distribution, or
22 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 22 * online at
23 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
23 * 24 *
24 * By copying, modifying or distributing this software, you acknowledge 25 * By copying, modifying or distributing this software, you acknowledge
25 * that you have read and understood your obligations described above, 26 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/metapropertyt.h b/linden/indra/llcommon/metapropertyt.h
index ab08116..79a536a 100644
--- a/linden/indra/llcommon/metapropertyt.h
+++ b/linden/indra/llcommon/metapropertyt.h
@@ -16,7 +16,8 @@
16 * There are special exceptions to the terms and conditions of the GPL as 16 * There are special exceptions to the terms and conditions of the GPL as
17 * it is applied to this Source Code. View the full text of the exception 17 * it is applied to this Source Code. View the full text of the exception
18 * in the file doc/FLOSS-exception.txt in this software distribution, or 18 * in the file doc/FLOSS-exception.txt in this software distribution, or
19 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 19 * online at
20 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
20 * 21 *
21 * By copying, modifying or distributing this software, you acknowledge 22 * By copying, modifying or distributing this software, you acknowledge
22 * that you have read and understood your obligations described above, 23 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/processor.h b/linden/indra/llcommon/processor.h
index d9196e3..5ba5540 100644
--- a/linden/indra/llcommon/processor.h
+++ b/linden/indra/llcommon/processor.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/reflective.cpp b/linden/indra/llcommon/reflective.cpp
index f20565a..88e07d7 100644
--- a/linden/indra/llcommon/reflective.cpp
+++ b/linden/indra/llcommon/reflective.cpp
@@ -19,7 +19,8 @@
19 * There are special exceptions to the terms and conditions of the GPL as 19 * There are special exceptions to the terms and conditions of the GPL as
20 * it is applied to this Source Code. View the full text of the exception 20 * it is applied to this Source Code. View the full text of the exception
21 * in the file doc/FLOSS-exception.txt in this software distribution, or 21 * in the file doc/FLOSS-exception.txt in this software distribution, or
22 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 22 * online at
23 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
23 * 24 *
24 * By copying, modifying or distributing this software, you acknowledge 25 * By copying, modifying or distributing this software, you acknowledge
25 * that you have read and understood your obligations described above, 26 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/reflective.h b/linden/indra/llcommon/reflective.h
index e61c931..e2c18eb 100644
--- a/linden/indra/llcommon/reflective.h
+++ b/linden/indra/llcommon/reflective.h
@@ -19,7 +19,8 @@
19 * There are special exceptions to the terms and conditions of the GPL as 19 * There are special exceptions to the terms and conditions of the GPL as
20 * it is applied to this Source Code. View the full text of the exception 20 * it is applied to this Source Code. View the full text of the exception
21 * in the file doc/FLOSS-exception.txt in this software distribution, or 21 * in the file doc/FLOSS-exception.txt in this software distribution, or
22 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 22 * online at
23 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
23 * 24 *
24 * By copying, modifying or distributing this software, you acknowledge 25 * By copying, modifying or distributing this software, you acknowledge
25 * that you have read and understood your obligations described above, 26 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/reflectivet.h b/linden/indra/llcommon/reflectivet.h
index 732c48f..b3195cb 100644
--- a/linden/indra/llcommon/reflectivet.h
+++ b/linden/indra/llcommon/reflectivet.h
@@ -16,7 +16,8 @@
16 * There are special exceptions to the terms and conditions of the GPL as 16 * There are special exceptions to the terms and conditions of the GPL as
17 * it is applied to this Source Code. View the full text of the exception 17 * it is applied to this Source Code. View the full text of the exception
18 * in the file doc/FLOSS-exception.txt in this software distribution, or 18 * in the file doc/FLOSS-exception.txt in this software distribution, or
19 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 19 * online at
20 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
20 * 21 *
21 * By copying, modifying or distributing this software, you acknowledge 22 * By copying, modifying or distributing this software, you acknowledge
22 * that you have read and understood your obligations described above, 23 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/roles_constants.h b/linden/indra/llcommon/roles_constants.h
index a0a24c0..854a153 100644
--- a/linden/indra/llcommon/roles_constants.h
+++ b/linden/indra/llcommon/roles_constants.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/stdenums.h b/linden/indra/llcommon/stdenums.h
index 1c28c0e..41da51f 100644
--- a/linden/indra/llcommon/stdenums.h
+++ b/linden/indra/llcommon/stdenums.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/stdtypes.h b/linden/indra/llcommon/stdtypes.h
index e88cde6..af0b4dd 100644
--- a/linden/indra/llcommon/stdtypes.h
+++ b/linden/indra/llcommon/stdtypes.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
@@ -32,6 +33,7 @@
32#define LL_STDTYPES_H 33#define LL_STDTYPES_H
33 34
34#include <cfloat> 35#include <cfloat>
36#include <climits>
35 37
36typedef signed char S8; 38typedef signed char S8;
37typedef unsigned char U8; 39typedef unsigned char U8;
@@ -104,6 +106,8 @@ typedef U32 TPACKETID;
104 106
105typedef U8 LLPCode; 107typedef U8 LLPCode;
106 108
109#define LL_ARRAY_SIZE( _kArray ) ( sizeof( (_kArray) ) / sizeof( _kArray[0] ) )
110
107#if LL_LINUX && __GNUC__ <= 2 111#if LL_LINUX && __GNUC__ <= 2
108typedef int intptr_t; 112typedef int intptr_t;
109#endif 113#endif
diff --git a/linden/indra/llcommon/string_table.h b/linden/indra/llcommon/string_table.h
index 1d46d81..176be21 100644
--- a/linden/indra/llcommon/string_table.h
+++ b/linden/indra/llcommon/string_table.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/timer.h b/linden/indra/llcommon/timer.h
index b8ed29f..21ed06a 100644
--- a/linden/indra/llcommon/timer.h
+++ b/linden/indra/llcommon/timer.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/timing.cpp b/linden/indra/llcommon/timing.cpp
index 5b5cd55..e1c1f6d 100644
--- a/linden/indra/llcommon/timing.cpp
+++ b/linden/indra/llcommon/timing.cpp
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/timing.h b/linden/indra/llcommon/timing.h
index ae7ac31..2b9f60a 100644
--- a/linden/indra/llcommon/timing.h
+++ b/linden/indra/llcommon/timing.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/u64.cpp b/linden/indra/llcommon/u64.cpp
index 6163191..01fe973 100644
--- a/linden/indra/llcommon/u64.cpp
+++ b/linden/indra/llcommon/u64.cpp
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llcommon/u64.h b/linden/indra/llcommon/u64.h
index 1c38468..09a6b3e 100644
--- a/linden/indra/llcommon/u64.h
+++ b/linden/indra/llcommon/u64.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,