aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--linden/indra/SConstruct21
-rw-r--r--linden/indra/indra_complete/indra_complete.sln1
-rw-r--r--linden/indra/linux_crash_logger/linux_crash_logger.cpp8
-rw-r--r--linden/indra/llaudio/audioengine_fmod.cpp2
-rw-r--r--linden/indra/llaudio/vorbisencode.cpp2
-rw-r--r--linden/indra/llcharacter/llheadrotmotion.cpp18
-rw-r--r--linden/indra/llcommon/doublelinkedlist.h2
-rw-r--r--linden/indra/llcommon/lldefs.h11
-rw-r--r--linden/indra/llcommon/llfasttimer.h6
-rw-r--r--linden/indra/llcommon/llptrskiplist.h2
-rw-r--r--linden/indra/llcommon/llptrskipmap.h6
-rw-r--r--linden/indra/llcommon/llskiplist.h2
-rw-r--r--linden/indra/llcommon/llversion.h2
-rw-r--r--linden/indra/llinventory/llinventory.cpp30
-rw-r--r--linden/indra/llinventory/lllandmark.cpp4
-rw-r--r--linden/indra/llinventory/llpermissions.cpp24
-rw-r--r--linden/indra/llinventory/llsaleinfo.cpp8
-rw-r--r--linden/indra/llmath/llrand.cpp59
-rw-r--r--linden/indra/llmath/llrand.h134
-rw-r--r--linden/indra/llmath/lluuid.cpp75
-rw-r--r--linden/indra/llmath/llvolume.cpp24
-rw-r--r--linden/indra/llmessage/llcachename.cpp18
-rw-r--r--linden/indra/llmessage/llcircuit.cpp6
-rw-r--r--linden/indra/llmessage/llpacketring.cpp4
-rw-r--r--linden/indra/llmessage/llpumpio.cpp1
-rw-r--r--linden/indra/llmessage/llurlrequest.cpp1
-rw-r--r--linden/indra/llmessage/llxfermanager.cpp2
-rw-r--r--linden/indra/llui/llmenugl.cpp3
-rw-r--r--linden/indra/llvfs/lldir_linux.cpp8
-rw-r--r--linden/indra/llvfs/lldir_mac.cpp4
-rw-r--r--linden/indra/llvfs/lldir_win32.cpp6
-rw-r--r--linden/indra/llwindow/llgl.cpp9
-rw-r--r--linden/indra/llwindow/llgl.h1
-rw-r--r--linden/indra/llwindow/llkeyboard.cpp1
-rw-r--r--linden/indra/llwindow/llkeyboardwin32.cpp1
-rw-r--r--linden/indra/llwindow/llwindowwin32.cpp37
-rw-r--r--linden/indra/lscript/lscript_alloc.h72
-rw-r--r--linden/indra/lscript/lscript_compile/lscript_compile.vcproj6
-rw-r--r--linden/indra/lscript/lscript_execute/lscript_execute.vcproj6
-rw-r--r--linden/indra/lscript/lscript_library/lscript_alloc.cpp59
-rw-r--r--linden/indra/lscript/lscript_library/lscript_library.cpp2
-rw-r--r--linden/indra/lscript/lscript_library/lscript_library.vcproj6
-rw-r--r--linden/indra/mac_crash_logger/mac_crash_logger.cpp14
-rw-r--r--linden/indra/mac_updater/mac_updater.cpp3
-rw-r--r--linden/indra/newview/English.lproj/InfoPlist.strings4
-rw-r--r--linden/indra/newview/Info-SecondLife.plist2
-rw-r--r--linden/indra/newview/linux_tools/exposed-symbols.txt3
-rw-r--r--linden/indra/newview/linux_tools/hidesymbols.ver9
-rwxr-xr-xlinden/indra/newview/linux_tools/package-client.sh11
-rw-r--r--linden/indra/newview/llagent.cpp12
-rw-r--r--linden/indra/newview/llanimalcontrols.cpp2
-rw-r--r--linden/indra/newview/llcloud.cpp6
-rw-r--r--linden/indra/newview/llcontroldef.cpp1
-rw-r--r--linden/indra/newview/lldrawpoolbump.cpp3
-rw-r--r--linden/indra/newview/llfasttimerview.cpp62
-rw-r--r--linden/indra/newview/llfasttimerview.h1
-rw-r--r--linden/indra/newview/llfeaturemanager.cpp19
-rw-r--r--linden/indra/newview/llfeaturemanager.h8
-rw-r--r--linden/indra/newview/llflexibleobject.cpp6
-rw-r--r--linden/indra/newview/llfloatereditui.cpp2
-rw-r--r--linden/indra/newview/llfloatertools.cpp15
-rw-r--r--linden/indra/newview/llfloatertools.h1
-rw-r--r--linden/indra/newview/llhippo.cpp2
-rw-r--r--linden/indra/newview/llhudeffectbeam.cpp6
-rw-r--r--linden/indra/newview/llinventorymodel.cpp3
-rw-r--r--linden/indra/newview/llmanip.cpp4
-rw-r--r--linden/indra/newview/llmutelist.cpp4
-rw-r--r--linden/indra/newview/llpanelavatar.cpp31
-rw-r--r--linden/indra/newview/llstartup.cpp2
-rw-r--r--linden/indra/newview/lltexlayer.cpp2
-rw-r--r--linden/indra/newview/llviewercontrol.cpp4
-rw-r--r--linden/indra/newview/llviewercontrol.h5
-rw-r--r--linden/indra/newview/llviewerimage.cpp1
-rw-r--r--linden/indra/newview/llviewerinventory.cpp5
-rw-r--r--linden/indra/newview/llviewerkeyboard.cpp3
-rw-r--r--linden/indra/newview/llviewermenu.cpp23
-rw-r--r--linden/indra/newview/llviewermessage.cpp2
-rw-r--r--linden/indra/newview/llviewerobject.cpp3
-rw-r--r--linden/indra/newview/llviewerpartsim.cpp6
-rw-r--r--linden/indra/newview/llviewerpartsource.cpp20
-rw-r--r--linden/indra/newview/llviewerstats.cpp12
-rw-r--r--linden/indra/newview/llviewerstats.h6
-rw-r--r--linden/indra/newview/llvoavatar.cpp2
-rw-r--r--linden/indra/newview/llvograss.cpp14
-rw-r--r--linden/indra/newview/llvopart.cpp24
-rw-r--r--linden/indra/newview/llvopartgroup.cpp2
-rw-r--r--linden/indra/newview/llvosky.cpp16
-rw-r--r--linden/indra/newview/llvostars.cpp14
-rw-r--r--linden/indra/newview/llvotreenew.cpp7
-rw-r--r--linden/indra/newview/llvotreenew.h6
-rw-r--r--linden/indra/newview/llwearable.cpp9
-rw-r--r--linden/indra/newview/llwebbrowserctrl.cpp8
-rw-r--r--linden/indra/newview/llwebbrowserctrl.h2
-rw-r--r--linden/indra/newview/releasenotes.txt18
-rw-r--r--linden/indra/newview/res/newViewRes.rc4
-rw-r--r--linden/indra/newview/rsyncfiles.txt22
-rw-r--r--linden/indra/newview/secondlife setup build firstlook.bat11
-rw-r--r--linden/indra/newview/skins/xui/en-us/notify.xml5
-rw-r--r--linden/indra/newview/viewer.cpp33
-rw-r--r--linden/indra/newview/viewer.h2
-rw-r--r--linden/indra/test/files.lst1
-rwxr-xr-xlinden/indra/test/llrandom_tut.cpp69
-rw-r--r--linden/indra/test/test.vcproj3
-rw-r--r--linden/indra/win_crash_logger/win_crash_logger.cpp6
-rw-r--r--linden/libraries/include/llmozlib.h2
105 files changed, 808 insertions, 494 deletions
diff --git a/linden/indra/SConstruct b/linden/indra/SConstruct
index d9c53b9..f94f661 100644
--- a/linden/indra/SConstruct
+++ b/linden/indra/SConstruct
@@ -57,7 +57,7 @@ opts.Add(EnumOption('DISTCC', 'Enabled distcc', 'yes',
57opts.Add(EnumOption('COLORGCC', 'Enabled colorgcc', 'yes', 57opts.Add(EnumOption('COLORGCC', 'Enabled colorgcc', 'yes',
58 allowed_values=('yes', 'no'))) 58 allowed_values=('yes', 'no')))
59opts.Add(EnumOption('GRID', 'Client package\'s default grid', 'default', 59opts.Add(EnumOption('GRID', 'Client package\'s default grid', 'default',
60 allowed_values=('default', 'aditi', 'agni', 'dmz', 'durga', 'ganga', 'shakti', 'siva', 'soma', 'uma', 'vaak'))) 60 allowed_values=('default', 'aditi', 'agni', 'dmz', 'durga', 'firstlook', 'ganga', 'shakti', 'siva', 'soma', 'uma', 'vaak')))
61opts.Add(EnumOption('OPENSOURCE', 'Build using only non-proprietary dependencies', 61opts.Add(EnumOption('OPENSOURCE', 'Build using only non-proprietary dependencies',
62 'yes',# OPENSOURCE: do not edit this line 62 'yes',# OPENSOURCE: do not edit this line
63 allowed_values=('yes', 'no'))) 63 allowed_values=('yes', 'no')))
@@ -179,7 +179,6 @@ for build_target in targets:
179 if platform == 'linux': 179 if platform == 'linux':
180 # Linux-only flags 180 # Linux-only flags
181 flags += '-DLL_LINUX=1 ' 181 flags += '-DLL_LINUX=1 '
182 system_link_flags += '-Wl,--version-script=newview/linux_tools/hidesymbols.ver '
183 if build_target == 'client': 182 if build_target == 'client':
184 flags += '-DAPPID=secondlife -DLL_SDL=1 -DLL_X11=1 ' 183 flags += '-DAPPID=secondlife -DLL_SDL=1 -DLL_X11=1 '
185 flags += '-DLL_GTK=1 ' 184 flags += '-DLL_GTK=1 '
@@ -210,6 +209,17 @@ for build_target in targets:
210 # logger backtraces deteriorates. 209 # logger backtraces deteriorates.
211 strip_cmd = 'strip -S -o $TARGET $SOURCE' 210 strip_cmd = 'strip -S -o $TARGET $SOURCE'
212 211
212 # hidesyms_cmd is something which copies an executable while 'hiding'
213 # all of its exposed symbols except a very few desired ones. This is
214 # used mainly to hide the symbols of the many common libraries we
215 # static-link, which otherwise cause hard-to-trace fatal crashes due
216 # to clashes in the run-time symbol namespace.
217 if platform == 'linux':
218 exposed_symbols_file = 'newview/linux_tools/exposed-symbols.txt'
219 hidesyms_cmd = 'objcopy --keep-global-symbols ' + exposed_symbols_file + ' $SOURCE $TARGET'
220 else:
221 hidesyms_cmd = 'cp -f $SOURCE $TARGET'
222
213 if build_target != 'client': 223 if build_target != 'client':
214 gcc_bin = 'g++-3.3' 224 gcc_bin = 'g++-3.3'
215 225
@@ -366,7 +376,8 @@ for build_target in targets:
366 output_crashlogger_bin = 'linux_crash_logger/linux-crash-logger-' + arch + '-bin' 376 output_crashlogger_bin = 'linux_crash_logger/linux-crash-logger-' + arch + '-bin'
367 external_libs = net_external_libs + [ 'db-4.2', 'gtk-x11-2.0' ] 377 external_libs = net_external_libs + [ 'db-4.2', 'gtk-x11-2.0' ]
368 internal_libs = [ 'llvfs', 'llmath', 'llcommon' ] 378 internal_libs = [ 'llvfs', 'llmath', 'llcommon' ]
369 create_executable(output_crashlogger_bin, 'linux_crash_logger', internal_libs + external_libs) 379 create_executable(output_crashlogger_bin + '-globalsyms', 'linux_crash_logger', internal_libs + external_libs)
380 env.Command(output_crashlogger_bin, output_crashlogger_bin + '-globalsyms', hidesyms_cmd)
370 381
371 create_static_module('llaudio') 382 create_static_module('llaudio')
372 create_static_module('llmedia') 383 create_static_module('llmedia')
@@ -389,7 +400,8 @@ for build_target in targets:
389 'llcharacter', 'llaudio', 'llui', 'llxml', 400 'llcharacter', 'llaudio', 'llui', 'llxml',
390 'llmessage', 'llvfs', 'llmath', 'llcommon' ] 401 'llmessage', 'llvfs', 'llmath', 'llcommon' ]
391 402
392 create_executable(output_bin, 'newview', internal_libs + external_libs) 403 create_executable(output_bin + '-globalsyms', 'newview', internal_libs + external_libs)
404 env.Command(output_bin, output_bin + '-globalsyms', hidesyms_cmd)
393 405
394 if buildtype == 'releasefordownload': 406 if buildtype == 'releasefordownload':
395 407
@@ -398,7 +410,6 @@ for build_target in targets:
398 ####################### 410 #######################
399 411
400 if platform == 'linux': 412 if platform == 'linux':
401
402 env.Command(output_bin + '-stripped', output_bin, strip_cmd) 413 env.Command(output_bin + '-stripped', output_bin, strip_cmd)
403 env.Command(output_crashlogger_bin + '-stripped', output_crashlogger_bin, strip_cmd) 414 env.Command(output_crashlogger_bin + '-stripped', output_crashlogger_bin, strip_cmd)
404 manifest_file = 'linux_tools/client-manifest-' + arch 415 manifest_file = 'linux_tools/client-manifest-' + arch
diff --git a/linden/indra/indra_complete/indra_complete.sln b/linden/indra/indra_complete/indra_complete.sln
index d0c31ea..f4a8647 100644
--- a/linden/indra/indra_complete/indra_complete.sln
+++ b/linden/indra/indra_complete/indra_complete.sln
@@ -217,6 +217,7 @@ EndProject
217 {4B19F64E-AB97-4FB9-8E1D-74A8104DE0C4} = {4B19F64E-AB97-4FB9-8E1D-74A8104DE0C4} 217 {4B19F64E-AB97-4FB9-8E1D-74A8104DE0C4} = {4B19F64E-AB97-4FB9-8E1D-74A8104DE0C4}
218 {E5D94794-5671-4BD6-A16D-26EC18F3DB34} = {E5D94794-5671-4BD6-A16D-26EC18F3DB34} 218 {E5D94794-5671-4BD6-A16D-26EC18F3DB34} = {E5D94794-5671-4BD6-A16D-26EC18F3DB34}
219 {E87FD9BE-BE42-4EA3-BF4D-D992223046D9} = {E87FD9BE-BE42-4EA3-BF4D-D992223046D9} 219 {E87FD9BE-BE42-4EA3-BF4D-D992223046D9} = {E87FD9BE-BE42-4EA3-BF4D-D992223046D9}
220 {D37774F4-253D-4760-BF64-372A943224A1} = {D37774F4-253D-4760-BF64-372A943224A1}
220 EndProjectSection 221 EndProjectSection
221EndProject 222EndProject
222 ProjectSection(ProjectDependencies) = postProject 223 ProjectSection(ProjectDependencies) = postProject
diff --git a/linden/indra/linux_crash_logger/linux_crash_logger.cpp b/linden/indra/linux_crash_logger/linux_crash_logger.cpp
index a332ccc..196ff6e 100644
--- a/linden/indra/linux_crash_logger/linux_crash_logger.cpp
+++ b/linden/indra/linux_crash_logger/linux_crash_logger.cpp
@@ -238,10 +238,8 @@ int main(int argc, char **argv)
238 db_filep = new LLFileEncoder("DB", db_file_name.c_str()); 238 db_filep = new LLFileEncoder("DB", db_file_name.c_str());
239 239
240 // Get the filename of the SecondLife.log file 240 // Get the filename of the SecondLife.log file
241 // *TODO tofu - get right MAX_PATH. 241 // *NOTE: These buffer sizes are hardcoded into a scanf() below.
242 // *FIX: What's up with this? This #define just can't be safe. 242 char tmp_sl_name[LL_MAX_PATH];
243#define MAX_PATH PATH_MAX
244 char tmp_sl_name[MAX_PATH];
245 tmp_sl_name[0] = '\0'; 243 tmp_sl_name[0] = '\0';
246 char tmp_space[256]; 244 char tmp_space[256];
247 tmp_space[0] = '\0'; 245 tmp_space[0] = '\0';
@@ -251,7 +249,7 @@ int main(int argc, char **argv)
251 { 249 {
252 // This was originally scanning for "SL Log: %[^\r\n]", which happily skipped to the next line 250 // This was originally scanning for "SL Log: %[^\r\n]", which happily skipped to the next line
253 // on debug logs (which don't have anything after "SL Log:" and tried to open a nonsensical filename. 251 // on debug logs (which don't have anything after "SL Log:" and tried to open a nonsensical filename.
254 sscanf(db_filep->mBuf.c_str(), "SL Log:%[ ]%[^\r\n]", tmp_space, tmp_sl_name); 252 sscanf(db_filep->mBuf.c_str(), "SL Log:%255[ ]%1023[^\r\n]", tmp_space, tmp_sl_name);
255 } 253 }
256 else 254 else
257 { 255 {
diff --git a/linden/indra/llaudio/audioengine_fmod.cpp b/linden/indra/llaudio/audioengine_fmod.cpp
index a4ddd1f..a69212e 100644
--- a/linden/indra/llaudio/audioengine_fmod.cpp
+++ b/linden/indra/llaudio/audioengine_fmod.cpp
@@ -1136,7 +1136,7 @@ void * F_CALLBACKAPI windCallback(void *originalbuffer, void *newbuffer, int len
1136 double nextSample; 1136 double nextSample;
1137 1137
1138 // start with white noise 1138 // start with white noise
1139 nextSample = frand(2.0f) - 1.0f; 1139 nextSample = llclamp((ll_frand(2.0f) - 1.0f), -1.0f, 1.0f);
1140 1140
1141#if 1 // LLAE_WIND_PINK apply pinking filter 1141#if 1 // LLAE_WIND_PINK apply pinking filter
1142 gbuf0 = 0.997f * gbuf0 + 0.0126502f * nextSample; 1142 gbuf0 = 0.997f * gbuf0 + 0.0126502f * nextSample;
diff --git a/linden/indra/llaudio/vorbisencode.cpp b/linden/indra/llaudio/vorbisencode.cpp
index 6007940..c8716cc 100644
--- a/linden/indra/llaudio/vorbisencode.cpp
+++ b/linden/indra/llaudio/vorbisencode.cpp
@@ -322,7 +322,7 @@ S32 encode_vorbis_file_at(const char *in_fname, const char *out_fname, S32 bitra
322 /* set up our packet->stream encoder */ 322 /* set up our packet->stream encoder */
323 /* pick a random serial number; that way we can more likely build 323 /* pick a random serial number; that way we can more likely build
324 chained streams just by concatenation */ 324 chained streams just by concatenation */
325 ogg_stream_init(&os,(int)frand(0xFFFFFF)); 325 ogg_stream_init(&os, ll_rand());
326 326
327 /* Vorbis streams begin with three headers; the initial header (with 327 /* Vorbis streams begin with three headers; the initial header (with
328 most of the codec setup parameters) which is mandated by the Ogg 328 most of the codec setup parameters) which is mandated by the Ogg
diff --git a/linden/indra/llcharacter/llheadrotmotion.cpp b/linden/indra/llcharacter/llheadrotmotion.cpp
index 3bf7be0..1d1771d 100644
--- a/linden/indra/llcharacter/llheadrotmotion.cpp
+++ b/linden/indra/llcharacter/llheadrotmotion.cpp
@@ -351,31 +351,31 @@ BOOL LLEyeMotion::onUpdate(F32 time, U8* joint_mask)
351 //calculate jitter 351 //calculate jitter
352 if (mEyeJitterTimer.getElapsedTimeF32() > mEyeJitterTime) 352 if (mEyeJitterTimer.getElapsedTimeF32() > mEyeJitterTime)
353 { 353 {
354 mEyeJitterTime = EYE_JITTER_MIN_TIME + frand(EYE_JITTER_MAX_TIME - EYE_JITTER_MIN_TIME); 354 mEyeJitterTime = EYE_JITTER_MIN_TIME + ll_frand(EYE_JITTER_MAX_TIME - EYE_JITTER_MIN_TIME);
355 mEyeJitterYaw = (frand(2.f) - 1.f) * EYE_JITTER_MAX_YAW; 355 mEyeJitterYaw = (ll_frand(2.f) - 1.f) * EYE_JITTER_MAX_YAW;
356 mEyeJitterPitch = (frand(2.f) - 1.f) * EYE_JITTER_MAX_PITCH; 356 mEyeJitterPitch = (ll_frand(2.f) - 1.f) * EYE_JITTER_MAX_PITCH;
357 // make sure lookaway time count gets updated, because we're resetting the timer 357 // make sure lookaway time count gets updated, because we're resetting the timer
358 mEyeLookAwayTime -= llmax(0.f, mEyeJitterTimer.getElapsedTimeF32()); 358 mEyeLookAwayTime -= llmax(0.f, mEyeJitterTimer.getElapsedTimeF32());
359 mEyeJitterTimer.reset(); 359 mEyeJitterTimer.reset();
360 } 360 }
361 else if (mEyeJitterTimer.getElapsedTimeF32() > mEyeLookAwayTime) 361 else if (mEyeJitterTimer.getElapsedTimeF32() > mEyeLookAwayTime)
362 { 362 {
363 if (frand(1.f) > 0.1f) 363 if (ll_frand() > 0.1f)
364 { 364 {
365 // blink while moving eyes some percentage of the time 365 // blink while moving eyes some percentage of the time
366 mEyeBlinkTime = mEyeBlinkTimer.getElapsedTimeF32(); 366 mEyeBlinkTime = mEyeBlinkTimer.getElapsedTimeF32();
367 } 367 }
368 if (mEyeLookAwayYaw == 0.f && mEyeLookAwayPitch == 0.f) 368 if (mEyeLookAwayYaw == 0.f && mEyeLookAwayPitch == 0.f)
369 { 369 {
370 mEyeLookAwayYaw = (frand(2.f) - 1.f) * EYE_LOOK_AWAY_MAX_YAW; 370 mEyeLookAwayYaw = (ll_frand(2.f) - 1.f) * EYE_LOOK_AWAY_MAX_YAW;
371 mEyeLookAwayPitch = (frand(2.f) - 1.f) * EYE_LOOK_AWAY_MAX_PITCH; 371 mEyeLookAwayPitch = (ll_frand(2.f) - 1.f) * EYE_LOOK_AWAY_MAX_PITCH;
372 mEyeLookAwayTime = EYE_LOOK_BACK_MIN_TIME + frand(EYE_LOOK_BACK_MAX_TIME - EYE_LOOK_BACK_MIN_TIME); 372 mEyeLookAwayTime = EYE_LOOK_BACK_MIN_TIME + ll_frand(EYE_LOOK_BACK_MAX_TIME - EYE_LOOK_BACK_MIN_TIME);
373 } 373 }
374 else 374 else
375 { 375 {
376 mEyeLookAwayYaw = 0.f; 376 mEyeLookAwayYaw = 0.f;
377 mEyeLookAwayPitch = 0.f; 377 mEyeLookAwayPitch = 0.f;
378 mEyeLookAwayTime = EYE_LOOK_AWAY_MIN_TIME + frand(EYE_LOOK_AWAY_MAX_TIME - EYE_LOOK_AWAY_MIN_TIME); 378 mEyeLookAwayTime = EYE_LOOK_AWAY_MIN_TIME + ll_frand(EYE_LOOK_AWAY_MAX_TIME - EYE_LOOK_AWAY_MIN_TIME);
379 } 379 }
380 } 380 }
381 381
@@ -414,7 +414,7 @@ BOOL LLEyeMotion::onUpdate(F32 time, U8* joint_mask)
414 if (rightEyeBlinkMorph == 0.f) 414 if (rightEyeBlinkMorph == 0.f)
415 { 415 {
416 mEyesClosed = FALSE; 416 mEyesClosed = FALSE;
417 mEyeBlinkTime = EYE_BLINK_MIN_TIME + frand(EYE_BLINK_MAX_TIME - EYE_BLINK_MIN_TIME); 417 mEyeBlinkTime = EYE_BLINK_MIN_TIME + ll_frand(EYE_BLINK_MAX_TIME - EYE_BLINK_MIN_TIME);
418 mEyeBlinkTimer.reset(); 418 mEyeBlinkTimer.reset();
419 } 419 }
420 } 420 }
diff --git a/linden/indra/llcommon/doublelinkedlist.h b/linden/indra/llcommon/doublelinkedlist.h
index ef289b2..833e73c 100644
--- a/linden/indra/llcommon/doublelinkedlist.h
+++ b/linden/indra/llcommon/doublelinkedlist.h
@@ -1362,7 +1362,7 @@ void LLDoubleLinkedList<DATA_TYPE>::scramble()
1362 DATA_TYPE *datap = getFirstData(); 1362 DATA_TYPE *datap = getFirstData();
1363 while(datap) 1363 while(datap)
1364 { 1364 {
1365 random_number = gLindenLabRandomNumber.llrand() % 5; 1365 random_number = ll_rand(5);
1366 1366
1367 if (0 == random_number) 1367 if (0 == random_number)
1368 { 1368 {
diff --git a/linden/indra/llcommon/lldefs.h b/linden/indra/llcommon/lldefs.h
index 2bba4f8..c0435fb 100644
--- a/linden/indra/llcommon/lldefs.h
+++ b/linden/indra/llcommon/lldefs.h
@@ -132,11 +132,22 @@ const U32 RIGHT_SIDE = 4;
132const U32 TOP_SIDE = 5; 132const U32 TOP_SIDE = 5;
133const U32 BOTTOM_SIDE = 6; 133const U32 BOTTOM_SIDE = 6;
134 134
135
136//
137// *NOTE: These values may be used as hard-coded numbers in scanf() variants.
138//
139// --------------
140// DO NOT CHANGE.
141// --------------
142//
135const U32 LL_MAX_PATH = 1024; // buffer size of maximum path + filename string length 143const U32 LL_MAX_PATH = 1024; // buffer size of maximum path + filename string length
136 144
137// For strings we send in messages 145// For strings we send in messages
138const U32 STD_STRING_BUF_SIZE = 255; // Buffer size 146const U32 STD_STRING_BUF_SIZE = 255; // Buffer size
139const U32 STD_STRING_STR_LEN = 254; // Length of the string (not including \0) 147const U32 STD_STRING_STR_LEN = 254; // Length of the string (not including \0)
148
149// *NOTE: This value is used as hard-coded numbers in scanf() variants.
150// DO NOT CHANGE.
140const U32 MAX_STRING = STD_STRING_BUF_SIZE; // Buffer size 151const U32 MAX_STRING = STD_STRING_BUF_SIZE; // Buffer size
141 152
142const U32 MAXADDRSTR = 17; // 123.567.901.345 = 15 chars + \0 + 1 for good luck 153const U32 MAXADDRSTR = 17; // 123.567.901.345 = 15 chars + \0 + 1 for good luck
diff --git a/linden/indra/llcommon/llfasttimer.h b/linden/indra/llcommon/llfasttimer.h
index e598096..b5e0734 100644
--- a/linden/indra/llcommon/llfasttimer.h
+++ b/linden/indra/llcommon/llfasttimer.h
@@ -47,7 +47,11 @@ public:
47 FTM_IDLE, 47 FTM_IDLE,
48 FTM_SLEEP, 48 FTM_SLEEP,
49 49
50 // common simulate components 50 // common messaging components
51 FTM_PUMP,
52 FTM_CURL,
53
54 // common simulation components
51 FTM_UPDATE_ANIMATION, 55 FTM_UPDATE_ANIMATION,
52 FTM_UPDATE_TERRAIN, 56 FTM_UPDATE_TERRAIN,
53 FTM_UPDATE_PRIMITIVES, 57 FTM_UPDATE_PRIMITIVES,
diff --git a/linden/indra/llcommon/llptrskiplist.h b/linden/indra/llcommon/llptrskiplist.h
index bae40b8..df56556 100644
--- a/linden/indra/llcommon/llptrskiplist.h
+++ b/linden/indra/llcommon/llptrskiplist.h
@@ -273,7 +273,7 @@ inline BOOL LLPtrSkipList<DATA_TYPE, BINARY_DEPTH>::addData(DATA_TYPE *data)
273 S32 newlevel; 273 S32 newlevel;
274 for (newlevel = 1; newlevel <= mLevel && newlevel < BINARY_DEPTH; newlevel++) 274 for (newlevel = 1; newlevel <= mLevel && newlevel < BINARY_DEPTH; newlevel++)
275 { 275 {
276 if (frand(1.f) < 0.5f) 276 if (ll_frand() < 0.5f)
277 break; 277 break;
278 } 278 }
279 279
diff --git a/linden/indra/llcommon/llptrskipmap.h b/linden/indra/llcommon/llptrskipmap.h
index d4e4de3..c4e131f 100644
--- a/linden/indra/llcommon/llptrskipmap.h
+++ b/linden/indra/llcommon/llptrskipmap.h
@@ -343,7 +343,7 @@ inline DATA_T &LLPtrSkipMap<INDEX_T, DATA_T, BINARY_DEPTH>::addData(const INDEX_
343 S32 newlevel; 343 S32 newlevel;
344 for (newlevel = 1; newlevel <= mLevel && newlevel < BINARY_DEPTH; newlevel++) 344 for (newlevel = 1; newlevel <= mLevel && newlevel < BINARY_DEPTH; newlevel++)
345 { 345 {
346 if (frand(1.f) < 0.5f) 346 if (ll_frand() < 0.5f)
347 { 347 {
348 break; 348 break;
349 } 349 }
@@ -411,7 +411,7 @@ inline DATA_T &LLPtrSkipMap<INDEX_T, DATA_T, BINARY_DEPTH>::addData(const INDEX_
411 S32 newlevel; 411 S32 newlevel;
412 for (newlevel = 1; newlevel <= mLevel && newlevel < BINARY_DEPTH; newlevel++) 412 for (newlevel = 1; newlevel <= mLevel && newlevel < BINARY_DEPTH; newlevel++)
413 { 413 {
414 if (frand(1.f) < 0.5f) 414 if (ll_frand() < 0.5f)
415 break; 415 break;
416 } 416 }
417 417
@@ -489,7 +489,7 @@ inline DATA_T &LLPtrSkipMap<INDEX_T, DATA_T, BINARY_DEPTH>::getData(const INDEX_
489 S32 newlevel; 489 S32 newlevel;
490 for (newlevel = 1; newlevel <= mLevel && newlevel < BINARY_DEPTH; newlevel++) 490 for (newlevel = 1; newlevel <= mLevel && newlevel < BINARY_DEPTH; newlevel++)
491 { 491 {
492 if (frand(1.f) < 0.5f) 492 if (ll_frand() < 0.5f)
493 break; 493 break;
494 } 494 }
495 495
diff --git a/linden/indra/llcommon/llskiplist.h b/linden/indra/llcommon/llskiplist.h
index 0d85749..bd28cea 100644
--- a/linden/indra/llcommon/llskiplist.h
+++ b/linden/indra/llcommon/llskiplist.h
@@ -242,7 +242,7 @@ inline BOOL LLSkipList<DATA_TYPE, BINARY_DEPTH>::addData(const DATA_TYPE& data)
242 S32 newlevel; 242 S32 newlevel;
243 for (newlevel = 1; newlevel <= mLevel && newlevel < BINARY_DEPTH; newlevel++) 243 for (newlevel = 1; newlevel <= mLevel && newlevel < BINARY_DEPTH; newlevel++)
244 { 244 {
245 if (frand(1.f) < 0.5f) 245 if (ll_frand() < 0.5f)
246 break; 246 break;
247 } 247 }
248 248
diff --git a/linden/indra/llcommon/llversion.h b/linden/indra/llcommon/llversion.h
index 83477a1..9cb01a3 100644
--- a/linden/indra/llcommon/llversion.h
+++ b/linden/indra/llcommon/llversion.h
@@ -34,7 +34,7 @@
34const S32 LL_VERSION_MAJOR = 1; 34const S32 LL_VERSION_MAJOR = 1;
35const S32 LL_VERSION_MINOR = 13; 35const S32 LL_VERSION_MINOR = 13;
36const S32 LL_VERSION_PATCH = 2; 36const S32 LL_VERSION_PATCH = 2;
37const S32 LL_VERSION_BUILD = 12; 37const S32 LL_VERSION_BUILD = 15;
38 38
39 39
40 40
diff --git a/linden/indra/llinventory/llinventory.cpp b/linden/indra/llinventory/llinventory.cpp
index 1f7efb3..3235748 100644
--- a/linden/indra/llinventory/llinventory.cpp
+++ b/linden/indra/llinventory/llinventory.cpp
@@ -320,6 +320,8 @@ void LLInventoryObject::setType(LLAssetType::EType type)
320// virtual 320// virtual
321BOOL LLInventoryObject::importLegacyStream(std::istream& input_stream) 321BOOL LLInventoryObject::importLegacyStream(std::istream& input_stream)
322{ 322{
323 // *NOTE: Changing the buffer size will require changing the scanf
324 // calls below.
323 char buffer[MAX_STRING]; 325 char buffer[MAX_STRING];
324 char keyword[MAX_STRING]; 326 char keyword[MAX_STRING];
325 char valuestr[MAX_STRING]; 327 char valuestr[MAX_STRING];
@@ -358,7 +360,7 @@ BOOL LLInventoryObject::importLegacyStream(std::istream& input_stream)
358 { 360 {
359 //strcpy(valuestr, buffer + strlen(keyword) + 3); 361 //strcpy(valuestr, buffer + strlen(keyword) + 3);
360 // *NOTE: Not ANSI C, but widely supported. 362 // *NOTE: Not ANSI C, but widely supported.
361 sscanf(buffer, " %254s %[^|]", keyword, valuestr); 363 sscanf(buffer, " %254s %254[^|]", keyword, valuestr);
362 mName.assign(valuestr); 364 mName.assign(valuestr);
363 LLString::replaceNonstandardASCII(mName, ' '); 365 LLString::replaceNonstandardASCII(mName, ' ');
364 LLString::replaceChar(mName, '|', ' '); 366 LLString::replaceChar(mName, '|', ' ');
@@ -681,6 +683,8 @@ BOOL LLInventoryItem::unpackMessage(LLMessageSystem* msg, const char* block, S32
681// virtual 683// virtual
682BOOL LLInventoryItem::importFile(FILE* fp) 684BOOL LLInventoryItem::importFile(FILE* fp)
683{ 685{
686 // *NOTE: Changing the buffer size will require changing the scanf
687 // calls below.
684 char buffer[MAX_STRING]; 688 char buffer[MAX_STRING];
685 char keyword[MAX_STRING]; 689 char keyword[MAX_STRING];
686 char valuestr[MAX_STRING]; 690 char valuestr[MAX_STRING];
@@ -769,7 +773,7 @@ BOOL LLInventoryItem::importFile(FILE* fp)
769 { 773 {
770 //strcpy(valuestr, buffer + strlen(keyword) + 3); 774 //strcpy(valuestr, buffer + strlen(keyword) + 3);
771 // *NOTE: Not ANSI C, but widely supported. 775 // *NOTE: Not ANSI C, but widely supported.
772 sscanf(buffer, " %254s%[\t]%[^|]", keyword, junk, valuestr); 776 sscanf(buffer, " %254s%254[\t]%254[^|]", keyword, junk, valuestr);
773 777
774 // IW: sscanf chokes and puts | in valuestr if there's no name 778 // IW: sscanf chokes and puts | in valuestr if there's no name
775 if (valuestr[0] == '|') 779 if (valuestr[0] == '|')
@@ -785,7 +789,7 @@ BOOL LLInventoryItem::importFile(FILE* fp)
785 { 789 {
786 //strcpy(valuestr, buffer + strlen(keyword) + 3); 790 //strcpy(valuestr, buffer + strlen(keyword) + 3);
787 // *NOTE: Not ANSI C, but widely supported. 791 // *NOTE: Not ANSI C, but widely supported.
788 sscanf(buffer, " %s%[\t]%[^|]", keyword, junk, valuestr); 792 sscanf(buffer, " %254s%254[\t]%254[^|]", keyword, junk, valuestr);
789 793
790 if (valuestr[0] == '|') 794 if (valuestr[0] == '|')
791 { 795 {
@@ -875,6 +879,8 @@ BOOL LLInventoryItem::exportFile(FILE* fp, BOOL include_asset_key) const
875// virtual 879// virtual
876BOOL LLInventoryItem::importLegacyStream(std::istream& input_stream) 880BOOL LLInventoryItem::importLegacyStream(std::istream& input_stream)
877{ 881{
882 // *NOTE: Changing the buffer size will require changing the scanf
883 // calls below.
878 char buffer[MAX_STRING]; 884 char buffer[MAX_STRING];
879 char keyword[MAX_STRING]; 885 char keyword[MAX_STRING];
880 char valuestr[MAX_STRING]; 886 char valuestr[MAX_STRING];
@@ -889,7 +895,7 @@ BOOL LLInventoryItem::importLegacyStream(std::istream& input_stream)
889 while(success && input_stream.good()) 895 while(success && input_stream.good())
890 { 896 {
891 input_stream.getline(buffer, MAX_STRING); 897 input_stream.getline(buffer, MAX_STRING);
892 sscanf(buffer, " %s %s", keyword, valuestr); 898 sscanf(buffer, " %254s %254s", keyword, valuestr);
893 if(!keyword) 899 if(!keyword)
894 { 900 {
895 continue; 901 continue;
@@ -963,7 +969,7 @@ BOOL LLInventoryItem::importLegacyStream(std::istream& input_stream)
963 { 969 {
964 //strcpy(valuestr, buffer + strlen(keyword) + 3); 970 //strcpy(valuestr, buffer + strlen(keyword) + 3);
965 // *NOTE: Not ANSI C, but widely supported. 971 // *NOTE: Not ANSI C, but widely supported.
966 sscanf(buffer, " %s%[\t]%[^|]", keyword, junk, valuestr); 972 sscanf(buffer, " %254s%254[\t]%254[^|]", keyword, junk, valuestr);
967 973
968 // IW: sscanf chokes and puts | in valuestr if there's no name 974 // IW: sscanf chokes and puts | in valuestr if there's no name
969 if (valuestr[0] == '|') 975 if (valuestr[0] == '|')
@@ -979,7 +985,7 @@ BOOL LLInventoryItem::importLegacyStream(std::istream& input_stream)
979 { 985 {
980 //strcpy(valuestr, buffer + strlen(keyword) + 3); 986 //strcpy(valuestr, buffer + strlen(keyword) + 3);
981 // *NOTE: Not ANSI C, but widely supported. 987 // *NOTE: Not ANSI C, but widely supported.
982 sscanf(buffer, " %s%[\t]%[^|]", keyword, junk, valuestr); 988 sscanf(buffer, " %254s%254[\t]%254[^|]", keyword, junk, valuestr);
983 989
984 if (valuestr[0] == '|') 990 if (valuestr[0] == '|')
985 { 991 {
@@ -1522,6 +1528,8 @@ void LLInventoryCategory::unpackMessage(LLMessageSystem* msg,
1522// virtual 1528// virtual
1523BOOL LLInventoryCategory::importFile(FILE* fp) 1529BOOL LLInventoryCategory::importFile(FILE* fp)
1524{ 1530{
1531 // *NOTE: Changing the buffer size will require changing the scanf
1532 // calls below.
1525 char buffer[MAX_STRING]; 1533 char buffer[MAX_STRING];
1526 char keyword[MAX_STRING]; 1534 char keyword[MAX_STRING];
1527 char valuestr[MAX_STRING]; 1535 char valuestr[MAX_STRING];
@@ -1531,7 +1539,7 @@ BOOL LLInventoryCategory::importFile(FILE* fp)
1531 while(!feof(fp)) 1539 while(!feof(fp))
1532 { 1540 {
1533 fgets(buffer, MAX_STRING, fp); 1541 fgets(buffer, MAX_STRING, fp);
1534 sscanf(buffer, " %s %s", keyword, valuestr); 1542 sscanf(buffer, " %254s %254s", keyword, valuestr);
1535 if(!keyword) 1543 if(!keyword)
1536 { 1544 {
1537 continue; 1545 continue;
@@ -1564,7 +1572,7 @@ BOOL LLInventoryCategory::importFile(FILE* fp)
1564 { 1572 {
1565 //strcpy(valuestr, buffer + strlen(keyword) + 3); 1573 //strcpy(valuestr, buffer + strlen(keyword) + 3);
1566 // *NOTE: Not ANSI C, but widely supported. 1574 // *NOTE: Not ANSI C, but widely supported.
1567 sscanf(buffer, " %s %[^|]", keyword, valuestr); 1575 sscanf(buffer, " %254s %254[^|]", keyword, valuestr);
1568 mName.assign(valuestr); 1576 mName.assign(valuestr);
1569 LLString::replaceNonstandardASCII(mName, ' '); 1577 LLString::replaceNonstandardASCII(mName, ' ');
1570 LLString::replaceChar(mName, '|', ' '); 1578 LLString::replaceChar(mName, '|', ' ');
@@ -1597,6 +1605,8 @@ BOOL LLInventoryCategory::exportFile(FILE* fp, BOOL) const
1597// virtual 1605// virtual
1598BOOL LLInventoryCategory::importLegacyStream(std::istream& input_stream) 1606BOOL LLInventoryCategory::importLegacyStream(std::istream& input_stream)
1599{ 1607{
1608 // *NOTE: Changing the buffer size will require changing the scanf
1609 // calls below.
1600 char buffer[MAX_STRING]; 1610 char buffer[MAX_STRING];
1601 char keyword[MAX_STRING]; 1611 char keyword[MAX_STRING];
1602 char valuestr[MAX_STRING]; 1612 char valuestr[MAX_STRING];
@@ -1606,7 +1616,7 @@ BOOL LLInventoryCategory::importLegacyStream(std::istream& input_stream)
1606 while(input_stream.good()) 1616 while(input_stream.good())
1607 { 1617 {
1608 input_stream.getline(buffer, MAX_STRING); 1618 input_stream.getline(buffer, MAX_STRING);
1609 sscanf(buffer, " %s %s", keyword, valuestr); 1619 sscanf(buffer, " %254s %254s", keyword, valuestr);
1610 if(!keyword) 1620 if(!keyword)
1611 { 1621 {
1612 continue; 1622 continue;
@@ -1639,7 +1649,7 @@ BOOL LLInventoryCategory::importLegacyStream(std::istream& input_stream)
1639 { 1649 {
1640 //strcpy(valuestr, buffer + strlen(keyword) + 3); 1650 //strcpy(valuestr, buffer + strlen(keyword) + 3);
1641 // *NOTE: Not ANSI C, but widely supported. 1651 // *NOTE: Not ANSI C, but widely supported.
1642 sscanf(buffer, " %s %[^|]", keyword, valuestr); 1652 sscanf(buffer, " %254s %254[^|]", keyword, valuestr);
1643 mName.assign(valuestr); 1653 mName.assign(valuestr);
1644 LLString::replaceNonstandardASCII(mName, ' '); 1654 LLString::replaceNonstandardASCII(mName, ' ');
1645 LLString::replaceChar(mName, '|', ' '); 1655 LLString::replaceChar(mName, '|', ' ');
diff --git a/linden/indra/llinventory/lllandmark.cpp b/linden/indra/llinventory/lllandmark.cpp
index bca64d1..d7dca20 100644
--- a/linden/indra/llinventory/lllandmark.cpp
+++ b/linden/indra/llinventory/lllandmark.cpp
@@ -138,10 +138,12 @@ LLLandmark* LLLandmark::constructFromString(const char *buffer)
138 } 138 }
139 else if(version == 2) 139 else if(version == 2)
140 { 140 {
141 // *NOTE: Changing the buffer size will require changing the
142 // scanf call below.
141 char region_id_str[MAX_STRING]; 143 char region_id_str[MAX_STRING];
142 LLVector3 pos; 144 LLVector3 pos;
143 cur += chars_read; 145 cur += chars_read;
144 count = sscanf(cur, "region_id %s\n%n", region_id_str, &chars_read); 146 count = sscanf(cur, "region_id %254s\n%n", region_id_str, &chars_read);
145 if(count != 1) goto error; 147 if(count != 1) goto error;
146 cur += chars_read; 148 cur += chars_read;
147 count = sscanf(cur, "local_pos %f %f %f\n%n", pos.mV+VX, pos.mV+VY, pos.mV+VZ, &chars_read); 149 count = sscanf(cur, "local_pos %f %f %f\n%n", pos.mV+VX, pos.mV+VY, pos.mV+VZ, &chars_read);
diff --git a/linden/indra/llinventory/llpermissions.cpp b/linden/indra/llinventory/llpermissions.cpp
index 39e7a72..35dbc3e 100644
--- a/linden/indra/llinventory/llpermissions.cpp
+++ b/linden/indra/llinventory/llpermissions.cpp
@@ -511,6 +511,8 @@ BOOL LLPermissions::importFile(FILE *fp)
511 init(LLUUID::null, LLUUID::null, LLUUID::null, LLUUID::null); 511 init(LLUUID::null, LLUUID::null, LLUUID::null, LLUUID::null);
512 const S32 BUFSIZE = 16384; 512 const S32 BUFSIZE = 16384;
513 513
514 // *NOTE: Changing the buffer size will require changing the scanf
515 // calls below.
514 char buffer[BUFSIZE]; 516 char buffer[BUFSIZE];
515 char keyword[256]; 517 char keyword[256];
516 char valuestr[256]; 518 char valuestr[256];
@@ -523,7 +525,7 @@ BOOL LLPermissions::importFile(FILE *fp)
523 while (!feof(fp)) 525 while (!feof(fp))
524 { 526 {
525 fgets(buffer, BUFSIZE, fp); 527 fgets(buffer, BUFSIZE, fp);
526 sscanf(buffer, " %s %s", keyword, valuestr); 528 sscanf(buffer, " %255s %255s", keyword, valuestr);
527 if (!keyword) 529 if (!keyword)
528 { 530 {
529 continue; 531 continue;
@@ -571,22 +573,22 @@ BOOL LLPermissions::importFile(FILE *fp)
571 } 573 }
572 else if (!strcmp("creator_id", keyword)) 574 else if (!strcmp("creator_id", keyword))
573 { 575 {
574 sscanf(valuestr, "%s", uuid_str); 576 sscanf(valuestr, "%255s", uuid_str);
575 mCreator.set(uuid_str); 577 mCreator.set(uuid_str);
576 } 578 }
577 else if (!strcmp("owner_id", keyword)) 579 else if (!strcmp("owner_id", keyword))
578 { 580 {
579 sscanf(valuestr, "%s", uuid_str); 581 sscanf(valuestr, "%255s", uuid_str);
580 mOwner.set(uuid_str); 582 mOwner.set(uuid_str);
581 } 583 }
582 else if (!strcmp("last_owner_id", keyword)) 584 else if (!strcmp("last_owner_id", keyword))
583 { 585 {
584 sscanf(valuestr, "%s", uuid_str); 586 sscanf(valuestr, "%255s", uuid_str);
585 mLastOwner.set(uuid_str); 587 mLastOwner.set(uuid_str);
586 } 588 }
587 else if (!strcmp("group_id", keyword)) 589 else if (!strcmp("group_id", keyword))
588 { 590 {
589 sscanf(valuestr, "%s", uuid_str); 591 sscanf(valuestr, "%255s", uuid_str);
590 mGroup.set(uuid_str); 592 mGroup.set(uuid_str);
591 } 593 }
592 else if (!strcmp("group_owned", keyword)) 594 else if (!strcmp("group_owned", keyword))
@@ -644,6 +646,8 @@ BOOL LLPermissions::importLegacyStream(std::istream& input_stream)
644 init(LLUUID::null, LLUUID::null, LLUUID::null, LLUUID::null); 646 init(LLUUID::null, LLUUID::null, LLUUID::null, LLUUID::null);
645 const S32 BUFSIZE = 16384; 647 const S32 BUFSIZE = 16384;
646 648
649 // *NOTE: Changing the buffer size will require changing the scanf
650 // calls below.
647 char buffer[BUFSIZE]; 651 char buffer[BUFSIZE];
648 char keyword[256]; 652 char keyword[256];
649 char valuestr[256]; 653 char valuestr[256];
@@ -656,7 +660,7 @@ BOOL LLPermissions::importLegacyStream(std::istream& input_stream)
656 while (input_stream.good()) 660 while (input_stream.good())
657 { 661 {
658 input_stream.getline(buffer, BUFSIZE); 662 input_stream.getline(buffer, BUFSIZE);
659 sscanf(buffer, " %s %s", keyword, valuestr); 663 sscanf(buffer, " %255s %255s", keyword, valuestr);
660 if (!keyword) 664 if (!keyword)
661 { 665 {
662 continue; 666 continue;
@@ -704,22 +708,22 @@ BOOL LLPermissions::importLegacyStream(std::istream& input_stream)
704 } 708 }
705 else if (!strcmp("creator_id", keyword)) 709 else if (!strcmp("creator_id", keyword))
706 { 710 {
707 sscanf(valuestr, "%s", uuid_str); 711 sscanf(valuestr, "%255s", uuid_str);
708 mCreator.set(uuid_str); 712 mCreator.set(uuid_str);
709 } 713 }
710 else if (!strcmp("owner_id", keyword)) 714 else if (!strcmp("owner_id", keyword))
711 { 715 {
712 sscanf(valuestr, "%s", uuid_str); 716 sscanf(valuestr, "%255s", uuid_str);
713 mOwner.set(uuid_str); 717 mOwner.set(uuid_str);
714 } 718 }
715 else if (!strcmp("last_owner_id", keyword)) 719 else if (!strcmp("last_owner_id", keyword))
716 { 720 {
717 sscanf(valuestr, "%s", uuid_str); 721 sscanf(valuestr, "%255s", uuid_str);
718 mLastOwner.set(uuid_str); 722 mLastOwner.set(uuid_str);
719 } 723 }
720 else if (!strcmp("group_id", keyword)) 724 else if (!strcmp("group_id", keyword))
721 { 725 {
722 sscanf(valuestr, "%s", uuid_str); 726 sscanf(valuestr, "%255s", uuid_str);
723 mGroup.set(uuid_str); 727 mGroup.set(uuid_str);
724 } 728 }
725 else if (!strcmp("group_owned", keyword)) 729 else if (!strcmp("group_owned", keyword))
diff --git a/linden/indra/llinventory/llsaleinfo.cpp b/linden/indra/llinventory/llsaleinfo.cpp
index b82bd18..98043d1 100644
--- a/linden/indra/llinventory/llsaleinfo.cpp
+++ b/linden/indra/llinventory/llsaleinfo.cpp
@@ -158,6 +158,8 @@ BOOL LLSaleInfo::importFile(FILE* fp, BOOL& has_perm_mask, U32& perm_mask)
158{ 158{
159 has_perm_mask = FALSE; 159 has_perm_mask = FALSE;
160 160
161 // *NOTE: Changing the buffer size will require changing the scanf
162 // calls below.
161 char buffer[MAX_STRING]; 163 char buffer[MAX_STRING];
162 char keyword[MAX_STRING]; 164 char keyword[MAX_STRING];
163 char valuestr[MAX_STRING]; 165 char valuestr[MAX_STRING];
@@ -168,7 +170,7 @@ BOOL LLSaleInfo::importFile(FILE* fp, BOOL& has_perm_mask, U32& perm_mask)
168 while(success && (!feof(fp))) 170 while(success && (!feof(fp)))
169 { 171 {
170 fgets(buffer, MAX_STRING, fp); 172 fgets(buffer, MAX_STRING, fp);
171 sscanf(buffer, " %s %s", keyword, valuestr); 173 sscanf(buffer, " %254s %254s", keyword, valuestr);
172 if(!keyword) 174 if(!keyword)
173 { 175 {
174 continue; 176 continue;
@@ -209,6 +211,8 @@ BOOL LLSaleInfo::importLegacyStream(std::istream& input_stream, BOOL& has_perm_m
209{ 211{
210 has_perm_mask = FALSE; 212 has_perm_mask = FALSE;
211 213
214 // *NOTE: Changing the buffer size will require changing the scanf
215 // calls below.
212 char buffer[MAX_STRING]; 216 char buffer[MAX_STRING];
213 char keyword[MAX_STRING]; 217 char keyword[MAX_STRING];
214 char valuestr[MAX_STRING]; 218 char valuestr[MAX_STRING];
@@ -219,7 +223,7 @@ BOOL LLSaleInfo::importLegacyStream(std::istream& input_stream, BOOL& has_perm_m
219 while(success && input_stream.good()) 223 while(success && input_stream.good())
220 { 224 {
221 input_stream.getline(buffer, MAX_STRING); 225 input_stream.getline(buffer, MAX_STRING);
222 sscanf(buffer, " %s %s", keyword, valuestr); 226 sscanf(buffer, " %254s %254s", keyword, valuestr);
223 if(!keyword) 227 if(!keyword)
224 { 228 {
225 continue; 229 continue;
diff --git a/linden/indra/llmath/llrand.cpp b/linden/indra/llmath/llrand.cpp
index 38e0639..4c214c4 100644
--- a/linden/indra/llmath/llrand.cpp
+++ b/linden/indra/llmath/llrand.cpp
@@ -1,6 +1,6 @@
1/** 1/**
2 * @file llrand.cpp 2 * @file llrand.cpp
3 * @brief a few useful math functions. 3 * @brief Global random generator.
4 * 4 *
5 * Copyright (c) 2000-2007, Linden Research, Inc. 5 * Copyright (c) 2000-2007, Linden Research, Inc.
6 * 6 *
@@ -30,45 +30,34 @@
30#include "llrand.h" 30#include "llrand.h"
31#include "lluuid.h" 31#include "lluuid.h"
32 32
33/* Put this back if you re-enabled slamFPCW 33static LLRandLagFib2281 gRandomGenerator(LLUUID::getRandomSeed());
34#if LL_WINDOWS
35#include <float.h>
36#else
37#include <stdlib.h>
38#endif
39*/
40 34
41void slamFPCW( void ) 35S32 ll_rand()
42{ 36{
43/* 37 return (S32)(gRandomGenerator() * RAND_MAX);
44#if LL_WINDOWS
45 // for Intel based CPUs, slam the FP control word directly
46 WORD wTemp, wSave;
47
48 __asm fstcw wSave
49 if ( (wSave & 0x300) // Not single mode
50 ||(0x3f != (wSave & 0x3f)) // Exceptions enabled
51 ||(wSave & 0xC00)) // Not round to nearest mode
52 {
53 __asm
54 {
55 mov ax, wSave
56 and ax, not 300h ;; single mode
57 or ax, 3fh ;; disable all exceptions
58 and ax, not 0xC00 ;; round to nearest mode
59 mov wTemp, ax
60 fldcw wTemp
61 }
62 }
63#endif
64*/
65} 38}
66 39
67LLRand gLindenLabRandomNumber(LLUUID::getRandomSeed()); 40S32 ll_rand(S32 val)
41{
42 return (S32)(gRandomGenerator() * val);
43}
44
45F32 ll_frand()
46{
47 return (F32)gRandomGenerator();
48}
68 49
69F32 frand(F32 val) 50F32 ll_frand(F32 val)
70{ 51{
71// return (val * (F32)rand()/(F32)RAND_MAX); 52 return (F32)gRandomGenerator() * val;
72 return gLindenLabRandomNumber.llfrand(val);
73} 53}
74 54
55F64 ll_drand()
56{
57 return gRandomGenerator();
58}
59
60F64 ll_drand(F64 val)
61{
62 return gRandomGenerator() * val;
63}
diff --git a/linden/indra/llmath/llrand.h b/linden/indra/llmath/llrand.h
index db9f353..47b5651 100644
--- a/linden/indra/llmath/llrand.h
+++ b/linden/indra/llmath/llrand.h
@@ -1,6 +1,6 @@
1/** 1/**
2 * @file llrand.h 2 * @file llrand.h
3 * @brief Some useful math functions. 3 * @brief Information, functions, and typedefs for randomness.
4 * 4 *
5 * Copyright (c) 2000-2007, Linden Research, Inc. 5 * Copyright (c) 2000-2007, Linden Research, Inc.
6 * 6 *
@@ -28,61 +28,101 @@
28#ifndef LL_LLRAND_H 28#ifndef LL_LLRAND_H
29#define LL_LLRAND_H 29#define LL_LLRAND_H
30 30
31// As long as you #include "llviewerprecompiledheaders.h", 31#include "boost/random/lagged_fibonacci.hpp"
32// you can use "gLindenLabRandomNumber.llfrand( range );" which returns a 32#include "boost/random/mersenne_twister.hpp"
33// random number F32 ranging from 0.0f to range.
34// -Ventrella - Sept 30, 2005
35 33
36// Slams Intel processors into Single Precision FP mode 34/**
37// (which is not any faster on modern hardware) 35 * Use the boost random number generators if you want a stateful
38void slamFPCW( void ); 36 * random numbers. If you want more random numbers, use the
39 37 * c-functions since they will generate faster/better randomness
40class LLRand 38 * across the process.
41{ 39 *
42public: 40 * I tested some of the boost random engines, and picked a good double
43 LLRand(U32 seed) : mSeed(seed) {} 41 * generator and a good integer generator. I also took some timings
44 ~LLRand() {} 42 * for them on linux using gcc 3.3.5. The harness also did some other
45 43 * fairly trivial operations to try to limit compiler optimizations,
46 void seed(U32 seed) { mSeed = seed; } 44 * so these numbers are only good for relative comparisons.
45 *
46 * usec/inter algorithm
47 * 0.21 boost::minstd_rand0
48 * 0.039 boost:lagged_fibonacci19937
49 * 0.036 boost:lagged_fibonacci607
50 * 0.44 boost::hellekalek1995
51 * 0.44 boost::ecuyer1988
52 * 0.042 boost::rand48
53 * 0.043 boost::mt11213b
54 * 0.028 stdlib random()
55 * 0.05 stdlib lrand48()
56 * 0.034 stdlib rand()
57 * 0.020 the old & lame LLRand
58 */
47 59
48 U32 llrand() 60/**
49 { 61 *@brief Generate a float from [0, RAND_MAX).
50 mSeed = U64L(1664525) * mSeed + U64L(1013904223); 62 */
51 return (U32)mSeed; 63S32 ll_rand();
52 }
53 64
54 U32 llrand(U32 val) 65/**
55 { 66 *@brief Generate a float from [0, val).
56 mSeed = U64L(1664525) * mSeed + U64L(1013904223); 67 */
57 return (U32)(mSeed) % val; 68S32 ll_rand(S32 val);
58 }
59 69
60 // val is the maximum 70/**
61 F32 llfrand(F32 val) 71 *@brief Generate a float from [0, 1.0).
62 { 72 */
63 const U32 FP_ONE = 0x3f800000; 73F32 ll_frand();
64 const U32 FP_MASK = 0x007fffff;
65 U32 ir = llrand();
66 74
67 ir = FP_ONE | (FP_MASK & ir); 75/**
68 76 *@brief Generate a float from [0, val).
69 // generate random float 77 */
70 F32 fr = (*(F32 *)&ir); 78F32 ll_frand(F32 val);
71 79
72 // correct to [0..1) 80/**
73 fr -= 1.f; 81 *@brief Generate a double from [0, 1.0).
82 */
83F64 ll_drand();
74 84
75 fr *= val; 85/**
86 *@brief Generate a double from [0, val).
87 */
88F64 ll_drand(F64 val);
76 89
77 return fr; 90/**
78 } 91 * @brief typedefs for good boost lagged fibonacci.
79 92 * @see boost::lagged_fibonacci
80public: 93 *
81 U64 mSeed; 94 * These generators will quickly generate doubles. Note the memory
82}; 95 * requirements, because they are somewhat high. I chose the smallest
96 * one, and one comparable in speed but higher periodicity without
97 * outrageous memory requirements.
98 * To use:
99 * LLRandLagFib607 foo((U32)time(NULL));
100 * double bar = foo();
101 */
83 102
84F32 frand(F32 val); 103typedef boost::lagged_fibonacci607 LLRandLagFib607;
104/**<
105 * lengh of cycle: 2^32,000
106 * memory: 607*sizeof(double) (about 5K)
107 */
85 108
86extern LLRand gLindenLabRandomNumber; 109typedef boost::lagged_fibonacci2281 LLRandLagFib2281;
110/**<
111 * lengh of cycle: 2^120,000
112 * memory: 2281*sizeof(double) (about 17K)
113 */
87 114
115/**
116 * @breif typedefs for a good boost mersenne twister implementation.
117 * @see boost::mersenne_twister
118 *
119 * This fairly quickly generates U32 values
120 * To use:
121 * LLRandMT19937 foo((U32)time(NULL));
122 * U32 bar = foo();
123 *
124 * lengh of cycle: 2^19,937-1
125 * memory: about 2496 bytes
126 */
127typedef boost::mt11213b LLRandMT19937;
88#endif 128#endif
diff --git a/linden/indra/llmath/lluuid.cpp b/linden/indra/llmath/lluuid.cpp
index 216dac9..3fb31a6 100644
--- a/linden/indra/llmath/lluuid.cpp
+++ b/linden/indra/llmath/lluuid.cpp
@@ -110,6 +110,40 @@ unsigned int decode( char const * fiveChars ) throw( bad_input_data )
110} 110}
111*/ 111*/
112 112
113#define LL_USE_JANKY_RANDOM_NUMBER_GENERATOR 0
114#if LL_USE_JANKY_RANDOM_NUMBER_GENERATOR
115/**
116 * @brief a global for
117 */
118static U64 sJankyRandomSeed(LLUUID::getRandomSeed());
119
120/**
121 * @brief generate a random U32.
122 */
123U32 janky_fast_random_bytes()
124{
125 sJankyRandomSeed = U64L(1664525) * sJankyRandomSeed + U64L(1013904223);
126 return (U32)sJankyRandomSeed;
127}
128
129/**
130 * @brief generate a random U32 from [0, val)
131 */
132U32 janky_fast_random_byes_range(U32 val)
133{
134 sJankyRandomSeed = U64L(1664525) * sJankyRandomSeed + U64L(1013904223);
135 return (U32)(sJankyRandomSeed) % val;
136}
137
138/**
139 * @brief generate a random U32 from [0, val)
140 */
141U32 janky_fast_random_seeded_bytes(U32 seed, U32 val)
142{
143 seed = U64L(1664525) * (U64)(seed) + U64L(1013904223);
144 return (U32)(seed) % val;
145}
146#endif
113 147
114// Common to all UUID implementations 148// Common to all UUID implementations
115void LLUUID::toString(char *out) const 149void LLUUID::toString(char *out) const
@@ -395,8 +429,16 @@ static void get_random_bytes(void *buf, int nbytes)
395 int i; 429 int i;
396 char *cp = (char *) buf; 430 char *cp = (char *) buf;
397 431
432 // *NOTE: If we are not using the janky generator ll_rand()
433 // generates at least 3 good bytes of data since it is 0 to
434 // RAND_MAX. This could be made more efficient by copying all the
435 // bytes.
398 for (i=0; i < nbytes; i++) 436 for (i=0; i < nbytes; i++)
399 *cp++ = gLindenLabRandomNumber.llrand() & 0xFF; 437#if LL_USE_JANKY_RANDOM_NUMBER_GENERATOR
438 *cp++ = janky_fast_random_bytes() & 0xFF;
439#else
440 *cp++ = ll_rand() & 0xFF;
441#endif
400 return; 442 return;
401} 443}
402 444
@@ -738,18 +780,18 @@ void LLUUID::getCurrentTime(uuid_time_t *timestamp)
738 780
739void LLUUID::generate() 781void LLUUID::generate()
740{ 782{
741 // Create a UUID. 783 // Create a UUID.
742 784 uuid_time_t timestamp;
743
744 uuid_time_t timestamp;
745 785
746 static unsigned char node_id[6]; 786 static unsigned char node_id[6];
747 static int has_init = 0; 787 static int has_init = 0;
748 788
749 // Create a UUID. 789 // Create a UUID.
750 static uuid_time_t time_last = {0,0}; 790 static uuid_time_t time_last = {0,0};
751 static U16 clock_seq = 0; 791 static U16 clock_seq = 0;
752 static LLRand random_generator(0); // dummy seed. reset it below 792#if LL_USE_JANKY_RANDOM_NUMBER_GENERATOR
793 static U32 seed = 0L; // dummy seed. reset it below
794#endif
753 if (!has_init) 795 if (!has_init)
754 { 796 {
755 if (getNodeID(node_id) <= 0) 797 if (getNodeID(node_id) <= 0)
@@ -764,8 +806,15 @@ void LLUUID::generate()
764 } 806 }
765 807
766 getCurrentTime(&time_last); 808 getCurrentTime(&time_last);
767 random_generator.seed(time_last.low); 809#if LL_USE_JANKY_RANDOM_NUMBER_GENERATOR
768 clock_seq = (U16) random_generator.llrand(65536); 810 seed = time_last.low;
811#endif
812
813#if LL_USE_JANKY_RANDOM_NUMBER_GENERATOR
814 clock_seq = (U16)janky_fast_random_seeded_bytes(seed, 65536);
815#else
816 clock_seq = (U16)ll_rand(65536);
817#endif
769 has_init = 1; 818 has_init = 1;
770 } 819 }
771 820
diff --git a/linden/indra/llmath/llvolume.cpp b/linden/indra/llmath/llvolume.cpp
index 14d4cdf..c527e85 100644
--- a/linden/indra/llmath/llvolume.cpp
+++ b/linden/indra/llmath/llvolume.cpp
@@ -725,6 +725,8 @@ BOOL LLProfileParams::importFile(FILE *fp)
725{ 725{
726 const S32 BUFSIZE = 16384; 726 const S32 BUFSIZE = 16384;
727 char buffer[BUFSIZE]; 727 char buffer[BUFSIZE];
728 // *NOTE: changing the size or type of these buffers will require
729 // changing the sscanf below.
728 char keyword[256]; 730 char keyword[256];
729 char valuestr[256]; 731 char valuestr[256];
730 keyword[0] = 0; 732 keyword[0] = 0;
@@ -735,7 +737,7 @@ BOOL LLProfileParams::importFile(FILE *fp)
735 while (!feof(fp)) 737 while (!feof(fp))
736 { 738 {
737 fgets(buffer, BUFSIZE, fp); 739 fgets(buffer, BUFSIZE, fp);
738 sscanf(buffer, " %s %s", keyword, valuestr); 740 sscanf(buffer, " %255s %255s", keyword, valuestr);
739 if (!keyword) 741 if (!keyword)
740 { 742 {
741 continue; 743 continue;
@@ -795,6 +797,8 @@ BOOL LLProfileParams::importLegacyStream(std::istream& input_stream)
795{ 797{
796 const S32 BUFSIZE = 16384; 798 const S32 BUFSIZE = 16384;
797 char buffer[BUFSIZE]; 799 char buffer[BUFSIZE];
800 // *NOTE: changing the size or type of these buffers will require
801 // changing the sscanf below.
798 char keyword[256]; 802 char keyword[256];
799 char valuestr[256]; 803 char valuestr[256];
800 keyword[0] = 0; 804 keyword[0] = 0;
@@ -805,7 +809,7 @@ BOOL LLProfileParams::importLegacyStream(std::istream& input_stream)
805 while (input_stream.good()) 809 while (input_stream.good())
806 { 810 {
807 input_stream.getline(buffer, BUFSIZE); 811 input_stream.getline(buffer, BUFSIZE);
808 sscanf(buffer, " %s %s", keyword, valuestr); 812 sscanf(buffer, " %255s %255s", keyword, valuestr);
809 if (!keyword) 813 if (!keyword)
810 { 814 {
811 continue; 815 continue;
@@ -1215,6 +1219,8 @@ BOOL LLPathParams::importFile(FILE *fp)
1215{ 1219{
1216 const S32 BUFSIZE = 16384; 1220 const S32 BUFSIZE = 16384;
1217 char buffer[BUFSIZE]; 1221 char buffer[BUFSIZE];
1222 // *NOTE: changing the size or type of these buffers will require
1223 // changing the sscanf below.
1218 char keyword[256]; 1224 char keyword[256];
1219 char valuestr[256]; 1225 char valuestr[256];
1220 keyword[0] = 0; 1226 keyword[0] = 0;
@@ -1227,7 +1233,7 @@ BOOL LLPathParams::importFile(FILE *fp)
1227 while (!feof(fp)) 1233 while (!feof(fp))
1228 { 1234 {
1229 fgets(buffer, BUFSIZE, fp); 1235 fgets(buffer, BUFSIZE, fp);
1230 sscanf(buffer, " %s %s", keyword, valuestr); 1236 sscanf(buffer, " %255s %255s", keyword, valuestr);
1231 if (!keyword) 1237 if (!keyword)
1232 { 1238 {
1233 continue; 1239 continue;
@@ -1354,6 +1360,8 @@ BOOL LLPathParams::importLegacyStream(std::istream& input_stream)
1354{ 1360{
1355 const S32 BUFSIZE = 16384; 1361 const S32 BUFSIZE = 16384;
1356 char buffer[BUFSIZE]; 1362 char buffer[BUFSIZE];
1363 // *NOTE: changing the size or type of these buffers will require
1364 // changing the sscanf below.
1357 char keyword[256]; 1365 char keyword[256];
1358 char valuestr[256]; 1366 char valuestr[256];
1359 keyword[0] = 0; 1367 keyword[0] = 0;
@@ -1366,7 +1374,7 @@ BOOL LLPathParams::importLegacyStream(std::istream& input_stream)
1366 while (input_stream.good()) 1374 while (input_stream.good())
1367 { 1375 {
1368 input_stream.getline(buffer, BUFSIZE); 1376 input_stream.getline(buffer, BUFSIZE);
1369 sscanf(buffer, " %s %s", keyword, valuestr); 1377 sscanf(buffer, " %255s %255s", keyword, valuestr);
1370 if (!keyword) 1378 if (!keyword)
1371 { 1379 {
1372 continue; 1380 continue;
@@ -3340,13 +3348,15 @@ BOOL LLVolumeParams::importFile(FILE *fp)
3340 //llinfos << "importing volume" << llendl; 3348 //llinfos << "importing volume" << llendl;
3341 const S32 BUFSIZE = 16384; 3349 const S32 BUFSIZE = 16384;
3342 char buffer[BUFSIZE]; 3350 char buffer[BUFSIZE];
3351 // *NOTE: changing the size or type of this buffer will require
3352 // changing the sscanf below.
3343 char keyword[256]; 3353 char keyword[256];
3344 keyword[0] = 0; 3354 keyword[0] = 0;
3345 3355
3346 while (!feof(fp)) 3356 while (!feof(fp))
3347 { 3357 {
3348 fgets(buffer, BUFSIZE, fp); 3358 fgets(buffer, BUFSIZE, fp);
3349 sscanf(buffer, " %s", keyword); 3359 sscanf(buffer, " %255s", keyword);
3350 if (!keyword) 3360 if (!keyword)
3351 { 3361 {
3352 continue; 3362 continue;
@@ -3391,6 +3401,8 @@ BOOL LLVolumeParams::importLegacyStream(std::istream& input_stream)
3391{ 3401{
3392 //llinfos << "importing volume" << llendl; 3402 //llinfos << "importing volume" << llendl;
3393 const S32 BUFSIZE = 16384; 3403 const S32 BUFSIZE = 16384;
3404 // *NOTE: changing the size or type of this buffer will require
3405 // changing the sscanf below.
3394 char buffer[BUFSIZE]; 3406 char buffer[BUFSIZE];
3395 char keyword[256]; 3407 char keyword[256];
3396 keyword[0] = 0; 3408 keyword[0] = 0;
@@ -3398,7 +3410,7 @@ BOOL LLVolumeParams::importLegacyStream(std::istream& input_stream)
3398 while (input_stream.good()) 3410 while (input_stream.good())
3399 { 3411 {
3400 input_stream.getline(buffer, BUFSIZE); 3412 input_stream.getline(buffer, BUFSIZE);
3401 sscanf(buffer, " %s", keyword); 3413 sscanf(buffer, " %255s", keyword);
3402 if (!keyword) 3414 if (!keyword)
3403 { 3415 {
3404 continue; 3416 continue;
diff --git a/linden/indra/llmessage/llcachename.cpp b/linden/indra/llmessage/llcachename.cpp
index 9995a6e..3a92812 100644
--- a/linden/indra/llmessage/llcachename.cpp
+++ b/linden/indra/llmessage/llcachename.cpp
@@ -284,6 +284,7 @@ void LLCacheName::importFile(FILE* fp)
284 const S32 BUFFER_SIZE = 1024; 284 const S32 BUFFER_SIZE = 1024;
285 char buffer[BUFFER_SIZE]; /*Flawfinder: ignore*/ 285 char buffer[BUFFER_SIZE]; /*Flawfinder: ignore*/
286 286
287 // *NOTE: These buffer sizes are hardcoded into sscanf() below
287 char id_string[MAX_STRING]; /*Flawfinder: ignore*/ 288 char id_string[MAX_STRING]; /*Flawfinder: ignore*/
288 char firstname[MAX_STRING]; /*Flawfinder: ignore*/ 289 char firstname[MAX_STRING]; /*Flawfinder: ignore*/
289 char lastname[MAX_STRING]; /*Flawfinder: ignore*/ 290 char lastname[MAX_STRING]; /*Flawfinder: ignore*/
@@ -293,9 +294,10 @@ void LLCacheName::importFile(FILE* fp)
293 char* valid = fgets(buffer, BUFFER_SIZE, fp); 294 char* valid = fgets(buffer, BUFFER_SIZE, fp);
294 if (!valid) return; 295 if (!valid) return;
295 296
297 // *NOTE: This buffer size is hardcoded into sscanf() below
296 char version_string[BUFFER_SIZE]; /*Flawfinder: ignore*/ 298 char version_string[BUFFER_SIZE]; /*Flawfinder: ignore*/
297 S32 version = 0; 299 S32 version = 0;
298 S32 match = sscanf(buffer, "%s %d", version_string, &version); // XXXTBD 300 S32 match = sscanf(buffer, "%1023s %d", version_string, &version);
299 if ( match != 2 301 if ( match != 2
300 || strcmp(version_string, "version") 302 || strcmp(version_string, "version")
301 || version != CN_FILE_VERSION) 303 || version != CN_FILE_VERSION)
@@ -314,11 +316,13 @@ void LLCacheName::importFile(FILE* fp)
314 valid = fgets(buffer, BUFFER_SIZE, fp); 316 valid = fgets(buffer, BUFFER_SIZE, fp);
315 if (!valid) break; 317 if (!valid) break;
316 318
317 match = sscanf(buffer, "%s %u %s %s", // XXXTBD 319 match = sscanf(
318 id_string, 320 buffer,
319 &create_time, 321 "%254s %u %254s %254s",
320 firstname, 322 id_string,
321 lastname); 323 &create_time,
324 firstname,
325 lastname);
322 if (4 != match) continue; 326 if (4 != match) continue;
323 327
324 LLUUID id(id_string); 328 LLUUID id(id_string);
@@ -409,7 +413,7 @@ BOOL LLCacheName::getName(const LLUUID& id, char* first, char* last)
409 { 413 {
410 //The function signature needs to change to pass in the 414 //The function signature needs to change to pass in the
411 //length of first and last. 415 //length of first and last.
412 strcpy(first,(frand(1.0f) < HIPPO_PROBABILITY) 416 strcpy(first,(ll_frand() < HIPPO_PROBABILITY)
413 ? CN_HIPPOS 417 ? CN_HIPPOS
414 : CN_WAITING); 418 : CN_WAITING);
415 strcpy(last, ""); 419 strcpy(last, "");
diff --git a/linden/indra/llmessage/llcircuit.cpp b/linden/indra/llmessage/llcircuit.cpp
index 7d3136b..5187948 100644
--- a/linden/indra/llmessage/llcircuit.cpp
+++ b/linden/indra/llmessage/llcircuit.cpp
@@ -105,12 +105,12 @@ LLCircuitData::LLCircuitData(const LLHost &host, TPACKETID in_id)
105 // Need to guarantee that this time is up to date, we may be creating a circuit even though we haven't been 105 // Need to guarantee that this time is up to date, we may be creating a circuit even though we haven't been
106 // running a message system loop. 106 // running a message system loop.
107 F64 mt_sec = LLMessageSystem::getMessageTimeSeconds(TRUE); 107 F64 mt_sec = LLMessageSystem::getMessageTimeSeconds(TRUE);
108 F32 distribution_offset = frand(1.0f); 108 F32 distribution_offset = ll_frand();
109 109
110 mPingTime = mt_sec; 110 mPingTime = mt_sec;
111 mLastPingSendTime = mt_sec + PING_INTERVAL * distribution_offset; 111 mLastPingSendTime = mt_sec + PING_INTERVAL * distribution_offset;
112 mLastPingReceivedTime = mt_sec; 112 mLastPingReceivedTime = mt_sec;
113 mNextPingSendTime = mLastPingSendTime + 0.95*PING_INTERVAL + frand(0.1f*PING_INTERVAL); 113 mNextPingSendTime = mLastPingSendTime + 0.95*PING_INTERVAL + ll_frand(0.1f*PING_INTERVAL);
114 mPeriodTime = mt_sec; 114 mPeriodTime = mt_sec;
115 115
116 mTimeoutCallback = NULL; 116 mTimeoutCallback = NULL;
@@ -804,7 +804,7 @@ void LLCircuit::updateWatchDogTimers(LLMessageSystem *msgsys)
804 if (cdp->updateWatchDogTimers(msgsys)) 804 if (cdp->updateWatchDogTimers(msgsys))
805 { 805 {
806 // Randomize our pings a bit by doing some up to 5% early or late 806 // Randomize our pings a bit by doing some up to 5% early or late
807 F64 dt = 0.95f*PING_INTERVAL + frand(0.1f*PING_INTERVAL); 807 F64 dt = 0.95f*PING_INTERVAL + ll_frand(0.1f*PING_INTERVAL);
808 808
809 // Remove it, and reinsert it with the new next ping time. 809 // Remove it, and reinsert it with the new next ping time.
810 // Always remove before changing the sorting key. 810 // Always remove before changing the sorting key.
diff --git a/linden/indra/llmessage/llpacketring.cpp b/linden/indra/llmessage/llpacketring.cpp
index 3876d76..6a6a456 100644
--- a/linden/indra/llmessage/llpacketring.cpp
+++ b/linden/indra/llmessage/llpacketring.cpp
@@ -166,7 +166,7 @@ S32 LLPacketRing::receivePacket (S32 socket, char *datap)
166 mActualBitsIn += packetp->getSize() * 8; 166 mActualBitsIn += packetp->getSize() * 8;
167 167
168 // Fake packet loss 168 // Fake packet loss
169 if (mDropPercentage && (frand(100.f) < mDropPercentage)) 169 if (mDropPercentage && (ll_frand(100.f) < mDropPercentage))
170 { 170 {
171 mPacketsToDrop++; 171 mPacketsToDrop++;
172 } 172 }
@@ -221,7 +221,7 @@ S32 LLPacketRing::receivePacket (S32 socket, char *datap)
221 221
222 if (packet_size) // did we actually get a packet? 222 if (packet_size) // did we actually get a packet?
223 { 223 {
224 if (mDropPercentage && (frand(100.f) < mDropPercentage)) 224 if (mDropPercentage && (ll_frand(100.f) < mDropPercentage))
225 { 225 {
226 mPacketsToDrop++; 226 mPacketsToDrop++;
227 } 227 }
diff --git a/linden/indra/llmessage/llpumpio.cpp b/linden/indra/llmessage/llpumpio.cpp
index 853a438..b1495f6 100644
--- a/linden/indra/llmessage/llpumpio.cpp
+++ b/linden/indra/llmessage/llpumpio.cpp
@@ -335,6 +335,7 @@ bool LLPumpIO::copyCurrentLinkInfo(links_t& links) const
335void LLPumpIO::pump() 335void LLPumpIO::pump()
336{ 336{
337 LLMemType m1(LLMemType::MTYPE_IO_PUMP); 337 LLMemType m1(LLMemType::MTYPE_IO_PUMP);
338 LLFastTimer t1(LLFastTimer::FTM_PUMP);
338 //llinfos << "LLPumpIO::pump()" << llendl; 339 //llinfos << "LLPumpIO::pump()" << llendl;
339 340
340 // Run any pending runners. 341 // Run any pending runners.
diff --git a/linden/indra/llmessage/llurlrequest.cpp b/linden/indra/llmessage/llurlrequest.cpp
index c0d8d27..8ac8d94 100644
--- a/linden/indra/llmessage/llurlrequest.cpp
+++ b/linden/indra/llmessage/llurlrequest.cpp
@@ -270,6 +270,7 @@ LLIOPipe::EStatus LLURLRequest::process_impl(
270 S32 queue; 270 S32 queue;
271 do 271 do
272 { 272 {
273 LLFastTimer t2(LLFastTimer::FTM_CURL);
273 code = curl_multi_perform(mDetail->mCurlMulti, &queue); 274 code = curl_multi_perform(mDetail->mCurlMulti, &queue);
274 }while((CURLM_CALL_MULTI_PERFORM == code) && (queue > 0) && count--); 275 }while((CURLM_CALL_MULTI_PERFORM == code) && (queue > 0) && count--);
275 CURLMsg* curl_msg; 276 CURLMsg* curl_msg;
diff --git a/linden/indra/llmessage/llxfermanager.cpp b/linden/indra/llmessage/llxfermanager.cpp
index d10c879..afeeef3 100644
--- a/linden/indra/llmessage/llxfermanager.cpp
+++ b/linden/indra/llmessage/llxfermanager.cpp
@@ -1108,7 +1108,7 @@ void process_request_xfer(LLMessageSystem *mesgsys, void **user_data)
1108void continue_file_receive(LLMessageSystem *mesgsys, void **user_data) 1108void continue_file_receive(LLMessageSystem *mesgsys, void **user_data)
1109{ 1109{
1110#if LL_TEST_XFER_REXMIT 1110#if LL_TEST_XFER_REXMIT
1111 if (frand(1.f) > 0.05f) 1111 if (ll_frand() > 0.05f)
1112 { 1112 {
1113#endif 1113#endif
1114 gXferManager->processReceiveData(mesgsys,user_data); 1114 gXferManager->processReceiveData(mesgsys,user_data);
diff --git a/linden/indra/llui/llmenugl.cpp b/linden/indra/llui/llmenugl.cpp
index 6d70fd1..97069fa 100644
--- a/linden/indra/llui/llmenugl.cpp
+++ b/linden/indra/llui/llmenugl.cpp
@@ -491,6 +491,7 @@ BOOL LLMenuItemGL::handleMouseUp( S32 x, S32 y, MASK )
491 } 491 }
492} 492}
493 493
494
494void LLMenuItemGL::draw( void ) 495void LLMenuItemGL::draw( void )
495{ 496{
496 // *FIX: This can be optimized by using switches. Want to avoid 497 // *FIX: This can be optimized by using switches. Want to avoid
@@ -4123,7 +4124,7 @@ BOOL LLMenuBarGL::handleAcceleratorKey(KEY key, MASK mask)
4123 4124
4124BOOL LLMenuBarGL::handleKeyHere(KEY key, MASK mask, BOOL called_from_parent) 4125BOOL LLMenuBarGL::handleKeyHere(KEY key, MASK mask, BOOL called_from_parent)
4125{ 4126{
4126 if(key == KEY_ALT) 4127 if(key == KEY_ALT && !gKeyboard->getKeyRepeated(key) && LLUI::sConfigGroup->getBOOL("UseAltKeyForMenus"))
4127 { 4128 {
4128 mAltKeyTrigger = TRUE; 4129 mAltKeyTrigger = TRUE;
4129 } 4130 }
diff --git a/linden/indra/llvfs/lldir_linux.cpp b/linden/indra/llvfs/lldir_linux.cpp
index 8557901..780fbdb 100644
--- a/linden/indra/llvfs/lldir_linux.cpp
+++ b/linden/indra/llvfs/lldir_linux.cpp
@@ -29,7 +29,7 @@
29 29
30#include "lldir_linux.h" 30#include "lldir_linux.h"
31#include "llerror.h" 31#include "llerror.h"
32#include "llrand.h" // for gLindenLabRandomNumber 32#include "llrand.h"
33#include <sys/types.h> 33#include <sys/types.h>
34#include <sys/stat.h> 34#include <sys/stat.h>
35#include <unistd.h> 35#include <unistd.h>
@@ -286,8 +286,8 @@ BOOL LLDir_Linux::getNextFileInDir(const std::string &dirname, const std::string
286// automatically wrap if we've hit the end 286// automatically wrap if we've hit the end
287void LLDir_Linux::getRandomFileInDir(const std::string &dirname, const std::string &mask, std::string &fname) 287void LLDir_Linux::getRandomFileInDir(const std::string &dirname, const std::string &mask, std::string &fname)
288{ 288{
289 U32 num_files; 289 S32 num_files;
290 U32 which_file; 290 S32 which_file;
291 DIR *dirp; 291 DIR *dirp;
292 dirent *entryp = NULL; 292 dirent *entryp = NULL;
293 293
@@ -299,7 +299,7 @@ void LLDir_Linux::getRandomFileInDir(const std::string &dirname, const std::stri
299 return; 299 return;
300 } 300 }
301 301
302 which_file = gLindenLabRandomNumber.llrand() % num_files; 302 which_file = ll_rand(num_files);
303 303
304// llinfos << "Random select file #" << which_file << llendl; 304// llinfos << "Random select file #" << which_file << llendl;
305 305
diff --git a/linden/indra/llvfs/lldir_mac.cpp b/linden/indra/llvfs/lldir_mac.cpp
index 683b961..7f1d2ce 100644
--- a/linden/indra/llvfs/lldir_mac.cpp
+++ b/linden/indra/llvfs/lldir_mac.cpp
@@ -287,7 +287,7 @@ BOOL LLDir_Mac::getNextFileInDir(const std::string &dirname, const std::string &
287// get a random file in the directory 287// get a random file in the directory
288void LLDir_Mac::getRandomFileInDir(const std::string &dirname, const std::string &mask, std::string &fname) 288void LLDir_Mac::getRandomFileInDir(const std::string &dirname, const std::string &mask, std::string &fname)
289{ 289{
290 U32 which_file; 290 S32 which_file;
291 glob_t g; 291 glob_t g;
292 fname = ""; 292 fname = "";
293 293
@@ -300,7 +300,7 @@ void LLDir_Mac::getRandomFileInDir(const std::string &dirname, const std::string
300 if(g.gl_pathc > 0) 300 if(g.gl_pathc > 0)
301 { 301 {
302 302
303 which_file = gLindenLabRandomNumber.llrand() % g.gl_pathc; 303 which_file = ll_rand(g.gl_pathc);
304 304
305// llinfos << "getRandomFileInDir: returning number " << which_file << ", path is " << g.gl_pathv[which_file] << llendl; 305// llinfos << "getRandomFileInDir: returning number " << which_file << ", path is " << g.gl_pathv[which_file] << llendl;
306 // The API wants just the filename, not the full path. 306 // The API wants just the filename, not the full path.
diff --git a/linden/indra/llvfs/lldir_win32.cpp b/linden/indra/llvfs/lldir_win32.cpp
index 8dcaa5c..ad72752 100644
--- a/linden/indra/llvfs/lldir_win32.cpp
+++ b/linden/indra/llvfs/lldir_win32.cpp
@@ -285,8 +285,8 @@ BOOL LLDir_Win32::getNextFileInDir(const llutf16string &dirname, const std::stri
285// automatically wrap if we've hit the end 285// automatically wrap if we've hit the end
286void LLDir_Win32::getRandomFileInDir(const std::string &dirname, const std::string &mask, std::string &fname) 286void LLDir_Win32::getRandomFileInDir(const std::string &dirname, const std::string &mask, std::string &fname)
287{ 287{
288 U32 num_files; 288 S32 num_files;
289 U32 which_file; 289 S32 which_file;
290 HANDLE random_search_h; 290 HANDLE random_search_h;
291 291
292 fname = ""; 292 fname = "";
@@ -303,7 +303,7 @@ void LLDir_Win32::getRandomFileInDir(const std::string &dirname, const std::stri
303 return; 303 return;
304 } 304 }
305 305
306 which_file = gLindenLabRandomNumber.llrand() % num_files; 306 which_file = ll_rand(num_files);
307 307
308// llinfos << "Random select mp3 #" << which_file << llendl; 308// llinfos << "Random select mp3 #" << which_file << llendl;
309 309
diff --git a/linden/indra/llwindow/llgl.cpp b/linden/indra/llwindow/llgl.cpp
index 547a353..ec22907 100644
--- a/linden/indra/llwindow/llgl.cpp
+++ b/linden/indra/llwindow/llgl.cpp
@@ -365,6 +365,7 @@ bool LLGLManager::initGL()
365 // from being recognized as ATI. 365 // from being recognized as ATI.
366 if (mGLVendor.substr(0,4) == "ATI ") 366 if (mGLVendor.substr(0,4) == "ATI ")
367 { 367 {
368 mGLVendorShort = "ATI";
368 BOOL mobile = FALSE; 369 BOOL mobile = FALSE;
369 if (mGLRenderer.find("MOBILITY") != LLString::npos) 370 if (mGLRenderer.find("MOBILITY") != LLString::npos)
370 { 371 {
@@ -404,6 +405,7 @@ bool LLGLManager::initGL()
404 } 405 }
405 else if (mGLVendor.find("NVIDIA ") != LLString::npos) 406 else if (mGLVendor.find("NVIDIA ") != LLString::npos)
406 { 407 {
408 mGLVendorShort = "NVIDIA";
407 mIsNVIDIA = TRUE; 409 mIsNVIDIA = TRUE;
408 if ( mGLRenderer.find("GEFORCE4 MX") != LLString::npos 410 if ( mGLRenderer.find("GEFORCE4 MX") != LLString::npos
409 || mGLRenderer.find("GEFORCE2") != LLString::npos 411 || mGLRenderer.find("GEFORCE2") != LLString::npos
@@ -428,9 +430,14 @@ bool LLGLManager::initGL()
428 } 430 }
429 else if (mGLVendor.find("INTEL") != LLString::npos) 431 else if (mGLVendor.find("INTEL") != LLString::npos)
430 { 432 {
433 mGLVendorShort = "INTEL";
431 mIsIntel = TRUE; 434 mIsIntel = TRUE;
432 } 435 }
433 436 else
437 {
438 mGLVendorShort = "MISC";
439 }
440
434 // This is called here because it depends on the setting of mIsGF2or4MX, and sets up mHasMultitexture. 441 // This is called here because it depends on the setting of mIsGF2or4MX, and sets up mHasMultitexture.
435 initExtensions(); 442 initExtensions();
436 443
diff --git a/linden/indra/llwindow/llgl.h b/linden/indra/llwindow/llgl.h
index 1c93b63..c0668ca 100644
--- a/linden/indra/llwindow/llgl.h
+++ b/linden/indra/llwindow/llgl.h
@@ -125,6 +125,7 @@ public:
125 125
126 // In ALL CAPS 126 // In ALL CAPS
127 LLString mGLVendor; 127 LLString mGLVendor;
128 LLString mGLVendorShort;
128 129
129 // In ALL CAPS 130 // In ALL CAPS
130 LLString mGLRenderer; 131 LLString mGLRenderer;
diff --git a/linden/indra/llwindow/llkeyboard.cpp b/linden/indra/llwindow/llkeyboard.cpp
index fd6fcdc..409bb13 100644
--- a/linden/indra/llwindow/llkeyboard.cpp
+++ b/linden/indra/llwindow/llkeyboard.cpp
@@ -157,7 +157,6 @@ void LLKeyboard::resetKeys()
157 if( mKeyLevel[i] ) 157 if( mKeyLevel[i] )
158 { 158 {
159 mKeyLevel[i] = FALSE; 159 mKeyLevel[i] = FALSE;
160 mKeyLevelFrameCount[i] = 0;
161 } 160 }
162 } 161 }
163 162
diff --git a/linden/indra/llwindow/llkeyboardwin32.cpp b/linden/indra/llwindow/llkeyboardwin32.cpp
index 531ad87..e166ec2 100644
--- a/linden/indra/llwindow/llkeyboardwin32.cpp
+++ b/linden/indra/llwindow/llkeyboardwin32.cpp
@@ -266,7 +266,6 @@ void LLKeyboardWin32::scanKeyboard()
266 { 266 {
267 //llinfos << "Key up event missed, resetting" << llendl; 267 //llinfos << "Key up event missed, resetting" << llendl;
268 mKeyLevel[key] = FALSE; 268 mKeyLevel[key] = FALSE;
269 mKeyLevelFrameCount[key] = 0;
270 } 269 }
271 } 270 }
272 } 271 }
diff --git a/linden/indra/llwindow/llwindowwin32.cpp b/linden/indra/llwindow/llwindowwin32.cpp
index b405bdb..5929fb5 100644
--- a/linden/indra/llwindow/llwindowwin32.cpp
+++ b/linden/indra/llwindow/llwindowwin32.cpp
@@ -1969,19 +1969,34 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
1969 // allow system keys, such as ALT-F4 to be processed by Windows 1969 // allow system keys, such as ALT-F4 to be processed by Windows
1970 eat_keystroke = FALSE; 1970 eat_keystroke = FALSE;
1971 case WM_KEYDOWN: 1971 case WM_KEYDOWN:
1972 if (gDebugWindowProc)
1973 {
1974 llinfos << "Debug WindowProc WM_KEYDOWN "
1975 << " key " << S32(w_param)
1976 << llendl;
1977 }
1978 if (gKeyboard->handleKeyDown(w_param, mask) && eat_keystroke)
1979 { 1972 {
1980 return 0; 1973 if (gDebugWindowProc)
1974 {
1975 llinfos << "Debug WindowProc WM_KEYDOWN "
1976 << " key " << S32(w_param)
1977 << llendl;
1978 }
1979 // lower 15 bits hold key repeat count
1980 S32 key_repeat_count = l_param & 0x7fff;
1981 if (key_repeat_count > 1)
1982 {
1983 KEY translated_key;
1984 gKeyboard->translateKey(w_param, &translated_key);
1985 if (!gKeyboard->getKeyDown(translated_key))
1986 {
1987 //RN: hack for handling key repeats when we no longer recognize the key as being down
1988 //This is necessary because we sometimes ignore the message queue and use getAsyncKeyState
1989 // to clear key level flags before we've processed all key repeat messages
1990 return 0;
1991 }
1992 }
1993 if(gKeyboard->handleKeyDown(w_param, mask) && eat_keystroke)
1994 {
1995 return 0;
1996 }
1997 // pass on to windows if we didn't handle it
1998 break;
1981 } 1999 }
1982 // pass on to windows if we didn't handle it
1983 break;
1984
1985 case WM_SYSKEYUP: 2000 case WM_SYSKEYUP:
1986 eat_keystroke = FALSE; 2001 eat_keystroke = FALSE;
1987 case WM_KEYUP: 2002 case WM_KEYUP:
diff --git a/linden/indra/lscript/lscript_alloc.h b/linden/indra/lscript/lscript_alloc.h
index 67e3dc0..4d69e8e 100644
--- a/linden/indra/lscript/lscript_alloc.h
+++ b/linden/indra/lscript/lscript_alloc.h
@@ -246,7 +246,7 @@ inline LLScriptLibData *lsa_bubble_sort(LLScriptLibData *src, S32 stride, S32 as
246 return retval; 246 return retval;
247 } 247 }
248 248
249 LLScriptLibData **sortarray = (LLScriptLibData **)new U32[number]; 249 LLScriptLibData **sortarray = new LLScriptLibData*[number];
250 250
251 LLScriptLibData *temp = src->mListp; 251 LLScriptLibData *temp = src->mListp;
252 while (temp) 252 while (temp)
@@ -290,74 +290,6 @@ inline LLScriptLibData *lsa_bubble_sort(LLScriptLibData *src, S32 stride, S32 as
290} 290}
291 291
292 292
293inline LLScriptLibData *lsa_randomize(LLScriptLibData *src, S32 stride) 293LLScriptLibData* lsa_randomize(LLScriptLibData* src, S32 stride);
294{
295 S32 number = src->getListLength();
296
297 if (number <= 0)
298 {
299 return NULL;
300 }
301
302 if (stride <= 0)
303 {
304 stride = 1;
305 }
306
307 if (number % stride)
308 {
309 LLScriptLibData *retval = src->mListp;
310 src->mListp = NULL;
311 return retval;
312 }
313
314 LLScriptLibData **sortarray = (LLScriptLibData **)new U32[number];
315
316 LLScriptLibData *temp = src->mListp;
317 S32 i = 0;
318 while (temp)
319 {
320 sortarray[i] = temp;
321 i++;
322 temp = temp->mListp;
323 }
324
325 S32 k, j, s;
326
327 for (k = 0; k < 20; k++)
328 {
329 for (i = 0; i < number; i += stride)
330 {
331 for (j = i; j < number; j += stride)
332 {
333 if (frand(1.f) > 0.5)
334 {
335 for (s = 0; s < stride; s++)
336 {
337 temp = sortarray[i + s];
338 sortarray[i + s] = sortarray[j + s];
339 sortarray[j + s] = temp;
340 }
341 }
342 }
343 }
344 }
345
346 i = 1;
347 temp = sortarray[0];
348 while (i < number)
349 {
350 temp->mListp = sortarray[i++];
351 temp = temp->mListp;
352 }
353 temp->mListp = NULL;
354
355 src->mListp = NULL;
356
357 LLScriptLibData *ret_value = sortarray[0];
358 delete [] sortarray;
359
360 return ret_value;
361}
362 294
363#endif 295#endif
diff --git a/linden/indra/lscript/lscript_compile/lscript_compile.vcproj b/linden/indra/lscript/lscript_compile/lscript_compile.vcproj
index 581fa27..fd03fa0 100644
--- a/linden/indra/lscript/lscript_compile/lscript_compile.vcproj
+++ b/linden/indra/lscript/lscript_compile/lscript_compile.vcproj
@@ -19,7 +19,7 @@
19 <Tool 19 <Tool
20 Name="VCCLCompilerTool" 20 Name="VCCLCompilerTool"
21 Optimization="0" 21 Optimization="0"
22 AdditionalIncludeDirectories="..;..\..\llcommon;..\..\llmath;..\..\llvfs;..\..\llmessage;..\..\llinventory" 22 AdditionalIncludeDirectories="..;..\..\llcommon;..\..\llmath;..\..\llvfs;..\..\llmessage;..\..\llinventory;&quot;..\..\..\libraries\i686-win32\include&quot;;..\..\..\libraries\include"
23 PreprocessorDefinitions="WIN32;_DEBUG;_LIB;LL_WINDOWS;LL_DEBUG" 23 PreprocessorDefinitions="WIN32;_DEBUG;_LIB;LL_WINDOWS;LL_DEBUG"
24 MinimalRebuild="TRUE" 24 MinimalRebuild="TRUE"
25 BasicRuntimeChecks="3" 25 BasicRuntimeChecks="3"
@@ -63,7 +63,7 @@
63 CharacterSet="1"> 63 CharacterSet="1">
64 <Tool 64 <Tool
65 Name="VCCLCompilerTool" 65 Name="VCCLCompilerTool"
66 AdditionalIncludeDirectories="..;..\..\llcommon;..\..\llmath;..\..\llvfs;..\..\llmessage;..\..\llinventory" 66 AdditionalIncludeDirectories="..;..\..\llcommon;..\..\llmath;..\..\llvfs;..\..\llmessage;..\..\llinventory;&quot;..\..\..\libraries\i686-win32\include&quot;;..\..\..\libraries\include"
67 PreprocessorDefinitions="WIN32;NDEBUG;_LIB;LL_WINDOWS;LL_RELEASE" 67 PreprocessorDefinitions="WIN32;NDEBUG;_LIB;LL_WINDOWS;LL_RELEASE"
68 RuntimeLibrary="0" 68 RuntimeLibrary="0"
69 StructMemberAlignment="0" 69 StructMemberAlignment="0"
@@ -106,7 +106,7 @@
106 <Tool 106 <Tool
107 Name="VCCLCompilerTool" 107 Name="VCCLCompilerTool"
108 Optimization="0" 108 Optimization="0"
109 AdditionalIncludeDirectories="..;..\..\llcommon;..\..\llmath;..\..\llvfs;..\..\llmessage;..\..\llinventory" 109 AdditionalIncludeDirectories="..;..\..\llcommon;..\..\llmath;..\..\llvfs;..\..\llmessage;..\..\llinventory;&quot;..\..\..\libraries\i686-win32\include&quot;;..\..\..\libraries\include"
110 PreprocessorDefinitions="WIN32;NDEBUG;_LIB;LL_WINDOWS;LL_RELEASE" 110 PreprocessorDefinitions="WIN32;NDEBUG;_LIB;LL_WINDOWS;LL_RELEASE"
111 RuntimeLibrary="0" 111 RuntimeLibrary="0"
112 StructMemberAlignment="0" 112 StructMemberAlignment="0"
diff --git a/linden/indra/lscript/lscript_execute/lscript_execute.vcproj b/linden/indra/lscript/lscript_execute/lscript_execute.vcproj
index 1ae15ea..c61ad89 100644
--- a/linden/indra/lscript/lscript_execute/lscript_execute.vcproj
+++ b/linden/indra/lscript/lscript_execute/lscript_execute.vcproj
@@ -19,7 +19,7 @@
19 <Tool 19 <Tool
20 Name="VCCLCompilerTool" 20 Name="VCCLCompilerTool"
21 Optimization="0" 21 Optimization="0"
22 AdditionalIncludeDirectories="..;..\..\llcommon;..\..\llmath" 22 AdditionalIncludeDirectories="..;..\..\llcommon;..\..\llmath;&quot;..\..\..\libraries\i686-win32\include&quot;;..\..\..\libraries\include"
23 PreprocessorDefinitions="WIN32;_DEBUG;_LIB;LL_WINDOWS;LL_DEBUG" 23 PreprocessorDefinitions="WIN32;_DEBUG;_LIB;LL_WINDOWS;LL_DEBUG"
24 MinimalRebuild="TRUE" 24 MinimalRebuild="TRUE"
25 BasicRuntimeChecks="3" 25 BasicRuntimeChecks="3"
@@ -63,7 +63,7 @@
63 CharacterSet="1"> 63 CharacterSet="1">
64 <Tool 64 <Tool
65 Name="VCCLCompilerTool" 65 Name="VCCLCompilerTool"
66 AdditionalIncludeDirectories="..;..\..\llcommon;..\..\llmath" 66 AdditionalIncludeDirectories="..;..\..\llcommon;..\..\llmath;&quot;..\..\..\libraries\i686-win32\include&quot;;..\..\..\libraries\include"
67 PreprocessorDefinitions="WIN32;NDEBUG;_LIB;LL_WINDOWS;LL_RELEASE" 67 PreprocessorDefinitions="WIN32;NDEBUG;_LIB;LL_WINDOWS;LL_RELEASE"
68 RuntimeLibrary="0" 68 RuntimeLibrary="0"
69 StructMemberAlignment="0" 69 StructMemberAlignment="0"
@@ -106,7 +106,7 @@
106 <Tool 106 <Tool
107 Name="VCCLCompilerTool" 107 Name="VCCLCompilerTool"
108 Optimization="0" 108 Optimization="0"
109 AdditionalIncludeDirectories="..;..\..\llcommon;..\..\llmath" 109 AdditionalIncludeDirectories="..;..\..\llcommon;..\..\llmath;&quot;..\..\..\libraries\i686-win32\include&quot;;..\..\..\libraries\include"
110 PreprocessorDefinitions="WIN32;NDEBUG;_LIB;LL_WINDOWS;LL_RELEASE" 110 PreprocessorDefinitions="WIN32;NDEBUG;_LIB;LL_WINDOWS;LL_RELEASE"
111 RuntimeLibrary="0" 111 RuntimeLibrary="0"
112 StructMemberAlignment="0" 112 StructMemberAlignment="0"
diff --git a/linden/indra/lscript/lscript_library/lscript_alloc.cpp b/linden/indra/lscript/lscript_library/lscript_alloc.cpp
index 978d7f2..4636c0b 100644
--- a/linden/indra/lscript/lscript_library/lscript_alloc.cpp
+++ b/linden/indra/lscript/lscript_library/lscript_alloc.cpp
@@ -1119,3 +1119,62 @@ S32 lsa_postadd_lists(U8 *buffer, S32 offset1, LLScriptLibData *data, S32 heapsi
1119 return lsa_heap_add_data(buffer, list1, heapsize, TRUE); 1119 return lsa_heap_add_data(buffer, list1, heapsize, TRUE);
1120} 1120}
1121 1121
1122
1123LLScriptLibData* lsa_randomize(LLScriptLibData* src, S32 stride)
1124{
1125 S32 number = src->getListLength();
1126 if (number <= 0)
1127 {
1128 return NULL;
1129 }
1130 if (stride <= 0)
1131 {
1132 stride = 1;
1133 }
1134 if(number % stride)
1135 {
1136 LLScriptLibData* retval = src->mListp;
1137 src->mListp = NULL;
1138 return retval;
1139 }
1140 S32 buckets = number / stride;
1141
1142 // Copy everything into a special vector for sorting;
1143 std::vector<LLScriptLibData*> sort_array;
1144 sort_array.reserve(number);
1145 LLScriptLibData* temp = src->mListp;
1146 while(temp)
1147 {
1148 sort_array.push_back(temp);
1149 temp = temp->mListp;
1150 }
1151
1152 // We cannot simply call random_shuffle or similar algorithm since
1153 // we need to obey the stride. So, we iterate over what we have
1154 // and swap each with a random other segment.
1155 S32 index = 0;
1156 S32 ii = 0;
1157 for(; ii < number; ii += stride)
1158 {
1159 index = ll_rand(buckets) * stride;
1160 for(S32 jj = 0; jj < stride; ++jj)
1161 {
1162 std::swap(sort_array[ii + jj], sort_array[index + jj]);
1163 }
1164 }
1165
1166 // copy the pointers back out
1167 ii = 1;
1168 temp = sort_array[0];
1169 while (ii < number)
1170 {
1171 temp->mListp = sort_array[ii++];
1172 temp = temp->mListp;
1173 }
1174 temp->mListp = NULL;
1175
1176 src->mListp = NULL;
1177
1178 LLScriptLibData* ret_value = sort_array[0];
1179 return ret_value;
1180}
diff --git a/linden/indra/lscript/lscript_library/lscript_library.cpp b/linden/indra/lscript/lscript_library/lscript_library.cpp
index 098c836..1b92608 100644
--- a/linden/indra/lscript/lscript_library/lscript_library.cpp
+++ b/linden/indra/lscript/lscript_library/lscript_library.cpp
@@ -467,7 +467,7 @@ LLScriptLibraryFunction::~LLScriptLibraryFunction()
467 467
468void LLScriptLibrary::addFunction(LLScriptLibraryFunction *func) 468void LLScriptLibrary::addFunction(LLScriptLibraryFunction *func)
469{ 469{
470 LLScriptLibraryFunction **temp = (LLScriptLibraryFunction **)new U32[mNextNumber + 1]; 470 LLScriptLibraryFunction **temp = new LLScriptLibraryFunction*[mNextNumber + 1];
471 if (mNextNumber) 471 if (mNextNumber)
472 { 472 {
473 memcpy(temp, mFunctions, sizeof(LLScriptLibraryFunction *)*mNextNumber); 473 memcpy(temp, mFunctions, sizeof(LLScriptLibraryFunction *)*mNextNumber);
diff --git a/linden/indra/lscript/lscript_library/lscript_library.vcproj b/linden/indra/lscript/lscript_library/lscript_library.vcproj
index f4861c7..1a340da 100644
--- a/linden/indra/lscript/lscript_library/lscript_library.vcproj
+++ b/linden/indra/lscript/lscript_library/lscript_library.vcproj
@@ -19,7 +19,7 @@
19 <Tool 19 <Tool
20 Name="VCCLCompilerTool" 20 Name="VCCLCompilerTool"
21 Optimization="0" 21 Optimization="0"
22 AdditionalIncludeDirectories="..;..\..\llcommon;..\..\llmath" 22 AdditionalIncludeDirectories="..\;..\..\llmath;..\..\llcommon;&quot;..\..\..\libraries\i686-win32&quot;;..\..\..\libraries\include"
23 PreprocessorDefinitions="WIN32;_DEBUG;_LIB;LL_WINDOWS;LL_DEBUG" 23 PreprocessorDefinitions="WIN32;_DEBUG;_LIB;LL_WINDOWS;LL_DEBUG"
24 MinimalRebuild="TRUE" 24 MinimalRebuild="TRUE"
25 BasicRuntimeChecks="3" 25 BasicRuntimeChecks="3"
@@ -63,7 +63,7 @@
63 CharacterSet="1"> 63 CharacterSet="1">
64 <Tool 64 <Tool
65 Name="VCCLCompilerTool" 65 Name="VCCLCompilerTool"
66 AdditionalIncludeDirectories="..;..\..\llcommon;..\..\llmath" 66 AdditionalIncludeDirectories="..\;..\..\llmath;..\..\llcommon;&quot;..\..\..\libraries\i686-win32&quot;;..\..\..\libraries\include"
67 PreprocessorDefinitions="WIN32;NDEBUG;_LIB;LL_WINDOWS;LL_RELEASE" 67 PreprocessorDefinitions="WIN32;NDEBUG;_LIB;LL_WINDOWS;LL_RELEASE"
68 RuntimeLibrary="0" 68 RuntimeLibrary="0"
69 StructMemberAlignment="0" 69 StructMemberAlignment="0"
@@ -106,7 +106,7 @@
106 <Tool 106 <Tool
107 Name="VCCLCompilerTool" 107 Name="VCCLCompilerTool"
108 Optimization="0" 108 Optimization="0"
109 AdditionalIncludeDirectories="..;..\..\llcommon;..\..\llmath" 109 AdditionalIncludeDirectories="..\;..\..\llmath;..\..\llcommon;&quot;..\..\..\libraries\i686-win32&quot;;..\..\..\libraries\include"
110 PreprocessorDefinitions="WIN32;NDEBUG;_LIB;LL_WINDOWS;LL_RELEASE" 110 PreprocessorDefinitions="WIN32;NDEBUG;_LIB;LL_WINDOWS;LL_RELEASE"
111 RuntimeLibrary="0" 111 RuntimeLibrary="0"
112 StructMemberAlignment="0" 112 StructMemberAlignment="0"
diff --git a/linden/indra/mac_crash_logger/mac_crash_logger.cpp b/linden/indra/mac_crash_logger/mac_crash_logger.cpp
index 177a4b5..372050d 100644
--- a/linden/indra/mac_crash_logger/mac_crash_logger.cpp
+++ b/linden/indra/mac_crash_logger/mac_crash_logger.cpp
@@ -330,9 +330,13 @@ int main(int argc, char **argv)
330 db_filep = new LLFileEncoder("DB", db_file_name.c_str()); 330 db_filep = new LLFileEncoder("DB", db_file_name.c_str());
331 331
332 // Get the filename of the SecondLife.log file 332 // Get the filename of the SecondLife.log file
333 char tmp_sl_name[MAX_PATH]; 333
334 // *NOTE: changing the size of either of these buffers will
335 // require changing the sscanf() format string to correctly
336 // account for it.
337 char tmp_sl_name[LL_MAX_PATH];
334 tmp_sl_name[0] = '\0'; 338 tmp_sl_name[0] = '\0';
335 char tmp_space[256]; 339 char tmp_space[MAX_STRING];
336 tmp_space[0] = '\0'; 340 tmp_space[0] = '\0';
337 341
338 // Look for it in the debug_info.log file 342 // Look for it in the debug_info.log file
@@ -340,7 +344,11 @@ int main(int argc, char **argv)
340 { 344 {
341 // This was originally scanning for "SL Log: %[^\r\n]", which happily skipped to the next line 345 // This was originally scanning for "SL Log: %[^\r\n]", which happily skipped to the next line
342 // on debug logs (which don't have anything after "SL Log:" and tried to open a nonsensical filename. 346 // on debug logs (which don't have anything after "SL Log:" and tried to open a nonsensical filename.
343 sscanf(db_filep->mBuf.c_str(), "SL Log:%[ ]%[^\r\n]", tmp_space, tmp_sl_name); 347 sscanf(
348 db_filep->mBuf.c_str(),
349 "SL Log:%254[ ]%1023[^\r\n]",
350 tmp_space,
351 tmp_sl_name);
344 } 352 }
345 else 353 else
346 { 354 {
diff --git a/linden/indra/mac_updater/mac_updater.cpp b/linden/indra/mac_updater/mac_updater.cpp
index 25e203c..2061ab4 100644
--- a/linden/indra/mac_updater/mac_updater.cpp
+++ b/linden/indra/mac_updater/mac_updater.cpp
@@ -613,6 +613,7 @@ void *updatethreadproc(void*)
613 char tempDir[PATH_MAX] = ""; 613 char tempDir[PATH_MAX] = "";
614 FSRef tempDirRef; 614 FSRef tempDirRef;
615 char temp[PATH_MAX]; 615 char temp[PATH_MAX];
616 // *NOTE: This buffer length is used in a scanf() below.
616 char deviceNode[1024] = ""; 617 char deviceNode[1024] = "";
617 FILE *downloadFile = NULL; 618 FILE *downloadFile = NULL;
618 OSStatus err; 619 OSStatus err;
@@ -937,7 +938,7 @@ void *updatethreadproc(void*)
937 if(sub != NULL) 938 if(sub != NULL)
938 { 939 {
939 sub += strlen(prefix); 940 sub += strlen(prefix);
940 sscanf(sub, "%s", deviceNode); 941 sscanf(sub, "%1023s", deviceNode);
941 } 942 }
942 } 943 }
943 944
diff --git a/linden/indra/newview/English.lproj/InfoPlist.strings b/linden/indra/newview/English.lproj/InfoPlist.strings
index ca392f1..2f68a02 100644
--- a/linden/indra/newview/English.lproj/InfoPlist.strings
+++ b/linden/indra/newview/English.lproj/InfoPlist.strings
@@ -1,5 +1,5 @@
1/* Localized versions of Info.plist keys */ 1/* Localized versions of Info.plist keys */
2 2
3CFBundleName = "Second Life"; 3CFBundleName = "Second Life";
4CFBundleShortVersionString = "Second Life version 1.13.2.12"; 4CFBundleShortVersionString = "Second Life version 1.13.2.15";
5CFBundleGetInfoString = "Second Life version 1.13.2.12, Copyright 2004-2006 Linden Research, Inc."; 5CFBundleGetInfoString = "Second Life version 1.13.2.15, Copyright 2004-2006 Linden Research, Inc.";
diff --git a/linden/indra/newview/Info-SecondLife.plist b/linden/indra/newview/Info-SecondLife.plist
index 8e8771d..3e6c65e 100644
--- a/linden/indra/newview/Info-SecondLife.plist
+++ b/linden/indra/newview/Info-SecondLife.plist
@@ -32,7 +32,7 @@
32 </dict> 32 </dict>
33 </array> 33 </array>
34 <key>CFBundleVersion</key> 34 <key>CFBundleVersion</key>
35 <string>1.13.2.12</string> 35 <string>1.13.2.15</string>
36 <key>CSResourcesFileMapped</key> 36 <key>CSResourcesFileMapped</key>
37 <true/> 37 <true/>
38</dict> 38</dict>
diff --git a/linden/indra/newview/linux_tools/exposed-symbols.txt b/linden/indra/newview/linux_tools/exposed-symbols.txt
new file mode 100644
index 0000000..98df90a
--- /dev/null
+++ b/linden/indra/newview/linux_tools/exposed-symbols.txt
@@ -0,0 +1,3 @@
1initllpython
2createLLImageJ2CKDU
3destroyLLImageJ2CKDU
diff --git a/linden/indra/newview/linux_tools/hidesymbols.ver b/linden/indra/newview/linux_tools/hidesymbols.ver
deleted file mode 100644
index 6ce7719..0000000
--- a/linden/indra/newview/linux_tools/hidesymbols.ver
+++ /dev/null
@@ -1,9 +0,0 @@
1LL_PRIVATE {
2 global:
3 initllpython;
4 createLLImageJ2CKDU;
5 destroyLLImageJ2CKDU;
6 local:
7 *;
8};
9
diff --git a/linden/indra/newview/linux_tools/package-client.sh b/linden/indra/newview/linux_tools/package-client.sh
index 1446e78..b054386 100755
--- a/linden/indra/newview/linux_tools/package-client.sh
+++ b/linden/indra/newview/linux_tools/package-client.sh
@@ -106,8 +106,15 @@ then
106 echo 'Default grid - creating empty gridargs.dat' 106 echo 'Default grid - creating empty gridargs.dat'
107 echo " " > $PACKAGE_NAME/gridargs.dat 107 echo " " > $PACKAGE_NAME/gridargs.dat
108else 108else
109 echo "Creating gridargs.dat for package, grid $GRID" 109 if [ X$GRID == X'firstlook' ]
110 echo "--${GRID} -helperuri http://preview-${GRID}.secondlife.com/helpers/" > $PACKAGE_NAME/gridargs.dat 110 then
111 # firstlook is a special case... it's not really a grid.
112 echo "Creating gridargs.dat for firstlook"
113 echo "-settings settings_firstlook.xml" > $PACKAGE_NAME/gridargs.dat
114 else
115 echo "Creating gridargs.dat for package, grid $GRID"
116 echo "-settings settings_beta.xml --${GRID} -helperuri http://preview-${GRID}.secondlife.com/helpers/" > $PACKAGE_NAME/gridargs.dat
117 fi
111fi 118fi
112 119
113TARBALL=$PACKAGE_NAME.tar.bz2 120TARBALL=$PACKAGE_NAME.tar.bz2
diff --git a/linden/indra/newview/llagent.cpp b/linden/indra/newview/llagent.cpp
index 26ef1b0..6d9137d 100644
--- a/linden/indra/newview/llagent.cpp
+++ b/linden/indra/newview/llagent.cpp
@@ -2115,11 +2115,11 @@ void LLAgent::updateWanderTarget()
2115 F32 rand_x; 2115 F32 rand_x;
2116 F32 rand_y; 2116 F32 rand_y;
2117 2117
2118 if (mWanderTimer.checkExpirationAndReset(frand(MAX_WANDER_TIME))) 2118 if (mWanderTimer.checkExpirationAndReset(ll_frand(MAX_WANDER_TIME)))
2119 { 2119 {
2120 // Pick a random spot to wander towards 2120 // Pick a random spot to wander towards
2121 num_regions = gWorldPointer->mActiveRegionList.getLength(); 2121 num_regions = gWorldPointer->mActiveRegionList.getLength();
2122 S32 region_num = llround(frand(1.f) * num_regions); 2122 S32 region_num = llround(ll_frand() * num_regions);
2123 rand_region = gWorldPointer->mActiveRegionList.getFirstData(); 2123 rand_region = gWorldPointer->mActiveRegionList.getFirstData();
2124 S32 i = 0; 2124 S32 i = 0;
2125 while (i < region_num) 2125 while (i < region_num)
@@ -2127,8 +2127,8 @@ void LLAgent::updateWanderTarget()
2127 rand_region = gWorldPointer->mActiveRegionList.getNextData(); 2127 rand_region = gWorldPointer->mActiveRegionList.getNextData();
2128 i++; 2128 i++;
2129 } 2129 }
2130 rand_x = frand(rand_region->getWidth()); 2130 rand_x = ll_frand(rand_region->getWidth());
2131 rand_y = frand(rand_region->getWidth()); 2131 rand_y = ll_frand(rand_region->getWidth());
2132 2132
2133 stopAutoPilot(); 2133 stopAutoPilot();
2134 startAutoPilotGlobal(rand_region->getPosGlobalFromRegion(LLVector3(rand_x, rand_y, 0.f))); 2134 startAutoPilotGlobal(rand_region->getPosGlobalFromRegion(LLVector3(rand_x, rand_y, 0.f)));
@@ -5687,7 +5687,7 @@ void LLAgent::fidget()
5687 // pick a random fidget anim here 5687 // pick a random fidget anim here
5688 S32 oldFidget = mCurrentFidget; 5688 S32 oldFidget = mCurrentFidget;
5689 5689
5690 mCurrentFidget = gLindenLabRandomNumber.llrand(NUM_AGENT_STAND_ANIMS); 5690 mCurrentFidget = ll_rand(NUM_AGENT_STAND_ANIMS);
5691 5691
5692 if (mCurrentFidget != oldFidget) 5692 if (mCurrentFidget != oldFidget)
5693 { 5693 {
@@ -5719,7 +5719,7 @@ void LLAgent::fidget()
5719 } 5719 }
5720 5720
5721 // calculate next fidget time 5721 // calculate next fidget time
5722 mNextFidgetTime = curTime + gLindenLabRandomNumber.llfrand(MAX_FIDGET_TIME - MIN_FIDGET_TIME) + MIN_FIDGET_TIME; 5722 mNextFidgetTime = curTime + ll_frand(MAX_FIDGET_TIME - MIN_FIDGET_TIME) + MIN_FIDGET_TIME;
5723 } 5723 }
5724 } 5724 }
5725} 5725}
diff --git a/linden/indra/newview/llanimalcontrols.cpp b/linden/indra/newview/llanimalcontrols.cpp
index 8bafe86..2e047ae 100644
--- a/linden/indra/newview/llanimalcontrols.cpp
+++ b/linden/indra/newview/llanimalcontrols.cpp
@@ -103,7 +103,7 @@ void LLAnimalControlsVirtualServer::update()
103 103
104 F32 leftRightSpan = 5.0f; 104 F32 leftRightSpan = 5.0f;
105 105
106 F32 randomSpan = gLindenLabRandomNumber.llfrand( leftRightSpan ); 106 F32 randomSpan = ll_frand( leftRightSpan );
107 107
108 focusPosition += leftDirection * ( - leftRightSpan * ONE_HALF + randomSpan ); 108 focusPosition += leftDirection * ( - leftRightSpan * ONE_HALF + randomSpan );
109 } 109 }
diff --git a/linden/indra/newview/llcloud.cpp b/linden/indra/newview/llcloud.cpp
index e1b2281..ca05562 100644
--- a/linden/indra/newview/llcloud.cpp
+++ b/linden/indra/newview/llcloud.cpp
@@ -193,9 +193,9 @@ void LLCloudGroup::updatePuffCount()
193 for (i = current_puff_count; i < target_puff_count; i++) 193 for (i = current_puff_count; i < target_puff_count; i++)
194 { 194 {
195 puff_pos_global = mVOCloudsp->getPositionGlobal(); 195 puff_pos_global = mVOCloudsp->getPositionGlobal();
196 F32 x = frand(256.f/CLOUD_GROUPS_PER_EDGE) - 128.f/CLOUD_GROUPS_PER_EDGE; 196 F32 x = ll_frand(256.f/CLOUD_GROUPS_PER_EDGE) - 128.f/CLOUD_GROUPS_PER_EDGE;
197 F32 y = frand(256.f/CLOUD_GROUPS_PER_EDGE) - 128.f/CLOUD_GROUPS_PER_EDGE; 197 F32 y = ll_frand(256.f/CLOUD_GROUPS_PER_EDGE) - 128.f/CLOUD_GROUPS_PER_EDGE;
198 F32 z = frand(CLOUD_HEIGHT_RANGE) - 0.5f*CLOUD_HEIGHT_RANGE; 198 F32 z = ll_frand(CLOUD_HEIGHT_RANGE) - 0.5f*CLOUD_HEIGHT_RANGE;
199 puff_pos_global += LLVector3d(x, y, z); 199 puff_pos_global += LLVector3d(x, y, z);
200 mCloudPuffs[i].mPositionGlobal = puff_pos_global; 200 mCloudPuffs[i].mPositionGlobal = puff_pos_global;
201 mCloudPuffs[i].mAlpha = 0.01f; 201 mCloudPuffs[i].mAlpha = 0.01f;
diff --git a/linden/indra/newview/llcontroldef.cpp b/linden/indra/newview/llcontroldef.cpp
index c186f6a..850b5bf 100644
--- a/linden/indra/newview/llcontroldef.cpp
+++ b/linden/indra/newview/llcontroldef.cpp
@@ -106,6 +106,7 @@ void declare_settings()
106 gSavedSettings.declareS32("MenuBarWidth", 410, "", NO_PERSIST ); 106 gSavedSettings.declareS32("MenuBarWidth", 410, "", NO_PERSIST );
107 107
108 gSavedSettings.declareF32("MenuAccessKeyTime", 0.25f, "Time (seconds) in which the menu key must be tapped to move focus to the menu bar"); 108 gSavedSettings.declareF32("MenuAccessKeyTime", 0.25f, "Time (seconds) in which the menu key must be tapped to move focus to the menu bar");
109 gSavedSettings.declareBOOL("UseAltKeyForMenus", FALSE, "Access menus via keyboard by tapping Alt");
109 // Which background overlay to use 110 // Which background overlay to use
110 gSavedSettings.declareS32("MapOverlayIndex", 0, "Currently selected world map type"); 111 gSavedSettings.declareS32("MapOverlayIndex", 0, "Currently selected world map type");
111 112
diff --git a/linden/indra/newview/lldrawpoolbump.cpp b/linden/indra/newview/lldrawpoolbump.cpp
index 28e60f1..befcc70 100644
--- a/linden/indra/newview/lldrawpoolbump.cpp
+++ b/linden/indra/newview/lldrawpoolbump.cpp
@@ -113,9 +113,10 @@ void LLStandardBumpmap::restoreGL()
113 113
114 while( !feof(file) && (LLStandardBumpmap::sStandardBumpmapCount < (U32)TEM_BUMPMAP_COUNT) ) 114 while( !feof(file) && (LLStandardBumpmap::sStandardBumpmapCount < (U32)TEM_BUMPMAP_COUNT) )
115 { 115 {
116 // *NOTE: This buffer size is hard coded into scanf() below.
116 char label[2048] = ""; 117 char label[2048] = "";
117 char bump_file[2048] = ""; 118 char bump_file[2048] = "";
118 fields_read = fscanf( file, "\n%s %s", label, bump_file); 119 fields_read = fscanf( file, "\n%2047s %2047s", label, bump_file);
119 if( EOF == fields_read ) 120 if( EOF == fields_read )
120 { 121 {
121 break; 122 break;
diff --git a/linden/indra/newview/llfasttimerview.cpp b/linden/indra/newview/llfasttimerview.cpp
index 3fddc4b..e147e3f 100644
--- a/linden/indra/newview/llfasttimerview.cpp
+++ b/linden/indra/newview/llfasttimerview.cpp
@@ -71,19 +71,21 @@ static LLColor4 green9(0.6f, 1.0f, 0.6f, 1.0f);
71// red (5) magenta (4) 71// red (5) magenta (4)
72static struct ft_display_info ft_display_table[] = 72static struct ft_display_info ft_display_table[] =
73{ 73{
74 { LLFastTimer::FTM_FRAME, "Frame", &LLColor4::white, 0 }, 74 { LLFastTimer::FTM_FRAME, "Frame", &LLColor4::white, 0 },
75 { LLFastTimer::FTM_MESSAGES, " Messages", &LLColor4::grey1, 0 }, 75 { LLFastTimer::FTM_MESSAGES, " Messages", &LLColor4::grey1, 0 },
76 { LLFastTimer::FTM_SLEEP, " Sleep", &LLColor4::grey2, 0 }, 76 { LLFastTimer::FTM_SLEEP, " Sleep", &LLColor4::grey2, 0 },
77 { LLFastTimer::FTM_IDLE, " Idle", &blue0, 0 }, 77 { LLFastTimer::FTM_IDLE, " Idle", &blue0, 0 },
78 { LLFastTimer::FTM_INVENTORY, " Inventory Update", &LLColor4::purple6, 1 }, 78 { LLFastTimer::FTM_PUMP, " Pump", &LLColor4::magenta2, 1 },
79 { LLFastTimer::FTM_AUTO_SELECT, " Open and Select", &LLColor4::red, 0 }, 79 { LLFastTimer::FTM_CURL, " Curl", &LLColor4::magenta3, 0 },
80 { LLFastTimer::FTM_INVENTORY, " Inventory Update", &LLColor4::purple6, 1 },
81 { LLFastTimer::FTM_AUTO_SELECT, " Open and Select", &LLColor4::red, 0 },
80 { LLFastTimer::FTM_FILTER, " Filter", &LLColor4::red2, 0 }, 82 { LLFastTimer::FTM_FILTER, " Filter", &LLColor4::red2, 0 },
81 { LLFastTimer::FTM_ARRANGE, " Arrange", &LLColor4::red3, 0 }, 83 { LLFastTimer::FTM_ARRANGE, " Arrange", &LLColor4::red3, 0 },
82 { LLFastTimer::FTM_REFRESH, " Refresh", &LLColor4::red4, 0 }, 84 { LLFastTimer::FTM_REFRESH, " Refresh", &LLColor4::red4, 0 },
83 { LLFastTimer::FTM_SORT, " Sort", &LLColor4::red5, 0 }, 85 { LLFastTimer::FTM_SORT, " Sort", &LLColor4::red5, 0 },
84 { LLFastTimer::FTM_RESET_DRAWORDER, " ResetDrawOrder", &LLColor4::pink1, 0 }, 86 { LLFastTimer::FTM_RESET_DRAWORDER, " ResetDrawOrder", &LLColor4::pink1, 0 },
85 { LLFastTimer::FTM_WORLD_UPDATE, " World Update", &LLColor4::blue1, 1 }, 87 { LLFastTimer::FTM_WORLD_UPDATE, " World Update", &LLColor4::blue1, 1 },
86 { LLFastTimer::FTM_UPDATE_MOVE, " Move Objects", &LLColor4::pink2, 0 }, 88 { LLFastTimer::FTM_UPDATE_MOVE, " Move Objects", &LLColor4::pink2, 0 },
87 { LLFastTimer::FTM_OCTREE_BALANCE, " Octree Balance", &LLColor4::red3, 0 }, 89 { LLFastTimer::FTM_OCTREE_BALANCE, " Octree Balance", &LLColor4::red3, 0 },
88 { LLFastTimer::FTM_CULL, " Object Cull", &LLColor4::blue2, 0 }, 90 { LLFastTimer::FTM_CULL, " Object Cull", &LLColor4::blue2, 0 },
89 { LLFastTimer::FTM_CULL_REBOUND, " Rebound", &LLColor4::blue3, 0 }, 91 { LLFastTimer::FTM_CULL_REBOUND, " Rebound", &LLColor4::blue3, 0 },
@@ -281,6 +283,13 @@ BOOL LLFastTimerView::handleMouseDown(S32 x, S32 y, MASK mask)
281 } 283 }
282 } 284 }
283 } 285 }
286 else if (mask & MASK_ALT)
287 {
288 if (mask & MASK_SHIFT)
289 mSubtractHidden = !mSubtractHidden;
290 else
291 mDisplayCalls = !mDisplayCalls;
292 }
284 else if (mask & MASK_SHIFT) 293 else if (mask & MASK_SHIFT)
285 { 294 {
286 if (++mDisplayMode > 3) 295 if (++mDisplayMode > 3)
@@ -301,8 +310,8 @@ BOOL LLFastTimerView::handleMouseDown(S32 x, S32 y, MASK mask)
301 mScrollIndex = 0; 310 mScrollIndex = 0;
302 } 311 }
303 } 312 }
304 // RN: for now, pass all mouse events through 313 // SJB: Don't pass mouse clicks through the display
305 return FALSE; 314 return TRUE;
306} 315}
307 316
308BOOL LLFastTimerView::handleMouseUp(S32 x, S32 y, MASK mask) 317BOOL LLFastTimerView::handleMouseUp(S32 x, S32 y, MASK mask)
@@ -359,33 +368,6 @@ BOOL LLFastTimerView::handleScrollWheel(S32 x, S32 y, S32 clicks)
359 return FALSE; 368 return FALSE;
360} 369}
361 370
362BOOL LLFastTimerView::handleKey(KEY key, MASK mask, BOOL called_from_parent)
363{
364 // Otherwise space key gets eaten from the rest of the UI. JC
365 if (getVisible())
366 {
367 switch (key)
368 {
369 case '=':
370 mDisplayCalls = !mDisplayCalls;
371 return TRUE;
372 case '-':
373 mSubtractHidden = !mSubtractHidden;
374 return TRUE;
375 case ' ':
376 // pause/unpause
377 LLFastTimer::sPauseHistory = !LLFastTimer::sPauseHistory;
378 // reset scroll to bottom when unpausing
379 if (!LLFastTimer::sPauseHistory)
380 {
381 mScrollIndex = 0;
382 }
383 return TRUE;
384 }
385 }
386 return FALSE;
387}
388
389void LLFastTimerView::draw() 371void LLFastTimerView::draw()
390{ 372{
391 LLFastTimer t(LLFastTimer::FTM_RENDER_TIMER); 373 LLFastTimer t(LLFastTimer::FTM_RENDER_TIMER);
@@ -480,7 +462,7 @@ void LLFastTimerView::draw()
480 LLFontGL::sMonospace->renderUTF8(tdesc, 0, x, y, LLColor4::white, LLFontGL::LEFT, LLFontGL::TOP); 462 LLFontGL::sMonospace->renderUTF8(tdesc, 0, x, y, LLColor4::white, LLFontGL::LEFT, LLFontGL::TOP);
481 y -= (texth + 2); 463 y -= (texth + 2);
482 464
483 LLFontGL::sMonospace->renderUTF8("[Right-click to log selected] [= to toggle counts] [- to subtract hidden]", 465 LLFontGL::sMonospace->renderUTF8("[Right-Click log selected] [ALT-Click toggle counts] [ALT-SHIFT-Click sub hidden]",
484 0, x, y, LLColor4::white, LLFontGL::LEFT, LLFontGL::TOP); 466 0, x, y, LLColor4::white, LLFontGL::LEFT, LLFontGL::TOP);
485 y -= (texth + 2); 467 y -= (texth + 2);
486 } 468 }
@@ -566,7 +548,7 @@ void LLFastTimerView::draw()
566 } 548 }
567 else 549 else
568 { 550 {
569 U64 ticks = disabled >= 1 ? ticks_sum[0][i] : LLFastTimer::sCountAverage[tidx]; 551 U64 ticks = ticks_sum[0][i];
570 ms = (F32)((F64)ticks * iclock_freq); 552 ms = (F32)((F64)ticks * iclock_freq);
571 calls = (S32)LLFastTimer::sCallAverage[tidx]; 553 calls = (S32)LLFastTimer::sCallAverage[tidx];
572 } 554 }
diff --git a/linden/indra/newview/llfasttimerview.h b/linden/indra/newview/llfasttimerview.h
index eb160e8..b20c8eb 100644
--- a/linden/indra/newview/llfasttimerview.h
+++ b/linden/indra/newview/llfasttimerview.h
@@ -45,7 +45,6 @@ public:
45 virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); 45 virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask);
46 virtual BOOL handleHover(S32 x, S32 y, MASK mask); 46 virtual BOOL handleHover(S32 x, S32 y, MASK mask);
47 virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks); 47 virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks);
48 virtual BOOL handleKey(KEY key, MASK mask, BOOL called_from_parent);
49 virtual void draw(); 48 virtual void draw();
50 49
51 S32 getLegendIndex(S32 y); 50 S32 getLegendIndex(S32 y);
diff --git a/linden/indra/newview/llfeaturemanager.cpp b/linden/indra/newview/llfeaturemanager.cpp
index d3b0dbb..061b343 100644
--- a/linden/indra/newview/llfeaturemanager.cpp
+++ b/linden/indra/newview/llfeaturemanager.cpp
@@ -300,12 +300,7 @@ BOOL LLFeatureManager::loadFeatureTables()
300 return TRUE; 300 return TRUE;
301} 301}
302 302
303S32 LLFeatureManager::getGPUClass() 303void LLFeatureManager::loadGPUClass()
304{
305 return mGPUClass;
306}
307
308S32 LLFeatureManager::loadGPUClass()
309{ 304{
310 std::string data_path = gDirUtilp->getAppRODataDir(); 305 std::string data_path = gDirUtilp->getAppRODataDir();
311 306
@@ -313,6 +308,10 @@ S32 LLFeatureManager::loadGPUClass()
313 308
314 data_path += GPU_TABLE_FILENAME; 309 data_path += GPU_TABLE_FILENAME;
315 310
311 // defaults
312 mGPUClass = 0;
313 mGPUString = gGLManager.getRawGLString();
314
316 llifstream file; 315 llifstream file;
317 316
318 file.open(data_path.c_str()); 317 file.open(data_path.c_str());
@@ -320,7 +319,7 @@ S32 LLFeatureManager::loadGPUClass()
320 if (!file) 319 if (!file)
321 { 320 {
322 llwarns << "Unable to open GPU table: " << data_path << "!" << llendl; 321 llwarns << "Unable to open GPU table: " << data_path << "!" << llendl;
323 return 0; 322 return;
324 } 323 }
325 324
326 std::string renderer = gGLManager.getRawGLString(); 325 std::string renderer = gGLManager.getRawGLString();
@@ -379,14 +378,14 @@ S32 LLFeatureManager::loadGPUClass()
379 { 378 {
380 file.close(); 379 file.close();
381 llinfos << "GPU is " << label << llendl; 380 llinfos << "GPU is " << label << llendl;
382 return (S32) strtol(cls, NULL, 10); 381 mGPUString = label;
382 mGPUClass = (S32) strtol(cls, NULL, 10);
383 } 383 }
384 } 384 }
385 file.close(); 385 file.close();
386 //flp->dump(); 386 //flp->dump();
387 387
388 llwarns << "Couldn't match GPU to a class: " << gGLManager.getRawGLString() << llendl; 388 llwarns << "Couldn't match GPU to a class: " << gGLManager.getRawGLString() << llendl;
389 return 0;
390} 389}
391 390
392void LLFeatureManager::cleanupFeatureTables() 391void LLFeatureManager::cleanupFeatureTables()
@@ -419,7 +418,7 @@ void LLFeatureManager::initCPUFeatureMasks()
419 418
420void LLFeatureManager::initGraphicsFeatureMasks() 419void LLFeatureManager::initGraphicsFeatureMasks()
421{ 420{
422 mGPUClass = loadGPUClass(); 421 loadGPUClass();
423 422
424 if (mGPUClass >= 0 && mGPUClass < 4) 423 if (mGPUClass >= 0 && mGPUClass < 4)
425 { 424 {
diff --git a/linden/indra/newview/llfeaturemanager.h b/linden/indra/newview/llfeaturemanager.h
index d38e5b7..a24f06f 100644
--- a/linden/indra/newview/llfeaturemanager.h
+++ b/linden/indra/newview/llfeaturemanager.h
@@ -84,9 +84,10 @@ public:
84 void maskCurrentList(const char *name); // Mask the current feature list with the named list 84 void maskCurrentList(const char *name); // Mask the current feature list with the named list
85 85
86 BOOL loadFeatureTables(); 86 BOOL loadFeatureTables();
87 S32 getGPUClass();
88 S32 loadGPUClass();
89 87
88 S32 getGPUClass() { return mGPUClass; }
89 std::string& getGPUString() { return mGPUString; }
90
90 void cleanupFeatureTables(); 91 void cleanupFeatureTables();
91 92
92 S32 getVersion() const { return mTableVersion; } 93 S32 getVersion() const { return mTableVersion; }
@@ -102,7 +103,9 @@ public:
102 BOOL initPCIFeatureMasks(); 103 BOOL initPCIFeatureMasks();
103 104
104 void applyRecommendedFeatures(); 105 void applyRecommendedFeatures();
106
105protected: 107protected:
108 void loadGPUClass();
106 void initBaseMask(); 109 void initBaseMask();
107 110
108 std::map<LLString, LLFeatureList *> mMaskList; 111 std::map<LLString, LLFeatureList *> mMaskList;
@@ -110,6 +113,7 @@ protected:
110 S32 mTableVersion; 113 S32 mTableVersion;
111 BOOL mSafe; // Reinitialize everything to the "safe" mask 114 BOOL mSafe; // Reinitialize everything to the "safe" mask
112 S32 mGPUClass; 115 S32 mGPUClass;
116 std::string mGPUString;
113}; 117};
114 118
115extern LLFeatureManager *gFeatureManagerp; 119extern LLFeatureManager *gFeatureManagerp;
diff --git a/linden/indra/newview/llflexibleobject.cpp b/linden/indra/newview/llflexibleobject.cpp
index 7e748f6..7e37c4c 100644
--- a/linden/indra/newview/llflexibleobject.cpp
+++ b/linden/indra/newview/llflexibleobject.cpp
@@ -204,9 +204,13 @@ void LLVolumeImplFlexible::setAttributesOfAllSections()
204 end_rot = F_PI * params.getTwist(); 204 end_rot = F_PI * params.getTwist();
205 } 205 }
206 206
207 if (!mVO->mDrawable)
208 {
209 return;
210 }
211
207 S32 num_sections = 1 << mSimulateRes; 212 S32 num_sections = 1 << mSimulateRes;
208 213
209
210 LLVector3 scale = mVO->mDrawable->getScale(); 214 LLVector3 scale = mVO->mDrawable->getScale();
211 215
212 mSection[0].mPosition = getAnchorPosition(); 216 mSection[0].mPosition = getAnchorPosition();
diff --git a/linden/indra/newview/llfloatereditui.cpp b/linden/indra/newview/llfloatereditui.cpp
index d6a61d7..21580d3 100644
--- a/linden/indra/newview/llfloatereditui.cpp
+++ b/linden/indra/newview/llfloatereditui.cpp
@@ -53,7 +53,7 @@ void LLFloaterEditUI::navigateHierarchyButtonPressed(void* data)
53 for(idx = 0,itor = parentChildren->begin();itor!=parentChildren->end();itor++,idx++){ 53 for(idx = 0,itor = parentChildren->begin();itor!=parentChildren->end();itor++,idx++){
54 if((*itor)==view)break; 54 if((*itor)==view)break;
55 } 55 }
56 switch((int)data) 56 switch((intptr_t)data)
57 { 57 {
58 case 0 ://up 58 case 0 ://up
59 view = view->getParent(); 59 view = view->getParent();
diff --git a/linden/indra/newview/llfloatertools.cpp b/linden/indra/newview/llfloatertools.cpp
index c9edf98..05dd70b 100644
--- a/linden/indra/newview/llfloatertools.cpp
+++ b/linden/indra/newview/llfloatertools.cpp
@@ -383,8 +383,7 @@ LLFloaterTools::LLFloaterTools()
383 mPanelLandInfo(NULL), 383 mPanelLandInfo(NULL),
384 384
385 mTabLand(NULL), 385 mTabLand(NULL),
386 mDirty(TRUE), 386 mDirty(TRUE)
387 mLastTool(gToolNull)
388{ 387{
389 mAutoFocus = FALSE; 388 mAutoFocus = FALSE;
390 LLCallbackMap::map_t factory_map; 389 LLCallbackMap::map_t factory_map;
@@ -949,21 +948,13 @@ void LLFloaterTools::onClickGridOptions(void* data)
949 //floaterp->addDependentFloater(LLFloaterBuildOptions::getInstance(), FALSE); 948 //floaterp->addDependentFloater(LLFloaterBuildOptions::getInstance(), FALSE);
950} 949}
951 950
952void LLFloaterTools::saveLastTool()
953{
954 mLastTool = gToolMgr->getCurrentTool( MASK_NONE );
955}
956
957void LLFloaterTools::setEditTool(void* tool_pointer) 951void LLFloaterTools::setEditTool(void* tool_pointer)
958{ 952{
959 select_tool(tool_pointer); 953 select_tool(tool_pointer);
960 if(gFloaterTools && tool_pointer != gToolNull)
961 {
962 gFloaterTools->saveLastTool();
963 }
964} 954}
965 955
966void LLFloaterTools::onFocusReceived() 956void LLFloaterTools::onFocusReceived()
967{ 957{
968 select_tool(mLastTool); 958 gCurrentToolset = gBasicToolset;
959 gCurrentToolset->selectTool(gCurrentToolset->getSelectedTool());
969} \ No newline at end of file 960} \ No newline at end of file
diff --git a/linden/indra/newview/llfloatertools.h b/linden/indra/newview/llfloatertools.h
index 343a898..a6c4ceb 100644
--- a/linden/indra/newview/llfloatertools.h
+++ b/linden/indra/newview/llfloatertools.h
@@ -175,7 +175,6 @@ public:
175 LLPanelLandInfo *mPanelLandInfo; 175 LLPanelLandInfo *mPanelLandInfo;
176 176
177 LLTabContainer* mTabLand; 177 LLTabContainer* mTabLand;
178 LLTool* mLastTool;
179 178
180private: 179private:
181 BOOL mDirty; 180 BOOL mDirty;
diff --git a/linden/indra/newview/llhippo.cpp b/linden/indra/newview/llhippo.cpp
index bcaf498..b2dd20f 100644
--- a/linden/indra/newview/llhippo.cpp
+++ b/linden/indra/newview/llhippo.cpp
@@ -51,7 +51,7 @@ void trigger_hippo_bug(void*)
51 { 51 {
52 chat = TRUE; 52 chat = TRUE;
53 } 53 }
54 else if (frand(1.f) > 0.5f) 54 else if (ll_frand() > 0.5f)
55 { 55 {
56 chat = TRUE; 56 chat = TRUE;
57 } 57 }
diff --git a/linden/indra/newview/llhudeffectbeam.cpp b/linden/indra/newview/llhudeffectbeam.cpp
index a7e7a5e..db24875 100644
--- a/linden/indra/newview/llhudeffectbeam.cpp
+++ b/linden/indra/newview/llhudeffectbeam.cpp
@@ -369,9 +369,9 @@ void LLHUDEffectBeam::setupParticle(const S32 i)
369 // Generate a random offset for the target point. 369 // Generate a random offset for the target point.
370 const F32 SCALE = 0.5f; 370 const F32 SCALE = 0.5f;
371 F32 x, y, z; 371 F32 x, y, z;
372 x = frand(SCALE) - 0.5f*SCALE; 372 x = ll_frand(SCALE) - 0.5f*SCALE;
373 y = frand(SCALE) - 0.5f*SCALE; 373 y = ll_frand(SCALE) - 0.5f*SCALE;
374 z = frand(SCALE) - 0.5f*SCALE; 374 z = ll_frand(SCALE) - 0.5f*SCALE;
375 375
376 LLVector3d target_pos_global(mTargetPos); 376 LLVector3d target_pos_global(mTargetPos);
377 target_pos_global += LLVector3d(x, y, z); 377 target_pos_global += LLVector3d(x, y, z);
diff --git a/linden/indra/newview/llinventorymodel.cpp b/linden/indra/newview/llinventorymodel.cpp
index 04506c8..7864aa8 100644
--- a/linden/indra/newview/llinventorymodel.cpp
+++ b/linden/indra/newview/llinventorymodel.cpp
@@ -1966,11 +1966,12 @@ bool LLInventoryModel::loadFromFile(
1966 llinfos << "unable to load inventory from: " << filename << llendl; 1966 llinfos << "unable to load inventory from: " << filename << llendl;
1967 return false; 1967 return false;
1968 } 1968 }
1969 // *NOTE: This buffer size is hard coded into scanf() below.
1969 char buffer[MAX_STRING]; 1970 char buffer[MAX_STRING];
1970 char keyword[MAX_STRING]; 1971 char keyword[MAX_STRING];
1971 while(!feof(file) && fgets(buffer, MAX_STRING, file)) 1972 while(!feof(file) && fgets(buffer, MAX_STRING, file))
1972 { 1973 {
1973 sscanf(buffer, " %s", keyword); 1974 sscanf(buffer, " %254s", keyword);
1974 if(0 == strcmp("inv_category", keyword)) 1975 if(0 == strcmp("inv_category", keyword))
1975 { 1976 {
1976 LLPointer<LLViewerInventoryCategory> inv_cat = new LLViewerInventoryCategory(LLUUID::null); 1977 LLPointer<LLViewerInventoryCategory> inv_cat = new LLViewerInventoryCategory(LLUUID::null);
diff --git a/linden/indra/newview/llmanip.cpp b/linden/indra/newview/llmanip.cpp
index 538e6df..20d77e0 100644
--- a/linden/indra/newview/llmanip.cpp
+++ b/linden/indra/newview/llmanip.cpp
@@ -107,9 +107,7 @@ void LLManip::getManipNormal(LLViewerObject* object, EManipPart manip, LLVector3
107 LLVector3 arrow_axis; 107 LLVector3 arrow_axis;
108 getManipAxis(object, manip, arrow_axis); 108 getManipAxis(object, manip, arrow_axis);
109 109
110 LLVector3 origin_dir = grid_origin - gCamera->getOrigin(); 110 LLVector3 cross = arrow_axis % gCamera->getAtAxis();
111 origin_dir.normVec();
112 LLVector3 cross = arrow_axis % origin_dir;
113 normal = cross % arrow_axis; 111 normal = cross % arrow_axis;
114 normal.normVec(); 112 normal.normVec();
115 } 113 }
diff --git a/linden/indra/newview/llmutelist.cpp b/linden/indra/newview/llmutelist.cpp
index 2101e87..fc0046a 100644
--- a/linden/indra/newview/llmutelist.cpp
+++ b/linden/indra/newview/llmutelist.cpp
@@ -363,6 +363,8 @@ BOOL LLMuteList::loadFromFile(const LLString& filename)
363 return FALSE; 363 return FALSE;
364 } 364 }
365 365
366 // *NOTE: Changing the size of these buffers will require changes
367 // in the scanf below.
366 char id_buffer[MAX_STRING]; 368 char id_buffer[MAX_STRING];
367 char name_buffer[MAX_STRING]; 369 char name_buffer[MAX_STRING];
368 char buffer[MAX_STRING]; 370 char buffer[MAX_STRING];
@@ -372,7 +374,7 @@ BOOL LLMuteList::loadFromFile(const LLString& filename)
372 id_buffer[0] = '\0'; 374 id_buffer[0] = '\0';
373 name_buffer[0] = '\0'; 375 name_buffer[0] = '\0';
374 S32 type = 0; 376 S32 type = 0;
375 sscanf(buffer, " %d %s %[^|]", &type, id_buffer, name_buffer); 377 sscanf(buffer, " %d %254s %254[^|]", &type, id_buffer, name_buffer);
376 LLUUID id = LLUUID(id_buffer); 378 LLUUID id = LLUUID(id_buffer);
377 LLMute mute(id, name_buffer, (LLMute::EType)type); 379 LLMute mute(id, name_buffer, (LLMute::EType)type);
378 if (mute.mID.isNull() 380 if (mute.mID.isNull()
diff --git a/linden/indra/newview/llpanelavatar.cpp b/linden/indra/newview/llpanelavatar.cpp
index d54f16b..8ba33a9 100644
--- a/linden/indra/newview/llpanelavatar.cpp
+++ b/linden/indra/newview/llpanelavatar.cpp
@@ -848,14 +848,17 @@ void LLPanelAvatarClassified::enableControls(BOOL self)
848BOOL LLPanelAvatarClassified::titleIsValid() 848BOOL LLPanelAvatarClassified::titleIsValid()
849{ 849{
850 LLTabContainerCommon* tabs = LLViewerUICtrlFactory::getTabContainerByName(this, "classified tab"); 850 LLTabContainerCommon* tabs = LLViewerUICtrlFactory::getTabContainerByName(this, "classified tab");
851 for (S32 i = 0; i < tabs->getTabCount(); i++) 851 if ( tabs )
852 { 852 {
853 LLPanelClassified* panel = (LLPanelClassified*)tabs->getPanelByIndex(i); 853 LLPanelClassified* panel = (LLPanelClassified*)tabs->getCurrentPanel();
854 if ( ! panel->titleIsValid() ) 854 if ( panel )
855 { 855 {
856 return FALSE; 856 if ( ! panel->titleIsValid() )
857 } 857 {
858 } 858 return FALSE;
859 };
860 };
861 };
859 862
860 return TRUE; 863 return TRUE;
861} 864}
@@ -1659,7 +1662,8 @@ void LLPanelAvatar::onClickOK(void *userdata)
1659 { 1662 {
1660 self->sendAvatarPropertiesUpdate(); 1663 self->sendAvatarPropertiesUpdate();
1661 1664
1662 if ( self->mPanelClassified->titleIsValid() ) 1665 LLTabContainerCommon* tabs = LLUICtrlFactory::getTabContainerByName(self,"tab");
1666 if ( tabs->getCurrentPanel() != self->mPanelClassified )
1663 { 1667 {
1664 self->mPanelClassified->apply(); 1668 self->mPanelClassified->apply();
1665 1669
@@ -1669,6 +1673,19 @@ void LLPanelAvatar::onClickOK(void *userdata)
1669 infop->close(); 1673 infop->close();
1670 } 1674 }
1671 } 1675 }
1676 else
1677 {
1678 if ( self->mPanelClassified->titleIsValid() )
1679 {
1680 self->mPanelClassified->apply();
1681
1682 LLFloaterAvatarInfo *infop = LLFloaterAvatarInfo::getInstance(self->mAvatarID);
1683 if (infop)
1684 {
1685 infop->close();
1686 }
1687 }
1688 }
1672 } 1689 }
1673} 1690}
1674 1691
diff --git a/linden/indra/newview/llstartup.cpp b/linden/indra/newview/llstartup.cpp
index 5eabad3..916db16 100644
--- a/linden/indra/newview/llstartup.cpp
+++ b/linden/indra/newview/llstartup.cpp
@@ -685,7 +685,7 @@ BOOL idle_startup()
685 gSavedSettings.loadFromFile(gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT,"overrides.xml")); 685 gSavedSettings.loadFromFile(gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT,"overrides.xml"));
686 686
687 // handle the per account settings setup 687 // handle the per account settings setup
688 strcpy(gPerAccountSettingsFileName, gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, DEFAULT_SETTINGS_FILE).c_str()); 688 gPerAccountSettingsFileName = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, DEFAULT_SETTINGS_FILE);
689 689
690 // per account settings. Set defaults here if not found. If we get a bunch of these, eventually move to a function. 690 // per account settings. Set defaults here if not found. If we get a bunch of these, eventually move to a function.
691 gSavedPerAccountSettings.loadFromFile(gPerAccountSettingsFileName); 691 gSavedPerAccountSettings.loadFromFile(gPerAccountSettingsFileName);
diff --git a/linden/indra/newview/lltexlayer.cpp b/linden/indra/newview/lltexlayer.cpp
index 0292417..63d167d 100644
--- a/linden/indra/newview/lltexlayer.cpp
+++ b/linden/indra/newview/lltexlayer.cpp
@@ -487,7 +487,7 @@ void LLTexLayerSetBuffer::readBackAndUpload(U8* baked_bump_data)
487// static 487// static
488void LLTexLayerSetBuffer::onTextureUploadComplete(const LLUUID& uuid, void* userdata, S32 result) // StoreAssetData callback (not fixed) 488void LLTexLayerSetBuffer::onTextureUploadComplete(const LLUUID& uuid, void* userdata, S32 result) // StoreAssetData callback (not fixed)
489{ 489{
490 LLBakedUploadData* baked_upload_data = (LLBakedUploadData*)(U32)userdata; 490 LLBakedUploadData* baked_upload_data = (LLBakedUploadData*)userdata;
491 491
492 LLVOAvatar* avatar = gAgent.getAvatarObject(); 492 LLVOAvatar* avatar = gAgent.getAvatarObject();
493 493
diff --git a/linden/indra/newview/llviewercontrol.cpp b/linden/indra/newview/llviewercontrol.cpp
index de89965..86e58d1 100644
--- a/linden/indra/newview/llviewercontrol.cpp
+++ b/linden/indra/newview/llviewercontrol.cpp
@@ -57,8 +57,8 @@ LLControlGroup gCrashSettings; // saved at end of session
57LLString gLastRunVersion; 57LLString gLastRunVersion;
58LLString gCurrentVersion; 58LLString gCurrentVersion;
59 59
60char gSettingsFileName[LL_MAX_PATH]; 60LLString gSettingsFileName;
61char gPerAccountSettingsFileName[LL_MAX_PATH] = ""; 61LLString gPerAccountSettingsFileName;
62 62
63LLFloaterSettingsDebug::LLFloaterSettingsDebug() : LLFloater("Configuration Editor") 63LLFloaterSettingsDebug::LLFloaterSettingsDebug() : LLFloater("Configuration Editor")
64{ 64{
diff --git a/linden/indra/newview/llviewercontrol.h b/linden/indra/newview/llviewercontrol.h
index 06d666e..4be4313 100644
--- a/linden/indra/newview/llviewercontrol.h
+++ b/linden/indra/newview/llviewercontrol.h
@@ -72,8 +72,7 @@ extern LLControlGroup gCrashSettings;
72extern LLString gLastRunVersion; 72extern LLString gLastRunVersion;
73extern LLString gCurrentVersion; 73extern LLString gCurrentVersion;
74 74
75extern char gSettingsFileName[LL_MAX_PATH]; 75extern LLString gSettingsFileName;
76extern char gPerAccountSettingsFileName[LL_MAX_PATH]; 76extern LLString gPerAccountSettingsFileName;
77extern const char *DEFAULT_SETTINGS_FILE;
78 77
79#endif // LL_LLVIEWERCONTROL_H 78#endif // LL_LLVIEWERCONTROL_H
diff --git a/linden/indra/newview/llviewerimage.cpp b/linden/indra/newview/llviewerimage.cpp
index ad1604e..7500ada 100644
--- a/linden/indra/newview/llviewerimage.cpp
+++ b/linden/indra/newview/llviewerimage.cpp
@@ -45,7 +45,6 @@
45#include "llvfs.h" 45#include "llvfs.h"
46#include "message.h" 46#include "message.h"
47#include "lltimer.h" 47#include "lltimer.h"
48//#include "vmath.h" // For frand
49 48
50// viewer includes 49// viewer includes
51#include "llviewerimagelist.h" 50#include "llviewerimagelist.h"
diff --git a/linden/indra/newview/llviewerinventory.cpp b/linden/indra/newview/llviewerinventory.cpp
index 1ed6525..487a9f8 100644
--- a/linden/indra/newview/llviewerinventory.cpp
+++ b/linden/indra/newview/llviewerinventory.cpp
@@ -449,6 +449,7 @@ bool LLViewerInventoryCategory::fetchDescendents()
449 449
450bool LLViewerInventoryCategory::importFileLocal(FILE* fp) 450bool LLViewerInventoryCategory::importFileLocal(FILE* fp)
451{ 451{
452 // *NOTE: This buffer size is hard coded into scanf() below.
452 char buffer[MAX_STRING]; 453 char buffer[MAX_STRING];
453 char keyword[MAX_STRING]; 454 char keyword[MAX_STRING];
454 char valuestr[MAX_STRING]; 455 char valuestr[MAX_STRING];
@@ -458,7 +459,7 @@ bool LLViewerInventoryCategory::importFileLocal(FILE* fp)
458 while(!feof(fp)) 459 while(!feof(fp))
459 { 460 {
460 fgets(buffer, MAX_STRING, fp); 461 fgets(buffer, MAX_STRING, fp);
461 sscanf(buffer, " %s %s", keyword, valuestr); 462 sscanf(buffer, " %254s %254s", keyword, valuestr);
462 if(!keyword) 463 if(!keyword)
463 { 464 {
464 continue; 465 continue;
@@ -491,7 +492,7 @@ bool LLViewerInventoryCategory::importFileLocal(FILE* fp)
491 { 492 {
492 //strcpy(valuestr, buffer + strlen(keyword) + 3); 493 //strcpy(valuestr, buffer + strlen(keyword) + 3);
493 // *NOTE: Not ANSI C, but widely supported. 494 // *NOTE: Not ANSI C, but widely supported.
494 sscanf(buffer, " %s %[^|]", keyword, valuestr); 495 sscanf(buffer, " %254s %254[^|]", keyword, valuestr);
495 mName.assign(valuestr); 496 mName.assign(valuestr);
496 LLString::replaceNonstandardASCII(mName, ' '); 497 LLString::replaceNonstandardASCII(mName, ' ');
497 LLString::replaceChar(mName, '|', ' '); 498 LLString::replaceChar(mName, '|', ' ');
diff --git a/linden/indra/newview/llviewerkeyboard.cpp b/linden/indra/newview/llviewerkeyboard.cpp
index 531cb89..c5ada54 100644
--- a/linden/indra/newview/llviewerkeyboard.cpp
+++ b/linden/indra/newview/llviewerkeyboard.cpp
@@ -704,6 +704,7 @@ S32 LLViewerKeyboard::loadBindings(const char *filename)
704 FILE *fp; 704 FILE *fp;
705 const S32 BUFFER_SIZE = 2048; 705 const S32 BUFFER_SIZE = 2048;
706 char buffer[BUFFER_SIZE]; 706 char buffer[BUFFER_SIZE];
707 // *NOTE: This buffer size is hard coded into scanf() below.
707 char mode_string[MAX_STRING]; 708 char mode_string[MAX_STRING];
708 char key_string[MAX_STRING]; 709 char key_string[MAX_STRING];
709 char mask_string[MAX_STRING]; 710 char mask_string[MAX_STRING];
@@ -733,7 +734,7 @@ S32 LLViewerKeyboard::loadBindings(const char *filename)
733 if (buffer[0] == '#' || buffer[0] == '\n') continue; 734 if (buffer[0] == '#' || buffer[0] == '\n') continue;
734 735
735 // grab the binding strings 736 // grab the binding strings
736 tokens_read = sscanf(buffer, "%s %s %s %s", mode_string, key_string, mask_string, function_string); 737 tokens_read = sscanf(buffer, "%254s %254s %254s %254s", mode_string, key_string, mask_string, function_string);
737 738
738 if (tokens_read == EOF) 739 if (tokens_read == EOF)
739 { 740 {
diff --git a/linden/indra/newview/llviewermenu.cpp b/linden/indra/newview/llviewermenu.cpp
index 921e650..3e5063e 100644
--- a/linden/indra/newview/llviewermenu.cpp
+++ b/linden/indra/newview/llviewermenu.cpp
@@ -3965,6 +3965,7 @@ void force_import_geometry(void*)
3965 child = root->getNextNamedChild()) 3965 child = root->getNextNamedChild())
3966 { 3966 {
3967 // get object data 3967 // get object data
3968 // *NOTE: This buffer size is hard coded into scanf() below.
3968 char name[255]; // Shape 3969 char name[255]; // Shape
3969 char description[255]; // Description 3970 char description[255]; // Description
3970 U32 material; // Material 3971 U32 material; // Material
@@ -3997,9 +3998,9 @@ void force_import_geometry(void*)
3997 child->getAttributeString("PCode", &attribute); 3998 child->getAttributeString("PCode", &attribute);
3998 pcode = atoi(attribute.c_str()); 3999 pcode = atoi(attribute.c_str());
3999 child->getAttributeString("Shape", &attribute); 4000 child->getAttributeString("Shape", &attribute);
4000 sscanf(attribute.c_str(), "%s", name); 4001 sscanf(attribute.c_str(), "%254s", name);
4001 child->getAttributeString("Description", &attribute); 4002 child->getAttributeString("Description", &attribute);
4002 sscanf(attribute.c_str(), "%s", description); 4003 sscanf(attribute.c_str(), "%254s", description);
4003 child->getAttributeString("Material", &attribute); 4004 child->getAttributeString("Material", &attribute);
4004 material = atoi(attribute.c_str()); 4005 material = atoi(attribute.c_str());
4005 child->getAttributeString("Scale", &attribute); 4006 child->getAttributeString("Scale", &attribute);
@@ -4079,6 +4080,7 @@ void force_import_geometry(void*)
4079 // read the faces 4080 // read the faces
4080 U32 facenumber; 4081 U32 facenumber;
4081 LLColor4 color; 4082 LLColor4 color;
4083 // *NOTE: This buffer size is hard coded into scanf() below.
4082 char texture[UUID_STR_LENGTH]; 4084 char texture[UUID_STR_LENGTH];
4083 LLUUID texid; 4085 LLUUID texid;
4084 texid.toString(texture); 4086 texid.toString(texture);
@@ -4089,7 +4091,7 @@ void force_import_geometry(void*)
4089 face->getAttributeString("FaceColor", &attribute); 4091 face->getAttributeString("FaceColor", &attribute);
4090 sscanf(attribute, "%d %f %f %f %f", &facenumber, &color.mV[VX], &color.mV[VY], &color.mV[VZ], &color.mV[VW]); 4092 sscanf(attribute, "%d %f %f %f %f", &facenumber, &color.mV[VX], &color.mV[VY], &color.mV[VZ], &color.mV[VW]);
4091 face->getAttributeString("Face", &attribute); 4093 face->getAttributeString("Face", &attribute);
4092 sscanf(attribute, "%d %f %f %f %f %f %d %s", &facenumber, &sx, &sy, &ox, &oy, &rot, &bump, texture); 4094 sscanf(attribute, "%d %f %f %f %f %f %d %36s", &facenumber, &sx, &sy, &ox, &oy, &rot, &bump, texture);
4093 texid.set(texture); 4095 texid.set(texture);
4094 te.setColor(color); 4096 te.setColor(color);
4095 te.setBumpShinyFullbright(bump); 4097 te.setBumpShinyFullbright(bump);
@@ -5025,7 +5027,7 @@ const char* upload_pick(void* data)
5025 LLFilePicker::ELoadFilter type; 5027 LLFilePicker::ELoadFilter type;
5026 if(data) 5028 if(data)
5027 { 5029 {
5028 type = (LLFilePicker::ELoadFilter)((S32)data); 5030 type = (LLFilePicker::ELoadFilter)((intptr_t)data);
5029 } 5031 }
5030 else 5032 else
5031 { 5033 {
@@ -5506,7 +5508,8 @@ void upload_new_resource(const LLString& src_filename, std::string name,
5506 if (fscanf(in, "LindenResource\nversion %d\n", &version)) 5508 if (fscanf(in, "LindenResource\nversion %d\n", &version))
5507 { 5509 {
5508 if (2 == version) 5510 if (2 == version)
5509 { 5511 {
5512 // *NOTE: This buffer size is hard coded into scanf() below.
5510 char label[MAX_STRING]; 5513 char label[MAX_STRING];
5511 char value[MAX_STRING]; 5514 char value[MAX_STRING];
5512 S32 tokens_read; 5515 S32 tokens_read;
@@ -5514,7 +5517,7 @@ void upload_new_resource(const LLString& src_filename, std::string name,
5514 { 5517 {
5515 label[0] = '\0'; 5518 label[0] = '\0';
5516 value[0] = '\0'; 5519 value[0] = '\0';
5517 tokens_read = sscanf(buf, "%s %s\n", label, value); 5520 tokens_read = sscanf(buf, "%254s %254s\n", label, value);
5518 5521
5519 llinfos << "got: " << label << " = " << value 5522 llinfos << "got: " << label << " = " << value
5520 << llendl; 5523 << llendl;
@@ -5930,7 +5933,7 @@ void handle_export_selected( void * )
5930 5933
5931BOOL menu_check_build_tool( void* user_data ) 5934BOOL menu_check_build_tool( void* user_data )
5932{ 5935{
5933 S32 index = (S32) user_data; 5936 S32 index = (intptr_t) user_data;
5934 return gCurrentToolset->isToolSelected( index ); 5937 return gCurrentToolset->isToolSelected( index );
5935} 5938}
5936 5939
@@ -6223,7 +6226,7 @@ class LLObjectEnableSitOrStand : public view_listener_t
6223 { 6226 {
6224 bool new_value = false; 6227 bool new_value = false;
6225 LLViewerObject* dest_object = NULL; 6228 LLViewerObject* dest_object = NULL;
6226 if(dest_object = gObjectList.findObject(gLastHitObjectID)) 6229 if((dest_object = gObjectList.findObject(gLastHitObjectID)))
6227 { 6230 {
6228 if(dest_object->getPCode() == LL_PCODE_VOLUME) 6231 if(dest_object->getPCode() == LL_PCODE_VOLUME)
6229 { 6232 {
@@ -8075,7 +8078,7 @@ void handle_debug_avatar_textures(void*)
8075 8078
8076void handle_grab_texture(void* data) 8079void handle_grab_texture(void* data)
8077{ 8080{
8078 LLVOAvatar::ETextureIndex index = (LLVOAvatar::ETextureIndex) ((U32) data); 8081 LLVOAvatar::ETextureIndex index = (LLVOAvatar::ETextureIndex)((intptr_t)data);
8079 LLVOAvatar* avatar = gAgent.getAvatarObject(); 8082 LLVOAvatar* avatar = gAgent.getAvatarObject();
8080 if ( avatar ) 8083 if ( avatar )
8081 { 8084 {
@@ -8166,7 +8169,7 @@ void handle_grab_texture(void* data)
8166 8169
8167BOOL enable_grab_texture(void* data) 8170BOOL enable_grab_texture(void* data)
8168{ 8171{
8169 LLVOAvatar::ETextureIndex index = (LLVOAvatar::ETextureIndex) ((U32) data); 8172 LLVOAvatar::ETextureIndex index = (LLVOAvatar::ETextureIndex)((intptr_t)data);
8170 LLVOAvatar* avatar = gAgent.getAvatarObject(); 8173 LLVOAvatar* avatar = gAgent.getAvatarObject();
8171 if ( avatar ) 8174 if ( avatar )
8172 { 8175 {
diff --git a/linden/indra/newview/llviewermessage.cpp b/linden/indra/newview/llviewermessage.cpp
index ba5be0a..124ae13 100644
--- a/linden/indra/newview/llviewermessage.cpp
+++ b/linden/indra/newview/llviewermessage.cpp
@@ -1999,7 +1999,7 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data)
1999 && chatter != gAgent.getAvatarObject()) 1999 && chatter != gAgent.getAvatarObject())
2000 { 2000 {
2001 gAgent.heardChat(chat); 2001 gAgent.heardChat(chat);
2002 if (gLindenLabRandomNumber.llrand(2) == 0) 2002 if (ll_rand(2) == 0)
2003 { 2003 {
2004 gAgent.setLookAt(LOOKAT_TARGET_AUTO_LISTEN, chatter, LLVector3::zero); 2004 gAgent.setLookAt(LOOKAT_TARGET_AUTO_LISTEN, chatter, LLVector3::zero);
2005 } 2005 }
diff --git a/linden/indra/newview/llviewerobject.cpp b/linden/indra/newview/llviewerobject.cpp
index d034aa7..40930e6 100644
--- a/linden/indra/newview/llviewerobject.cpp
+++ b/linden/indra/newview/llviewerobject.cpp
@@ -2396,6 +2396,7 @@ void LLViewerObject::loadTaskInvFile(const char* filename)
2396 if(ifs.good()) 2396 if(ifs.good())
2397 { 2397 {
2398 char buffer[MAX_STRING]; 2398 char buffer[MAX_STRING];
2399 // *NOTE: This buffer size is hard coded into scanf() below.
2399 char keyword[MAX_STRING]; 2400 char keyword[MAX_STRING];
2400 if(mInventory) 2401 if(mInventory)
2401 { 2402 {
@@ -2408,7 +2409,7 @@ void LLViewerObject::loadTaskInvFile(const char* filename)
2408 while(ifs.good()) 2409 while(ifs.good())
2409 { 2410 {
2410 ifs.getline(buffer, MAX_STRING); 2411 ifs.getline(buffer, MAX_STRING);
2411 sscanf(buffer, " %s", keyword); 2412 sscanf(buffer, " %254s", keyword);
2412 if(0 == strcmp("inv_item", keyword)) 2413 if(0 == strcmp("inv_item", keyword))
2413 { 2414 {
2414 LLPointer<LLInventoryObject> inv = new LLViewerInventoryItem; 2415 LLPointer<LLInventoryObject> inv = new LLViewerInventoryItem;
diff --git a/linden/indra/newview/llviewerpartsim.cpp b/linden/indra/newview/llviewerpartsim.cpp
index 1175553..be2c90f 100644
--- a/linden/indra/newview/llviewerpartsim.cpp
+++ b/linden/indra/newview/llviewerpartsim.cpp
@@ -418,7 +418,7 @@ BOOL LLViewerPartSim::shouldAddPart()
418 F32 frac = (F32)sParticleCount/(F32)sMaxParticleCount; 418 F32 frac = (F32)sParticleCount/(F32)sMaxParticleCount;
419 frac -= 0.75; 419 frac -= 0.75;
420 frac *= 3.f; 420 frac *= 3.f;
421 if (frand(1.f) < frac) 421 if (ll_frand() < frac)
422 { 422 {
423 // Skip... 423 // Skip...
424 return FALSE; 424 return FALSE;
@@ -549,9 +549,9 @@ void LLViewerPartSim::updateSimulation()
549 // pain. 549 // pain.
550 S32 i; 550 S32 i;
551 S32 count = mViewerPartSources.count(); 551 S32 count = mViewerPartSources.count();
552 S32 start = (S32)frand((F32)count); 552 S32 start = (S32)ll_frand((F32)count);
553 S32 dir = 1; 553 S32 dir = 1;
554 if (frand(1.0) > 0.5f) 554 if (ll_frand() > 0.5f)
555 { 555 {
556 dir = -1; 556 dir = -1;
557 } 557 }
diff --git a/linden/indra/newview/llviewerpartsource.cpp b/linden/indra/newview/llviewerpartsource.cpp
index ceb6761..39869e2 100644
--- a/linden/indra/newview/llviewerpartsource.cpp
+++ b/linden/indra/newview/llviewerpartsource.cpp
@@ -213,9 +213,9 @@ void LLViewerPartSourceScript::update(const F32 dt)
213 F32 mvs; 213 F32 mvs;
214 do 214 do
215 { 215 {
216 part_dir_vector.mV[VX] = frand(2.f) - 1.f; 216 part_dir_vector.mV[VX] = ll_frand(2.f) - 1.f;
217 part_dir_vector.mV[VY] = frand(2.f) - 1.f; 217 part_dir_vector.mV[VY] = ll_frand(2.f) - 1.f;
218 part_dir_vector.mV[VZ] = frand(2.f) - 1.f; 218 part_dir_vector.mV[VZ] = ll_frand(2.f) - 1.f;
219 mvs = part_dir_vector.magVecSquared(); 219 mvs = part_dir_vector.magVecSquared();
220 } 220 }
221 while ((mvs > 1.f) || (mvs < 0.01f)); 221 while ((mvs > 1.f) || (mvs < 0.01f));
@@ -223,7 +223,7 @@ void LLViewerPartSourceScript::update(const F32 dt)
223 part_dir_vector.normVec(); 223 part_dir_vector.normVec();
224 part.mPosAgent += mPartSysData.mBurstRadius*part_dir_vector; 224 part.mPosAgent += mPartSysData.mBurstRadius*part_dir_vector;
225 part.mVelocity = part_dir_vector; 225 part.mVelocity = part_dir_vector;
226 F32 speed = mPartSysData.mBurstSpeedMin + frand(mPartSysData.mBurstSpeedMax - mPartSysData.mBurstSpeedMin); 226 F32 speed = mPartSysData.mBurstSpeedMin + ll_frand(mPartSysData.mBurstSpeedMax - mPartSysData.mBurstSpeedMin);
227 part.mVelocity *= speed; 227 part.mVelocity *= speed;
228 } 228 }
229 else if (mPartSysData.mPattern & LLPartSysData::LL_PART_SRC_PATTERN_ANGLE 229 else if (mPartSysData.mPattern & LLPartSysData::LL_PART_SRC_PATTERN_ANGLE
@@ -242,10 +242,10 @@ void LLViewerPartSourceScript::update(const F32 dt)
242 F32 outerAngle = mPartSysData.mOuterAngle; 242 F32 outerAngle = mPartSysData.mOuterAngle;
243 243
244 // generate a random angle within the given space... 244 // generate a random angle within the given space...
245 F32 angle = innerAngle + frand(outerAngle - innerAngle); 245 F32 angle = innerAngle + ll_frand(outerAngle - innerAngle);
246 246
247 // split which side it will go on randomly... 247 // split which side it will go on randomly...
248 if (frand(1.0) < 0.5) 248 if (ll_frand() < 0.5)
249 { 249 {
250 angle = -angle; 250 angle = -angle;
251 } 251 }
@@ -256,7 +256,7 @@ void LLViewerPartSourceScript::update(const F32 dt)
256 // If this is a cone pattern, rotate again to create the cone. 256 // If this is a cone pattern, rotate again to create the cone.
257 if (mPartSysData.mPattern & LLPartSysData::LL_PART_SRC_PATTERN_ANGLE_CONE) 257 if (mPartSysData.mPattern & LLPartSysData::LL_PART_SRC_PATTERN_ANGLE_CONE)
258 { 258 {
259 part_dir_vector.rotVec(frand(4*F_PI), 0.0, 0.0, 1.0); 259 part_dir_vector.rotVec(ll_frand(4*F_PI), 0.0, 0.0, 1.0);
260 } 260 }
261 261
262 // Only apply this rotation if using the deprecated angles. 262 // Only apply this rotation if using the deprecated angles.
@@ -276,7 +276,7 @@ void LLViewerPartSourceScript::update(const F32 dt)
276 276
277 part.mVelocity = part_dir_vector; 277 part.mVelocity = part_dir_vector;
278 278
279 F32 speed = mPartSysData.mBurstSpeedMin + frand(mPartSysData.mBurstSpeedMax - mPartSysData.mBurstSpeedMin); 279 F32 speed = mPartSysData.mBurstSpeedMin + ll_frand(mPartSysData.mBurstSpeedMax - mPartSysData.mBurstSpeedMin);
280 part.mVelocity *= speed; 280 part.mVelocity *= speed;
281 } 281 }
282 else 282 else
@@ -459,7 +459,7 @@ void LLViewerPartSourceSpiral::update(const F32 dt)
459 part.mLastUpdateTime = 0.f; 459 part.mLastUpdateTime = 0.f;
460 part.mScale.mV[0] = 0.25f; 460 part.mScale.mV[0] = 0.25f;
461 part.mScale.mV[1] = 0.25f; 461 part.mScale.mV[1] = 0.25f;
462 part.mParameter = frand(F_TWO_PI); 462 part.mParameter = ll_frand(F_TWO_PI);
463 463
464 gWorldPointer->mPartSim.addPart(part); 464 gWorldPointer->mPartSim.addPart(part);
465 } 465 }
@@ -720,7 +720,7 @@ void LLViewerPartSourceChat::update(const F32 dt)
720 part.mLastUpdateTime = 0.f; 720 part.mLastUpdateTime = 0.f;
721 part.mScale.mV[0] = 0.25f; 721 part.mScale.mV[0] = 0.25f;
722 part.mScale.mV[1] = 0.25f; 722 part.mScale.mV[1] = 0.25f;
723 part.mParameter = frand(F_TWO_PI); 723 part.mParameter = ll_frand(F_TWO_PI);
724 724
725 gWorldPointer->mPartSim.addPart(part); 725 gWorldPointer->mPartSim.addPart(part);
726 } 726 }
diff --git a/linden/indra/newview/llviewerstats.cpp b/linden/indra/newview/llviewerstats.cpp
index e1e783c..e04918e 100644
--- a/linden/indra/newview/llviewerstats.cpp
+++ b/linden/indra/newview/llviewerstats.cpp
@@ -57,8 +57,8 @@ public:
57 57
58const StatAttributes STAT_INFO[LLViewerStats::ST_COUNT] = 58const StatAttributes STAT_INFO[LLViewerStats::ST_COUNT] =
59{ 59{
60 // ST_MOUSELOOK_SECONDS 60 // ST_VERSION
61 StatAttributes("Seconds in Mouselook", FALSE, TRUE), 61 StatAttributes("Version", TRUE, FALSE),
62 // ST_AVATAR_EDIT_SECONDS 62 // ST_AVATAR_EDIT_SECONDS
63 StatAttributes("Seconds in Edit Appearence", FALSE, TRUE), 63 StatAttributes("Seconds in Edit Appearence", FALSE, TRUE),
64 // ST_TOOLBOX_SECONDS 64 // ST_TOOLBOX_SECONDS
@@ -77,10 +77,10 @@ const StatAttributes STAT_INFO[LLViewerStats::ST_COUNT] =
77 StatAttributes("Object rez count", FALSE, FALSE), 77 StatAttributes("Object rez count", FALSE, FALSE),
78 // ST_FPS_10_SECONDS 78 // ST_FPS_10_SECONDS
79 StatAttributes("Seconds below 10 FPS", FALSE, TRUE), 79 StatAttributes("Seconds below 10 FPS", FALSE, TRUE),
80 // ST_FPS_5_SECONDS
81 StatAttributes("Seconds below 5 FPS", FALSE, TRUE),
82 // ST_FPS_2_SECONDS 80 // ST_FPS_2_SECONDS
83 StatAttributes("Seconds below 2 FPS", FALSE, TRUE), 81 StatAttributes("Seconds below 2 FPS", FALSE, TRUE),
82 // ST_MOUSELOOK_SECONDS
83 StatAttributes("Seconds in Mouselook", FALSE, TRUE),
84 // ST_FLY_COUNT 84 // ST_FLY_COUNT
85 StatAttributes("Fly count", FALSE, FALSE), 85 StatAttributes("Fly count", FALSE, FALSE),
86 // ST_TELEPORT_COUNT 86 // ST_TELEPORT_COUNT
@@ -248,10 +248,6 @@ void LLViewerStats::updateFrameStats(const F64 time_diff)
248 { 248 {
249 incStat(LLViewerStats::ST_FPS_2_SECONDS, time_diff); 249 incStat(LLViewerStats::ST_FPS_2_SECONDS, time_diff);
250 } 250 }
251 if (time_diff >= 0.2)
252 {
253 incStat(LLViewerStats::ST_FPS_5_SECONDS, time_diff);
254 }
255 if (time_diff >= 0.125) 251 if (time_diff >= 0.125)
256 { 252 {
257 incStat(LLViewerStats::ST_FPS_8_SECONDS, time_diff); 253 incStat(LLViewerStats::ST_FPS_8_SECONDS, time_diff);
diff --git a/linden/indra/newview/llviewerstats.h b/linden/indra/newview/llviewerstats.h
index 9b446ec..a3eb4c1 100644
--- a/linden/indra/newview/llviewerstats.h
+++ b/linden/indra/newview/llviewerstats.h
@@ -98,7 +98,7 @@ public:
98 // in statTypeToText in llviewerstats.cpp 98 // in statTypeToText in llviewerstats.cpp
99 enum EStatType 99 enum EStatType
100 { 100 {
101 ST_MOUSELOOK_SECONDS = 0, 101 ST_VERSION = 0,
102 ST_AVATAR_EDIT_SECONDS = 1, 102 ST_AVATAR_EDIT_SECONDS = 1,
103 ST_TOOLBOX_SECONDS = 2, 103 ST_TOOLBOX_SECONDS = 2,
104 ST_CHAT_COUNT = 3, 104 ST_CHAT_COUNT = 3,
@@ -108,8 +108,8 @@ public:
108 ST_CREATE_COUNT = 7, 108 ST_CREATE_COUNT = 7,
109 ST_REZ_COUNT = 8, 109 ST_REZ_COUNT = 8,
110 ST_FPS_10_SECONDS = 9, 110 ST_FPS_10_SECONDS = 9,
111 ST_FPS_5_SECONDS = 10, 111 ST_FPS_2_SECONDS = 10,
112 ST_FPS_2_SECONDS = 11, 112 ST_MOUSELOOK_SECONDS = 11,
113 ST_FLY_COUNT = 12, 113 ST_FLY_COUNT = 12,
114 ST_TELEPORT_COUNT = 13, 114 ST_TELEPORT_COUNT = 13,
115 ST_OBJECT_DELETE_COUNT = 14, 115 ST_OBJECT_DELETE_COUNT = 14,
diff --git a/linden/indra/newview/llvoavatar.cpp b/linden/indra/newview/llvoavatar.cpp
index 3d4f1c0..ece24e0 100644
--- a/linden/indra/newview/llvoavatar.cpp
+++ b/linden/indra/newview/llvoavatar.cpp
@@ -2382,7 +2382,7 @@ BOOL LLVOAvatar::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time)
2382 static const F32 UPDATE_TIME = .5f; 2382 static const F32 UPDATE_TIME = .5f;
2383 if (mUpdateLODTimer.hasExpired()) 2383 if (mUpdateLODTimer.hasExpired())
2384 { 2384 {
2385 mUpdateLODTimer.setTimerExpirySec(UPDATE_TIME * (.75f + frand(0.5f))); 2385 mUpdateLODTimer.setTimerExpirySec(UPDATE_TIME * (.75f + ll_frand(0.5f)));
2386 updateJointLODs(); 2386 updateJointLODs();
2387 } 2387 }
2388 2388
diff --git a/linden/indra/newview/llvograss.cpp b/linden/indra/newview/llvograss.cpp
index 048ae61..58e5378 100644
--- a/linden/indra/newview/llvograss.cpp
+++ b/linden/indra/newview/llvograss.cpp
@@ -229,26 +229,26 @@ void LLVOGrass::initClass()
229 { 229 {
230 if (1) //(i%2 == 0) Uncomment for X blading 230 if (1) //(i%2 == 0) Uncomment for X blading
231 { 231 {
232 F32 u = sqrt(-2.0f * log(frand(1.0))); 232 F32 u = sqrt(-2.0f * log(ll_frand()));
233 F32 v = 2.0f * F_PI * frand(1.0); 233 F32 v = 2.0f * F_PI * ll_frand();
234 234
235 x = u * sin(v) * GRASS_DISTRIBUTION_SD; 235 x = u * sin(v) * GRASS_DISTRIBUTION_SD;
236 y = u * cos(v) * GRASS_DISTRIBUTION_SD; 236 y = u * cos(v) * GRASS_DISTRIBUTION_SD;
237 237
238 rot = frand(F_PI); 238 rot = ll_frand(F_PI);
239 } 239 }
240 else 240 else
241 { 241 {
242 rot += (F_PI*0.4f + frand(0.2f*F_PI)); 242 rot += (F_PI*0.4f + ll_frand(0.2f*F_PI));
243 } 243 }
244 244
245 exp_x[i] = x; 245 exp_x[i] = x;
246 exp_y[i] = y; 246 exp_y[i] = y;
247 rot_x[i] = sin(rot); 247 rot_x[i] = sin(rot);
248 rot_y[i] = cos(rot); 248 rot_y[i] = cos(rot);
249 dz_x[i] = frand(GRASS_BLADE_BASE * 0.25f); 249 dz_x[i] = ll_frand(GRASS_BLADE_BASE * 0.25f);
250 dz_y[i] = frand(GRASS_BLADE_BASE * 0.25f); 250 dz_y[i] = ll_frand(GRASS_BLADE_BASE * 0.25f);
251 w_mod[i] = 0.5f + frand(1.f); // Degree to which blade is moved by wind 251 w_mod[i] = 0.5f + ll_frand(); // Degree to which blade is moved by wind
252 252
253 } 253 }
254} 254}
diff --git a/linden/indra/newview/llvopart.cpp b/linden/indra/newview/llvopart.cpp
index 5e471be..6b38cf9 100644
--- a/linden/indra/newview/llvopart.cpp
+++ b/linden/indra/newview/llvopart.cpp
@@ -654,7 +654,7 @@ void LLVOPart::setParticleCountdownStateWaitingDead(const U32 particleNumber)
654 654
655 frequency = mSpawnFrequency; 655 frequency = mSpawnFrequency;
656 // **** Hack! remainingLifetime counts up from negative, to avoid subtracts! - djs 656 // **** Hack! remainingLifetime counts up from negative, to avoid subtracts! - djs
657 mParticleState[particleNumber].remainingLifetime = -(((mSpawnFrequencyRange * 2.0f)*frand(1.f)) + frequency - mSpawnFrequencyRange); 657 mParticleState[particleNumber].remainingLifetime = -(((mSpawnFrequencyRange * 2.0f)*ll_frand()) + frequency - mSpawnFrequencyRange);
658} 658}
659 659
660//Can override later 660//Can override later
@@ -672,9 +672,9 @@ void LLVOPart::spawnParticle(const U32 particleNumber)
672 mDeadArr[particleNumber] = 0; // not dead yet! 672 mDeadArr[particleNumber] = 0; // not dead yet!
673 673
674 //j = pos_offset_i(particleNumber); 674 //j = pos_offset_i(particleNumber);
675 mParticleState[particleNumber].position[0] = 2.f*mSpawnRange*(frand(1.f)) - mSpawnRange; 675 mParticleState[particleNumber].position[0] = 2.f*mSpawnRange*(ll_frand()) - mSpawnRange;
676 mParticleState[particleNumber].position[1] = 2.f*mSpawnRange*(frand(1.f)) - mSpawnRange; 676 mParticleState[particleNumber].position[1] = 2.f*mSpawnRange*(ll_frand()) - mSpawnRange;
677 mParticleState[particleNumber].position[2] = 2.f*mSpawnRange*(frand(1.f)) - mSpawnRange; 677 mParticleState[particleNumber].position[2] = 2.f*mSpawnRange*(ll_frand()) - mSpawnRange;
678 678
679 //mParticleStateArray[j] = (pos_ranges[1] - pos_ranges[0])*(F32)rand()/((F32)RAND_MAX) + pos_ranges[0]; 679 //mParticleStateArray[j] = (pos_ranges[1] - pos_ranges[0])*(F32)rand()/((F32)RAND_MAX) + pos_ranges[0];
680 //j++; 680 //j++;
@@ -687,12 +687,12 @@ void LLVOPart::spawnParticle(const U32 particleNumber)
687 //Create the ranged direction vector first - then rotate by the actual direction and then scale 687 //Create the ranged direction vector first - then rotate by the actual direction and then scale
688 //Creating a random value about 1,0,0 688 //Creating a random value about 1,0,0
689 //1. pick a random angle YZ orientation through full circle. 689 //1. pick a random angle YZ orientation through full circle.
690 randomUnitValue = (frand(1.f)); 690 randomUnitValue = (ll_frand());
691 direction.mV[VY] = sinf(randomUnitValue * 2.0 * F_PI); 691 direction.mV[VY] = sinf(randomUnitValue * 2.0 * F_PI);
692 direction.mV[VZ] = cosf(randomUnitValue * 2.0 * F_PI); 692 direction.mV[VZ] = cosf(randomUnitValue * 2.0 * F_PI);
693 693
694 //2. pick a rotation to this angle to project into z which is scaled by mSpawnDirectionRange 694 //2. pick a rotation to this angle to project into z which is scaled by mSpawnDirectionRange
695 randomUnitValue = (frand(1.f)); 695 randomUnitValue = (ll_frand());
696 randomUnitValue *= mSpawnDirectionRange; 696 randomUnitValue *= mSpawnDirectionRange;
697 direction.mV[VY] = direction.mV[VY] * sinf(randomUnitValue * F_PI); 697 direction.mV[VY] = direction.mV[VY] * sinf(randomUnitValue * F_PI);
698 direction.mV[VZ] = direction.mV[VZ] * sinf(randomUnitValue * F_PI); 698 direction.mV[VZ] = direction.mV[VZ] * sinf(randomUnitValue * F_PI);
@@ -804,7 +804,7 @@ void LLVOPart::spawnParticle(const U32 particleNumber)
804 804
805 805
806 //4. scale the vector by a random scale by mSpawnVelocityRange and offset by mSpawnVelocity 806 //4. scale the vector by a random scale by mSpawnVelocityRange and offset by mSpawnVelocity
807 randomUnitValue = (frand(1.f)); 807 randomUnitValue = (ll_frand());
808 randomUnitValue = (randomUnitValue * mSpawnVelocityRange) + mSpawnVelocity; 808 randomUnitValue = (randomUnitValue * mSpawnVelocityRange) + mSpawnVelocity;
809 809
810 mParticleState[particleNumber].velocity[0] = direction.mV[VX] * randomUnitValue; 810 mParticleState[particleNumber].velocity[0] = direction.mV[VX] * randomUnitValue;
@@ -822,16 +822,16 @@ void LLVOPart::spawnParticle(const U32 particleNumber)
822 822
823 mParticleState[particleNumber].acceleration[2] = 0.0f; 823 mParticleState[particleNumber].acceleration[2] = 0.0f;
824 824
825 mParticleState[particleNumber].scale[0] = (mScale_range[1] - mScale_range[0])*frand(1.f) + mScale_range[0]; 825 mParticleState[particleNumber].scale[0] = (mScale_range[1] - mScale_range[0])*ll_frand() + mScale_range[0];
826 mParticleState[particleNumber].scale[1] = (mScale_range[3] - mScale_range[2])*frand(1.f) + mScale_range[2]; 826 mParticleState[particleNumber].scale[1] = (mScale_range[3] - mScale_range[2])*ll_frand() + mScale_range[2];
827 mParticleState[particleNumber].scale[2] = 0.0f; 827 mParticleState[particleNumber].scale[2] = 0.0f;
828 828
829 mParticleState[particleNumber].alpha[0] = (mAlpha_range[1] - mAlpha_range[0])*frand(1.f) + mAlpha_range[0]; 829 mParticleState[particleNumber].alpha[0] = (mAlpha_range[1] - mAlpha_range[0])*ll_frand() + mAlpha_range[0];
830 mParticleState[particleNumber].alpha[1] = (mAlpha_range[3] - mAlpha_range[2])*frand(1.f) + mAlpha_range[2]; 830 mParticleState[particleNumber].alpha[1] = (mAlpha_range[3] - mAlpha_range[2])*ll_frand() + mAlpha_range[2];
831 mParticleState[particleNumber].alpha[2] = 0.0f; 831 mParticleState[particleNumber].alpha[2] = 0.0f;
832 832
833 // **** Hack! remainingLifetime counts up from negative, to avoid subtracts! - djs 833 // **** Hack! remainingLifetime counts up from negative, to avoid subtracts! - djs
834 mParticleState[particleNumber].remainingLifetime = -((mIndividualLifetimeRange*2.0f)*frand(1.f) + mIndividualLifetime - mIndividualLifetimeRange); 834 mParticleState[particleNumber].remainingLifetime = -((mIndividualLifetimeRange*2.0f)*ll_frand() + mIndividualLifetime - mIndividualLifetimeRange);
835 835
836 //rest of the state - 0 for now 836 //rest of the state - 0 for now
837 mParticleState[particleNumber].deathOffset = 0.0f; 837 mParticleState[particleNumber].deathOffset = 0.0f;
diff --git a/linden/indra/newview/llvopartgroup.cpp b/linden/indra/newview/llvopartgroup.cpp
index 10a765d..150f5cd 100644
--- a/linden/indra/newview/llvopartgroup.cpp
+++ b/linden/indra/newview/llvopartgroup.cpp
@@ -53,7 +53,7 @@ LLVOPartGroup::LLVOPartGroup(const LLUUID &id, const LLPCode pcode, LLViewerRegi
53 setNumTEs(1); 53 setNumTEs(1);
54 setTETexture(0, LLUUID::null); 54 setTETexture(0, LLUUID::null);
55 mbCanSelect = FALSE; // users can't select particle systems 55 mbCanSelect = FALSE; // users can't select particle systems
56 mDebugColor = LLColor4(frand(1.f), frand(1.f), frand(1.f), 1.f); 56 mDebugColor = LLColor4(ll_frand(), ll_frand(), ll_frand(), 1.f);
57} 57}
58 58
59 59
diff --git a/linden/indra/newview/llvosky.cpp b/linden/indra/newview/llvosky.cpp
index 927b784..559e846 100644
--- a/linden/indra/newview/llvosky.cpp
+++ b/linden/indra/newview/llvosky.cpp
@@ -664,20 +664,18 @@ void LLVOSky::restoreGL()
664 664
665void LLVOSky::updateHaze() 665void LLVOSky::updateHaze()
666{ 666{
667 time_t timer; 667 static LLRandLagFib607 weather_generator(LLUUID::getRandomSeed());
668 time(&timer);
669 static LLRand WeatherRandomNumber(gmtime(&timer)->tm_mday);
670 if (gSavedSettings.getBOOL("FixedWeather")) 668 if (gSavedSettings.getBOOL("FixedWeather"))
671 { 669 {
672 WeatherRandomNumber.seed(8008135); 670 weather_generator.seed(8008135);
673 } 671 }
674 672
675 const F32 fo_upper_bound = 5; 673 const F32 fo_upper_bound = 5;
676 const F32 sca_upper_bound = 6; 674 const F32 sca_upper_bound = 6;
677 const F32 fo = 1 + WeatherRandomNumber.llfrand(fo_upper_bound - 1); 675 const F32 fo = 1 + (F32)weather_generator() *(fo_upper_bound - 1);
678 const static F32 upper = 0.5f / gFastLn.ln(fo_upper_bound); 676 const static F32 upper = 0.5f / gFastLn.ln(fo_upper_bound);
679 mHaze.setFalloff(fo); 677 mHaze.setFalloff(fo);
680 mHaze.setG(WeatherRandomNumber.llfrand(0.0f + upper * gFastLn.ln(fo))); 678 mHaze.setG((F32)weather_generator() * (0.0f + upper * gFastLn.ln(fo)));
681 LLColor3 sca; 679 LLColor3 sca;
682 const F32 cd = mCloudDensity * 3; 680 const F32 cd = mCloudDensity * 3;
683 F32 min_r = cd - 1; 681 F32 min_r = cd - 1;
@@ -691,7 +689,7 @@ void LLVOSky::updateHaze()
691 max_r = sca_upper_bound; 689 max_r = sca_upper_bound;
692 } 690 }
693 691
694 sca.mV[0] = min_r + WeatherRandomNumber.llfrand(max_r - min_r);//frand(6); 692 sca.mV[0] = min_r + (F32)weather_generator() * (max_r - min_r);
695 693
696 min_r = sca.mV[0] - 0.1f; 694 min_r = sca.mV[0] - 0.1f;
697 if (min_r < 0) 695 if (min_r < 0)
@@ -704,7 +702,7 @@ void LLVOSky::updateHaze()
704 max_r = sca_upper_bound; 702 max_r = sca_upper_bound;
705 } 703 }
706 704
707 sca.mV[1] = min_r + WeatherRandomNumber.llfrand(max_r - min_r); 705 sca.mV[1] = min_r + (F32)weather_generator() * (max_r - min_r);
708 706
709 min_r = sca.mV[1]; 707 min_r = sca.mV[1];
710 if (min_r < 0) 708 if (min_r < 0)
@@ -717,7 +715,7 @@ void LLVOSky::updateHaze()
717 max_r = sca_upper_bound; 715 max_r = sca_upper_bound;
718 } 716 }
719 717
720 sca.mV[2] = min_r + WeatherRandomNumber.llfrand(max_r - min_r); 718 sca.mV[2] = min_r + (F32)weather_generator() * (max_r - min_r);
721 719
722 sca = AIR_SCA_AVG * sca; 720 sca = AIR_SCA_AVG * sca;
723 721
diff --git a/linden/indra/newview/llvostars.cpp b/linden/indra/newview/llvostars.cpp
index d20c5da..3fd3b91 100644
--- a/linden/indra/newview/llvostars.cpp
+++ b/linden/indra/newview/llvostars.cpp
@@ -125,19 +125,19 @@ void LLVOStars::initStars()
125 U32 i; 125 U32 i;
126 for (i = 0; i < NUMBER_OF_STARS; i++ ) 126 for (i = 0; i < NUMBER_OF_STARS; i++ )
127 { 127 {
128 v_p->mV[VX] = frand(1.f) - 0.5f; 128 v_p->mV[VX] = ll_frand() - 0.5f;
129 v_p->mV[VY] = frand(1.f) - 0.5f; 129 v_p->mV[VY] = ll_frand() - 0.5f;
130 130
131 // we only want stars on the top half of the dome! 131 // we only want stars on the top half of the dome!
132 132
133 v_p->mV[VZ] = frand(1.f)/2.f; 133 v_p->mV[VZ] = ll_frand()/2.f;
134 134
135 v_p->normVec(); 135 v_p->normVec();
136 *v_p *= DISTANCE_TO_STARS; 136 *v_p *= DISTANCE_TO_STARS;
137 *v_i = llmin((F32)pow(frand(1.f),2.f) + 0.1f, 1.f); 137 *v_i = llmin((F32)pow(ll_frand(),2.f) + 0.1f, 1.f);
138 v_c->mV[VRED] = 0.75f + frand(1.f) * 0.25f ; 138 v_c->mV[VRED] = 0.75f + ll_frand() * 0.25f ;
139 v_c->mV[VGREEN] = 1.f ; 139 v_c->mV[VGREEN] = 1.f ;
140 v_c->mV[VBLUE] = 0.75f + frand(1.f) * 0.25f ; 140 v_c->mV[VBLUE] = 0.75f + ll_frand() * 0.25f ;
141 v_c->mV[VALPHA] = 1.f; 141 v_c->mV[VALPHA] = 1.f;
142 v_c->clamp(); 142 v_c->clamp();
143 v_p++; 143 v_p++;
@@ -179,7 +179,7 @@ void LLVOStars::updateStarColors()
179 sundir_factor = (1 - how_close_to_sun) / sunclose_range; 179 sundir_factor = (1 - how_close_to_sun) / sunclose_range;
180 } 180 }
181 intensity = *(v_i); 181 intensity = *(v_i);
182 F32 alpha = v_c->mV[VALPHA] + (frand(1.f) - 0.5f) * var * intensity; 182 F32 alpha = v_c->mV[VALPHA] + (ll_frand() - 0.5f) * var * intensity;
183 if (alpha < min * intensity) 183 if (alpha < min * intensity)
184 { 184 {
185 alpha = min * intensity; 185 alpha = min * intensity;
diff --git a/linden/indra/newview/llvotreenew.cpp b/linden/indra/newview/llvotreenew.cpp
index 40b0c58..d7fc635 100644
--- a/linden/indra/newview/llvotreenew.cpp
+++ b/linden/indra/newview/llvotreenew.cpp
@@ -138,9 +138,9 @@ void LLVOTreeNew::initClass()
138 //LLVOTreeNew::sParameters = LLTreeParams(); 138 //LLVOTreeNew::sParameters = LLTreeParams();
139 139
140 // initialize an array of random numbers that we'll be using 140 // initialize an array of random numbers that we'll be using
141 gLindenLabRandomNumber.seed(0); 141 LLRandLagFib607 tree_rand;
142 for (i = 0; i < MAX_RAND_NUMS; i++) 142 for (i = 0; i < MAX_RAND_NUMS; i++)
143 sRandNums[i] = gLindenLabRandomNumber.llfrand(1.0); 143 sRandNums[i] = (F32)tree_rand();
144} 144}
145 145
146/* 146/*
@@ -959,7 +959,8 @@ void LLVOTreeNew::drawTree(LLDrawPool &draw_pool)
959 U8 i, j; 959 U8 i, j;
960 960
961 // seed the drawtree thing with the object's uuid to make it original but predictable... 961 // seed the drawtree thing with the object's uuid to make it original but predictable...
962 gLindenLabRandomNumber.seed(0); 962 // don't re-seed the process random number generator. bad.
963 //gLindenLabRandomNumber.seed(0);
963 964
964 // reset the rand offsets 965 // reset the rand offsets
965 for (i = 0; i < MAX_LEVELS; i++) mRandOffset[i] = 0; 966 for (i = 0; i < MAX_LEVELS; i++) mRandOffset[i] = 0;
diff --git a/linden/indra/newview/llvotreenew.h b/linden/indra/newview/llvotreenew.h
index 058bd19..936028a 100644
--- a/linden/indra/newview/llvotreenew.h
+++ b/linden/indra/newview/llvotreenew.h
@@ -78,7 +78,7 @@ public:
78 // return +- negPos 78 // return +- negPos
79 static S32 llrand_signed(S32 negPos) 79 static S32 llrand_signed(S32 negPos)
80 { 80 {
81 return (gLindenLabRandomNumber.llrand((U32)negPos * 2) - negPos); 81 return (ll_rand((U32)negPos * 2) - negPos);
82 }; 82 };
83 83
84 static S32 llrand_signed(S32 negPos, U32 index) 84 static S32 llrand_signed(S32 negPos, U32 index)
@@ -94,7 +94,7 @@ public:
94 // return +- negPos 94 // return +- negPos
95 static F32 llfrand_signed(F32 negPos) 95 static F32 llfrand_signed(F32 negPos)
96 { 96 {
97 return (gLindenLabRandomNumber.llfrand(negPos * 2.0f) - negPos); 97 return (ll_frand(negPos * 2.0f) - negPos);
98 }; 98 };
99 99
100 static F32 llfrand_signed(F32 negPos, U32 index) 100 static F32 llfrand_signed(F32 negPos, U32 index)
@@ -110,7 +110,7 @@ public:
110 // return between 0-pos 110 // return between 0-pos
111 static F32 llfrand_unsigned(F32 pos) 111 static F32 llfrand_unsigned(F32 pos)
112 { 112 {
113 return gLindenLabRandomNumber.llfrand(pos); 113 return ll_frand(pos);
114 }; 114 };
115 115
116 static void cleanupTextures() {}; // not needed anymore 116 static void cleanupTextures() {}; // not needed anymore
diff --git a/linden/indra/newview/llwearable.cpp b/linden/indra/newview/llwearable.cpp
index 62a1d20..310eae5 100644
--- a/linden/indra/newview/llwearable.cpp
+++ b/linden/indra/newview/llwearable.cpp
@@ -265,6 +265,9 @@ BOOL LLWearable::exportFile( FILE* file )
265 265
266BOOL LLWearable::importFile( FILE* file ) 266BOOL LLWearable::importFile( FILE* file )
267{ 267{
268 // *NOTE: changing the type or size of this buffer will require
269 // changes in the fscanf() code below. You would be better off
270 // rewriting this to use streams and not require an open FILE.
268 char text_buffer[2048]; 271 char text_buffer[2048];
269 S32 fields_read = 0; 272 S32 fields_read = 0;
270 273
@@ -295,7 +298,7 @@ BOOL LLWearable::importFile( FILE* file )
295 else 298 else
296 { 299 {
297 ungetc( next_char, file ); 300 ungetc( next_char, file );
298 fields_read = fscanf( file, "%[^\n]", text_buffer ); 301 fields_read = fscanf( file, "%2047[^\n]", text_buffer );
299 if( (1 != fields_read) || (fgetc( file ) != '\n') ) 302 if( (1 != fields_read) || (fgetc( file ) != '\n') )
300 { 303 {
301 llwarns << "Bad Wearable asset: early end of file" << llendl; 304 llwarns << "Bad Wearable asset: early end of file" << llendl;
@@ -315,7 +318,7 @@ BOOL LLWearable::importFile( FILE* file )
315 else 318 else
316 { 319 {
317 ungetc( next_char, file ); 320 ungetc( next_char, file );
318 fields_read = fscanf( file, "%[^\n]", text_buffer ); 321 fields_read = fscanf( file, "%2047[^\n]", text_buffer );
319 if( (1 != fields_read) || (fgetc( file ) != '\n') ) 322 if( (1 != fields_read) || (fgetc( file ) != '\n') )
320 { 323 {
321 llwarns << "Bad Wearable asset: early end of file" << llendl; 324 llwarns << "Bad Wearable asset: early end of file" << llendl;
@@ -422,7 +425,7 @@ BOOL LLWearable::importFile( FILE* file )
422 for( i = 0; i < num_textures; i++ ) 425 for( i = 0; i < num_textures; i++ )
423 { 426 {
424 S32 te = 0; 427 S32 te = 0;
425 fields_read = fscanf( file, "%d %s\n", &te, text_buffer); 428 fields_read = fscanf( file, "%d %2047s\n", &te, text_buffer);
426 if( fields_read != 2 ) 429 if( fields_read != 2 )
427 { 430 {
428 llwarns << "Bad Wearable asset: bad texture, #" << i << llendl; 431 llwarns << "Bad Wearable asset: bad texture, #" << i << llendl;
diff --git a/linden/indra/newview/llwebbrowserctrl.cpp b/linden/indra/newview/llwebbrowserctrl.cpp
index afbff65..6d1ee28 100644
--- a/linden/indra/newview/llwebbrowserctrl.cpp
+++ b/linden/indra/newview/llwebbrowserctrl.cpp
@@ -251,8 +251,16 @@ void LLWebBrowserCtrl::navigateTo( std::string urlIn )
251 251
252 // don't browse to anything that starts with secondlife:// 252 // don't browse to anything that starts with secondlife://
253 if ( urlIn.length() >= protocol.length() ) 253 if ( urlIn.length() >= protocol.length() )
254 {
254 if ( LLString::compareInsensitive( urlIn.substr( 0, protocol.length() ).c_str(), protocol.c_str() ) != 0 ) 255 if ( LLString::compareInsensitive( urlIn.substr( 0, protocol.length() ).c_str(), protocol.c_str() ) != 0 )
256 {
255 LLMozLib::getInstance()->navigateTo( mEmbeddedBrowserWindowId, urlIn ); 257 LLMozLib::getInstance()->navigateTo( mEmbeddedBrowserWindowId, urlIn );
258 }
259 }
260 else
261 {
262 LLMozLib::getInstance()->navigateTo( mEmbeddedBrowserWindowId, urlIn );
263 }
256} 264}
257 265
258//////////////////////////////////////////////////////////////////////////////// 266////////////////////////////////////////////////////////////////////////////////
diff --git a/linden/indra/newview/llwebbrowserctrl.h b/linden/indra/newview/llwebbrowserctrl.h
index 57c72c5..bad6e88 100644
--- a/linden/indra/newview/llwebbrowserctrl.h
+++ b/linden/indra/newview/llwebbrowserctrl.h
@@ -254,4 +254,4 @@ class LLWebBrowserTexture : public LLDynamicTexture
254 254
255#endif // // LL_LIBXUL_ENABLED 255#endif // // LL_LIBXUL_ENABLED
256 256
257#endif // LL_LLWEBBROWSERCTRL_H \ No newline at end of file 257#endif // LL_LLWEBBROWSERCTRL_H
diff --git a/linden/indra/newview/releasenotes.txt b/linden/indra/newview/releasenotes.txt
index a96a62a..4cce794 100644
--- a/linden/indra/newview/releasenotes.txt
+++ b/linden/indra/newview/releasenotes.txt
@@ -1,3 +1,21 @@
1Release Notes for Second Life 1.13.2(15) January 25, 2007
2=====================================
3Changes:
4* Tapping Alt to focus on menus has been disabled
5* Separate settings.ini file used by Beta and First Look clients
6** Uninstalling these clients will no longer remove Second Life user settings
7
8Bug fixes:
9* Alt-mouseclick no longer puts focus on the menus
10* Popup warnings for sandbox regions reflect changes made in 1.13.2(11)
11* Fixed error while editing profile if you have a classified
12* Fixed Buy Pass option in pie menu not appearing unless access list for avatars is enabled
13* Fixed build tool not changing type until you use another menu
14* Fixed dragging position arrows sideways moves object vertically
15* Fixed clicking More/Less in editor selects Create
16* Fixed loud noise in wind on dual core systems
17* Fixed a client crash
18
1Release Notes for Second Life 1.13.2(12) January 19, 2007 19Release Notes for Second Life 1.13.2(12) January 19, 2007
2===================================== 20=====================================
3Bug fixes: 21Bug fixes:
diff --git a/linden/indra/newview/res/newViewRes.rc b/linden/indra/newview/res/newViewRes.rc
index 44aab17..cf7b935 100644
--- a/linden/indra/newview/res/newViewRes.rc
+++ b/linden/indra/newview/res/newViewRes.rc
@@ -227,7 +227,7 @@ TOOLPIPETTE CURSOR "toolpipette.cur"
227// 227//
228 228
229VS_VERSION_INFO VERSIONINFO 229VS_VERSION_INFO VERSIONINFO
230 FILEVERSION 1,13,2,12 230 FILEVERSION 1,13,2,15
231 PRODUCTVERSION 1,13,2,0 231 PRODUCTVERSION 1,13,2,0
232 FILEFLAGSMASK 0x3fL 232 FILEFLAGSMASK 0x3fL
233#ifdef _DEBUG 233#ifdef _DEBUG
@@ -245,7 +245,7 @@ BEGIN
245 BEGIN 245 BEGIN
246 VALUE "CompanyName", "Linden Lab" 246 VALUE "CompanyName", "Linden Lab"
247 VALUE "FileDescription", "Second Life" 247 VALUE "FileDescription", "Second Life"
248 VALUE "FileVersion", "1.13.2.12" 248 VALUE "FileVersion", "1.13.2.15"
249 VALUE "InternalName", "Second Life" 249 VALUE "InternalName", "Second Life"
250 VALUE "LegalCopyright", "Copyright © 2001-2006, Linden Research, Inc." 250 VALUE "LegalCopyright", "Copyright © 2001-2006, Linden Research, Inc."
251 VALUE "OriginalFilename", "SecondLife.exe" 251 VALUE "OriginalFilename", "SecondLife.exe"
diff --git a/linden/indra/newview/rsyncfiles.txt b/linden/indra/newview/rsyncfiles.txt
new file mode 100644
index 0000000..0763c5c
--- /dev/null
+++ b/linden/indra/newview/rsyncfiles.txt
@@ -0,0 +1,22 @@
1- *.cpp
2- *.c
3- *.h
4- .svn/
5- CVS/
6- .cvsignore
7- .DS_Store
8- /app_settings/mozilla/
9- /app_settings/mozilla_debug/
10+ /app_settings/
11+ /character/
12+ /help/
13+ /trial/
14+ /fonts/
15+ /skins/
16+ /cursors_mac/
17+ /featuretable.txt
18+ /featuretable_mac.txt
19+ /releasenotes.txt
20+ /lsl_guide.html
21+ /secondlife.icns
22+ /gpu_table.txt
diff --git a/linden/indra/newview/secondlife setup build firstlook.bat b/linden/indra/newview/secondlife setup build firstlook.bat
new file mode 100644
index 0000000..099f4fc
--- /dev/null
+++ b/linden/indra/newview/secondlife setup build firstlook.bat
@@ -0,0 +1,11 @@
1@rem Invoke the script which preps then runs the installer.
2@rem This batch file is customized per grid.
3
4set LOGINPAGEURL=http://secondlife.com/app/login/firstlook/
5set ARGS=/DFIRSTLOOK
6
7@rem To build optional "update" installer (doesn't have static VFS):
8@rem
9@rem set ARGS=/DUPDATE
10
11@"secondlife setup build.bat" %LOGINPAGEURL% %ARGS%
diff --git a/linden/indra/newview/skins/xui/en-us/notify.xml b/linden/indra/newview/skins/xui/en-us/notify.xml
index 70defa7..747d1ca 100644
--- a/linden/indra/newview/skins/xui/en-us/notify.xml
+++ b/linden/indra/newview/skins/xui/en-us/notify.xml
@@ -802,9 +802,8 @@ You can edit your appearance as often as you like.
802 <notify name="FirstSandbox" tip="false"> 802 <notify name="FirstSandbox" tip="false">
803 <message name="message"> 803 <message name="message">
804 This is a sandbox region. 804 This is a sandbox region.
805Objects you build here may be deleted after you 805Objects you build here may be deleted after
806leave the area, and the region will be wiped 806you leave the area, Sandboxes clean on a regular basis, please refer to the information at the top of the screen next to the region name.
807every [HOURS] hours starting at [TIME] AM Pacific Time.
808 807
809Sandbox regions are uncommon, and are marked with signs. 808Sandbox regions are uncommon, and are marked with signs.
810 </message> 809 </message>
diff --git a/linden/indra/newview/viewer.cpp b/linden/indra/newview/viewer.cpp
index c009039..19b5260 100644
--- a/linden/indra/newview/viewer.cpp
+++ b/linden/indra/newview/viewer.cpp
@@ -352,7 +352,7 @@ BOOL gDoneLogout = FALSE;
352 352
353BOOL gInitializationComplete = FALSE; // used in windows handlers to determine if OK to call idle() 353BOOL gInitializationComplete = FALSE; // used in windows handlers to determine if OK to call idle()
354BOOL gAutoLogin = FALSE; 354BOOL gAutoLogin = FALSE;
355char gOldSettingsFileName[LL_MAX_PATH]; 355LLString gOldSettingsFileName;
356BOOL gPrintMessagesThisFrame = FALSE; 356BOOL gPrintMessagesThisFrame = FALSE;
357const char* DEFAULT_SETTINGS_FILE = "settings.xml"; 357const char* DEFAULT_SETTINGS_FILE = "settings.xml";
358const char* LEGACY_DEFAULT_SETTINGS_FILE = "settings.ini"; 358const char* LEGACY_DEFAULT_SETTINGS_FILE = "settings.ini";
@@ -925,8 +925,8 @@ int main( int argc, char **argv )
925 // 925 //
926 926
927 // Set up some defaults... 927 // Set up some defaults...
928 strcpy(gSettingsFileName, gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, DEFAULT_SETTINGS_FILE).c_str()); 928 gSettingsFileName = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, DEFAULT_SETTINGS_FILE);
929 strcpy(gOldSettingsFileName, gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, LEGACY_DEFAULT_SETTINGS_FILE).c_str()); 929 gOldSettingsFileName = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, LEGACY_DEFAULT_SETTINGS_FILE);
930 gUserServer.setPort(DEFAULT_USER_SERVER_PORT); 930 gUserServer.setPort(DEFAULT_USER_SERVER_PORT);
931 931
932 ///////////////////////////////////////// 932 /////////////////////////////////////////
@@ -4215,7 +4215,7 @@ BOOL add_object( LLPCode pcode, S32 x, S32 y, U8 use_physics )
4215 { 4215 {
4216 case LL_PCODE_LEGACY_GRASS: 4216 case LL_PCODE_LEGACY_GRASS:
4217 // Randomize size of grass patch 4217 // Randomize size of grass patch
4218 scale.setVec(10.f + frand(20.f), 10.f + frand(20.f), 1.f + frand(2.f)); 4218 scale.setVec(10.f + ll_frand(20.f), 10.f + ll_frand(20.f), 1.f + ll_frand(2.f));
4219 state = rand() % LLVOGrass::sMaxGrassSpecies; 4219 state = rand() % LLVOGrass::sMaxGrassSpecies;
4220 break; 4220 break;
4221 4221
@@ -5337,8 +5337,14 @@ void send_stats()
5337 gMessageSystem->addU32Fast(_PREHASH_SysRAM, gSysMemory.getPhysicalMemory()); 5337 gMessageSystem->addU32Fast(_PREHASH_SysRAM, gSysMemory.getPhysicalMemory());
5338 gMessageSystem->addStringFast(_PREHASH_SysOS, gSysOS.getOSString()); 5338 gMessageSystem->addStringFast(_PREHASH_SysOS, gSysOS.getOSString());
5339 gMessageSystem->addStringFast(_PREHASH_SysCPU, gSysCPU.getCPUStringTerse()); 5339 gMessageSystem->addStringFast(_PREHASH_SysCPU, gSysCPU.getCPUStringTerse());
5340
5340 5341
5341 gMessageSystem->addStringFast(_PREHASH_SysGPU, gGLManager.getRawGLString()); 5342 std::string gpu_desc = llformat("%-6s Class %d ",
5343 gGLManager.mGLVendorShort.substr(0,6).c_str(),
5344 gFeatureManagerp->getGPUClass())
5345 + gFeatureManagerp->getGPUString();
5346
5347 gMessageSystem->addStringFast(_PREHASH_SysGPU, gpu_desc);
5342 5348
5343 gMessageSystem->nextBlockFast(_PREHASH_DownloadTotals); 5349 gMessageSystem->nextBlockFast(_PREHASH_DownloadTotals);
5344 gMessageSystem->addU32Fast(_PREHASH_World, gTotalWorldBytes); 5350 gMessageSystem->addU32Fast(_PREHASH_World, gTotalWorldBytes);
@@ -5365,6 +5371,14 @@ void send_stats()
5365 gMessageSystem->addU32Fast(_PREHASH_OffCircuit, (U32)gMessageSystem->mOffCircuitPackets); 5371 gMessageSystem->addU32Fast(_PREHASH_OffCircuit, (U32)gMessageSystem->mOffCircuitPackets);
5366 gMessageSystem->addU32Fast(_PREHASH_Invalid, (U32)gMessageSystem->mInvalidOnCircuitPackets); 5372 gMessageSystem->addU32Fast(_PREHASH_Invalid, (U32)gMessageSystem->mInvalidOnCircuitPackets);
5367 5373
5374 // 1.00.00.000000
5375 F64 version =
5376 LL_VERSION_MAJOR * 10000000000.0 +
5377 LL_VERSION_MINOR * 100000000.0 +
5378 LL_VERSION_PATCH * 1000000.0 +
5379 LL_VERSION_BUILD;
5380 gViewerStats->setStat(LLViewerStats::ST_VERSION, version);
5381
5368 gViewerStats->addToMessage(); 5382 gViewerStats->addToMessage();
5369 5383
5370 gAgent.sendReliableMessage(); 5384 gAgent.sendReliableMessage();
@@ -5596,7 +5610,7 @@ int parse_args(int argc, char **argv)
5596 std::string folder(argv[j]); 5610 std::string folder(argv[j]);
5597 gDirUtilp->setSkinFolder(folder); 5611 gDirUtilp->setSkinFolder(folder);
5598 } 5612 }
5599 else if (!strcmp(argv[j], "--autologin")) 5613 else if (!strcmp(argv[j], "-autologin") || !strcmp(argv[j], "--autologin")) // keep --autologin for compatibility
5600 { 5614 {
5601 gAutoLogin = TRUE; 5615 gAutoLogin = TRUE;
5602 } 5616 }
@@ -5731,8 +5745,9 @@ int parse_args(int argc, char **argv)
5731 } 5745 }
5732 else if (!strcmp(argv[j], "-logfile") && (++j < argc)) 5746 else if (!strcmp(argv[j], "-logfile") && (++j < argc))
5733 { 5747 {
5748 // *NOTE: This buffer size is hard coded into scanf() below.
5734 char logfile[256]; 5749 char logfile[256];
5735 sscanf(argv[j], "%s", logfile); 5750 sscanf(argv[j], "%255s", logfile);
5736 llinfos << "Setting log file to " << logfile << llendl; 5751 llinfos << "Setting log file to " << logfile << llendl;
5737 LLFile::remove(logfile); 5752 LLFile::remove(logfile);
5738 if (!gErrorStream.setFile(logfile)) 5753 if (!gErrorStream.setFile(logfile))
@@ -5742,7 +5757,7 @@ int parse_args(int argc, char **argv)
5742 } 5757 }
5743 else if (!strcmp(argv[j], "-settings") && (++j < argc)) 5758 else if (!strcmp(argv[j], "-settings") && (++j < argc))
5744 { 5759 {
5745 strcpy(gSettingsFileName, argv[j]); 5760 gSettingsFileName = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, argv[j]);
5746 } 5761 }
5747 else if (!strcmp(argv[j], "-setdefault") && (j + 2 < argc)) 5762 else if (!strcmp(argv[j], "-setdefault") && (j + 2 < argc))
5748 { 5763 {
@@ -6475,7 +6490,7 @@ void cleanup_app()
6475 // Must do this after all panels have been deleted because panels that have persistent rects 6490 // Must do this after all panels have been deleted because panels that have persistent rects
6476 // save their rects on delete. 6491 // save their rects on delete.
6477 gSavedSettings.saveToFile(gSettingsFileName, TRUE); 6492 gSavedSettings.saveToFile(gSettingsFileName, TRUE);
6478 if (gPerAccountSettingsFileName[0]) 6493 if (!gPerAccountSettingsFileName.empty())
6479 { 6494 {
6480 gSavedPerAccountSettings.saveToFile(gPerAccountSettingsFileName, TRUE); 6495 gSavedPerAccountSettings.saveToFile(gPerAccountSettingsFileName, TRUE);
6481 } 6496 }
diff --git a/linden/indra/newview/viewer.h b/linden/indra/newview/viewer.h
index ed302ce..34ca249 100644
--- a/linden/indra/newview/viewer.h
+++ b/linden/indra/newview/viewer.h
@@ -95,7 +95,7 @@ extern LLTimer gLogoutTimer;
95extern BOOL gInProductionGrid; 95extern BOOL gInProductionGrid;
96extern S32 gCrashBehavior; 96extern S32 gCrashBehavior;
97extern bool gVerifySSLCert; 97extern bool gVerifySSLCert;
98 98extern const char* DEFAULT_SETTINGS_FILE;
99 99
100// TODO: Eliminate most of these, move into a globals structure. 100// TODO: Eliminate most of these, move into a globals structure.
101extern const U32 PATCH_SIZE; 101extern const U32 PATCH_SIZE;
diff --git a/linden/indra/test/files.lst b/linden/indra/test/files.lst
index 3824bd8..0f99ce9 100644
--- a/linden/indra/test/files.lst
+++ b/linden/indra/test/files.lst
@@ -7,6 +7,7 @@ test/llhttpnode_tut.cpp
7test/lliohttpserver_tut.cpp 7test/lliohttpserver_tut.cpp
8test/llmime_tut.cpp 8test/llmime_tut.cpp
9test/llpipeutil.cpp 9test/llpipeutil.cpp
10test/llrandom_tut.cpp
10test/llsd_new_tut.cpp 11test/llsd_new_tut.cpp
11test/llsdserialize_tut.cpp 12test/llsdserialize_tut.cpp
12test/llsd_message_system_tut.cpp 13test/llsd_message_system_tut.cpp
diff --git a/linden/indra/test/llrandom_tut.cpp b/linden/indra/test/llrandom_tut.cpp
new file mode 100755
index 0000000..1bb795e
--- /dev/null
+++ b/linden/indra/test/llrandom_tut.cpp
@@ -0,0 +1,69 @@
1/**
2 * @file llrandom_tut.cpp
3 * @author Phoenix
4 * @date 2007-01-25
5 *
6 * Copyright (c) 2007-2007, Linden Research, Inc.
7 *
8 * The source code in this file ("Source Code") is provided by Linden Lab
9 * to you under the terms of the GNU General Public License, version 2.0
10 * ("GPL"), unless you have obtained a separate licensing agreement
11 * ("Other License"), formally executed by you and Linden Lab. Terms of
12 * the GPL can be found in doc/GPL-license.txt in this distribution, or
13 * online at http://secondlife.com/developers/opensource/gplv2
14 *
15 * There are special exceptions to the terms and conditions of the GPL as
16 * it is applied to this Source Code. View the full text of the exception
17 * in the file doc/FLOSS-exception.txt in this software distribution, or
18 * online at http://secondlife.com/developers/opensource/flossexception
19 *
20 * By copying, modifying or distributing this software, you acknowledge
21 * that you have read and understood your obligations described above,
22 * and agree to abide by those obligations.
23 *
24 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
25 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
26 * COMPLETENESS OR PERFORMANCE.
27 */
28
29#include <tut/tut.h>
30
31#include "linden_common.h"
32#include "llrand.h"
33#include "lltut.h"
34
35
36namespace tut
37{
38 struct random
39 {
40 };
41
42 typedef test_group<random> random_t;
43 typedef random_t::object random_object_t;
44 tut::random_t tut_random("random");
45
46 template<> template<>
47 void random_object_t::test<1>()
48 {
49 F32 number = 0.0f;
50 for(S32 ii = 0; ii < 100000; ++ii)
51 {
52 number = ll_frand();
53 ensure("frand >= 0", (number >= 0.0f));
54 ensure("frand < 1", (number < 1.0f));
55 }
56 }
57
58 template<> template<>
59 void random_object_t::test<2>()
60 {
61 F32 number = 0.0f;
62 for(S32 ii = 0; ii < 100000; ++ii)
63 {
64 number = ll_frand(2.0f) - 1.0f;
65 ensure("frand >= 0", (number >= -1.0f));
66 ensure("frand < 1", (number <= 1.0f));
67 }
68 }
69}
diff --git a/linden/indra/test/test.vcproj b/linden/indra/test/test.vcproj
index 64c247c..f07d412 100644
--- a/linden/indra/test/test.vcproj
+++ b/linden/indra/test/test.vcproj
@@ -204,6 +204,9 @@
204 RelativePath=".\llpipeutil.cpp"> 204 RelativePath=".\llpipeutil.cpp">
205 </File> 205 </File>
206 <File 206 <File
207 RelativePath=".\llrandom_tut.cpp">
208 </File>
209 <File
207 RelativePath=".\llsd_message_system_tut.cpp"> 210 RelativePath=".\llsd_message_system_tut.cpp">
208 </File> 211 </File>
209 <File 212 <File
diff --git a/linden/indra/win_crash_logger/win_crash_logger.cpp b/linden/indra/win_crash_logger/win_crash_logger.cpp
index 3aa41d0..effe56c 100644
--- a/linden/indra/win_crash_logger/win_crash_logger.cpp
+++ b/linden/indra/win_crash_logger/win_crash_logger.cpp
@@ -496,6 +496,7 @@ void send_crash_report()
496 db_filep = new LLFileEncoder("DB", db_file_name.c_str()); 496 db_filep = new LLFileEncoder("DB", db_file_name.c_str());
497 497
498 // Get the filename of the SecondLife.log file 498 // Get the filename of the SecondLife.log file
499 // *NOTE: This buffer size is hard coded into scanf() below.
499 char tmp_sl_name[256]; 500 char tmp_sl_name[256];
500 tmp_sl_name[0] = '\0'; 501 tmp_sl_name[0] = '\0';
501 502
@@ -506,7 +507,10 @@ void send_crash_report()
506 // Look for it in the debug_info.log file 507 // Look for it in the debug_info.log file
507 if (db_filep->isValid()) 508 if (db_filep->isValid())
508 { 509 {
509 sscanf((const char *)db_filep->mBuf, "SL Log: %[^\r\n]", tmp_sl_name); 510 sscanf(
511 (const char*)db_filep->mBuf,
512 "SL Log: %255[^\r\n]",
513 tmp_sl_name);
510 } 514 }
511 else 515 else
512 { 516 {
diff --git a/linden/libraries/include/llmozlib.h b/linden/libraries/include/llmozlib.h
index f4ac0dc..a0897dc 100644
--- a/linden/libraries/include/llmozlib.h
+++ b/linden/libraries/include/llmozlib.h
@@ -142,4 +142,4 @@ class LLMozLib
142 LLEmbeddedBrowserWindow** mBrowserWindowList; 142 LLEmbeddedBrowserWindow** mBrowserWindowList;
143}; 143};
144 144
145#endif // LLMOZLIB_H \ No newline at end of file 145#endif // LLMOZLIB_H