From 9b4f54c826ffa4f94efa866068c9d6ecdfb4b424 Mon Sep 17 00:00:00 2001 From: Jacek Antonelli Date: Fri, 15 Aug 2008 23:44:48 -0500 Subject: Second Life viewer sources 1.13.2.15 --- linden/indra/SConstruct | 21 +++- linden/indra/indra_complete/indra_complete.sln | 1 + .../linux_crash_logger/linux_crash_logger.cpp | 8 +- linden/indra/llaudio/audioengine_fmod.cpp | 2 +- linden/indra/llaudio/vorbisencode.cpp | 2 +- linden/indra/llcharacter/llheadrotmotion.cpp | 18 +-- linden/indra/llcommon/doublelinkedlist.h | 2 +- linden/indra/llcommon/lldefs.h | 11 ++ linden/indra/llcommon/llfasttimer.h | 6 +- linden/indra/llcommon/llptrskiplist.h | 2 +- linden/indra/llcommon/llptrskipmap.h | 6 +- linden/indra/llcommon/llskiplist.h | 2 +- linden/indra/llcommon/llversion.h | 2 +- linden/indra/llinventory/llinventory.cpp | 30 +++-- linden/indra/llinventory/lllandmark.cpp | 4 +- linden/indra/llinventory/llpermissions.cpp | 24 ++-- linden/indra/llinventory/llsaleinfo.cpp | 8 +- linden/indra/llmath/llrand.cpp | 59 ++++----- linden/indra/llmath/llrand.h | 134 +++++++++++++-------- linden/indra/llmath/lluuid.cpp | 75 ++++++++++-- linden/indra/llmath/llvolume.cpp | 24 +++- linden/indra/llmessage/llcachename.cpp | 18 +-- linden/indra/llmessage/llcircuit.cpp | 6 +- linden/indra/llmessage/llpacketring.cpp | 4 +- linden/indra/llmessage/llpumpio.cpp | 1 + linden/indra/llmessage/llurlrequest.cpp | 1 + linden/indra/llmessage/llxfermanager.cpp | 2 +- linden/indra/llui/llmenugl.cpp | 3 +- linden/indra/llvfs/lldir_linux.cpp | 8 +- linden/indra/llvfs/lldir_mac.cpp | 4 +- linden/indra/llvfs/lldir_win32.cpp | 6 +- linden/indra/llwindow/llgl.cpp | 9 +- linden/indra/llwindow/llgl.h | 1 + linden/indra/llwindow/llkeyboard.cpp | 1 - linden/indra/llwindow/llkeyboardwin32.cpp | 1 - linden/indra/llwindow/llwindowwin32.cpp | 37 ++++-- linden/indra/lscript/lscript_alloc.h | 72 +---------- .../lscript/lscript_compile/lscript_compile.vcproj | 6 +- .../lscript/lscript_execute/lscript_execute.vcproj | 6 +- .../lscript/lscript_library/lscript_alloc.cpp | 59 +++++++++ .../lscript/lscript_library/lscript_library.cpp | 2 +- .../lscript/lscript_library/lscript_library.vcproj | 6 +- linden/indra/mac_crash_logger/mac_crash_logger.cpp | 14 ++- linden/indra/mac_updater/mac_updater.cpp | 3 +- .../indra/newview/English.lproj/InfoPlist.strings | 4 +- linden/indra/newview/Info-SecondLife.plist | 2 +- .../indra/newview/linux_tools/exposed-symbols.txt | 3 + linden/indra/newview/linux_tools/hidesymbols.ver | 9 -- linden/indra/newview/linux_tools/package-client.sh | 11 +- linden/indra/newview/llagent.cpp | 12 +- linden/indra/newview/llanimalcontrols.cpp | 2 +- linden/indra/newview/llcloud.cpp | 6 +- linden/indra/newview/llcontroldef.cpp | 1 + linden/indra/newview/lldrawpoolbump.cpp | 3 +- linden/indra/newview/llfasttimerview.cpp | 62 ++++------ linden/indra/newview/llfasttimerview.h | 1 - linden/indra/newview/llfeaturemanager.cpp | 19 ++- linden/indra/newview/llfeaturemanager.h | 8 +- linden/indra/newview/llflexibleobject.cpp | 6 +- linden/indra/newview/llfloatereditui.cpp | 2 +- linden/indra/newview/llfloatertools.cpp | 15 +-- linden/indra/newview/llfloatertools.h | 1 - linden/indra/newview/llhippo.cpp | 2 +- linden/indra/newview/llhudeffectbeam.cpp | 6 +- linden/indra/newview/llinventorymodel.cpp | 3 +- linden/indra/newview/llmanip.cpp | 4 +- linden/indra/newview/llmutelist.cpp | 4 +- linden/indra/newview/llpanelavatar.cpp | 31 +++-- linden/indra/newview/llstartup.cpp | 2 +- linden/indra/newview/lltexlayer.cpp | 2 +- linden/indra/newview/llviewercontrol.cpp | 4 +- linden/indra/newview/llviewercontrol.h | 5 +- linden/indra/newview/llviewerimage.cpp | 1 - linden/indra/newview/llviewerinventory.cpp | 5 +- linden/indra/newview/llviewerkeyboard.cpp | 3 +- linden/indra/newview/llviewermenu.cpp | 23 ++-- linden/indra/newview/llviewermessage.cpp | 2 +- linden/indra/newview/llviewerobject.cpp | 3 +- linden/indra/newview/llviewerpartsim.cpp | 6 +- linden/indra/newview/llviewerpartsource.cpp | 20 +-- linden/indra/newview/llviewerstats.cpp | 12 +- linden/indra/newview/llviewerstats.h | 6 +- linden/indra/newview/llvoavatar.cpp | 2 +- linden/indra/newview/llvograss.cpp | 14 +-- linden/indra/newview/llvopart.cpp | 24 ++-- linden/indra/newview/llvopartgroup.cpp | 2 +- linden/indra/newview/llvosky.cpp | 16 ++- linden/indra/newview/llvostars.cpp | 14 +-- linden/indra/newview/llvotreenew.cpp | 7 +- linden/indra/newview/llvotreenew.h | 6 +- linden/indra/newview/llwearable.cpp | 9 +- linden/indra/newview/llwebbrowserctrl.cpp | 8 ++ linden/indra/newview/llwebbrowserctrl.h | 2 +- linden/indra/newview/releasenotes.txt | 18 +++ linden/indra/newview/res/newViewRes.rc | 4 +- linden/indra/newview/rsyncfiles.txt | 22 ++++ .../newview/secondlife setup build firstlook.bat | 11 ++ linden/indra/newview/skins/xui/en-us/notify.xml | 5 +- linden/indra/newview/viewer.cpp | 33 +++-- linden/indra/newview/viewer.h | 2 +- linden/indra/test/files.lst | 1 + linden/indra/test/llrandom_tut.cpp | 69 +++++++++++ linden/indra/test/test.vcproj | 3 + linden/indra/win_crash_logger/win_crash_logger.cpp | 6 +- linden/libraries/include/llmozlib.h | 2 +- 105 files changed, 808 insertions(+), 494 deletions(-) create mode 100644 linden/indra/newview/linux_tools/exposed-symbols.txt delete mode 100644 linden/indra/newview/linux_tools/hidesymbols.ver create mode 100644 linden/indra/newview/rsyncfiles.txt create mode 100644 linden/indra/newview/secondlife setup build firstlook.bat create mode 100755 linden/indra/test/llrandom_tut.cpp 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', opts.Add(EnumOption('COLORGCC', 'Enabled colorgcc', 'yes', allowed_values=('yes', 'no'))) opts.Add(EnumOption('GRID', 'Client package\'s default grid', 'default', - allowed_values=('default', 'aditi', 'agni', 'dmz', 'durga', 'ganga', 'shakti', 'siva', 'soma', 'uma', 'vaak'))) + allowed_values=('default', 'aditi', 'agni', 'dmz', 'durga', 'firstlook', 'ganga', 'shakti', 'siva', 'soma', 'uma', 'vaak'))) opts.Add(EnumOption('OPENSOURCE', 'Build using only non-proprietary dependencies', 'yes',# OPENSOURCE: do not edit this line allowed_values=('yes', 'no'))) @@ -179,7 +179,6 @@ for build_target in targets: if platform == 'linux': # Linux-only flags flags += '-DLL_LINUX=1 ' - system_link_flags += '-Wl,--version-script=newview/linux_tools/hidesymbols.ver ' if build_target == 'client': flags += '-DAPPID=secondlife -DLL_SDL=1 -DLL_X11=1 ' flags += '-DLL_GTK=1 ' @@ -210,6 +209,17 @@ for build_target in targets: # logger backtraces deteriorates. strip_cmd = 'strip -S -o $TARGET $SOURCE' + # hidesyms_cmd is something which copies an executable while 'hiding' + # all of its exposed symbols except a very few desired ones. This is + # used mainly to hide the symbols of the many common libraries we + # static-link, which otherwise cause hard-to-trace fatal crashes due + # to clashes in the run-time symbol namespace. + if platform == 'linux': + exposed_symbols_file = 'newview/linux_tools/exposed-symbols.txt' + hidesyms_cmd = 'objcopy --keep-global-symbols ' + exposed_symbols_file + ' $SOURCE $TARGET' + else: + hidesyms_cmd = 'cp -f $SOURCE $TARGET' + if build_target != 'client': gcc_bin = 'g++-3.3' @@ -366,7 +376,8 @@ for build_target in targets: output_crashlogger_bin = 'linux_crash_logger/linux-crash-logger-' + arch + '-bin' external_libs = net_external_libs + [ 'db-4.2', 'gtk-x11-2.0' ] internal_libs = [ 'llvfs', 'llmath', 'llcommon' ] - create_executable(output_crashlogger_bin, 'linux_crash_logger', internal_libs + external_libs) + create_executable(output_crashlogger_bin + '-globalsyms', 'linux_crash_logger', internal_libs + external_libs) + env.Command(output_crashlogger_bin, output_crashlogger_bin + '-globalsyms', hidesyms_cmd) create_static_module('llaudio') create_static_module('llmedia') @@ -389,7 +400,8 @@ for build_target in targets: 'llcharacter', 'llaudio', 'llui', 'llxml', 'llmessage', 'llvfs', 'llmath', 'llcommon' ] - create_executable(output_bin, 'newview', internal_libs + external_libs) + create_executable(output_bin + '-globalsyms', 'newview', internal_libs + external_libs) + env.Command(output_bin, output_bin + '-globalsyms', hidesyms_cmd) if buildtype == 'releasefordownload': @@ -398,7 +410,6 @@ for build_target in targets: ####################### if platform == 'linux': - env.Command(output_bin + '-stripped', output_bin, strip_cmd) env.Command(output_crashlogger_bin + '-stripped', output_crashlogger_bin, strip_cmd) 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 {4B19F64E-AB97-4FB9-8E1D-74A8104DE0C4} = {4B19F64E-AB97-4FB9-8E1D-74A8104DE0C4} {E5D94794-5671-4BD6-A16D-26EC18F3DB34} = {E5D94794-5671-4BD6-A16D-26EC18F3DB34} {E87FD9BE-BE42-4EA3-BF4D-D992223046D9} = {E87FD9BE-BE42-4EA3-BF4D-D992223046D9} + {D37774F4-253D-4760-BF64-372A943224A1} = {D37774F4-253D-4760-BF64-372A943224A1} EndProjectSection EndProject 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) db_filep = new LLFileEncoder("DB", db_file_name.c_str()); // Get the filename of the SecondLife.log file - // *TODO tofu - get right MAX_PATH. - // *FIX: What's up with this? This #define just can't be safe. -#define MAX_PATH PATH_MAX - char tmp_sl_name[MAX_PATH]; + // *NOTE: These buffer sizes are hardcoded into a scanf() below. + char tmp_sl_name[LL_MAX_PATH]; tmp_sl_name[0] = '\0'; char tmp_space[256]; tmp_space[0] = '\0'; @@ -251,7 +249,7 @@ int main(int argc, char **argv) { // This was originally scanning for "SL Log: %[^\r\n]", which happily skipped to the next line // on debug logs (which don't have anything after "SL Log:" and tried to open a nonsensical filename. - sscanf(db_filep->mBuf.c_str(), "SL Log:%[ ]%[^\r\n]", tmp_space, tmp_sl_name); + sscanf(db_filep->mBuf.c_str(), "SL Log:%255[ ]%1023[^\r\n]", tmp_space, tmp_sl_name); } else { 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 double nextSample; // start with white noise - nextSample = frand(2.0f) - 1.0f; + nextSample = llclamp((ll_frand(2.0f) - 1.0f), -1.0f, 1.0f); #if 1 // LLAE_WIND_PINK apply pinking filter 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 /* set up our packet->stream encoder */ /* pick a random serial number; that way we can more likely build chained streams just by concatenation */ - ogg_stream_init(&os,(int)frand(0xFFFFFF)); + ogg_stream_init(&os, ll_rand()); /* Vorbis streams begin with three headers; the initial header (with 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) //calculate jitter if (mEyeJitterTimer.getElapsedTimeF32() > mEyeJitterTime) { - mEyeJitterTime = EYE_JITTER_MIN_TIME + frand(EYE_JITTER_MAX_TIME - EYE_JITTER_MIN_TIME); - mEyeJitterYaw = (frand(2.f) - 1.f) * EYE_JITTER_MAX_YAW; - mEyeJitterPitch = (frand(2.f) - 1.f) * EYE_JITTER_MAX_PITCH; + mEyeJitterTime = EYE_JITTER_MIN_TIME + ll_frand(EYE_JITTER_MAX_TIME - EYE_JITTER_MIN_TIME); + mEyeJitterYaw = (ll_frand(2.f) - 1.f) * EYE_JITTER_MAX_YAW; + mEyeJitterPitch = (ll_frand(2.f) - 1.f) * EYE_JITTER_MAX_PITCH; // make sure lookaway time count gets updated, because we're resetting the timer mEyeLookAwayTime -= llmax(0.f, mEyeJitterTimer.getElapsedTimeF32()); mEyeJitterTimer.reset(); } else if (mEyeJitterTimer.getElapsedTimeF32() > mEyeLookAwayTime) { - if (frand(1.f) > 0.1f) + if (ll_frand() > 0.1f) { // blink while moving eyes some percentage of the time mEyeBlinkTime = mEyeBlinkTimer.getElapsedTimeF32(); } if (mEyeLookAwayYaw == 0.f && mEyeLookAwayPitch == 0.f) { - mEyeLookAwayYaw = (frand(2.f) - 1.f) * EYE_LOOK_AWAY_MAX_YAW; - mEyeLookAwayPitch = (frand(2.f) - 1.f) * EYE_LOOK_AWAY_MAX_PITCH; - mEyeLookAwayTime = EYE_LOOK_BACK_MIN_TIME + frand(EYE_LOOK_BACK_MAX_TIME - EYE_LOOK_BACK_MIN_TIME); + mEyeLookAwayYaw = (ll_frand(2.f) - 1.f) * EYE_LOOK_AWAY_MAX_YAW; + mEyeLookAwayPitch = (ll_frand(2.f) - 1.f) * EYE_LOOK_AWAY_MAX_PITCH; + mEyeLookAwayTime = EYE_LOOK_BACK_MIN_TIME + ll_frand(EYE_LOOK_BACK_MAX_TIME - EYE_LOOK_BACK_MIN_TIME); } else { mEyeLookAwayYaw = 0.f; mEyeLookAwayPitch = 0.f; - mEyeLookAwayTime = EYE_LOOK_AWAY_MIN_TIME + frand(EYE_LOOK_AWAY_MAX_TIME - EYE_LOOK_AWAY_MIN_TIME); + mEyeLookAwayTime = EYE_LOOK_AWAY_MIN_TIME + ll_frand(EYE_LOOK_AWAY_MAX_TIME - EYE_LOOK_AWAY_MIN_TIME); } } @@ -414,7 +414,7 @@ BOOL LLEyeMotion::onUpdate(F32 time, U8* joint_mask) if (rightEyeBlinkMorph == 0.f) { mEyesClosed = FALSE; - mEyeBlinkTime = EYE_BLINK_MIN_TIME + frand(EYE_BLINK_MAX_TIME - EYE_BLINK_MIN_TIME); + mEyeBlinkTime = EYE_BLINK_MIN_TIME + ll_frand(EYE_BLINK_MAX_TIME - EYE_BLINK_MIN_TIME); mEyeBlinkTimer.reset(); } } 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::scramble() DATA_TYPE *datap = getFirstData(); while(datap) { - random_number = gLindenLabRandomNumber.llrand() % 5; + random_number = ll_rand(5); if (0 == random_number) { 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; const U32 TOP_SIDE = 5; const U32 BOTTOM_SIDE = 6; + +// +// *NOTE: These values may be used as hard-coded numbers in scanf() variants. +// +// -------------- +// DO NOT CHANGE. +// -------------- +// const U32 LL_MAX_PATH = 1024; // buffer size of maximum path + filename string length // For strings we send in messages const U32 STD_STRING_BUF_SIZE = 255; // Buffer size const U32 STD_STRING_STR_LEN = 254; // Length of the string (not including \0) + +// *NOTE: This value is used as hard-coded numbers in scanf() variants. +// DO NOT CHANGE. const U32 MAX_STRING = STD_STRING_BUF_SIZE; // Buffer size const 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: FTM_IDLE, FTM_SLEEP, - // common simulate components + // common messaging components + FTM_PUMP, + FTM_CURL, + + // common simulation components FTM_UPDATE_ANIMATION, FTM_UPDATE_TERRAIN, 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::addData(DATA_TYPE *data) S32 newlevel; for (newlevel = 1; newlevel <= mLevel && newlevel < BINARY_DEPTH; newlevel++) { - if (frand(1.f) < 0.5f) + if (ll_frand() < 0.5f) break; } 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::addData(const INDEX_ S32 newlevel; for (newlevel = 1; newlevel <= mLevel && newlevel < BINARY_DEPTH; newlevel++) { - if (frand(1.f) < 0.5f) + if (ll_frand() < 0.5f) { break; } @@ -411,7 +411,7 @@ inline DATA_T &LLPtrSkipMap::addData(const INDEX_ S32 newlevel; for (newlevel = 1; newlevel <= mLevel && newlevel < BINARY_DEPTH; newlevel++) { - if (frand(1.f) < 0.5f) + if (ll_frand() < 0.5f) break; } @@ -489,7 +489,7 @@ inline DATA_T &LLPtrSkipMap::getData(const INDEX_ S32 newlevel; for (newlevel = 1; newlevel <= mLevel && newlevel < BINARY_DEPTH; newlevel++) { - if (frand(1.f) < 0.5f) + if (ll_frand() < 0.5f) break; } 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::addData(const DATA_TYPE& data) S32 newlevel; for (newlevel = 1; newlevel <= mLevel && newlevel < BINARY_DEPTH; newlevel++) { - if (frand(1.f) < 0.5f) + if (ll_frand() < 0.5f) break; } 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 @@ const S32 LL_VERSION_MAJOR = 1; const S32 LL_VERSION_MINOR = 13; const S32 LL_VERSION_PATCH = 2; -const S32 LL_VERSION_BUILD = 12; +const S32 LL_VERSION_BUILD = 15; 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) // virtual BOOL LLInventoryObject::importLegacyStream(std::istream& input_stream) { + // *NOTE: Changing the buffer size will require changing the scanf + // calls below. char buffer[MAX_STRING]; char keyword[MAX_STRING]; char valuestr[MAX_STRING]; @@ -358,7 +360,7 @@ BOOL LLInventoryObject::importLegacyStream(std::istream& input_stream) { //strcpy(valuestr, buffer + strlen(keyword) + 3); // *NOTE: Not ANSI C, but widely supported. - sscanf(buffer, " %254s %[^|]", keyword, valuestr); + sscanf(buffer, " %254s %254[^|]", keyword, valuestr); mName.assign(valuestr); LLString::replaceNonstandardASCII(mName, ' '); LLString::replaceChar(mName, '|', ' '); @@ -681,6 +683,8 @@ BOOL LLInventoryItem::unpackMessage(LLMessageSystem* msg, const char* block, S32 // virtual BOOL LLInventoryItem::importFile(FILE* fp) { + // *NOTE: Changing the buffer size will require changing the scanf + // calls below. char buffer[MAX_STRING]; char keyword[MAX_STRING]; char valuestr[MAX_STRING]; @@ -769,7 +773,7 @@ BOOL LLInventoryItem::importFile(FILE* fp) { //strcpy(valuestr, buffer + strlen(keyword) + 3); // *NOTE: Not ANSI C, but widely supported. - sscanf(buffer, " %254s%[\t]%[^|]", keyword, junk, valuestr); + sscanf(buffer, " %254s%254[\t]%254[^|]", keyword, junk, valuestr); // IW: sscanf chokes and puts | in valuestr if there's no name if (valuestr[0] == '|') @@ -785,7 +789,7 @@ BOOL LLInventoryItem::importFile(FILE* fp) { //strcpy(valuestr, buffer + strlen(keyword) + 3); // *NOTE: Not ANSI C, but widely supported. - sscanf(buffer, " %s%[\t]%[^|]", keyword, junk, valuestr); + sscanf(buffer, " %254s%254[\t]%254[^|]", keyword, junk, valuestr); if (valuestr[0] == '|') { @@ -875,6 +879,8 @@ BOOL LLInventoryItem::exportFile(FILE* fp, BOOL include_asset_key) const // virtual BOOL LLInventoryItem::importLegacyStream(std::istream& input_stream) { + // *NOTE: Changing the buffer size will require changing the scanf + // calls below. char buffer[MAX_STRING]; char keyword[MAX_STRING]; char valuestr[MAX_STRING]; @@ -889,7 +895,7 @@ BOOL LLInventoryItem::importLegacyStream(std::istream& input_stream) while(success && input_stream.good()) { input_stream.getline(buffer, MAX_STRING); - sscanf(buffer, " %s %s", keyword, valuestr); + sscanf(buffer, " %254s %254s", keyword, valuestr); if(!keyword) { continue; @@ -963,7 +969,7 @@ BOOL LLInventoryItem::importLegacyStream(std::istream& input_stream) { //strcpy(valuestr, buffer + strlen(keyword) + 3); // *NOTE: Not ANSI C, but widely supported. - sscanf(buffer, " %s%[\t]%[^|]", keyword, junk, valuestr); + sscanf(buffer, " %254s%254[\t]%254[^|]", keyword, junk, valuestr); // IW: sscanf chokes and puts | in valuestr if there's no name if (valuestr[0] == '|') @@ -979,7 +985,7 @@ BOOL LLInventoryItem::importLegacyStream(std::istream& input_stream) { //strcpy(valuestr, buffer + strlen(keyword) + 3); // *NOTE: Not ANSI C, but widely supported. - sscanf(buffer, " %s%[\t]%[^|]", keyword, junk, valuestr); + sscanf(buffer, " %254s%254[\t]%254[^|]", keyword, junk, valuestr); if (valuestr[0] == '|') { @@ -1522,6 +1528,8 @@ void LLInventoryCategory::unpackMessage(LLMessageSystem* msg, // virtual BOOL LLInventoryCategory::importFile(FILE* fp) { + // *NOTE: Changing the buffer size will require changing the scanf + // calls below. char buffer[MAX_STRING]; char keyword[MAX_STRING]; char valuestr[MAX_STRING]; @@ -1531,7 +1539,7 @@ BOOL LLInventoryCategory::importFile(FILE* fp) while(!feof(fp)) { fgets(buffer, MAX_STRING, fp); - sscanf(buffer, " %s %s", keyword, valuestr); + sscanf(buffer, " %254s %254s", keyword, valuestr); if(!keyword) { continue; @@ -1564,7 +1572,7 @@ BOOL LLInventoryCategory::importFile(FILE* fp) { //strcpy(valuestr, buffer + strlen(keyword) + 3); // *NOTE: Not ANSI C, but widely supported. - sscanf(buffer, " %s %[^|]", keyword, valuestr); + sscanf(buffer, " %254s %254[^|]", keyword, valuestr); mName.assign(valuestr); LLString::replaceNonstandardASCII(mName, ' '); LLString::replaceChar(mName, '|', ' '); @@ -1597,6 +1605,8 @@ BOOL LLInventoryCategory::exportFile(FILE* fp, BOOL) const // virtual BOOL LLInventoryCategory::importLegacyStream(std::istream& input_stream) { + // *NOTE: Changing the buffer size will require changing the scanf + // calls below. char buffer[MAX_STRING]; char keyword[MAX_STRING]; char valuestr[MAX_STRING]; @@ -1606,7 +1616,7 @@ BOOL LLInventoryCategory::importLegacyStream(std::istream& input_stream) while(input_stream.good()) { input_stream.getline(buffer, MAX_STRING); - sscanf(buffer, " %s %s", keyword, valuestr); + sscanf(buffer, " %254s %254s", keyword, valuestr); if(!keyword) { continue; @@ -1639,7 +1649,7 @@ BOOL LLInventoryCategory::importLegacyStream(std::istream& input_stream) { //strcpy(valuestr, buffer + strlen(keyword) + 3); // *NOTE: Not ANSI C, but widely supported. - sscanf(buffer, " %s %[^|]", keyword, valuestr); + sscanf(buffer, " %254s %254[^|]", keyword, valuestr); mName.assign(valuestr); LLString::replaceNonstandardASCII(mName, ' '); 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) } else if(version == 2) { + // *NOTE: Changing the buffer size will require changing the + // scanf call below. char region_id_str[MAX_STRING]; LLVector3 pos; cur += chars_read; - count = sscanf(cur, "region_id %s\n%n", region_id_str, &chars_read); + count = sscanf(cur, "region_id %254s\n%n", region_id_str, &chars_read); if(count != 1) goto error; cur += chars_read; 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) init(LLUUID::null, LLUUID::null, LLUUID::null, LLUUID::null); const S32 BUFSIZE = 16384; + // *NOTE: Changing the buffer size will require changing the scanf + // calls below. char buffer[BUFSIZE]; char keyword[256]; char valuestr[256]; @@ -523,7 +525,7 @@ BOOL LLPermissions::importFile(FILE *fp) while (!feof(fp)) { fgets(buffer, BUFSIZE, fp); - sscanf(buffer, " %s %s", keyword, valuestr); + sscanf(buffer, " %255s %255s", keyword, valuestr); if (!keyword) { continue; @@ -571,22 +573,22 @@ BOOL LLPermissions::importFile(FILE *fp) } else if (!strcmp("creator_id", keyword)) { - sscanf(valuestr, "%s", uuid_str); + sscanf(valuestr, "%255s", uuid_str); mCreator.set(uuid_str); } else if (!strcmp("owner_id", keyword)) { - sscanf(valuestr, "%s", uuid_str); + sscanf(valuestr, "%255s", uuid_str); mOwner.set(uuid_str); } else if (!strcmp("last_owner_id", keyword)) { - sscanf(valuestr, "%s", uuid_str); + sscanf(valuestr, "%255s", uuid_str); mLastOwner.set(uuid_str); } else if (!strcmp("group_id", keyword)) { - sscanf(valuestr, "%s", uuid_str); + sscanf(valuestr, "%255s", uuid_str); mGroup.set(uuid_str); } else if (!strcmp("group_owned", keyword)) @@ -644,6 +646,8 @@ BOOL LLPermissions::importLegacyStream(std::istream& input_stream) init(LLUUID::null, LLUUID::null, LLUUID::null, LLUUID::null); const S32 BUFSIZE = 16384; + // *NOTE: Changing the buffer size will require changing the scanf + // calls below. char buffer[BUFSIZE]; char keyword[256]; char valuestr[256]; @@ -656,7 +660,7 @@ BOOL LLPermissions::importLegacyStream(std::istream& input_stream) while (input_stream.good()) { input_stream.getline(buffer, BUFSIZE); - sscanf(buffer, " %s %s", keyword, valuestr); + sscanf(buffer, " %255s %255s", keyword, valuestr); if (!keyword) { continue; @@ -704,22 +708,22 @@ BOOL LLPermissions::importLegacyStream(std::istream& input_stream) } else if (!strcmp("creator_id", keyword)) { - sscanf(valuestr, "%s", uuid_str); + sscanf(valuestr, "%255s", uuid_str); mCreator.set(uuid_str); } else if (!strcmp("owner_id", keyword)) { - sscanf(valuestr, "%s", uuid_str); + sscanf(valuestr, "%255s", uuid_str); mOwner.set(uuid_str); } else if (!strcmp("last_owner_id", keyword)) { - sscanf(valuestr, "%s", uuid_str); + sscanf(valuestr, "%255s", uuid_str); mLastOwner.set(uuid_str); } else if (!strcmp("group_id", keyword)) { - sscanf(valuestr, "%s", uuid_str); + sscanf(valuestr, "%255s", uuid_str); mGroup.set(uuid_str); } 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) { has_perm_mask = FALSE; + // *NOTE: Changing the buffer size will require changing the scanf + // calls below. char buffer[MAX_STRING]; char keyword[MAX_STRING]; char valuestr[MAX_STRING]; @@ -168,7 +170,7 @@ BOOL LLSaleInfo::importFile(FILE* fp, BOOL& has_perm_mask, U32& perm_mask) while(success && (!feof(fp))) { fgets(buffer, MAX_STRING, fp); - sscanf(buffer, " %s %s", keyword, valuestr); + sscanf(buffer, " %254s %254s", keyword, valuestr); if(!keyword) { continue; @@ -209,6 +211,8 @@ BOOL LLSaleInfo::importLegacyStream(std::istream& input_stream, BOOL& has_perm_m { has_perm_mask = FALSE; + // *NOTE: Changing the buffer size will require changing the scanf + // calls below. char buffer[MAX_STRING]; char keyword[MAX_STRING]; char valuestr[MAX_STRING]; @@ -219,7 +223,7 @@ BOOL LLSaleInfo::importLegacyStream(std::istream& input_stream, BOOL& has_perm_m while(success && input_stream.good()) { input_stream.getline(buffer, MAX_STRING); - sscanf(buffer, " %s %s", keyword, valuestr); + sscanf(buffer, " %254s %254s", keyword, valuestr); if(!keyword) { 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 @@ /** * @file llrand.cpp - * @brief a few useful math functions. + * @brief Global random generator. * * Copyright (c) 2000-2007, Linden Research, Inc. * @@ -30,45 +30,34 @@ #include "llrand.h" #include "lluuid.h" -/* Put this back if you re-enabled slamFPCW -#if LL_WINDOWS -#include -#else -#include -#endif -*/ +static LLRandLagFib2281 gRandomGenerator(LLUUID::getRandomSeed()); -void slamFPCW( void ) +S32 ll_rand() { -/* -#if LL_WINDOWS - // for Intel based CPUs, slam the FP control word directly - WORD wTemp, wSave; - - __asm fstcw wSave - if ( (wSave & 0x300) // Not single mode - ||(0x3f != (wSave & 0x3f)) // Exceptions enabled - ||(wSave & 0xC00)) // Not round to nearest mode - { - __asm - { - mov ax, wSave - and ax, not 300h ;; single mode - or ax, 3fh ;; disable all exceptions - and ax, not 0xC00 ;; round to nearest mode - mov wTemp, ax - fldcw wTemp - } - } -#endif -*/ + return (S32)(gRandomGenerator() * RAND_MAX); } -LLRand gLindenLabRandomNumber(LLUUID::getRandomSeed()); +S32 ll_rand(S32 val) +{ + return (S32)(gRandomGenerator() * val); +} + +F32 ll_frand() +{ + return (F32)gRandomGenerator(); +} -F32 frand(F32 val) +F32 ll_frand(F32 val) { -// return (val * (F32)rand()/(F32)RAND_MAX); - return gLindenLabRandomNumber.llfrand(val); + return (F32)gRandomGenerator() * val; } +F64 ll_drand() +{ + return gRandomGenerator(); +} + +F64 ll_drand(F64 val) +{ + return gRandomGenerator() * val; +} 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 @@ /** * @file llrand.h - * @brief Some useful math functions. + * @brief Information, functions, and typedefs for randomness. * * Copyright (c) 2000-2007, Linden Research, Inc. * @@ -28,61 +28,101 @@ #ifndef LL_LLRAND_H #define LL_LLRAND_H -// As long as you #include "llviewerprecompiledheaders.h", -// you can use "gLindenLabRandomNumber.llfrand( range );" which returns a -// random number F32 ranging from 0.0f to range. -// -Ventrella - Sept 30, 2005 +#include "boost/random/lagged_fibonacci.hpp" +#include "boost/random/mersenne_twister.hpp" -// Slams Intel processors into Single Precision FP mode -// (which is not any faster on modern hardware) -void slamFPCW( void ); - -class LLRand -{ -public: - LLRand(U32 seed) : mSeed(seed) {} - ~LLRand() {} - - void seed(U32 seed) { mSeed = seed; } +/** + * Use the boost random number generators if you want a stateful + * random numbers. If you want more random numbers, use the + * c-functions since they will generate faster/better randomness + * across the process. + * + * I tested some of the boost random engines, and picked a good double + * generator and a good integer generator. I also took some timings + * for them on linux using gcc 3.3.5. The harness also did some other + * fairly trivial operations to try to limit compiler optimizations, + * so these numbers are only good for relative comparisons. + * + * usec/inter algorithm + * 0.21 boost::minstd_rand0 + * 0.039 boost:lagged_fibonacci19937 + * 0.036 boost:lagged_fibonacci607 + * 0.44 boost::hellekalek1995 + * 0.44 boost::ecuyer1988 + * 0.042 boost::rand48 + * 0.043 boost::mt11213b + * 0.028 stdlib random() + * 0.05 stdlib lrand48() + * 0.034 stdlib rand() + * 0.020 the old & lame LLRand + */ - U32 llrand() - { - mSeed = U64L(1664525) * mSeed + U64L(1013904223); - return (U32)mSeed; - } +/** + *@brief Generate a float from [0, RAND_MAX). + */ +S32 ll_rand(); - U32 llrand(U32 val) - { - mSeed = U64L(1664525) * mSeed + U64L(1013904223); - return (U32)(mSeed) % val; - } +/** + *@brief Generate a float from [0, val). + */ +S32 ll_rand(S32 val); - // val is the maximum - F32 llfrand(F32 val) - { - const U32 FP_ONE = 0x3f800000; - const U32 FP_MASK = 0x007fffff; - U32 ir = llrand(); +/** + *@brief Generate a float from [0, 1.0). + */ +F32 ll_frand(); - ir = FP_ONE | (FP_MASK & ir); - - // generate random float - F32 fr = (*(F32 *)&ir); +/** + *@brief Generate a float from [0, val). + */ +F32 ll_frand(F32 val); - // correct to [0..1) - fr -= 1.f; +/** + *@brief Generate a double from [0, 1.0). + */ +F64 ll_drand(); - fr *= val; +/** + *@brief Generate a double from [0, val). + */ +F64 ll_drand(F64 val); - return fr; - } - -public: - U64 mSeed; -}; +/** + * @brief typedefs for good boost lagged fibonacci. + * @see boost::lagged_fibonacci + * + * These generators will quickly generate doubles. Note the memory + * requirements, because they are somewhat high. I chose the smallest + * one, and one comparable in speed but higher periodicity without + * outrageous memory requirements. + * To use: + * LLRandLagFib607 foo((U32)time(NULL)); + * double bar = foo(); + */ -F32 frand(F32 val); +typedef boost::lagged_fibonacci607 LLRandLagFib607; +/**< + * lengh of cycle: 2^32,000 + * memory: 607*sizeof(double) (about 5K) + */ -extern LLRand gLindenLabRandomNumber; +typedef boost::lagged_fibonacci2281 LLRandLagFib2281; +/**< + * lengh of cycle: 2^120,000 + * memory: 2281*sizeof(double) (about 17K) + */ +/** + * @breif typedefs for a good boost mersenne twister implementation. + * @see boost::mersenne_twister + * + * This fairly quickly generates U32 values + * To use: + * LLRandMT19937 foo((U32)time(NULL)); + * U32 bar = foo(); + * + * lengh of cycle: 2^19,937-1 + * memory: about 2496 bytes + */ +typedef boost::mt11213b LLRandMT19937; #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 ) } */ +#define LL_USE_JANKY_RANDOM_NUMBER_GENERATOR 0 +#if LL_USE_JANKY_RANDOM_NUMBER_GENERATOR +/** + * @brief a global for + */ +static U64 sJankyRandomSeed(LLUUID::getRandomSeed()); + +/** + * @brief generate a random U32. + */ +U32 janky_fast_random_bytes() +{ + sJankyRandomSeed = U64L(1664525) * sJankyRandomSeed + U64L(1013904223); + return (U32)sJankyRandomSeed; +} + +/** + * @brief generate a random U32 from [0, val) + */ +U32 janky_fast_random_byes_range(U32 val) +{ + sJankyRandomSeed = U64L(1664525) * sJankyRandomSeed + U64L(1013904223); + return (U32)(sJankyRandomSeed) % val; +} + +/** + * @brief generate a random U32 from [0, val) + */ +U32 janky_fast_random_seeded_bytes(U32 seed, U32 val) +{ + seed = U64L(1664525) * (U64)(seed) + U64L(1013904223); + return (U32)(seed) % val; +} +#endif // Common to all UUID implementations void LLUUID::toString(char *out) const @@ -395,8 +429,16 @@ static void get_random_bytes(void *buf, int nbytes) int i; char *cp = (char *) buf; + // *NOTE: If we are not using the janky generator ll_rand() + // generates at least 3 good bytes of data since it is 0 to + // RAND_MAX. This could be made more efficient by copying all the + // bytes. for (i=0; i < nbytes; i++) - *cp++ = gLindenLabRandomNumber.llrand() & 0xFF; +#if LL_USE_JANKY_RANDOM_NUMBER_GENERATOR + *cp++ = janky_fast_random_bytes() & 0xFF; +#else + *cp++ = ll_rand() & 0xFF; +#endif return; } @@ -738,18 +780,18 @@ void LLUUID::getCurrentTime(uuid_time_t *timestamp) void LLUUID::generate() { - // Create a UUID. - - - uuid_time_t timestamp; + // Create a UUID. + uuid_time_t timestamp; - static unsigned char node_id[6]; - static int has_init = 0; + static unsigned char node_id[6]; + static int has_init = 0; - // Create a UUID. - static uuid_time_t time_last = {0,0}; - static U16 clock_seq = 0; - static LLRand random_generator(0); // dummy seed. reset it below + // Create a UUID. + static uuid_time_t time_last = {0,0}; + static U16 clock_seq = 0; +#if LL_USE_JANKY_RANDOM_NUMBER_GENERATOR + static U32 seed = 0L; // dummy seed. reset it below +#endif if (!has_init) { if (getNodeID(node_id) <= 0) @@ -764,8 +806,15 @@ void LLUUID::generate() } getCurrentTime(&time_last); - random_generator.seed(time_last.low); - clock_seq = (U16) random_generator.llrand(65536); +#if LL_USE_JANKY_RANDOM_NUMBER_GENERATOR + seed = time_last.low; +#endif + +#if LL_USE_JANKY_RANDOM_NUMBER_GENERATOR + clock_seq = (U16)janky_fast_random_seeded_bytes(seed, 65536); +#else + clock_seq = (U16)ll_rand(65536); +#endif has_init = 1; } 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) { const S32 BUFSIZE = 16384; char buffer[BUFSIZE]; + // *NOTE: changing the size or type of these buffers will require + // changing the sscanf below. char keyword[256]; char valuestr[256]; keyword[0] = 0; @@ -735,7 +737,7 @@ BOOL LLProfileParams::importFile(FILE *fp) while (!feof(fp)) { fgets(buffer, BUFSIZE, fp); - sscanf(buffer, " %s %s", keyword, valuestr); + sscanf(buffer, " %255s %255s", keyword, valuestr); if (!keyword) { continue; @@ -795,6 +797,8 @@ BOOL LLProfileParams::importLegacyStream(std::istream& input_stream) { const S32 BUFSIZE = 16384; char buffer[BUFSIZE]; + // *NOTE: changing the size or type of these buffers will require + // changing the sscanf below. char keyword[256]; char valuestr[256]; keyword[0] = 0; @@ -805,7 +809,7 @@ BOOL LLProfileParams::importLegacyStream(std::istream& input_stream) while (input_stream.good()) { input_stream.getline(buffer, BUFSIZE); - sscanf(buffer, " %s %s", keyword, valuestr); + sscanf(buffer, " %255s %255s", keyword, valuestr); if (!keyword) { continue; @@ -1215,6 +1219,8 @@ BOOL LLPathParams::importFile(FILE *fp) { const S32 BUFSIZE = 16384; char buffer[BUFSIZE]; + // *NOTE: changing the size or type of these buffers will require + // changing the sscanf below. char keyword[256]; char valuestr[256]; keyword[0] = 0; @@ -1227,7 +1233,7 @@ BOOL LLPathParams::importFile(FILE *fp) while (!feof(fp)) { fgets(buffer, BUFSIZE, fp); - sscanf(buffer, " %s %s", keyword, valuestr); + sscanf(buffer, " %255s %255s", keyword, valuestr); if (!keyword) { continue; @@ -1354,6 +1360,8 @@ BOOL LLPathParams::importLegacyStream(std::istream& input_stream) { const S32 BUFSIZE = 16384; char buffer[BUFSIZE]; + // *NOTE: changing the size or type of these buffers will require + // changing the sscanf below. char keyword[256]; char valuestr[256]; keyword[0] = 0; @@ -1366,7 +1374,7 @@ BOOL LLPathParams::importLegacyStream(std::istream& input_stream) while (input_stream.good()) { input_stream.getline(buffer, BUFSIZE); - sscanf(buffer, " %s %s", keyword, valuestr); + sscanf(buffer, " %255s %255s", keyword, valuestr); if (!keyword) { continue; @@ -3340,13 +3348,15 @@ BOOL LLVolumeParams::importFile(FILE *fp) //llinfos << "importing volume" << llendl; const S32 BUFSIZE = 16384; char buffer[BUFSIZE]; + // *NOTE: changing the size or type of this buffer will require + // changing the sscanf below. char keyword[256]; keyword[0] = 0; while (!feof(fp)) { fgets(buffer, BUFSIZE, fp); - sscanf(buffer, " %s", keyword); + sscanf(buffer, " %255s", keyword); if (!keyword) { continue; @@ -3391,6 +3401,8 @@ BOOL LLVolumeParams::importLegacyStream(std::istream& input_stream) { //llinfos << "importing volume" << llendl; const S32 BUFSIZE = 16384; + // *NOTE: changing the size or type of this buffer will require + // changing the sscanf below. char buffer[BUFSIZE]; char keyword[256]; keyword[0] = 0; @@ -3398,7 +3410,7 @@ BOOL LLVolumeParams::importLegacyStream(std::istream& input_stream) while (input_stream.good()) { input_stream.getline(buffer, BUFSIZE); - sscanf(buffer, " %s", keyword); + sscanf(buffer, " %255s", keyword); if (!keyword) { 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) const S32 BUFFER_SIZE = 1024; char buffer[BUFFER_SIZE]; /*Flawfinder: ignore*/ + // *NOTE: These buffer sizes are hardcoded into sscanf() below char id_string[MAX_STRING]; /*Flawfinder: ignore*/ char firstname[MAX_STRING]; /*Flawfinder: ignore*/ char lastname[MAX_STRING]; /*Flawfinder: ignore*/ @@ -293,9 +294,10 @@ void LLCacheName::importFile(FILE* fp) char* valid = fgets(buffer, BUFFER_SIZE, fp); if (!valid) return; + // *NOTE: This buffer size is hardcoded into sscanf() below char version_string[BUFFER_SIZE]; /*Flawfinder: ignore*/ S32 version = 0; - S32 match = sscanf(buffer, "%s %d", version_string, &version); // XXXTBD + S32 match = sscanf(buffer, "%1023s %d", version_string, &version); if ( match != 2 || strcmp(version_string, "version") || version != CN_FILE_VERSION) @@ -314,11 +316,13 @@ void LLCacheName::importFile(FILE* fp) valid = fgets(buffer, BUFFER_SIZE, fp); if (!valid) break; - match = sscanf(buffer, "%s %u %s %s", // XXXTBD - id_string, - &create_time, - firstname, - lastname); + match = sscanf( + buffer, + "%254s %u %254s %254s", + id_string, + &create_time, + firstname, + lastname); if (4 != match) continue; LLUUID id(id_string); @@ -409,7 +413,7 @@ BOOL LLCacheName::getName(const LLUUID& id, char* first, char* last) { //The function signature needs to change to pass in the //length of first and last. - strcpy(first,(frand(1.0f) < HIPPO_PROBABILITY) + strcpy(first,(ll_frand() < HIPPO_PROBABILITY) ? CN_HIPPOS : CN_WAITING); 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) // Need to guarantee that this time is up to date, we may be creating a circuit even though we haven't been // running a message system loop. F64 mt_sec = LLMessageSystem::getMessageTimeSeconds(TRUE); - F32 distribution_offset = frand(1.0f); + F32 distribution_offset = ll_frand(); mPingTime = mt_sec; mLastPingSendTime = mt_sec + PING_INTERVAL * distribution_offset; mLastPingReceivedTime = mt_sec; - mNextPingSendTime = mLastPingSendTime + 0.95*PING_INTERVAL + frand(0.1f*PING_INTERVAL); + mNextPingSendTime = mLastPingSendTime + 0.95*PING_INTERVAL + ll_frand(0.1f*PING_INTERVAL); mPeriodTime = mt_sec; mTimeoutCallback = NULL; @@ -804,7 +804,7 @@ void LLCircuit::updateWatchDogTimers(LLMessageSystem *msgsys) if (cdp->updateWatchDogTimers(msgsys)) { // Randomize our pings a bit by doing some up to 5% early or late - F64 dt = 0.95f*PING_INTERVAL + frand(0.1f*PING_INTERVAL); + F64 dt = 0.95f*PING_INTERVAL + ll_frand(0.1f*PING_INTERVAL); // Remove it, and reinsert it with the new next ping time. // 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) mActualBitsIn += packetp->getSize() * 8; // Fake packet loss - if (mDropPercentage && (frand(100.f) < mDropPercentage)) + if (mDropPercentage && (ll_frand(100.f) < mDropPercentage)) { mPacketsToDrop++; } @@ -221,7 +221,7 @@ S32 LLPacketRing::receivePacket (S32 socket, char *datap) if (packet_size) // did we actually get a packet? { - if (mDropPercentage && (frand(100.f) < mDropPercentage)) + if (mDropPercentage && (ll_frand(100.f) < mDropPercentage)) { mPacketsToDrop++; } 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 void LLPumpIO::pump() { LLMemType m1(LLMemType::MTYPE_IO_PUMP); + LLFastTimer t1(LLFastTimer::FTM_PUMP); //llinfos << "LLPumpIO::pump()" << llendl; // 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( S32 queue; do { + LLFastTimer t2(LLFastTimer::FTM_CURL); code = curl_multi_perform(mDetail->mCurlMulti, &queue); }while((CURLM_CALL_MULTI_PERFORM == code) && (queue > 0) && count--); 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) void continue_file_receive(LLMessageSystem *mesgsys, void **user_data) { #if LL_TEST_XFER_REXMIT - if (frand(1.f) > 0.05f) + if (ll_frand() > 0.05f) { #endif 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 ) } } + void LLMenuItemGL::draw( void ) { // *FIX: This can be optimized by using switches. Want to avoid @@ -4123,7 +4124,7 @@ BOOL LLMenuBarGL::handleAcceleratorKey(KEY key, MASK mask) BOOL LLMenuBarGL::handleKeyHere(KEY key, MASK mask, BOOL called_from_parent) { - if(key == KEY_ALT) + if(key == KEY_ALT && !gKeyboard->getKeyRepeated(key) && LLUI::sConfigGroup->getBOOL("UseAltKeyForMenus")) { mAltKeyTrigger = TRUE; } 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 @@ #include "lldir_linux.h" #include "llerror.h" -#include "llrand.h" // for gLindenLabRandomNumber +#include "llrand.h" #include #include #include @@ -286,8 +286,8 @@ BOOL LLDir_Linux::getNextFileInDir(const std::string &dirname, const std::string // automatically wrap if we've hit the end void LLDir_Linux::getRandomFileInDir(const std::string &dirname, const std::string &mask, std::string &fname) { - U32 num_files; - U32 which_file; + S32 num_files; + S32 which_file; DIR *dirp; dirent *entryp = NULL; @@ -299,7 +299,7 @@ void LLDir_Linux::getRandomFileInDir(const std::string &dirname, const std::stri return; } - which_file = gLindenLabRandomNumber.llrand() % num_files; + which_file = ll_rand(num_files); // llinfos << "Random select file #" << which_file << llendl; 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 & // get a random file in the directory void LLDir_Mac::getRandomFileInDir(const std::string &dirname, const std::string &mask, std::string &fname) { - U32 which_file; + S32 which_file; glob_t g; fname = ""; @@ -300,7 +300,7 @@ void LLDir_Mac::getRandomFileInDir(const std::string &dirname, const std::string if(g.gl_pathc > 0) { - which_file = gLindenLabRandomNumber.llrand() % g.gl_pathc; + which_file = ll_rand(g.gl_pathc); // llinfos << "getRandomFileInDir: returning number " << which_file << ", path is " << g.gl_pathv[which_file] << llendl; // 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 // automatically wrap if we've hit the end void LLDir_Win32::getRandomFileInDir(const std::string &dirname, const std::string &mask, std::string &fname) { - U32 num_files; - U32 which_file; + S32 num_files; + S32 which_file; HANDLE random_search_h; fname = ""; @@ -303,7 +303,7 @@ void LLDir_Win32::getRandomFileInDir(const std::string &dirname, const std::stri return; } - which_file = gLindenLabRandomNumber.llrand() % num_files; + which_file = ll_rand(num_files); // llinfos << "Random select mp3 #" << which_file << llendl; 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() // from being recognized as ATI. if (mGLVendor.substr(0,4) == "ATI ") { + mGLVendorShort = "ATI"; BOOL mobile = FALSE; if (mGLRenderer.find("MOBILITY") != LLString::npos) { @@ -404,6 +405,7 @@ bool LLGLManager::initGL() } else if (mGLVendor.find("NVIDIA ") != LLString::npos) { + mGLVendorShort = "NVIDIA"; mIsNVIDIA = TRUE; if ( mGLRenderer.find("GEFORCE4 MX") != LLString::npos || mGLRenderer.find("GEFORCE2") != LLString::npos @@ -428,9 +430,14 @@ bool LLGLManager::initGL() } else if (mGLVendor.find("INTEL") != LLString::npos) { + mGLVendorShort = "INTEL"; mIsIntel = TRUE; } - + else + { + mGLVendorShort = "MISC"; + } + // This is called here because it depends on the setting of mIsGF2or4MX, and sets up mHasMultitexture. initExtensions(); 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: // In ALL CAPS LLString mGLVendor; + LLString mGLVendorShort; // In ALL CAPS 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() if( mKeyLevel[i] ) { mKeyLevel[i] = FALSE; - mKeyLevelFrameCount[i] = 0; } } 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() { //llinfos << "Key up event missed, resetting" << llendl; mKeyLevel[key] = FALSE; - mKeyLevelFrameCount[key] = 0; } } } 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_ // allow system keys, such as ALT-F4 to be processed by Windows eat_keystroke = FALSE; case WM_KEYDOWN: - if (gDebugWindowProc) - { - llinfos << "Debug WindowProc WM_KEYDOWN " - << " key " << S32(w_param) - << llendl; - } - if (gKeyboard->handleKeyDown(w_param, mask) && eat_keystroke) { - return 0; + if (gDebugWindowProc) + { + llinfos << "Debug WindowProc WM_KEYDOWN " + << " key " << S32(w_param) + << llendl; + } + // lower 15 bits hold key repeat count + S32 key_repeat_count = l_param & 0x7fff; + if (key_repeat_count > 1) + { + KEY translated_key; + gKeyboard->translateKey(w_param, &translated_key); + if (!gKeyboard->getKeyDown(translated_key)) + { + //RN: hack for handling key repeats when we no longer recognize the key as being down + //This is necessary because we sometimes ignore the message queue and use getAsyncKeyState + // to clear key level flags before we've processed all key repeat messages + return 0; + } + } + if(gKeyboard->handleKeyDown(w_param, mask) && eat_keystroke) + { + return 0; + } + // pass on to windows if we didn't handle it + break; } - // pass on to windows if we didn't handle it - break; - case WM_SYSKEYUP: eat_keystroke = FALSE; 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 return retval; } - LLScriptLibData **sortarray = (LLScriptLibData **)new U32[number]; + LLScriptLibData **sortarray = new LLScriptLibData*[number]; LLScriptLibData *temp = src->mListp; while (temp) @@ -290,74 +290,6 @@ inline LLScriptLibData *lsa_bubble_sort(LLScriptLibData *src, S32 stride, S32 as } -inline LLScriptLibData *lsa_randomize(LLScriptLibData *src, S32 stride) -{ - S32 number = src->getListLength(); - - if (number <= 0) - { - return NULL; - } - - if (stride <= 0) - { - stride = 1; - } - - if (number % stride) - { - LLScriptLibData *retval = src->mListp; - src->mListp = NULL; - return retval; - } - - LLScriptLibData **sortarray = (LLScriptLibData **)new U32[number]; - - LLScriptLibData *temp = src->mListp; - S32 i = 0; - while (temp) - { - sortarray[i] = temp; - i++; - temp = temp->mListp; - } - - S32 k, j, s; - - for (k = 0; k < 20; k++) - { - for (i = 0; i < number; i += stride) - { - for (j = i; j < number; j += stride) - { - if (frand(1.f) > 0.5) - { - for (s = 0; s < stride; s++) - { - temp = sortarray[i + s]; - sortarray[i + s] = sortarray[j + s]; - sortarray[j + s] = temp; - } - } - } - } - } - - i = 1; - temp = sortarray[0]; - while (i < number) - { - temp->mListp = sortarray[i++]; - temp = temp->mListp; - } - temp->mListp = NULL; - - src->mListp = NULL; - - LLScriptLibData *ret_value = sortarray[0]; - delete [] sortarray; - - return ret_value; -} +LLScriptLibData* lsa_randomize(LLScriptLibData* src, S32 stride); #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 @@ getListLength(); + if (number <= 0) + { + return NULL; + } + if (stride <= 0) + { + stride = 1; + } + if(number % stride) + { + LLScriptLibData* retval = src->mListp; + src->mListp = NULL; + return retval; + } + S32 buckets = number / stride; + + // Copy everything into a special vector for sorting; + std::vector sort_array; + sort_array.reserve(number); + LLScriptLibData* temp = src->mListp; + while(temp) + { + sort_array.push_back(temp); + temp = temp->mListp; + } + + // We cannot simply call random_shuffle or similar algorithm since + // we need to obey the stride. So, we iterate over what we have + // and swap each with a random other segment. + S32 index = 0; + S32 ii = 0; + for(; ii < number; ii += stride) + { + index = ll_rand(buckets) * stride; + for(S32 jj = 0; jj < stride; ++jj) + { + std::swap(sort_array[ii + jj], sort_array[index + jj]); + } + } + + // copy the pointers back out + ii = 1; + temp = sort_array[0]; + while (ii < number) + { + temp->mListp = sort_array[ii++]; + temp = temp->mListp; + } + temp->mListp = NULL; + + src->mListp = NULL; + + LLScriptLibData* ret_value = sort_array[0]; + return ret_value; +} 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() void LLScriptLibrary::addFunction(LLScriptLibraryFunction *func) { - LLScriptLibraryFunction **temp = (LLScriptLibraryFunction **)new U32[mNextNumber + 1]; + LLScriptLibraryFunction **temp = new LLScriptLibraryFunction*[mNextNumber + 1]; if (mNextNumber) { 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 @@ mBuf.c_str(), "SL Log:%[ ]%[^\r\n]", tmp_space, tmp_sl_name); + sscanf( + db_filep->mBuf.c_str(), + "SL Log:%254[ ]%1023[^\r\n]", + tmp_space, + tmp_sl_name); } else { 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*) char tempDir[PATH_MAX] = ""; FSRef tempDirRef; char temp[PATH_MAX]; + // *NOTE: This buffer length is used in a scanf() below. char deviceNode[1024] = ""; FILE *downloadFile = NULL; OSStatus err; @@ -937,7 +938,7 @@ void *updatethreadproc(void*) if(sub != NULL) { sub += strlen(prefix); - sscanf(sub, "%s", deviceNode); + sscanf(sub, "%1023s", deviceNode); } } 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 @@ /* Localized versions of Info.plist keys */ CFBundleName = "Second Life"; -CFBundleShortVersionString = "Second Life version 1.13.2.12"; -CFBundleGetInfoString = "Second Life version 1.13.2.12, Copyright 2004-2006 Linden Research, Inc."; +CFBundleShortVersionString = "Second Life version 1.13.2.15"; +CFBundleGetInfoString = "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 @@ CFBundleVersion - 1.13.2.12 + 1.13.2.15 CSResourcesFileMapped 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 @@ +initllpython +createLLImageJ2CKDU +destroyLLImageJ2CKDU 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 @@ -LL_PRIVATE { - global: - initllpython; - createLLImageJ2CKDU; - destroyLLImageJ2CKDU; - local: - *; -}; - 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 echo 'Default grid - creating empty gridargs.dat' echo " " > $PACKAGE_NAME/gridargs.dat else - echo "Creating gridargs.dat for package, grid $GRID" - echo "--${GRID} -helperuri http://preview-${GRID}.secondlife.com/helpers/" > $PACKAGE_NAME/gridargs.dat + if [ X$GRID == X'firstlook' ] + then + # firstlook is a special case... it's not really a grid. + echo "Creating gridargs.dat for firstlook" + echo "-settings settings_firstlook.xml" > $PACKAGE_NAME/gridargs.dat + else + echo "Creating gridargs.dat for package, grid $GRID" + echo "-settings settings_beta.xml --${GRID} -helperuri http://preview-${GRID}.secondlife.com/helpers/" > $PACKAGE_NAME/gridargs.dat + fi fi TARBALL=$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() F32 rand_x; F32 rand_y; - if (mWanderTimer.checkExpirationAndReset(frand(MAX_WANDER_TIME))) + if (mWanderTimer.checkExpirationAndReset(ll_frand(MAX_WANDER_TIME))) { // Pick a random spot to wander towards num_regions = gWorldPointer->mActiveRegionList.getLength(); - S32 region_num = llround(frand(1.f) * num_regions); + S32 region_num = llround(ll_frand() * num_regions); rand_region = gWorldPointer->mActiveRegionList.getFirstData(); S32 i = 0; while (i < region_num) @@ -2127,8 +2127,8 @@ void LLAgent::updateWanderTarget() rand_region = gWorldPointer->mActiveRegionList.getNextData(); i++; } - rand_x = frand(rand_region->getWidth()); - rand_y = frand(rand_region->getWidth()); + rand_x = ll_frand(rand_region->getWidth()); + rand_y = ll_frand(rand_region->getWidth()); stopAutoPilot(); startAutoPilotGlobal(rand_region->getPosGlobalFromRegion(LLVector3(rand_x, rand_y, 0.f))); @@ -5687,7 +5687,7 @@ void LLAgent::fidget() // pick a random fidget anim here S32 oldFidget = mCurrentFidget; - mCurrentFidget = gLindenLabRandomNumber.llrand(NUM_AGENT_STAND_ANIMS); + mCurrentFidget = ll_rand(NUM_AGENT_STAND_ANIMS); if (mCurrentFidget != oldFidget) { @@ -5719,7 +5719,7 @@ void LLAgent::fidget() } // calculate next fidget time - mNextFidgetTime = curTime + gLindenLabRandomNumber.llfrand(MAX_FIDGET_TIME - MIN_FIDGET_TIME) + MIN_FIDGET_TIME; + mNextFidgetTime = curTime + ll_frand(MAX_FIDGET_TIME - MIN_FIDGET_TIME) + MIN_FIDGET_TIME; } } } 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() F32 leftRightSpan = 5.0f; - F32 randomSpan = gLindenLabRandomNumber.llfrand( leftRightSpan ); + F32 randomSpan = ll_frand( leftRightSpan ); focusPosition += leftDirection * ( - leftRightSpan * ONE_HALF + randomSpan ); } 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() for (i = current_puff_count; i < target_puff_count; i++) { puff_pos_global = mVOCloudsp->getPositionGlobal(); - F32 x = frand(256.f/CLOUD_GROUPS_PER_EDGE) - 128.f/CLOUD_GROUPS_PER_EDGE; - F32 y = frand(256.f/CLOUD_GROUPS_PER_EDGE) - 128.f/CLOUD_GROUPS_PER_EDGE; - F32 z = frand(CLOUD_HEIGHT_RANGE) - 0.5f*CLOUD_HEIGHT_RANGE; + F32 x = ll_frand(256.f/CLOUD_GROUPS_PER_EDGE) - 128.f/CLOUD_GROUPS_PER_EDGE; + F32 y = ll_frand(256.f/CLOUD_GROUPS_PER_EDGE) - 128.f/CLOUD_GROUPS_PER_EDGE; + F32 z = ll_frand(CLOUD_HEIGHT_RANGE) - 0.5f*CLOUD_HEIGHT_RANGE; puff_pos_global += LLVector3d(x, y, z); mCloudPuffs[i].mPositionGlobal = puff_pos_global; 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() gSavedSettings.declareS32("MenuBarWidth", 410, "", NO_PERSIST ); gSavedSettings.declareF32("MenuAccessKeyTime", 0.25f, "Time (seconds) in which the menu key must be tapped to move focus to the menu bar"); + gSavedSettings.declareBOOL("UseAltKeyForMenus", FALSE, "Access menus via keyboard by tapping Alt"); // Which background overlay to use gSavedSettings.declareS32("MapOverlayIndex", 0, "Currently selected world map type"); 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() while( !feof(file) && (LLStandardBumpmap::sStandardBumpmapCount < (U32)TEM_BUMPMAP_COUNT) ) { + // *NOTE: This buffer size is hard coded into scanf() below. char label[2048] = ""; char bump_file[2048] = ""; - fields_read = fscanf( file, "\n%s %s", label, bump_file); + fields_read = fscanf( file, "\n%2047s %2047s", label, bump_file); if( EOF == fields_read ) { 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); // red (5) magenta (4) static struct ft_display_info ft_display_table[] = { - { LLFastTimer::FTM_FRAME, "Frame", &LLColor4::white, 0 }, - { LLFastTimer::FTM_MESSAGES, " Messages", &LLColor4::grey1, 0 }, - { LLFastTimer::FTM_SLEEP, " Sleep", &LLColor4::grey2, 0 }, - { LLFastTimer::FTM_IDLE, " Idle", &blue0, 0 }, - { LLFastTimer::FTM_INVENTORY, " Inventory Update", &LLColor4::purple6, 1 }, - { LLFastTimer::FTM_AUTO_SELECT, " Open and Select", &LLColor4::red, 0 }, + { LLFastTimer::FTM_FRAME, "Frame", &LLColor4::white, 0 }, + { LLFastTimer::FTM_MESSAGES, " Messages", &LLColor4::grey1, 0 }, + { LLFastTimer::FTM_SLEEP, " Sleep", &LLColor4::grey2, 0 }, + { LLFastTimer::FTM_IDLE, " Idle", &blue0, 0 }, + { LLFastTimer::FTM_PUMP, " Pump", &LLColor4::magenta2, 1 }, + { LLFastTimer::FTM_CURL, " Curl", &LLColor4::magenta3, 0 }, + { LLFastTimer::FTM_INVENTORY, " Inventory Update", &LLColor4::purple6, 1 }, + { LLFastTimer::FTM_AUTO_SELECT, " Open and Select", &LLColor4::red, 0 }, { LLFastTimer::FTM_FILTER, " Filter", &LLColor4::red2, 0 }, { LLFastTimer::FTM_ARRANGE, " Arrange", &LLColor4::red3, 0 }, { LLFastTimer::FTM_REFRESH, " Refresh", &LLColor4::red4, 0 }, { LLFastTimer::FTM_SORT, " Sort", &LLColor4::red5, 0 }, - { LLFastTimer::FTM_RESET_DRAWORDER, " ResetDrawOrder", &LLColor4::pink1, 0 }, - { LLFastTimer::FTM_WORLD_UPDATE, " World Update", &LLColor4::blue1, 1 }, - { LLFastTimer::FTM_UPDATE_MOVE, " Move Objects", &LLColor4::pink2, 0 }, + { LLFastTimer::FTM_RESET_DRAWORDER, " ResetDrawOrder", &LLColor4::pink1, 0 }, + { LLFastTimer::FTM_WORLD_UPDATE, " World Update", &LLColor4::blue1, 1 }, + { LLFastTimer::FTM_UPDATE_MOVE, " Move Objects", &LLColor4::pink2, 0 }, { LLFastTimer::FTM_OCTREE_BALANCE, " Octree Balance", &LLColor4::red3, 0 }, { LLFastTimer::FTM_CULL, " Object Cull", &LLColor4::blue2, 0 }, { LLFastTimer::FTM_CULL_REBOUND, " Rebound", &LLColor4::blue3, 0 }, @@ -281,6 +283,13 @@ BOOL LLFastTimerView::handleMouseDown(S32 x, S32 y, MASK mask) } } } + else if (mask & MASK_ALT) + { + if (mask & MASK_SHIFT) + mSubtractHidden = !mSubtractHidden; + else + mDisplayCalls = !mDisplayCalls; + } else if (mask & MASK_SHIFT) { if (++mDisplayMode > 3) @@ -301,8 +310,8 @@ BOOL LLFastTimerView::handleMouseDown(S32 x, S32 y, MASK mask) mScrollIndex = 0; } } - // RN: for now, pass all mouse events through - return FALSE; + // SJB: Don't pass mouse clicks through the display + return TRUE; } BOOL LLFastTimerView::handleMouseUp(S32 x, S32 y, MASK mask) @@ -359,33 +368,6 @@ BOOL LLFastTimerView::handleScrollWheel(S32 x, S32 y, S32 clicks) return FALSE; } -BOOL LLFastTimerView::handleKey(KEY key, MASK mask, BOOL called_from_parent) -{ - // Otherwise space key gets eaten from the rest of the UI. JC - if (getVisible()) - { - switch (key) - { - case '=': - mDisplayCalls = !mDisplayCalls; - return TRUE; - case '-': - mSubtractHidden = !mSubtractHidden; - return TRUE; - case ' ': - // pause/unpause - LLFastTimer::sPauseHistory = !LLFastTimer::sPauseHistory; - // reset scroll to bottom when unpausing - if (!LLFastTimer::sPauseHistory) - { - mScrollIndex = 0; - } - return TRUE; - } - } - return FALSE; -} - void LLFastTimerView::draw() { LLFastTimer t(LLFastTimer::FTM_RENDER_TIMER); @@ -480,7 +462,7 @@ void LLFastTimerView::draw() LLFontGL::sMonospace->renderUTF8(tdesc, 0, x, y, LLColor4::white, LLFontGL::LEFT, LLFontGL::TOP); y -= (texth + 2); - LLFontGL::sMonospace->renderUTF8("[Right-click to log selected] [= to toggle counts] [- to subtract hidden]", + LLFontGL::sMonospace->renderUTF8("[Right-Click log selected] [ALT-Click toggle counts] [ALT-SHIFT-Click sub hidden]", 0, x, y, LLColor4::white, LLFontGL::LEFT, LLFontGL::TOP); y -= (texth + 2); } @@ -566,7 +548,7 @@ void LLFastTimerView::draw() } else { - U64 ticks = disabled >= 1 ? ticks_sum[0][i] : LLFastTimer::sCountAverage[tidx]; + U64 ticks = ticks_sum[0][i]; ms = (F32)((F64)ticks * iclock_freq); calls = (S32)LLFastTimer::sCallAverage[tidx]; } 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: virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); virtual BOOL handleHover(S32 x, S32 y, MASK mask); virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks); - virtual BOOL handleKey(KEY key, MASK mask, BOOL called_from_parent); virtual void draw(); 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() return TRUE; } -S32 LLFeatureManager::getGPUClass() -{ - return mGPUClass; -} - -S32 LLFeatureManager::loadGPUClass() +void LLFeatureManager::loadGPUClass() { std::string data_path = gDirUtilp->getAppRODataDir(); @@ -313,6 +308,10 @@ S32 LLFeatureManager::loadGPUClass() data_path += GPU_TABLE_FILENAME; + // defaults + mGPUClass = 0; + mGPUString = gGLManager.getRawGLString(); + llifstream file; file.open(data_path.c_str()); @@ -320,7 +319,7 @@ S32 LLFeatureManager::loadGPUClass() if (!file) { llwarns << "Unable to open GPU table: " << data_path << "!" << llendl; - return 0; + return; } std::string renderer = gGLManager.getRawGLString(); @@ -379,14 +378,14 @@ S32 LLFeatureManager::loadGPUClass() { file.close(); llinfos << "GPU is " << label << llendl; - return (S32) strtol(cls, NULL, 10); + mGPUString = label; + mGPUClass = (S32) strtol(cls, NULL, 10); } } file.close(); //flp->dump(); llwarns << "Couldn't match GPU to a class: " << gGLManager.getRawGLString() << llendl; - return 0; } void LLFeatureManager::cleanupFeatureTables() @@ -419,7 +418,7 @@ void LLFeatureManager::initCPUFeatureMasks() void LLFeatureManager::initGraphicsFeatureMasks() { - mGPUClass = loadGPUClass(); + loadGPUClass(); if (mGPUClass >= 0 && mGPUClass < 4) { 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: void maskCurrentList(const char *name); // Mask the current feature list with the named list BOOL loadFeatureTables(); - S32 getGPUClass(); - S32 loadGPUClass(); + S32 getGPUClass() { return mGPUClass; } + std::string& getGPUString() { return mGPUString; } + void cleanupFeatureTables(); S32 getVersion() const { return mTableVersion; } @@ -102,7 +103,9 @@ public: BOOL initPCIFeatureMasks(); void applyRecommendedFeatures(); + protected: + void loadGPUClass(); void initBaseMask(); std::map mMaskList; @@ -110,6 +113,7 @@ protected: S32 mTableVersion; BOOL mSafe; // Reinitialize everything to the "safe" mask S32 mGPUClass; + std::string mGPUString; }; extern 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() end_rot = F_PI * params.getTwist(); } + if (!mVO->mDrawable) + { + return; + } + S32 num_sections = 1 << mSimulateRes; - LLVector3 scale = mVO->mDrawable->getScale(); 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) for(idx = 0,itor = parentChildren->begin();itor!=parentChildren->end();itor++,idx++){ if((*itor)==view)break; } - switch((int)data) + switch((intptr_t)data) { case 0 ://up 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() mPanelLandInfo(NULL), mTabLand(NULL), - mDirty(TRUE), - mLastTool(gToolNull) + mDirty(TRUE) { mAutoFocus = FALSE; LLCallbackMap::map_t factory_map; @@ -949,21 +948,13 @@ void LLFloaterTools::onClickGridOptions(void* data) //floaterp->addDependentFloater(LLFloaterBuildOptions::getInstance(), FALSE); } -void LLFloaterTools::saveLastTool() -{ - mLastTool = gToolMgr->getCurrentTool( MASK_NONE ); -} - void LLFloaterTools::setEditTool(void* tool_pointer) { select_tool(tool_pointer); - if(gFloaterTools && tool_pointer != gToolNull) - { - gFloaterTools->saveLastTool(); - } } void LLFloaterTools::onFocusReceived() { - select_tool(mLastTool); + gCurrentToolset = gBasicToolset; + gCurrentToolset->selectTool(gCurrentToolset->getSelectedTool()); } \ 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: LLPanelLandInfo *mPanelLandInfo; LLTabContainer* mTabLand; - LLTool* mLastTool; private: 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*) { chat = TRUE; } - else if (frand(1.f) > 0.5f) + else if (ll_frand() > 0.5f) { chat = TRUE; } 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) // Generate a random offset for the target point. const F32 SCALE = 0.5f; F32 x, y, z; - x = frand(SCALE) - 0.5f*SCALE; - y = frand(SCALE) - 0.5f*SCALE; - z = frand(SCALE) - 0.5f*SCALE; + x = ll_frand(SCALE) - 0.5f*SCALE; + y = ll_frand(SCALE) - 0.5f*SCALE; + z = ll_frand(SCALE) - 0.5f*SCALE; LLVector3d target_pos_global(mTargetPos); 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( llinfos << "unable to load inventory from: " << filename << llendl; return false; } + // *NOTE: This buffer size is hard coded into scanf() below. char buffer[MAX_STRING]; char keyword[MAX_STRING]; while(!feof(file) && fgets(buffer, MAX_STRING, file)) { - sscanf(buffer, " %s", keyword); + sscanf(buffer, " %254s", keyword); if(0 == strcmp("inv_category", keyword)) { LLPointer 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 LLVector3 arrow_axis; getManipAxis(object, manip, arrow_axis); - LLVector3 origin_dir = grid_origin - gCamera->getOrigin(); - origin_dir.normVec(); - LLVector3 cross = arrow_axis % origin_dir; + LLVector3 cross = arrow_axis % gCamera->getAtAxis(); normal = cross % arrow_axis; normal.normVec(); } 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) return FALSE; } + // *NOTE: Changing the size of these buffers will require changes + // in the scanf below. char id_buffer[MAX_STRING]; char name_buffer[MAX_STRING]; char buffer[MAX_STRING]; @@ -372,7 +374,7 @@ BOOL LLMuteList::loadFromFile(const LLString& filename) id_buffer[0] = '\0'; name_buffer[0] = '\0'; S32 type = 0; - sscanf(buffer, " %d %s %[^|]", &type, id_buffer, name_buffer); + sscanf(buffer, " %d %254s %254[^|]", &type, id_buffer, name_buffer); LLUUID id = LLUUID(id_buffer); LLMute mute(id, name_buffer, (LLMute::EType)type); 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) BOOL LLPanelAvatarClassified::titleIsValid() { LLTabContainerCommon* tabs = LLViewerUICtrlFactory::getTabContainerByName(this, "classified tab"); - for (S32 i = 0; i < tabs->getTabCount(); i++) + if ( tabs ) { - LLPanelClassified* panel = (LLPanelClassified*)tabs->getPanelByIndex(i); - if ( ! panel->titleIsValid() ) + LLPanelClassified* panel = (LLPanelClassified*)tabs->getCurrentPanel(); + if ( panel ) { - return FALSE; - } - } + if ( ! panel->titleIsValid() ) + { + return FALSE; + }; + }; + }; return TRUE; } @@ -1659,7 +1662,8 @@ void LLPanelAvatar::onClickOK(void *userdata) { self->sendAvatarPropertiesUpdate(); - if ( self->mPanelClassified->titleIsValid() ) + LLTabContainerCommon* tabs = LLUICtrlFactory::getTabContainerByName(self,"tab"); + if ( tabs->getCurrentPanel() != self->mPanelClassified ) { self->mPanelClassified->apply(); @@ -1669,6 +1673,19 @@ void LLPanelAvatar::onClickOK(void *userdata) infop->close(); } } + else + { + if ( self->mPanelClassified->titleIsValid() ) + { + self->mPanelClassified->apply(); + + LLFloaterAvatarInfo *infop = LLFloaterAvatarInfo::getInstance(self->mAvatarID); + if (infop) + { + infop->close(); + } + } + } } } 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() gSavedSettings.loadFromFile(gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT,"overrides.xml")); // handle the per account settings setup - strcpy(gPerAccountSettingsFileName, gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, DEFAULT_SETTINGS_FILE).c_str()); + gPerAccountSettingsFileName = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, DEFAULT_SETTINGS_FILE); // per account settings. Set defaults here if not found. If we get a bunch of these, eventually move to a function. 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) // static void LLTexLayerSetBuffer::onTextureUploadComplete(const LLUUID& uuid, void* userdata, S32 result) // StoreAssetData callback (not fixed) { - LLBakedUploadData* baked_upload_data = (LLBakedUploadData*)(U32)userdata; + LLBakedUploadData* baked_upload_data = (LLBakedUploadData*)userdata; LLVOAvatar* avatar = gAgent.getAvatarObject(); 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 LLString gLastRunVersion; LLString gCurrentVersion; -char gSettingsFileName[LL_MAX_PATH]; -char gPerAccountSettingsFileName[LL_MAX_PATH] = ""; +LLString gSettingsFileName; +LLString gPerAccountSettingsFileName; LLFloaterSettingsDebug::LLFloaterSettingsDebug() : LLFloater("Configuration Editor") { 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; extern LLString gLastRunVersion; extern LLString gCurrentVersion; -extern char gSettingsFileName[LL_MAX_PATH]; -extern char gPerAccountSettingsFileName[LL_MAX_PATH]; -extern const char *DEFAULT_SETTINGS_FILE; +extern LLString gSettingsFileName; +extern LLString gPerAccountSettingsFileName; #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 @@ #include "llvfs.h" #include "message.h" #include "lltimer.h" -//#include "vmath.h" // For frand // viewer includes #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() bool LLViewerInventoryCategory::importFileLocal(FILE* fp) { + // *NOTE: This buffer size is hard coded into scanf() below. char buffer[MAX_STRING]; char keyword[MAX_STRING]; char valuestr[MAX_STRING]; @@ -458,7 +459,7 @@ bool LLViewerInventoryCategory::importFileLocal(FILE* fp) while(!feof(fp)) { fgets(buffer, MAX_STRING, fp); - sscanf(buffer, " %s %s", keyword, valuestr); + sscanf(buffer, " %254s %254s", keyword, valuestr); if(!keyword) { continue; @@ -491,7 +492,7 @@ bool LLViewerInventoryCategory::importFileLocal(FILE* fp) { //strcpy(valuestr, buffer + strlen(keyword) + 3); // *NOTE: Not ANSI C, but widely supported. - sscanf(buffer, " %s %[^|]", keyword, valuestr); + sscanf(buffer, " %254s %254[^|]", keyword, valuestr); mName.assign(valuestr); LLString::replaceNonstandardASCII(mName, ' '); 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) FILE *fp; const S32 BUFFER_SIZE = 2048; char buffer[BUFFER_SIZE]; + // *NOTE: This buffer size is hard coded into scanf() below. char mode_string[MAX_STRING]; char key_string[MAX_STRING]; char mask_string[MAX_STRING]; @@ -733,7 +734,7 @@ S32 LLViewerKeyboard::loadBindings(const char *filename) if (buffer[0] == '#' || buffer[0] == '\n') continue; // grab the binding strings - tokens_read = sscanf(buffer, "%s %s %s %s", mode_string, key_string, mask_string, function_string); + tokens_read = sscanf(buffer, "%254s %254s %254s %254s", mode_string, key_string, mask_string, function_string); if (tokens_read == EOF) { 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*) child = root->getNextNamedChild()) { // get object data + // *NOTE: This buffer size is hard coded into scanf() below. char name[255]; // Shape char description[255]; // Description U32 material; // Material @@ -3997,9 +3998,9 @@ void force_import_geometry(void*) child->getAttributeString("PCode", &attribute); pcode = atoi(attribute.c_str()); child->getAttributeString("Shape", &attribute); - sscanf(attribute.c_str(), "%s", name); + sscanf(attribute.c_str(), "%254s", name); child->getAttributeString("Description", &attribute); - sscanf(attribute.c_str(), "%s", description); + sscanf(attribute.c_str(), "%254s", description); child->getAttributeString("Material", &attribute); material = atoi(attribute.c_str()); child->getAttributeString("Scale", &attribute); @@ -4079,6 +4080,7 @@ void force_import_geometry(void*) // read the faces U32 facenumber; LLColor4 color; + // *NOTE: This buffer size is hard coded into scanf() below. char texture[UUID_STR_LENGTH]; LLUUID texid; texid.toString(texture); @@ -4089,7 +4091,7 @@ void force_import_geometry(void*) face->getAttributeString("FaceColor", &attribute); sscanf(attribute, "%d %f %f %f %f", &facenumber, &color.mV[VX], &color.mV[VY], &color.mV[VZ], &color.mV[VW]); face->getAttributeString("Face", &attribute); - sscanf(attribute, "%d %f %f %f %f %f %d %s", &facenumber, &sx, &sy, &ox, &oy, &rot, &bump, texture); + sscanf(attribute, "%d %f %f %f %f %f %d %36s", &facenumber, &sx, &sy, &ox, &oy, &rot, &bump, texture); texid.set(texture); te.setColor(color); te.setBumpShinyFullbright(bump); @@ -5025,7 +5027,7 @@ const char* upload_pick(void* data) LLFilePicker::ELoadFilter type; if(data) { - type = (LLFilePicker::ELoadFilter)((S32)data); + type = (LLFilePicker::ELoadFilter)((intptr_t)data); } else { @@ -5506,7 +5508,8 @@ void upload_new_resource(const LLString& src_filename, std::string name, if (fscanf(in, "LindenResource\nversion %d\n", &version)) { if (2 == version) - { + { + // *NOTE: This buffer size is hard coded into scanf() below. char label[MAX_STRING]; char value[MAX_STRING]; S32 tokens_read; @@ -5514,7 +5517,7 @@ void upload_new_resource(const LLString& src_filename, std::string name, { label[0] = '\0'; value[0] = '\0'; - tokens_read = sscanf(buf, "%s %s\n", label, value); + tokens_read = sscanf(buf, "%254s %254s\n", label, value); llinfos << "got: " << label << " = " << value << llendl; @@ -5930,7 +5933,7 @@ void handle_export_selected( void * ) BOOL menu_check_build_tool( void* user_data ) { - S32 index = (S32) user_data; + S32 index = (intptr_t) user_data; return gCurrentToolset->isToolSelected( index ); } @@ -6223,7 +6226,7 @@ class LLObjectEnableSitOrStand : public view_listener_t { bool new_value = false; LLViewerObject* dest_object = NULL; - if(dest_object = gObjectList.findObject(gLastHitObjectID)) + if((dest_object = gObjectList.findObject(gLastHitObjectID))) { if(dest_object->getPCode() == LL_PCODE_VOLUME) { @@ -8075,7 +8078,7 @@ void handle_debug_avatar_textures(void*) void handle_grab_texture(void* data) { - LLVOAvatar::ETextureIndex index = (LLVOAvatar::ETextureIndex) ((U32) data); + LLVOAvatar::ETextureIndex index = (LLVOAvatar::ETextureIndex)((intptr_t)data); LLVOAvatar* avatar = gAgent.getAvatarObject(); if ( avatar ) { @@ -8166,7 +8169,7 @@ void handle_grab_texture(void* data) BOOL enable_grab_texture(void* data) { - LLVOAvatar::ETextureIndex index = (LLVOAvatar::ETextureIndex) ((U32) data); + LLVOAvatar::ETextureIndex index = (LLVOAvatar::ETextureIndex)((intptr_t)data); LLVOAvatar* avatar = gAgent.getAvatarObject(); if ( avatar ) { 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) && chatter != gAgent.getAvatarObject()) { gAgent.heardChat(chat); - if (gLindenLabRandomNumber.llrand(2) == 0) + if (ll_rand(2) == 0) { gAgent.setLookAt(LOOKAT_TARGET_AUTO_LISTEN, chatter, LLVector3::zero); } 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) if(ifs.good()) { char buffer[MAX_STRING]; + // *NOTE: This buffer size is hard coded into scanf() below. char keyword[MAX_STRING]; if(mInventory) { @@ -2408,7 +2409,7 @@ void LLViewerObject::loadTaskInvFile(const char* filename) while(ifs.good()) { ifs.getline(buffer, MAX_STRING); - sscanf(buffer, " %s", keyword); + sscanf(buffer, " %254s", keyword); if(0 == strcmp("inv_item", keyword)) { LLPointer 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() F32 frac = (F32)sParticleCount/(F32)sMaxParticleCount; frac -= 0.75; frac *= 3.f; - if (frand(1.f) < frac) + if (ll_frand() < frac) { // Skip... return FALSE; @@ -549,9 +549,9 @@ void LLViewerPartSim::updateSimulation() // pain. S32 i; S32 count = mViewerPartSources.count(); - S32 start = (S32)frand((F32)count); + S32 start = (S32)ll_frand((F32)count); S32 dir = 1; - if (frand(1.0) > 0.5f) + if (ll_frand() > 0.5f) { dir = -1; } 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) F32 mvs; do { - part_dir_vector.mV[VX] = frand(2.f) - 1.f; - part_dir_vector.mV[VY] = frand(2.f) - 1.f; - part_dir_vector.mV[VZ] = frand(2.f) - 1.f; + part_dir_vector.mV[VX] = ll_frand(2.f) - 1.f; + part_dir_vector.mV[VY] = ll_frand(2.f) - 1.f; + part_dir_vector.mV[VZ] = ll_frand(2.f) - 1.f; mvs = part_dir_vector.magVecSquared(); } while ((mvs > 1.f) || (mvs < 0.01f)); @@ -223,7 +223,7 @@ void LLViewerPartSourceScript::update(const F32 dt) part_dir_vector.normVec(); part.mPosAgent += mPartSysData.mBurstRadius*part_dir_vector; part.mVelocity = part_dir_vector; - F32 speed = mPartSysData.mBurstSpeedMin + frand(mPartSysData.mBurstSpeedMax - mPartSysData.mBurstSpeedMin); + F32 speed = mPartSysData.mBurstSpeedMin + ll_frand(mPartSysData.mBurstSpeedMax - mPartSysData.mBurstSpeedMin); part.mVelocity *= speed; } else if (mPartSysData.mPattern & LLPartSysData::LL_PART_SRC_PATTERN_ANGLE @@ -242,10 +242,10 @@ void LLViewerPartSourceScript::update(const F32 dt) F32 outerAngle = mPartSysData.mOuterAngle; // generate a random angle within the given space... - F32 angle = innerAngle + frand(outerAngle - innerAngle); + F32 angle = innerAngle + ll_frand(outerAngle - innerAngle); // split which side it will go on randomly... - if (frand(1.0) < 0.5) + if (ll_frand() < 0.5) { angle = -angle; } @@ -256,7 +256,7 @@ void LLViewerPartSourceScript::update(const F32 dt) // If this is a cone pattern, rotate again to create the cone. if (mPartSysData.mPattern & LLPartSysData::LL_PART_SRC_PATTERN_ANGLE_CONE) { - part_dir_vector.rotVec(frand(4*F_PI), 0.0, 0.0, 1.0); + part_dir_vector.rotVec(ll_frand(4*F_PI), 0.0, 0.0, 1.0); } // Only apply this rotation if using the deprecated angles. @@ -276,7 +276,7 @@ void LLViewerPartSourceScript::update(const F32 dt) part.mVelocity = part_dir_vector; - F32 speed = mPartSysData.mBurstSpeedMin + frand(mPartSysData.mBurstSpeedMax - mPartSysData.mBurstSpeedMin); + F32 speed = mPartSysData.mBurstSpeedMin + ll_frand(mPartSysData.mBurstSpeedMax - mPartSysData.mBurstSpeedMin); part.mVelocity *= speed; } else @@ -459,7 +459,7 @@ void LLViewerPartSourceSpiral::update(const F32 dt) part.mLastUpdateTime = 0.f; part.mScale.mV[0] = 0.25f; part.mScale.mV[1] = 0.25f; - part.mParameter = frand(F_TWO_PI); + part.mParameter = ll_frand(F_TWO_PI); gWorldPointer->mPartSim.addPart(part); } @@ -720,7 +720,7 @@ void LLViewerPartSourceChat::update(const F32 dt) part.mLastUpdateTime = 0.f; part.mScale.mV[0] = 0.25f; part.mScale.mV[1] = 0.25f; - part.mParameter = frand(F_TWO_PI); + part.mParameter = ll_frand(F_TWO_PI); gWorldPointer->mPartSim.addPart(part); } 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: const StatAttributes STAT_INFO[LLViewerStats::ST_COUNT] = { - // ST_MOUSELOOK_SECONDS - StatAttributes("Seconds in Mouselook", FALSE, TRUE), + // ST_VERSION + StatAttributes("Version", TRUE, FALSE), // ST_AVATAR_EDIT_SECONDS StatAttributes("Seconds in Edit Appearence", FALSE, TRUE), // ST_TOOLBOX_SECONDS @@ -77,10 +77,10 @@ const StatAttributes STAT_INFO[LLViewerStats::ST_COUNT] = StatAttributes("Object rez count", FALSE, FALSE), // ST_FPS_10_SECONDS StatAttributes("Seconds below 10 FPS", FALSE, TRUE), - // ST_FPS_5_SECONDS - StatAttributes("Seconds below 5 FPS", FALSE, TRUE), // ST_FPS_2_SECONDS StatAttributes("Seconds below 2 FPS", FALSE, TRUE), + // ST_MOUSELOOK_SECONDS + StatAttributes("Seconds in Mouselook", FALSE, TRUE), // ST_FLY_COUNT StatAttributes("Fly count", FALSE, FALSE), // ST_TELEPORT_COUNT @@ -248,10 +248,6 @@ void LLViewerStats::updateFrameStats(const F64 time_diff) { incStat(LLViewerStats::ST_FPS_2_SECONDS, time_diff); } - if (time_diff >= 0.2) - { - incStat(LLViewerStats::ST_FPS_5_SECONDS, time_diff); - } if (time_diff >= 0.125) { 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: // in statTypeToText in llviewerstats.cpp enum EStatType { - ST_MOUSELOOK_SECONDS = 0, + ST_VERSION = 0, ST_AVATAR_EDIT_SECONDS = 1, ST_TOOLBOX_SECONDS = 2, ST_CHAT_COUNT = 3, @@ -108,8 +108,8 @@ public: ST_CREATE_COUNT = 7, ST_REZ_COUNT = 8, ST_FPS_10_SECONDS = 9, - ST_FPS_5_SECONDS = 10, - ST_FPS_2_SECONDS = 11, + ST_FPS_2_SECONDS = 10, + ST_MOUSELOOK_SECONDS = 11, ST_FLY_COUNT = 12, ST_TELEPORT_COUNT = 13, 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) static const F32 UPDATE_TIME = .5f; if (mUpdateLODTimer.hasExpired()) { - mUpdateLODTimer.setTimerExpirySec(UPDATE_TIME * (.75f + frand(0.5f))); + mUpdateLODTimer.setTimerExpirySec(UPDATE_TIME * (.75f + ll_frand(0.5f))); updateJointLODs(); } 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() { if (1) //(i%2 == 0) Uncomment for X blading { - F32 u = sqrt(-2.0f * log(frand(1.0))); - F32 v = 2.0f * F_PI * frand(1.0); + F32 u = sqrt(-2.0f * log(ll_frand())); + F32 v = 2.0f * F_PI * ll_frand(); x = u * sin(v) * GRASS_DISTRIBUTION_SD; y = u * cos(v) * GRASS_DISTRIBUTION_SD; - rot = frand(F_PI); + rot = ll_frand(F_PI); } else { - rot += (F_PI*0.4f + frand(0.2f*F_PI)); + rot += (F_PI*0.4f + ll_frand(0.2f*F_PI)); } exp_x[i] = x; exp_y[i] = y; rot_x[i] = sin(rot); rot_y[i] = cos(rot); - dz_x[i] = frand(GRASS_BLADE_BASE * 0.25f); - dz_y[i] = frand(GRASS_BLADE_BASE * 0.25f); - w_mod[i] = 0.5f + frand(1.f); // Degree to which blade is moved by wind + dz_x[i] = ll_frand(GRASS_BLADE_BASE * 0.25f); + dz_y[i] = ll_frand(GRASS_BLADE_BASE * 0.25f); + w_mod[i] = 0.5f + ll_frand(); // Degree to which blade is moved by wind } } 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) frequency = mSpawnFrequency; // **** Hack! remainingLifetime counts up from negative, to avoid subtracts! - djs - mParticleState[particleNumber].remainingLifetime = -(((mSpawnFrequencyRange * 2.0f)*frand(1.f)) + frequency - mSpawnFrequencyRange); + mParticleState[particleNumber].remainingLifetime = -(((mSpawnFrequencyRange * 2.0f)*ll_frand()) + frequency - mSpawnFrequencyRange); } //Can override later @@ -672,9 +672,9 @@ void LLVOPart::spawnParticle(const U32 particleNumber) mDeadArr[particleNumber] = 0; // not dead yet! //j = pos_offset_i(particleNumber); - mParticleState[particleNumber].position[0] = 2.f*mSpawnRange*(frand(1.f)) - mSpawnRange; - mParticleState[particleNumber].position[1] = 2.f*mSpawnRange*(frand(1.f)) - mSpawnRange; - mParticleState[particleNumber].position[2] = 2.f*mSpawnRange*(frand(1.f)) - mSpawnRange; + mParticleState[particleNumber].position[0] = 2.f*mSpawnRange*(ll_frand()) - mSpawnRange; + mParticleState[particleNumber].position[1] = 2.f*mSpawnRange*(ll_frand()) - mSpawnRange; + mParticleState[particleNumber].position[2] = 2.f*mSpawnRange*(ll_frand()) - mSpawnRange; //mParticleStateArray[j] = (pos_ranges[1] - pos_ranges[0])*(F32)rand()/((F32)RAND_MAX) + pos_ranges[0]; //j++; @@ -687,12 +687,12 @@ void LLVOPart::spawnParticle(const U32 particleNumber) //Create the ranged direction vector first - then rotate by the actual direction and then scale //Creating a random value about 1,0,0 //1. pick a random angle YZ orientation through full circle. - randomUnitValue = (frand(1.f)); + randomUnitValue = (ll_frand()); direction.mV[VY] = sinf(randomUnitValue * 2.0 * F_PI); direction.mV[VZ] = cosf(randomUnitValue * 2.0 * F_PI); //2. pick a rotation to this angle to project into z which is scaled by mSpawnDirectionRange - randomUnitValue = (frand(1.f)); + randomUnitValue = (ll_frand()); randomUnitValue *= mSpawnDirectionRange; direction.mV[VY] = direction.mV[VY] * sinf(randomUnitValue * F_PI); direction.mV[VZ] = direction.mV[VZ] * sinf(randomUnitValue * F_PI); @@ -804,7 +804,7 @@ void LLVOPart::spawnParticle(const U32 particleNumber) //4. scale the vector by a random scale by mSpawnVelocityRange and offset by mSpawnVelocity - randomUnitValue = (frand(1.f)); + randomUnitValue = (ll_frand()); randomUnitValue = (randomUnitValue * mSpawnVelocityRange) + mSpawnVelocity; mParticleState[particleNumber].velocity[0] = direction.mV[VX] * randomUnitValue; @@ -822,16 +822,16 @@ void LLVOPart::spawnParticle(const U32 particleNumber) mParticleState[particleNumber].acceleration[2] = 0.0f; - mParticleState[particleNumber].scale[0] = (mScale_range[1] - mScale_range[0])*frand(1.f) + mScale_range[0]; - mParticleState[particleNumber].scale[1] = (mScale_range[3] - mScale_range[2])*frand(1.f) + mScale_range[2]; + mParticleState[particleNumber].scale[0] = (mScale_range[1] - mScale_range[0])*ll_frand() + mScale_range[0]; + mParticleState[particleNumber].scale[1] = (mScale_range[3] - mScale_range[2])*ll_frand() + mScale_range[2]; mParticleState[particleNumber].scale[2] = 0.0f; - mParticleState[particleNumber].alpha[0] = (mAlpha_range[1] - mAlpha_range[0])*frand(1.f) + mAlpha_range[0]; - mParticleState[particleNumber].alpha[1] = (mAlpha_range[3] - mAlpha_range[2])*frand(1.f) + mAlpha_range[2]; + mParticleState[particleNumber].alpha[0] = (mAlpha_range[1] - mAlpha_range[0])*ll_frand() + mAlpha_range[0]; + mParticleState[particleNumber].alpha[1] = (mAlpha_range[3] - mAlpha_range[2])*ll_frand() + mAlpha_range[2]; mParticleState[particleNumber].alpha[2] = 0.0f; // **** Hack! remainingLifetime counts up from negative, to avoid subtracts! - djs - mParticleState[particleNumber].remainingLifetime = -((mIndividualLifetimeRange*2.0f)*frand(1.f) + mIndividualLifetime - mIndividualLifetimeRange); + mParticleState[particleNumber].remainingLifetime = -((mIndividualLifetimeRange*2.0f)*ll_frand() + mIndividualLifetime - mIndividualLifetimeRange); //rest of the state - 0 for now 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 setNumTEs(1); setTETexture(0, LLUUID::null); mbCanSelect = FALSE; // users can't select particle systems - mDebugColor = LLColor4(frand(1.f), frand(1.f), frand(1.f), 1.f); + mDebugColor = LLColor4(ll_frand(), ll_frand(), ll_frand(), 1.f); } 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() void LLVOSky::updateHaze() { - time_t timer; - time(&timer); - static LLRand WeatherRandomNumber(gmtime(&timer)->tm_mday); + static LLRandLagFib607 weather_generator(LLUUID::getRandomSeed()); if (gSavedSettings.getBOOL("FixedWeather")) { - WeatherRandomNumber.seed(8008135); + weather_generator.seed(8008135); } const F32 fo_upper_bound = 5; const F32 sca_upper_bound = 6; - const F32 fo = 1 + WeatherRandomNumber.llfrand(fo_upper_bound - 1); + const F32 fo = 1 + (F32)weather_generator() *(fo_upper_bound - 1); const static F32 upper = 0.5f / gFastLn.ln(fo_upper_bound); mHaze.setFalloff(fo); - mHaze.setG(WeatherRandomNumber.llfrand(0.0f + upper * gFastLn.ln(fo))); + mHaze.setG((F32)weather_generator() * (0.0f + upper * gFastLn.ln(fo))); LLColor3 sca; const F32 cd = mCloudDensity * 3; F32 min_r = cd - 1; @@ -691,7 +689,7 @@ void LLVOSky::updateHaze() max_r = sca_upper_bound; } - sca.mV[0] = min_r + WeatherRandomNumber.llfrand(max_r - min_r);//frand(6); + sca.mV[0] = min_r + (F32)weather_generator() * (max_r - min_r); min_r = sca.mV[0] - 0.1f; if (min_r < 0) @@ -704,7 +702,7 @@ void LLVOSky::updateHaze() max_r = sca_upper_bound; } - sca.mV[1] = min_r + WeatherRandomNumber.llfrand(max_r - min_r); + sca.mV[1] = min_r + (F32)weather_generator() * (max_r - min_r); min_r = sca.mV[1]; if (min_r < 0) @@ -717,7 +715,7 @@ void LLVOSky::updateHaze() max_r = sca_upper_bound; } - sca.mV[2] = min_r + WeatherRandomNumber.llfrand(max_r - min_r); + sca.mV[2] = min_r + (F32)weather_generator() * (max_r - min_r); sca = AIR_SCA_AVG * sca; 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() U32 i; for (i = 0; i < NUMBER_OF_STARS; i++ ) { - v_p->mV[VX] = frand(1.f) - 0.5f; - v_p->mV[VY] = frand(1.f) - 0.5f; + v_p->mV[VX] = ll_frand() - 0.5f; + v_p->mV[VY] = ll_frand() - 0.5f; // we only want stars on the top half of the dome! - v_p->mV[VZ] = frand(1.f)/2.f; + v_p->mV[VZ] = ll_frand()/2.f; v_p->normVec(); *v_p *= DISTANCE_TO_STARS; - *v_i = llmin((F32)pow(frand(1.f),2.f) + 0.1f, 1.f); - v_c->mV[VRED] = 0.75f + frand(1.f) * 0.25f ; + *v_i = llmin((F32)pow(ll_frand(),2.f) + 0.1f, 1.f); + v_c->mV[VRED] = 0.75f + ll_frand() * 0.25f ; v_c->mV[VGREEN] = 1.f ; - v_c->mV[VBLUE] = 0.75f + frand(1.f) * 0.25f ; + v_c->mV[VBLUE] = 0.75f + ll_frand() * 0.25f ; v_c->mV[VALPHA] = 1.f; v_c->clamp(); v_p++; @@ -179,7 +179,7 @@ void LLVOStars::updateStarColors() sundir_factor = (1 - how_close_to_sun) / sunclose_range; } intensity = *(v_i); - F32 alpha = v_c->mV[VALPHA] + (frand(1.f) - 0.5f) * var * intensity; + F32 alpha = v_c->mV[VALPHA] + (ll_frand() - 0.5f) * var * intensity; if (alpha < min * intensity) { 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() //LLVOTreeNew::sParameters = LLTreeParams(); // initialize an array of random numbers that we'll be using - gLindenLabRandomNumber.seed(0); + LLRandLagFib607 tree_rand; for (i = 0; i < MAX_RAND_NUMS; i++) - sRandNums[i] = gLindenLabRandomNumber.llfrand(1.0); + sRandNums[i] = (F32)tree_rand(); } /* @@ -959,7 +959,8 @@ void LLVOTreeNew::drawTree(LLDrawPool &draw_pool) U8 i, j; // seed the drawtree thing with the object's uuid to make it original but predictable... - gLindenLabRandomNumber.seed(0); + // don't re-seed the process random number generator. bad. + //gLindenLabRandomNumber.seed(0); // reset the rand offsets 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: // return +- negPos static S32 llrand_signed(S32 negPos) { - return (gLindenLabRandomNumber.llrand((U32)negPos * 2) - negPos); + return (ll_rand((U32)negPos * 2) - negPos); }; static S32 llrand_signed(S32 negPos, U32 index) @@ -94,7 +94,7 @@ public: // return +- negPos static F32 llfrand_signed(F32 negPos) { - return (gLindenLabRandomNumber.llfrand(negPos * 2.0f) - negPos); + return (ll_frand(negPos * 2.0f) - negPos); }; static F32 llfrand_signed(F32 negPos, U32 index) @@ -110,7 +110,7 @@ public: // return between 0-pos static F32 llfrand_unsigned(F32 pos) { - return gLindenLabRandomNumber.llfrand(pos); + return ll_frand(pos); }; 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 ) BOOL LLWearable::importFile( FILE* file ) { + // *NOTE: changing the type or size of this buffer will require + // changes in the fscanf() code below. You would be better off + // rewriting this to use streams and not require an open FILE. char text_buffer[2048]; S32 fields_read = 0; @@ -295,7 +298,7 @@ BOOL LLWearable::importFile( FILE* file ) else { ungetc( next_char, file ); - fields_read = fscanf( file, "%[^\n]", text_buffer ); + fields_read = fscanf( file, "%2047[^\n]", text_buffer ); if( (1 != fields_read) || (fgetc( file ) != '\n') ) { llwarns << "Bad Wearable asset: early end of file" << llendl; @@ -315,7 +318,7 @@ BOOL LLWearable::importFile( FILE* file ) else { ungetc( next_char, file ); - fields_read = fscanf( file, "%[^\n]", text_buffer ); + fields_read = fscanf( file, "%2047[^\n]", text_buffer ); if( (1 != fields_read) || (fgetc( file ) != '\n') ) { llwarns << "Bad Wearable asset: early end of file" << llendl; @@ -422,7 +425,7 @@ BOOL LLWearable::importFile( FILE* file ) for( i = 0; i < num_textures; i++ ) { S32 te = 0; - fields_read = fscanf( file, "%d %s\n", &te, text_buffer); + fields_read = fscanf( file, "%d %2047s\n", &te, text_buffer); if( fields_read != 2 ) { 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 ) // don't browse to anything that starts with secondlife:// if ( urlIn.length() >= protocol.length() ) + { if ( LLString::compareInsensitive( urlIn.substr( 0, protocol.length() ).c_str(), protocol.c_str() ) != 0 ) + { LLMozLib::getInstance()->navigateTo( mEmbeddedBrowserWindowId, urlIn ); + } + } + else + { + LLMozLib::getInstance()->navigateTo( mEmbeddedBrowserWindowId, urlIn ); + } } //////////////////////////////////////////////////////////////////////////////// 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 #endif // // LL_LIBXUL_ENABLED -#endif // LL_LLWEBBROWSERCTRL_H \ No newline at end of file +#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 @@ +Release Notes for Second Life 1.13.2(15) January 25, 2007 +===================================== +Changes: +* Tapping Alt to focus on menus has been disabled +* Separate settings.ini file used by Beta and First Look clients +** Uninstalling these clients will no longer remove Second Life user settings + +Bug fixes: +* Alt-mouseclick no longer puts focus on the menus +* Popup warnings for sandbox regions reflect changes made in 1.13.2(11) +* Fixed error while editing profile if you have a classified +* Fixed Buy Pass option in pie menu not appearing unless access list for avatars is enabled +* Fixed build tool not changing type until you use another menu +* Fixed dragging position arrows sideways moves object vertically +* Fixed clicking More/Less in editor selects Create +* Fixed loud noise in wind on dual core systems +* Fixed a client crash + Release Notes for Second Life 1.13.2(12) January 19, 2007 ===================================== Bug 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" // VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,13,2,12 + FILEVERSION 1,13,2,15 PRODUCTVERSION 1,13,2,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG @@ -245,7 +245,7 @@ BEGIN BEGIN VALUE "CompanyName", "Linden Lab" VALUE "FileDescription", "Second Life" - VALUE "FileVersion", "1.13.2.12" + VALUE "FileVersion", "1.13.2.15" VALUE "InternalName", "Second Life" VALUE "LegalCopyright", "Copyright © 2001-2006, Linden Research, Inc." 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 @@ +- *.cpp +- *.c +- *.h +- .svn/ +- CVS/ +- .cvsignore +- .DS_Store +- /app_settings/mozilla/ +- /app_settings/mozilla_debug/ ++ /app_settings/ ++ /character/ ++ /help/ ++ /trial/ ++ /fonts/ ++ /skins/ ++ /cursors_mac/ ++ /featuretable.txt ++ /featuretable_mac.txt ++ /releasenotes.txt ++ /lsl_guide.html ++ /secondlife.icns ++ /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 @@ +@rem Invoke the script which preps then runs the installer. +@rem This batch file is customized per grid. + +set LOGINPAGEURL=http://secondlife.com/app/login/firstlook/ +set ARGS=/DFIRSTLOOK + +@rem To build optional "update" installer (doesn't have static VFS): +@rem +@rem set ARGS=/DUPDATE + +@"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. This is a sandbox region. -Objects you build here may be deleted after you -leave the area, and the region will be wiped -every [HOURS] hours starting at [TIME] AM Pacific Time. +Objects you build here may be deleted after +you 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. Sandbox regions are uncommon, and are marked with signs. 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; BOOL gInitializationComplete = FALSE; // used in windows handlers to determine if OK to call idle() BOOL gAutoLogin = FALSE; -char gOldSettingsFileName[LL_MAX_PATH]; +LLString gOldSettingsFileName; BOOL gPrintMessagesThisFrame = FALSE; const char* DEFAULT_SETTINGS_FILE = "settings.xml"; const char* LEGACY_DEFAULT_SETTINGS_FILE = "settings.ini"; @@ -925,8 +925,8 @@ int main( int argc, char **argv ) // // Set up some defaults... - strcpy(gSettingsFileName, gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, DEFAULT_SETTINGS_FILE).c_str()); - strcpy(gOldSettingsFileName, gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, LEGACY_DEFAULT_SETTINGS_FILE).c_str()); + gSettingsFileName = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, DEFAULT_SETTINGS_FILE); + gOldSettingsFileName = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, LEGACY_DEFAULT_SETTINGS_FILE); gUserServer.setPort(DEFAULT_USER_SERVER_PORT); ///////////////////////////////////////// @@ -4215,7 +4215,7 @@ BOOL add_object( LLPCode pcode, S32 x, S32 y, U8 use_physics ) { case LL_PCODE_LEGACY_GRASS: // Randomize size of grass patch - scale.setVec(10.f + frand(20.f), 10.f + frand(20.f), 1.f + frand(2.f)); + scale.setVec(10.f + ll_frand(20.f), 10.f + ll_frand(20.f), 1.f + ll_frand(2.f)); state = rand() % LLVOGrass::sMaxGrassSpecies; break; @@ -5337,8 +5337,14 @@ void send_stats() gMessageSystem->addU32Fast(_PREHASH_SysRAM, gSysMemory.getPhysicalMemory()); gMessageSystem->addStringFast(_PREHASH_SysOS, gSysOS.getOSString()); gMessageSystem->addStringFast(_PREHASH_SysCPU, gSysCPU.getCPUStringTerse()); + - gMessageSystem->addStringFast(_PREHASH_SysGPU, gGLManager.getRawGLString()); + std::string gpu_desc = llformat("%-6s Class %d ", + gGLManager.mGLVendorShort.substr(0,6).c_str(), + gFeatureManagerp->getGPUClass()) + + gFeatureManagerp->getGPUString(); + + gMessageSystem->addStringFast(_PREHASH_SysGPU, gpu_desc); gMessageSystem->nextBlockFast(_PREHASH_DownloadTotals); gMessageSystem->addU32Fast(_PREHASH_World, gTotalWorldBytes); @@ -5365,6 +5371,14 @@ void send_stats() gMessageSystem->addU32Fast(_PREHASH_OffCircuit, (U32)gMessageSystem->mOffCircuitPackets); gMessageSystem->addU32Fast(_PREHASH_Invalid, (U32)gMessageSystem->mInvalidOnCircuitPackets); + // 1.00.00.000000 + F64 version = + LL_VERSION_MAJOR * 10000000000.0 + + LL_VERSION_MINOR * 100000000.0 + + LL_VERSION_PATCH * 1000000.0 + + LL_VERSION_BUILD; + gViewerStats->setStat(LLViewerStats::ST_VERSION, version); + gViewerStats->addToMessage(); gAgent.sendReliableMessage(); @@ -5596,7 +5610,7 @@ int parse_args(int argc, char **argv) std::string folder(argv[j]); gDirUtilp->setSkinFolder(folder); } - else if (!strcmp(argv[j], "--autologin")) + else if (!strcmp(argv[j], "-autologin") || !strcmp(argv[j], "--autologin")) // keep --autologin for compatibility { gAutoLogin = TRUE; } @@ -5731,8 +5745,9 @@ int parse_args(int argc, char **argv) } else if (!strcmp(argv[j], "-logfile") && (++j < argc)) { + // *NOTE: This buffer size is hard coded into scanf() below. char logfile[256]; - sscanf(argv[j], "%s", logfile); + sscanf(argv[j], "%255s", logfile); llinfos << "Setting log file to " << logfile << llendl; LLFile::remove(logfile); if (!gErrorStream.setFile(logfile)) @@ -5742,7 +5757,7 @@ int parse_args(int argc, char **argv) } else if (!strcmp(argv[j], "-settings") && (++j < argc)) { - strcpy(gSettingsFileName, argv[j]); + gSettingsFileName = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, argv[j]); } else if (!strcmp(argv[j], "-setdefault") && (j + 2 < argc)) { @@ -6475,7 +6490,7 @@ void cleanup_app() // Must do this after all panels have been deleted because panels that have persistent rects // save their rects on delete. gSavedSettings.saveToFile(gSettingsFileName, TRUE); - if (gPerAccountSettingsFileName[0]) + if (!gPerAccountSettingsFileName.empty()) { gSavedPerAccountSettings.saveToFile(gPerAccountSettingsFileName, TRUE); } 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; extern BOOL gInProductionGrid; extern S32 gCrashBehavior; extern bool gVerifySSLCert; - +extern const char* DEFAULT_SETTINGS_FILE; // TODO: Eliminate most of these, move into a globals structure. extern 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 test/lliohttpserver_tut.cpp test/llmime_tut.cpp test/llpipeutil.cpp +test/llrandom_tut.cpp test/llsd_new_tut.cpp test/llsdserialize_tut.cpp test/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 @@ +/** + * @file llrandom_tut.cpp + * @author Phoenix + * @date 2007-01-25 + * + * Copyright (c) 2007-2007, Linden Research, Inc. + * + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlife.com/developers/opensource/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at http://secondlife.com/developers/opensource/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + */ + +#include + +#include "linden_common.h" +#include "llrand.h" +#include "lltut.h" + + +namespace tut +{ + struct random + { + }; + + typedef test_group random_t; + typedef random_t::object random_object_t; + tut::random_t tut_random("random"); + + template<> template<> + void random_object_t::test<1>() + { + F32 number = 0.0f; + for(S32 ii = 0; ii < 100000; ++ii) + { + number = ll_frand(); + ensure("frand >= 0", (number >= 0.0f)); + ensure("frand < 1", (number < 1.0f)); + } + } + + template<> template<> + void random_object_t::test<2>() + { + F32 number = 0.0f; + for(S32 ii = 0; ii < 100000; ++ii) + { + number = ll_frand(2.0f) - 1.0f; + ensure("frand >= 0", (number >= -1.0f)); + ensure("frand < 1", (number <= 1.0f)); + } + } +} 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 @@ RelativePath=".\llpipeutil.cpp"> + + isValid()) { - sscanf((const char *)db_filep->mBuf, "SL Log: %[^\r\n]", tmp_sl_name); + sscanf( + (const char*)db_filep->mBuf, + "SL Log: %255[^\r\n]", + tmp_sl_name); } else { 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 LLEmbeddedBrowserWindow** mBrowserWindowList; }; -#endif // LLMOZLIB_H \ No newline at end of file +#endif // LLMOZLIB_H -- cgit v1.1