aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llcommon
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--linden/indra/llcommon/CMakeLists.txt188
-rw-r--r--linden/indra/llcommon/files.lst49
-rw-r--r--linden/indra/llcommon/indra_constants.h14
-rw-r--r--linden/indra/llcommon/linden_common.h5
-rw-r--r--linden/indra/llcommon/llapp.cpp2
-rw-r--r--linden/indra/llcommon/llapr.cpp24
-rw-r--r--linden/indra/llcommon/llapr.h34
-rw-r--r--linden/indra/llcommon/llassettype.cpp20
-rw-r--r--linden/indra/llcommon/llassettype.h6
-rw-r--r--linden/indra/llcommon/llbase64.cpp2
-rw-r--r--linden/indra/llcommon/llchat.h6
-rw-r--r--linden/indra/llcommon/llcommon.vcproj608
-rw-r--r--linden/indra/llcommon/llcommon_vc8.vcproj847
-rw-r--r--linden/indra/llcommon/llcommon_vc9.vcproj828
-rw-r--r--linden/indra/llcommon/llcrc.cpp (renamed from linden/indra/llmath/llcrc.cpp)6
-rw-r--r--linden/indra/llcommon/llcrc.h (renamed from linden/indra/llmath/llcrc.h)4
-rw-r--r--linden/indra/llcommon/lldarray.h1
-rw-r--r--linden/indra/llcommon/lldate.cpp2
-rw-r--r--linden/indra/llcommon/llerror.cpp44
-rw-r--r--linden/indra/llcommon/llevent.cpp2
-rw-r--r--linden/indra/llcommon/llfile.cpp88
-rw-r--r--linden/indra/llcommon/llfile.h81
-rw-r--r--linden/indra/llcommon/llfixedbuffer.cpp2
-rw-r--r--linden/indra/llcommon/llfixedbuffer.h2
-rw-r--r--linden/indra/llcommon/llframetimer.cpp1
-rw-r--r--linden/indra/llcommon/llframetimer.h8
-rw-r--r--linden/indra/llcommon/llhash.h4
-rw-r--r--linden/indra/llcommon/llheartbeat.cpp7
-rw-r--r--linden/indra/llcommon/llindraconfigfile.cpp2
-rw-r--r--linden/indra/llcommon/llkeythrottle.h110
-rw-r--r--linden/indra/llcommon/llliveappconfig.cpp2
-rw-r--r--linden/indra/llcommon/lllivefile.cpp2
-rw-r--r--linden/indra/llcommon/lllslconstants.h6
-rw-r--r--linden/indra/llcommon/llmd5.cpp (renamed from linden/indra/llmath/llmd5.cpp)4
-rw-r--r--linden/indra/llcommon/llmd5.h (renamed from linden/indra/llmath/llmd5.h)4
-rw-r--r--linden/indra/llcommon/llmemory.cpp1
-rw-r--r--linden/indra/llcommon/llmemtype.h1
-rw-r--r--linden/indra/llcommon/llpreprocessor.h7
-rw-r--r--linden/indra/llcommon/llprocessor.cpp4
-rw-r--r--linden/indra/llcommon/llprocessor.h2
-rw-r--r--linden/indra/llcommon/llptrskiplist.h1
-rw-r--r--linden/indra/llcommon/llrand.cpp (renamed from linden/indra/llmath/llrand.cpp)0
-rw-r--r--linden/indra/llcommon/llrand.h (renamed from linden/indra/llmath/llrand.h)0
-rw-r--r--linden/indra/llcommon/llsd.cpp28
-rw-r--r--linden/indra/llcommon/llsd.h4
-rw-r--r--linden/indra/llcommon/llsdserialize.cpp30
-rw-r--r--linden/indra/llcommon/llsdserialize.h41
-rw-r--r--linden/indra/llcommon/llsdserialize_xml.cpp137
-rw-r--r--linden/indra/llcommon/llsdutil.cpp132
-rw-r--r--linden/indra/llcommon/llsdutil.h17
-rw-r--r--linden/indra/llcommon/llsecondlifeurls.cpp72
-rw-r--r--linden/indra/llcommon/llsecondlifeurls.h32
-rw-r--r--linden/indra/llcommon/llstat.cpp5
-rw-r--r--linden/indra/llcommon/llstat.h8
-rw-r--r--linden/indra/llcommon/llstatenums.h3
-rw-r--r--linden/indra/llcommon/llstl.h2
-rw-r--r--linden/indra/llcommon/llstring.cpp292
-rw-r--r--linden/indra/llcommon/llstring.h391
-rw-r--r--linden/indra/llcommon/llsys.cpp56
-rw-r--r--linden/indra/llcommon/llsys.h4
-rw-r--r--linden/indra/llcommon/llthread.cpp2
-rw-r--r--linden/indra/llcommon/llthread.h2
-rw-r--r--linden/indra/llcommon/lltimer.cpp25
-rw-r--r--linden/indra/llcommon/lltimer.h37
-rw-r--r--linden/indra/llcommon/lluri.cpp2
-rw-r--r--linden/indra/llcommon/lluuid.cpp (renamed from linden/indra/llmath/lluuid.cpp)110
-rw-r--r--linden/indra/llcommon/lluuid.h (renamed from linden/indra/llmath/lluuid.h)7
-rw-r--r--linden/indra/llcommon/llversionserver.h6
-rw-r--r--linden/indra/llcommon/llversionviewer.h4
-rw-r--r--linden/indra/llcommon/metapropertyt.h13
-rw-r--r--linden/indra/llcommon/roles_constants.h10
-rw-r--r--linden/indra/llcommon/stdtypes.h2
-rw-r--r--linden/indra/llcommon/u64.cpp36
-rw-r--r--linden/indra/llcommon/u64.h9
-rw-r--r--linden/indra/llmessage/llares.cpp (renamed from linden/indra/llcommon/llares.cpp)99
-rw-r--r--linden/indra/llmessage/llares.h (renamed from linden/indra/llcommon/llares.h)6
76 files changed, 1238 insertions, 3417 deletions
diff --git a/linden/indra/llcommon/CMakeLists.txt b/linden/indra/llcommon/CMakeLists.txt
new file mode 100644
index 0000000..72d267d
--- /dev/null
+++ b/linden/indra/llcommon/CMakeLists.txt
@@ -0,0 +1,188 @@
1# -*- cmake -*-
2
3project(llcommon)
4
5include(00-Common)
6include(LLCommon)
7
8include_directories(
9 ${EXPAT_INCLUDE_DIRS}
10 ${LLCOMMON_INCLUDE_DIRS}
11 ${ZLIB_INCLUDE_DIRS}
12 )
13
14set(llcommon_SOURCE_FILES
15 llapp.cpp
16 llapr.cpp
17 llassettype.cpp
18 llbase32.cpp
19 llbase64.cpp
20 llcommon.cpp
21 llcrc.cpp
22 llcriticaldamp.cpp
23 lldate.cpp
24 llerror.cpp
25 llerrorthread.cpp
26 llevent.cpp
27 llfasttimer.cpp
28 llfile.cpp
29 llfindlocale.cpp
30 llfixedbuffer.cpp
31 llformat.cpp
32 llframetimer.cpp
33 llheartbeat.cpp
34 llindraconfigfile.cpp
35 llliveappconfig.cpp
36 lllivefile.cpp
37 lllog.cpp
38 llmd5.cpp
39 llmemory.cpp
40 llmemorystream.cpp
41 llmetrics.cpp
42 llmortician.cpp
43 llprocessor.cpp
44 llqueuedthread.cpp
45 llrand.cpp
46 llrun.cpp
47 llsd.cpp
48 llsdserialize.cpp
49 llsdserialize_xml.cpp
50 llsdutil.cpp
51 llsecondlifeurls.cpp
52 llstat.cpp
53 llstreamtools.cpp
54 llstring.cpp
55 llstringtable.cpp
56 llsys.cpp
57 llthread.cpp
58 lltimer.cpp
59 lluri.cpp
60 lluuid.cpp
61 llworkerthread.cpp
62 metaclass.cpp
63 metaproperty.cpp
64 reflective.cpp
65 timing.cpp
66 u64.cpp
67 )
68
69set(llcommon_HEADER_FILES
70 CMakeLists.txt
71
72 bitpack.h
73 ctype_workaround.h
74 doublelinkedlist.h
75 imageids.h
76 indra_constants.h
77 linden_common.h
78 linked_lists.h
79 llagentconstants.h
80 llapp.h
81 llapr.h
82 llassettype.h
83 llassoclist.h
84 llavatarconstants.h
85 llbase32.h
86 llbase64.h
87 llboost.h
88 llchat.h
89 llclickaction.h
90 llcommon.h
91 llcrc.h
92 llcriticaldamp.h
93 lldarray.h
94 lldarrayptr.h
95 lldate.h
96 lldefs.h
97 lldepthstack.h
98 lldlinked.h
99 lldqueueptr.h
100 llendianswizzle.h
101 llenum.h
102 llerror.h
103 llerrorcontrol.h
104 llerrorlegacy.h
105 llerrorthread.h
106 llevent.h
107 lleventemitter.h
108 llextendedstatus.h
109 llfasttimer.h
110 llfile.h
111 llfindlocale.h
112 llfixedbuffer.h
113 llformat.h
114 llframetimer.h
115 llhash.h
116 llheartbeat.h
117 llindexedqueue.h
118 llindraconfigfile.h
119 llkeythrottle.h
120 lllinkedqueue.h
121 llliveappconfig.h
122 lllivefile.h
123 lllocalidhashmap.h
124 lllog.h
125 lllslconstants.h
126 llmap.h
127 llmd5.h
128 llmemory.h
129 llmemorystream.h
130 llmemtype.h
131 llmetrics.h
132 llmortician.h
133 llnametable.h
134 llpreprocessor.h
135 llpriqueuemap.h
136 llprocessor.h
137 llptrskiplist.h
138 llptrskipmap.h
139 llqueuedthread.h
140 llrand.h
141 llrun.h
142 llsd.h
143 llsdserialize.h
144 llsdserialize_xml.h
145 llsdutil.h
146 llsecondlifeurls.h
147 llsimplehash.h
148 llskiplist.h
149 llskipmap.h
150 llstack.h
151 llstat.h
152 llstatenums.h
153 llstl.h
154 llstreamtools.h
155 llstrider.h
156 llstring.h
157 llstringtable.h
158 llsys.h
159 llthread.h
160 lltimer.h
161 lluri.h
162 lluuid.h
163 lluuidhashmap.h
164 llversionserver.h
165 llversionviewer.h
166 llworkerthread.h
167 metaclass.h
168 metaclasst.h
169 metaproperty.h
170 metapropertyt.h
171 processor.h
172 reflective.h
173 reflectivet.h
174 roles_constants.h
175 stdenums.h
176 stdtypes.h
177 string_table.h
178 timer.h
179 timing.h
180 u64.h
181 )
182
183set_source_files_properties(${llcommon_HEADER_FILES}
184 PROPERTIES HEADER_FILE_ONLY TRUE)
185
186list(APPEND llcommon_SOURCE_FILES ${llcommon_HEADER_FILES})
187
188add_library (llcommon ${llcommon_SOURCE_FILES})
diff --git a/linden/indra/llcommon/files.lst b/linden/indra/llcommon/files.lst
deleted file mode 100644
index d698773..0000000
--- a/linden/indra/llcommon/files.lst
+++ /dev/null
@@ -1,49 +0,0 @@
1llcommon/llapp.cpp
2llcommon/llapr.cpp
3llcommon/llares.cpp
4llcommon/llassettype.cpp
5llcommon/llbase32.cpp
6llcommon/llbase64.cpp
7llcommon/llcommon.cpp
8llcommon/llcriticaldamp.cpp
9llcommon/lldate.cpp
10llcommon/llerror.cpp
11llcommon/llerrorthread.cpp
12llcommon/llevent.cpp
13llcommon/llfasttimer.cpp
14llcommon/llfile.cpp
15llcommon/llfindlocale.cpp
16llcommon/llfixedbuffer.cpp
17llcommon/llformat.cpp
18llcommon/llframetimer.cpp
19llcommon/llheartbeat.cpp
20llcommon/llindraconfigfile.cpp
21llcommon/lllog.cpp
22llcommon/llliveappconfig.cpp
23llcommon/lllivefile.cpp
24llcommon/llmemory.cpp
25llcommon/llmemorystream.cpp
26llcommon/llmetrics.cpp
27llcommon/llmortician.cpp
28llcommon/llprocessor.cpp
29llcommon/llqueuedthread.cpp
30llcommon/llrun.cpp
31llcommon/llsd.cpp
32llcommon/llsdserialize.cpp
33llcommon/llsdserialize_xml.cpp
34llcommon/llsdutil.cpp
35llcommon/llsecondlifeurls.cpp
36llcommon/llstat.cpp
37llcommon/llstreamtools.cpp
38llcommon/llstring.cpp
39llcommon/llstringtable.cpp
40llcommon/llsys.cpp
41llcommon/llthread.cpp
42llcommon/lltimer.cpp
43llcommon/lluri.cpp
44llcommon/llworkerthread.cpp
45llcommon/metaclass.cpp
46llcommon/metaproperty.cpp
47llcommon/reflective.cpp
48llcommon/timing.cpp
49llcommon/u64.cpp
diff --git a/linden/indra/llcommon/indra_constants.h b/linden/indra/llcommon/indra_constants.h
index 77f3d8c..1c48a5c 100644
--- a/linden/indra/llcommon/indra_constants.h
+++ b/linden/indra/llcommon/indra_constants.h
@@ -38,7 +38,11 @@
38// At 45 Hz collisions seem stable and objects seem 38// At 45 Hz collisions seem stable and objects seem
39// to settle down at a reasonable rate. 39// to settle down at a reasonable rate.
40// JC 3/18/2003 40// JC 3/18/2003
41const F32 PHYSICS_TIMESTEP = 1.f / 45.f; 41
42// const F32 PHYSICS_TIMESTEP = 1.f / 45.f;
43// This must be a #define due to anal retentive restrictions on const expressions
44// CG 2008-06-05
45#define PHYSICS_TIMESTEP (1.f / 45.f)
42 46
43const F32 COLLISION_TOLERANCE = 0.1f; 47const F32 COLLISION_TOLERANCE = 0.1f;
44const F32 HALF_COLLISION_TOLERANCE = COLLISION_TOLERANCE * 0.5f; 48const F32 HALF_COLLISION_TOLERANCE = COLLISION_TOLERANCE * 0.5f;
@@ -50,9 +54,9 @@ const U32 DAYS_PER_LINDEN_YEAR = 11;
50const U32 SEC_PER_LINDEN_DAY = HOURS_PER_LINDEN_DAY * 60 * 60; 54const U32 SEC_PER_LINDEN_DAY = HOURS_PER_LINDEN_DAY * 60 * 60;
51const U32 SEC_PER_LINDEN_YEAR = DAYS_PER_LINDEN_YEAR * SEC_PER_LINDEN_DAY; 55const U32 SEC_PER_LINDEN_YEAR = DAYS_PER_LINDEN_YEAR * SEC_PER_LINDEN_DAY;
52 56
53const F32 REGION_WIDTH_METERS = 256.f; 57static const F32 REGION_WIDTH_METERS = 256.f;
54const S32 REGION_WIDTH_UNITS = 256; 58static const S32 REGION_WIDTH_UNITS = 256;
55const U32 REGION_WIDTH_U32 = 256; 59static const U32 REGION_WIDTH_U32 = 256;
56 60
57const F32 REGION_HEIGHT_METERS = 4096.f; 61const F32 REGION_HEIGHT_METERS = 4096.f;
58 62
@@ -74,7 +78,7 @@ enum LAND_STAT_REPORT_TYPE
74const U32 STAT_FILTER_MASK = 0x1FFFFFFF; 78const U32 STAT_FILTER_MASK = 0x1FFFFFFF;
75 79
76// Default maximum number of tasks/prims per region. 80// Default maximum number of tasks/prims per region.
77const U32 MAX_TASKS_PER_REGION = 15000; 81const U32 DEFAULT_MAX_REGION_WIDE_PRIM_COUNT = 15000;
78 82
79const F32 MIN_AGENT_DEPTH = 0.30f; 83const F32 MIN_AGENT_DEPTH = 0.30f;
80const F32 DEFAULT_AGENT_DEPTH = 0.45f; 84const F32 DEFAULT_AGENT_DEPTH = 0.45f;
diff --git a/linden/indra/llcommon/linden_common.h b/linden/indra/llcommon/linden_common.h
index 547cceb..7d3c82d 100644
--- a/linden/indra/llcommon/linden_common.h
+++ b/linden/indra/llcommon/linden_common.h
@@ -45,9 +45,10 @@
45#include <iostream> 45#include <iostream>
46#include <fstream> 46#include <fstream>
47 47
48// Work around stupid Microsoft STL warning 48// Work Microsoft compiler warnings
49#ifdef LL_WINDOWS 49#ifdef LL_WINDOWS
50#pragma warning (disable : 4702) // warning C4702: unreachable code 50#pragma warning (disable : 4702) // unreachable code
51#pragma warning (disable : 4244) // conversion from time_t to S32
51#endif // LL_WINDOWS 52#endif // LL_WINDOWS
52 53
53#include <algorithm> 54#include <algorithm>
diff --git a/linden/indra/llcommon/llapp.cpp b/linden/indra/llcommon/llapp.cpp
index ebace4e..3ca3782 100644
--- a/linden/indra/llcommon/llapp.cpp
+++ b/linden/indra/llcommon/llapp.cpp
@@ -224,6 +224,7 @@ LLSD LLApp::getOptionData(OptionPriority level)
224void LLApp::stepFrame() 224void LLApp::stepFrame()
225{ 225{
226 LLFrameTimer::updateFrameTime(); 226 LLFrameTimer::updateFrameTime();
227 LLFrameTimer::updateFrameCount();
227 LLEventTimer::updateClass(); 228 LLEventTimer::updateClass();
228 mRunner.run(); 229 mRunner.run();
229} 230}
@@ -492,6 +493,7 @@ void LLApp::setDefaultChildCallback(LLAppChildCallback callback)
492 493
493pid_t LLApp::fork() 494pid_t LLApp::fork()
494{ 495{
496 fflush(NULL); // flush all buffers before the child inherits them
495 pid_t pid = ::fork(); 497 pid_t pid = ::fork();
496 if( pid < 0 ) 498 if( pid < 0 )
497 { 499 {
diff --git a/linden/indra/llcommon/llapr.cpp b/linden/indra/llcommon/llapr.cpp
index 78bf876..73e715a 100644
--- a/linden/indra/llcommon/llapr.cpp
+++ b/linden/indra/llcommon/llapr.cpp
@@ -129,7 +129,7 @@ void ll_apr_assert_status(apr_status_t status)
129} 129}
130 130
131// File I/O 131// File I/O
132apr_file_t* ll_apr_file_open(const LLString& filename, apr_int32_t flags, S32* sizep, apr_pool_t* pool) 132apr_file_t* ll_apr_file_open(const std::string& filename, apr_int32_t flags, S32* sizep, apr_pool_t* pool)
133{ 133{
134 apr_file_t* apr_file; 134 apr_file_t* apr_file;
135 apr_status_t s; 135 apr_status_t s;
@@ -160,15 +160,15 @@ apr_file_t* ll_apr_file_open(const LLString& filename, apr_int32_t flags, S32* s
160 160
161 return apr_file; 161 return apr_file;
162} 162}
163apr_file_t* ll_apr_file_open(const LLString& filename, apr_int32_t flags, S32* sizep) 163apr_file_t* ll_apr_file_open(const std::string& filename, apr_int32_t flags, S32* sizep)
164{ 164{
165 return ll_apr_file_open(filename, flags, sizep, NULL); 165 return ll_apr_file_open(filename, flags, sizep, NULL);
166} 166}
167apr_file_t* ll_apr_file_open(const LLString& filename, apr_int32_t flags, apr_pool_t* pool) 167apr_file_t* ll_apr_file_open(const std::string& filename, apr_int32_t flags, apr_pool_t* pool)
168{ 168{
169 return ll_apr_file_open(filename, flags, NULL, pool); 169 return ll_apr_file_open(filename, flags, NULL, pool);
170} 170}
171apr_file_t* ll_apr_file_open(const LLString& filename, apr_int32_t flags) 171apr_file_t* ll_apr_file_open(const std::string& filename, apr_int32_t flags)
172{ 172{
173 return ll_apr_file_open(filename, flags, NULL, NULL); 173 return ll_apr_file_open(filename, flags, NULL, NULL);
174} 174}
@@ -188,7 +188,7 @@ S32 ll_apr_file_read(apr_file_t* apr_file, void *buf, S32 nbytes)
188 } 188 }
189} 189}
190 190
191S32 ll_apr_file_read_ex(const LLString& filename, apr_pool_t* pool, void *buf, S32 offset, S32 nbytes) 191S32 ll_apr_file_read_ex(const std::string& filename, apr_pool_t* pool, void *buf, S32 offset, S32 nbytes)
192{ 192{
193 if (pool == NULL) pool = gAPRPoolp; 193 if (pool == NULL) pool = gAPRPoolp;
194 apr_file_t* filep = ll_apr_file_open(filename, APR_READ|APR_BINARY, pool); 194 apr_file_t* filep = ll_apr_file_open(filename, APR_READ|APR_BINARY, pool);
@@ -230,7 +230,7 @@ S32 ll_apr_file_write(apr_file_t* apr_file, const void *buf, S32 nbytes)
230 } 230 }
231} 231}
232 232
233S32 ll_apr_file_write_ex(const LLString& filename, apr_pool_t* pool, void *buf, S32 offset, S32 nbytes) 233S32 ll_apr_file_write_ex(const std::string& filename, apr_pool_t* pool, void *buf, S32 offset, S32 nbytes)
234{ 234{
235 if (pool == NULL) pool = gAPRPoolp; 235 if (pool == NULL) pool = gAPRPoolp;
236 apr_int32_t flags = APR_CREATE|APR_WRITE|APR_BINARY; 236 apr_int32_t flags = APR_CREATE|APR_WRITE|APR_BINARY;
@@ -287,7 +287,7 @@ S32 ll_apr_file_seek(apr_file_t* apr_file, apr_seek_where_t where, S32 offset)
287 } 287 }
288} 288}
289 289
290bool ll_apr_file_remove(const LLString& filename, apr_pool_t* pool) 290bool ll_apr_file_remove(const std::string& filename, apr_pool_t* pool)
291{ 291{
292 apr_status_t s; 292 apr_status_t s;
293 if (pool == NULL) pool = gAPRPoolp; 293 if (pool == NULL) pool = gAPRPoolp;
@@ -301,7 +301,7 @@ bool ll_apr_file_remove(const LLString& filename, apr_pool_t* pool)
301 return true; 301 return true;
302} 302}
303 303
304bool ll_apr_file_rename(const LLString& filename, const LLString& newname, apr_pool_t* pool) 304bool ll_apr_file_rename(const std::string& filename, const std::string& newname, apr_pool_t* pool)
305{ 305{
306 apr_status_t s; 306 apr_status_t s;
307 if (pool == NULL) pool = gAPRPoolp; 307 if (pool == NULL) pool = gAPRPoolp;
@@ -315,7 +315,7 @@ bool ll_apr_file_rename(const LLString& filename, const LLString& newname, apr_p
315 return true; 315 return true;
316} 316}
317 317
318bool ll_apr_file_exists(const LLString& filename, apr_pool_t* pool) 318bool ll_apr_file_exists(const std::string& filename, apr_pool_t* pool)
319{ 319{
320 apr_file_t* apr_file; 320 apr_file_t* apr_file;
321 apr_status_t s; 321 apr_status_t s;
@@ -332,7 +332,7 @@ bool ll_apr_file_exists(const LLString& filename, apr_pool_t* pool)
332 } 332 }
333} 333}
334 334
335S32 ll_apr_file_size(const LLString& filename, apr_pool_t* pool) 335S32 ll_apr_file_size(const std::string& filename, apr_pool_t* pool)
336{ 336{
337 apr_file_t* apr_file; 337 apr_file_t* apr_file;
338 apr_finfo_t info; 338 apr_finfo_t info;
@@ -358,7 +358,7 @@ S32 ll_apr_file_size(const LLString& filename, apr_pool_t* pool)
358 } 358 }
359} 359}
360 360
361bool ll_apr_dir_make(const LLString& dirname, apr_pool_t* pool) 361bool ll_apr_dir_make(const std::string& dirname, apr_pool_t* pool)
362{ 362{
363 apr_status_t s; 363 apr_status_t s;
364 if (pool == NULL) pool = gAPRPoolp; 364 if (pool == NULL) pool = gAPRPoolp;
@@ -372,7 +372,7 @@ bool ll_apr_dir_make(const LLString& dirname, apr_pool_t* pool)
372 return true; 372 return true;
373} 373}
374 374
375bool ll_apr_dir_remove(const LLString& dirname, apr_pool_t* pool) 375bool ll_apr_dir_remove(const std::string& dirname, apr_pool_t* pool)
376{ 376{
377 apr_status_t s; 377 apr_status_t s;
378 if (pool == NULL) pool = gAPRPoolp; 378 if (pool == NULL) pool = gAPRPoolp;
diff --git a/linden/indra/llcommon/llapr.h b/linden/indra/llcommon/llapr.h
index 695b93e..323dcb2 100644
--- a/linden/indra/llcommon/llapr.h
+++ b/linden/indra/llcommon/llapr.h
@@ -40,11 +40,11 @@
40 40
41#include <boost/noncopyable.hpp> 41#include <boost/noncopyable.hpp>
42 42
43#include "apr-1/apr_thread_proc.h" 43#include "apr_thread_proc.h"
44#include "apr-1/apr_thread_mutex.h" 44#include "apr_thread_mutex.h"
45#include "apr-1/apr_getopt.h" 45#include "apr_getopt.h"
46#include "apr-1/apr_signal.h" 46#include "apr_signal.h"
47#include "apr-1/apr_atomic.h" 47#include "apr_atomic.h"
48#include "llstring.h" 48#include "llstring.h"
49 49
50extern apr_thread_mutex_t* gLogMutexp; 50extern apr_thread_mutex_t* gLogMutexp;
@@ -130,24 +130,24 @@ typedef LLAtomic32<S32> LLAtomicS32;
130#define LL_APR_WB (APR_CREATE|APR_TRUNCATE|APR_WRITE|APR_BINARY) // "wb" 130#define LL_APR_WB (APR_CREATE|APR_TRUNCATE|APR_WRITE|APR_BINARY) // "wb"
131#define LL_APR_RPB (APR_READ|APR_WRITE|APR_BINARY) // "r+b" 131#define LL_APR_RPB (APR_READ|APR_WRITE|APR_BINARY) // "r+b"
132#define LL_APR_WPB (APR_CREATE|APR_TRUNCATE|APR_READ|APR_WRITE|APR_BINARY) // "w+b" 132#define LL_APR_WPB (APR_CREATE|APR_TRUNCATE|APR_READ|APR_WRITE|APR_BINARY) // "w+b"
133apr_file_t* ll_apr_file_open(const LLString& filename, apr_int32_t flags, S32* sizep, apr_pool_t* pool); 133apr_file_t* ll_apr_file_open(const std::string& filename, apr_int32_t flags, S32* sizep, apr_pool_t* pool);
134apr_file_t* ll_apr_file_open(const LLString& filename, apr_int32_t flags, S32* sizep); 134apr_file_t* ll_apr_file_open(const std::string& filename, apr_int32_t flags, S32* sizep);
135apr_file_t* ll_apr_file_open(const LLString& filename, apr_int32_t flags, apr_pool_t* pool); 135apr_file_t* ll_apr_file_open(const std::string& filename, apr_int32_t flags, apr_pool_t* pool);
136apr_file_t* ll_apr_file_open(const LLString& filename, apr_int32_t flags); 136apr_file_t* ll_apr_file_open(const std::string& filename, apr_int32_t flags);
137// Returns actual offset, -1 if seek fails 137// Returns actual offset, -1 if seek fails
138S32 ll_apr_file_seek(apr_file_t* apr_file, apr_seek_where_t where, S32 offset); 138S32 ll_apr_file_seek(apr_file_t* apr_file, apr_seek_where_t where, S32 offset);
139// Returns bytes read/written, 0 if read/write fails: 139// Returns bytes read/written, 0 if read/write fails:
140S32 ll_apr_file_read(apr_file_t* apr_file, void* buf, S32 nbytes); 140S32 ll_apr_file_read(apr_file_t* apr_file, void* buf, S32 nbytes);
141S32 ll_apr_file_read_ex(const LLString& filename, apr_pool_t* pool, void *buf, S32 offset, S32 nbytes); 141S32 ll_apr_file_read_ex(const std::string& filename, apr_pool_t* pool, void *buf, S32 offset, S32 nbytes);
142S32 ll_apr_file_write(apr_file_t* apr_file, const void* buf, S32 nbytes); 142S32 ll_apr_file_write(apr_file_t* apr_file, const void* buf, S32 nbytes);
143S32 ll_apr_file_write_ex(const LLString& filename, apr_pool_t* pool, void *buf, S32 offset, S32 nbytes); 143S32 ll_apr_file_write_ex(const std::string& filename, apr_pool_t* pool, void *buf, S32 offset, S32 nbytes);
144// returns false if failure: 144// returns false if failure:
145bool ll_apr_file_remove(const LLString& filename, apr_pool_t* pool = NULL); 145bool ll_apr_file_remove(const std::string& filename, apr_pool_t* pool = NULL);
146bool ll_apr_file_rename(const LLString& filename, const LLString& newname, apr_pool_t* pool = NULL); 146bool ll_apr_file_rename(const std::string& filename, const std::string& newname, apr_pool_t* pool = NULL);
147bool ll_apr_file_exists(const LLString& filename, apr_pool_t* pool = NULL); 147bool ll_apr_file_exists(const std::string& filename, apr_pool_t* pool = NULL);
148S32 ll_apr_file_size(const LLString& filename, apr_pool_t* pool = NULL); 148S32 ll_apr_file_size(const std::string& filename, apr_pool_t* pool = NULL);
149bool ll_apr_dir_make(const LLString& dirname, apr_pool_t* pool = NULL); 149bool ll_apr_dir_make(const std::string& dirname, apr_pool_t* pool = NULL);
150bool ll_apr_dir_remove(const LLString& dirname, apr_pool_t* pool = NULL); 150bool ll_apr_dir_remove(const std::string& dirname, apr_pool_t* pool = NULL);
151 151
152/** 152/**
153 * @brief Function which approprately logs error or remains quiet on 153 * @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 4b2a862..27b8310 100644
--- a/linden/indra/llcommon/llassettype.cpp
+++ b/linden/indra/llcommon/llassettype.cpp
@@ -75,7 +75,7 @@ asset_info_t asset_types[] =
75LLAssetType::EType LLAssetType::getType(const std::string& sin) 75LLAssetType::EType LLAssetType::getType(const std::string& sin)
76{ 76{
77 std::string s = sin; 77 std::string s = sin;
78 LLString::toUpper(s); 78 LLStringUtil::toUpper(s);
79 for (S32 idx = 0; ;idx++) 79 for (S32 idx = 0; ;idx++)
80 { 80 {
81 asset_info_t* info = asset_types + idx; 81 asset_info_t* info = asset_types + idx;
@@ -128,7 +128,7 @@ const char* LLAssetType::mAssetTypeNames[LLAssetType::AT_COUNT] =
128 "jpeg", 128 "jpeg",
129 "animatn", 129 "animatn",
130 "gesture", 130 "gesture",
131 "simstate", 131 "simstate"
132}; 132};
133 133
134// This table is meant for decoding to human readable form. Put any 134// This table is meant for decoding to human readable form. Put any
@@ -158,7 +158,7 @@ const char* LLAssetType::mAssetTypeHumanNames[LLAssetType::AT_COUNT] =
158 "jpeg image", 158 "jpeg image",
159 "animation", 159 "animation",
160 "gesture", 160 "gesture",
161 "simstate", 161 "simstate"
162}; 162};
163 163
164///---------------------------------------------------------------------------- 164///----------------------------------------------------------------------------
@@ -181,9 +181,14 @@ const char* LLAssetType::lookup( LLAssetType::EType type )
181// static 181// static
182LLAssetType::EType LLAssetType::lookup( const char* name ) 182LLAssetType::EType LLAssetType::lookup( const char* name )
183{ 183{
184 return lookup(ll_safe_string(name));
185}
186
187LLAssetType::EType LLAssetType::lookup( const std::string& name )
188{
184 for( S32 i = 0; i < AT_COUNT; i++ ) 189 for( S32 i = 0; i < AT_COUNT; i++ )
185 { 190 {
186 if( 0 == strcmp(name, mAssetTypeNames[i]) ) 191 if( name == mAssetTypeNames[i] )
187 { 192 {
188 // match 193 // match
189 return (EType)i; 194 return (EType)i;
@@ -208,9 +213,14 @@ const char* LLAssetType::lookupHumanReadable(LLAssetType::EType type)
208// static 213// static
209LLAssetType::EType LLAssetType::lookupHumanReadable( const char* name ) 214LLAssetType::EType LLAssetType::lookupHumanReadable( const char* name )
210{ 215{
216 return lookupHumanReadable(ll_safe_string(name));
217}
218
219LLAssetType::EType LLAssetType::lookupHumanReadable( const std::string& name )
220{
211 for( S32 i = 0; i < AT_COUNT; i++ ) 221 for( S32 i = 0; i < AT_COUNT; i++ )
212 { 222 {
213 if( 0 == strcmp(name, mAssetTypeHumanNames[i]) ) 223 if( name == mAssetTypeHumanNames[i] )
214 { 224 {
215 // match 225 // match
216 return (EType)i; 226 return (EType)i;
diff --git a/linden/indra/llcommon/llassettype.h b/linden/indra/llcommon/llassettype.h
index f5ef05b..f976df4 100644
--- a/linden/indra/llcommon/llassettype.h
+++ b/linden/indra/llcommon/llassettype.h
@@ -145,11 +145,13 @@ public:
145 }; 145 };
146 146
147 // machine transation between type and strings 147 // machine transation between type and strings
148 static EType lookup(const char* name); 148 static EType lookup(const char* name); // safe conversion to std::string, *TODO: deprecate
149 static EType lookup(const std::string& name);
149 static const char* lookup(EType type); 150 static const char* lookup(EType type);
150 151
151 // translation from a type to a human readable form. 152 // translation from a type to a human readable form.
152 static EType lookupHumanReadable( const char* name ); 153 static EType lookupHumanReadable( const char* name ); // safe conversion to std::string, *TODO: deprecate
154 static EType lookupHumanReadable( const std::string& name );
153 static const char* lookupHumanReadable(EType type); 155 static const char* lookupHumanReadable(EType type);
154 156
155 static EDragAndDropType lookupDragAndDropType( EType ); 157 static EDragAndDropType lookupDragAndDropType( EType );
diff --git a/linden/indra/llcommon/llbase64.cpp b/linden/indra/llcommon/llbase64.cpp
index 950ce6e..c2421d8 100644
--- a/linden/indra/llcommon/llbase64.cpp
+++ b/linden/indra/llcommon/llbase64.cpp
@@ -36,7 +36,7 @@
36 36
37#include <string> 37#include <string>
38 38
39#include "apr-1/apr_base64.h" 39#include "apr_base64.h"
40 40
41 41
42// static 42// static
diff --git a/linden/indra/llcommon/llchat.h b/linden/indra/llcommon/llchat.h
index a46b8aa..ea1a579 100644
--- a/linden/indra/llcommon/llchat.h
+++ b/linden/indra/llcommon/llchat.h
@@ -68,7 +68,7 @@ typedef enum e_chat_audible_level
68class LLChat 68class LLChat
69{ 69{
70public: 70public:
71 LLChat(const LLString& text = LLString::null) 71 LLChat(const std::string& text = LLStringUtil::null)
72 : mText(text), 72 : mText(text),
73 mFromName(), 73 mFromName(),
74 mFromID(), 74 mFromID(),
@@ -80,8 +80,8 @@ public:
80 mPosAgent() 80 mPosAgent()
81 { } 81 { }
82 82
83 LLString mText; // UTF-8 line of text 83 std::string mText; // UTF-8 line of text
84 LLString mFromName; // agent or object name 84 std::string mFromName; // agent or object name
85 LLUUID mFromID; // agent id or object id 85 LLUUID mFromID; // agent id or object id
86 EChatSourceType mSourceType; 86 EChatSourceType mSourceType;
87 EChatType mChatType; 87 EChatType mChatType;
diff --git a/linden/indra/llcommon/llcommon.vcproj b/linden/indra/llcommon/llcommon.vcproj
deleted file mode 100644
index f54ea13..0000000
--- a/linden/indra/llcommon/llcommon.vcproj
+++ /dev/null
@@ -1,608 +0,0 @@
1<?xml version="1.0" encoding="Windows-1252"?>
2<VisualStudioProject
3 ProjectType="Visual C++"
4 Version="7.10"
5 Name="llcommon"
6 ProjectGUID="{7BCB4B2C-8378-4186-88EA-5742B5ABE17F}"
7 RootNamespace="llcommon"
8 Keyword="Win32Proj">
9 <Platforms>
10 <Platform
11 Name="Win32"/>
12 </Platforms>
13 <Configurations>
14 <Configuration
15 Name="Debug|Win32"
16 OutputDirectory="../lib_$(ConfigurationName)/i686-win32"
17 IntermediateDirectory="$(ConfigurationName)"
18 ConfigurationType="4"
19 CharacterSet="1">
20 <Tool
21 Name="VCCLCompilerTool"
22 Optimization="0"
23 AdditionalIncludeDirectories="..\..\libraries\i686-win32\include;..\..\libraries\include\"
24 PreprocessorDefinitions="WIN32;_DEBUG;_LIB;LL_WINDOWS;LL_DEBUG;XML_STATIC;APR_DECLARE_STATIC"
25 MinimalRebuild="TRUE"
26 BasicRuntimeChecks="3"
27 RuntimeLibrary="1"
28 StructMemberAlignment="4"
29 ForceConformanceInForLoopScope="TRUE"
30 UsePrecompiledHeader="0"
31 WarningLevel="3"
32 WarnAsError="TRUE"
33 Detect64BitPortabilityProblems="FALSE"
34 DebugInformationFormat="4"/>
35 <Tool
36 Name="VCCustomBuildTool"/>
37 <Tool
38 Name="VCLibrarianTool"
39 OutputFile="$(OutDir)/llcommon.lib"/>
40 <Tool
41 Name="VCMIDLTool"/>
42 <Tool
43 Name="VCPostBuildEventTool"/>
44 <Tool
45 Name="VCPreBuildEventTool"/>
46 <Tool
47 Name="VCPreLinkEventTool"/>
48 <Tool
49 Name="VCResourceCompilerTool"/>
50 <Tool
51 Name="VCWebServiceProxyGeneratorTool"/>
52 <Tool
53 Name="VCXMLDataGeneratorTool"/>
54 <Tool
55 Name="VCManagedWrapperGeneratorTool"/>
56 <Tool
57 Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
58 </Configuration>
59 <Configuration
60 Name="Release|Win32"
61 OutputDirectory="../lib_$(ConfigurationName)/i686-win32"
62 IntermediateDirectory="$(ConfigurationName)"
63 ConfigurationType="4"
64 CharacterSet="1">
65 <Tool
66 Name="VCCLCompilerTool"
67 AdditionalOptions="/Oy-"
68 GlobalOptimizations="TRUE"
69 InlineFunctionExpansion="2"
70 EnableIntrinsicFunctions="TRUE"
71 OptimizeForProcessor="3"
72 OptimizeForWindowsApplication="TRUE"
73 AdditionalIncludeDirectories="..\..\libraries\i686-win32\include;..\..\libraries\include\"
74 PreprocessorDefinitions="WIN32;NDEBUG;_LIB;LL_WINDOWS;LL_RELEASE;XML_STATIC;APR_DECLARE_STATIC"
75 RuntimeLibrary="0"
76 StructMemberAlignment="0"
77 ForceConformanceInForLoopScope="TRUE"
78 UsePrecompiledHeader="0"
79 WarningLevel="3"
80 WarnAsError="TRUE"
81 Detect64BitPortabilityProblems="FALSE"
82 DebugInformationFormat="3"/>
83 <Tool
84 Name="VCCustomBuildTool"/>
85 <Tool
86 Name="VCLibrarianTool"
87 OutputFile="$(OutDir)/llcommon.lib"/>
88 <Tool
89 Name="VCMIDLTool"/>
90 <Tool
91 Name="VCPostBuildEventTool"/>
92 <Tool
93 Name="VCPreBuildEventTool"/>
94 <Tool
95 Name="VCPreLinkEventTool"/>
96 <Tool
97 Name="VCResourceCompilerTool"/>
98 <Tool
99 Name="VCWebServiceProxyGeneratorTool"/>
100 <Tool
101 Name="VCXMLDataGeneratorTool"/>
102 <Tool
103 Name="VCManagedWrapperGeneratorTool"/>
104 <Tool
105 Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
106 </Configuration>
107 <Configuration
108 Name="ReleaseNoOpt|Win32"
109 OutputDirectory="../lib_$(ConfigurationName)/i686-win32"
110 IntermediateDirectory="$(ConfigurationName)"
111 ConfigurationType="4"
112 CharacterSet="1">
113 <Tool
114 Name="VCCLCompilerTool"
115 AdditionalOptions="/Oy-"
116 Optimization="0"
117 AdditionalIncludeDirectories="..\..\libraries\i686-win32\include;..\..\libraries\include\"
118 PreprocessorDefinitions="WIN32;NDEBUG;_LIB;LL_WINDOWS;LL_RELEASE;XML_STATIC;APR_DECLARE_STATIC"
119 RuntimeLibrary="0"
120 StructMemberAlignment="0"
121 ForceConformanceInForLoopScope="TRUE"
122 UsePrecompiledHeader="0"
123 WarningLevel="3"
124 WarnAsError="TRUE"
125 Detect64BitPortabilityProblems="FALSE"
126 DebugInformationFormat="3"/>
127 <Tool
128 Name="VCCustomBuildTool"/>
129 <Tool
130 Name="VCLibrarianTool"
131 OutputFile="$(OutDir)/llcommon.lib"/>
132 <Tool
133 Name="VCMIDLTool"/>
134 <Tool
135 Name="VCPostBuildEventTool"/>
136 <Tool
137 Name="VCPreBuildEventTool"/>
138 <Tool
139 Name="VCPreLinkEventTool"/>
140 <Tool
141 Name="VCResourceCompilerTool"/>
142 <Tool
143 Name="VCWebServiceProxyGeneratorTool"/>
144 <Tool
145 Name="VCXMLDataGeneratorTool"/>
146 <Tool
147 Name="VCManagedWrapperGeneratorTool"/>
148 <Tool
149 Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
150 </Configuration>
151 </Configurations>
152 <References>
153 </References>
154 <Files>
155 <Filter
156 Name="Source Files"
157 Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
158 UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
159 <File
160 RelativePath=".\llapp.cpp">
161 </File>
162 <File
163 RelativePath=".\llapr.cpp">
164 </File>
165 <File
166 RelativePath=".\llares.cpp">
167 </File>
168 <File
169 RelativePath=".\llassettype.cpp">
170 </File>
171 <File
172 RelativePath=".\llbase32.cpp">
173 </File>
174 <File
175 RelativePath=".\llbase64.cpp">
176 </File>
177 <File
178 RelativePath=".\llcommon.cpp">
179 </File>
180 <File
181 RelativePath=".\llcriticaldamp.cpp">
182 </File>
183 <File
184 RelativePath=".\lldate.cpp">
185 </File>
186 <File
187 RelativePath=".\llerror.cpp">
188 </File>
189 <File
190 RelativePath=".\llerrorthread.cpp">
191 </File>
192 <File
193 RelativePath=".\llevent.cpp">
194 </File>
195 <File
196 RelativePath=".\llfasttimer.cpp">
197 </File>
198 <File
199 RelativePath=".\llfile.cpp">
200 </File>
201 <File
202 RelativePath=".\llfindlocale.cpp">
203 </File>
204 <File
205 RelativePath=".\llfixedbuffer.cpp">
206 </File>
207 <File
208 RelativePath=".\llformat.cpp">
209 </File>
210 <File
211 RelativePath=".\llframetimer.cpp">
212 </File>
213 <File
214 RelativePath=".\llheartbeat.cpp">
215 </File>
216 <File
217 RelativePath=".\llindraconfigfile.cpp">
218 </File>
219 <File
220 RelativePath=".\llliveappconfig.cpp">
221 </File>
222 <File
223 RelativePath=".\lllivefile.cpp">
224 </File>
225 <File
226 RelativePath=".\lllog.cpp">
227 </File>
228 <File
229 RelativePath=".\llmemory.cpp">
230 </File>
231 <File
232 RelativePath=".\llmemorystream.cpp">
233 </File>
234 <File
235 RelativePath=".\llmetrics.cpp">
236 </File>
237 <File
238 RelativePath=".\llmortician.cpp">
239 </File>
240 <File
241 RelativePath=".\llprocessor.cpp">
242 </File>
243 <File
244 RelativePath=".\llqueuedthread.cpp">
245 </File>
246 <File
247 RelativePath=".\llrun.cpp">
248 </File>
249 <File
250 RelativePath=".\llsd.cpp">
251 </File>
252 <File
253 RelativePath=".\llsdserialize.cpp">
254 </File>
255 <File
256 RelativePath=".\llsdserialize_xml.cpp">
257 </File>
258 <File
259 RelativePath=".\llsdutil.cpp">
260 </File>
261 <File
262 RelativePath=".\llsecondlifeurls.cpp">
263 </File>
264 <File
265 RelativePath=".\llstat.cpp">
266 </File>
267 <File
268 RelativePath=".\llstreamtools.cpp">
269 </File>
270 <File
271 RelativePath=".\llstring.cpp">
272 </File>
273 <File
274 RelativePath=".\llstringtable.cpp">
275 </File>
276 <File
277 RelativePath=".\llsys.cpp">
278 </File>
279 <File
280 RelativePath=".\llthread.cpp">
281 </File>
282 <File
283 RelativePath=".\lltimer.cpp">
284 </File>
285 <File
286 RelativePath=".\lluri.cpp">
287 </File>
288 <File
289 RelativePath=".\llworkerthread.cpp">
290 </File>
291 <File
292 RelativePath=".\metaclass.cpp">
293 </File>
294 <File
295 RelativePath=".\metaproperty.cpp">
296 </File>
297 <File
298 RelativePath=".\reflective.cpp">
299 </File>
300 <File
301 RelativePath=".\timing.cpp">
302 </File>
303 <File
304 RelativePath=".\u64.cpp">
305 </File>
306 </Filter>
307 <Filter
308 Name="Header Files"
309 Filter="h;hpp;hxx;hm;inl;inc;xsd"
310 UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
311 <File
312 RelativePath=".\bitpack.h">
313 </File>
314 <File
315 RelativePath=".\doublelinkedlist.h">
316 </File>
317 <File
318 RelativePath=".\imageids.h">
319 </File>
320 <File
321 RelativePath=".\indra_constants.h">
322 </File>
323 <File
324 RelativePath=".\linden_common.h">
325 </File>
326 <File
327 RelativePath=".\linked_lists.h">
328 </File>
329 <File
330 RelativePath=".\llagentconstants.h">
331 </File>
332 <File
333 RelativePath=".\llapp.h">
334 </File>
335 <File
336 RelativePath=".\llapr.h">
337 </File>
338 <File
339 RelativePath=".\llassettype.h">
340 </File>
341 <File
342 RelativePath=".\llassoclist.h">
343 </File>
344 <File
345 RelativePath=".\llavatarconstants.h">
346 </File>
347 <File
348 RelativePath=".\llbase32.h">
349 </File>
350 <File
351 RelativePath=".\llbase64.h">
352 </File>
353 <File
354 RelativePath=".\llboost.h">
355 </File>
356 <File
357 RelativePath=".\llchat.h">
358 </File>
359 <File
360 RelativePath=".\llclickaction.h">
361 </File>
362 <File
363 RelativePath=".\llcommon.h">
364 </File>
365 <File
366 RelativePath=".\llcriticaldamp.h">
367 </File>
368 <File
369 RelativePath=".\lldarray.h">
370 </File>
371 <File
372 RelativePath=".\lldarrayptr.h">
373 </File>
374 <File
375 RelativePath=".\lldate.h">
376 </File>
377 <File
378 RelativePath=".\lldefs.h">
379 </File>
380 <File
381 RelativePath=".\lldlinked.h">
382 </File>
383 <File
384 RelativePath=".\lldqueueptr.h">
385 </File>
386 <File
387 RelativePath=".\llendianswizzle.h">
388 </File>
389 <File
390 RelativePath=".\llenum.h">
391 </File>
392 <File
393 RelativePath=".\llerror.h">
394 </File>
395 <File
396 RelativePath=".\llerrorcontrol.h">
397 </File>
398 <File
399 RelativePath=".\llerrorthread.h">
400 </File>
401 <File
402 RelativePath=".\llevent.h">
403 </File>
404 <File
405 RelativePath=".\llextendedstatus.h">
406 </File>
407 <File
408 RelativePath=".\llfasttimer.h">
409 </File>
410 <File
411 RelativePath=".\llfile.h">
412 </File>
413 <File
414 RelativePath=".\llfixedbuffer.h">
415 </File>
416 <File
417 RelativePath=".\llformat.h">
418 </File>
419 <File
420 RelativePath=".\llframecallbackmanager.h">
421 </File>
422 <File
423 RelativePath=".\llframetimer.h">
424 </File>
425 <File
426 RelativePath=".\llhash.h">
427 </File>
428 <File
429 RelativePath=".\llheartbeat.h">
430 </File>
431 <File
432 RelativePath=".\llindexedqueue.h">
433 </File>
434 <File
435 RelativePath=".\llkeythrottle.h">
436 </File>
437 <File
438 RelativePath=".\llkeyusetracker.h">
439 </File>
440 <File
441 RelativePath=".\lllinkedqueue.h">
442 </File>
443 <File
444 RelativePath=".\llliveappconfig.h">
445 </File>
446 <File
447 RelativePath=".\lllivefile.h">
448 </File>
449 <File
450 RelativePath=".\lllocalidhashmap.h">
451 </File>
452 <File
453 RelativePath=".\lllog.h">
454 </File>
455 <File
456 RelativePath=".\lllslconstants.h">
457 </File>
458 <File
459 RelativePath=".\llmap.h">
460 </File>
461 <File
462 RelativePath=".\llmemory.h">
463 </File>
464 <File
465 RelativePath=".\llmemorystream.h">
466 </File>
467 <File
468 RelativePath=".\llmemtype.h">
469 </File>
470 <File
471 RelativePath=".\llmetrics.h">
472 </File>
473 <File
474 RelativePath=".\llmortician.h">
475 </File>
476 <File
477 RelativePath=".\llnametable.h">
478 </File>
479 <File
480 RelativePath=".\llpreprocessor.h">
481 </File>
482 <File
483 RelativePath=".\llpriqueuemap.h">
484 </File>
485 <File
486 RelativePath=".\llprocessor.h">
487 </File>
488 <File
489 RelativePath=".\llptrskiplist.h">
490 </File>
491 <File
492 RelativePath=".\llptrskipmap.h">
493 </File>
494 <File
495 RelativePath=".\llqueuedthread.h">
496 </File>
497 <File
498 RelativePath=".\llrun.h">
499 </File>
500 <File
501 RelativePath=".\llsd.h">
502 </File>
503 <File
504 RelativePath=".\llsdserialize.h">
505 </File>
506 <File
507 RelativePath=".\llsdserialize_xml.h">
508 </File>
509 <File
510 RelativePath=".\llsdutil.h">
511 </File>
512 <File
513 RelativePath=".\llsecondlifeurls.h">
514 </File>
515 <File
516 RelativePath=".\llskiplist.h">
517 </File>
518 <File
519 RelativePath=".\llskipmap.h">
520 </File>
521 <File
522 RelativePath=".\llsmoothstep.h">
523 </File>
524 <File
525 RelativePath=".\llstat.h">
526 </File>
527 <File
528 RelativePath=".\llstatenums.h">
529 </File>
530 <File
531 RelativePath=".\llstl.h">
532 </File>
533 <File
534 RelativePath=".\llstreamtools.h">
535 </File>
536 <File
537 RelativePath=".\llstrider.h">
538 </File>
539 <File
540 RelativePath=".\llstring.h">
541 </File>
542 <File
543 RelativePath=".\llstringtable.h">
544 </File>
545 <File
546 RelativePath=".\llsys.h">
547 </File>
548 <File
549 RelativePath=".\llthread.h">
550 </File>
551 <File
552 RelativePath=".\lltimer.h">
553 </File>
554 <File
555 RelativePath=".\lluri.h">
556 </File>
557 <File
558 RelativePath=".\lluuidhashmap.h">
559 </File>
560 <File
561 RelativePath=".\llversionserver.h">
562 </File>
563 <File
564 RelativePath=".\llversionviewer.h">
565 </File>
566 <File
567 RelativePath=".\llworkerthread.h">
568 </File>
569 <File
570 RelativePath=".\new_mem_ops.h">
571 </File>
572 <File
573 RelativePath=".\priqueue.h">
574 </File>
575 <File
576 RelativePath=".\processor.h">
577 </File>
578 <File
579 RelativePath=".\roles_constants.h">
580 </File>
581 <File
582 RelativePath=".\stdenums.h">
583 </File>
584 <File
585 RelativePath=".\stdtypes.h">
586 </File>
587 <File
588 RelativePath=".\string_table.h">
589 </File>
590 <File
591 RelativePath=".\timer.h">
592 </File>
593 <File
594 RelativePath=".\timing.h">
595 </File>
596 <File
597 RelativePath=".\u64.h">
598 </File>
599 </Filter>
600 <Filter
601 Name="Resource Files"
602 Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
603 UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
604 </Filter>
605 </Files>
606 <Globals>
607 </Globals>
608</VisualStudioProject>
diff --git a/linden/indra/llcommon/llcommon_vc8.vcproj b/linden/indra/llcommon/llcommon_vc8.vcproj
deleted file mode 100644
index a298499..0000000
--- a/linden/indra/llcommon/llcommon_vc8.vcproj
+++ /dev/null
@@ -1,847 +0,0 @@
1<?xml version="1.0" encoding="Windows-1252"?>
2<VisualStudioProject
3 ProjectType="Visual C++"
4 Version="8.00"
5 Name="llcommon"
6 ProjectGUID="{7BCB4B2C-8378-4186-88EA-5742B5ABE17F}"
7 RootNamespace="llcommon"
8 Keyword="Win32Proj"
9 >
10 <Platforms>
11 <Platform
12 Name="Win32"
13 />
14 </Platforms>
15 <ToolFiles>
16 </ToolFiles>
17 <Configurations>
18 <Configuration
19 Name="Debug|Win32"
20 OutputDirectory="../lib_$(ConfigurationName)/i686-win32"
21 IntermediateDirectory="$(ConfigurationName)"
22 ConfigurationType="4"
23 InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
24 CharacterSet="1"
25 >
26 <Tool
27 Name="VCPreBuildEventTool"
28 />
29 <Tool
30 Name="VCCustomBuildTool"
31 />
32 <Tool
33 Name="VCXMLDataGeneratorTool"
34 />
35 <Tool
36 Name="VCWebServiceProxyGeneratorTool"
37 />
38 <Tool
39 Name="VCMIDLTool"
40 />
41 <Tool
42 Name="VCCLCompilerTool"
43 Optimization="0"
44 AdditionalIncludeDirectories="..\..\libraries\i686-win32\include;..\..\libraries\include\"
45 PreprocessorDefinitions="WIN32;_DEBUG;_LIB;LL_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_USE_32BIT_TIME_T;LL_DEBUG;XML_STATIC;APR_DECLARE_STATIC"
46 MinimalRebuild="true"
47 BasicRuntimeChecks="3"
48 RuntimeLibrary="1"
49 StructMemberAlignment="4"
50 TreatWChar_tAsBuiltInType="false"
51 ForceConformanceInForLoopScope="true"
52 UsePrecompiledHeader="0"
53 WarningLevel="3"
54 WarnAsError="true"
55 Detect64BitPortabilityProblems="false"
56 DebugInformationFormat="4"
57 />
58 <Tool
59 Name="VCManagedResourceCompilerTool"
60 />
61 <Tool
62 Name="VCResourceCompilerTool"
63 />
64 <Tool
65 Name="VCPreLinkEventTool"
66 />
67 <Tool
68 Name="VCLibrarianTool"
69 OutputFile="$(OutDir)/llcommon.lib"
70 />
71 <Tool
72 Name="VCALinkTool"
73 />
74 <Tool
75 Name="VCXDCMakeTool"
76 />
77 <Tool
78 Name="VCBscMakeTool"
79 />
80 <Tool
81 Name="VCFxCopTool"
82 />
83 <Tool
84 Name="VCPostBuildEventTool"
85 />
86 </Configuration>
87 <Configuration
88 Name="Release|Win32"
89 OutputDirectory="../lib_$(ConfigurationName)/i686-win32"
90 IntermediateDirectory="$(ConfigurationName)"
91 ConfigurationType="4"
92 InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
93 CharacterSet="1"
94 >
95 <Tool
96 Name="VCPreBuildEventTool"
97 />
98 <Tool
99 Name="VCCustomBuildTool"
100 />
101 <Tool
102 Name="VCXMLDataGeneratorTool"
103 />
104 <Tool
105 Name="VCWebServiceProxyGeneratorTool"
106 />
107 <Tool
108 Name="VCMIDLTool"
109 />
110 <Tool
111 Name="VCCLCompilerTool"
112 AdditionalOptions="/Oy-"
113 InlineFunctionExpansion="2"
114 EnableIntrinsicFunctions="true"
115 AdditionalIncludeDirectories="..\..\libraries\i686-win32\include;..\..\libraries\include\"
116 PreprocessorDefinitions="WIN32;NDEBUG;_LIB;LL_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_USE_32BIT_TIME_T;LL_RELEASE;XML_STATIC;APR_DECLARE_STATIC"
117 RuntimeLibrary="0"
118 StructMemberAlignment="0"
119 TreatWChar_tAsBuiltInType="false"
120 ForceConformanceInForLoopScope="true"
121 UsePrecompiledHeader="0"
122 WarningLevel="3"
123 WarnAsError="true"
124 Detect64BitPortabilityProblems="false"
125 DebugInformationFormat="3"
126 />
127 <Tool
128 Name="VCManagedResourceCompilerTool"
129 />
130 <Tool
131 Name="VCResourceCompilerTool"
132 />
133 <Tool
134 Name="VCPreLinkEventTool"
135 />
136 <Tool
137 Name="VCLibrarianTool"
138 OutputFile="$(OutDir)/llcommon.lib"
139 />
140 <Tool
141 Name="VCALinkTool"
142 />
143 <Tool
144 Name="VCXDCMakeTool"
145 />
146 <Tool
147 Name="VCBscMakeTool"
148 />
149 <Tool
150 Name="VCFxCopTool"
151 />
152 <Tool
153 Name="VCPostBuildEventTool"
154 />
155 </Configuration>
156 <Configuration
157 Name="ReleaseNoOpt|Win32"
158 OutputDirectory="../lib_$(ConfigurationName)/i686-win32"
159 IntermediateDirectory="$(ConfigurationName)"
160 ConfigurationType="4"
161 InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
162 CharacterSet="1"
163 >
164 <Tool
165 Name="VCPreBuildEventTool"
166 />
167 <Tool
168 Name="VCCustomBuildTool"
169 />
170 <Tool
171 Name="VCXMLDataGeneratorTool"
172 />
173 <Tool
174 Name="VCWebServiceProxyGeneratorTool"
175 />
176 <Tool
177 Name="VCMIDLTool"
178 />
179 <Tool
180 Name="VCCLCompilerTool"
181 AdditionalOptions="/Oy-"
182 Optimization="0"
183 AdditionalIncludeDirectories="..\..\libraries\i686-win32\include;..\..\libraries\include\"
184 PreprocessorDefinitions="WIN32;NDEBUG;_LIB;LL_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_USE_32BIT_TIME_T;LL_RELEASE;XML_STATIC;APR_DECLARE_STATIC"
185 RuntimeLibrary="0"
186 StructMemberAlignment="0"
187 TreatWChar_tAsBuiltInType="false"
188 ForceConformanceInForLoopScope="true"
189 UsePrecompiledHeader="0"
190 WarningLevel="3"
191 WarnAsError="true"
192 Detect64BitPortabilityProblems="false"
193 DebugInformationFormat="3"
194 />
195 <Tool
196 Name="VCManagedResourceCompilerTool"
197 />
198 <Tool
199 Name="VCResourceCompilerTool"
200 />
201 <Tool
202 Name="VCPreLinkEventTool"
203 />
204 <Tool
205 Name="VCLibrarianTool"
206 AdditionalDependencies="psapi.lib"
207 OutputFile="$(OutDir)/llcommon.lib"
208 AdditionalLibraryDirectories=""
209 />
210 <Tool
211 Name="VCALinkTool"
212 />
213 <Tool
214 Name="VCXDCMakeTool"
215 />
216 <Tool
217 Name="VCBscMakeTool"
218 />
219 <Tool
220 Name="VCFxCopTool"
221 />
222 <Tool
223 Name="VCPostBuildEventTool"
224 />
225 </Configuration>
226 </Configurations>
227 <References>
228 </References>
229 <Files>
230 <Filter
231 Name="Source Files"
232 Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
233 UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
234 >
235 <File
236 RelativePath=".\llapp.cpp"
237 >
238 </File>
239 <File
240 RelativePath=".\llapr.cpp"
241 >
242 </File>
243 <File
244 RelativePath=".\llares.cpp"
245 >
246 </File>
247 <File
248 RelativePath=".\llassettype.cpp"
249 >
250 </File>
251 <File
252 RelativePath=".\llbase32.cpp"
253 >
254 </File>
255 <File
256 RelativePath=".\llbase64.cpp"
257 >
258 </File>
259 <File
260 RelativePath=".\llcommon.cpp"
261 >
262 </File>
263 <File
264 RelativePath=".\llcriticaldamp.cpp"
265 >
266 </File>
267 <File
268 RelativePath=".\lldate.cpp"
269 >
270 </File>
271 <File
272 RelativePath=".\llerror.cpp"
273 >
274 </File>
275 <File
276 RelativePath=".\llerrorthread.cpp"
277 >
278 </File>
279 <File
280 RelativePath=".\llevent.cpp"
281 >
282 </File>
283 <File
284 RelativePath=".\llfasttimer.cpp"
285 >
286 </File>
287 <File
288 RelativePath=".\llfile.cpp"
289 >
290 </File>
291 <File
292 RelativePath=".\llfindlocale.cpp"
293 >
294 </File>
295 <File
296 RelativePath=".\llfixedbuffer.cpp"
297 >
298 </File>
299 <File
300 RelativePath=".\llformat.cpp"
301 >
302 </File>
303 <File
304 RelativePath=".\llframetimer.cpp"
305 >
306 </File>
307 <File
308 RelativePath=".\llheartbeat.cpp"
309 >
310 </File>
311 <File
312 RelativePath=".\llindraconfigfile.cpp"
313 >
314 </File>
315 <File
316 RelativePath=".\llliveappconfig.cpp"
317 >
318 </File>
319 <File
320 RelativePath=".\lllivefile.cpp"
321 >
322 </File>
323 <File
324 RelativePath=".\lllog.cpp"
325 >
326 </File>
327 <File
328 RelativePath=".\llmemory.cpp"
329 >
330 </File>
331 <File
332 RelativePath=".\llmemorystream.cpp"
333 >
334 </File>
335 <File
336 RelativePath=".\llmetrics.cpp"
337 >
338 </File>
339 <File
340 RelativePath=".\llmortician.cpp"
341 >
342 </File>
343 <File
344 RelativePath=".\llprocessor.cpp"
345 >
346 </File>
347 <File
348 RelativePath=".\llqueuedthread.cpp"
349 >
350 </File>
351 <File
352 RelativePath=".\llrun.cpp"
353 >
354 </File>
355 <File
356 RelativePath=".\llsd.cpp"
357 >
358 </File>
359 <File
360 RelativePath=".\llsdserialize.cpp"
361 >
362 </File>
363 <File
364 RelativePath=".\llsdserialize_xml.cpp"
365 >
366 </File>
367 <File
368 RelativePath=".\llsdutil.cpp"
369 >
370 </File>
371 <File
372 RelativePath=".\llsecondlifeurls.cpp"
373 >
374 </File>
375 <File
376 RelativePath=".\llstat.cpp"
377 >
378 </File>
379 <File
380 RelativePath=".\llstreamtools.cpp"
381 >
382 </File>
383 <File
384 RelativePath=".\llstring.cpp"
385 >
386 </File>
387 <File
388 RelativePath=".\llstringtable.cpp"
389 >
390 </File>
391 <File
392 RelativePath=".\llsys.cpp"
393 >
394 </File>
395 <File
396 RelativePath=".\llthread.cpp"
397 >
398 </File>
399 <File
400 RelativePath=".\lltimer.cpp"
401 >
402 </File>
403 <File
404 RelativePath=".\lluri.cpp"
405 >
406 </File>
407 <File
408 RelativePath=".\llworkerthread.cpp"
409 >
410 </File>
411 <File
412 RelativePath=".\metaclass.cpp"
413 >
414 </File>
415 <File
416 RelativePath=".\metaproperty.cpp"
417 >
418 </File>
419 <File
420 RelativePath=".\reflective.cpp"
421 >
422 </File>
423 <File
424 RelativePath=".\timing.cpp"
425 >
426 </File>
427 <File
428 RelativePath=".\u64.cpp"
429 >
430 </File>
431 </Filter>
432 <Filter
433 Name="Header Files"
434 Filter="h;hpp;hxx;hm;inl;inc;xsd"
435 UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
436 >
437 <File
438 RelativePath=".\bitpack.h"
439 >
440 </File>
441 <File
442 RelativePath=".\doublelinkedlist.h"
443 >
444 </File>
445 <File
446 RelativePath=".\imageids.h"
447 >
448 </File>
449 <File
450 RelativePath=".\indra_constants.h"
451 >
452 </File>
453 <File
454 RelativePath=".\linden_common.h"
455 >
456 </File>
457 <File
458 RelativePath=".\linked_lists.h"
459 >
460 </File>
461 <File
462 RelativePath=".\llagentconstants.h"
463 >
464 </File>
465 <File
466 RelativePath=".\llapp.h"
467 >
468 </File>
469 <File
470 RelativePath=".\llapr.h"
471 >
472 </File>
473 <File
474 RelativePath=".\llares.h"
475 >
476 </File>
477 <File
478 RelativePath=".\llassettype.h"
479 >
480 </File>
481 <File
482 RelativePath=".\llassoclist.h"
483 >
484 </File>
485 <File
486 RelativePath=".\llavatarconstants.h"
487 >
488 </File>
489 <File
490 RelativePath=".\llbase32.h"
491 >
492 </File>
493 <File
494 RelativePath=".\llbase64.h"
495 >
496 </File>
497 <File
498 RelativePath=".\llboost.h"
499 >
500 </File>
501 <File
502 RelativePath=".\llchat.h"
503 >
504 </File>
505 <File
506 RelativePath=".\llclickaction.h"
507 >
508 </File>
509 <File
510 RelativePath=".\llcommon.h"
511 >
512 </File>
513 <File
514 RelativePath=".\llcriticaldamp.h"
515 >
516 </File>
517 <File
518 RelativePath=".\lldarray.h"
519 >
520 </File>
521 <File
522 RelativePath=".\lldarrayptr.h"
523 >
524 </File>
525 <File
526 RelativePath=".\lldate.h"
527 >
528 </File>
529 <File
530 RelativePath=".\lldefs.h"
531 >
532 </File>
533 <File
534 RelativePath=".\lldlinked.h"
535 >
536 </File>
537 <File
538 RelativePath=".\lldqueueptr.h"
539 >
540 </File>
541 <File
542 RelativePath=".\llendianswizzle.h"
543 >
544 </File>
545 <File
546 RelativePath=".\llenum.h"
547 >
548 </File>
549 <File
550 RelativePath=".\llerror.h"
551 >
552 </File>
553 <File
554 RelativePath=".\llerrorcontrol.h"
555 >
556 </File>
557 <File
558 RelativePath=".\llerrorthread.h"
559 >
560 </File>
561 <File
562 RelativePath=".\llevent.h"
563 >
564 </File>
565 <File
566 RelativePath=".\llextendedstatus.h"
567 >
568 </File>
569 <File
570 RelativePath=".\llfasttimer.h"
571 >
572 </File>
573 <File
574 RelativePath=".\llfile.h"
575 >
576 </File>
577 <File
578 RelativePath=".\llfindlocale.h"
579 >
580 </File>
581 <File
582 RelativePath=".\llfixedbuffer.h"
583 >
584 </File>
585 <File
586 RelativePath=".\llformat.h"
587 >
588 </File>
589 <File
590 RelativePath=".\llframecallbackmanager.h"
591 >
592 </File>
593 <File
594 RelativePath=".\llframetimer.h"
595 >
596 </File>
597 <File
598 RelativePath=".\llhash.h"
599 >
600 </File>
601 <File
602 RelativePath=".\llindexedqueue.h"
603 >
604 </File>
605 <File
606 RelativePath=".\llindraconfigfile.h"
607 >
608 </File>
609 <File
610 RelativePath=".\lllinkedqueue.h"
611 >
612 </File>
613 <File
614 RelativePath=".\llliveappconfig.h"
615 >
616 </File>
617 <File
618 RelativePath=".\lllivefile.h"
619 >
620 </File>
621 <File
622 RelativePath=".\lllocalidhashmap.h"
623 >
624 </File>
625 <File
626 RelativePath=".\lllog.h"
627 >
628 </File>
629 <File
630 RelativePath=".\lllslconstants.h"
631 >
632 </File>
633 <File
634 RelativePath=".\llmap.h"
635 >
636 </File>
637 <File
638 RelativePath=".\llmemory.h"
639 >
640 </File>
641 <File
642 RelativePath=".\llmemorystream.h"
643 >
644 </File>
645 <File
646 RelativePath=".\llmemtype.h"
647 >
648 </File>
649 <File
650 RelativePath=".\llmetrics.h"
651 >
652 </File>
653 <File
654 RelativePath=".\llmortician.h"
655 >
656 </File>
657 <File
658 RelativePath=".\llnametable.h"
659 >
660 </File>
661 <File
662 RelativePath=".\llnametable.h"
663 >
664 </File>
665 <File
666 RelativePath=".\llpreprocessor.h"
667 >
668 </File>
669 <File
670 RelativePath=".\llpriqueuemap.h"
671 >
672 </File>
673 <File
674 RelativePath=".\llprocessor.h"
675 >
676 </File>
677 <File
678 RelativePath=".\llptrskiplist.h"
679 >
680 </File>
681 <File
682 RelativePath=".\llptrskipmap.h"
683 >
684 </File>
685 <File
686 RelativePath=".\llqueuedthread.h"
687 >
688 </File>
689 <File
690 RelativePath=".\llrun.h"
691 >
692 </File>
693 <File
694 RelativePath=".\llsd.h"
695 >
696 </File>
697 <File
698 RelativePath=".\llsdserialize.h"
699 >
700 </File>
701 <File
702 RelativePath=".\llsdserialize_xml.h"
703 >
704 </File>
705 <File
706 RelativePath=".\llsdutil.h"
707 >
708 </File>
709 <File
710 RelativePath=".\llsecondlifeurls.h"
711 >
712 </File>
713 <File
714 RelativePath=".\llskiplist.h"
715 >
716 </File>
717 <File
718 RelativePath=".\llskipmap.h"
719 >
720 </File>
721 <File
722 RelativePath=".\llstat.h"
723 >
724 </File>
725 <File
726 RelativePath=".\llstatenums.h"
727 >
728 </File>
729 <File
730 RelativePath=".\llstl.h"
731 >
732 </File>
733 <File
734 RelativePath=".\llstreamtools.h"
735 >
736 </File>
737 <File
738 RelativePath=".\llstrider.h"
739 >
740 </File>
741 <File
742 RelativePath=".\llstring.h"
743 >
744 </File>
745 <File
746 RelativePath=".\llstringtable.h"
747 >
748 </File>
749 <File
750 RelativePath=".\llsys.h"
751 >
752 </File>
753 <File
754 RelativePath=".\llthread.h"
755 >
756 </File>
757 <File
758 RelativePath=".\lltimer.h"
759 >
760 </File>
761 <File
762 RelativePath=".\lluri.h"
763 >
764 </File>
765 <File
766 RelativePath=".\lluuidhashmap.h"
767 >
768 </File>
769 <File
770 RelativePath=".\llversionserver.h"
771 >
772 </File>
773 <File
774 RelativePath=".\llversionviewer.h"
775 >
776 </File>
777 <File
778 RelativePath=".\llworkerthread.h"
779 >
780 </File>
781 <File
782 RelativePath=".\metaclass.h"
783 >
784 </File>
785 <File
786 RelativePath=".\metaclasst.h"
787 >
788 </File>
789 <File
790 RelativePath=".\metaproperty.h"
791 >
792 </File>
793 <File
794 RelativePath=".\metapropertyt.h"
795 >
796 </File>
797 <File
798 RelativePath=".\new_mem_ops.h"
799 >
800 </File>
801 <File
802 RelativePath=".\priqueue.h"
803 >
804 </File>
805 <File
806 RelativePath=".\processor.h"
807 >
808 </File>
809 <File
810 RelativePath=".\roles_constants.h"
811 >
812 </File>
813 <File
814 RelativePath=".\stdenums.h"
815 >
816 </File>
817 <File
818 RelativePath=".\stdtypes.h"
819 >
820 </File>
821 <File
822 RelativePath=".\string_table.h"
823 >
824 </File>
825 <File
826 RelativePath=".\timer.h"
827 >
828 </File>
829 <File
830 RelativePath=".\timing.h"
831 >
832 </File>
833 <File
834 RelativePath=".\u64.h"
835 >
836 </File>
837 </Filter>
838 <Filter
839 Name="Resource Files"
840 Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
841 UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
842 >
843 </Filter>
844 </Files>
845 <Globals>
846 </Globals>
847</VisualStudioProject>
diff --git a/linden/indra/llcommon/llcommon_vc9.vcproj b/linden/indra/llcommon/llcommon_vc9.vcproj
deleted file mode 100644
index 1ae534d..0000000
--- a/linden/indra/llcommon/llcommon_vc9.vcproj
+++ /dev/null
@@ -1,828 +0,0 @@
1<?xml version="1.0" encoding="Windows-1252"?>
2<VisualStudioProject
3 ProjectType="Visual C++"
4 Version="9.00"
5 Name="llcommon"
6 ProjectGUID="{7BCB4B2C-8378-4186-88EA-5742B5ABE17F}"
7 RootNamespace="llcommon"
8 Keyword="Win32Proj"
9 TargetFrameworkVersion="131072"
10 >
11 <Platforms>
12 <Platform
13 Name="Win32"
14 />
15 </Platforms>
16 <ToolFiles>
17 </ToolFiles>
18 <Configurations>
19 <Configuration
20 Name="Debug|Win32"
21 OutputDirectory="../lib_$(ConfigurationName)/i686-win32"
22 IntermediateDirectory="$(ConfigurationName)"
23 ConfigurationType="4"
24 InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
25 CharacterSet="1"
26 >
27 <Tool
28 Name="VCPreBuildEventTool"
29 />
30 <Tool
31 Name="VCCustomBuildTool"
32 />
33 <Tool
34 Name="VCXMLDataGeneratorTool"
35 />
36 <Tool
37 Name="VCWebServiceProxyGeneratorTool"
38 />
39 <Tool
40 Name="VCMIDLTool"
41 />
42 <Tool
43 Name="VCCLCompilerTool"
44 Optimization="0"
45 AdditionalIncludeDirectories="..\..\libraries\i686-win32\include;..\..\libraries\include\"
46 PreprocessorDefinitions="WIN32;_DEBUG;_LIB;LL_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_USE_32BIT_TIME_T;LL_DEBUG;XML_STATIC;APR_DECLARE_STATIC"
47 MinimalRebuild="true"
48 BasicRuntimeChecks="3"
49 RuntimeLibrary="1"
50 StructMemberAlignment="4"
51 TreatWChar_tAsBuiltInType="false"
52 ForceConformanceInForLoopScope="true"
53 UsePrecompiledHeader="0"
54 WarningLevel="3"
55 WarnAsError="true"
56 Detect64BitPortabilityProblems="false"
57 DebugInformationFormat="4"
58 />
59 <Tool
60 Name="VCManagedResourceCompilerTool"
61 />
62 <Tool
63 Name="VCResourceCompilerTool"
64 />
65 <Tool
66 Name="VCPreLinkEventTool"
67 />
68 <Tool
69 Name="VCLibrarianTool"
70 OutputFile="$(OutDir)/llcommon.lib"
71 />
72 <Tool
73 Name="VCALinkTool"
74 />
75 <Tool
76 Name="VCXDCMakeTool"
77 />
78 <Tool
79 Name="VCBscMakeTool"
80 />
81 <Tool
82 Name="VCFxCopTool"
83 />
84 <Tool
85 Name="VCPostBuildEventTool"
86 />
87 </Configuration>
88 <Configuration
89 Name="Release|Win32"
90 OutputDirectory="../lib_$(ConfigurationName)/i686-win32"
91 IntermediateDirectory="$(ConfigurationName)"
92 ConfigurationType="4"
93 InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
94 CharacterSet="1"
95 >
96 <Tool
97 Name="VCPreBuildEventTool"
98 />
99 <Tool
100 Name="VCCustomBuildTool"
101 />
102 <Tool
103 Name="VCXMLDataGeneratorTool"
104 />
105 <Tool
106 Name="VCWebServiceProxyGeneratorTool"
107 />
108 <Tool
109 Name="VCMIDLTool"
110 />
111 <Tool
112 Name="VCCLCompilerTool"
113 AdditionalOptions="/Oy-"
114 InlineFunctionExpansion="2"
115 EnableIntrinsicFunctions="true"
116 AdditionalIncludeDirectories="..\..\libraries\i686-win32\include;..\..\libraries\include\"
117 PreprocessorDefinitions="WIN32;NDEBUG;_LIB;LL_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_USE_32BIT_TIME_T;LL_RELEASE;XML_STATIC;APR_DECLARE_STATIC"
118 RuntimeLibrary="0"
119 StructMemberAlignment="0"
120 TreatWChar_tAsBuiltInType="false"
121 ForceConformanceInForLoopScope="true"
122 UsePrecompiledHeader="0"
123 WarningLevel="3"
124 WarnAsError="true"
125 Detect64BitPortabilityProblems="false"
126 DebugInformationFormat="3"
127 />
128 <Tool
129 Name="VCManagedResourceCompilerTool"
130 />
131 <Tool
132 Name="VCResourceCompilerTool"
133 />
134 <Tool
135 Name="VCPreLinkEventTool"
136 />
137 <Tool
138 Name="VCLibrarianTool"
139 OutputFile="$(OutDir)/llcommon.lib"
140 />
141 <Tool
142 Name="VCALinkTool"
143 />
144 <Tool
145 Name="VCXDCMakeTool"
146 />
147 <Tool
148 Name="VCBscMakeTool"
149 />
150 <Tool
151 Name="VCFxCopTool"
152 />
153 <Tool
154 Name="VCPostBuildEventTool"
155 />
156 </Configuration>
157 <Configuration
158 Name="ReleaseNoOpt|Win32"
159 OutputDirectory="../lib_$(ConfigurationName)/i686-win32"
160 IntermediateDirectory="$(ConfigurationName)"
161 ConfigurationType="4"
162 InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
163 CharacterSet="1"
164 >
165 <Tool
166 Name="VCPreBuildEventTool"
167 />
168 <Tool
169 Name="VCCustomBuildTool"
170 />
171 <Tool
172 Name="VCXMLDataGeneratorTool"
173 />
174 <Tool
175 Name="VCWebServiceProxyGeneratorTool"
176 />
177 <Tool
178 Name="VCMIDLTool"
179 />
180 <Tool
181 Name="VCCLCompilerTool"
182 AdditionalOptions="/Oy-"
183 Optimization="0"
184 AdditionalIncludeDirectories="..\..\libraries\i686-win32\include;..\..\libraries\include\"
185 PreprocessorDefinitions="WIN32;NDEBUG;_LIB;LL_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_USE_32BIT_TIME_T;LL_RELEASE;XML_STATIC;APR_DECLARE_STATIC"
186 RuntimeLibrary="0"
187 StructMemberAlignment="0"
188 TreatWChar_tAsBuiltInType="false"
189 ForceConformanceInForLoopScope="true"
190 UsePrecompiledHeader="0"
191 WarningLevel="3"
192 WarnAsError="true"
193 Detect64BitPortabilityProblems="false"
194 DebugInformationFormat="3"
195 />
196 <Tool
197 Name="VCManagedResourceCompilerTool"
198 />
199 <Tool
200 Name="VCResourceCompilerTool"
201 />
202 <Tool
203 Name="VCPreLinkEventTool"
204 />
205 <Tool
206 Name="VCLibrarianTool"
207 AdditionalDependencies="psapi.lib"
208 OutputFile="$(OutDir)/llcommon.lib"
209 AdditionalLibraryDirectories=""
210 />
211 <Tool
212 Name="VCALinkTool"
213 />
214 <Tool
215 Name="VCXDCMakeTool"
216 />
217 <Tool
218 Name="VCBscMakeTool"
219 />
220 <Tool
221 Name="VCFxCopTool"
222 />
223 <Tool
224 Name="VCPostBuildEventTool"
225 />
226 </Configuration>
227 </Configurations>
228 <References>
229 </References>
230 <Files>
231 <Filter
232 Name="Source Files"
233 Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
234 UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
235 >
236 <File
237 RelativePath=".\llapp.cpp"
238 >
239 </File>
240 <File
241 RelativePath=".\llapr.cpp"
242 >
243 </File>
244 <File
245 RelativePath=".\llares.cpp"
246 >
247 </File>
248 <File
249 RelativePath=".\llassettype.cpp"
250 >
251 </File>
252 <File
253 RelativePath=".\llbase32.cpp"
254 >
255 </File>
256 <File
257 RelativePath=".\llbase64.cpp"
258 >
259 </File>
260 <File
261 RelativePath=".\llcommon.cpp"
262 >
263 </File>
264 <File
265 RelativePath=".\llcriticaldamp.cpp"
266 >
267 </File>
268 <File
269 RelativePath=".\lldate.cpp"
270 >
271 </File>
272 <File
273 RelativePath=".\llerror.cpp"
274 >
275 </File>
276 <File
277 RelativePath=".\llerrorthread.cpp"
278 >
279 </File>
280 <File
281 RelativePath=".\llevent.cpp"
282 >
283 </File>
284 <File
285 RelativePath=".\llfasttimer.cpp"
286 >
287 </File>
288 <File
289 RelativePath=".\llfile.cpp"
290 >
291 </File>
292 <File
293 RelativePath=".\llfindlocale.cpp"
294 >
295 </File>
296 <File
297 RelativePath=".\llfixedbuffer.cpp"
298 >
299 </File>
300 <File
301 RelativePath=".\llformat.cpp"
302 >
303 </File>
304 <File
305 RelativePath=".\llframetimer.cpp"
306 >
307 </File>
308 <File
309 RelativePath=".\llheartbeat.cpp"
310 >
311 </File>
312 <File
313 RelativePath=".\llindraconfigfile.cpp"
314 >
315 </File>
316 <File
317 RelativePath=".\llliveappconfig.cpp"
318 >
319 </File>
320 <File
321 RelativePath=".\lllivefile.cpp"
322 >
323 </File>
324 <File
325 RelativePath=".\lllog.cpp"
326 >
327 </File>
328 <File
329 RelativePath=".\llmemory.cpp"
330 >
331 </File>
332 <File
333 RelativePath=".\llmemorystream.cpp"
334 >
335 </File>
336 <File
337 RelativePath=".\llmetrics.cpp"
338 >
339 </File>
340 <File
341 RelativePath=".\llmortician.cpp"
342 >
343 </File>
344 <File
345 RelativePath=".\llprocessor.cpp"
346 >
347 </File>
348 <File
349 RelativePath=".\llqueuedthread.cpp"
350 >
351 </File>
352 <File
353 RelativePath=".\llrun.cpp"
354 >
355 </File>
356 <File
357 RelativePath=".\llsd.cpp"
358 >
359 </File>
360 <File
361 RelativePath=".\llsdserialize.cpp"
362 >
363 </File>
364 <File
365 RelativePath=".\llsdserialize_xml.cpp"
366 >
367 </File>
368 <File
369 RelativePath=".\llsdutil.cpp"
370 >
371 </File>
372 <File
373 RelativePath=".\llsecondlifeurls.cpp"
374 >
375 </File>
376 <File
377 RelativePath=".\llstat.cpp"
378 >
379 </File>
380 <File
381 RelativePath=".\llstreamtools.cpp"
382 >
383 </File>
384 <File
385 RelativePath=".\llstring.cpp"
386 >
387 </File>
388 <File
389 RelativePath=".\llstringtable.cpp"
390 >
391 </File>
392 <File
393 RelativePath=".\llsys.cpp"
394 >
395 </File>
396 <File
397 RelativePath=".\llthread.cpp"
398 >
399 </File>
400 <File
401 RelativePath=".\lltimer.cpp"
402 >
403 </File>
404 <File
405 RelativePath=".\lluri.cpp"
406 >
407 </File>
408 <File
409 RelativePath=".\llworkerthread.cpp"
410 >
411 </File>
412 <File
413 RelativePath=".\metaclass.cpp"
414 >
415 </File>
416 <File
417 RelativePath=".\metaproperty.cpp"
418 >
419 </File>
420 <File
421 RelativePath=".\reflective.cpp"
422 >
423 </File>
424 <File
425 RelativePath=".\timing.cpp"
426 >
427 </File>
428 <File
429 RelativePath=".\u64.cpp"
430 >
431 </File>
432 </Filter>
433 <Filter
434 Name="Header Files"
435 Filter="h;hpp;hxx;hm;inl;inc;xsd"
436 UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
437 >
438 <File
439 RelativePath=".\bitpack.h"
440 >
441 </File>
442 <File
443 RelativePath=".\doublelinkedlist.h"
444 >
445 </File>
446 <File
447 RelativePath=".\imageids.h"
448 >
449 </File>
450 <File
451 RelativePath=".\indra_constants.h"
452 >
453 </File>
454 <File
455 RelativePath=".\linden_common.h"
456 >
457 </File>
458 <File
459 RelativePath=".\linked_lists.h"
460 >
461 </File>
462 <File
463 RelativePath=".\llagentconstants.h"
464 >
465 </File>
466 <File
467 RelativePath=".\llapp.h"
468 >
469 </File>
470 <File
471 RelativePath=".\llapr.h"
472 >
473 </File>
474 <File
475 RelativePath=".\llares.h"
476 >
477 </File>
478 <File
479 RelativePath=".\llassettype.h"
480 >
481 </File>
482 <File
483 RelativePath=".\llassoclist.h"
484 >
485 </File>
486 <File
487 RelativePath=".\llavatarconstants.h"
488 >
489 </File>
490 <File
491 RelativePath=".\llbase32.h"
492 >
493 </File>
494 <File
495 RelativePath=".\llbase64.h"
496 >
497 </File>
498 <File
499 RelativePath=".\llboost.h"
500 >
501 </File>
502 <File
503 RelativePath=".\llchat.h"
504 >
505 </File>
506 <File
507 RelativePath=".\llclickaction.h"
508 >
509 </File>
510 <File
511 RelativePath=".\llcommon.h"
512 >
513 </File>
514 <File
515 RelativePath=".\llcriticaldamp.h"
516 >
517 </File>
518 <File
519 RelativePath=".\lldarray.h"
520 >
521 </File>
522 <File
523 RelativePath=".\lldarrayptr.h"
524 >
525 </File>
526 <File
527 RelativePath=".\lldate.h"
528 >
529 </File>
530 <File
531 RelativePath=".\lldefs.h"
532 >
533 </File>
534 <File
535 RelativePath=".\lldlinked.h"
536 >
537 </File>
538 <File
539 RelativePath=".\lldqueueptr.h"
540 >
541 </File>
542 <File
543 RelativePath=".\llendianswizzle.h"
544 >
545 </File>
546 <File
547 RelativePath=".\llenum.h"
548 >
549 </File>
550 <File
551 RelativePath=".\llerror.h"
552 >
553 </File>
554 <File
555 RelativePath=".\llerrorcontrol.h"
556 >
557 </File>
558 <File
559 RelativePath=".\llerrorthread.h"
560 >
561 </File>
562 <File
563 RelativePath=".\llevent.h"
564 >
565 </File>
566 <File
567 RelativePath=".\llextendedstatus.h"
568 >
569 </File>
570 <File
571 RelativePath=".\llfasttimer.h"
572 >
573 </File>
574 <File
575 RelativePath=".\llfile.h"
576 >
577 </File>
578 <File
579 RelativePath=".\llfindlocale.h"
580 >
581 </File>
582 <File
583 RelativePath=".\llfixedbuffer.h"
584 >
585 </File>
586 <File
587 RelativePath=".\llformat.h"
588 >
589 </File>
590 <File
591 RelativePath=".\llframecallbackmanager.h"
592 >
593 </File>
594 <File
595 RelativePath=".\llframetimer.h"
596 >
597 </File>
598 <File
599 RelativePath=".\llhash.h"
600 >
601 </File>
602 <File
603 RelativePath=".\llindexedqueue.h"
604 >
605 </File>
606 <File
607 RelativePath=".\llindraconfigfile.h"
608 >
609 </File>
610 <File
611 RelativePath=".\lllinkedqueue.h"
612 >
613 </File>
614 <File
615 RelativePath=".\llliveappconfig.h"
616 >
617 </File>
618 <File
619 RelativePath=".\lllivefile.h"
620 >
621 </File>
622 <File
623 RelativePath=".\lllocalidhashmap.h"
624 >
625 </File>
626 <File
627 RelativePath=".\lllog.h"
628 >
629 </File>
630 <File
631 RelativePath=".\lllslconstants.h"
632 >
633 </File>
634 <File
635 RelativePath=".\llmap.h"
636 >
637 </File>
638 <File
639 RelativePath=".\llmemory.h"
640 >
641 </File>
642 <File
643 RelativePath=".\llmemorystream.h"
644 >
645 </File>
646 <File
647 RelativePath=".\llmemtype.h"
648 >
649 </File>
650 <File
651 RelativePath=".\llmetrics.h"
652 >
653 </File>
654 <File
655 RelativePath=".\llmortician.h"
656 >
657 </File>
658 <File
659 RelativePath=".\llnametable.h"
660 >
661 </File>
662 <File
663 RelativePath=".\llpreprocessor.h"
664 >
665 </File>
666 <File
667 RelativePath=".\llpriqueuemap.h"
668 >
669 </File>
670 <File
671 RelativePath=".\llprocessor.h"
672 >
673 </File>
674 <File
675 RelativePath=".\llptrskiplist.h"
676 >
677 </File>
678 <File
679 RelativePath=".\llptrskipmap.h"
680 >
681 </File>
682 <File
683 RelativePath=".\llqueuedthread.h"
684 >
685 </File>
686 <File
687 RelativePath=".\llrun.h"
688 >
689 </File>
690 <File
691 RelativePath=".\llsd.h"
692 >
693 </File>
694 <File
695 RelativePath=".\llsdserialize.h"
696 >
697 </File>
698 <File
699 RelativePath=".\llsdserialize_xml.h"
700 >
701 </File>
702 <File
703 RelativePath=".\llsdutil.h"
704 >
705 </File>
706 <File
707 RelativePath=".\llsecondlifeurls.h"
708 >
709 </File>
710 <File
711 RelativePath=".\llskiplist.h"
712 >
713 </File>
714 <File
715 RelativePath=".\llskipmap.h"
716 >
717 </File>
718 <File
719 RelativePath=".\llstat.h"
720 >
721 </File>
722 <File
723 RelativePath=".\llstatenums.h"
724 >
725 </File>
726 <File
727 RelativePath=".\llstl.h"
728 >
729 </File>
730 <File
731 RelativePath=".\llstreamtools.h"
732 >
733 </File>
734 <File
735 RelativePath=".\llstrider.h"
736 >
737 </File>
738 <File
739 RelativePath=".\llstring.h"
740 >
741 </File>
742 <File
743 RelativePath=".\llstringtable.h"
744 >
745 </File>
746 <File
747 RelativePath=".\llsys.h"
748 >
749 </File>
750 <File
751 RelativePath=".\llthread.h"
752 >
753 </File>
754 <File
755 RelativePath=".\lltimer.h"
756 >
757 </File>
758 <File
759 RelativePath=".\lluri.h"
760 >
761 </File>
762 <File
763 RelativePath=".\lluuidhashmap.h"
764 >
765 </File>
766 <File
767 RelativePath=".\llversionserver.h"
768 >
769 </File>
770 <File
771 RelativePath=".\llversionviewer.h"
772 >
773 </File>
774 <File
775 RelativePath=".\llworkerthread.h"
776 >
777 </File>
778 <File
779 RelativePath=".\new_mem_ops.h"
780 >
781 </File>
782 <File
783 RelativePath=".\priqueue.h"
784 >
785 </File>
786 <File
787 RelativePath=".\processor.h"
788 >
789 </File>
790 <File
791 RelativePath=".\roles_constants.h"
792 >
793 </File>
794 <File
795 RelativePath=".\stdenums.h"
796 >
797 </File>
798 <File
799 RelativePath=".\stdtypes.h"
800 >
801 </File>
802 <File
803 RelativePath=".\string_table.h"
804 >
805 </File>
806 <File
807 RelativePath=".\timer.h"
808 >
809 </File>
810 <File
811 RelativePath=".\timing.h"
812 >
813 </File>
814 <File
815 RelativePath=".\u64.h"
816 >
817 </File>
818 </Filter>
819 <Filter
820 Name="Resource Files"
821 Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
822 UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
823 >
824 </Filter>
825 </Files>
826 <Globals>
827 </Globals>
828</VisualStudioProject>
diff --git a/linden/indra/llmath/llcrc.cpp b/linden/indra/llcommon/llcrc.cpp
index 447521a..beb76d1 100644
--- a/linden/indra/llmath/llcrc.cpp
+++ b/linden/indra/llcommon/llcrc.cpp
@@ -163,15 +163,15 @@ void LLCRC::update(const U8* buffer, size_t buffer_size)
163 } 163 }
164} 164}
165 165
166void LLCRC::update(const char* filename) 166void LLCRC::update(const std::string& filename)
167{ 167{
168 if (!filename) 168 if (filename.empty())
169 { 169 {
170 llerrs << "No filename specified" << llendl; 170 llerrs << "No filename specified" << llendl;
171 return; 171 return;
172 } 172 }
173 173
174 LLFILE* fp = LLFile::fopen(filename, "rb"); /* Flawfinder: ignore */ 174 FILE* fp = LLFile::fopen(filename, "rb"); /* Flawfinder: ignore */
175 175
176 if (fp) 176 if (fp)
177 { 177 {
diff --git a/linden/indra/llmath/llcrc.h b/linden/indra/llcommon/llcrc.h
index 59f58ce..20f214e 100644
--- a/linden/indra/llmath/llcrc.h
+++ b/linden/indra/llcommon/llcrc.h
@@ -41,7 +41,7 @@
41// example (don't try this at work kids): 41// example (don't try this at work kids):
42// 42//
43// LLCRC crc; 43// LLCRC crc;
44// LLFILE* fp = LLFile::fopen(filename,"rb"); 44// FILE* fp = LLFile::fopen(filename,"rb");
45// while(!feof(fp)) { 45// while(!feof(fp)) {
46// crc.update(fgetc(fp)); 46// crc.update(fgetc(fp));
47// } 47// }
@@ -60,7 +60,7 @@ public:
60 U32 getCRC() const; 60 U32 getCRC() const;
61 void update(U8 next_byte); 61 void update(U8 next_byte);
62 void update(const U8* buffer, size_t buffer_size); 62 void update(const U8* buffer, size_t buffer_size);
63 void update(const char *filename); 63 void update(const std::string& filename);
64 64
65#ifdef _DEBUG 65#ifdef _DEBUG
66 // This function runs tests to make sure the crc is 66 // This function runs tests to make sure the crc is
diff --git a/linden/indra/llcommon/lldarray.h b/linden/indra/llcommon/lldarray.h
index 45e564f..32ece4e 100644
--- a/linden/indra/llcommon/lldarray.h
+++ b/linden/indra/llcommon/lldarray.h
@@ -32,7 +32,6 @@
32#ifndef LL_LLDARRAY_H 32#ifndef LL_LLDARRAY_H
33#define LL_LLDARRAY_H 33#define LL_LLDARRAY_H
34 34
35#include "llmath.h"
36#include "llerror.h" 35#include "llerror.h"
37 36
38#include <vector> 37#include <vector>
diff --git a/linden/indra/llcommon/lldate.cpp b/linden/indra/llcommon/lldate.cpp
index 5d36d2b..a313246 100644
--- a/linden/indra/llcommon/lldate.cpp
+++ b/linden/indra/llcommon/lldate.cpp
@@ -34,7 +34,7 @@
34#include "linden_common.h" 34#include "linden_common.h"
35#include "lldate.h" 35#include "lldate.h"
36 36
37#include "apr-1/apr_time.h" 37#include "apr_time.h"
38 38
39#include <iomanip> 39#include <iomanip>
40#include <sstream> 40#include <sstream>
diff --git a/linden/indra/llcommon/llerror.cpp b/linden/indra/llcommon/llerror.cpp
index b74b288..5c7c3cd 100644
--- a/linden/indra/llcommon/llerror.cpp
+++ b/linden/indra/llcommon/llerror.cpp
@@ -102,7 +102,7 @@ namespace {
102 public: 102 public:
103 RecordToFile(const std::string& filename) 103 RecordToFile(const std::string& filename)
104 { 104 {
105 mFile.open(filename.c_str(), llofstream::out | llofstream::app); 105 mFile.open(filename, llofstream::out | llofstream::app);
106 if (!mFile) 106 if (!mFile)
107 { 107 {
108 llinfos << "Error setting log file to " << filename << llendl; 108 llinfos << "Error setting log file to " << filename << llendl;
@@ -168,7 +168,7 @@ namespace {
168 168
169 private: 169 private:
170 bool mTimestamp; 170 bool mTimestamp;
171 typedef enum ANSIState {ANSI_PROBE, ANSI_YES, ANSI_NO}; 171 enum ANSIState {ANSI_PROBE, ANSI_YES, ANSI_NO};
172 ANSIState mUseANSI; 172 ANSIState mUseANSI;
173 void colorANSI(const std::string color) 173 void colorANSI(const std::string color)
174 { 174 {
@@ -196,7 +196,7 @@ namespace {
196 virtual void recordMessage(LLError::ELevel level, 196 virtual void recordMessage(LLError::ELevel level,
197 const std::string& message) 197 const std::string& message)
198 { 198 {
199 mBuffer.addLine(message.c_str()); 199 mBuffer.addLine(message);
200 } 200 }
201 201
202 private: 202 private:
@@ -305,7 +305,7 @@ namespace
305 std::string file = dirBase + "logcontrol-dev.xml"; 305 std::string file = dirBase + "logcontrol-dev.xml";
306 306
307 llstat stat_info; 307 llstat stat_info;
308 if (LLFile::stat(file.c_str(), &stat_info)) { 308 if (LLFile::stat(file, &stat_info)) {
309 // NB: stat returns non-zero if it can't read the file, for example 309 // NB: stat returns non-zero if it can't read the file, for example
310 // if it doesn't exist. LLFile has no better abstraction for 310 // if it doesn't exist. LLFile has no better abstraction for
311 // testing for file existence. 311 // testing for file existence.
@@ -321,7 +321,7 @@ namespace
321 LLSD configuration; 321 LLSD configuration;
322 322
323 { 323 {
324 llifstream file(filename().c_str()); 324 llifstream file(filename());
325 if (file.is_open()) 325 if (file.is_open())
326 { 326 {
327 LLSDSerialize::fromXML(configuration, file); 327 LLSDSerialize::fromXML(configuration, file);
@@ -1040,17 +1040,37 @@ namespace LLError
1040 << "(" << site.mLine << ") : "; 1040 << "(" << site.mLine << ") : ";
1041 } 1041 }
1042 1042
1043 if (message.find(functionName(site.mFunction)) == std::string::npos)
1044 {
1045 #if LL_WINDOWS 1043 #if LL_WINDOWS
1046 // DevStudio: __FUNCTION__ already includes the full class name 1044 // DevStudio: __FUNCTION__ already includes the full class name
1047 #else 1045 #else
1048 if (site.mClassInfo != typeid(NoClassInfo)) 1046 if (site.mClassInfo != typeid(NoClassInfo))
1047 {
1048 prefix << className(site.mClassInfo) << "::";
1049 }
1050 #endif
1051 prefix << site.mFunction << ": ";
1052
1053 if (site.mPrintOnce)
1054 {
1055 std::map<std::string, unsigned int>::iterator messageIter = s.uniqueLogMessages.find(message);
1056 if (messageIter != s.uniqueLogMessages.end())
1057 {
1058 messageIter->second++;
1059 unsigned int num_messages = messageIter->second;
1060 if (num_messages == 10 || num_messages == 50 || (num_messages % 100) == 0)
1061 {
1062 prefix << "ONCE (" << num_messages << "th time seen): ";
1063 }
1064 else
1065 {
1066 return;
1067 }
1068 }
1069 else
1049 { 1070 {
1050 prefix << className(site.mClassInfo) << "::"; 1071 prefix << "ONCE: ";
1072 s.uniqueLogMessages[message] = 1;
1051 } 1073 }
1052 #endif
1053 prefix << site.mFunction << ": ";
1054 } 1074 }
1055 1075
1056 if (site.mPrintOnce) 1076 if (site.mPrintOnce)
diff --git a/linden/indra/llcommon/llevent.cpp b/linden/indra/llcommon/llevent.cpp
index 33af028..7d701a1 100644
--- a/linden/indra/llcommon/llevent.cpp
+++ b/linden/indra/llcommon/llevent.cpp
@@ -219,7 +219,7 @@ std::vector<LLListenerEntry> LLSimpleDispatcher::getListeners() const
219bool LLSimpleDispatcher::fireEvent(LLPointer<LLEvent> event, LLSD filter) 219bool LLSimpleDispatcher::fireEvent(LLPointer<LLEvent> event, LLSD filter)
220{ 220{
221 std::vector<LLListenerEntry>::iterator itor; 221 std::vector<LLListenerEntry>::iterator itor;
222 LLString filter_string = filter.asString(); 222 std::string filter_string = filter.asString();
223 for (itor=mListeners.begin(); itor!=mListeners.end(); ++itor) 223 for (itor=mListeners.begin(); itor!=mListeners.end(); ++itor)
224 { 224 {
225 LLListenerEntry& entry = *itor; 225 LLListenerEntry& entry = *itor;
diff --git a/linden/indra/llcommon/llfile.cpp b/linden/indra/llcommon/llfile.cpp
index fc0d481..b32437f 100644
--- a/linden/indra/llcommon/llfile.cpp
+++ b/linden/indra/llcommon/llfile.cpp
@@ -32,6 +32,10 @@
32 * $/LicenseInfo$ 32 * $/LicenseInfo$
33 */ 33 */
34 34
35#if LL_WINDOWS
36#include <windows.h>
37#endif
38
35#include "linden_common.h" 39#include "linden_common.h"
36#include "llfile.h" 40#include "llfile.h"
37#include "llstring.h" 41#include "llstring.h"
@@ -40,7 +44,7 @@
40using namespace std; 44using namespace std;
41 45
42// static 46// static
43int LLFile::mkdir(const char* dirname, int perms) 47int LLFile::mkdir(const std::string& dirname, int perms)
44{ 48{
45#if LL_WINDOWS 49#if LL_WINDOWS
46 // permissions are ignored on Windows 50 // permissions are ignored on Windows
@@ -48,12 +52,12 @@ int LLFile::mkdir(const char* dirname, int perms)
48 llutf16string utf16dirname = utf8str_to_utf16str(utf8dirname); 52 llutf16string utf16dirname = utf8str_to_utf16str(utf8dirname);
49 return _wmkdir(utf16dirname.c_str()); 53 return _wmkdir(utf16dirname.c_str());
50#else 54#else
51 return ::mkdir(dirname, (mode_t)perms); 55 return ::mkdir(dirname.c_str(), (mode_t)perms);
52#endif 56#endif
53} 57}
54 58
55// static 59// static
56int LLFile::rmdir(const char* dirname) 60int LLFile::rmdir(const std::string& dirname)
57{ 61{
58#if LL_WINDOWS 62#if LL_WINDOWS
59 // permissions are ignored on Windows 63 // permissions are ignored on Windows
@@ -61,29 +65,29 @@ int LLFile::rmdir(const char* dirname)
61 llutf16string utf16dirname = utf8str_to_utf16str(utf8dirname); 65 llutf16string utf16dirname = utf8str_to_utf16str(utf8dirname);
62 return _wrmdir(utf16dirname.c_str()); 66 return _wrmdir(utf16dirname.c_str());
63#else 67#else
64 return ::rmdir(dirname); 68 return ::rmdir(dirname.c_str());
65#endif 69#endif
66} 70}
67 71
68// static 72// static
69LLFILE* LLFile::fopen(const char* filename, const char* mode) /* Flawfinder: ignore */ 73LLFILE* LLFile::fopen(const std::string& filename, const char* mode) /* Flawfinder: ignore */
70{ 74{
71#if LL_WINDOWS 75#if LL_WINDOWS
72 std::string utf8filename = filename; 76 std::string utf8filename = filename;
73 std::string utf8mode = mode; 77 std::string utf8mode = std::string(mode);
74 llutf16string utf16filename = utf8str_to_utf16str(utf8filename); 78 llutf16string utf16filename = utf8str_to_utf16str(utf8filename);
75 llutf16string utf16mode = utf8str_to_utf16str(utf8mode); 79 llutf16string utf16mode = utf8str_to_utf16str(utf8mode);
76 return _wfopen(utf16filename.c_str(),utf16mode.c_str()); 80 return _wfopen(utf16filename.c_str(),utf16mode.c_str());
77#else 81#else
78 return ::fopen(filename,mode); /* Flawfinder: ignore */ 82 return ::fopen(filename.c_str(),mode); /* Flawfinder: ignore */
79#endif 83#endif
80} 84}
81 85
82LLFILE* LLFile::_fsopen(const char* filename, const char* mode, int sharingFlag) 86LLFILE* LLFile::_fsopen(const std::string& filename, const char* mode, int sharingFlag)
83{ 87{
84#if LL_WINDOWS 88#if LL_WINDOWS
85 std::string utf8filename = filename; 89 std::string utf8filename = filename;
86 std::string utf8mode = mode; 90 std::string utf8mode = std::string(mode);
87 llutf16string utf16filename = utf8str_to_utf16str(utf8filename); 91 llutf16string utf16filename = utf8str_to_utf16str(utf8filename);
88 llutf16string utf16mode = utf8str_to_utf16str(utf8mode); 92 llutf16string utf16mode = utf8str_to_utf16str(utf8mode);
89 return _wfsopen(utf16filename.c_str(),utf16mode.c_str(),sharingFlag); 93 return _wfsopen(utf16filename.c_str(),utf16mode.c_str(),sharingFlag);
@@ -93,18 +97,18 @@ LLFILE* LLFile::_fsopen(const char* filename, const char* mode, int sharingFlag)
93#endif 97#endif
94} 98}
95 99
96int LLFile::remove(const char* filename) 100int LLFile::remove(const std::string& filename)
97{ 101{
98#if LL_WINDOWS 102#if LL_WINDOWS
99 std::string utf8filename = filename; 103 std::string utf8filename = filename;
100 llutf16string utf16filename = utf8str_to_utf16str(utf8filename); 104 llutf16string utf16filename = utf8str_to_utf16str(utf8filename);
101 return _wremove(utf16filename.c_str()); 105 return _wremove(utf16filename.c_str());
102#else 106#else
103 return ::remove(filename); 107 return ::remove(filename.c_str());
104#endif 108#endif
105} 109}
106 110
107int LLFile::rename(const char* filename, const char* newname) 111int LLFile::rename(const std::string& filename, const std::string& newname)
108{ 112{
109#if LL_WINDOWS 113#if LL_WINDOWS
110 std::string utf8filename = filename; 114 std::string utf8filename = filename;
@@ -113,19 +117,63 @@ int LLFile::rename(const char* filename, const char* newname)
113 llutf16string utf16newname = utf8str_to_utf16str(utf8newname); 117 llutf16string utf16newname = utf8str_to_utf16str(utf8newname);
114 return _wrename(utf16filename.c_str(),utf16newname.c_str()); 118 return _wrename(utf16filename.c_str(),utf16newname.c_str());
115#else 119#else
116 return ::rename(filename,newname); 120 return ::rename(filename.c_str(),newname.c_str());
117#endif 121#endif
118} 122}
119 123
120int LLFile::stat(const char* filename, llstat* filestatus) 124int LLFile::stat(const std::string& filename, llstat* filestatus)
121{ 125{
122#if LL_WINDOWS 126#if LL_WINDOWS
123 std::string utf8filename = filename; 127 std::string utf8filename = filename;
124 llutf16string utf16filename = utf8str_to_utf16str(utf8filename); 128 llutf16string utf16filename = utf8str_to_utf16str(utf8filename);
125 return _wstat(utf16filename.c_str(),filestatus); 129 return _wstat(utf16filename.c_str(),filestatus);
126#else 130#else
127 return ::stat(filename,filestatus); 131 return ::stat(filename.c_str(),filestatus);
132#endif
133}
134
135bool LLFile::isdir(const std::string& filename)
136{
137 llstat st;
138
139 return stat(filename, &st) == 0 && S_ISDIR(st.st_mode);
140}
141
142bool LLFile::isfile(const std::string& filename)
143{
144 llstat st;
145
146 return stat(filename, &st) == 0 && S_ISREG(st.st_mode);
147}
148
149const char *LLFile::tmpdir()
150{
151 static std::string utf8path;
152
153 if (utf8path.empty())
154 {
155 char sep;
156#if LL_WINDOWS
157 sep = '\\';
158
159 DWORD len = GetTempPathW(0, L"");
160 llutf16string utf16path;
161 utf16path.resize(len + 1);
162 len = GetTempPathW(static_cast<DWORD>(utf16path.size()), &utf16path[0]);
163 utf8path = utf16str_to_utf8str(utf16path);
164#else
165 sep = '/';
166
167 char *env = getenv("TMPDIR");
168
169 utf8path = env ? env : "/tmp/";
128#endif 170#endif
171 if (utf8path[utf8path.size() - 1] != sep)
172 {
173 utf8path += sep;
174 }
175 }
176 return utf8path.c_str();
129} 177}
130 178
131 179
@@ -133,7 +181,7 @@ int LLFile::stat(const char* filename, llstat* filestatus)
133 181
134#if USE_LLFILESTREAMS 182#if USE_LLFILESTREAMS
135 183
136LLFILE * LLFile::_Fiopen(const char *filename, std::ios::openmode mode,int) // protection currently unused 184LLFILE * LLFile::_Fiopen(const std::string& filename, std::ios::openmode mode,int) // protection currently unused
137{ // open a file 185{ // open a file
138 static const char *mods[] = 186 static const char *mods[] =
139 { // fopen mode strings corresponding to valid[i] 187 { // fopen mode strings corresponding to valid[i]
@@ -202,7 +250,7 @@ void llifstream::close()
202 } 250 }
203} 251}
204 252
205void llifstream::open(const char* _Filename, /* Flawfinder: ignore */ 253void llifstream::open(const std::string& _Filename, /* Flawfinder: ignore */
206 ios_base::openmode _Mode, 254 ios_base::openmode _Mode,
207 int _Prot) 255 int _Prot)
208{ // open a C stream with specified mode 256{ // open a C stream with specified mode
@@ -234,7 +282,7 @@ llifstream::~llifstream()
234 delete _Filebuffer; 282 delete _Filebuffer;
235} 283}
236 284
237llifstream::llifstream(const char *_Filename, 285llifstream::llifstream(const std::string& _Filename,
238 ios_base::openmode _Mode, 286 ios_base::openmode _Mode,
239 int _Prot) 287 int _Prot)
240 : std::basic_istream< char , std::char_traits< char > >(NULL,true),_Filebuffer(NULL),_ShouldClose(false) 288 : std::basic_istream< char , std::char_traits< char > >(NULL,true),_Filebuffer(NULL),_ShouldClose(false)
@@ -253,7 +301,7 @@ bool llofstream::is_open() const
253 return false; 301 return false;
254} 302}
255 303
256void llofstream::open(const char* _Filename, /* Flawfinder: ignore */ 304void llofstream::open(const std::string& _Filename, /* Flawfinder: ignore */
257 ios_base::openmode _Mode, 305 ios_base::openmode _Mode,
258 int _Prot) 306 int _Prot)
259{ // open a C stream with specified mode 307{ // open a C stream with specified mode
@@ -279,7 +327,7 @@ void llofstream::close()
279 } 327 }
280} 328}
281 329
282llofstream::llofstream(const char *_Filename, 330llofstream::llofstream(const std::string& _Filename,
283 std::ios_base::openmode _Mode, 331 std::ios_base::openmode _Mode,
284 int _Prot) 332 int _Prot)
285 : std::basic_ostream<char,std::char_traits < char > >(NULL,true),_Filebuffer(NULL),_ShouldClose(false) 333 : std::basic_ostream<char,std::char_traits < char > >(NULL,true),_Filebuffer(NULL),_ShouldClose(false)
diff --git a/linden/indra/llcommon/llfile.h b/linden/indra/llcommon/llfile.h
index 189edbf..f3e3af5 100644
--- a/linden/indra/llcommon/llfile.h
+++ b/linden/indra/llcommon/llfile.h
@@ -50,31 +50,45 @@ typedef FILE LLFILE;
50#define USE_LLFILESTREAMS 0 50#define USE_LLFILESTREAMS 0
51#endif 51#endif
52 52
53#include <sys/stat.h>
53 54
54#if LL_WINDOWS 55#if LL_WINDOWS
55// windows version of stat function and stat data structure are called _stat 56// windows version of stat function and stat data structure are called _stat
56typedef struct _stat llstat; 57typedef struct _stat llstat;
57#else 58#else
58#include <sys/stat.h>
59typedef struct stat llstat; 59typedef struct stat llstat;
60#endif 60#endif
61 61
62#ifndef S_ISREG
63# define S_ISREG(x) (((x) & S_IFMT) == S_IFREG)
64#endif
65
66#ifndef S_ISDIR
67# define S_ISDIR(x) (((x) & S_IFMT) == S_IFDIR)
68#endif
69
70#include "llstring.h" // safe char* -> std::string conversion
71
62class LLFile 72class LLFile
63{ 73{
64public: 74public:
65 // All these functions take UTF8 path/filenames. 75 // All these functions take UTF8 path/filenames.
66 static LLFILE* fopen(const char* filename,const char* accessmode); /* Flawfinder: ignore */ 76 static LLFILE* fopen(const std::string& filename,const char* accessmode); /* Flawfinder: ignore */
67 static LLFILE* _fsopen(const char* filename,const char* accessmode,int sharingFlag); 77 static LLFILE* _fsopen(const std::string& filename,const char* accessmode,int sharingFlag);
68 78
69 // perms is a permissions mask like 0777 or 0700. In most cases it will 79 // perms is a permissions mask like 0777 or 0700. In most cases it will
70 // be overridden by the user's umask. It is ignored on Windows. 80 // be overridden by the user's umask. It is ignored on Windows.
71 static int mkdir(const char* filename, int perms = 0700); 81 static int mkdir(const std::string& filename, int perms = 0700);
72 82
73 static int rmdir(const char* filename); 83 static int rmdir(const std::string& filename);
74 static int remove(const char* filename); 84 static int remove(const std::string& filename);
75 static int rename(const char* filename,const char* newname); 85 static int rename(const std::string& filename,const std::string& newname);
76 static int stat(const char* filename,llstat* file_status); 86 static int stat(const std::string& filename,llstat* file_status);
77 static LLFILE * _Fiopen(const char *filename, std::ios::openmode mode,int); // protection currently unused 87 static bool isdir(const std::string& filename);
88 static bool isfile(const std::string& filename);
89 static LLFILE * _Fiopen(const std::string& filename, std::ios::openmode mode,int); // protection currently unused
90
91 static const char * tmpdir();
78}; 92};
79 93
80 94
@@ -93,7 +107,7 @@ public:
93 { // construct unopened 107 { // construct unopened
94 } 108 }
95 109
96 explicit llifstream(const char *_Filename, 110 explicit llifstream(const std::string& _Filename,
97 ios_base::openmode _Mode = ios_base::in, 111 ios_base::openmode _Mode = ios_base::in,
98 int _Prot = (int)ios_base::_Openprot); 112 int _Prot = (int)ios_base::_Openprot);
99 113
@@ -110,7 +124,7 @@ public:
110 return _Filebuffer; 124 return _Filebuffer;
111 } 125 }
112 bool is_open() const; 126 bool is_open() const;
113 void open(const char* _Filename, /* Flawfinder: ignore */ 127 void open(const std::string& _Filename, /* Flawfinder: ignore */
114 ios_base::openmode _Mode = ios_base::in, 128 ios_base::openmode _Mode = ios_base::in,
115 int _Prot = (int)ios_base::_Openprot); 129 int _Prot = (int)ios_base::_Openprot);
116 void close(); 130 void close();
@@ -133,7 +147,7 @@ public:
133 { // construct unopened 147 { // construct unopened
134 } 148 }
135 149
136 explicit llofstream(const char *_Filename, 150 explicit llofstream(const std::string& _Filename,
137 std::ios_base::openmode _Mode = ios_base::out, 151 std::ios_base::openmode _Mode = ios_base::out,
138 int _Prot = (int)std::ios_base::_Openprot); 152 int _Prot = (int)std::ios_base::_Openprot);
139 153
@@ -154,7 +168,7 @@ public:
154 168
155 bool is_open() const; 169 bool is_open() const;
156 170
157 void open(const char *_Filename,ios_base::openmode _Mode = ios_base::out,int _Prot = (int)ios_base::_Openprot); /* Flawfinder: ignore */ 171 void open(const std::string& _Filename,ios_base::openmode _Mode = ios_base::out,int _Prot = (int)ios_base::_Openprot); /* Flawfinder: ignore */
158 172
159 void close(); 173 void close();
160 174
@@ -167,8 +181,45 @@ private:
167 181
168#else 182#else
169//Use standard file streams on non windows platforms 183//Use standard file streams on non windows platforms
170#define llifstream std::ifstream 184//#define llifstream std::ifstream
171#define llofstream std::ofstream 185//#define llofstream std::ofstream
186
187class llifstream : public std::ifstream
188{
189public:
190 llifstream() : std::ifstream()
191 {
192 }
193
194 explicit llifstream(const std::string& _Filename, std::_Ios_Openmode _Mode = in)
195 : std::ifstream(_Filename.c_str(), _Mode)
196 {
197 }
198 void open(const std::string& _Filename, std::_Ios_Openmode _Mode = in) /* Flawfinder: ignore */
199 {
200 std::ifstream::open(_Filename.c_str(), _Mode);
201 }
202};
203
204
205class llofstream : public std::ofstream
206{
207public:
208 llofstream() : std::ofstream()
209 {
210 }
211
212 explicit llofstream(const std::string& _Filename, std::_Ios_Openmode _Mode = out)
213 : std::ofstream(_Filename.c_str(), _Mode)
214 {
215 }
216
217 void open(const std::string& _Filename, std::_Ios_Openmode _Mode = out) /* Flawfinder: ignore */
218 {
219 std::ofstream::open(_Filename.c_str(), _Mode);
220 }
221
222};
172 223
173#endif 224#endif
174 225
diff --git a/linden/indra/llcommon/llfixedbuffer.cpp b/linden/indra/llcommon/llfixedbuffer.cpp
index 776de0d..a3ebae1 100644
--- a/linden/indra/llcommon/llfixedbuffer.cpp
+++ b/linden/indra/llcommon/llfixedbuffer.cpp
@@ -54,7 +54,7 @@ void LLFixedBuffer::clear()
54} 54}
55 55
56 56
57void LLFixedBuffer::addLine(const LLString& utf8line) 57void LLFixedBuffer::addLine(const std::string& utf8line)
58{ 58{
59 LLWString wstring = utf8str_to_wstring(utf8line); 59 LLWString wstring = utf8str_to_wstring(utf8line);
60 LLFixedBuffer::addLine(wstring); 60 LLFixedBuffer::addLine(wstring);
diff --git a/linden/indra/llcommon/llfixedbuffer.h b/linden/indra/llcommon/llfixedbuffer.h
index 06a7f45..1641bee 100644
--- a/linden/indra/llcommon/llfixedbuffer.h
+++ b/linden/indra/llcommon/llfixedbuffer.h
@@ -52,7 +52,7 @@ public:
52 std::deque<S32> mLineLengths; 52 std::deque<S32> mLineLengths;
53 53
54 void clear(); // Clear the buffer, and reset it. 54 void clear(); // Clear the buffer, and reset it.
55 virtual void addLine(const LLString& utf8line); 55 virtual void addLine(const std::string& utf8line);
56 virtual void addLine(const LLWString& line); 56 virtual void addLine(const LLWString& line);
57 57
58 // Get lines currently in the buffer, up to max_size chars, max_length lines 58 // Get lines currently in the buffer, up to max_size chars, max_length lines
diff --git a/linden/indra/llcommon/llframetimer.cpp b/linden/indra/llcommon/llframetimer.cpp
index 96e5014..e4e8a18 100644
--- a/linden/indra/llcommon/llframetimer.cpp
+++ b/linden/indra/llcommon/llframetimer.cpp
@@ -53,7 +53,6 @@ void LLFrameTimer::updateFrameTime()
53 sTotalTime = total_time; 53 sTotalTime = total_time;
54 sTotalSeconds = U64_to_F64(sTotalTime) * USEC_TO_SEC_F64; 54 sTotalSeconds = U64_to_F64(sTotalTime) * USEC_TO_SEC_F64;
55 sFrameTime = U64_to_F64(sTotalTime - sStartTotalTime) * USEC_TO_SEC_F64; 55 sFrameTime = U64_to_F64(sTotalTime - sStartTotalTime) * USEC_TO_SEC_F64;
56 sFrameCount++;
57} 56}
58 57
59void LLFrameTimer::start() 58void LLFrameTimer::start()
diff --git a/linden/indra/llcommon/llframetimer.h b/linden/indra/llcommon/llframetimer.h
index 11c4cfc..d13018f 100644
--- a/linden/indra/llcommon/llframetimer.h
+++ b/linden/indra/llcommon/llframetimer.h
@@ -67,10 +67,14 @@ public:
67 return sTotalSeconds; 67 return sTotalSeconds;
68 } 68 }
69 69
70 // Call this method once per frame to update the current frame time. 70 // Call this method once per frame to update the current frame time. This is actually called
71 // at some other times as well
71 static void updateFrameTime(); 72 static void updateFrameTime();
72 73
73 static S32 getFrameCount() { return sFrameCount; } 74 // Call this method once, and only once, per frame to update the current frame count.
75 static void updateFrameCount() { sFrameCount++; }
76
77 static U32 getFrameCount() { return sFrameCount; }
74 78
75 static F32 getFrameDeltaTimeF32(); 79 static F32 getFrameDeltaTimeF32();
76 80
diff --git a/linden/indra/llcommon/llhash.h b/linden/indra/llcommon/llhash.h
index 716d9df..e259a11 100644
--- a/linden/indra/llcommon/llhash.h
+++ b/linden/indra/llcommon/llhash.h
@@ -38,7 +38,9 @@
38#include <hash_map> 38#include <hash_map>
39#include <algorithm> 39#include <algorithm>
40#elif LL_DARWIN || LL_LINUX 40#elif LL_DARWIN || LL_LINUX
41# if GCC_VERSION >= 30400 // gcc 3.4 and up 41# if GCC_VERSION >= 40300 // gcc 4.3 and up
42# include <backward/hashtable.h>
43# elif GCC_VERSION >= 30400 // gcc 3.4 and up
42# include <ext/hashtable.h> 44# include <ext/hashtable.h>
43# elif __GNUC__ >= 3 45# elif __GNUC__ >= 3
44# include <ext/stl_hashtable.h> 46# include <ext/stl_hashtable.h>
diff --git a/linden/indra/llcommon/llheartbeat.cpp b/linden/indra/llcommon/llheartbeat.cpp
index 13bcd46..b67d3f2 100644
--- a/linden/indra/llcommon/llheartbeat.cpp
+++ b/linden/indra/llcommon/llheartbeat.cpp
@@ -72,8 +72,13 @@ LLHeartbeat::rawSend()
72 if (mSuppressed) 72 if (mSuppressed)
73 return 0; // Pretend we succeeded. 73 return 0; // Pretend we succeeded.
74 74
75 int result;
76#ifndef LL_DARWIN
75 union sigval dummy; 77 union sigval dummy;
76 int result = sigqueue(getppid(), LL_HEARTBEAT_SIGNAL, dummy); 78 result = sigqueue(getppid(), LL_HEARTBEAT_SIGNAL, dummy);
79#else
80 result = kill(getppid(), LL_HEARTBEAT_SIGNAL);
81#endif
77 if (result == 0) 82 if (result == 0)
78 return 0; // success 83 return 0; // success
79 84
diff --git a/linden/indra/llcommon/llindraconfigfile.cpp b/linden/indra/llcommon/llindraconfigfile.cpp
index 7ef1a9b..60b498d 100644
--- a/linden/indra/llcommon/llindraconfigfile.cpp
+++ b/linden/indra/llcommon/llindraconfigfile.cpp
@@ -81,7 +81,7 @@ void LLIndraConfigFile::loadFile()
81 LLSD config; 81 LLSD config;
82 82
83 { 83 {
84 llifstream file(filename().c_str()); 84 llifstream file(filename());
85 if (file.is_open()) 85 if (file.is_open())
86 { 86 {
87 LLSDSerialize::fromXML(config, file); 87 LLSDSerialize::fromXML(config, file);
diff --git a/linden/indra/llcommon/llkeythrottle.h b/linden/indra/llcommon/llkeythrottle.h
index 8314269..eb1519a 100644
--- a/linden/indra/llcommon/llkeythrottle.h
+++ b/linden/indra/llcommon/llkeythrottle.h
@@ -55,33 +55,40 @@ class LLKeyThrottleImpl
55protected: 55protected:
56 struct Entry { 56 struct Entry {
57 U32 count; 57 U32 count;
58 BOOL blocked; 58 bool blocked;
59 59
60 Entry() : count(0), blocked(FALSE) { } 60 Entry() : count(0), blocked(false) { }
61 }; 61 };
62 62
63 typedef std::map<T, Entry> EntryMap; 63 typedef std::map<T, Entry> EntryMap;
64 64
65 EntryMap * prevMap; 65 EntryMap* prevMap;
66 EntryMap * currMap; 66 EntryMap* currMap;
67 67
68 U32 countLimit; 68 U32 countLimit;
69 // maximum number of keys allowed per interval 69 // maximum number of keys allowed per interval
70 70
71 U64 interval_usec; 71 U64 intervalLength; // each map covers this time period (usec or frame number)
72 // each map covers this time period 72 U64 startTime; // start of the time period (usec or frame number)
73 U64 start_usec;
74 // currMap started counting at this time 73 // currMap started counting at this time
75 // prevMap covers the previous interval 74 // prevMap covers the previous interval
76 75
77 LLKeyThrottleImpl() : prevMap(0), currMap(0), 76 LLKeyThrottleImpl() :
78 countLimit(0), interval_usec(0), 77 prevMap(NULL),
79 start_usec(0) { }; 78 currMap(NULL),
79 countLimit(0),
80 intervalLength(1),
81 startTime(0)
82 {}
80 83
81 static U64 getTime() 84 static U64 getTime()
82 { 85 {
83 return LLFrameTimer::getTotalTime(); 86 return LLFrameTimer::getTotalTime();
84 } 87 }
88 static U64 getFrame() // Return the current frame number
89 {
90 return (U64) LLFrameTimer::getFrameCount();
91 }
85}; 92};
86 93
87 94
@@ -89,17 +96,12 @@ template< class T >
89class LLKeyThrottle 96class LLKeyThrottle
90{ 97{
91public: 98public:
92 LLKeyThrottle(U32 limit, F32 interval) 99 // @param realtime = FALSE for frame-based throttle, TRUE for usec
100 // real-time throttle
101 LLKeyThrottle(U32 limit, F32 interval, BOOL realtime = TRUE)
93 : m(* new LLKeyThrottleImpl<T>) 102 : m(* new LLKeyThrottleImpl<T>)
94 { 103 {
95 // limit is the maximum number of keys 104 setParameters( limit, interval, realtime );
96 // allowed per interval (in seconds)
97 m.countLimit = limit;
98 m.interval_usec = (U64)(interval * USEC_PER_SEC);
99 m.start_usec = LLKeyThrottleImpl<T>::getTime();
100
101 m.prevMap = new typename LLKeyThrottleImpl<T>::EntryMap;
102 m.currMap = new typename LLKeyThrottleImpl<T>::EntryMap;
103 } 105 }
104 106
105 ~LLKeyThrottle() 107 ~LLKeyThrottle()
@@ -118,18 +120,26 @@ public:
118 // call each time the key wants use 120 // call each time the key wants use
119 State noteAction(const T& id, S32 weight = 1) 121 State noteAction(const T& id, S32 weight = 1)
120 { 122 {
121 U64 now = LLKeyThrottleImpl<T>::getTime(); 123 U64 now = 0;
124 if ( mIsRealtime )
125 {
126 now = LLKeyThrottleImpl<T>::getTime();
127 }
128 else
129 {
130 now = LLKeyThrottleImpl<T>::getFrame();
131 }
122 132
123 if (now >= (m.start_usec + m.interval_usec)) 133 if (now >= (m.startTime + m.intervalLength))
124 { 134 {
125 if (now < (m.start_usec + 2 * m.interval_usec)) 135 if (now < (m.startTime + 2 * m.intervalLength))
126 { 136 {
127 // prune old data 137 // prune old data
128 delete m.prevMap; 138 delete m.prevMap;
129 m.prevMap = m.currMap; 139 m.prevMap = m.currMap;
130 m.currMap = new typename LLKeyThrottleImpl<T>::EntryMap; 140 m.currMap = new typename LLKeyThrottleImpl<T>::EntryMap;
131 141
132 m.start_usec += m.interval_usec; 142 m.startTime += m.intervalLength;
133 } 143 }
134 else 144 else
135 { 145 {
@@ -139,12 +149,12 @@ public:
139 m.prevMap = new typename LLKeyThrottleImpl<T>::EntryMap; 149 m.prevMap = new typename LLKeyThrottleImpl<T>::EntryMap;
140 m.currMap = new typename LLKeyThrottleImpl<T>::EntryMap; 150 m.currMap = new typename LLKeyThrottleImpl<T>::EntryMap;
141 151
142 m.start_usec = now; 152 m.startTime = now;
143 } 153 }
144 } 154 }
145 155
146 U32 prevCount = 0; 156 U32 prevCount = 0;
147 BOOL prevBlocked = FALSE; 157 bool prevBlocked = false;
148 158
149 typename LLKeyThrottleImpl<T>::EntryMap::const_iterator prev = m.prevMap->find(id); 159 typename LLKeyThrottleImpl<T>::EntryMap::const_iterator prev = m.prevMap->find(id);
150 if (prev != m.prevMap->end()) 160 if (prev != m.prevMap->end())
@@ -166,7 +176,7 @@ public:
166 // (now) time. 176 // (now) time.
167 177
168 // compute current, windowed rate 178 // compute current, windowed rate
169 F64 timeInCurrent = ((F64)(now - m.start_usec) / m.interval_usec); 179 F64 timeInCurrent = ((F64)(now - m.startTime) / m.intervalLength);
170 F64 averageCount = curr.count + prevCount * (1.0 - timeInCurrent); 180 F64 averageCount = curr.count + prevCount * (1.0 - timeInCurrent);
171 181
172 curr.blocked |= averageCount > m.countLimit; 182 curr.blocked |= averageCount > m.countLimit;
@@ -193,17 +203,17 @@ public:
193 noteAction(id); 203 noteAction(id);
194 typename LLKeyThrottleImpl<T>::Entry& curr = (*m.currMap)[id]; 204 typename LLKeyThrottleImpl<T>::Entry& curr = (*m.currMap)[id];
195 curr.count = llmax(m.countLimit, curr.count); 205 curr.count = llmax(m.countLimit, curr.count);
196 curr.blocked = TRUE; 206 curr.blocked = true;
197 } 207 }
198 208
199 // returns TRUE if key is blocked 209 // returns true if key is blocked
200 BOOL isThrottled(const T& id) const 210 bool isThrottled(const T& id) const
201 { 211 {
202 if (m.currMap->empty() 212 if (m.currMap->empty()
203 && m.prevMap->empty()) 213 && m.prevMap->empty())
204 { 214 {
205 // most of the time we'll fall in here 215 // most of the time we'll fall in here
206 return FALSE; 216 return false;
207 } 217 }
208 218
209 // NOTE, we ignore the case where id is in the map but the map is stale. 219 // NOTE, we ignore the case where id is in the map but the map is stale.
@@ -221,11 +231,49 @@ public:
221 { 231 {
222 return entry->second.blocked; 232 return entry->second.blocked;
223 } 233 }
224 return FALSE; 234 return false;
235 }
236
237 // Get the throttling parameters
238 void getParameters( U32 & out_limit, F32 & out_interval, BOOL & out_realtime )
239 {
240 out_limit = m.countLimit;
241 out_interval = m.intervalLength;
242 out_realtime = mIsRealtime;
243 }
244
245 // Set the throttling behavior
246 void setParameters( U32 limit, F32 interval, BOOL realtime )
247 {
248 // limit is the maximum number of keys
249 // allowed per interval (in seconds or frames)
250 mIsRealtime = realtime;
251 m.countLimit = limit;
252 if ( mIsRealtime )
253 {
254 m.intervalLength = (U64)(interval * USEC_PER_SEC);
255 m.startTime = LLKeyThrottleImpl<T>::getTime();
256 }
257 else
258 {
259 m.intervalLength = (U64)interval;
260 m.startTime = LLKeyThrottleImpl<T>::getFrame();
261 }
262
263 if ( m.intervalLength == 0 )
264 { // Don't allow zero intervals
265 m.intervalLength = 1;
266 }
267
268 delete m.prevMap;
269 m.prevMap = new typename LLKeyThrottleImpl<T>::EntryMap;
270 delete m.currMap;
271 m.currMap = new typename LLKeyThrottleImpl<T>::EntryMap;
225 } 272 }
226 273
227protected: 274protected:
228 LLKeyThrottleImpl<T>& m; 275 LLKeyThrottleImpl<T>& m;
276 BOOL mIsRealtime; // TRUE to be time based (default), FALSE for frame based
229}; 277};
230 278
231#endif 279#endif
diff --git a/linden/indra/llcommon/llliveappconfig.cpp b/linden/indra/llcommon/llliveappconfig.cpp
index ad11987..a11f5b0 100644
--- a/linden/indra/llcommon/llliveappconfig.cpp
+++ b/linden/indra/llcommon/llliveappconfig.cpp
@@ -51,7 +51,7 @@ void LLLiveAppConfig::loadFile()
51{ 51{
52 llinfos << "LLLiveAppConfig::loadFile(): reading from " 52 llinfos << "LLLiveAppConfig::loadFile(): reading from "
53 << filename() << llendl; 53 << filename() << llendl;
54 llifstream file(filename().c_str()); 54 llifstream file(filename());
55 LLSD config; 55 LLSD config;
56 if (file.is_open()) 56 if (file.is_open())
57 { 57 {
diff --git a/linden/indra/llcommon/lllivefile.cpp b/linden/indra/llcommon/lllivefile.cpp
index 6e027ef..8ac6bb4 100644
--- a/linden/indra/llcommon/lllivefile.cpp
+++ b/linden/indra/llcommon/lllivefile.cpp
@@ -93,7 +93,7 @@ bool LLLiveFile::Impl::check()
93 93
94 // Stat the file to see if it exists and when it was last modified. 94 // Stat the file to see if it exists and when it was last modified.
95 llstat stat_data; 95 llstat stat_data;
96 int res = LLFile::stat(mFilename.c_str(), &stat_data); 96 int res = LLFile::stat(mFilename, &stat_data);
97 97
98 if (res) 98 if (res)
99 { 99 {
diff --git a/linden/indra/llcommon/lllslconstants.h b/linden/indra/llcommon/lllslconstants.h
index 508fb42..24120a2 100644
--- a/linden/indra/llcommon/lllslconstants.h
+++ b/linden/indra/llcommon/lllslconstants.h
@@ -126,6 +126,9 @@ const S32 LSL_PRIM_SCULPT_TYPE_SPHERE = 1;
126const S32 LSL_PRIM_SCULPT_TYPE_TORUS = 2; 126const S32 LSL_PRIM_SCULPT_TYPE_TORUS = 2;
127const S32 LSL_PRIM_SCULPT_TYPE_PLANE = 3; 127const S32 LSL_PRIM_SCULPT_TYPE_PLANE = 3;
128const S32 LSL_PRIM_SCULPT_TYPE_CYLINDER = 4; 128const S32 LSL_PRIM_SCULPT_TYPE_CYLINDER = 4;
129const S32 LSL_PRIM_SCULPT_TYPE_MASK = 7;
130const S32 LSL_PRIM_SCULPT_FLAG_INVERT = 64;
131const S32 LSL_PRIM_SCULPT_FLAG_MIRROR = 128;
129 132
130const S32 LSL_ALL_SIDES = -1; 133const S32 LSL_ALL_SIDES = -1;
131const S32 LSL_LINK_ROOT = 1; 134const S32 LSL_LINK_ROOT = 1;
@@ -181,4 +184,7 @@ const S32 OBJECT_OWNER = 6;
181const S32 OBJECT_GROUP = 7; 184const S32 OBJECT_GROUP = 7;
182const S32 OBJECT_CREATOR = 8; 185const S32 OBJECT_CREATOR = 8;
183 186
187// llTextBox() magic token string - yes this is a hack. sue me.
188const std::string TEXTBOX_MAGIC_TOKEN = "!!llTextBox!!";
189
184#endif 190#endif
diff --git a/linden/indra/llmath/llmd5.cpp b/linden/indra/llcommon/llmd5.cpp
index ea69002..a0ac92f 100644
--- a/linden/indra/llmath/llmd5.cpp
+++ b/linden/indra/llcommon/llmd5.cpp
@@ -157,7 +157,7 @@ void LLMD5::update (const uint1 *input, const uint4 input_length) {
157// MD5 update for files. 157// MD5 update for files.
158// Like above, except that it works on files (and uses above as a primitive.) 158// Like above, except that it works on files (and uses above as a primitive.)
159 159
160void LLMD5::update(LLFILE* file){ 160void LLMD5::update(FILE* file){
161 161
162 unsigned char buffer[BLOCK_LEN]; /* Flawfinder: ignore */ 162 unsigned char buffer[BLOCK_LEN]; /* Flawfinder: ignore */
163 int len; 163 int len;
@@ -237,7 +237,7 @@ void LLMD5::finalize (){
237 237
238 238
239 239
240LLMD5::LLMD5(LLFILE *file){ 240LLMD5::LLMD5(FILE *file){
241 241
242 init(); // must be called be all constructors 242 init(); // must be called be all constructors
243 update(file); 243 update(file);
diff --git a/linden/indra/llmath/llmd5.h b/linden/indra/llcommon/llmd5.h
index 9ba0a9f..6d21b31 100644
--- a/linden/indra/llmath/llmd5.h
+++ b/linden/indra/llcommon/llmd5.h
@@ -93,14 +93,14 @@ public:
93 LLMD5 (); // simple initializer 93 LLMD5 (); // simple initializer
94 void update (const uint1 *input, const uint4 input_length); 94 void update (const uint1 *input, const uint4 input_length);
95 void update (std::istream& stream); 95 void update (std::istream& stream);
96 void update (LLFILE *file); 96 void update (FILE *file);
97 void finalize (); 97 void finalize ();
98 98
99// constructors for special circumstances. All these constructors finalize 99// constructors for special circumstances. All these constructors finalize
100// the MD5 context. 100// the MD5 context.
101 LLMD5 (const unsigned char *string); // digest string, finalize 101 LLMD5 (const unsigned char *string); // digest string, finalize
102 LLMD5 (std::istream& stream); // digest stream, finalize 102 LLMD5 (std::istream& stream); // digest stream, finalize
103 LLMD5 (LLFILE *file); // digest file, close, finalize 103 LLMD5 (FILE *file); // digest file, close, finalize
104 LLMD5 (const unsigned char *string, const unsigned int number); 104 LLMD5 (const unsigned char *string, const unsigned int number);
105 105
106// methods to acquire finalized result 106// methods to acquire finalized result
diff --git a/linden/indra/llcommon/llmemory.cpp b/linden/indra/llcommon/llmemory.cpp
index 9b6f893..3fec50f 100644
--- a/linden/indra/llcommon/llmemory.cpp
+++ b/linden/indra/llcommon/llmemory.cpp
@@ -335,7 +335,6 @@ U64 getCurrentRSS()
335U64 getCurrentRSS() 335U64 getCurrentRSS()
336{ 336{
337 U64 residentSize = 0; 337 U64 residentSize = 0;
338
339 task_basic_info_data_t basicInfo; 338 task_basic_info_data_t basicInfo;
340 mach_msg_type_number_t basicInfoCount = TASK_BASIC_INFO_COUNT; 339 mach_msg_type_number_t basicInfoCount = TASK_BASIC_INFO_COUNT;
341 if (task_info(mach_task_self(), TASK_BASIC_INFO, (task_info_t)&basicInfo, &basicInfoCount) == KERN_SUCCESS) 340 if (task_info(mach_task_self(), TASK_BASIC_INFO, (task_info_t)&basicInfo, &basicInfoCount) == KERN_SUCCESS)
diff --git a/linden/indra/llcommon/llmemtype.h b/linden/indra/llcommon/llmemtype.h
index 4a4702b..bd80930 100644
--- a/linden/indra/llcommon/llmemtype.h
+++ b/linden/indra/llcommon/llmemtype.h
@@ -80,6 +80,7 @@ public:
80 MTYPE_SPACE_PARTITION, 80 MTYPE_SPACE_PARTITION,
81 MTYPE_PIPELINE, 81 MTYPE_PIPELINE,
82 MTYPE_AVATAR, 82 MTYPE_AVATAR,
83 MTYPE_AVATAR_MESH,
83 MTYPE_PARTICLES, 84 MTYPE_PARTICLES,
84 MTYPE_REGIONS, 85 MTYPE_REGIONS,
85 MTYPE_INVENTORY, 86 MTYPE_INVENTORY,
diff --git a/linden/indra/llcommon/llpreprocessor.h b/linden/indra/llcommon/llpreprocessor.h
index e99b103..4809a2f 100644
--- a/linden/indra/llcommon/llpreprocessor.h
+++ b/linden/indra/llcommon/llpreprocessor.h
@@ -64,6 +64,9 @@
64 #ifndef LL_MSVC 64 #ifndef LL_MSVC
65 #define LL_MSVC 1 65 #define LL_MSVC 1
66 #endif 66 #endif
67 #if _MSC_VER < 1400
68 #define LL_MSVC7 //Visual C++ 2003 or earlier
69 #endif
67#endif 70#endif
68 71
69// Deal with minor differences on Unixy OSes. 72// Deal with minor differences on Unixy OSes.
@@ -104,9 +107,7 @@ using snprintf_hack::snprintf;
104#if defined(LL_WINDOWS) 107#if defined(LL_WINDOWS)
105#define BOOST_REGEX_NO_LIB 1 108#define BOOST_REGEX_NO_LIB 1
106#define CURL_STATICLIB 1 109#define CURL_STATICLIB 1
107 110#define XML_STATIC
108//#define LL_LCD_COMPILE 0
109
110#endif // LL_WINDOWS 111#endif // LL_WINDOWS
111 112
112 113
diff --git a/linden/indra/llcommon/llprocessor.cpp b/linden/indra/llcommon/llprocessor.cpp
index 1c0f7e0..f132b86 100644
--- a/linden/indra/llcommon/llprocessor.cpp
+++ b/linden/indra/llcommon/llprocessor.cpp
@@ -2216,12 +2216,12 @@ bool CProcessor::CPUInfoToText(char *strBuffer, unsigned int uiMaxLen)
2216 return true; 2216 return true;
2217} 2217}
2218 2218
2219// bool CProcessor::WriteInfoTextFile(const char *strFilename) 2219// bool CProcessor::WriteInfoTextFile(const std::string& strFilename)
2220// =========================================================== 2220// ===========================================================
2221// Takes use of CProcessor::CPUInfoToText and saves the string to a 2221// Takes use of CProcessor::CPUInfoToText and saves the string to a
2222// file 2222// file
2223/////////////////////////////////////////////////////////////////// 2223///////////////////////////////////////////////////////////////////
2224bool CProcessor::WriteInfoTextFile(const char *strFilename) 2224bool CProcessor::WriteInfoTextFile(const std::string& strFilename)
2225{ 2225{
2226 char buf[16384]; /* Flawfinder: ignore */ 2226 char buf[16384]; /* Flawfinder: ignore */
2227 2227
diff --git a/linden/indra/llcommon/llprocessor.h b/linden/indra/llcommon/llprocessor.h
index a188b1a..6abbd96 100644
--- a/linden/indra/llcommon/llprocessor.h
+++ b/linden/indra/llcommon/llprocessor.h
@@ -188,7 +188,7 @@ public:
188 F64 GetCPUFrequency(unsigned int uiMeasureMSecs); 188 F64 GetCPUFrequency(unsigned int uiMeasureMSecs);
189 const ProcessorInfo *GetCPUInfo(); 189 const ProcessorInfo *GetCPUInfo();
190 bool CPUInfoToText(char *strBuffer, unsigned int uiMaxLen); 190 bool CPUInfoToText(char *strBuffer, unsigned int uiMaxLen);
191 bool WriteInfoTextFile(const char *strFilename); 191 bool WriteInfoTextFile(const std::string& strFilename);
192}; 192};
193 193
194 194
diff --git a/linden/indra/llcommon/llptrskiplist.h b/linden/indra/llcommon/llptrskiplist.h
index f1df27a..ebd297d 100644
--- a/linden/indra/llcommon/llptrskiplist.h
+++ b/linden/indra/llcommon/llptrskiplist.h
@@ -33,6 +33,7 @@
33#define LL_LLPTRSKIPLIST_H 33#define LL_LLPTRSKIPLIST_H
34 34
35#include "llerror.h" 35#include "llerror.h"
36#include "llrand.h"
36//#include "vmath.h" 37//#include "vmath.h"
37#include "llrand.h" 38#include "llrand.h"
38 39
diff --git a/linden/indra/llmath/llrand.cpp b/linden/indra/llcommon/llrand.cpp
index bc8c867..bc8c867 100644
--- a/linden/indra/llmath/llrand.cpp
+++ b/linden/indra/llcommon/llrand.cpp
diff --git a/linden/indra/llmath/llrand.h b/linden/indra/llcommon/llrand.h
index 0a28213..0a28213 100644
--- a/linden/indra/llmath/llrand.h
+++ b/linden/indra/llcommon/llrand.h
diff --git a/linden/indra/llcommon/llsd.cpp b/linden/indra/llcommon/llsd.cpp
index fa0531b..2c32184 100644
--- a/linden/indra/llcommon/llsd.cpp
+++ b/linden/indra/llcommon/llsd.cpp
@@ -42,10 +42,11 @@
42#endif 42#endif
43 43
44#ifdef NAME_UNNAMED_NAMESPACE 44#ifdef NAME_UNNAMED_NAMESPACE
45namespace LLSDUnnamedNamespace { 45namespace LLSDUnnamedNamespace
46#else 46#else
47namespace { 47namespace
48#endif 48#endif
49{
49 class ImplMap; 50 class ImplMap;
50 class ImplArray; 51 class ImplArray;
51} 52}
@@ -127,10 +128,10 @@ public:
127 virtual void erase(Integer) { } 128 virtual void erase(Integer) { }
128 virtual const LLSD& ref(Integer) const { return undef(); } 129 virtual const LLSD& ref(Integer) const { return undef(); }
129 130
130 virtual LLSD::map_const_iterator beginMap() const { return LLSD::map_const_iterator(); } 131 virtual LLSD::map_const_iterator beginMap() const { return endMap(); }
131 virtual LLSD::map_const_iterator endMap() const { return LLSD::map_const_iterator(); } 132 virtual LLSD::map_const_iterator endMap() const { static const std::map<String, LLSD> empty; return empty.end(); }
132 virtual LLSD::array_const_iterator beginArray() const { return LLSD::array_const_iterator(); } 133 virtual LLSD::array_const_iterator beginArray() const { return endArray(); }
133 virtual LLSD::array_const_iterator endArray() const { return LLSD::array_const_iterator(); } 134 virtual LLSD::array_const_iterator endArray() const { static const std::vector<LLSD> empty; return empty.end(); }
134 135
135 static const LLSD& undef(); 136 static const LLSD& undef();
136 137
@@ -139,10 +140,11 @@ public:
139}; 140};
140 141
141#ifdef NAME_UNNAMED_NAMESPACE 142#ifdef NAME_UNNAMED_NAMESPACE
142namespace LLSDUnnamedNamespace { 143namespace LLSDUnnamedNamespace
143#else 144#else
144namespace { 145namespace
145#endif 146#endif
147{
146 template<LLSD::Type T, class Data, class DataRef = Data> 148 template<LLSD::Type T, class Data, class DataRef = Data>
147 class ImplBase : public LLSD::Impl 149 class ImplBase : public LLSD::Impl
148 ///< This class handles most of the work for a subclass of Impl 150 ///< This class handles most of the work for a subclass of Impl
@@ -185,6 +187,11 @@ namespace {
185 }; 187 };
186 188
187 LLSD::String ImplBoolean::asString() const 189 LLSD::String ImplBoolean::asString() const
190 // *NOTE: The reason that false is not converted to "false" is
191 // because that would break roundtripping,
192 // e.g. LLSD(false).asString().asBoolean(). There are many
193 // reasons for wanting LLSD("false").asBoolean() == true, such
194 // as "everything else seems to work that way".
188 { return mValue ? "true" : ""; } 195 { return mValue ? "true" : ""; }
189 196
190 197
@@ -650,10 +657,11 @@ U32 LLSD::Impl::sOutstandingCount = 0;
650 657
651 658
652#ifdef NAME_UNNAMED_NAMESPACE 659#ifdef NAME_UNNAMED_NAMESPACE
653namespace LLSDUnnamedNamespace { 660namespace LLSDUnnamedNamespace
654#else 661#else
655namespace { 662namespace
656#endif 663#endif
664{
657 inline LLSD::Impl& safe(LLSD::Impl* impl) 665 inline LLSD::Impl& safe(LLSD::Impl* impl)
658 { return LLSD::Impl::safe(impl); } 666 { return LLSD::Impl::safe(impl); }
659 667
diff --git a/linden/indra/llcommon/llsd.h b/linden/indra/llcommon/llsd.h
index 3f53735..98a6692 100644
--- a/linden/indra/llcommon/llsd.h
+++ b/linden/indra/llcommon/llsd.h
@@ -40,7 +40,7 @@
40 40
41#include "lldate.h" 41#include "lldate.h"
42#include "lluri.h" 42#include "lluri.h"
43#include "../llmath/lluuid.h" 43#include "lluuid.h"
44 44
45/** 45/**
46 LLSD provides a flexible data system similar to the data facilities of 46 LLSD provides a flexible data system similar to the data facilities of
@@ -394,7 +394,7 @@ std::ostream& operator<<(std::ostream& s, const LLSD& llsd);
394 - as UTF8 encoded strings (making not like UUID<->String) 394 - as UTF8 encoded strings (making not like UUID<->String)
395 - as Base64 or Base96 encoded (making like UUID<->String) 395 - as Base64 or Base96 encoded (making like UUID<->String)
396 - Conversions to std::string and LLUUID do not result in easy assignment 396 - Conversions to std::string and LLUUID do not result in easy assignment
397 to std::string, LLString or LLUUID due to non-unique conversion paths 397 to std::string, std::string or LLUUID due to non-unique conversion paths
398*/ 398*/
399 399
400#endif // LL_LLSD_NEW_H 400#endif // LL_LLSD_NEW_H
diff --git a/linden/indra/llcommon/llsdserialize.cpp b/linden/indra/llcommon/llsdserialize.cpp
index a556d5d..d42842d 100644
--- a/linden/indra/llcommon/llsdserialize.cpp
+++ b/linden/indra/llcommon/llsdserialize.cpp
@@ -37,7 +37,7 @@
37#include "llstreamtools.h" // for fullread 37#include "llstreamtools.h" // for fullread
38 38
39#include <iostream> 39#include <iostream>
40#include "apr-1/apr_base64.h" 40#include "apr_base64.h"
41 41
42#if !LL_WINDOWS 42#if !LL_WINDOWS
43#include <netinet/in.h> // htonl & ntohl 43#include <netinet/in.h> // htonl & ntohl
@@ -146,12 +146,15 @@ bool LLSDSerialize::deserialize(LLSD& sd, std::istream& str, S32 max_bytes)
146 * Create the parser as appropriate 146 * Create the parser as appropriate
147 */ 147 */
148 if (legacy_no_header) 148 if (legacy_no_header)
149 { 149 { // Create a LLSD XML parser, and parse the first chunk read above
150 LLSDXMLParser* x = new LLSDXMLParser; 150 LLSDXMLParser* x = new LLSDXMLParser();
151 x->parsePart(hdr_buf, inbuf); 151 x->parsePart(hdr_buf, inbuf); // Parse the first part that was already read
152 p = x; 152 x->parseLines(str, sd); // Parse the rest of it
153 delete x;
154 return true;
153 } 155 }
154 else if (header == LLSD_BINARY_HEADER) 156
157 if (header == LLSD_BINARY_HEADER)
155 { 158 {
156 p = new LLSDBinaryParser; 159 p = new LLSDBinaryParser;
157 } 160 }
@@ -300,7 +303,8 @@ static const char BINARY_FALSE_SERIAL = '0';
300/** 303/**
301 * LLSDParser 304 * LLSDParser
302 */ 305 */
303LLSDParser::LLSDParser() : mCheckLimits(true), mMaxBytesLeft(0) 306LLSDParser::LLSDParser()
307 : mCheckLimits(true), mMaxBytesLeft(0), mParseLines(false)
304{ 308{
305} 309}
306 310
@@ -316,6 +320,15 @@ S32 LLSDParser::parse(std::istream& istr, LLSD& data, S32 max_bytes)
316} 320}
317 321
318 322
323// Parse using routine to get() lines, faster than parse()
324S32 LLSDParser::parseLines(std::istream& istr, LLSD& data)
325{
326 mCheckLimits = false;
327 mParseLines = false; // was true, Emergency fix DEV-17785 parsing newline failure
328 return doParse(istr, data);
329}
330
331
319int LLSDParser::get(std::istream& istr) const 332int LLSDParser::get(std::istream& istr) const
320{ 333{
321 if(mCheckLimits) --mMaxBytesLeft; 334 if(mCheckLimits) --mMaxBytesLeft;
@@ -1217,8 +1230,7 @@ void LLSDFormatter::realFormat(const std::string& format)
1217 1230
1218void LLSDFormatter::formatReal(LLSD::Real real, std::ostream& ostr) const 1231void LLSDFormatter::formatReal(LLSD::Real real, std::ostream& ostr) const
1219{ 1232{
1220 char buffer[MAX_STRING]; /* Flawfinder: ignore */ 1233 std::string buffer = llformat(mRealFormat.c_str(), real);
1221 snprintf(buffer, MAX_STRING, mRealFormat.c_str(), real); /* Flawfinder: ignore */
1222 ostr << buffer; 1234 ostr << buffer;
1223} 1235}
1224 1236
diff --git a/linden/indra/llcommon/llsdserialize.h b/linden/indra/llcommon/llsdserialize.h
index f5282b4..94ad824 100644
--- a/linden/indra/llcommon/llsdserialize.h
+++ b/linden/indra/llcommon/llsdserialize.h
@@ -83,6 +83,18 @@ public:
83 */ 83 */
84 S32 parse(std::istream& istr, LLSD& data, S32 max_bytes); 84 S32 parse(std::istream& istr, LLSD& data, S32 max_bytes);
85 85
86 /** Like parse(), but uses a different call (istream.getline()) to read by lines
87 * This API is better suited for XML, where the parse cannot tell
88 * where the document actually ends.
89 */
90 S32 parseLines(std::istream& istr, LLSD& data);
91
92 /**
93 * @brief Resets the parser so parse() or parseLines() can be called again for another <llsd> chunk.
94 */
95 void reset() { doReset(); };
96
97
86protected: 98protected:
87 /** 99 /**
88 * @brief Pure virtual base for doing the parse. 100 * @brief Pure virtual base for doing the parse.
@@ -100,6 +112,11 @@ protected:
100 */ 112 */
101 virtual S32 doParse(std::istream& istr, LLSD& data) const = 0; 113 virtual S32 doParse(std::istream& istr, LLSD& data) const = 0;
102 114
115 /**
116 * @brief Virtual default function for resetting the parser
117 */
118 virtual void doReset() {};
119
103 /* @name Simple istream helper methods 120 /* @name Simple istream helper methods
104 * 121 *
105 * These helper methods exist to help correctly use the 122 * These helper methods exist to help correctly use the
@@ -191,6 +208,11 @@ protected:
191 * @brief The maximum number of bytes left to be parsed. 208 * @brief The maximum number of bytes left to be parsed.
192 */ 209 */
193 mutable S32 mMaxBytesLeft; 210 mutable S32 mMaxBytesLeft;
211
212 /**
213 * @brief Use line-based reading to get text
214 */
215 bool mParseLines;
194}; 216};
195 217
196/** 218/**
@@ -301,6 +323,11 @@ protected:
301 */ 323 */
302 virtual S32 doParse(std::istream& istr, LLSD& data) const; 324 virtual S32 doParse(std::istream& istr, LLSD& data) const;
303 325
326 /**
327 * @brief Virtual default function for resetting the parser
328 */
329 virtual void doReset();
330
304private: 331private:
305 class Impl; 332 class Impl;
306 Impl& impl; 333 Impl& impl;
@@ -674,7 +701,7 @@ public:
674 U32 options = LLSDFormatter::OPTIONS_NONE); 701 U32 options = LLSDFormatter::OPTIONS_NONE);
675 702
676 /** 703 /**
677 * @breif Examine a stream, and parse 1 sd object out based on contents. 704 * @brief Examine a stream, and parse 1 sd object out based on contents.
678 * 705 *
679 * @param sd [out] The data found on the stream 706 * @param sd [out] The data found on the stream
680 * @param str The incoming stream 707 * @param str The incoming stream
@@ -718,13 +745,23 @@ public:
718 return f->format(sd, str, LLSDFormatter::OPTIONS_PRETTY); 745 return f->format(sd, str, LLSDFormatter::OPTIONS_PRETTY);
719 } 746 }
720 747
721 static S32 fromXML(LLSD& sd, std::istream& str) 748 static S32 fromXMLEmbedded(LLSD& sd, std::istream& str)
722 { 749 {
723 // no need for max_bytes since xml formatting is not 750 // no need for max_bytes since xml formatting is not
724 // subvertable by bad sizes. 751 // subvertable by bad sizes.
725 LLPointer<LLSDXMLParser> p = new LLSDXMLParser; 752 LLPointer<LLSDXMLParser> p = new LLSDXMLParser;
726 return p->parse(str, sd, LLSDSerialize::SIZE_UNLIMITED); 753 return p->parse(str, sd, LLSDSerialize::SIZE_UNLIMITED);
727 } 754 }
755 static S32 fromXMLDocument(LLSD& sd, std::istream& str)
756 {
757 LLPointer<LLSDXMLParser> p = new LLSDXMLParser();
758 return p->parseLines(str, sd);
759 }
760 static S32 fromXML(LLSD& sd, std::istream& str)
761 {
762 return fromXMLEmbedded(sd, str);
763// return fromXMLDocument(sd, str);
764 }
728 765
729 /* 766 /*
730 * Binary Methods 767 * Binary Methods
diff --git a/linden/indra/llcommon/llsdserialize_xml.cpp b/linden/indra/llcommon/llsdserialize_xml.cpp
index 7de0c35..690ab67 100644
--- a/linden/indra/llcommon/llsdserialize_xml.cpp
+++ b/linden/indra/llcommon/llsdserialize_xml.cpp
@@ -35,7 +35,7 @@
35#include <iostream> 35#include <iostream>
36#include <deque> 36#include <deque>
37 37
38#include "apr-1/apr_base64.h" 38#include "apr_base64.h"
39 39
40extern "C" 40extern "C"
41{ 41{
@@ -63,7 +63,7 @@ S32 LLSDXMLFormatter::format(const LLSD& data, std::ostream& ostr, U32 options)
63{ 63{
64 std::streamsize old_precision = ostr.precision(25); 64 std::streamsize old_precision = ostr.precision(25);
65 65
66 LLString post = ""; 66 std::string post;
67 if (options & LLSDFormatter::OPTIONS_PRETTY) 67 if (options & LLSDFormatter::OPTIONS_PRETTY)
68 { 68 {
69 post = "\n"; 69 post = "\n";
@@ -79,8 +79,8 @@ S32 LLSDXMLFormatter::format(const LLSD& data, std::ostream& ostr, U32 options)
79S32 LLSDXMLFormatter::format_impl(const LLSD& data, std::ostream& ostr, U32 options, U32 level) const 79S32 LLSDXMLFormatter::format_impl(const LLSD& data, std::ostream& ostr, U32 options, U32 level) const
80{ 80{
81 S32 format_count = 1; 81 S32 format_count = 1;
82 LLString pre = ""; 82 std::string pre;
83 LLString post = ""; 83 std::string post;
84 84
85 if (options & LLSDFormatter::OPTIONS_PRETTY) 85 if (options & LLSDFormatter::OPTIONS_PRETTY)
86 { 86 {
@@ -262,12 +262,13 @@ public:
262 ~Impl(); 262 ~Impl();
263 263
264 S32 parse(std::istream& input, LLSD& data); 264 S32 parse(std::istream& input, LLSD& data);
265 S32 parseLines(std::istream& input, LLSD& data);
265 266
266 void parsePart(const char *buf, int len); 267 void parsePart(const char *buf, int len);
267 268
268private:
269 void reset(); 269 void reset();
270 270
271private:
271 void startElementHandler(const XML_Char* name, const XML_Char** attributes); 272 void startElementHandler(const XML_Char* name, const XML_Char** attributes);
272 void endElementHandler(const XML_Char* name); 273 void endElementHandler(const XML_Char* name);
273 void characterDataHandler(const XML_Char* data, int length); 274 void characterDataHandler(const XML_Char* data, int length);
@@ -307,8 +308,8 @@ private:
307 LLSD mResult; 308 LLSD mResult;
308 S32 mParseCount; 309 S32 mParseCount;
309 310
310 bool mInLLSDElement; 311 bool mInLLSDElement; // true if we're on LLSD
311 bool mGracefullStop; 312 bool mGracefullStop; // true if we found the </llsd
312 313
313 typedef std::deque<LLSD*> LLSDRefStack; 314 typedef std::deque<LLSD*> LLSDRefStack;
314 LLSDRefStack mStack; 315 LLSDRefStack mStack;
@@ -319,15 +320,12 @@ private:
319 320
320 std::string mCurrentKey; 321 std::string mCurrentKey;
321 std::ostringstream mCurrentContent; 322 std::ostringstream mCurrentContent;
322
323 bool mPreStaged;
324}; 323};
325 324
326 325
327LLSDXMLParser::Impl::Impl() 326LLSDXMLParser::Impl::Impl()
328{ 327{
329 mParser = XML_ParserCreate(NULL); 328 mParser = XML_ParserCreate(NULL);
330 mPreStaged = false;
331 reset(); 329 reset();
332} 330}
333 331
@@ -336,7 +334,7 @@ LLSDXMLParser::Impl::~Impl()
336 XML_ParserFree(mParser); 334 XML_ParserFree(mParser);
337} 335}
338 336
339bool is_eol(char c) 337inline bool is_eol(char c)
340{ 338{
341 return (c == '\n' || c == '\r'); 339 return (c == '\n' || c == '\r');
342} 340}
@@ -356,9 +354,9 @@ static unsigned get_till_eol(std::istream& input, char *buf, unsigned bufsize)
356 unsigned count = 0; 354 unsigned count = 0;
357 while (count < bufsize && input.good()) 355 while (count < bufsize && input.good())
358 { 356 {
359 input.get(buf[count]); 357 char c = input.get();
360 count++; 358 buf[count++] = c;
361 if (is_eol(buf[count - 1])) 359 if (is_eol(c))
362 break; 360 break;
363 } 361 }
364 return count; 362 return count;
@@ -366,7 +364,6 @@ static unsigned get_till_eol(std::istream& input, char *buf, unsigned bufsize)
366 364
367S32 LLSDXMLParser::Impl::parse(std::istream& input, LLSD& data) 365S32 LLSDXMLParser::Impl::parse(std::istream& input, LLSD& data)
368{ 366{
369 reset();
370 XML_Status status; 367 XML_Status status;
371 368
372 static const int BUFFER_SIZE = 1024; 369 static const int BUFFER_SIZE = 1024;
@@ -420,14 +417,86 @@ S32 LLSDXMLParser::Impl::parse(std::istream& input, LLSD& data)
420 return mParseCount; 417 return mParseCount;
421} 418}
422 419
423void LLSDXMLParser::Impl::reset() 420
421S32 LLSDXMLParser::Impl::parseLines(std::istream& input, LLSD& data)
424{ 422{
425 if (mPreStaged) 423 XML_Status status = XML_STATUS_OK;
424
425 data = LLSD();
426
427 static const int BUFFER_SIZE = 1024;
428
429 //static char last_buffer[ BUFFER_SIZE ];
430 //std::streamsize last_num_read;
431
432 // Must get rid of any leading \n, otherwise the stream gets into an error/eof state
433 clear_eol(input);
434
435 while( !mGracefullStop
436 && input.good()
437 && !input.eof())
426 { 438 {
427 mPreStaged = false; 439 void* buffer = XML_GetBuffer(mParser, BUFFER_SIZE);
428 return; 440 /*
441 * If we happened to end our last buffer right at the end of the llsd, but the
442 * stream is still going we will get a null buffer here. Check for mGracefullStop.
443 * -- I don't think this is actually true - zero 2008-05-09
444 */
445 if (!buffer)
446 {
447 break;
448 }
449
450 // Get one line
451 input.getline((char*)buffer, BUFFER_SIZE);
452 std::streamsize num_read = input.gcount();
453
454 //memcpy( last_buffer, buffer, num_read );
455 //last_num_read = num_read;
456
457 if ( num_read > 0 )
458 {
459 if (!input.good() )
460 { // Clear state that's set when we run out of buffer
461 input.clear();
462 }
463
464 // Don't parse the NULL at the end which might be added if \n was absorbed by getline()
465 char * text = (char *) buffer;
466 if ( text[num_read - 1] == 0)
467 {
468 num_read--;
469 }
470 }
471
472 status = XML_ParseBuffer(mParser, num_read, false);
473 if (status == XML_STATUS_ERROR)
474 {
475 break;
476 }
429 } 477 }
430 478
479 if (status != XML_STATUS_ERROR
480 && !mGracefullStop)
481 { // Parse last bit
482 status = XML_ParseBuffer(mParser, 0, true);
483 }
484
485 if (status == XML_STATUS_ERROR
486 && !mGracefullStop)
487 {
488 llinfos << "LLSDXMLParser::Impl::parseLines: XML_STATUS_ERROR" << llendl;
489 return LLSDParser::PARSE_FAILURE;
490 }
491
492 clear_eol(input);
493 data = mResult;
494 return mParseCount;
495}
496
497
498void LLSDXMLParser::Impl::reset()
499{
431 mResult.clear(); 500 mResult.clear();
432 mParseCount = 0; 501 mParseCount = 0;
433 502
@@ -476,14 +545,15 @@ LLSDXMLParser::Impl::findAttribute(const XML_Char* name, const XML_Char** pairs)
476 545
477void LLSDXMLParser::Impl::parsePart(const char* buf, int len) 546void LLSDXMLParser::Impl::parsePart(const char* buf, int len)
478{ 547{
479 void * buffer = XML_GetBuffer(mParser, len); 548 if ( buf != NULL
480 if (buffer != NULL && buf != NULL) 549 && len > 0 )
481 { 550 {
482 memcpy(buffer, buf, len); 551 XML_Status status = XML_Parse(mParser, buf, len, false);
552 if (status == XML_STATUS_ERROR)
553 {
554 llinfos << "Unexpected XML parsing error at start" << llendl;
555 }
483 } 556 }
484 XML_ParseBuffer(mParser, len, false);
485
486 mPreStaged = true;
487} 557}
488 558
489void LLSDXMLParser::Impl::startElementHandler(const XML_Char* name, const XML_Char** attributes) 559void LLSDXMLParser::Impl::startElementHandler(const XML_Char* name, const XML_Char** attributes)
@@ -738,5 +808,18 @@ void LLSDXMLParser::parsePart(const char *buf, int len)
738// virtual 808// virtual
739S32 LLSDXMLParser::doParse(std::istream& input, LLSD& data) const 809S32 LLSDXMLParser::doParse(std::istream& input, LLSD& data) const
740{ 810{
741 return impl.parse(input, data); 811// Remove code - emergency fix DEV-17785 parsing newline failure
812// if (mParseLines)
813// {
814 // Use line-based reading (faster code)
815// return impl.parseLines(input, data);
816// }
817
818 return impl.parse(input, data);
819}
820
821// virtual
822void LLSDXMLParser::doReset()
823{
824 impl.reset();
742} 825}
diff --git a/linden/indra/llcommon/llsdutil.cpp b/linden/indra/llcommon/llsdutil.cpp
index d1ccce0..b619fb6 100644
--- a/linden/indra/llcommon/llsdutil.cpp
+++ b/linden/indra/llcommon/llsdutil.cpp
@@ -46,124 +46,6 @@
46 46
47#include "llsdserialize.h" 47#include "llsdserialize.h"
48 48
49// vector3
50LLSD ll_sd_from_vector3(const LLVector3& vec)
51{
52 LLSD rv;
53 rv.append((F64)vec.mV[VX]);
54 rv.append((F64)vec.mV[VY]);
55 rv.append((F64)vec.mV[VZ]);
56 return rv;
57}
58
59LLVector3 ll_vector3_from_sd(const LLSD& sd, S32 start_index)
60{
61 LLVector3 rv;
62 rv.mV[VX] = (F32)sd[start_index].asReal();
63 rv.mV[VY] = (F32)sd[++start_index].asReal();
64 rv.mV[VZ] = (F32)sd[++start_index].asReal();
65 return rv;
66}
67
68// vector4
69LLSD ll_sd_from_vector4(const LLVector4& vec)
70{
71 LLSD rv;
72 rv.append((F64)vec.mV[VX]);
73 rv.append((F64)vec.mV[VY]);
74 rv.append((F64)vec.mV[VZ]);
75 rv.append((F64)vec.mV[VW]);
76 return rv;
77}
78
79LLVector4 ll_vector4_from_sd(const LLSD& sd, S32 start_index)
80{
81 LLVector4 rv;
82 rv.mV[VX] = (F32)sd[start_index].asReal();
83 rv.mV[VY] = (F32)sd[++start_index].asReal();
84 rv.mV[VZ] = (F32)sd[++start_index].asReal();
85 rv.mV[VW] = (F32)sd[++start_index].asReal();
86 return rv;
87}
88
89// vector3d
90LLSD ll_sd_from_vector3d(const LLVector3d& vec)
91{
92 LLSD rv;
93 rv.append(vec.mdV[VX]);
94 rv.append(vec.mdV[VY]);
95 rv.append(vec.mdV[VZ]);
96 return rv;
97}
98
99LLVector3d ll_vector3d_from_sd(const LLSD& sd, S32 start_index)
100{
101 LLVector3d rv;
102 rv.mdV[VX] = sd[start_index].asReal();
103 rv.mdV[VY] = sd[++start_index].asReal();
104 rv.mdV[VZ] = sd[++start_index].asReal();
105 return rv;
106}
107
108//vector2
109LLSD ll_sd_from_vector2(const LLVector2& vec)
110{
111 LLSD rv;
112 rv.append((F64)vec.mV[VX]);
113 rv.append((F64)vec.mV[VY]);
114 return rv;
115}
116
117LLVector2 ll_vector2_from_sd(const LLSD& sd)
118{
119 LLVector2 rv;
120 rv.mV[VX] = (F32)sd[0].asReal();
121 rv.mV[VY] = (F32)sd[1].asReal();
122 return rv;
123}
124
125// Quaternion
126LLSD ll_sd_from_quaternion(const LLQuaternion& quat)
127{
128 LLSD rv;
129 rv.append((F64)quat.mQ[VX]);
130 rv.append((F64)quat.mQ[VY]);
131 rv.append((F64)quat.mQ[VZ]);
132 rv.append((F64)quat.mQ[VW]);
133 return rv;
134}
135
136LLQuaternion ll_quaternion_from_sd(const LLSD& sd)
137{
138 LLQuaternion quat;
139 quat.mQ[VX] = (F32)sd[0].asReal();
140 quat.mQ[VY] = (F32)sd[1].asReal();
141 quat.mQ[VZ] = (F32)sd[2].asReal();
142 quat.mQ[VW] = (F32)sd[3].asReal();
143 return quat;
144}
145
146// color4
147LLSD ll_sd_from_color4(const LLColor4& c)
148{
149 LLSD rv;
150 rv.append(c.mV[0]);
151 rv.append(c.mV[1]);
152 rv.append(c.mV[2]);
153 rv.append(c.mV[3]);
154 return rv;
155}
156
157LLColor4 ll_color4_from_sd(const LLSD& sd)
158{
159 LLColor4 c;
160 c.mV[0] = (F32)sd[0].asReal();
161 c.mV[1] = (F32)sd[1].asReal();
162 c.mV[2] = (F32)sd[2].asReal();
163 c.mV[3] = (F32)sd[3].asReal();
164 return c;
165}
166
167// U32 49// U32
168LLSD ll_sd_from_U32(const U32 val) 50LLSD ll_sd_from_U32(const U32 val)
169{ 51{
@@ -263,12 +145,11 @@ LLSD ll_binary_from_string(const LLSD& sd)
263{ 145{
264 std::vector<U8> binary_value; 146 std::vector<U8> binary_value;
265 147
266 LLString string_value = sd.asString(); 148 std::string string_value = sd.asString();
267 const char* string_p = string_value.c_str(); 149 for (std::string::iterator iter = string_value.begin();
268 while (*string_p) 150 iter != string_value.end(); ++iter)
269 { 151 {
270 binary_value.push_back(*string_p); 152 binary_value.push_back(*iter);
271 string_p++;
272 } 153 }
273 154
274 binary_value.push_back('\0'); 155 binary_value.push_back('\0');
@@ -303,8 +184,9 @@ char* ll_pretty_print_sd(const LLSD& sd)
303} 184}
304 185
305//compares the structure of an LLSD to a template LLSD and stores the 186//compares the structure of an LLSD to a template LLSD and stores the
306//"valid" values in a 3rd LLSD. Default values are stored in the template 187//"valid" values in a 3rd LLSD. Default values pulled from the template
307// 188//if the tested LLSD does not contain the key/value pair.
189//Excess values in the test LLSD are ignored in the resultant_llsd.
308//If the llsd to test has a specific key to a map and the values 190//If the llsd to test has a specific key to a map and the values
309//are not of the same type, false is returned or if the LLSDs are not 191//are not of the same type, false is returned or if the LLSDs are not
310//of the same value. Ordering of arrays matters 192//of the same value. Ordering of arrays matters
diff --git a/linden/indra/llcommon/llsdutil.h b/linden/indra/llcommon/llsdutil.h
index ae6d694..905c031 100644
--- a/linden/indra/llcommon/llsdutil.h
+++ b/linden/indra/llcommon/llsdutil.h
@@ -35,35 +35,34 @@
35#define LL_LLSDUTIL_H 35#define LL_LLSDUTIL_H
36 36
37#include "llsd.h" 37#include "llsd.h"
38#include "../llmath/v3math.h"
39#include "../llmath/v4math.h"
40#include "../llmath/v3dmath.h"
41#include "../llmath/v2math.h"
42#include "../llmath/llquaternion.h"
43#include "../llmath/v4color.h"
44#include "../llprimitive/lltextureanim.h"
45 38
46// vector3 39// vector3
40class LLVector3;
47LLSD ll_sd_from_vector3(const LLVector3& vec); 41LLSD ll_sd_from_vector3(const LLVector3& vec);
48LLVector3 ll_vector3_from_sd(const LLSD& sd, S32 start_index = 0); 42LLVector3 ll_vector3_from_sd(const LLSD& sd, S32 start_index = 0);
49 43
50// vector4 44// vector4
45class LLVector4;
51LLSD ll_sd_from_vector4(const LLVector4& vec); 46LLSD ll_sd_from_vector4(const LLVector4& vec);
52LLVector4 ll_vector4_from_sd(const LLSD& sd, S32 start_index = 0); 47LLVector4 ll_vector4_from_sd(const LLSD& sd, S32 start_index = 0);
53 48
54// vector3d (double) 49// vector3d (double)
50class LLVector3d;
55LLSD ll_sd_from_vector3d(const LLVector3d& vec); 51LLSD ll_sd_from_vector3d(const LLVector3d& vec);
56LLVector3d ll_vector3d_from_sd(const LLSD& sd, S32 start_index = 0); 52LLVector3d ll_vector3d_from_sd(const LLSD& sd, S32 start_index = 0);
57 53
58// vector2 54// vector2
55class LLVector2;
59LLSD ll_sd_from_vector2(const LLVector2& vec); 56LLSD ll_sd_from_vector2(const LLVector2& vec);
60LLVector2 ll_vector2_from_sd(const LLSD& sd); 57LLVector2 ll_vector2_from_sd(const LLSD& sd);
61 58
62// Quaternion 59// Quaternion
60class LLQuaternion;
63LLSD ll_sd_from_quaternion(const LLQuaternion& quat); 61LLSD ll_sd_from_quaternion(const LLQuaternion& quat);
64LLQuaternion ll_quaternion_from_sd(const LLSD& sd); 62LLQuaternion ll_quaternion_from_sd(const LLSD& sd);
65 63
66// color4 64// color4
65class LLColor4;
67LLSD ll_sd_from_color4(const LLColor4& c); 66LLSD ll_sd_from_color4(const LLColor4& c);
68LLColor4 ll_color4_from_sd(const LLSD& sd); 67LLColor4 ll_color4_from_sd(const LLSD& sd);
69 68
@@ -93,9 +92,11 @@ char* ll_pretty_print_sd(const LLSD& sd);
93 92
94//compares the structure of an LLSD to a template LLSD and stores the 93//compares the structure of an LLSD to a template LLSD and stores the
95//"valid" values in a 3rd LLSD. Default values 94//"valid" values in a 3rd LLSD. Default values
96//are pulled from the template. Ordering of arrays matters 95//are pulled from the template. Extra keys/values in the test
96//are ignored in the resultant LLSD. Ordering of arrays matters
97//Returns false if the test is of same type but values differ in type 97//Returns false if the test is of same type but values differ in type
98//Otherwise, returns true 98//Otherwise, returns true
99
99BOOL compare_llsd_with_template( 100BOOL compare_llsd_with_template(
100 const LLSD& llsd_to_test, 101 const LLSD& llsd_to_test,
101 const LLSD& template_llsd, 102 const LLSD& template_llsd,
diff --git a/linden/indra/llcommon/llsecondlifeurls.cpp b/linden/indra/llcommon/llsecondlifeurls.cpp
index 46b8cde..ee478fe 100644
--- a/linden/indra/llcommon/llsecondlifeurls.cpp
+++ b/linden/indra/llcommon/llsecondlifeurls.cpp
@@ -32,56 +32,56 @@
32#include "linden_common.h" 32#include "linden_common.h"
33#include "llsecondlifeurls.h" 33#include "llsecondlifeurls.h"
34 34
35const char CREATE_ACCOUNT_URL[] = 35const std::string CREATE_ACCOUNT_URL (
36 "http://secondlife.com/registration/"; 36 "http://secondlife.com/registration/");
37 37
38const char MANAGE_ACCOUNT[] = 38const std::string MANAGE_ACCOUNT (
39 "http://secondlife.com/account/"; 39 "http://secondlife.com/account/");
40 40
41const char AUCTION_URL[] = 41const std::string AUCTION_URL (
42 "http://secondlife.com/auctions/auction-detail.php?id="; 42 "http://secondlife.com/auctions/auction-detail.php?id=");
43 43
44const char EVENTS_URL[] = 44const std::string EVENTS_URL (
45 "http://secondlife.com/events/"; 45 "http://secondlife.com/events/");
46 46
47const char TIER_UP_URL[] = 47const std::string TIER_UP_URL (
48 "http://secondlife.com/app/landtier"; 48 "http://secondlife.com/app/landtier");
49 49
50const char LAND_URL[] = 50const std::string LAND_URL (
51 "http://secondlife.com/app/landtier"; 51 "http://secondlife.com/app/landtier");
52 52
53const char UPGRADE_TO_PREMIUM_URL[] = 53const std::string UPGRADE_TO_PREMIUM_URL (
54 "http://secondlife.com/app/upgrade/"; 54 "http://secondlife.com/app/upgrade/");
55 55
56const char DIRECTX_9_URL[] = 56const std::string DIRECTX_9_URL (
57 "http://secondlife.com/support/"; 57 "http://secondlife.com/support/");
58 58
59const char AMD_AGP_URL[] = 59const std::string AMD_AGP_URL (
60 "http://secondlife.com/support/"; 60 "http://secondlife.com/support/");
61 61
62const char VIA_URL[] = 62const std::string VIA_URL (
63 "http://secondlife.com/support/"; 63 "http://secondlife.com/support/");
64 64
65const char SUPPORT_URL[] = 65const std::string SUPPORT_URL (
66 "http://secondlife.com/support/"; 66 "http://secondlife.com/support/");
67 67
68const char INTEL_CHIPSET_URL[] = 68const std::string INTEL_CHIPSET_URL (
69 "http://secondlife.com/support/"; 69 "http://secondlife.com/support/");
70 70
71const char SIS_CHIPSET_URL[] = 71const std::string SIS_CHIPSET_URL (
72 "http://secondlife.com/support/"; 72 "http://secondlife.com/support/");
73 73
74const char BLOGS_URL[] = 74const std::string BLOGS_URL (
75 "http://blog.secondlife.com/"; 75 "http://blog.secondlife.com/");
76 76
77const char BUY_CURRENCY_URL[] = 77const std::string BUY_CURRENCY_URL (
78 "http://secondlife.com/app/currency/"; 78 "http://secondlife.com/app/currency/");
79 79
80const char LSL_DOC_URL[] = 80const std::string LSL_DOC_URL (
81 "http://secondlife.com/app/lsldoc/"; 81 "http://secondlife.com/app/lsldoc/");
82 82
83const char SL_KB_URL[] = 83const std::string SL_KB_URL (
84 "http://secondlife.com/knowledgebase/"; 84 "http://secondlife.com/knowledgebase/");
85
86const char RELEASE_NOTES[] = "releasenotes.txt";
87 85
86const std::string RELEASE_NOTES_BASE_URL (
87 "http://secondlife.com/app/releasenotes/");
diff --git a/linden/indra/llcommon/llsecondlifeurls.h b/linden/indra/llcommon/llsecondlifeurls.h
index 3fe086a..f612d5e 100644
--- a/linden/indra/llcommon/llsecondlifeurls.h
+++ b/linden/indra/llcommon/llsecondlifeurls.h
@@ -33,46 +33,46 @@
33#define LL_LLSECONDLIFEURLS_H 33#define LL_LLSECONDLIFEURLS_H
34 34
35// Account registration web page 35// Account registration web page
36extern const char CREATE_ACCOUNT_URL[]; 36extern const std::string CREATE_ACCOUNT_URL;
37 37
38// Manage Account 38// Manage Account
39extern const char MANAGE_ACCOUNT[]; 39extern const std::string MANAGE_ACCOUNT;
40 40
41extern const char AUCTION_URL[]; 41extern const std::string AUCTION_URL;
42 42
43extern const char EVENTS_URL[]; 43extern const std::string EVENTS_URL;
44 44
45// Tier up to a new land level. 45// Tier up to a new land level.
46extern const char TIER_UP_URL[]; 46extern const std::string TIER_UP_URL;
47 47
48// Tier up to a new land level. 48// Tier up to a new land level.
49extern const char LAND_URL[]; 49extern const std::string LAND_URL;
50 50
51// Upgrade from basic membership to premium membership 51// Upgrade from basic membership to premium membership
52extern const char UPGRADE_TO_PREMIUM_URL[]; 52extern const std::string UPGRADE_TO_PREMIUM_URL;
53 53
54// How to get DirectX 9 54// How to get DirectX 9
55extern const char DIRECTX_9_URL[]; 55extern const std::string DIRECTX_9_URL;
56 56
57// Out of date VIA chipset 57// Out of date VIA chipset
58extern const char VIA_URL[]; 58extern const std::string VIA_URL;
59 59
60// Support URL 60// Support URL
61extern const char SUPPORT_URL[]; 61extern const std::string SUPPORT_URL;
62 62
63// Linden Blogs page 63// Linden Blogs page
64extern const char BLOGS_URL[]; 64extern const std::string BLOGS_URL;
65 65
66// Currency page 66// Currency page
67extern const char BUY_CURRENCY_URL[]; 67extern const std::string BUY_CURRENCY_URL;
68 68
69// LSL script wiki 69// LSL script wiki
70extern const char LSL_DOC_URL[]; 70extern const std::string LSL_DOC_URL;
71 71
72// SL KnowledgeBase page 72// SL KnowledgeBase page
73extern const char SL_KB_URL[]; 73extern const std::string SL_KB_URL;
74 74
75// Local Url Release Notes 75// Release Notes Redirect URL for Server and Viewer
76extern const char RELEASE_NOTES[]; 76extern const std::string RELEASE_NOTES_BASE_URL;
77 77
78#endif 78#endif
diff --git a/linden/indra/llcommon/llstat.cpp b/linden/indra/llcommon/llstat.cpp
index 11e4c64..4b79fcb 100644
--- a/linden/indra/llcommon/llstat.cpp
+++ b/linden/indra/llcommon/llstat.cpp
@@ -76,10 +76,11 @@ public:
76 76
77U64 LLStatAccum::impl::sScaleTimes[IMPL_NUM_SCALES] = 77U64 LLStatAccum::impl::sScaleTimes[IMPL_NUM_SCALES] =
78{ 78{
79 USEC_PER_SEC / 10, // 100 millisec
79 USEC_PER_SEC * 1, // seconds 80 USEC_PER_SEC * 1, // seconds
80 USEC_PER_SEC * 60, // minutes 81 USEC_PER_SEC * 60, // minutes
81 USEC_PER_SEC * 60 * 2 // minutes 82 USEC_PER_SEC * 60 * 2 // two minutes
82#if 0 83#if ENABLE_LONG_TIME_STATS
83 // enable these when more time scales are desired 84 // enable these when more time scales are desired
84 USEC_PER_SEC * 60*60, // hours 85 USEC_PER_SEC * 60*60, // hours
85 USEC_PER_SEC * 24*60*60, // days 86 USEC_PER_SEC * 24*60*60, // days
diff --git a/linden/indra/llcommon/llstat.h b/linden/indra/llcommon/llstat.h
index a0a86e6..0a7e014 100644
--- a/linden/indra/llcommon/llstat.h
+++ b/linden/indra/llcommon/llstat.h
@@ -37,6 +37,9 @@
37#include "lltimer.h" 37#include "lltimer.h"
38#include "llframetimer.h" 38#include "llframetimer.h"
39 39
40// Set this if longer stats are needed
41#define ENABLE_LONG_TIME_STATS 0
42
40// 43//
41// Accumulates statistics for an arbitrary length of time. 44// Accumulates statistics for an arbitrary length of time.
42// Does this by maintaining a chain of accumulators, each one 45// Does this by maintaining a chain of accumulators, each one
@@ -52,19 +55,22 @@ protected:
52 55
53public: 56public:
54 enum TimeScale { 57 enum TimeScale {
58 SCALE_100MS,
55 SCALE_SECOND, 59 SCALE_SECOND,
56 SCALE_MINUTE, 60 SCALE_MINUTE,
57 SCALE_TWO_MINUTE, 61 SCALE_TWO_MINUTE,
62#if ENABLE_LONG_TIME_STATS
58 SCALE_HOUR, 63 SCALE_HOUR,
59 SCALE_DAY, 64 SCALE_DAY,
60 SCALE_WEEK, 65 SCALE_WEEK,
61 66#endif
62 NUM_SCALES 67 NUM_SCALES
63 }; 68 };
64 69
65 F32 meanValue(TimeScale scale) const; 70 F32 meanValue(TimeScale scale) const;
66 // see the subclasses for the specific meaning of value 71 // see the subclasses for the specific meaning of value
67 72
73 F32 meanValueOverLast100ms() const { return meanValue(SCALE_100MS); }
68 F32 meanValueOverLastSecond() const { return meanValue(SCALE_SECOND); } 74 F32 meanValueOverLastSecond() const { return meanValue(SCALE_SECOND); }
69 F32 meanValueOverLastMinute() const { return meanValue(SCALE_MINUTE); } 75 F32 meanValueOverLastMinute() const { return meanValue(SCALE_MINUTE); }
70 76
diff --git a/linden/indra/llcommon/llstatenums.h b/linden/indra/llcommon/llstatenums.h
index bde6ade..6866586 100644
--- a/linden/indra/llcommon/llstatenums.h
+++ b/linden/indra/llcommon/llstatenums.h
@@ -63,7 +63,8 @@ enum
63 LL_SIM_STAT_SIMPHYSICSSTEPMS, 63 LL_SIM_STAT_SIMPHYSICSSTEPMS,
64 LL_SIM_STAT_SIMPHYSICSSHAPEMS, 64 LL_SIM_STAT_SIMPHYSICSSHAPEMS,
65 LL_SIM_STAT_SIMPHYSICSOTHERMS, 65 LL_SIM_STAT_SIMPHYSICSOTHERMS,
66 LL_SIM_STAT_SIMPHYSICSMEMORY 66 LL_SIM_STAT_SIMPHYSICSMEMORY,
67 LL_SIM_STAT_SCRIPT_EPS,
67}; 68};
68 69
69#endif 70#endif
diff --git a/linden/indra/llcommon/llstl.h b/linden/indra/llcommon/llstl.h
index 9a24185..4486727 100644
--- a/linden/indra/llcommon/llstl.h
+++ b/linden/indra/llcommon/llstl.h
@@ -105,6 +105,7 @@ struct DeletePairedPointer
105 template<typename T> void operator()(T &ptr) const 105 template<typename T> void operator()(T &ptr) const
106 { 106 {
107 delete ptr.second; 107 delete ptr.second;
108 ptr.second = NULL;
108 } 109 }
109}; 110};
110struct DeletePairedPointerArray 111struct DeletePairedPointerArray
@@ -112,6 +113,7 @@ struct DeletePairedPointerArray
112 template<typename T> void operator()(T &ptr) const 113 template<typename T> void operator()(T &ptr) const
113 { 114 {
114 delete[] ptr.second; 115 delete[] ptr.second;
116 ptr.second = NULL;
115 } 117 }
116}; 118};
117 119
diff --git a/linden/indra/llcommon/llstring.cpp b/linden/indra/llcommon/llstring.cpp
index a1f19ad..6a8efa8 100644
--- a/linden/indra/llcommon/llstring.cpp
+++ b/linden/indra/llcommon/llstring.cpp
@@ -1,6 +1,6 @@
1/** 1/**
2 * @file llstring.cpp 2 * @file llstring.cpp
3 * @brief String utility functions and the LLString class. 3 * @brief String utility functions and the std::string class.
4 * 4 *
5 * $LicenseInfo:firstyear=2001&license=viewergpl$ 5 * $LicenseInfo:firstyear=2001&license=viewergpl$
6 * 6 *
@@ -47,6 +47,12 @@ std::string ll_safe_string(const char* in)
47 return std::string(); 47 return std::string();
48} 48}
49 49
50std::string ll_safe_string(const char* in, S32 maxlen)
51{
52 if(in) return std::string(in, maxlen);
53 return std::string();
54}
55
50U8 hex_as_nybble(char hex) 56U8 hex_as_nybble(char hex)
51{ 57{
52 if((hex >= '0') && (hex <= '9')) 58 if((hex >= '0') && (hex <= '9'))
@@ -65,12 +71,12 @@ U8 hex_as_nybble(char hex)
65} 71}
66 72
67 73
68bool _read_file_into_string(std::string& str, const char* filename) 74bool _read_file_into_string(std::string& str, const std::string& filename)
69{ 75{
70 llifstream ifs(filename, llifstream::binary); 76 llifstream ifs(filename, llifstream::binary);
71 if (!ifs.is_open()) 77 if (!ifs.is_open())
72 { 78 {
73 llinfos << "Unable to open file" << filename << llendl; 79 llinfos << "Unable to open file " << filename << llendl;
74 return false; 80 return false;
75 } 81 }
76 82
@@ -174,20 +180,6 @@ S32 utf16chars_to_wchar(const U16* inchars, llwchar* outchar)
174 return inchars - base; 180 return inchars - base;
175} 181}
176 182
177S32 utf16chars_to_utf8chars(const U16* inchars, char* outchars, S32* nchars8p)
178{
179 // Get 32 bit char32
180 llwchar char32;
181 S32 nchars16 = utf16chars_to_wchar(inchars, &char32);
182 // Convert to utf8
183 S32 nchars8 = wchar_to_utf8chars(char32, outchars);
184 if (nchars8p)
185 {
186 *nchars8p = nchars8;
187 }
188 return nchars16;
189}
190
191llutf16string wstring_to_utf16str(const LLWString &utf32str, S32 len) 183llutf16string wstring_to_utf16str(const LLWString &utf32str, S32 len)
192{ 184{
193 llutf16string out; 185 llutf16string out;
@@ -216,7 +208,7 @@ llutf16string wstring_to_utf16str(const LLWString &utf32str)
216 return wstring_to_utf16str(utf32str, len); 208 return wstring_to_utf16str(utf32str, len);
217} 209}
218 210
219llutf16string utf8str_to_utf16str ( const LLString& utf8str ) 211llutf16string utf8str_to_utf16str ( const std::string& utf8str )
220{ 212{
221 LLWString wstr = utf8str_to_wstring ( utf8str ); 213 LLWString wstr = utf8str_to_wstring ( utf8str );
222 return wstring_to_utf16str ( wstr ); 214 return wstring_to_utf16str ( wstr );
@@ -492,210 +484,10 @@ std::string utf16str_to_utf8str(const llutf16string& utf16str, S32 len)
492 return wstring_to_utf8str(utf16str_to_wstring(utf16str, len), len); 484 return wstring_to_utf8str(utf16str_to_wstring(utf16str, len), len);
493} 485}
494 486
495
496//LLWString wstring_truncate(const LLWString &wstr, const S32 max_len)
497//{
498// return wstr.substr(0, llmin((S32)wstr.length(), max_len));
499//}
500//
501//
502//LLWString wstring_trim(const LLWString &wstr)
503//{
504// LLWString outstr;
505// outstr = wstring_trimhead(wstr);
506// outstr = wstring_trimtail(outstr);
507// return outstr;
508//}
509//
510//
511//LLWString wstring_trimhead(const LLWString &wstr)
512//{
513// if(wstr.empty())
514// {
515// return wstr;
516// }
517//
518// S32 i = 0;
519// while((i < (S32)wstr.length()) && iswspace(wstr[i]))
520// {
521// i++;
522// }
523// return wstr.substr(i, wstr.length() - i);
524//}
525//
526//
527//LLWString wstring_trimtail(const LLWString &wstr)
528//{
529// if(wstr.empty())
530// {
531// return wstr;
532// }
533//
534// S32 len = (S32)wstr.length();
535//
536// S32 i = len - 1;
537// while (i >= 0 && iswspace(wstr[i]))
538// {
539// i--;
540// }
541//
542// if (i >= 0)
543// {
544// return wstr.substr(0, i + 1);
545// }
546// return wstr;
547//}
548//
549//
550//LLWString wstring_copyinto(const LLWString &dest, const LLWString &src, const S32 insert_offset)
551//{
552// llassert( insert_offset <= (S32)dest.length() );
553//
554// LLWString out_str = dest.substr(0, insert_offset);
555// out_str += src;
556// LLWString tail = dest.substr(insert_offset);
557// out_str += tail;
558//
559// return out_str;
560//}
561
562
563//LLWString wstring_detabify(const LLWString &wstr, const S32 num_spaces)
564//{
565// LLWString out_str;
566// // Replace tabs with spaces
567// for (S32 i = 0; i < (S32)wstr.length(); i++)
568// {
569// if (wstr[i] == '\t')
570// {
571// for (S32 j = 0; j < num_spaces; j++)
572// out_str += ' ';
573// }
574// else
575// {
576// out_str += wstr[i];
577// }
578// }
579// return out_str;
580//}
581
582
583//LLWString wstring_makeASCII(const LLWString &wstr)
584//{
585// // Replace non-ASCII chars with replace_char
586// LLWString out_str = wstr;
587// for (S32 i = 0; i < (S32)out_str.length(); i++)
588// {
589// if (out_str[i] > 0x7f)
590// {
591// out_str[i] = LL_UNKNOWN_CHAR;
592// }
593// }
594// return out_str;
595//}
596
597
598//LLWString wstring_substChar(const LLWString &wstr, const llwchar target_char, const llwchar replace_char)
599//{
600// // Replace all occurences of target_char with replace_char
601// LLWString out_str = wstr;
602// for (S32 i = 0; i < (S32)out_str.length(); i++)
603// {
604// if (out_str[i] == target_char)
605// {
606// out_str[i] = replace_char;
607// }
608// }
609// return out_str;
610//}
611//
612//
613//LLWString wstring_tolower(const LLWString &wstr)
614//{
615// LLWString out_str = wstr;
616// for (S32 i = 0; i < (S32)out_str.length(); i++)
617// {
618// out_str[i] = towlower(out_str[i]);
619// }
620// return out_str;
621//}
622//
623//
624//LLWString wstring_convert_to_lf(const LLWString &wstr)
625//{
626// const llwchar CR = 13;
627// // Remove carriage returns from string with CRLF
628// LLWString out_str;
629//
630// for (S32 i = 0; i < (S32)wstr.length(); i++)
631// {
632// if (wstr[i] != CR)
633// {
634// out_str += wstr[i];
635// }
636// }
637// return out_str;
638//}
639//
640//
641//LLWString wstring_convert_to_crlf(const LLWString &wstr)
642//{
643// const llwchar LF = 10;
644// const llwchar CR = 13;
645// // Remove carriage returns from string with CRLF
646// LLWString out_str;
647//
648// for (S32 i = 0; i < (S32)wstr.length(); i++)
649// {
650// if (wstr[i] == LF)
651// {
652// out_str += CR;
653// }
654// out_str += wstr[i];
655// }
656// return out_str;
657//}
658
659
660//S32 wstring_compare_insensitive(const LLWString &lhs, const LLWString &rhs)
661//{
662//
663// if (lhs == rhs)
664// {
665// return 0;
666// }
667//
668// if (lhs.empty())
669// {
670// return rhs.empty() ? 0 : 1;
671// }
672//
673// if (rhs.empty())
674// {
675// return -1;
676// }
677//
678//#ifdef LL_LINUX
679// // doesn't work because gcc 2.95 doesn't correctly implement c_str(). Sigh...
680// llerrs << "wstring_compare_insensitive doesn't work on Linux!" << llendl;
681// return 0;
682//#else
683// LLWString lhs_lower = lhs;
684// LLWString::toLower(lhs_lower);
685// std::string lhs_lower = wstring_to_utf8str(lhs_lower);
686// LLWString rhs_lower = lhs;
687// LLWString::toLower(rhs_lower);
688// std::string rhs_lower = wstring_to_utf8str(rhs_lower);
689//
690// return strcmp(lhs_lower.c_str(), rhs_lower.c_str());
691//#endif
692//}
693
694
695std::string utf8str_trim(const std::string& utf8str) 487std::string utf8str_trim(const std::string& utf8str)
696{ 488{
697 LLWString wstr = utf8str_to_wstring(utf8str); 489 LLWString wstr = utf8str_to_wstring(utf8str);
698 LLWString::trim(wstr); 490 LLWStringUtil::trim(wstr);
699 return wstring_to_utf8str(wstr); 491 return wstring_to_utf8str(wstr);
700} 492}
701 493
@@ -703,7 +495,7 @@ std::string utf8str_trim(const std::string& utf8str)
703std::string utf8str_tolower(const std::string& utf8str) 495std::string utf8str_tolower(const std::string& utf8str)
704{ 496{
705 LLWString out_str = utf8str_to_wstring(utf8str); 497 LLWString out_str = utf8str_to_wstring(utf8str);
706 LLWString::toLower(out_str); 498 LLWStringUtil::toLower(out_str);
707 return wstring_to_utf8str(out_str); 499 return wstring_to_utf8str(out_str);
708} 500}
709 501
@@ -712,7 +504,7 @@ S32 utf8str_compare_insensitive(const std::string& lhs, const std::string& rhs)
712{ 504{
713 LLWString wlhs = utf8str_to_wstring(lhs); 505 LLWString wlhs = utf8str_to_wstring(lhs);
714 LLWString wrhs = utf8str_to_wstring(rhs); 506 LLWString wrhs = utf8str_to_wstring(rhs);
715 return LLWString::compareInsensitive(wlhs.c_str(), wrhs.c_str()); 507 return LLWStringUtil::compareInsensitive(wlhs, wrhs);
716} 508}
717 509
718std::string utf8str_truncate(const std::string& utf8str, const S32 max_len) 510std::string utf8str_truncate(const std::string& utf8str, const S32 max_len)
@@ -756,7 +548,7 @@ std::string utf8str_substChar(
756 const llwchar replace_char) 548 const llwchar replace_char)
757{ 549{
758 LLWString wstr = utf8str_to_wstring(utf8str); 550 LLWString wstr = utf8str_to_wstring(utf8str);
759 LLWString::replaceChar(wstr, target_char, replace_char); 551 LLWStringUtil::replaceChar(wstr, target_char, replace_char);
760 //wstr = wstring_substChar(wstr, target_char, replace_char); 552 //wstr = wstring_substChar(wstr, target_char, replace_char);
761 return wstring_to_utf8str(wstr); 553 return wstring_to_utf8str(wstr);
762} 554}
@@ -764,7 +556,7 @@ std::string utf8str_substChar(
764std::string utf8str_makeASCII(const std::string& utf8str) 556std::string utf8str_makeASCII(const std::string& utf8str)
765{ 557{
766 LLWString wstr = utf8str_to_wstring(utf8str); 558 LLWString wstr = utf8str_to_wstring(utf8str);
767 LLWString::_makeASCII(wstr); 559 LLWStringUtil::_makeASCII(wstr);
768 return wstring_to_utf8str(wstr); 560 return wstring_to_utf8str(wstr);
769} 561}
770 562
@@ -929,6 +721,32 @@ namespace LLStringFn
929 } 721 }
930 } 722 }
931 } 723 }
724
725 // https://wiki.lindenlab.com/wiki/Unicode_Guidelines has details on
726 // allowable code points for XML. Specifically, they are:
727 // 0x09, 0x0a, 0x0d, and 0x20 on up. JC
728 std::string strip_invalid_xml(const std::string& input)
729 {
730 std::string output;
731 output.reserve( input.size() );
732 std::string::const_iterator it = input.begin();
733 while (it != input.end())
734 {
735 // Must compare as unsigned for >=
736 // Test most likely match first
737 const unsigned char c = (unsigned char)*it;
738 if ( c >= (unsigned char)0x20 // SPACE
739 || c == (unsigned char)0x09 // TAB
740 || c == (unsigned char)0x0a // LINE_FEED
741 || c == (unsigned char)0x0d ) // CARRIAGE_RETURN
742 {
743 output.push_back(c);
744 }
745 ++it;
746 }
747 return output;
748 }
749
932} 750}
933 751
934 752
@@ -938,19 +756,19 @@ namespace LLStringFn
938#ifdef _DEBUG 756#ifdef _DEBUG
939 757
940template<class T> 758template<class T>
941void LLStringBase<T>::testHarness() 759void LLStringUtilBase<T>::testHarness()
942{ 760{
943 LLString s1; 761 std::string s1;
944 762
945 llassert( s1.c_str() == NULL ); 763 llassert( s1.c_str() == NULL );
946 llassert( s1.size() == 0 ); 764 llassert( s1.size() == 0 );
947 llassert( s1.empty() ); 765 llassert( s1.empty() );
948 766
949 LLString s2( "hello"); 767 std::string s2( "hello");
950 llassert( !strcmp( s2.c_str(), "hello" ) ); 768 llassert( !strcmp( s2.c_str(), "hello" ) );
951 llassert( s2.size() == 5 ); 769 llassert( s2.size() == 5 );
952 llassert( !s2.empty() ); 770 llassert( !s2.empty() );
953 LLString s3( s2 ); 771 std::string s3( s2 );
954 772
955 llassert( "hello" == s2 ); 773 llassert( "hello" == s2 );
956 llassert( s2 == "hello" ); 774 llassert( s2 == "hello" );
@@ -959,12 +777,12 @@ void LLStringBase<T>::testHarness()
959 llassert( "gello" != s2 ); 777 llassert( "gello" != s2 );
960 llassert( s2 != "gello" ); 778 llassert( s2 != "gello" );
961 779
962 LLString s4 = s2; 780 std::string s4 = s2;
963 llassert( !s4.empty() ); 781 llassert( !s4.empty() );
964 s4.empty(); 782 s4.empty();
965 llassert( s4.empty() ); 783 llassert( s4.empty() );
966 784
967 LLString s5(""); 785 std::string s5("");
968 llassert( s5.empty() ); 786 llassert( s5.empty() );
969 787
970 llassert( isValidIndex(s5, 0) ); 788 llassert( isValidIndex(s5, 0) );
@@ -978,8 +796,8 @@ void LLStringBase<T>::testHarness()
978 llassert( s4 == "hello again!hello again!" ); 796 llassert( s4 == "hello again!hello again!" );
979 797
980 798
981 LLString s6 = s2 + " " + s2; 799 std::string s6 = s2 + " " + s2;
982 LLString s7 = s6; 800 std::string s7 = s6;
983 llassert( s6 == s7 ); 801 llassert( s6 == s7 );
984 llassert( !( s6 != s7) ); 802 llassert( !( s6 != s7) );
985 llassert( !(s6 < s7) ); 803 llassert( !(s6 < s7) );
@@ -1002,10 +820,10 @@ void LLStringBase<T>::testHarness()
1002 s2.insert( 1, "awn, don't yel"); 820 s2.insert( 1, "awn, don't yel");
1003 llassert( s2 == "yawn, don't yell"); 821 llassert( s2 == "yawn, don't yell");
1004 822
1005 LLString s8 = s2.substr( 6, 5 ); 823 std::string s8 = s2.substr( 6, 5 );
1006 llassert( s8 == "don't" ); 824 llassert( s8 == "don't" );
1007 825
1008 LLString s9 = " \t\ntest \t\t\n "; 826 std::string s9 = " \t\ntest \t\t\n ";
1009 trim(s9); 827 trim(s9);
1010 llassert( s9 == "test" ); 828 llassert( s9 == "test" );
1011 829
@@ -1020,17 +838,17 @@ void LLStringBase<T>::testHarness()
1020 llassert( s9 == "abc123&*(abc" ); 838 llassert( s9 == "abc123&*(abc" );
1021 839
1022 840
1023 LLString s10( 10, 'x' ); 841 std::string s10( 10, 'x' );
1024 llassert( s10 == "xxxxxxxxxx" ); 842 llassert( s10 == "xxxxxxxxxx" );
1025 843
1026 LLString s11( "monkey in the middle", 7, 2 ); 844 std::string s11( "monkey in the middle", 7, 2 );
1027 llassert( s11 == "in" ); 845 llassert( s11 == "in" );
1028 846
1029 LLString s12; //empty 847 std::string s12; //empty
1030 s12 += "foo"; 848 s12 += "foo";
1031 llassert( s12 == "foo" ); 849 llassert( s12 == "foo" );
1032 850
1033 LLString s13; //empty 851 std::string s13; //empty
1034 s13 += 'f'; 852 s13 += 'f';
1035 llassert( s13 == "f" ); 853 llassert( s13 == "f" );
1036} 854}
diff --git a/linden/indra/llcommon/llstring.h b/linden/indra/llcommon/llstring.h
index 82ebdc9..60a4492 100644
--- a/linden/indra/llcommon/llstring.h
+++ b/linden/indra/llcommon/llstring.h
@@ -1,6 +1,6 @@
1/** 1/**
2 * @file llstring.h 2 * @file llstring.h
3 * @brief String utility functions and LLString class. 3 * @brief String utility functions and std::string class.
4 * 4 *
5 * $LicenseInfo:firstyear=2001&license=viewergpl$ 5 * $LicenseInfo:firstyear=2001&license=viewergpl$
6 * 6 *
@@ -39,15 +39,8 @@
39 39
40const char LL_UNKNOWN_CHAR = '?'; 40const char LL_UNKNOWN_CHAR = '?';
41 41
42class LLVector3; 42#if LL_DARWIN || LL_LINUX || LL_SOLARIS
43class LLVector3d; 43// Template specialization of char_traits for U16s. Only necessary on Mac and Linux (exists on Windows already)
44class LLQuaternion;
45class LLUUID;
46class LLColor4;
47class LLColor4U;
48
49#if (LL_DARWIN || LL_SOLARIS || (LL_LINUX && __GNUC__ > 2))
50// Template specialization of char_traits for U16s. Only necessary on Mac for now (exists on Windows, unused/broken on Linux/gcc2.95)
51namespace std 44namespace std
52{ 45{
53template<> 46template<>
@@ -162,79 +155,29 @@ public:
162 static BOOL isDigit(llwchar a) { return iswdigit(a) != 0; } 155 static BOOL isDigit(llwchar a) { return iswdigit(a) != 0; }
163}; 156};
164 157
165//RN: I used a templated base class instead of a pure interface class to minimize code duplication 158// Allowing assignments from non-strings into format_map_t is apparently
166// but it might be worthwhile to just go with two implementations (LLString and LLWString) of 159// *really* error-prone, so subclass std::string with just basic c'tors.
167// an interface class, unless we can think of a good reason to have a std::basic_string polymorphic base 160class FormatMapString : public std::string
168 161{
169//**************************************************************** 162public:
170// NOTA BENE: do *NOT* dynamically allocate memory inside of LLStringBase as the {*()^#%*)#%W^*)#%*)STL implentation 163 FormatMapString() : std::string() {};
171// of basic_string doesn't provide a virtual destructor. If we need to allocate resources specific to LLString 164 FormatMapString(const char* s) : std::string(s) {};
172// then we should either customize std::basic_string to linden::basic_string or change LLString to be a wrapper 165 FormatMapString(const std::string& s) : std::string(s) {};
173// that contains an instance of std::basic_string. Similarly, overriding methods defined in std::basic_string will *not* 166};
174// be called in a polymorphic manner (passing an instance of basic_string to a particular function)
175//****************************************************************
176 167
177template <class T> 168template <class T>
178class LLStringBase : public std::basic_string<T> 169class LLStringUtilBase
179{ 170{
180public: 171public:
181 typedef typename std::basic_string<T>::size_type size_type; 172 typedef typename std::basic_string<T>::size_type size_type;
182 173
183 // naming convention follows those set for LLUUID
184// static LLStringBase null; // deprecated for std::string compliance
185// static LLStringBase zero_length; // deprecated for std::string compliance
186
187
188 // standard constructors
189 LLStringBase() : std::basic_string<T>() {}
190 LLStringBase(const LLStringBase& s): std::basic_string<T>(s) {}
191 LLStringBase(const std::basic_string<T>& s) : std::basic_string<T>(s) {}
192 LLStringBase(const std::basic_string<T>& s, size_type pos, size_type n = std::basic_string<T>::npos)
193 : std::basic_string<T>(s, pos, n) {}
194 LLStringBase(size_type count, const T& c) : std::basic_string<T>() { assign(count, c);}
195 // custom constructors
196 LLStringBase(const T* s);
197 LLStringBase(const T* s, size_type n);
198 LLStringBase(const T* s, size_type pos, size_type n );
199
200#if LL_LINUX || LL_SOLARIS
201 void clear() { assign(null); }
202
203 LLStringBase<T>& assign(const T* s);
204 LLStringBase<T>& assign(const T* s, size_type n);
205 LLStringBase<T>& assign(const LLStringBase& s);
206 LLStringBase<T>& assign(size_type n, const T& c);
207 LLStringBase<T>& assign(const T* a, const T* b);
208 LLStringBase<T>& assign(typename LLStringBase<T>::iterator &it1, typename LLStringBase<T>::iterator &it2);
209 LLStringBase<T>& assign(typename LLStringBase<T>::const_iterator &it1, typename LLStringBase<T>::const_iterator &it2);
210
211 // workaround for bug in gcc2 STL headers.
212 #if ((__GNUC__ <= 2) && (!defined _STLPORT_VERSION))
213 const T* c_str () const
214 {
215 if (length () == 0)
216 {
217 static const T zero = 0;
218 return &zero;
219 }
220
221 //terminate ();
222 { string_char_traits<T>::assign(const_cast<T*>(data())[length()], string_char_traits<T>::eos()); }
223
224 return data ();
225 }
226 #endif
227#endif
228
229 bool operator==(const T* _Right) const { return _Right ? (std::basic_string<T>::compare(_Right) == 0) : this->empty(); }
230
231public: 174public:
232 ///////////////////////////////////////////////////////////////////////////////////////// 175 /////////////////////////////////////////////////////////////////////////////////////////
233 // Static Utility functions that operate on std::strings 176 // Static Utility functions that operate on std::strings
234 177
235 static LLStringBase null; 178 static std::basic_string<T> null;
236 179
237 typedef std::map<std::string, std::string> format_map_t; 180 typedef std::map<FormatMapString, FormatMapString> format_map_t;
238 static S32 format(std::basic_string<T>& s, const format_map_t& fmt_map); 181 static S32 format(std::basic_string<T>& s, const format_map_t& fmt_map);
239 182
240 static BOOL isValidIndex(const std::basic_string<T>& string, size_type i) 183 static BOOL isValidIndex(const std::basic_string<T>& string, size_type i)
@@ -266,8 +209,8 @@ public:
266 /** 209 /**
267 * @brief Unsafe way to make ascii characters. You should probably 210 * @brief Unsafe way to make ascii characters. You should probably
268 * only call this when interacting with the host operating system. 211 * only call this when interacting with the host operating system.
269 * The 1 byte LLString does not work correctly. 212 * The 1 byte std::string does not work correctly.
270 * The 2 and 4 byte LLString probably work, so LLWString::_makeASCII 213 * The 2 and 4 byte std::string probably work, so LLWStringUtil::_makeASCII
271 * should work. 214 * should work.
272 */ 215 */
273 static void _makeASCII(std::basic_string<T>& string); 216 static void _makeASCII(std::basic_string<T>& string);
@@ -289,11 +232,13 @@ public:
289 // Like strcmp but also handles empty strings. Uses 232 // Like strcmp but also handles empty strings. Uses
290 // current locale. 233 // current locale.
291 static S32 compareStrings(const T* lhs, const T* rhs); 234 static S32 compareStrings(const T* lhs, const T* rhs);
235 static S32 compareStrings(const std::basic_string<T>& lhs, const std::basic_string<T>& rhs);
292 236
293 // case insensitive version of above. Uses current locale on 237 // case insensitive version of above. Uses current locale on
294 // Win32, and falls back to a non-locale aware comparison on 238 // Win32, and falls back to a non-locale aware comparison on
295 // Linux. 239 // Linux.
296 static S32 compareInsensitive(const T* lhs, const T* rhs); 240 static S32 compareInsensitive(const T* lhs, const T* rhs);
241 static S32 compareInsensitive(const std::basic_string<T>& lhs, const std::basic_string<T>& rhs);
297 242
298 // Case sensitive comparison with good handling of numbers. Does not use current locale. 243 // Case sensitive comparison with good handling of numbers. Does not use current locale.
299 // a.k.a. strdictcmp() 244 // a.k.a. strdictcmp()
@@ -320,21 +265,21 @@ public:
320 265
321}; 266};
322 267
323template<class T> LLStringBase<T> LLStringBase<T>::null; 268template<class T> std::basic_string<T> LLStringUtilBase<T>::null;
324 269
325typedef LLStringBase<char> LLString; 270typedef LLStringUtilBase<char> LLStringUtil;
326typedef LLStringBase<llwchar> LLWString; 271typedef LLStringUtilBase<llwchar> LLWStringUtil;
272typedef std::basic_string<llwchar> LLWString;
327 273
328//@ Use this where we want to disallow input in the form of "foo" 274//@ Use this where we want to disallow input in the form of "foo"
329// This is used to catch places where english text is embedded in the code 275// This is used to catch places where english text is embedded in the code
330// instead of in a translatable XUI file. 276// instead of in a translatable XUI file.
331class LLStringExplicit : public LLString 277class LLStringExplicit : public std::string
332{ 278{
333public: 279public:
334 explicit LLStringExplicit(const char* s) : LLString(s) {} 280 explicit LLStringExplicit(const char* s) : std::string(s) {}
335 LLStringExplicit(const LLString& s) : LLString(s) {} 281 LLStringExplicit(const std::string& s) : std::string(s) {}
336 LLStringExplicit(const std::string& s) : LLString(s) {} 282 LLStringExplicit(const std::string& s, size_type pos, size_type n = std::string::npos) : std::string(s, pos, n) {}
337 LLStringExplicit(const std::string& s, size_type pos, size_type n = std::string::npos) : LLString(s, pos, n) {}
338}; 283};
339 284
340struct LLDictionaryLess 285struct LLDictionaryLess
@@ -342,7 +287,7 @@ struct LLDictionaryLess
342public: 287public:
343 bool operator()(const std::string& a, const std::string& b) 288 bool operator()(const std::string& a, const std::string& b)
344 { 289 {
345 return (LLString::precedesDict(a, b) ? true : false); 290 return (LLStringUtil::precedesDict(a, b) ? true : false);
346 } 291 }
347}; 292};
348 293
@@ -371,6 +316,7 @@ inline std::string chop_tail_copy(
371 * pointer is NULL. 316 * pointer is NULL.
372 */ 317 */
373std::string ll_safe_string(const char* in); 318std::string ll_safe_string(const char* in);
319std::string ll_safe_string(const char* in, S32 maxlen);
374 320
375/** 321/**
376 * @brief This translates a nybble stored as a hex value from 0-f back 322 * @brief This translates a nybble stored as a hex value from 0-f back
@@ -387,7 +333,7 @@ U8 hex_as_nybble(char hex);
387 * @param filename The full name of the file to read. 333 * @param filename The full name of the file to read.
388 * @return Returns true on success. If false, str is unmodified. 334 * @return Returns true on success. If false, str is unmodified.
389 */ 335 */
390bool _read_file_into_string(std::string& str, const char* filename); 336bool _read_file_into_string(std::string& str, const std::string& filename);
391 337
392/** 338/**
393 * Unicode support 339 * Unicode support
@@ -409,20 +355,17 @@ LLWString utf16str_to_wstring(const llutf16string &utf16str);
409llutf16string wstring_to_utf16str(const LLWString &utf32str, S32 len); 355llutf16string wstring_to_utf16str(const LLWString &utf32str, S32 len);
410llutf16string wstring_to_utf16str(const LLWString &utf32str); 356llutf16string wstring_to_utf16str(const LLWString &utf32str);
411 357
412llutf16string utf8str_to_utf16str ( const LLString& utf8str, S32 len); 358llutf16string utf8str_to_utf16str ( const std::string& utf8str, S32 len);
413llutf16string utf8str_to_utf16str ( const LLString& utf8str ); 359llutf16string utf8str_to_utf16str ( const std::string& utf8str );
414 360
415LLWString utf8str_to_wstring(const std::string &utf8str, S32 len); 361LLWString utf8str_to_wstring(const std::string &utf8str, S32 len);
416LLWString utf8str_to_wstring(const std::string &utf8str); 362LLWString utf8str_to_wstring(const std::string &utf8str);
417// Same function, better name. JC 363// Same function, better name. JC
418inline LLWString utf8string_to_wstring(const std::string& utf8_string) { return utf8str_to_wstring(utf8_string); } 364inline LLWString utf8string_to_wstring(const std::string& utf8_string) { return utf8str_to_wstring(utf8_string); }
419 365
420// Special hack for llfilepicker.cpp: 366//
421S32 utf16chars_to_utf8chars(const U16* inchars, char* outchars, S32* nchars8 = 0);
422S32 utf16chars_to_wchar(const U16* inchars, llwchar* outchar);
423S32 wchar_to_utf8chars(llwchar inchar, char* outchars); 367S32 wchar_to_utf8chars(llwchar inchar, char* outchars);
424 368
425//
426std::string wstring_to_utf8str(const LLWString &utf32str, S32 len); 369std::string wstring_to_utf8str(const LLWString &utf32str, S32 len);
427std::string wstring_to_utf8str(const LLWString &utf32str); 370std::string wstring_to_utf8str(const LLWString &utf32str);
428 371
@@ -484,15 +427,6 @@ std::string mbcsstring_makeASCII(const std::string& str);
484std::string utf8str_removeCRLF(const std::string& utf8str); 427std::string utf8str_removeCRLF(const std::string& utf8str);
485 428
486 429
487template <class T>
488std::ostream& operator<<(std::ostream &s, const LLStringBase<T> &str)
489{
490 s << ((std::basic_string<T>)str);
491 return s;
492}
493
494std::ostream& operator<<(std::ostream &s, const LLWString &wstr);
495
496#if LL_WINDOWS 430#if LL_WINDOWS
497/* @name Windows string helpers 431/* @name Windows string helpers
498 */ 432 */
@@ -528,7 +462,7 @@ std::string ll_convert_wide_to_string(const wchar_t* in);
528#endif // LL_WINDOWS 462#endif // LL_WINDOWS
529 463
530/** 464/**
531 * Many of the 'strip' and 'replace' methods of LLStringBase need 465 * Many of the 'strip' and 'replace' methods of LLStringUtilBase need
532 * specialization to work with the signed char type. 466 * specialization to work with the signed char type.
533 * Sadly, it is not possible (AFAIK) to specialize a single method of 467 * Sadly, it is not possible (AFAIK) to specialize a single method of
534 * a template class. 468 * a template class.
@@ -581,30 +515,68 @@ namespace LLStringFn
581 */ 515 */
582 void replace_nonprintable_and_pipe(std::basic_string<llwchar>& str, 516 void replace_nonprintable_and_pipe(std::basic_string<llwchar>& str,
583 llwchar replacement); 517 llwchar replacement);
518
519 /**
520 * @brief Remove all characters that are not allowed in XML 1.0.
521 * Returns a copy of the string with those characters removed.
522 * Works with US ASCII and UTF-8 encoded strings. JC
523 */
524 std::string strip_invalid_xml(const std::string& input);
584} 525}
585 526
586//////////////////////////////////////////////////////////// 527////////////////////////////////////////////////////////////
587 528
529// LLStringBase::format()
530//
531// This function takes a string 's' and a map 'fmt_map' of strings-to-strings.
532// All occurances of strings in 's' from the left-hand side of 'fmt_map' are
533// then replaced with the corresponding right-hand side of 'fmt_map', non-
534// recursively. The function returns the number of substitutions made.
535
588// static 536// static
589template<class T> 537template<class T>
590S32 LLStringBase<T>::format(std::basic_string<T>& s, const format_map_t& fmt_map) 538S32 LLStringUtilBase<T>::format(std::basic_string<T>& s, const format_map_t& fmt_map)
591{ 539{
592 typedef typename std::basic_string<T>::size_type string_size_type_t; 540 typedef typename std::basic_string<T>::size_type string_size_type_t;
541 string_size_type_t scanstart = 0;
593 S32 res = 0; 542 S32 res = 0;
594 for (format_map_t::const_iterator iter = fmt_map.begin(); iter != fmt_map.end(); ++iter) 543
544 // Look for the first match of any keyword, replace that keyword,
545 // repeat from the end of the replacement string. This avoids
546 // accidentally performing substitution on a substituted string.
547 while (1)
595 { 548 {
596 U32 fmtlen = iter->first.size(); 549 string_size_type_t first_match_pos = scanstart;
597 string_size_type_t n = 0; 550 string_size_type_t first_match_str_length = 0;
598 while (1) 551 std::basic_string<T> first_match_str_replacement;
552
553 for (format_map_t::const_iterator iter = fmt_map.begin();
554 iter != fmt_map.end();
555 ++iter)
599 { 556 {
600 n = s.find(iter->first, n); 557 string_size_type_t n = s.find(iter->first, scanstart);
601 if (n == std::basic_string<T>::npos) 558 if (n != std::basic_string<T>::npos &&
559 (n < first_match_pos ||
560 0 == first_match_str_length))
602 { 561 {
603 break; 562 first_match_pos = n;
563 first_match_str_length = iter->first.length();
564 first_match_str_replacement = iter->second;
604 } 565 }
605 s.erase(n, fmtlen); 566 }
606 s.insert(n, iter->second); 567
607 n += fmtlen; 568 if (0 == first_match_str_length)
569 {
570 // no more keys found to substitute from this point
571 // in the string forward.
572 break;
573 }
574 else
575 {
576 s.erase(first_match_pos, first_match_str_length);
577 s.insert(first_match_pos, first_match_str_replacement);
578 scanstart = first_match_pos +
579 first_match_str_replacement.length();
608 ++res; 580 ++res;
609 } 581 }
610 } 582 }
@@ -613,7 +585,7 @@ S32 LLStringBase<T>::format(std::basic_string<T>& s, const format_map_t& fmt_map
613 585
614// static 586// static
615template<class T> 587template<class T>
616S32 LLStringBase<T>::compareStrings(const T* lhs, const T* rhs) 588S32 LLStringUtilBase<T>::compareStrings(const T* lhs, const T* rhs)
617{ 589{
618 S32 result; 590 S32 result;
619 if( lhs == rhs ) 591 if( lhs == rhs )
@@ -637,9 +609,16 @@ S32 LLStringBase<T>::compareStrings(const T* lhs, const T* rhs)
637 return result; 609 return result;
638} 610}
639 611
612//static
613template<class T>
614S32 LLStringUtilBase<T>::compareStrings(const std::basic_string<T>& lhs, const std::basic_string<T>& rhs)
615{
616 return LLStringOps::collate(lhs.c_str(), rhs.c_str());
617}
618
640// static 619// static
641template<class T> 620template<class T>
642S32 LLStringBase<T>::compareInsensitive(const T* lhs, const T* rhs ) 621S32 LLStringUtilBase<T>::compareInsensitive(const T* lhs, const T* rhs )
643{ 622{
644 S32 result; 623 S32 result;
645 if( lhs == rhs ) 624 if( lhs == rhs )
@@ -658,22 +637,32 @@ S32 LLStringBase<T>::compareInsensitive(const T* lhs, const T* rhs )
658 } 637 }
659 else 638 else
660 { 639 {
661 LLStringBase<T> lhs_string(lhs); 640 std::basic_string<T> lhs_string(lhs);
662 LLStringBase<T> rhs_string(rhs); 641 std::basic_string<T> rhs_string(rhs);
663 LLStringBase<T>::toUpper(lhs_string); 642 LLStringUtilBase<T>::toUpper(lhs_string);
664 LLStringBase<T>::toUpper(rhs_string); 643 LLStringUtilBase<T>::toUpper(rhs_string);
665 result = LLStringOps::collate(lhs_string.c_str(), rhs_string.c_str()); 644 result = LLStringOps::collate(lhs_string.c_str(), rhs_string.c_str());
666 } 645 }
667 return result; 646 return result;
668} 647}
669 648
649//static
650template<class T>
651S32 LLStringUtilBase<T>::compareInsensitive(const std::basic_string<T>& lhs, const std::basic_string<T>& rhs)
652{
653 std::basic_string<T> lhs_string(lhs);
654 std::basic_string<T> rhs_string(rhs);
655 LLStringUtilBase<T>::toUpper(lhs_string);
656 LLStringUtilBase<T>::toUpper(rhs_string);
657 return LLStringOps::collate(lhs_string.c_str(), rhs_string.c_str());
658}
670 659
671// Case sensitive comparison with good handling of numbers. Does not use current locale. 660// Case sensitive comparison with good handling of numbers. Does not use current locale.
672// a.k.a. strdictcmp() 661// a.k.a. strdictcmp()
673 662
674//static 663//static
675template<class T> 664template<class T>
676S32 LLStringBase<T>::compareDict(const std::basic_string<T>& astr, const std::basic_string<T>& bstr) 665S32 LLStringUtilBase<T>::compareDict(const std::basic_string<T>& astr, const std::basic_string<T>& bstr)
677{ 666{
678 const T* a = astr.c_str(); 667 const T* a = astr.c_str();
679 const T* b = bstr.c_str(); 668 const T* b = bstr.c_str();
@@ -712,8 +701,9 @@ S32 LLStringBase<T>::compareDict(const std::basic_string<T>& astr, const std::ba
712 return ca-cb; 701 return ca-cb;
713} 702}
714 703
704// static
715template<class T> 705template<class T>
716S32 LLStringBase<T>::compareDictInsensitive(const std::basic_string<T>& astr, const std::basic_string<T>& bstr) 706S32 LLStringUtilBase<T>::compareDictInsensitive(const std::basic_string<T>& astr, const std::basic_string<T>& bstr)
717{ 707{
718 const T* a = astr.c_str(); 708 const T* a = astr.c_str();
719 const T* b = bstr.c_str(); 709 const T* b = bstr.c_str();
@@ -748,11 +738,11 @@ S32 LLStringBase<T>::compareDictInsensitive(const std::basic_string<T>& astr, co
748// Puts compareDict() in a form appropriate for LL container classes to use for sorting. 738// Puts compareDict() in a form appropriate for LL container classes to use for sorting.
749// static 739// static
750template<class T> 740template<class T>
751BOOL LLStringBase<T>::precedesDict( const std::basic_string<T>& a, const std::basic_string<T>& b ) 741BOOL LLStringUtilBase<T>::precedesDict( const std::basic_string<T>& a, const std::basic_string<T>& b )
752{ 742{
753 if( a.size() && b.size() ) 743 if( a.size() && b.size() )
754 { 744 {
755 return (LLStringBase<T>::compareDict(a.c_str(), b.c_str()) < 0); 745 return (LLStringUtilBase<T>::compareDict(a.c_str(), b.c_str()) < 0);
756 } 746 }
757 else 747 else
758 { 748 {
@@ -760,108 +750,9 @@ BOOL LLStringBase<T>::precedesDict( const std::basic_string<T>& a, const std::ba
760 } 750 }
761} 751}
762 752
763// Constructors
764template<class T>
765LLStringBase<T>::LLStringBase(const T* s ) : std::basic_string<T>()
766{
767 if (s) assign(s);
768}
769
770template<class T>
771LLStringBase<T>::LLStringBase(const T* s, size_type n ) : std::basic_string<T>()
772{
773 if (s) assign(s, n);
774}
775
776// Init from a substring
777template<class T>
778LLStringBase<T>::LLStringBase(const T* s, size_type pos, size_type n ) : std::basic_string<T>()
779{
780 if( s )
781 {
782 assign(s + pos, n);
783 }
784 else
785 {
786 assign(LLStringBase<T>::null);
787 }
788}
789
790#if LL_LINUX || LL_SOLARIS
791template<class T>
792LLStringBase<T>& LLStringBase<T>::assign(const T* s)
793{
794 if (s)
795 {
796 std::basic_string<T>::assign(s);
797 }
798 else
799 {
800 assign(LLStringBase<T>::null);
801 }
802 return *this;
803}
804
805template<class T>
806LLStringBase<T>& LLStringBase<T>::assign(const T* s, size_type n)
807{
808 if (s)
809 {
810 std::basic_string<T>::assign(s, n);
811 }
812 else
813 {
814 assign(LLStringBase<T>::null);
815 }
816 return *this;
817}
818
819template<class T>
820LLStringBase<T>& LLStringBase<T>::assign(const LLStringBase<T>& s)
821{
822 std::basic_string<T>::assign(s);
823 return *this;
824}
825
826template<class T>
827LLStringBase<T>& LLStringBase<T>::assign(size_type n, const T& c)
828{
829 std::basic_string<T>::assign(n, c);
830 return *this;
831}
832
833template<class T>
834LLStringBase<T>& LLStringBase<T>::assign(const T* a, const T* b)
835{
836 if (a > b)
837 assign(LLStringBase<T>::null);
838 else
839 assign(a, (size_type) (b-a));
840 return *this;
841}
842
843template<class T>
844LLStringBase<T>& LLStringBase<T>::assign(typename LLStringBase<T>::iterator &it1, typename LLStringBase<T>::iterator &it2)
845{
846 assign(LLStringBase<T>::null);
847 while(it1 != it2)
848 *this += *it1++;
849 return *this;
850}
851
852template<class T>
853LLStringBase<T>& LLStringBase<T>::assign(typename LLStringBase<T>::const_iterator &it1, typename LLStringBase<T>::const_iterator &it2)
854{
855 assign(LLStringBase<T>::null);
856 while(it1 != it2)
857 *this += *it1++;
858 return *this;
859}
860#endif
861
862//static 753//static
863template<class T> 754template<class T>
864void LLStringBase<T>::toUpper(std::basic_string<T>& string) 755void LLStringUtilBase<T>::toUpper(std::basic_string<T>& string)
865{ 756{
866 if( !string.empty() ) 757 if( !string.empty() )
867 { 758 {
@@ -875,7 +766,7 @@ void LLStringBase<T>::toUpper(std::basic_string<T>& string)
875 766
876//static 767//static
877template<class T> 768template<class T>
878void LLStringBase<T>::toLower(std::basic_string<T>& string) 769void LLStringUtilBase<T>::toLower(std::basic_string<T>& string)
879{ 770{
880 if( !string.empty() ) 771 if( !string.empty() )
881 { 772 {
@@ -889,7 +780,7 @@ void LLStringBase<T>::toLower(std::basic_string<T>& string)
889 780
890//static 781//static
891template<class T> 782template<class T>
892void LLStringBase<T>::trimHead(std::basic_string<T>& string) 783void LLStringUtilBase<T>::trimHead(std::basic_string<T>& string)
893{ 784{
894 if( !string.empty() ) 785 if( !string.empty() )
895 { 786 {
@@ -904,7 +795,7 @@ void LLStringBase<T>::trimHead(std::basic_string<T>& string)
904 795
905//static 796//static
906template<class T> 797template<class T>
907void LLStringBase<T>::trimTail(std::basic_string<T>& string) 798void LLStringUtilBase<T>::trimTail(std::basic_string<T>& string)
908{ 799{
909 if( string.size() ) 800 if( string.size() )
910 { 801 {
@@ -923,7 +814,7 @@ void LLStringBase<T>::trimTail(std::basic_string<T>& string)
923// Replace line feeds with carriage return-line feed pairs. 814// Replace line feeds with carriage return-line feed pairs.
924//static 815//static
925template<class T> 816template<class T>
926void LLStringBase<T>::addCRLF(std::basic_string<T>& string) 817void LLStringUtilBase<T>::addCRLF(std::basic_string<T>& string)
927{ 818{
928 const T LF = 10; 819 const T LF = 10;
929 const T CR = 13; 820 const T CR = 13;
@@ -964,7 +855,7 @@ void LLStringBase<T>::addCRLF(std::basic_string<T>& string)
964// Remove all carriage returns 855// Remove all carriage returns
965//static 856//static
966template<class T> 857template<class T>
967void LLStringBase<T>::removeCRLF(std::basic_string<T>& string) 858void LLStringUtilBase<T>::removeCRLF(std::basic_string<T>& string)
968{ 859{
969 const T CR = 13; 860 const T CR = 13;
970 861
@@ -985,7 +876,7 @@ void LLStringBase<T>::removeCRLF(std::basic_string<T>& string)
985 876
986//static 877//static
987template<class T> 878template<class T>
988void LLStringBase<T>::replaceChar( std::basic_string<T>& string, T target, T replacement ) 879void LLStringUtilBase<T>::replaceChar( std::basic_string<T>& string, T target, T replacement )
989{ 880{
990 size_type found_pos = 0; 881 size_type found_pos = 0;
991 for (found_pos = string.find(target, found_pos); 882 for (found_pos = string.find(target, found_pos);
@@ -998,7 +889,7 @@ void LLStringBase<T>::replaceChar( std::basic_string<T>& string, T target, T rep
998 889
999//static 890//static
1000template<class T> 891template<class T>
1001void LLStringBase<T>::replaceNonstandardASCII( std::basic_string<T>& string, T replacement ) 892void LLStringUtilBase<T>::replaceNonstandardASCII( std::basic_string<T>& string, T replacement )
1002{ 893{
1003 const char LF = 10; 894 const char LF = 10;
1004 const S8 MIN = 32; 895 const S8 MIN = 32;
@@ -1018,12 +909,12 @@ void LLStringBase<T>::replaceNonstandardASCII( std::basic_string<T>& string, T r
1018 909
1019//static 910//static
1020template<class T> 911template<class T>
1021void LLStringBase<T>::replaceTabsWithSpaces( std::basic_string<T>& str, size_type spaces_per_tab ) 912void LLStringUtilBase<T>::replaceTabsWithSpaces( std::basic_string<T>& str, size_type spaces_per_tab )
1022{ 913{
1023 const T TAB = '\t'; 914 const T TAB = '\t';
1024 const T SPACE = ' '; 915 const T SPACE = ' ';
1025 916
1026 LLStringBase<T> out_str; 917 std::basic_string<T> out_str;
1027 // Replace tabs with spaces 918 // Replace tabs with spaces
1028 for (size_type i = 0; i < str.length(); i++) 919 for (size_type i = 0; i < str.length(); i++)
1029 { 920 {
@@ -1042,7 +933,7 @@ void LLStringBase<T>::replaceTabsWithSpaces( std::basic_string<T>& str, size_typ
1042 933
1043//static 934//static
1044template<class T> 935template<class T>
1045BOOL LLStringBase<T>::containsNonprintable(const std::basic_string<T>& string) 936BOOL LLStringUtilBase<T>::containsNonprintable(const std::basic_string<T>& string)
1046{ 937{
1047 const char MIN = 32; 938 const char MIN = 32;
1048 BOOL rv = FALSE; 939 BOOL rv = FALSE;
@@ -1059,7 +950,7 @@ BOOL LLStringBase<T>::containsNonprintable(const std::basic_string<T>& string)
1059 950
1060//static 951//static
1061template<class T> 952template<class T>
1062void LLStringBase<T>::stripNonprintable(std::basic_string<T>& string) 953void LLStringUtilBase<T>::stripNonprintable(std::basic_string<T>& string)
1063{ 954{
1064 const char MIN = 32; 955 const char MIN = 32;
1065 size_type j = 0; 956 size_type j = 0;
@@ -1090,7 +981,7 @@ void LLStringBase<T>::stripNonprintable(std::basic_string<T>& string)
1090} 981}
1091 982
1092template<class T> 983template<class T>
1093void LLStringBase<T>::_makeASCII(std::basic_string<T>& string) 984void LLStringUtilBase<T>::_makeASCII(std::basic_string<T>& string)
1094{ 985{
1095 // Replace non-ASCII chars with LL_UNKNOWN_CHAR 986 // Replace non-ASCII chars with LL_UNKNOWN_CHAR
1096 for (size_type i = 0; i < string.length(); i++) 987 for (size_type i = 0; i < string.length(); i++)
@@ -1104,7 +995,7 @@ void LLStringBase<T>::_makeASCII(std::basic_string<T>& string)
1104 995
1105// static 996// static
1106template<class T> 997template<class T>
1107void LLStringBase<T>::copy( T* dst, const T* src, size_type dst_size ) 998void LLStringUtilBase<T>::copy( T* dst, const T* src, size_type dst_size )
1108{ 999{
1109 if( dst_size > 0 ) 1000 if( dst_size > 0 )
1110 { 1001 {
@@ -1120,7 +1011,7 @@ void LLStringBase<T>::copy( T* dst, const T* src, size_type dst_size )
1120 1011
1121// static 1012// static
1122template<class T> 1013template<class T>
1123void LLStringBase<T>::copyInto(std::basic_string<T>& dst, const std::basic_string<T>& src, size_type offset) 1014void LLStringUtilBase<T>::copyInto(std::basic_string<T>& dst, const std::basic_string<T>& src, size_type offset)
1124{ 1015{
1125 if ( offset == dst.length() ) 1016 if ( offset == dst.length() )
1126 { 1017 {
@@ -1141,7 +1032,7 @@ void LLStringBase<T>::copyInto(std::basic_string<T>& dst, const std::basic_strin
1141// True if this is the head of s. 1032// True if this is the head of s.
1142//static 1033//static
1143template<class T> 1034template<class T>
1144BOOL LLStringBase<T>::isHead( const std::basic_string<T>& string, const T* s ) 1035BOOL LLStringUtilBase<T>::isHead( const std::basic_string<T>& string, const T* s )
1145{ 1036{
1146 if( string.empty() ) 1037 if( string.empty() )
1147 { 1038 {
@@ -1155,14 +1046,14 @@ BOOL LLStringBase<T>::isHead( const std::basic_string<T>& string, const T* s )
1155} 1046}
1156 1047
1157template<class T> 1048template<class T>
1158BOOL LLStringBase<T>::convertToBOOL(const std::basic_string<T>& string, BOOL& value) 1049BOOL LLStringUtilBase<T>::convertToBOOL(const std::basic_string<T>& string, BOOL& value)
1159{ 1050{
1160 if( string.empty() ) 1051 if( string.empty() )
1161 { 1052 {
1162 return FALSE; 1053 return FALSE;
1163 } 1054 }
1164 1055
1165 LLStringBase<T> temp( string ); 1056 std::basic_string<T> temp( string );
1166 trim(temp); 1057 trim(temp);
1167 if( 1058 if(
1168 (temp == "1") || 1059 (temp == "1") ||
@@ -1192,7 +1083,7 @@ BOOL LLStringBase<T>::convertToBOOL(const std::basic_string<T>& string, BOOL& va
1192} 1083}
1193 1084
1194template<class T> 1085template<class T>
1195BOOL LLStringBase<T>::convertToU8(const std::basic_string<T>& string, U8& value) 1086BOOL LLStringUtilBase<T>::convertToU8(const std::basic_string<T>& string, U8& value)
1196{ 1087{
1197 S32 value32 = 0; 1088 S32 value32 = 0;
1198 BOOL success = convertToS32(string, value32); 1089 BOOL success = convertToS32(string, value32);
@@ -1205,7 +1096,7 @@ BOOL LLStringBase<T>::convertToU8(const std::basic_string<T>& string, U8& value)
1205} 1096}
1206 1097
1207template<class T> 1098template<class T>
1208BOOL LLStringBase<T>::convertToS8(const std::basic_string<T>& string, S8& value) 1099BOOL LLStringUtilBase<T>::convertToS8(const std::basic_string<T>& string, S8& value)
1209{ 1100{
1210 S32 value32 = 0; 1101 S32 value32 = 0;
1211 BOOL success = convertToS32(string, value32); 1102 BOOL success = convertToS32(string, value32);
@@ -1218,7 +1109,7 @@ BOOL LLStringBase<T>::convertToS8(const std::basic_string<T>& string, S8& value)
1218} 1109}
1219 1110
1220template<class T> 1111template<class T>
1221BOOL LLStringBase<T>::convertToS16(const std::basic_string<T>& string, S16& value) 1112BOOL LLStringUtilBase<T>::convertToS16(const std::basic_string<T>& string, S16& value)
1222{ 1113{
1223 S32 value32 = 0; 1114 S32 value32 = 0;
1224 BOOL success = convertToS32(string, value32); 1115 BOOL success = convertToS32(string, value32);
@@ -1231,7 +1122,7 @@ BOOL LLStringBase<T>::convertToS16(const std::basic_string<T>& string, S16& valu
1231} 1122}
1232 1123
1233template<class T> 1124template<class T>
1234BOOL LLStringBase<T>::convertToU16(const std::basic_string<T>& string, U16& value) 1125BOOL LLStringUtilBase<T>::convertToU16(const std::basic_string<T>& string, U16& value)
1235{ 1126{
1236 S32 value32 = 0; 1127 S32 value32 = 0;
1237 BOOL success = convertToS32(string, value32); 1128 BOOL success = convertToS32(string, value32);
@@ -1244,14 +1135,14 @@ BOOL LLStringBase<T>::convertToU16(const std::basic_string<T>& string, U16& valu
1244} 1135}
1245 1136
1246template<class T> 1137template<class T>
1247BOOL LLStringBase<T>::convertToU32(const std::basic_string<T>& string, U32& value) 1138BOOL LLStringUtilBase<T>::convertToU32(const std::basic_string<T>& string, U32& value)
1248{ 1139{
1249 if( string.empty() ) 1140 if( string.empty() )
1250 { 1141 {
1251 return FALSE; 1142 return FALSE;
1252 } 1143 }
1253 1144
1254 LLStringBase<T> temp( string ); 1145 std::basic_string<T> temp( string );
1255 trim(temp); 1146 trim(temp);
1256 U32 v; 1147 U32 v;
1257 std::basic_istringstream<T> i_stream((std::basic_string<T>)temp); 1148 std::basic_istringstream<T> i_stream((std::basic_string<T>)temp);
@@ -1271,14 +1162,14 @@ BOOL LLStringBase<T>::convertToU32(const std::basic_string<T>& string, U32& valu
1271} 1162}
1272 1163
1273template<class T> 1164template<class T>
1274BOOL LLStringBase<T>::convertToS32(const std::basic_string<T>& string, S32& value) 1165BOOL LLStringUtilBase<T>::convertToS32(const std::basic_string<T>& string, S32& value)
1275{ 1166{
1276 if( string.empty() ) 1167 if( string.empty() )
1277 { 1168 {
1278 return FALSE; 1169 return FALSE;
1279 } 1170 }
1280 1171
1281 LLStringBase<T> temp( string ); 1172 std::basic_string<T> temp( string );
1282 trim(temp); 1173 trim(temp);
1283 S32 v; 1174 S32 v;
1284 std::basic_istringstream<T> i_stream((std::basic_string<T>)temp); 1175 std::basic_istringstream<T> i_stream((std::basic_string<T>)temp);
@@ -1298,7 +1189,7 @@ BOOL LLStringBase<T>::convertToS32(const std::basic_string<T>& string, S32& valu
1298} 1189}
1299 1190
1300template<class T> 1191template<class T>
1301BOOL LLStringBase<T>::convertToF32(const std::basic_string<T>& string, F32& value) 1192BOOL LLStringUtilBase<T>::convertToF32(const std::basic_string<T>& string, F32& value)
1302{ 1193{
1303 F64 value64 = 0.0; 1194 F64 value64 = 0.0;
1304 BOOL success = convertToF64(string, value64); 1195 BOOL success = convertToF64(string, value64);
@@ -1311,14 +1202,14 @@ BOOL LLStringBase<T>::convertToF32(const std::basic_string<T>& string, F32& valu
1311} 1202}
1312 1203
1313template<class T> 1204template<class T>
1314BOOL LLStringBase<T>::convertToF64(const std::basic_string<T>& string, F64& value) 1205BOOL LLStringUtilBase<T>::convertToF64(const std::basic_string<T>& string, F64& value)
1315{ 1206{
1316 if( string.empty() ) 1207 if( string.empty() )
1317 { 1208 {
1318 return FALSE; 1209 return FALSE;
1319 } 1210 }
1320 1211
1321 LLStringBase<T> temp( string ); 1212 std::basic_string<T> temp( string );
1322 trim(temp); 1213 trim(temp);
1323 F64 v; 1214 F64 v;
1324 std::basic_istringstream<T> i_stream((std::basic_string<T>)temp); 1215 std::basic_istringstream<T> i_stream((std::basic_string<T>)temp);
@@ -1338,7 +1229,7 @@ BOOL LLStringBase<T>::convertToF64(const std::basic_string<T>& string, F64& valu
1338} 1229}
1339 1230
1340template<class T> 1231template<class T>
1341void LLStringBase<T>::truncate(std::basic_string<T>& string, size_type count) 1232void LLStringUtilBase<T>::truncate(std::basic_string<T>& string, size_type count)
1342{ 1233{
1343 size_type cur_size = string.size(); 1234 size_type cur_size = string.size();
1344 string.resize(count < cur_size ? count : cur_size); 1235 string.resize(count < cur_size ? count : cur_size);
diff --git a/linden/indra/llcommon/llsys.cpp b/linden/indra/llcommon/llsys.cpp
index 1285851..cb2e34a 100644
--- a/linden/indra/llcommon/llsys.cpp
+++ b/linden/indra/llcommon/llsys.cpp
@@ -143,28 +143,22 @@ LLOSInfo::LLOSInfo() :
143 143
144 std::string csdversion = utf16str_to_utf8str(osvi.szCSDVersion); 144 std::string csdversion = utf16str_to_utf8str(osvi.szCSDVersion);
145 // Display version, service pack (if any), and build number. 145 // Display version, service pack (if any), and build number.
146 char tmp[MAX_STRING]; /* Flawfinder: ignore */ 146 std::string tmpstr;
147 if(osvi.dwMajorVersion <= 4) 147 if(osvi.dwMajorVersion <= 4)
148 { 148 {
149 snprintf( /* Flawfinder: ignore */ 149 tmpstr = llformat("version %d.%d %s (Build %d)",
150 tmp, 150 osvi.dwMajorVersion,
151 sizeof(tmp), 151 osvi.dwMinorVersion,
152 "version %d.%d %s (Build %d)", 152 csdversion.c_str(),
153 osvi.dwMajorVersion, 153 (osvi.dwBuildNumber & 0xffff));
154 osvi.dwMinorVersion,
155 csdversion.c_str(),
156 (osvi.dwBuildNumber & 0xffff));
157 } 154 }
158 else 155 else
159 { 156 {
160 snprintf( /* Flawfinder: ignore */ 157 tmpstr = llformat("%s (Build %d)",
161 tmp, 158 csdversion.c_str(),
162 sizeof(tmp), 159 (osvi.dwBuildNumber & 0xffff));
163 "%s (Build %d)",
164 csdversion.c_str(),
165 (osvi.dwBuildNumber & 0xffff));
166 } 160 }
167 mOSString = mOSStringSimple + tmp; 161 mOSString = mOSStringSimple + tmpstr;
168 } 162 }
169 break; 163 break;
170 164
@@ -397,7 +391,7 @@ LLCPUInfo::LLCPUInfo()
397 mCPUString = out.str(); 391 mCPUString = out.str();
398 392
399#elif LL_LINUX 393#elif LL_LINUX
400 std::map< LLString, LLString > cpuinfo; 394 std::map< std::string, std::string > cpuinfo;
401 LLFILE* cpuinfo_fp = LLFile::fopen(CPUINFO_FILE, "rb"); 395 LLFILE* cpuinfo_fp = LLFile::fopen(CPUINFO_FILE, "rb");
402 if(cpuinfo_fp) 396 if(cpuinfo_fp)
403 { 397 {
@@ -420,21 +414,21 @@ LLCPUInfo::LLCPUInfo()
420 if (nlspot == NULL) 414 if (nlspot == NULL)
421 nlspot = line + strlen( line ); // Fallback to terminating NUL 415 nlspot = line + strlen( line ); // Fallback to terminating NUL
422 std::string linename( line, tabspot ); 416 std::string linename( line, tabspot );
423 LLString llinename(linename); 417 std::string llinename(linename);
424 LLString::toLower(llinename); 418 LLStringUtil::toLower(llinename);
425 std::string lineval( spacespot + 1, nlspot ); 419 std::string lineval( spacespot + 1, nlspot );
426 cpuinfo[ llinename ] = lineval; 420 cpuinfo[ llinename ] = lineval;
427 } 421 }
428 fclose(cpuinfo_fp); 422 fclose(cpuinfo_fp);
429 } 423 }
430# if LL_X86 424# if LL_X86
431 LLString flags = " " + cpuinfo["flags"] + " "; 425 std::string flags = " " + cpuinfo["flags"] + " ";
432 LLString::toLower(flags); 426 LLStringUtil::toLower(flags);
433 mHasSSE = ( flags.find( " sse " ) != std::string::npos ); 427 mHasSSE = ( flags.find( " sse " ) != std::string::npos );
434 mHasSSE2 = ( flags.find( " sse2 " ) != std::string::npos ); 428 mHasSSE2 = ( flags.find( " sse2 " ) != std::string::npos );
435 429
436 F64 mhz; 430 F64 mhz;
437 if (LLString::convertToF64(cpuinfo["cpu mhz"], mhz) 431 if (LLStringUtil::convertToF64(cpuinfo["cpu mhz"], mhz)
438 && 200.0 < mhz && mhz < 10000.0) 432 && 200.0 < mhz && mhz < 10000.0)
439 { 433 {
440 mCPUMhz = (S32)llrint(mhz); 434 mCPUMhz = (S32)llrint(mhz);
@@ -658,18 +652,17 @@ std::ostream& operator<<(std::ostream& s, const LLMemoryInfo& info)
658 return s; 652 return s;
659} 653}
660 654
661BOOL gunzip_file(const char *srcfile, const char *dstfile) 655BOOL gunzip_file(const std::string& srcfile, const std::string& dstfile)
662{ 656{
663 char tmpfile[LL_MAX_PATH]; /* Flawfinder: ignore */ 657 std::string tmpfile;
664 const S32 UNCOMPRESS_BUFFER_SIZE = 32768; 658 const S32 UNCOMPRESS_BUFFER_SIZE = 32768;
665 BOOL retval = FALSE; 659 BOOL retval = FALSE;
666 gzFile src = NULL; 660 gzFile src = NULL;
667 U8 buffer[UNCOMPRESS_BUFFER_SIZE]; 661 U8 buffer[UNCOMPRESS_BUFFER_SIZE];
668 LLFILE *dst = NULL; 662 LLFILE *dst = NULL;
669 S32 bytes = 0; 663 S32 bytes = 0;
670 (void *) strcpy(tmpfile, dstfile); /* Flawfinder: ignore */ 664 tmpfile = dstfile + ".t";
671 (void *) strncat(tmpfile, ".t", sizeof(tmpfile) - strlen(tmpfile) -1); /* Flawfinder: ignore */ 665 src = gzopen(srcfile.c_str(), "rb");
672 src = gzopen(srcfile, "rb");
673 if (! src) goto err; 666 if (! src) goto err;
674 dst = LLFile::fopen(tmpfile, "wb"); /* Flawfinder: ignore */ 667 dst = LLFile::fopen(tmpfile, "wb"); /* Flawfinder: ignore */
675 if (! dst) goto err; 668 if (! dst) goto err;
@@ -693,18 +686,17 @@ err:
693 return retval; 686 return retval;
694} 687}
695 688
696BOOL gzip_file(const char *srcfile, const char *dstfile) 689BOOL gzip_file(const std::string& srcfile, const std::string& dstfile)
697{ 690{
698 const S32 COMPRESS_BUFFER_SIZE = 32768; 691 const S32 COMPRESS_BUFFER_SIZE = 32768;
699 char tmpfile[LL_MAX_PATH]; /* Flawfinder: ignore */ 692 std::string tmpfile;
700 BOOL retval = FALSE; 693 BOOL retval = FALSE;
701 U8 buffer[COMPRESS_BUFFER_SIZE]; 694 U8 buffer[COMPRESS_BUFFER_SIZE];
702 gzFile dst = NULL; 695 gzFile dst = NULL;
703 LLFILE *src = NULL; 696 LLFILE *src = NULL;
704 S32 bytes = 0; 697 S32 bytes = 0;
705 (void *) strcpy(tmpfile, dstfile); /* Flawfinder: ignore */ 698 tmpfile = dstfile + ".t";
706 (void *) strncat(tmpfile, ".t", sizeof(tmpfile) - strlen(tmpfile) -1); /* Flawfinder: ignore */ 699 dst = gzopen(tmpfile.c_str(), "wb"); /* Flawfinder: ignore */
707 dst = gzopen(tmpfile, "wb"); /* Flawfinder: ignore */
708 if (! dst) goto err; 700 if (! dst) goto err;
709 src = LLFile::fopen(srcfile, "rb"); /* Flawfinder: ignore */ 701 src = LLFile::fopen(srcfile, "rb"); /* Flawfinder: ignore */
710 if (! src) goto err; 702 if (! src) goto err;
diff --git a/linden/indra/llcommon/llsys.h b/linden/indra/llcommon/llsys.h
index da7f07e..b764ca9 100644
--- a/linden/indra/llcommon/llsys.h
+++ b/linden/indra/llcommon/llsys.h
@@ -127,9 +127,9 @@ std::ostream& operator<<(std::ostream& s, const LLCPUInfo& info);
127std::ostream& operator<<(std::ostream& s, const LLMemoryInfo& info); 127std::ostream& operator<<(std::ostream& s, const LLMemoryInfo& info);
128 128
129// gunzip srcfile into dstfile. Returns FALSE on error. 129// gunzip srcfile into dstfile. Returns FALSE on error.
130BOOL gunzip_file(const char *srcfile, const char *dstfile); 130BOOL gunzip_file(const std::string& srcfile, const std::string& dstfile);
131// gzip srcfile into dstfile. Returns FALSE on error. 131// gzip srcfile into dstfile. Returns FALSE on error.
132BOOL gzip_file(const char *srcfile, const char *dstfile); 132BOOL gzip_file(const std::string& srcfile, const std::string& dstfile);
133 133
134extern LLCPUInfo gSysCPU; 134extern LLCPUInfo gSysCPU;
135 135
diff --git a/linden/indra/llcommon/llthread.cpp b/linden/indra/llcommon/llthread.cpp
index 48ebc4b..e07170b 100644
--- a/linden/indra/llcommon/llthread.cpp
+++ b/linden/indra/llcommon/llthread.cpp
@@ -31,7 +31,7 @@
31#include "linden_common.h" 31#include "linden_common.h"
32#include "llapr.h" 32#include "llapr.h"
33 33
34#include "apr-1/apr_portable.h" 34#include "apr_portable.h"
35 35
36#include "llthread.h" 36#include "llthread.h"
37 37
diff --git a/linden/indra/llcommon/llthread.h b/linden/indra/llcommon/llthread.h
index 608b218..9da3134 100644
--- a/linden/indra/llcommon/llthread.h
+++ b/linden/indra/llcommon/llthread.h
@@ -36,7 +36,7 @@
36#include "llapp.h" 36#include "llapp.h"
37#include "llmemory.h" 37#include "llmemory.h"
38 38
39#include "apr-1/apr_thread_cond.h" 39#include "apr_thread_cond.h"
40 40
41class LLThread; 41class LLThread;
42class LLMutex; 42class LLMutex;
diff --git a/linden/indra/llcommon/lltimer.cpp b/linden/indra/llcommon/lltimer.cpp
index 25d9897..967570d 100644
--- a/linden/indra/llcommon/lltimer.cpp
+++ b/linden/indra/llcommon/lltimer.cpp
@@ -429,10 +429,9 @@ BOOL LLTimer::knownBadTimer()
429// 429//
430/////////////////////////////////////////////////////////////////////////////// 430///////////////////////////////////////////////////////////////////////////////
431 431
432U32 time_corrected() 432time_t time_corrected()
433{ 433{
434 U32 corrected_time = (U32)time(NULL) + gUTCOffset; 434 return time(NULL) + gUTCOffset;
435 return corrected_time;
436} 435}
437 436
438 437
@@ -452,27 +451,25 @@ BOOL is_daylight_savings()
452} 451}
453 452
454 453
455struct tm* utc_to_pacific_time(S32 utc_time, BOOL pacific_daylight_time) 454struct tm* utc_to_pacific_time(time_t utc_time, BOOL pacific_daylight_time)
456{ 455{
457 time_t unix_time = (time_t)utc_time;
458
459 S32 pacific_offset_hours; 456 S32 pacific_offset_hours;
460 if (pacific_daylight_time) 457 if (pacific_daylight_time)
461 { 458 {
462 pacific_offset_hours = -7; 459 pacific_offset_hours = 7;
463 } 460 }
464 else 461 else
465 { 462 {
466 pacific_offset_hours = -8; 463 pacific_offset_hours = 8;
467 } 464 }
468 465
469 // We subtract off the PST/PDT offset _before_ getting 466 // We subtract off the PST/PDT offset _before_ getting
470 // "UTC" time, because this will handle wrapping around 467 // "UTC" time, because this will handle wrapping around
471 // for 5 AM UTC -> 10 PM PDT of the previous day. 468 // for 5 AM UTC -> 10 PM PDT of the previous day.
472 unix_time += pacific_offset_hours * MIN_PER_HOUR * SEC_PER_MIN; 469 utc_time -= pacific_offset_hours * MIN_PER_HOUR * SEC_PER_MIN;
473 470
474 // Internal buffer to PST/PDT (see above) 471 // Internal buffer to PST/PDT (see above)
475 struct tm* internal_time = gmtime(&unix_time); 472 struct tm* internal_time = gmtime(&utc_time);
476 473
477 /* 474 /*
478 // Don't do this, this won't correctly tell you if daylight savings is active in CA or not. 475 // Don't do this, this won't correctly tell you if daylight savings is active in CA or not.
@@ -486,7 +483,7 @@ struct tm* utc_to_pacific_time(S32 utc_time, BOOL pacific_daylight_time)
486} 483}
487 484
488 485
489void microsecondsToTimecodeString(U64 current_time, char *tcstring) 486void microsecondsToTimecodeString(U64 current_time, std::string& tcstring)
490{ 487{
491 U64 hours; 488 U64 hours;
492 U64 minutes; 489 U64 minutes;
@@ -504,11 +501,11 @@ void microsecondsToTimecodeString(U64 current_time, char *tcstring)
504 subframes = current_time / (U64)42; 501 subframes = current_time / (U64)42;
505 subframes %= 100; 502 subframes %= 100;
506 503
507 sprintf(tcstring,"%3.3d:%2.2d:%2.2d:%2.2d.%2.2d",(int)hours,(int)minutes,(int)seconds,(int)frames,(int)subframes); /* Flawfinder: ignore */ 504 tcstring = llformat("%3.3d:%2.2d:%2.2d:%2.2d.%2.2d",(int)hours,(int)minutes,(int)seconds,(int)frames,(int)subframes);
508} 505}
509 506
510 507
511void secondsToTimecodeString(F32 current_time, char *tcstring) 508void secondsToTimecodeString(F32 current_time, std::string& tcstring)
512{ 509{
513 microsecondsToTimecodeString((U64)((F64)(SEC_TO_MICROSEC*current_time)), tcstring); 510 microsecondsToTimecodeString((U64)((F64)(SEC_TO_MICROSEC*current_time)), tcstring);
514} 511}
@@ -541,7 +538,7 @@ void LLEventTimer::updateClass()
541 { 538 {
542 LLEventTimer* timer = *iter++; 539 LLEventTimer* timer = *iter++;
543 F32 et = timer->mEventTimer.getElapsedTimeF32(); 540 F32 et = timer->mEventTimer.getElapsedTimeF32();
544 if (et > timer->mPeriod) { 541 if (timer->mEventTimer.getStarted() && et > timer->mPeriod) {
545 timer->mEventTimer.reset(); 542 timer->mEventTimer.reset();
546 if ( timer->tick() ) 543 if ( timer->tick() )
547 { 544 {
diff --git a/linden/indra/llcommon/lltimer.h b/linden/indra/llcommon/lltimer.h
index 91b93d6..8d94276 100644
--- a/linden/indra/llcommon/lltimer.h
+++ b/linden/indra/llcommon/lltimer.h
@@ -35,6 +35,7 @@
35#if LL_LINUX || LL_DARWIN 35#if LL_LINUX || LL_DARWIN
36#include <sys/time.h> 36#include <sys/time.h>
37#endif 37#endif
38#include <limits.h>
38 39
39#include "stdtypes.h" 40#include "stdtypes.h"
40 41
@@ -117,7 +118,35 @@ void ms_sleep(U32 ms);
117 118
118// Returns the correct UTC time in seconds, like time(NULL). 119// Returns the correct UTC time in seconds, like time(NULL).
119// Useful on the viewer, which may have its local clock set wrong. 120// Useful on the viewer, which may have its local clock set wrong.
120U32 time_corrected(); 121time_t time_corrected();
122
123static inline time_t time_min()
124{
125 if (sizeof(time_t) == 4)
126 {
127 return (time_t) INT_MIN;
128 } else {
129#ifdef LLONG_MIN
130 return (time_t) LLONG_MIN;
131#else
132 return (time_t) LONG_MIN;
133#endif
134 }
135}
136
137static inline time_t time_max()
138{
139 if (sizeof(time_t) == 4)
140 {
141 return (time_t) INT_MAX;
142 } else {
143#ifdef LLONG_MAX
144 return (time_t) LLONG_MAX;
145#else
146 return (time_t) LONG_MAX;
147#endif
148 }
149}
121 150
122// Correction factor used by time_corrected() above. 151// Correction factor used by time_corrected() above.
123extern S32 gUTCOffset; 152extern S32 gUTCOffset;
@@ -131,10 +160,10 @@ BOOL is_daylight_savings();
131// S32 utc_time; 160// S32 utc_time;
132// utc_time = time_corrected(); 161// utc_time = time_corrected();
133// struct tm* internal_time = utc_to_pacific_time(utc_time, gDaylight); 162// struct tm* internal_time = utc_to_pacific_time(utc_time, gDaylight);
134struct tm* utc_to_pacific_time(S32 utc_time, BOOL pacific_daylight_time); 163struct tm* utc_to_pacific_time(time_t utc_time, BOOL pacific_daylight_time);
135 164
136void microsecondsToTimecodeString(U64 current_time, char *tcstring); 165void microsecondsToTimecodeString(U64 current_time, std::string& tcstring);
137void secondsToTimecodeString(F32 current_time, char *tcstring); 166void secondsToTimecodeString(F32 current_time, std::string& tcstring);
138 167
139// class for scheduling a function to be called at a given frequency (approximate, inprecise) 168// class for scheduling a function to be called at a given frequency (approximate, inprecise)
140class LLEventTimer 169class LLEventTimer
diff --git a/linden/indra/llcommon/lluri.cpp b/linden/indra/llcommon/lluri.cpp
index 7db8f3b..b83036b 100644
--- a/linden/indra/llcommon/lluri.cpp
+++ b/linden/indra/llcommon/lluri.cpp
@@ -38,7 +38,7 @@
38#include "llsd.h" 38#include "llsd.h"
39#include <iomanip> 39#include <iomanip>
40 40
41#include "../llmath/lluuid.h" 41#include "lluuid.h"
42 42
43// system includes 43// system includes
44#include <boost/tokenizer.hpp> 44#include <boost/tokenizer.hpp>
diff --git a/linden/indra/llmath/lluuid.cpp b/linden/indra/llcommon/lluuid.cpp
index d835cbc..7e4eb50 100644
--- a/linden/indra/llmath/lluuid.cpp
+++ b/linden/indra/llcommon/lluuid.cpp
@@ -149,9 +149,9 @@ U32 janky_fast_random_seeded_bytes(U32 seed, U32 val)
149#endif 149#endif
150 150
151// Common to all UUID implementations 151// Common to all UUID implementations
152void LLUUID::toString(char *out) const 152void LLUUID::toString(std::string& out) const
153{ 153{
154 sprintf(out, 154 out = llformat(
155 "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x", 155 "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x",
156 (U8)(mData[0]), 156 (U8)(mData[0]),
157 (U8)(mData[1]), 157 (U8)(mData[1]),
@@ -171,6 +171,23 @@ void LLUUID::toString(char *out) const
171 (U8)(mData[15])); 171 (U8)(mData[15]));
172} 172}
173 173
174// *TODO: deprecate
175void LLUUID::toString(char *out) const
176{
177 std::string buffer;
178 toString(buffer);
179 strcpy(out,buffer.c_str()); /* Flawfinder: ignore */
180}
181
182void LLUUID::toCompressedString(std::string& out) const
183{
184 char bytes[UUID_BYTES+1];
185 memcpy(bytes, mData, UUID_BYTES); /* Flawfinder: ignore */
186 bytes[UUID_BYTES] = '\0';
187 out.assign(bytes, UUID_BYTES);
188}
189
190// *TODO: deprecate
174void LLUUID::toCompressedString(char *out) const 191void LLUUID::toCompressedString(char *out) const
175{ 192{
176 memcpy(out, mData, UUID_BYTES); /* Flawfinder: ignore */ 193 memcpy(out, mData, UUID_BYTES); /* Flawfinder: ignore */
@@ -184,38 +201,32 @@ std::string LLUUID::getString() const
184 201
185std::string LLUUID::asString() const 202std::string LLUUID::asString() const
186{ 203{
187 char str[UUID_STR_SIZE]; /* Flawfinder: ignore */ 204 std::string str;
188 toString(str); 205 toString(str);
189 return std::string(str); 206 return str;
190} 207}
191 208
192BOOL LLUUID::set(const std::string& in_string, BOOL emit) 209BOOL LLUUID::set(const char* in_string, BOOL emit)
193{ 210{
194 return set(in_string.c_str(), emit); 211 return set(ll_safe_string(in_string));
195} 212}
196 213
197BOOL LLUUID::set(const char *in_string, BOOL emit) 214BOOL LLUUID::set(const std::string& in_string, BOOL emit)
198{ 215{
199 BOOL broken_format = FALSE; 216 BOOL broken_format = FALSE;
200 if (!in_string)
201 {
202 llerrs << "No string pointer in LLUUID::set!" << llendl;
203 setNull();
204 return FALSE;
205 }
206 217
207 // empty strings should make NULL uuid 218 // empty strings should make NULL uuid
208 if (!in_string[0]) 219 if (in_string.empty())
209 { 220 {
210 setNull(); 221 setNull();
211 return TRUE; 222 return TRUE;
212 } 223 }
213 224
214 if (strlen(in_string) != (UUID_STR_LENGTH - 1)) /* Flawfinder: ignore */ 225 if (in_string.length() != (UUID_STR_LENGTH - 1)) /* Flawfinder: ignore */
215 { 226 {
216 // I'm a moron. First implementation didn't have the right UUID format. 227 // I'm a moron. First implementation didn't have the right UUID format.
217 // Shouldn't see any of these any more 228 // Shouldn't see any of these any more
218 if (strlen(in_string) == (UUID_STR_LENGTH - 2)) /* Flawfinder: ignore */ 229 if (in_string.length() == (UUID_STR_LENGTH - 2)) /* Flawfinder: ignore */
219 { 230 {
220 if(emit) 231 if(emit)
221 { 232 {
@@ -251,17 +262,17 @@ BOOL LLUUID::set(const char *in_string, BOOL emit)
251 262
252 mData[i] = 0; 263 mData[i] = 0;
253 264
254 if ((*(in_string + cur_pos) >= '0') && (*(in_string+cur_pos) <= '9')) 265 if ((in_string[cur_pos] >= '0') && (in_string[cur_pos] <= '9'))
255 { 266 {
256 mData[i] += (U8)(*(in_string + cur_pos) - '0'); 267 mData[i] += (U8)(in_string[cur_pos] - '0');
257 } 268 }
258 else if ((*(in_string + cur_pos) >= 'a') && (*(in_string+cur_pos) <='f')) 269 else if ((in_string[cur_pos] >= 'a') && (in_string[cur_pos] <='f'))
259 { 270 {
260 mData[i] += (U8)(10 + *(in_string + cur_pos) - 'a'); 271 mData[i] += (U8)(10 + in_string[cur_pos] - 'a');
261 } 272 }
262 else if ((*(in_string + cur_pos) >= 'A') && (*(in_string+cur_pos) <='F')) 273 else if ((in_string[cur_pos] >= 'A') && (in_string[cur_pos] <='F'))
263 { 274 {
264 mData[i] += (U8)(10 + *(in_string + cur_pos) - 'A'); 275 mData[i] += (U8)(10 + in_string[cur_pos] - 'A');
265 } 276 }
266 else 277 else
267 { 278 {
@@ -276,17 +287,17 @@ BOOL LLUUID::set(const char *in_string, BOOL emit)
276 mData[i] = mData[i] << 4; 287 mData[i] = mData[i] << 4;
277 cur_pos++; 288 cur_pos++;
278 289
279 if ((*(in_string + cur_pos) >= '0') && (*(in_string+cur_pos) <= '9')) 290 if ((in_string[cur_pos] >= '0') && (in_string[cur_pos] <= '9'))
280 { 291 {
281 mData[i] += (U8)(*(in_string + cur_pos) - '0'); 292 mData[i] += (U8)(in_string[cur_pos] - '0');
282 } 293 }
283 else if ((*(in_string + cur_pos) >= 'a') && (*(in_string+cur_pos) <='f')) 294 else if ((in_string[cur_pos] >= 'a') && (in_string[cur_pos] <='f'))
284 { 295 {
285 mData[i] += (U8)(10 + *(in_string + cur_pos) - 'a'); 296 mData[i] += (U8)(10 + in_string[cur_pos] - 'a');
286 } 297 }
287 else if ((*(in_string + cur_pos) >= 'A') && (*(in_string+cur_pos) <='F')) 298 else if ((in_string[cur_pos] >= 'A') && (in_string[cur_pos] <='F'))
288 { 299 {
289 mData[i] += (U8)(10 + *(in_string + cur_pos) - 'A'); 300 mData[i] += (U8)(10 + in_string[cur_pos] - 'A');
290 } 301 }
291 else 302 else
292 { 303 {
@@ -305,20 +316,11 @@ BOOL LLUUID::set(const char *in_string, BOOL emit)
305 316
306BOOL LLUUID::validate(const std::string& in_string) 317BOOL LLUUID::validate(const std::string& in_string)
307{ 318{
308 return validate(in_string.c_str());
309}
310
311BOOL LLUUID::validate(const char *in_string)
312{
313 BOOL broken_format = FALSE; 319 BOOL broken_format = FALSE;
314 if (!in_string) 320 if (in_string.length() != (UUID_STR_LENGTH - 1)) /* Flawfinder: ignore */
315 {
316 return FALSE;
317 }
318 if (strlen(in_string) != (UUID_STR_LENGTH - 1)) /* Flawfinder: ignore */
319 { 321 {
320 // I'm a moron. First implementation didn't have the right UUID format. 322 // I'm a moron. First implementation didn't have the right UUID format.
321 if (strlen(in_string) == (UUID_STR_LENGTH - 2)) /* Flawfinder: ignore */ 323 if (in_string.length() == (UUID_STR_LENGTH - 2)) /* Flawfinder: ignore */
322 { 324 {
323 broken_format = TRUE; 325 broken_format = TRUE;
324 } 326 }
@@ -329,8 +331,7 @@ BOOL LLUUID::validate(const char *in_string)
329 } 331 }
330 332
331 U8 cur_pos = 0; 333 U8 cur_pos = 0;
332 U32 i; 334 for (U32 i = 0; i < 16; i++)
333 for (i = 0; i < 16; i++)
334 { 335 {
335 if ((i == 4) || (i == 6) || (i == 8) || (i == 10)) 336 if ((i == 4) || (i == 6) || (i == 8) || (i == 10))
336 { 337 {
@@ -342,13 +343,13 @@ BOOL LLUUID::validate(const char *in_string)
342 } 343 }
343 } 344 }
344 345
345 if ((*(in_string + cur_pos) >= '0') && (*(in_string+cur_pos) <= '9')) 346 if ((in_string[cur_pos] >= '0') && (in_string[cur_pos] <= '9'))
346 { 347 {
347 } 348 }
348 else if ((*(in_string + cur_pos) >= 'a') && (*(in_string+cur_pos) <='f')) 349 else if ((in_string[cur_pos] >= 'a') && (in_string[cur_pos] <='f'))
349 { 350 {
350 } 351 }
351 else if ((*(in_string + cur_pos) >= 'A') && (*(in_string+cur_pos) <='F')) 352 else if ((in_string[cur_pos] >= 'A') && (in_string[cur_pos] <='F'))
352 { 353 {
353 } 354 }
354 else 355 else
@@ -358,13 +359,13 @@ BOOL LLUUID::validate(const char *in_string)
358 359
359 cur_pos++; 360 cur_pos++;
360 361
361 if ((*(in_string + cur_pos) >= '0') && (*(in_string+cur_pos) <= '9')) 362 if ((in_string[cur_pos] >= '0') && (in_string[cur_pos] <= '9'))
362 { 363 {
363 } 364 }
364 else if ((*(in_string + cur_pos) >= 'a') && (*(in_string+cur_pos) <='f')) 365 else if ((in_string[cur_pos] >= 'a') && (in_string[cur_pos] <='f'))
365 { 366 {
366 } 367 }
367 else if ((*(in_string + cur_pos) >= 'A') && (*(in_string+cur_pos) <='F')) 368 else if ((in_string[cur_pos] >= 'A') && (in_string[cur_pos] <='F'))
368 { 369 {
369 } 370 }
370 else 371 else
@@ -412,8 +413,7 @@ LLUUID LLUUID::combine(const LLUUID &other) const
412 413
413std::ostream& operator<<(std::ostream& s, const LLUUID &uuid) 414std::ostream& operator<<(std::ostream& s, const LLUUID &uuid)
414{ 415{
415 char uuid_str[UUID_STR_LENGTH]; 416 std::string uuid_str;
416
417 uuid.toString(uuid_str); 417 uuid.toString(uuid_str);
418 s << uuid_str; 418 s << uuid_str;
419 return s; 419 return s;
@@ -428,7 +428,7 @@ std::istream& operator>>(std::istream &s, LLUUID &uuid)
428 s >> uuid_str[i]; 428 s >> uuid_str[i];
429 } 429 }
430 uuid_str[i] = '\0'; 430 uuid_str[i] = '\0';
431 uuid.set(uuid_str); 431 uuid.set(std::string(uuid_str));
432 return s; 432 return s;
433} 433}
434 434
@@ -867,7 +867,7 @@ void LLUUID::generate()
867 time_last = timestamp; 867 time_last = timestamp;
868} 868}
869 869
870void LLUUID::generate(std::string hash_string) 870void LLUUID::generate(const std::string& hash_string)
871{ 871{
872 LLMD5 md5_uuid((U8*)hash_string.c_str()); 872 LLMD5 md5_uuid((U8*)hash_string.c_str());
873 md5_uuid.raw_digest(mData); 873 md5_uuid.raw_digest(mData);
@@ -891,15 +891,15 @@ U32 LLUUID::getRandomSeed()
891 return(*(U32 *)seed); 891 return(*(U32 *)seed);
892} 892}
893 893
894BOOL LLUUID::parseUUID(const char* buf, LLUUID* value) 894BOOL LLUUID::parseUUID(const std::string& buf, LLUUID* value)
895{ 895{
896 if( buf == NULL || buf[0] == '\0' || value == NULL) 896 if( buf.empty() || value == NULL)
897 { 897 {
898 return FALSE; 898 return FALSE;
899 } 899 }
900 900
901 LLString temp( buf ); 901 std::string temp( buf );
902 LLString::trim(temp); 902 LLStringUtil::trim(temp);
903 if( LLUUID::validate( temp ) ) 903 if( LLUUID::validate( temp ) )
904 { 904 {
905 value->set( temp ); 905 value->set( temp );
diff --git a/linden/indra/llmath/lluuid.h b/linden/indra/llcommon/lluuid.h
index 48308f2..3b057fb 100644
--- a/linden/indra/llmath/lluuid.h
+++ b/linden/indra/llcommon/lluuid.h
@@ -64,7 +64,7 @@ public:
64 // MANIPULATORS 64 // MANIPULATORS
65 // 65 //
66 void generate(); // Generate a new UUID 66 void generate(); // Generate a new UUID
67 void generate(std::string stream); //Generate a new UUID based on hash of input stream 67 void generate(const std::string& stream); //Generate a new UUID based on hash of input stream
68 BOOL set(const char *in_string, BOOL emit = TRUE); // Convert from string, if emit is FALSE, do not emit warnings 68 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 69 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. 70 void setNull(); // Faster than setting to LLUUID::null.
@@ -106,7 +106,9 @@ public:
106 friend std::istream& operator>>(std::istream& s, LLUUID &uuid); 106 friend std::istream& operator>>(std::istream& s, LLUUID &uuid);
107 107
108 void toString(char *out) const; // Does not allocate memory, needs 36 characters (including \0) 108 void toString(char *out) const; // Does not allocate memory, needs 36 characters (including \0)
109 void toString(std::string& out) const;
109 void toCompressedString(char *out) const; // Does not allocate memory, needs 17 characters (including \0) 110 void toCompressedString(char *out) const; // Does not allocate memory, needs 17 characters (including \0)
111 void toCompressedString(std::string& out) const;
110 112
111 std::string asString() const; 113 std::string asString() const;
112 std::string getString() const; 114 std::string getString() const;
@@ -115,14 +117,13 @@ public:
115 U32 getCRC32() const; 117 U32 getCRC32() const;
116 118
117 static BOOL validate(const std::string& in_string); // Validate that the UUID string is legal. 119 static BOOL validate(const std::string& in_string); // Validate that the UUID string is legal.
118 static BOOL validate(const char *in_string); // Validate that the UUID string is legal.
119 120
120 static const LLUUID null; 121 static const LLUUID null;
121 122
122 static U32 getRandomSeed(); 123 static U32 getRandomSeed();
123 static S32 getNodeID(unsigned char * node_id); 124 static S32 getNodeID(unsigned char * node_id);
124 125
125 static BOOL parseUUID(const char* buf, LLUUID* value); 126 static BOOL parseUUID(const std::string& buf, LLUUID* value);
126 127
127 U8 mData[UUID_BYTES]; 128 U8 mData[UUID_BYTES];
128}; 129};
diff --git a/linden/indra/llcommon/llversionserver.h b/linden/indra/llcommon/llversionserver.h
index e3ceadf..0b88ce8 100644
--- a/linden/indra/llcommon/llversionserver.h
+++ b/linden/indra/llcommon/llversionserver.h
@@ -33,9 +33,9 @@
33#define LL_LLVERSIONSERVER_H 33#define LL_LLVERSIONSERVER_H
34 34
35const S32 LL_VERSION_MAJOR = 1; 35const S32 LL_VERSION_MAJOR = 1;
36const S32 LL_VERSION_MINOR = 21; 36const S32 LL_VERSION_MINOR = 24;
37const S32 LL_VERSION_PATCH = 1; 37const S32 LL_VERSION_PATCH = 0;
38const S32 LL_VERSION_BUILD = 86526; 38const S32 LL_VERSION_BUILD = 93453;
39 39
40const char * const LL_CHANNEL = "Second Life Server"; 40const char * const LL_CHANNEL = "Second Life Server";
41 41
diff --git a/linden/indra/llcommon/llversionviewer.h b/linden/indra/llcommon/llversionviewer.h
index 9b3cf80..4820f68 100644
--- a/linden/indra/llcommon/llversionviewer.h
+++ b/linden/indra/llcommon/llversionviewer.h
@@ -33,8 +33,8 @@
33#define LL_LLVERSIONVIEWER_H 33#define LL_LLVERSIONVIEWER_H
34 34
35const S32 LL_VERSION_MAJOR = 1; 35const S32 LL_VERSION_MAJOR = 1;
36const S32 LL_VERSION_MINOR = 20; 36const S32 LL_VERSION_MINOR = 21;
37const S32 LL_VERSION_PATCH = 15; 37const S32 LL_VERSION_PATCH = 0;
38const S32 LL_VERSION_BUILD = 0; 38const S32 LL_VERSION_BUILD = 0;
39 39
40const char * const LL_CHANNEL = "Second Life Release"; 40const char * const LL_CHANNEL = "Second Life Release";
diff --git a/linden/indra/llcommon/metapropertyt.h b/linden/indra/llcommon/metapropertyt.h
index 5c25ec4..73c2a7a 100644
--- a/linden/indra/llcommon/metapropertyt.h
+++ b/linden/indra/llcommon/metapropertyt.h
@@ -86,13 +86,6 @@ inline const LLReflective* LLMetaPropertyT<std::string>::get(const LLReflective*
86} 86}
87 87
88template <> 88template <>
89inline const LLReflective* LLMetaPropertyT<LLString>::get(const LLReflective* object) const
90{
91 checkObjectClass(object);
92 return NULL;
93}
94
95template <>
96inline const LLReflective* LLMetaPropertyT<LLUUID>::get(const LLReflective* object) const 89inline const LLReflective* LLMetaPropertyT<LLUUID>::get(const LLReflective* object) const
97{ 90{
98 checkObjectClass(object); 91 checkObjectClass(object);
@@ -112,12 +105,6 @@ inline LLSD LLMetaPropertyT<std::string>::getLLSD(const LLReflective* object) co
112} 105}
113 106
114template <> 107template <>
115inline LLSD LLMetaPropertyT<LLString>::getLLSD(const LLReflective* object) const
116{
117 return *(getProperty(object));
118}
119
120template <>
121inline LLSD LLMetaPropertyT<LLUUID>::getLLSD(const LLReflective* object) const 108inline LLSD LLMetaPropertyT<LLUUID>::getLLSD(const LLReflective* object) const
122{ 109{
123 return *(getProperty(object)); 110 return *(getProperty(object));
diff --git a/linden/indra/llcommon/roles_constants.h b/linden/indra/llcommon/roles_constants.h
index 956a9de..ee2986b 100644
--- a/linden/indra/llcommon/roles_constants.h
+++ b/linden/indra/llcommon/roles_constants.h
@@ -143,11 +143,18 @@ const U64 GP_NOTICES_RECEIVE = 0x1LL << 43; // Receive Notices and View Notice
143const U64 GP_PROPOSAL_START = 0x1LL << 44; // Start Proposal 143const U64 GP_PROPOSAL_START = 0x1LL << 44; // Start Proposal
144const U64 GP_PROPOSAL_VOTE = 0x1LL << 45; // Vote on Proposal 144const U64 GP_PROPOSAL_VOTE = 0x1LL << 45; // Vote on Proposal
145 145
146// Group chat moderation related
147const U64 GP_SESSION_JOIN = 0x1LL << 16; //can join session
148const U64 GP_SESSION_VOICE = 0x1LL << 27; //can hear/talk
149const U64 GP_SESSION_MODERATOR = 0x1LL << 37; //can mute people's session
150
146const U64 GP_DEFAULT_MEMBER = GP_ACCOUNTING_ACCOUNTABLE 151const U64 GP_DEFAULT_MEMBER = GP_ACCOUNTING_ACCOUNTABLE
147 | GP_LAND_ALLOW_SET_HOME 152 | GP_LAND_ALLOW_SET_HOME
148 | GP_NOTICES_RECEIVE 153 | GP_NOTICES_RECEIVE
149 | GP_PROPOSAL_START 154 | GP_PROPOSAL_START
150 | GP_PROPOSAL_VOTE 155 | GP_PROPOSAL_VOTE
156 | GP_SESSION_JOIN
157 | GP_SESSION_VOICE
151 ; 158 ;
152 159
153const U64 GP_DEFAULT_OFFICER = GP_ACCOUNTING_ACCOUNTABLE 160const U64 GP_DEFAULT_OFFICER = GP_ACCOUNTING_ACCOUNTABLE
@@ -188,5 +195,8 @@ const U64 GP_DEFAULT_OFFICER = GP_ACCOUNTING_ACCOUNTABLE
188 | GP_PROPOSAL_VOTE 195 | GP_PROPOSAL_VOTE
189 | GP_ROLE_ASSIGN_MEMBER_LIMITED 196 | GP_ROLE_ASSIGN_MEMBER_LIMITED
190 | GP_ROLE_PROPERTIES 197 | GP_ROLE_PROPERTIES
198 | GP_SESSION_MODERATOR
199 | GP_SESSION_JOIN
200 | GP_SESSION_VOICE
191 ; 201 ;
192#endif 202#endif
diff --git a/linden/indra/llcommon/stdtypes.h b/linden/indra/llcommon/stdtypes.h
index c1f5303..44f67f2 100644
--- a/linden/indra/llcommon/stdtypes.h
+++ b/linden/indra/llcommon/stdtypes.h
@@ -31,6 +31,8 @@
31#ifndef LL_STDTYPES_H 31#ifndef LL_STDTYPES_H
32#define LL_STDTYPES_H 32#define LL_STDTYPES_H
33 33
34#include <cfloat>
35
34typedef signed char S8; 36typedef signed char S8;
35typedef unsigned char U8; 37typedef unsigned char U8;
36typedef signed short S16; 38typedef signed short S16;
diff --git a/linden/indra/llcommon/u64.cpp b/linden/indra/llcommon/u64.cpp
index bbeed9f..5aebdb3 100644
--- a/linden/indra/llcommon/u64.cpp
+++ b/linden/indra/llcommon/u64.cpp
@@ -34,10 +34,10 @@
34#include "u64.h" 34#include "u64.h"
35 35
36 36
37U64 str_to_U64(const char *str) 37U64 str_to_U64(const std::string& str)
38{ 38{
39 U64 result = 0; 39 U64 result = 0;
40 const char *aptr = strpbrk(str,"0123456789"); 40 const char *aptr = strpbrk(str.c_str(),"0123456789");
41 41
42 if (!aptr) 42 if (!aptr)
43 { 43 {
@@ -54,8 +54,9 @@ U64 str_to_U64(const char *str)
54} 54}
55 55
56 56
57char* U64_to_str(U64 value, char* result, S32 result_size) 57std::string U64_to_str(U64 value)
58{ 58{
59 std::string res;
59 U32 part1,part2,part3; 60 U32 part1,part2,part3;
60 61
61 part3 = (U32)(value % (U64)10000000); 62 part3 = (U32)(value % (U64)10000000);
@@ -70,31 +71,26 @@ char* U64_to_str(U64 value, char* result, S32 result_size)
70 71
71 if (part1) 72 if (part1)
72 { 73 {
73 snprintf( /* Flawfinder: ignore */ 74 res = llformat("%u%07u%07u",part1,part2,part3);
74 result,
75 result_size,
76 "%u%07u%07u",
77 part1,part2,part3);
78 } 75 }
79 else if (part2) 76 else if (part2)
80 { 77 {
81 snprintf( /* Flawfinder: ignore */ 78 res = llformat("%u%07u",part2,part3);
82 result,
83 result_size,
84 "%u%07u",
85 part2,part3);
86 } 79 }
87 else 80 else
88 { 81 {
89 snprintf( /* Flawfinder: ignore */ 82 res = llformat("%u",part3);
90 result,
91 result_size,
92 "%u",
93 part3);
94 } 83 }
95 return (result); 84 return res;
96} 85}
97 86
87char* U64_to_str(U64 value, char* result, S32 result_size)
88{
89 std::string res = U64_to_str(value);
90 LLStringUtil::copy(result, res.c_str(), result_size);
91 return result;
92}
93
98F64 U64_to_F64(const U64 value) 94F64 U64_to_F64(const U64 value)
99{ 95{
100 S64 top_bits = (S64)(value >> 1); 96 S64 top_bits = (S64)(value >> 1);
diff --git a/linden/indra/llcommon/u64.h b/linden/indra/llcommon/u64.h
index ab06836..3d45fc3 100644
--- a/linden/indra/llcommon/u64.h
+++ b/linden/indra/llcommon/u64.h
@@ -38,7 +38,14 @@
38 * @param str The string to parse. 38 * @param str The string to parse.
39 * @return Returns the first U64 value found in the string or 0 on failure. 39 * @return Returns the first U64 value found in the string or 0 on failure.
40 */ 40 */
41U64 str_to_U64(const char* str); 41U64 str_to_U64(const std::string& str);
42
43/**
44 * @brief Given a U64 value, return a printable representation.
45 * @param value The U64 to turn into a printable character array.
46 * @return Returns the result string.
47 */
48std::string U64_to_str(U64 value);
42 49
43/** 50/**
44 * @brief Given a U64 value, return a printable representation. 51 * @brief Given a U64 value, return a printable representation.
diff --git a/linden/indra/llcommon/llares.cpp b/linden/indra/llmessage/llares.cpp
index 4d054e4..5a310b3 100644
--- a/linden/indra/llcommon/llares.cpp
+++ b/linden/indra/llmessage/llares.cpp
@@ -31,17 +31,15 @@
31 * $/LicenseInfo$ 31 * $/LicenseInfo$
32 */ 32 */
33 33
34#ifdef LL_STANDALONE 34#include "linden_common.h"
35# include <ares_dns.h>
36#else
37# include <ares/ares_dns.h>
38#endif
39 35
40#include "apr-1/apr_portable.h" 36#include <ares_dns.h>
41#include "apr-1/apr_network_io.h" 37#include <ares_version.h>
42#include "apr-1/apr_poll.h" 38
39#include "apr_portable.h"
40#include "apr_network_io.h"
41#include "apr_poll.h"
43 42
44#include "linden_common.h"
45#include "llapr.h" 43#include "llapr.h"
46#include "llares.h" 44#include "llares.h"
47 45
@@ -103,24 +101,22 @@ void LLAres::QueryResponder::queryError(int code)
103} 101}
104 102
105LLAres::LLAres() 103LLAres::LLAres()
106 : chan_(NULL)
107{ 104{
108 ares_init(&chan_); 105 ares_init(&chan_);
109} 106}
110 107
111LLAres::~LLAres() 108LLAres::~LLAres()
112{ 109{
113 if (chan_) 110 ares_destroy(chan_);
114 ares_destroy(chan_);
115} 111}
116 112
117void LLAres::cancel() 113void LLAres::cancel()
118{ 114{
119 if (chan_) 115 ares_cancel(chan_);
120 ares_cancel(chan_);
121} 116}
122 117
123static void host_callback(void *arg, int status, struct hostent *ent) 118static void host_callback_1_5(void *arg, int status, int timeouts,
119 struct hostent *ent)
124{ 120{
125 LLPointer<LLAres::HostResponder> *resp = 121 LLPointer<LLAres::HostResponder> *resp =
126 (LLPointer<LLAres::HostResponder> *) arg; 122 (LLPointer<LLAres::HostResponder> *) arg;
@@ -135,14 +131,18 @@ static void host_callback(void *arg, int status, struct hostent *ent)
135 delete resp; 131 delete resp;
136} 132}
137 133
134#if ARES_VERSION_MAJOR == 1 && ARES_VERSION_MINOR == 4
135static void host_callback(void *arg, int status, struct hostent *ent)
136{
137 host_callback_1_5(arg, status, 0, ent);
138}
139#else
140# define host_callback host_callback_1_5
141#endif
142
138void LLAres::getHostByName(const char *name, HostResponder *resp, 143void LLAres::getHostByName(const char *name, HostResponder *resp,
139 int family) 144 int family)
140{ 145{
141 if (!chan_)
142 {
143 resp->hostError(ARES_EBADRESP);
144 return;
145 }
146 ares_gethostbyname(chan_, name, family, host_callback, 146 ares_gethostbyname(chan_, name, family, host_callback,
147 new LLPointer<LLAres::HostResponder>(resp)); 147 new LLPointer<LLAres::HostResponder>(resp));
148} 148}
@@ -154,7 +154,7 @@ void LLAres::getSrvRecords(const std::string &name, SrvResponder *resp)
154 154
155void LLAres::rewriteURI(const std::string &uri, UriRewriteResponder *resp) 155void LLAres::rewriteURI(const std::string &uri, UriRewriteResponder *resp)
156{ 156{
157 LL_DEBUGS2("AppInit","Rewrite") << "Rewriting " << uri << LL_ENDL; 157 llinfos << "Rewriting " << uri << llendl;
158 158
159 resp->mUri = LLURI(uri); 159 resp->mUri = LLURI(uri);
160 search("_" + resp->mUri.scheme() + "._tcp." + resp->mUri.hostName(), 160 search("_" + resp->mUri.scheme() + "._tcp." + resp->mUri.hostName(),
@@ -163,8 +163,7 @@ void LLAres::rewriteURI(const std::string &uri, UriRewriteResponder *resp)
163 163
164LLQueryResponder::LLQueryResponder() 164LLQueryResponder::LLQueryResponder()
165 : LLAres::QueryResponder(), 165 : LLAres::QueryResponder(),
166 mResult(ARES_ENODATA), 166 mResult(ARES_ENODATA)
167 mType(RES_INVALID)
168{ 167{
169} 168}
170 169
@@ -342,18 +341,18 @@ bail:
342 mResult = ret; 341 mResult = ret;
343 if (mResult == ARES_SUCCESS) 342 if (mResult == ARES_SUCCESS)
344 { 343 {
345 queryResult(); 344 querySuccess();
346 } else { 345 } else {
347 queryError(mResult); 346 queryError(mResult);
348 } 347 }
349} 348}
350 349
351void LLQueryResponder::queryResult() 350void LLQueryResponder::querySuccess()
352{ 351{
353 llinfos << "LLQueryResponder::queryResult not implemented" << llendl; 352 llinfos << "LLQueryResponder::queryResult not implemented" << llendl;
354} 353}
355 354
356void LLAres::SrvResponder::queryResult() 355void LLAres::SrvResponder::querySuccess()
357{ 356{
358 if (mType == RES_SRV) 357 if (mType == RES_SRV)
359 { 358 {
@@ -389,7 +388,8 @@ void LLAres::SrvResponder::srvError(int code)
389 << LLAres::strerror(code) << llendl; 388 << LLAres::strerror(code) << llendl;
390} 389}
391 390
392static void nameinfo_callback(void *arg, int status, char *node, char *service) 391static void nameinfo_callback_1_5(void *arg, int status, int timeouts,
392 char *node, char *service)
393{ 393{
394 LLPointer<LLAres::NameInfoResponder> *resp = 394 LLPointer<LLAres::NameInfoResponder> *resp =
395 (LLPointer<LLAres::NameInfoResponder> *) arg; 395 (LLPointer<LLAres::NameInfoResponder> *) arg;
@@ -404,20 +404,24 @@ static void nameinfo_callback(void *arg, int status, char *node, char *service)
404 delete resp; 404 delete resp;
405} 405}
406 406
407#if ARES_VERSION_MAJOR == 1 && ARES_VERSION_MINOR == 4
408static void nameinfo_callback(void *arg, int status, char *node, char *service)
409{
410 nameinfo_callback_1_5(arg, status, 0, node, service);
411}
412#else
413# define nameinfo_callback nameinfo_callback_1_5
414#endif
415
407void LLAres::getNameInfo(const struct sockaddr &sa, socklen_t salen, int flags, 416void LLAres::getNameInfo(const struct sockaddr &sa, socklen_t salen, int flags,
408 NameInfoResponder *resp) 417 NameInfoResponder *resp)
409{ 418{
410 if (!chan_)
411 {
412 resp->nameInfoError(ARES_EBADRESP);
413 return;
414 }
415 ares_getnameinfo(chan_, &sa, salen, flags, nameinfo_callback, 419 ares_getnameinfo(chan_, &sa, salen, flags, nameinfo_callback,
416 new LLPointer<NameInfoResponder>(resp)); 420 new LLPointer<NameInfoResponder>(resp));
417} 421}
418 422
419static void search_callback(void *arg, int status, unsigned char *abuf, 423static void search_callback_1_5(void *arg, int status, int timeouts,
420 int alen) 424 unsigned char *abuf, int alen)
421{ 425{
422 LLPointer<LLAres::QueryResponder> *resp = 426 LLPointer<LLAres::QueryResponder> *resp =
423 (LLPointer<LLAres::QueryResponder> *) arg; 427 (LLPointer<LLAres::QueryResponder> *) arg;
@@ -432,14 +436,19 @@ static void search_callback(void *arg, int status, unsigned char *abuf,
432 delete resp; 436 delete resp;
433} 437}
434 438
439#if ARES_VERSION_MAJOR == 1 && ARES_VERSION_MINOR == 4
440static void search_callback(void *arg, int status, unsigned char *abuf,
441 int alen)
442{
443 search_callback_1_5(arg, status, 0, abuf, alen);
444}
445#else
446# define search_callback search_callback_1_5
447#endif
448
435void LLAres::search(const std::string &query, LLResType type, 449void LLAres::search(const std::string &query, LLResType type,
436 QueryResponder *resp) 450 QueryResponder *resp)
437{ 451{
438 if (!chan_)
439 {
440 resp->queryError(ARES_EBADRESP);
441 return;
442 }
443 ares_search(chan_, query.c_str(), ns_c_in, type, search_callback, 452 ares_search(chan_, query.c_str(), ns_c_in, type, search_callback,
444 new LLPointer<QueryResponder>(resp)); 453 new LLPointer<QueryResponder>(resp));
445} 454}
@@ -459,11 +468,6 @@ bool LLAres::process(U64 timeout)
459 int nactive = 0; 468 int nactive = 0;
460 int bitmask; 469 int bitmask;
461 470
462 if (!chan_)
463 {
464 goto bail;
465 }
466
467 bitmask = ares_getsock(chan_, socks, ARES_GETSOCK_MAXNUM); 471 bitmask = ares_getsock(chan_, socks, ARES_GETSOCK_MAXNUM);
468 472
469 if (bitmask == 0) 473 if (bitmask == 0)
@@ -535,11 +539,6 @@ bail:
535 539
536bool LLAres::processAll() 540bool LLAres::processAll()
537{ 541{
538 if (!chan_)
539 {
540 return false;
541 }
542
543 bool anyProcessed = false, ret; 542 bool anyProcessed = false, ret;
544 543
545 do { 544 do {
@@ -735,7 +734,7 @@ void LLAres::UriRewriteResponder::queryError(int code)
735 rewriteResult(uris); 734 rewriteResult(uris);
736} 735}
737 736
738void LLAres::UriRewriteResponder::queryResult() 737void LLAres::UriRewriteResponder::querySuccess()
739{ 738{
740 std::vector<std::string> uris; 739 std::vector<std::string> uris;
741 740
diff --git a/linden/indra/llcommon/llares.h b/linden/indra/llmessage/llares.h
index 07957f1..5d72170 100644
--- a/linden/indra/llcommon/llares.h
+++ b/linden/indra/llmessage/llares.h
@@ -485,7 +485,7 @@ protected:
485 size_t count, const char *& pos, dns_rrs_t &rrs); 485 size_t count, const char *& pos, dns_rrs_t &rrs);
486 486
487 void queryResult(const char *buf, size_t len); 487 void queryResult(const char *buf, size_t len);
488 virtual void queryResult(); 488 virtual void querySuccess();
489 489
490public: 490public:
491 LLQueryResponder(); 491 LLQueryResponder();
@@ -532,7 +532,7 @@ class LLAres::SrvResponder : public LLQueryResponder
532public: 532public:
533 friend void LLAres::getSrvRecords(const std::string &name, 533 friend void LLAres::getSrvRecords(const std::string &name,
534 SrvResponder *resp); 534 SrvResponder *resp);
535 void queryResult(); 535 void querySuccess();
536 void queryError(int code); 536 void queryError(int code);
537 537
538 virtual void srvResult(const dns_rrs_t &ents); 538 virtual void srvResult(const dns_rrs_t &ents);
@@ -551,7 +551,7 @@ protected:
551public: 551public:
552 friend void LLAres::rewriteURI(const std::string &uri, 552 friend void LLAres::rewriteURI(const std::string &uri,
553 UriRewriteResponder *resp); 553 UriRewriteResponder *resp);
554 void queryResult(); 554 void querySuccess();
555 void queryError(int code); 555 void queryError(int code);
556 556
557 virtual void rewriteResult(const std::vector<std::string> &uris); 557 virtual void rewriteResult(const std::vector<std::string> &uris);