From 798d367d54a6c6379ad355bd8345fa40e31e7fe9 Mon Sep 17 00:00:00 2001 From: Jacek Antonelli Date: Sat, 6 Sep 2008 18:24:57 -0500 Subject: Second Life viewer sources 1.21.0-RC --- linden/doc/contributions.txt | 15 + linden/doc/releasenotes-where.txt | 6 +- linden/doc/viewer-changes.txt | 0 linden/etc/message.xml | 28 +- linden/indra/CMakeLists.txt | 102 + linden/indra/SConstruct | 895 --- linden/indra/cmake/00-Common.cmake | 206 + linden/indra/cmake/APR.cmake | 55 + linden/indra/cmake/Audio.cmake | 34 + linden/indra/cmake/BerkeleyDB.cmake | 11 + linden/indra/cmake/Boost.cmake | 49 + linden/indra/cmake/BuildVersion.cmake | 18 + linden/indra/cmake/CARes.cmake | 23 + linden/indra/cmake/CMakeCopyIfDifferent.cmake | 41 + linden/indra/cmake/CSharpMacros.cmake | 142 + linden/indra/cmake/CURL.cmake | 19 + linden/indra/cmake/CommonMiscLibs.cmake | 7 + linden/indra/cmake/CopyBackToSource.cmake | 16 + linden/indra/cmake/CopyWinLibs.cmake | 155 + linden/indra/cmake/DirectX.cmake | 40 + linden/indra/cmake/ELFIO.cmake | 19 + linden/indra/cmake/EXPAT.cmake | 17 + linden/indra/cmake/FMOD.cmake | 64 + linden/indra/cmake/FindAPR.cmake | 94 + linden/indra/cmake/FindBerkeleyDB.cmake | 50 + linden/indra/cmake/FindCARes.cmake | 48 + linden/indra/cmake/FindELFIO.cmake | 48 + linden/indra/cmake/FindGooglePerfTools.cmake | 66 + linden/indra/cmake/FindMono.cmake | 68 + linden/indra/cmake/FindMySQL.cmake | 48 + linden/indra/cmake/FindOpenJPEG.cmake | 50 + linden/indra/cmake/FindSCP.cmake | 40 + linden/indra/cmake/FindXmlRpcEpi.cmake | 48 + linden/indra/cmake/FreeType.cmake | 20 + linden/indra/cmake/GStreamer.cmake | 38 + linden/indra/cmake/GooglePerfTools.cmake | 28 + linden/indra/cmake/JPEG.cmake | 23 + linden/indra/cmake/LLAudio.cmake | 15 + linden/indra/cmake/LLCharacter.cmake | 9 + linden/indra/cmake/LLCommon.cmake | 21 + linden/indra/cmake/LLCrashLogger.cmake | 9 + linden/indra/cmake/LLDatabase.cmake | 13 + linden/indra/cmake/LLImage.cmake | 15 + linden/indra/cmake/LLImageJ2COJ.cmake | 8 + linden/indra/cmake/LLInventory.cmake | 9 + linden/indra/cmake/LLKDU.cmake | 20 + linden/indra/cmake/LLMath.cmake | 9 + linden/indra/cmake/LLMedia.cmake | 15 + linden/indra/cmake/LLMessage.cmake | 22 + linden/indra/cmake/LLPhysics.cmake | 76 + linden/indra/cmake/LLPrimitive.cmake | 9 + linden/indra/cmake/LLRender.cmake | 32 + linden/indra/cmake/LLScene.cmake | 9 + linden/indra/cmake/LLUI.cmake | 9 + linden/indra/cmake/LLVFS.cmake | 13 + linden/indra/cmake/LLWindow.cmake | 43 + linden/indra/cmake/LLXML.cmake | 13 + linden/indra/cmake/LScript.cmake | 16 + linden/indra/cmake/Linking.cmake | 45 + linden/indra/cmake/MonoDeps.cmake | 48 + linden/indra/cmake/MonoEmbed.cmake | 57 + linden/indra/cmake/Mozlib.cmake | 47 + linden/indra/cmake/MySQL.cmake | 23 + linden/indra/cmake/NDOF.cmake | 14 + linden/indra/cmake/OpenGL.cmake | 9 + linden/indra/cmake/OpenJPEG.cmake | 22 + linden/indra/cmake/OpenSSL.cmake | 23 + linden/indra/cmake/PNG.cmake | 13 + linden/indra/cmake/Prebuilt.cmake | 44 + linden/indra/cmake/Python.cmake | 49 + linden/indra/cmake/QuickTime.cmake | 33 + linden/indra/cmake/TemplateCheck.cmake | 14 + linden/indra/cmake/UI.cmake | 64 + linden/indra/cmake/UnixInstall.cmake | 31 + linden/indra/cmake/Variables.cmake | 100 + linden/indra/cmake/ViewerMiscLibs.cmake | 10 + linden/indra/cmake/XmlRpcEpi.cmake | 17 + linden/indra/cmake/ZLIB.cmake | 20 + linden/indra/copy_win_scripts/CMakeLists.txt | 35 + linden/indra/copy_win_scripts/start-client.py | 68 + linden/indra/develop.py | 676 ++ linden/indra/indra_complete/indra_complete.sln | 573 -- linden/indra/indra_complete/indra_complete_vc8.sln | 619 -- linden/indra/indra_complete/indra_complete_vc9.sln | 621 -- linden/indra/lib/python/indra/base/cllsd_test.py | 51 + linden/indra/lib/python/indra/base/config.py | 236 +- linden/indra/lib/python/indra/base/llsd.py | 110 +- linden/indra/lib/python/indra/base/lluuid.py | 32 +- linden/indra/lib/python/indra/ipc/llsdhttp.py | 13 +- linden/indra/lib/python/indra/ipc/mysql_pool.py | 100 +- linden/indra/lib/python/indra/ipc/siesta.py | 402 ++ linden/indra/lib/python/indra/ipc/siesta_test.py | 214 + .../lib/python/indra/util/fastest_elementtree.py | 52 + linden/indra/lib/python/indra/util/llmanifest.py | 217 +- linden/indra/lib/python/indra/util/named_query.py | 7 +- linden/indra/lib/python/indra/util/term.py | 222 + linden/indra/linux_crash_logger/CMakeLists.txt | 68 + linden/indra/linux_crash_logger/files.lst | 3 - .../linux_crash_logger/llcrashloggerlinux.cpp | 2 +- .../indra/linux_crash_logger/llcrashloggerlinux.h | 2 +- linden/indra/llaudio/CMakeLists.txt | 67 + linden/indra/llaudio/audioengine.cpp | 10 +- linden/indra/llaudio/audioengine.h | 10 +- linden/indra/llaudio/audioengine_fmod.cpp | 37 +- linden/indra/llaudio/audioengine_fmod.h | 22 +- linden/indra/llaudio/files.lst | 7 - linden/indra/llaudio/listener_fmod.cpp | 7 - linden/indra/llaudio/listener_fmod.h | 4 - linden/indra/llaudio/llaudio.vcproj | 225 - linden/indra/llaudio/llaudio_vc8.vcproj | 323 - linden/indra/llaudio/llaudio_vc9.vcproj | 324 - linden/indra/llaudio/llaudiodecodemgr.cpp | 22 +- linden/indra/llaudio/vorbisencode.cpp | 26 +- linden/indra/llaudio/vorbisencode.h | 4 +- linden/indra/llcharacter/CMakeLists.txt | 76 + linden/indra/llcharacter/files.lst | 21 - linden/indra/llcharacter/llanimationstates.cpp | 6 +- linden/indra/llcharacter/llanimationstates.h | 2 +- linden/indra/llcharacter/llbvhloader.cpp | 114 +- linden/indra/llcharacter/llbvhloader.h | 64 +- linden/indra/llcharacter/llcharacter.cpp | 16 +- linden/indra/llcharacter/llcharacter.vcproj | 296 - linden/indra/llcharacter/llcharacter_vc8.vcproj | 419 -- linden/indra/llcharacter/llcharacter_vc9.vcproj | 420 -- linden/indra/llcharacter/llgesture.cpp | 18 +- linden/indra/llcharacter/llgesture.h | 2 +- linden/indra/llcharacter/llhandmotion.cpp | 8 +- linden/indra/llcharacter/llhandmotion.h | 4 +- linden/indra/llcharacter/llkeyframemotion.cpp | 33 +- linden/indra/llcharacter/llkeyframemotion.h | 11 +- linden/indra/llcharacter/llkeyframemotionparam.cpp | 8 +- linden/indra/llcharacter/llkeyframewalkmotion.cpp | 14 +- linden/indra/llcharacter/llmotion.h | 4 +- linden/indra/llcharacter/llmotioncontroller.h | 2 +- linden/indra/llcharacter/llmultigesture.cpp | 10 +- linden/indra/llcharacter/llpose.cpp | 2 + linden/indra/llcharacter/llstatemachine.cpp | 2 +- linden/indra/llcharacter/llstatemachine.h | 2 +- linden/indra/llcharacter/llvisualparam.cpp | 4 +- linden/indra/llcharacter/llvisualparam.h | 24 +- linden/indra/llcommon/CMakeLists.txt | 188 + linden/indra/llcommon/files.lst | 49 - linden/indra/llcommon/indra_constants.h | 14 +- linden/indra/llcommon/linden_common.h | 5 +- linden/indra/llcommon/llapp.cpp | 2 + linden/indra/llcommon/llapr.cpp | 24 +- linden/indra/llcommon/llapr.h | 34 +- linden/indra/llcommon/llares.cpp | 805 --- linden/indra/llcommon/llares.h | 572 -- linden/indra/llcommon/llassettype.cpp | 20 +- linden/indra/llcommon/llassettype.h | 6 +- linden/indra/llcommon/llbase64.cpp | 2 +- linden/indra/llcommon/llchat.h | 6 +- linden/indra/llcommon/llcommon.vcproj | 608 -- linden/indra/llcommon/llcommon_vc8.vcproj | 847 --- linden/indra/llcommon/llcommon_vc9.vcproj | 828 --- linden/indra/llcommon/llcrc.cpp | 224 + linden/indra/llcommon/llcrc.h | 73 + linden/indra/llcommon/lldarray.h | 1 - linden/indra/llcommon/lldate.cpp | 2 +- linden/indra/llcommon/llerror.cpp | 44 +- linden/indra/llcommon/llevent.cpp | 2 +- linden/indra/llcommon/llfile.cpp | 88 +- linden/indra/llcommon/llfile.h | 81 +- linden/indra/llcommon/llfixedbuffer.cpp | 2 +- linden/indra/llcommon/llfixedbuffer.h | 2 +- linden/indra/llcommon/llframetimer.cpp | 1 - linden/indra/llcommon/llframetimer.h | 8 +- linden/indra/llcommon/llhash.h | 4 +- linden/indra/llcommon/llheartbeat.cpp | 7 +- linden/indra/llcommon/llindraconfigfile.cpp | 2 +- linden/indra/llcommon/llkeythrottle.h | 110 +- linden/indra/llcommon/llliveappconfig.cpp | 2 +- linden/indra/llcommon/lllivefile.cpp | 2 +- linden/indra/llcommon/lllslconstants.h | 6 + linden/indra/llcommon/llmd5.cpp | 531 ++ linden/indra/llcommon/llmd5.h | 133 + linden/indra/llcommon/llmemory.cpp | 1 - linden/indra/llcommon/llmemtype.h | 1 + linden/indra/llcommon/llpreprocessor.h | 7 +- linden/indra/llcommon/llprocessor.cpp | 4 +- linden/indra/llcommon/llprocessor.h | 2 +- linden/indra/llcommon/llptrskiplist.h | 1 + linden/indra/llcommon/llrand.cpp | 176 + linden/indra/llcommon/llrand.h | 132 + linden/indra/llcommon/llsd.cpp | 28 +- linden/indra/llcommon/llsd.h | 4 +- linden/indra/llcommon/llsdserialize.cpp | 30 +- linden/indra/llcommon/llsdserialize.h | 41 +- linden/indra/llcommon/llsdserialize_xml.cpp | 137 +- linden/indra/llcommon/llsdutil.cpp | 132 +- linden/indra/llcommon/llsdutil.h | 17 +- linden/indra/llcommon/llsecondlifeurls.cpp | 72 +- linden/indra/llcommon/llsecondlifeurls.h | 32 +- linden/indra/llcommon/llstat.cpp | 5 +- linden/indra/llcommon/llstat.h | 8 +- linden/indra/llcommon/llstatenums.h | 3 +- linden/indra/llcommon/llstl.h | 2 + linden/indra/llcommon/llstring.cpp | 292 +- linden/indra/llcommon/llstring.h | 391 +- linden/indra/llcommon/llsys.cpp | 56 +- linden/indra/llcommon/llsys.h | 4 +- linden/indra/llcommon/llthread.cpp | 2 +- linden/indra/llcommon/llthread.h | 2 +- linden/indra/llcommon/lltimer.cpp | 25 +- linden/indra/llcommon/lltimer.h | 37 +- linden/indra/llcommon/lluri.cpp | 2 +- linden/indra/llcommon/lluuid.cpp | 923 +++ linden/indra/llcommon/lluuid.h | 331 + linden/indra/llcommon/llversionserver.h | 6 +- linden/indra/llcommon/llversionviewer.h | 4 +- linden/indra/llcommon/metapropertyt.h | 13 - linden/indra/llcommon/roles_constants.h | 10 + linden/indra/llcommon/stdtypes.h | 2 + linden/indra/llcommon/u64.cpp | 36 +- linden/indra/llcommon/u64.h | 9 +- linden/indra/llcrashlogger/CMakeLists.txt | 35 + linden/indra/llcrashlogger/files.lst | 1 - linden/indra/llcrashlogger/llcrashlogger.cpp | 27 +- linden/indra/llcrashlogger/llcrashlogger.h | 18 +- linden/indra/llimage/CMakeLists.txt | 50 + linden/indra/llimage/files.lst | 9 - linden/indra/llimage/llimage.cpp | 60 +- linden/indra/llimage/llimage.h | 22 +- linden/indra/llimage/llimage.vcproj | 229 - linden/indra/llimage/llimage_vc8.vcproj | 325 - linden/indra/llimage/llimage_vc9.vcproj | 326 - linden/indra/llimage/llimagebmp.cpp | 8 +- linden/indra/llimage/llimagebmp.h | 1 + linden/indra/llimage/llimagedxt.h | 1 + linden/indra/llimage/llimagej2c.cpp | 6 +- linden/indra/llimage/llimagej2c.h | 3 +- linden/indra/llimage/llimagejpeg.cpp | 35 +- linden/indra/llimage/llimagejpeg.h | 9 +- linden/indra/llimage/llimagepng.h | 7 +- linden/indra/llimage/llimagetga.cpp | 37 +- linden/indra/llimage/llimagetga.h | 5 +- linden/indra/llimage/llpngwrapper.cpp | 11 +- linden/indra/llimage/llpngwrapper.h | 6 +- linden/indra/llimagej2coj/CMakeLists.txt | 31 + linden/indra/llimagej2coj/files.lst | 1 - linden/indra/llimagej2coj/llimagej2coj.cpp | 6 +- linden/indra/llimagej2coj/llimagej2coj.vcproj | 161 - linden/indra/llinventory/CMakeLists.txt | 56 + linden/indra/llinventory/files.lst | 11 - linden/indra/llinventory/llinventory.cpp | 228 +- linden/indra/llinventory/llinventory.h | 26 +- linden/indra/llinventory/llinventory.vcproj | 245 - linden/indra/llinventory/llinventory_vc8.vcproj | 347 - linden/indra/llinventory/llinventory_vc9.vcproj | 348 - linden/indra/llinventory/llinventorytype.cpp | 4 +- linden/indra/llinventory/llinventorytype.h | 2 +- linden/indra/llinventory/llnotecard.cpp | 14 +- linden/indra/llinventory/llnotecard.h | 9 +- linden/indra/llinventory/llparcel.cpp | 341 +- linden/indra/llinventory/llparcel.h | 60 +- linden/indra/llinventory/llpermissions.cpp | 42 +- linden/indra/llinventory/llsaleinfo.cpp | 2 +- linden/indra/llinventory/lltransactionflags.cpp | 36 +- linden/indra/llinventory/lltransactionflags.h | 6 +- linden/indra/llmath/CMakeLists.txt | 81 + linden/indra/llmath/files.lst | 25 - linden/indra/llmath/llcamera.h | 5 +- linden/indra/llmath/llcrc.cpp | 224 - linden/indra/llmath/llcrc.h | 73 - linden/indra/llmath/llline.cpp | 2 + linden/indra/llmath/llmath.h | 52 +- linden/indra/llmath/llmath.vcproj | 348 - linden/indra/llmath/llmath_vc8.vcproj | 488 -- linden/indra/llmath/llmath_vc9.vcproj | 489 -- linden/indra/llmath/llmd5.cpp | 531 -- linden/indra/llmath/llmd5.h | 133 - linden/indra/llmath/lloctree.h | 2 +- linden/indra/llmath/llquaternion.cpp | 8 +- linden/indra/llmath/llquaternion.h | 2 +- linden/indra/llmath/llrand.cpp | 176 - linden/indra/llmath/llrand.h | 132 - linden/indra/llmath/llrect.h | 5 +- linden/indra/llmath/llsdutil_math.cpp | 172 + linden/indra/llmath/llsphere.cpp | 2 + linden/indra/llmath/lluuid.cpp | 923 --- linden/indra/llmath/lluuid.h | 330 - linden/indra/llmath/llvolume.cpp | 420 +- linden/indra/llmath/llvolume.h | 100 +- linden/indra/llmath/llvolumemgr.cpp | 7 +- linden/indra/llmath/llvolumemgr.h | 2 +- linden/indra/llmath/v2math.cpp | 1 + linden/indra/llmath/v2math.h | 14 +- linden/indra/llmath/v3color.h | 4 + linden/indra/llmath/v3dmath.cpp | 6 +- linden/indra/llmath/v3dmath.h | 48 +- linden/indra/llmath/v3math.cpp | 80 +- linden/indra/llmath/v3math.h | 5 +- linden/indra/llmath/v4color.cpp | 28 +- linden/indra/llmath/v4color.h | 4 +- linden/indra/llmath/v4coloru.cpp | 8 +- linden/indra/llmath/v4coloru.h | 2 +- linden/indra/llmedia/CMakeLists.txt | 94 + linden/indra/llmedia/files.lst | 11 - linden/indra/llmedia/llmedia.vcproj | 245 - linden/indra/llmedia/llmedia_vc8.vcproj | 323 - linden/indra/llmedia/llmedia_vc9.vcproj | 326 - linden/indra/llmedia/llmediabase.h | 19 - linden/indra/llmedia/llmediaimplexample1.cpp | 2 + linden/indra/llmedia/llmediaimplexample2.cpp | 2 + linden/indra/llmedia/llmediaimplgstreamer.cpp | 30 +- linden/indra/llmedia/llmediaimplgstreamer.h | 12 +- linden/indra/llmedia/llmediaimplgstreamer_syms.cpp | 4 +- .../llmedia/llmediaimplgstreamer_syms_raw.inc | 1 + linden/indra/llmedia/llmediamanager.cpp | 23 +- linden/indra/llmedia/llmediamanager.h | 4 + linden/indra/llmessage/CMakeLists.txt | 191 + linden/indra/llmessage/files.lst | 71 - linden/indra/llmessage/llares.cpp | 804 +++ linden/indra/llmessage/llares.h | 572 ++ linden/indra/llmessage/llassetstorage.cpp | 127 +- linden/indra/llmessage/llassetstorage.h | 25 +- linden/indra/llmessage/llcachename.cpp | 80 +- linden/indra/llmessage/llcachename.h | 6 +- linden/indra/llmessage/llcircuit.cpp | 20 +- linden/indra/llmessage/llcurl.cpp | 60 +- linden/indra/llmessage/llcurl.h | 33 +- linden/indra/llmessage/lldatapacker.cpp | 26 +- linden/indra/llmessage/lldatapacker.h | 8 +- linden/indra/llmessage/lldispatcher.cpp | 3 +- linden/indra/llmessage/llfiltersd2xmlrpc.cpp | 2 +- linden/indra/llmessage/llhost.cpp | 72 +- linden/indra/llmessage/llhost.h | 14 +- linden/indra/llmessage/llhttpassetstorage.cpp | 64 +- linden/indra/llmessage/llhttpassetstorage.h | 18 +- linden/indra/llmessage/llhttpclient.cpp | 111 +- linden/indra/llmessage/llhttpclient.h | 36 +- linden/indra/llmessage/llhttpnode.cpp | 27 + linden/indra/llmessage/llhttpnode.h | 88 +- linden/indra/llmessage/llhttpsender.cpp | 2 +- linden/indra/llmessage/llhttpsender.h | 2 +- linden/indra/llmessage/llinstantmessage.cpp | 26 +- linden/indra/llmessage/llinstantmessage.h | 10 +- linden/indra/llmessage/lliohttpserver.cpp | 52 +- linden/indra/llmessage/lliopipe.cpp | 2 + linden/indra/llmessage/lliopipe.h | 7 +- linden/indra/llmessage/lliosocket.cpp | 8 +- linden/indra/llmessage/lliosocket.h | 4 +- linden/indra/llmessage/llmail.cpp | 27 +- linden/indra/llmessage/llmessage.vcproj | 675 -- linden/indra/llmessage/llmessage_vc8.vcproj | 921 --- linden/indra/llmessage/llmessage_vc9.vcproj | 922 --- linden/indra/llmessage/llmessageconfig.cpp | 19 +- linden/indra/llmessage/llmessagereader.h | 1 + linden/indra/llmessage/llmessagetemplateparser.cpp | 2 +- linden/indra/llmessage/llmessagethrottle.cpp | 4 +- linden/indra/llmessage/llmessagethrottle.h | 4 +- linden/indra/llmessage/llmime.cpp | 6 +- linden/indra/llmessage/llnamevalue.cpp | 2 +- linden/indra/llmessage/llpumpio.cpp | 13 +- linden/indra/llmessage/llpumpio.h | 2 +- linden/indra/llmessage/llregionflags.h | 4 +- linden/indra/llmessage/llsdmessagereader.cpp | 26 +- linden/indra/llmessage/llsdmessagereader.h | 2 + linden/indra/llmessage/llservicebuilder.cpp | 72 +- linden/indra/llmessage/llservicebuilder.h | 15 +- linden/indra/llmessage/lltemplatemessagereader.cpp | 16 +- linden/indra/llmessage/lltemplatemessagereader.h | 2 + linden/indra/llmessage/lltransfersourcefile.cpp | 8 +- linden/indra/llmessage/lltransfersourcefile.h | 2 +- linden/indra/llmessage/lltransfertargetfile.cpp | 4 +- linden/indra/llmessage/lltransfertargetfile.h | 4 +- linden/indra/llmessage/llurlrequest.cpp | 11 +- linden/indra/llmessage/llurlrequest.h | 1 + linden/indra/llmessage/llxfer.cpp | 18 +- linden/indra/llmessage/llxfer.h | 2 +- linden/indra/llmessage/llxfer_file.cpp | 44 +- linden/indra/llmessage/llxfer_file.h | 20 +- linden/indra/llmessage/llxfer_mem.cpp | 9 +- linden/indra/llmessage/llxfer_mem.h | 2 +- linden/indra/llmessage/llxfer_vfile.cpp | 10 +- linden/indra/llmessage/llxfer_vfile.h | 4 +- linden/indra/llmessage/llxfermanager.cpp | 26 +- linden/indra/llmessage/llxfermanager.h | 6 +- linden/indra/llmessage/mean_collision_data.h | 16 +- linden/indra/llmessage/message.cpp | 172 +- linden/indra/llmessage/message.h | 18 +- linden/indra/llmessage/message_prehash.cpp | 3 + linden/indra/llmessage/message_prehash.h | 4 +- linden/indra/llprimitive/CMakeLists.txt | 49 + linden/indra/llprimitive/files.lst | 7 - linden/indra/llprimitive/llmaterialtable.cpp | 29 +- linden/indra/llprimitive/llmaterialtable.h | 20 +- linden/indra/llprimitive/llprimitive.cpp | 65 +- linden/indra/llprimitive/llprimitive.h | 4 +- linden/indra/llprimitive/llprimitive.vcproj | 224 - linden/indra/llprimitive/llprimitive_vc8.vcproj | 319 - linden/indra/llprimitive/llprimitive_vc9.vcproj | 320 - linden/indra/llrender/CMakeLists.txt | 83 + linden/indra/llrender/files.darwin.lst | 1 - linden/indra/llrender/files.lst | 7 - linden/indra/llrender/llcubemap.cpp | 532 ++ linden/indra/llrender/llcubemap.h | 89 + linden/indra/llrender/llfont.h | 8 +- linden/indra/llrender/llfontgl.cpp | 98 +- linden/indra/llrender/llfontgl.h | 50 +- linden/indra/llrender/llgl.cpp | 1763 +++++ linden/indra/llrender/llgl.h | 378 + linden/indra/llrender/llgldbg.cpp | 10 +- linden/indra/llrender/llglheaders.h | 588 ++ linden/indra/llrender/llglimmediate.cpp | 264 + linden/indra/llrender/llglimmediate.h | 97 + linden/indra/llrender/llglslshader.cpp | 823 +++ linden/indra/llrender/llglslshader.h | 139 + linden/indra/llrender/llglstates.h | 302 + linden/indra/llrender/llgltypes.h | 44 + linden/indra/llrender/llimagegl.cpp | 2 +- linden/indra/llrender/llpostprocess.cpp | 574 ++ linden/indra/llrender/llpostprocess.h | 268 + linden/indra/llrender/llrender.cpp | 12 + linden/indra/llrender/llrender.h | 6 +- linden/indra/llrender/llrender.vcproj | 232 - linden/indra/llrender/llrender_vc8.vcproj | 329 - linden/indra/llrender/llrender_vc9.vcproj | 330 - linden/indra/llrender/llrendersphere.cpp | 182 + linden/indra/llrender/llrendersphere.h | 47 + linden/indra/llrender/llrendertarget.cpp | 5 + linden/indra/llrender/llshadermgr.cpp | 513 ++ linden/indra/llrender/llshadermgr.h | 75 + linden/indra/llrender/llvertexbuffer.cpp | 5 + linden/indra/llrender/llvertexbuffer.h | 1 + linden/indra/llui/CMakeLists.txt | 133 + linden/indra/llui/files.lst | 46 - linden/indra/llui/llalertdialog.cpp | 104 +- linden/indra/llui/llalertdialog.h | 69 +- linden/indra/llui/llbutton.cpp | 153 +- linden/indra/llui/llbutton.h | 73 +- linden/indra/llui/llcallbackmap.h | 2 +- linden/indra/llui/llcheckboxctrl.cpp | 42 +- linden/indra/llui/llcheckboxctrl.h | 12 +- linden/indra/llui/llcombobox.cpp | 108 +- linden/indra/llui/llcombobox.h | 30 +- linden/indra/llui/llctrlselectioninterface.cpp | 4 +- linden/indra/llui/llctrlselectioninterface.h | 10 +- linden/indra/llui/lldraghandle.cpp | 24 +- linden/indra/llui/lldraghandle.h | 18 +- linden/indra/llui/llfloater.cpp | 242 +- linden/indra/llui/llfloater.h | 56 +- linden/indra/llui/llfocusmgr.cpp | 12 +- linden/indra/llui/llfocusmgr.h | 6 +- linden/indra/llui/lliconctrl.cpp | 10 +- linden/indra/llui/lliconctrl.h | 10 +- linden/indra/llui/llkeywords.cpp | 63 +- linden/indra/llui/llkeywords.h | 8 +- linden/indra/llui/lllineeditor.cpp | 142 +- linden/indra/llui/lllineeditor.h | 36 +- linden/indra/llui/llmemberlistener.h | 4 +- linden/indra/llui/llmenugl.cpp | 262 +- linden/indra/llui/llmenugl.h | 90 +- linden/indra/llui/llmodaldialog.cpp | 4 +- linden/indra/llui/llmodaldialog.h | 2 +- linden/indra/llui/llmultislider.cpp | 32 +- linden/indra/llui/llmultislider.h | 22 +- linden/indra/llui/llmultisliderctrl.cpp | 64 +- linden/indra/llui/llmultisliderctrl.h | 28 +- linden/indra/llui/llpanel.cpp | 130 +- linden/indra/llui/llpanel.h | 126 +- linden/indra/llui/llradiogroup.cpp | 28 +- linden/indra/llui/llradiogroup.h | 10 +- linden/indra/llui/llresizebar.cpp | 2 +- linden/indra/llui/llresizebar.h | 2 +- linden/indra/llui/llresizehandle.cpp | 2 +- linden/indra/llui/llresizehandle.h | 2 +- linden/indra/llui/llresmgr.cpp | 38 +- linden/indra/llui/llresmgr.h | 12 +- linden/indra/llui/llrootview.cpp | 2 +- linden/indra/llui/llrootview.h | 2 +- linden/indra/llui/llscrollbar.cpp | 28 +- linden/indra/llui/llscrollbar.h | 4 +- linden/indra/llui/llscrollcontainer.cpp | 22 +- linden/indra/llui/llscrollcontainer.h | 8 +- linden/indra/llui/llscrollingpanellist.cpp | 2 +- linden/indra/llui/llscrollingpanellist.h | 4 +- linden/indra/llui/llscrolllistctrl.cpp | 166 +- linden/indra/llui/llscrolllistctrl.h | 53 +- linden/indra/llui/llslider.cpp | 6 +- linden/indra/llui/llslider.h | 4 +- linden/indra/llui/llsliderctrl.cpp | 54 +- linden/indra/llui/llsliderctrl.h | 12 +- linden/indra/llui/llspinctrl.cpp | 63 +- linden/indra/llui/llspinctrl.h | 8 +- linden/indra/llui/llstyle.cpp | 18 +- linden/indra/llui/llstyle.h | 16 +- linden/indra/llui/lltabcontainer.cpp | 141 +- linden/indra/llui/lltabcontainer.h | 26 +- linden/indra/llui/lltextbox.cpp | 28 +- linden/indra/llui/lltextbox.h | 12 +- linden/indra/llui/lltexteditor.cpp | 328 +- linden/indra/llui/lltexteditor.h | 57 +- linden/indra/llui/llui.cpp | 31 +- linden/indra/llui/llui.h | 18 +- linden/indra/llui/llui.vcproj | 446 -- linden/indra/llui/llui_vc8.vcproj | 611 -- linden/indra/llui/llui_vc9.vcproj | 612 -- linden/indra/llui/lluictrl.cpp | 8 +- linden/indra/llui/lluictrl.h | 6 +- linden/indra/llui/lluictrlfactory.cpp | 56 +- linden/indra/llui/lluictrlfactory.h | 22 +- linden/indra/llui/lluistring.cpp | 14 +- linden/indra/llui/lluistring.h | 34 +- linden/indra/llui/lluixmltags.h | 6 +- linden/indra/llui/llview.cpp | 138 +- linden/indra/llui/llview.h | 103 +- linden/indra/llui/llviewborder.cpp | 8 +- linden/indra/llui/llviewborder.h | 2 +- linden/indra/llvfs/CMakeLists.txt | 58 + linden/indra/llvfs/files.linux.lst | 1 - linden/indra/llvfs/files.lst | 5 - linden/indra/llvfs/files.sunos5.lst | 1 - linden/indra/llvfs/files.win32.lst | 1 - linden/indra/llvfs/lldir.cpp | 112 +- linden/indra/llvfs/lldir.h | 11 +- linden/indra/llvfs/lldir_linux.cpp | 22 +- linden/indra/llvfs/lldir_mac.cpp | 11 +- linden/indra/llvfs/lldir_solaris.cpp | 18 +- linden/indra/llvfs/lldir_win32.cpp | 18 +- linden/indra/llvfs/lllfsthread.cpp | 7 +- linden/indra/llvfs/lllfsthread.h | 10 +- linden/indra/llvfs/llvfs.cpp | 112 +- linden/indra/llvfs/llvfs.h | 10 +- linden/indra/llvfs/llvfs.vcproj | 203 - linden/indra/llvfs/llvfs_vc8.vcproj | 295 - linden/indra/llvfs/llvfs_vc9.vcproj | 296 - linden/indra/llvfs/llvfsthread.cpp | 1 - linden/indra/llvfs/llvfsthread.h | 6 +- linden/indra/llwindow/CMakeLists.txt | 147 + linden/indra/llwindow/GL/glh_extensions.h | 207 + linden/indra/llwindow/GL/glh_genext.h | 1671 +++++ linden/indra/llwindow/files.darwin.lst | 2 - linden/indra/llwindow/files.linux.lst | 3 - linden/indra/llwindow/files.lst | 5 - linden/indra/llwindow/files.sunos5.lst | 3 - linden/indra/llwindow/files.win32.lst | 2 - linden/indra/llwindow/lldxhardware.cpp | 4 +- linden/indra/llwindow/lldxhardware.h | 4 +- linden/indra/llwindow/llgl.cpp | 1734 ----- linden/indra/llwindow/llgl.h | 377 - linden/indra/llwindow/llglheaders.h | 597 -- linden/indra/llwindow/llglstates.h | 302 - linden/indra/llwindow/llgltypes.h | 44 - linden/indra/llwindow/llkeyboard.cpp | 27 +- linden/indra/llwindow/llkeyboard.h | 12 +- linden/indra/llwindow/lllogitechlcd.cpp | 296 - linden/indra/llwindow/lllogitechlcd.h | 135 - linden/indra/llwindow/llmousehandler.h | 11 +- linden/indra/llwindow/llwindow.cpp | 20 +- linden/indra/llwindow/llwindow.h | 31 +- linden/indra/llwindow/llwindow.vcproj | 281 - linden/indra/llwindow/llwindow_vc8.vcproj | 395 -- linden/indra/llwindow/llwindow_vc9.vcproj | 398 -- linden/indra/llwindow/llwindowheadless.cpp | 2 +- linden/indra/llwindow/llwindowheadless.h | 10 +- linden/indra/llwindow/llwindowmacosx.cpp | 166 +- linden/indra/llwindow/llwindowmacosx.h | 23 +- linden/indra/llwindow/llwindowmesaheadless.cpp | 7 +- linden/indra/llwindow/llwindowmesaheadless.h | 10 +- linden/indra/llwindow/llwindowsdl.cpp | 169 +- linden/indra/llwindow/llwindowsdl.h | 17 +- linden/indra/llwindow/llwindowwin32.cpp | 150 +- linden/indra/llwindow/llwindowwin32.h | 13 +- linden/indra/llxml/CMakeLists.txt | 36 + linden/indra/llxml/files.lst | 4 - linden/indra/llxml/llcontrol.cpp | 158 +- linden/indra/llxml/llcontrol.h | 126 +- linden/indra/llxml/llxml.vcproj | 191 - linden/indra/llxml/llxml_vc8.vcproj | 279 - linden/indra/llxml/llxml_vc9.vcproj | 280 - linden/indra/llxml/llxmlnode.cpp | 233 +- linden/indra/llxml/llxmlnode.h | 107 +- linden/indra/llxml/llxmlparser.cpp | 14 +- linden/indra/llxml/llxmlparser.h | 2 +- linden/indra/llxml/llxmltree.cpp | 94 +- linden/indra/llxml/llxmltree.h | 20 +- linden/indra/lscript/CMakeLists.txt | 18 + linden/indra/lscript/files.lst | 16 - linden/indra/lscript/lscript_byteconvert.h | 4 +- linden/indra/lscript/lscript_byteformat.h | 18 +- .../indra/lscript/lscript_compile/CMakeLists.txt | 148 + linden/indra/lscript/lscript_compile/bison.bat | 11 + linden/indra/lscript/lscript_compile/indra.l | 42 +- .../lscript/lscript_compile/lscript_bytecode.cpp | 4 +- .../lscript/lscript_compile/lscript_bytecode.h | 4 +- .../lscript/lscript_compile/lscript_compile.vcproj | 227 - .../lscript_compile/lscript_compile_fb.vcproj | 105 - .../lscript_compile/lscript_compile_fb_vc8.vcproj | 131 - .../lscript_compile/lscript_compile_fb_vc9.vcproj | 132 - .../lscript_compile/lscript_compile_ly.vcproj | 110 - .../lscript_compile/lscript_compile_ly_vc8.vcproj | 131 - .../lscript_compile/lscript_compile_vc8.vcproj | 331 - .../lscript_compile/lscript_compile_vc9.vcproj | 332 - .../lscript/lscript_compile/lscript_error.cpp | 14 +- .../indra/lscript/lscript_compile/lscript_error.h | 5 + .../indra/lscript/lscript_compile/lscript_scope.h | 22 +- .../indra/lscript/lscript_compile/lscript_tree.cpp | 1743 +++-- .../indra/lscript/lscript_compile/lscript_tree.h | 16 +- .../lscript/lscript_compile/lscript_typecheck.cpp | 8 +- linden/indra/lscript/lscript_execute.h | 150 +- .../indra/lscript/lscript_execute/CMakeLists.txt | 34 + .../lscript/lscript_execute/lscript_execute.cpp | 985 ++- .../lscript/lscript_execute/lscript_execute.vcproj | 191 - .../lscript_execute/lscript_execute_vc8.vcproj | 279 - .../lscript_execute/lscript_execute_vc9.vcproj | 280 - .../lscript/lscript_execute_mono/assembly.cpp | 74 + linden/indra/lscript/lscript_execute_mono/size.cpp | 182 + linden/indra/lscript/lscript_library.h | 43 +- .../indra/lscript/lscript_library/CMakeLists.txt | 32 + .../lscript/lscript_library/lscript_library.cpp | 48 +- .../lscript/lscript_library/lscript_library.vcproj | 185 - .../lscript_library/lscript_library_vc8.vcproj | 271 - .../lscript_library/lscript_library_vc9.vcproj | 272 - linden/indra/lscript/lscript_rt_interface.h | 6 +- linden/indra/mac_crash_logger/CMakeLists.txt | 79 + linden/indra/mac_crash_logger/llcrashloggermac.cpp | 14 +- linden/indra/mac_crash_logger/llcrashloggermac.h | 2 +- linden/indra/mac_updater/CMakeLists.txt | 82 + linden/indra/mac_updater/MoreFilesX.c | 2 + linden/indra/mac_updater/MoreFilesX.h | 2 + linden/indra/mac_updater/mac_updater.cpp | 14 +- linden/indra/newview/AutoUpdater-Info.plist | 26 - linden/indra/newview/CMakeLists.txt | 1490 ++++ linden/indra/newview/CrashReporter.nib/classes.nib | 8 - linden/indra/newview/CrashReporter.nib/info.nib | 20 - linden/indra/newview/CrashReporter.nib/objects.xib | 69 - .../indra/newview/English.lproj/InfoPlist.strings | 5 +- linden/indra/newview/Info-SecondLife.plist | 2 +- linden/indra/newview/ViewerInstall.cmake | 28 + linden/indra/newview/app_settings/keywords.ini | 3 + linden/indra/newview/app_settings/settings.xml | 207 +- linden/indra/newview/crashreporter-Info.plist | 26 - linden/indra/newview/featuretable.txt | 42 +- linden/indra/newview/featuretable_linux.txt | 145 +- linden/indra/newview/featuretable_mac.txt | 2 + linden/indra/newview/files.lst | 373 - linden/indra/newview/gpu_table.txt | 39 +- .../darwin/firstlook-dmg/Applications-alias.r | 6996 +++++++++++++++++++ .../installers/darwin/firstlook-dmg/_DS_Store | Bin 0 -> 12292 bytes .../darwin/firstlook-dmg/_VolumeIcon.icns | Bin 0 -> 98049 bytes .../installers/darwin/firstlook-dmg/background.jpg | Bin 0 -> 75112 bytes .../newview/installers/darwin/mac_image_DS_Store | Bin 12292 -> 0 bytes .../installers/darwin/mac_image_background.tga | Bin 589868 -> 0 bytes .../newview/installers/darwin/mac_image_hidden | 1 - .../darwin/publicnightly-dmg/Applications-alias.r | 6996 +++++++++++++++++++ .../installers/darwin/publicnightly-dmg/_DS_Store | Bin 0 -> 12292 bytes .../darwin/publicnightly-dmg/_VolumeIcon.icns | Bin 0 -> 98049 bytes .../darwin/publicnightly-dmg/background.jpg | Bin 0 -> 75112 bytes .../darwin/release-dmg/Applications-alias.r | 6996 +++++++++++++++++++ .../installers/darwin/release-dmg/_DS_Store | Bin 0 -> 12292 bytes .../installers/darwin/release-dmg/_VolumeIcon.icns | Bin 0 -> 98049 bytes .../installers/darwin/release-dmg/background.jpg | Bin 0 -> 75112 bytes .../releasecandidate-dmg/Applications-alias.r | 6996 +++++++++++++++++++ .../darwin/releasecandidate-dmg/_DS_Store | Bin 0 -> 12292 bytes .../darwin/releasecandidate-dmg/_VolumeIcon.icns | Bin 0 -> 98049 bytes .../darwin/releasecandidate-dmg/background.jpg | Bin 0 -> 75112 bytes .../installers/windows/installer_template.nsi | 34 +- .../indra/newview/linux_tools/exposed-symbols.txt | 4 - linden/indra/newview/linux_tools/wrapper.sh | 11 + linden/indra/newview/llagent.cpp | 234 +- linden/indra/newview/llagent.h | 35 +- linden/indra/newview/llagentlanguage.cpp | 65 + linden/indra/newview/llagentlanguage.h | 45 + linden/indra/newview/llagentpilot.cpp | 31 +- linden/indra/newview/llagentpilot.h | 4 +- linden/indra/newview/llanimstatelabels.cpp | 4 +- linden/indra/newview/llappviewer.cpp | 418 +- linden/indra/newview/llappviewer.h | 25 +- linden/indra/newview/llappviewerlinux.cpp | 44 +- linden/indra/newview/llappviewermacosx.cpp | 128 +- linden/indra/newview/llappviewerwin32.cpp | 27 +- linden/indra/newview/llassetuploadqueue.cpp | 216 + linden/indra/newview/llassetuploadqueue.h | 96 + linden/indra/newview/llassetuploadresponders.cpp | 132 +- linden/indra/newview/llassetuploadresponders.h | 23 +- linden/indra/newview/llcallingcard.cpp | 10 +- linden/indra/newview/llcallingcard.h | 2 +- linden/indra/newview/llcaphttpsender.cpp | 2 +- linden/indra/newview/llcaphttpsender.h | 2 +- linden/indra/newview/llchatbar.cpp | 81 +- linden/indra/newview/llchatbar.h | 2 +- linden/indra/newview/llcolorswatch.cpp | 12 +- linden/indra/newview/llcommandlineparser.cpp | 26 +- linden/indra/newview/llcommandlineparser.h | 8 +- linden/indra/newview/llcompass.h | 4 - linden/indra/newview/llcompilequeue.cpp | 321 +- linden/indra/newview/llcompilequeue.h | 44 +- linden/indra/newview/llconfirmationmanager.cpp | 6 +- linden/indra/newview/llconsole.cpp | 366 +- linden/indra/newview/llconsole.h | 85 +- linden/indra/newview/llcontainerview.cpp | 2 +- linden/indra/newview/llcontainerview.h | 4 +- linden/indra/newview/llcubemap.cpp | 539 -- linden/indra/newview/llcubemap.h | 87 - linden/indra/newview/llcurrencyuimanager.cpp | 5 +- linden/indra/newview/llcurrencyuimanager.h | 2 +- linden/indra/newview/lldebugmessagebox.cpp | 22 +- linden/indra/newview/lldebugmessagebox.h | 4 +- linden/indra/newview/lldebugview.cpp | 2 +- linden/indra/newview/lldelayedgestureerror.cpp | 4 +- linden/indra/newview/lldelayedgestureerror.h | 4 +- linden/indra/newview/lldirpicker.cpp | 24 +- linden/indra/newview/lldirpicker.h | 9 +- linden/indra/newview/lldrawable.cpp | 88 +- linden/indra/newview/lldrawable.h | 2 - linden/indra/newview/lldrawpoolalpha.cpp | 4 +- linden/indra/newview/lldrawpoolavatar.cpp | 59 +- linden/indra/newview/lldrawpoolbump.cpp | 35 +- linden/indra/newview/lldrawpoolbump.h | 4 +- linden/indra/newview/lldrawpoolground.cpp | 4 +- linden/indra/newview/lldrawpoolsimple.cpp | 10 +- linden/indra/newview/lldrawpoolsky.cpp | 4 +- linden/indra/newview/lldrawpoolterrain.cpp | 24 +- linden/indra/newview/lldrawpooltree.cpp | 4 +- linden/indra/newview/lldrawpoolwater.cpp | 52 +- linden/indra/newview/lldrawpoolwlsky.cpp | 5 +- linden/indra/newview/llemote.h | 2 - linden/indra/newview/lleventinfo.cpp | 57 +- linden/indra/newview/lleventinfo.h | 5 +- linden/indra/newview/lleventnotifier.cpp | 7 +- linden/indra/newview/lleventnotifier.h | 4 +- linden/indra/newview/llface.cpp | 243 +- linden/indra/newview/llface.h | 3 +- linden/indra/newview/llfasttimerview.cpp | 24 +- linden/indra/newview/llfeaturemanager.cpp | 56 +- linden/indra/newview/llfeaturemanager.h | 35 +- linden/indra/newview/llfilepicker.cpp | 563 +- linden/indra/newview/llfilepicker.h | 45 +- linden/indra/newview/llfirstuse.cpp | 23 +- linden/indra/newview/llfirstuse.h | 4 +- linden/indra/newview/llfloaterabout.cpp | 125 +- linden/indra/newview/llfloateractivespeakers.cpp | 97 +- linden/indra/newview/llfloateractivespeakers.h | 12 +- linden/indra/newview/llfloateranimpreview.cpp | 45 +- linden/indra/newview/llfloateranimpreview.h | 4 +- linden/indra/newview/llfloaterauction.cpp | 16 +- linden/indra/newview/llfloateravatarinfo.cpp | 29 +- linden/indra/newview/llfloateravatarinfo.h | 2 + linden/indra/newview/llfloateravatarpicker.cpp | 24 +- linden/indra/newview/llfloateravatartextures.cpp | 4 +- linden/indra/newview/llfloateravatartextures.h | 2 +- linden/indra/newview/llfloaterbuildoptions.cpp | 2 +- linden/indra/newview/llfloaterbump.cpp | 9 +- linden/indra/newview/llfloaterbuy.cpp | 18 +- linden/indra/newview/llfloaterbuy.h | 2 + linden/indra/newview/llfloaterbuycontents.cpp | 8 +- linden/indra/newview/llfloaterbuycurrency.cpp | 10 +- linden/indra/newview/llfloaterbuyland.cpp | 46 +- linden/indra/newview/llfloatercamera.cpp | 23 +- linden/indra/newview/llfloaterchat.cpp | 34 +- linden/indra/newview/llfloaterchat.h | 2 +- linden/indra/newview/llfloaterclothing.cpp | 14 +- linden/indra/newview/llfloatercolorpicker.cpp | 12 +- linden/indra/newview/llfloatercustomize.cpp | 128 +- linden/indra/newview/llfloatercustomize.h | 3 +- linden/indra/newview/llfloaterdaycycle.cpp | 52 +- linden/indra/newview/llfloaterdaycycle.h | 10 +- linden/indra/newview/llfloaterdirectory.cpp | 8 +- linden/indra/newview/llfloatereditui.cpp | 40 +- linden/indra/newview/llfloaterenvsettings.cpp | 6 +- linden/indra/newview/llfloaterenvsettings.h | 2 +- linden/indra/newview/llfloaterfriends.cpp | 141 +- linden/indra/newview/llfloaterfriends.h | 12 +- linden/indra/newview/llfloatergesture.cpp | 24 +- linden/indra/newview/llfloatergodtools.cpp | 42 +- linden/indra/newview/llfloatergodtools.h | 12 +- linden/indra/newview/llfloatergroupinfo.cpp | 14 +- linden/indra/newview/llfloatergroupinfo.h | 14 +- linden/indra/newview/llfloatergroupinvite.cpp | 5 +- linden/indra/newview/llfloatergroups.cpp | 6 +- linden/indra/newview/llfloaterhardwaresettings.cpp | 2 +- linden/indra/newview/llfloaterhtml.cpp | 15 +- linden/indra/newview/llfloaterhtml.h | 4 +- linden/indra/newview/llfloaterhtmlhelp.cpp | 91 +- linden/indra/newview/llfloaterhud.cpp | 21 +- linden/indra/newview/llfloaterhud.h | 23 +- linden/indra/newview/llfloaterimagepreview.cpp | 31 +- linden/indra/newview/llfloaterimagepreview.h | 6 +- linden/indra/newview/llfloaterinspect.cpp | 8 +- linden/indra/newview/llfloaterjoystick.cpp | 2 +- linden/indra/newview/llfloaterlagmeter.cpp | 18 +- linden/indra/newview/llfloaterlagmeter.h | 2 +- linden/indra/newview/llfloaterland.cpp | 169 +- linden/indra/newview/llfloaterland.h | 2 +- linden/indra/newview/llfloaterlandholdings.cpp | 30 +- linden/indra/newview/llfloaterlandholdings.h | 2 +- linden/indra/newview/llfloaterlandmark.cpp | 6 +- linden/indra/newview/llfloaterlandmark.h | 6 +- linden/indra/newview/llfloatermap.cpp | 6 +- linden/indra/newview/llfloatermemleak.cpp | 265 + linden/indra/newview/llfloatermemleak.h | 89 + linden/indra/newview/llfloatermute.cpp | 18 +- linden/indra/newview/llfloatermute.h | 2 +- linden/indra/newview/llfloaternamedesc.cpp | 33 +- linden/indra/newview/llfloaternamedesc.h | 4 +- linden/indra/newview/llfloaternewim.cpp | 6 +- linden/indra/newview/llfloateropenobject.cpp | 6 +- linden/indra/newview/llfloaterpermissionsmgr.cpp | 17 +- linden/indra/newview/llfloaterpermissionsmgr.h | 2 +- linden/indra/newview/llfloaterpostcard.cpp | 14 +- linden/indra/newview/llfloaterpostcard.h | 2 +- linden/indra/newview/llfloaterpostprocess.cpp | 2 +- linden/indra/newview/llfloaterpreference.cpp | 29 +- linden/indra/newview/llfloaterpreference.h | 10 +- linden/indra/newview/llfloaterproperties.cpp | 8 +- linden/indra/newview/llfloaterregioninfo.cpp | 329 +- linden/indra/newview/llfloaterregioninfo.h | 35 +- linden/indra/newview/llfloaterreleasemsg.cpp | 174 - linden/indra/newview/llfloaterreleasemsg.h | 59 - linden/indra/newview/llfloaterreporter.cpp | 51 +- linden/indra/newview/llfloaterreporter.h | 8 +- linden/indra/newview/llfloaterscriptdebug.cpp | 14 +- linden/indra/newview/llfloaterscriptdebug.h | 2 +- linden/indra/newview/llfloatersellland.cpp | 22 +- linden/indra/newview/llfloatersettingsdebug.cpp | 38 +- linden/indra/newview/llfloatersnapshot.cpp | 636 +- linden/indra/newview/llfloatersnapshot.h | 19 +- linden/indra/newview/llfloaterstats.cpp | 8 +- linden/indra/newview/llfloaterstats.h | 2 +- linden/indra/newview/llfloatertelehub.cpp | 13 +- linden/indra/newview/llfloatertelehub.h | 2 +- linden/indra/newview/llfloatertest.cpp | 94 +- linden/indra/newview/llfloatertools.cpp | 53 +- linden/indra/newview/llfloatertools.h | 2 + linden/indra/newview/llfloatertopobjects.cpp | 52 +- linden/indra/newview/llfloatertopobjects.h | 4 +- linden/indra/newview/llfloatertos.cpp | 58 +- linden/indra/newview/llfloatertos.h | 2 +- linden/indra/newview/llfloaterurlentry.cpp | 2 +- .../indra/newview/llfloatervoicedevicesettings.cpp | 6 +- linden/indra/newview/llfloaterwater.cpp | 38 +- linden/indra/newview/llfloaterwater.h | 4 +- linden/indra/newview/llfloaterwindlight.cpp | 86 +- linden/indra/newview/llfloaterwindlight.h | 4 +- linden/indra/newview/llfloaterworldmap.cpp | 69 +- linden/indra/newview/llfloaterworldmap.h | 14 +- linden/indra/newview/llfolderview.cpp | 190 +- linden/indra/newview/llfolderview.h | 87 +- linden/indra/newview/llfollowcam.cpp | 1 + linden/indra/newview/llfollowcam.h | 2 - linden/indra/newview/llframestats.cpp | 18 +- linden/indra/newview/llframestats.h | 10 +- linden/indra/newview/llframestatview.cpp | 10 +- linden/indra/newview/llframestatview.h | 4 +- linden/indra/newview/llgenepool.cpp | 7 +- linden/indra/newview/llgesturemgr.cpp | 22 +- linden/indra/newview/llgivemoney.cpp | 28 +- linden/indra/newview/llgivemoney.h | 6 +- linden/indra/newview/llglsandbox.cpp | 43 +- linden/indra/newview/llglslshader.cpp | 2310 ------- linden/indra/newview/llglslshader.h | 420 -- linden/indra/newview/llgroupmgr.cpp | 81 +- linden/indra/newview/llgroupmgr.h | 2 +- linden/indra/newview/llgroupnotify.cpp | 98 +- linden/indra/newview/llgroupnotify.h | 36 +- linden/indra/newview/llhippo.cpp | 70 - linden/indra/newview/llhippo.h | 37 - linden/indra/newview/llhoverview.cpp | 21 +- linden/indra/newview/llhoverview.h | 5 +- linden/indra/newview/llhudeffectlookat.cpp | 18 +- linden/indra/newview/llhudobject.h | 2 + linden/indra/newview/llhudrender.cpp | 1 + linden/indra/newview/llhudtext.cpp | 19 +- linden/indra/newview/llhudtext.h | 3 + linden/indra/newview/llimpanel.cpp | 235 +- linden/indra/newview/llimpanel.h | 44 +- linden/indra/newview/llimview.cpp | 111 +- linden/indra/newview/llimview.h | 24 +- linden/indra/newview/llinventoryactions.cpp | 36 +- linden/indra/newview/llinventorybridge.cpp | 375 +- linden/indra/newview/llinventorybridge.h | 106 +- linden/indra/newview/llinventorymodel.cpp | 135 +- linden/indra/newview/llinventorymodel.h | 22 +- linden/indra/newview/llinventoryview.cpp | 162 +- linden/indra/newview/llinventoryview.h | 51 +- linden/indra/newview/lljoystickbutton.cpp | 50 +- linden/indra/newview/lljoystickbutton.h | 16 +- linden/indra/newview/lllcd.cpp | 703 -- linden/indra/newview/lllcd.h | 113 - linden/indra/newview/lllogchat.cpp | 37 +- linden/indra/newview/lllogchat.h | 12 +- linden/indra/newview/llmanip.cpp | 53 +- linden/indra/newview/llmanip.h | 7 +- linden/indra/newview/llmaniprotate.cpp | 121 +- linden/indra/newview/llmaniprotate.h | 3 - linden/indra/newview/llmanipscale.cpp | 40 +- linden/indra/newview/llmanipscale.h | 2 - linden/indra/newview/llmaniptranslate.cpp | 52 +- linden/indra/newview/llmaniptranslate.h | 2 - linden/indra/newview/llmediaremotectrl.cpp | 14 +- linden/indra/newview/llmediaremotectrl.h | 2 +- linden/indra/newview/llmemoryview.cpp | 1 + linden/indra/newview/llmimetypes.cpp | 48 +- linden/indra/newview/llmimetypes.h | 42 +- linden/indra/newview/llmoveview.cpp | 2 +- linden/indra/newview/llmutelist.cpp | 78 +- linden/indra/newview/llmutelist.h | 22 +- linden/indra/newview/llnamebox.cpp | 24 +- linden/indra/newview/llnamebox.h | 7 +- linden/indra/newview/llnameeditor.cpp | 26 +- linden/indra/newview/llnameeditor.h | 7 +- linden/indra/newview/llnamelistctrl.cpp | 52 +- linden/indra/newview/llnamelistctrl.h | 15 +- linden/indra/newview/llnetmap.cpp | 36 +- linden/indra/newview/llnetmap.h | 2 +- linden/indra/newview/llnotify.cpp | 72 +- linden/indra/newview/llnotify.h | 44 +- linden/indra/newview/lloverlaybar.cpp | 22 +- linden/indra/newview/lloverlaybar.h | 1 - linden/indra/newview/llpanelaudiovolume.cpp | 2 +- linden/indra/newview/llpanelavatar.cpp | 213 +- linden/indra/newview/llpanelavatar.h | 21 +- linden/indra/newview/llpanelclassified.cpp | 68 +- linden/indra/newview/llpanelclassified.h | 10 +- linden/indra/newview/llpanelcontents.cpp | 4 +- linden/indra/newview/llpaneldebug.cpp | 66 +- linden/indra/newview/llpaneldirbrowser.cpp | 82 +- linden/indra/newview/llpaneldirbrowser.h | 11 +- linden/indra/newview/llpaneldirclassified.cpp | 2 +- linden/indra/newview/llpaneldirclassified.h | 2 +- linden/indra/newview/llpaneldirevents.cpp | 6 +- linden/indra/newview/llpaneldirfind.cpp | 14 +- linden/indra/newview/llpaneldirpeople.cpp | 2 +- linden/indra/newview/llpaneldirplaces.cpp | 14 +- linden/indra/newview/llpaneldirplaces.h | 2 +- linden/indra/newview/llpaneldisplay.cpp | 23 +- linden/indra/newview/llpaneldisplay.h | 2 +- linden/indra/newview/llpanelevent.cpp | 4 +- linden/indra/newview/llpanelgeneral.cpp | 2 +- linden/indra/newview/llpanelgeneral.h | 4 +- linden/indra/newview/llpanelgroup.cpp | 30 +- linden/indra/newview/llpanelgroup.h | 22 +- linden/indra/newview/llpanelgroupgeneral.cpp | 28 +- linden/indra/newview/llpanelgroupgeneral.h | 4 +- linden/indra/newview/llpanelgroupinvite.cpp | 10 +- linden/indra/newview/llpanelgrouplandmoney.cpp | 149 +- linden/indra/newview/llpanelgrouplandmoney.h | 4 +- linden/indra/newview/llpanelgroupnotices.cpp | 45 +- linden/indra/newview/llpanelgroupnotices.h | 14 +- linden/indra/newview/llpanelgrouproles.cpp | 63 +- linden/indra/newview/llpanelgrouproles.h | 26 +- linden/indra/newview/llpanelgroupvoting.cpp | 107 +- linden/indra/newview/llpanelgroupvoting.h | 4 +- linden/indra/newview/llpanelinventory.cpp | 168 +- linden/indra/newview/llpanelinventory.h | 8 +- linden/indra/newview/llpanelland.cpp | 4 +- linden/indra/newview/llpanellandmedia.cpp | 36 +- linden/indra/newview/llpanellandmedia.h | 6 +- linden/indra/newview/llpanellogin.cpp | 95 +- linden/indra/newview/llpanellogin.h | 12 +- linden/indra/newview/llpanelmsgs.cpp | 6 +- linden/indra/newview/llpanelnetwork.cpp | 12 +- linden/indra/newview/llpanelobject.cpp | 109 +- linden/indra/newview/llpanelobject.h | 10 +- linden/indra/newview/llpanelpermissions.cpp | 203 +- linden/indra/newview/llpanelpick.cpp | 42 +- linden/indra/newview/llpanelpick.h | 2 +- linden/indra/newview/llpanelplace.cpp | 48 +- linden/indra/newview/llpanelplace.h | 2 + linden/indra/newview/llpanelvolume.cpp | 2 +- linden/indra/newview/llpanelweb.h | 2 +- linden/indra/newview/llpolymesh.cpp | 28 +- linden/indra/newview/llpolymesh.h | 12 +- linden/indra/newview/llpolymorph.cpp | 16 +- linden/indra/newview/llpolymorph.h | 13 +- linden/indra/newview/llpostprocess.cpp | 567 -- linden/indra/newview/llpostprocess.h | 268 - linden/indra/newview/llprefschat.cpp | 9 +- linden/indra/newview/llprefsim.cpp | 38 +- linden/indra/newview/llprefsim.h | 5 +- linden/indra/newview/llprefsvoice.cpp | 4 +- linden/indra/newview/llpreview.cpp | 2 +- linden/indra/newview/llpreviewanim.h | 2 +- linden/indra/newview/llpreviewgesture.cpp | 42 +- linden/indra/newview/llpreviewgesture.h | 2 +- linden/indra/newview/llpreviewlandmark.cpp | 5 +- linden/indra/newview/llpreviewlandmark.h | 2 +- linden/indra/newview/llpreviewnotecard.cpp | 16 +- linden/indra/newview/llpreviewscript.cpp | 305 +- linden/indra/newview/llpreviewscript.h | 28 +- linden/indra/newview/llpreviewtexture.cpp | 14 +- linden/indra/newview/llpreviewtexture.h | 2 +- linden/indra/newview/llprogressview.cpp | 23 +- linden/indra/newview/llprogressview.h | 10 +- linden/indra/newview/llrendersphere.cpp | 171 - linden/indra/newview/llrendersphere.h | 47 - linden/indra/newview/llselectmgr.cpp | 217 +- linden/indra/newview/llselectmgr.h | 34 +- linden/indra/newview/llsky.h | 3 - linden/indra/newview/llspatialpartition.cpp | 178 +- linden/indra/newview/llspatialpartition.h | 9 +- linden/indra/newview/llsprite.cpp | 32 +- linden/indra/newview/llsprite.h | 1 - linden/indra/newview/llstartup.cpp | 761 +- linden/indra/newview/llstartup.h | 37 +- linden/indra/newview/llstatbar.cpp | 24 +- linden/indra/newview/llstatbar.h | 10 +- linden/indra/newview/llstatgraph.cpp | 4 +- linden/indra/newview/llstatgraph.h | 8 +- linden/indra/newview/llstatusbar.cpp | 133 +- linden/indra/newview/llstatusbar.h | 4 +- linden/indra/newview/llstatview.cpp | 6 +- linden/indra/newview/llstatview.h | 8 +- linden/indra/newview/llstylemap.cpp | 16 +- linden/indra/newview/llstylemap.h | 3 + linden/indra/newview/llsurface.cpp | 2 + linden/indra/newview/llsurface.h | 3 - linden/indra/newview/llsurfacepatch.cpp | 45 +- linden/indra/newview/llsurfacepatch.h | 14 +- linden/indra/newview/lltexlayer.cpp | 24 +- linden/indra/newview/lltexlayer.h | 30 +- linden/indra/newview/lltexturecache.cpp | 26 +- linden/indra/newview/lltexturecache.h | 2 +- linden/indra/newview/lltexturectrl.cpp | 86 +- linden/indra/newview/lltexturectrl.h | 18 +- linden/indra/newview/lltexturefetch.cpp | 12 +- linden/indra/newview/lltexturefetch.h | 2 +- linden/indra/newview/lltextureview.cpp | 63 +- linden/indra/newview/lltool.cpp | 10 +- linden/indra/newview/lltool.h | 13 +- linden/indra/newview/lltoolbar.cpp | 8 +- linden/indra/newview/lltoolbar.h | 2 +- linden/indra/newview/lltoolbrush.cpp | 79 +- linden/indra/newview/lltoolcomp.cpp | 92 +- linden/indra/newview/lltoolcomp.h | 15 +- linden/indra/newview/lltooldraganddrop.cpp | 402 +- linden/indra/newview/lltooldraganddrop.h | 25 +- linden/indra/newview/lltoolface.cpp | 15 +- linden/indra/newview/lltoolface.h | 3 +- linden/indra/newview/lltoolfocus.cpp | 30 +- linden/indra/newview/lltoolfocus.h | 4 +- linden/indra/newview/lltoolgrab.cpp | 345 +- linden/indra/newview/lltoolgrab.h | 19 +- linden/indra/newview/lltoolgun.cpp | 3 +- linden/indra/newview/lltoolindividual.cpp | 8 +- linden/indra/newview/lltoolindividual.h | 4 +- linden/indra/newview/lltoolmgr.cpp | 2 +- linden/indra/newview/lltoolobjpicker.cpp | 17 +- linden/indra/newview/lltoolobjpicker.h | 4 +- linden/indra/newview/lltoolpie.cpp | 105 +- linden/indra/newview/lltoolpie.h | 13 +- linden/indra/newview/lltoolpipette.cpp | 22 +- linden/indra/newview/lltoolpipette.h | 9 +- linden/indra/newview/lltoolplacer.cpp | 26 +- linden/indra/newview/lltoolplacer.h | 2 +- linden/indra/newview/lltoolselect.cpp | 54 +- linden/indra/newview/lltoolselect.h | 5 +- linden/indra/newview/lltoolselectland.cpp | 2 +- linden/indra/newview/lltoolselectrect.cpp | 22 +- linden/indra/newview/lltoolselectrect.h | 2 + linden/indra/newview/lltoolview.cpp | 88 +- linden/indra/newview/lltoolview.h | 2 - linden/indra/newview/lltracker.cpp | 15 +- linden/indra/newview/lltracker.h | 20 +- linden/indra/newview/lltrans.cpp | 12 +- linden/indra/newview/lltrans.h | 16 +- linden/indra/newview/lluploaddialog.cpp | 11 +- linden/indra/newview/llurldispatcher.cpp | 4 +- linden/indra/newview/llurlhistory.cpp | 12 +- linden/indra/newview/llurlhistory.h | 4 +- linden/indra/newview/llurlsimstring.cpp | 54 +- linden/indra/newview/llurlsimstring.h | 16 +- linden/indra/newview/llurlwhitelist.cpp | 24 +- linden/indra/newview/llurlwhitelist.h | 12 +- linden/indra/newview/lluserauth.cpp | 56 +- linden/indra/newview/lluserauth.h | 26 +- linden/indra/newview/llvelocitybar.cpp | 18 +- linden/indra/newview/llviewchildren.cpp | 20 +- linden/indra/newview/llviewchildren.h | 16 +- linden/indra/newview/llviewerassetstorage.cpp | 16 +- linden/indra/newview/llviewerassetstorage.h | 2 +- linden/indra/newview/llviewercamera.cpp | 12 - linden/indra/newview/llviewercamera.h | 7 - linden/indra/newview/llviewercontrol.cpp | 24 +- linden/indra/newview/llviewercontrol.h | 6 +- linden/indra/newview/llviewerdisplay.cpp | 127 +- linden/indra/newview/llviewergenericmessage.cpp | 4 +- linden/indra/newview/llviewergenericmessage.h | 2 +- linden/indra/newview/llviewergesture.cpp | 8 +- linden/indra/newview/llviewerimage.cpp | 72 +- linden/indra/newview/llviewerimage.h | 12 +- linden/indra/newview/llviewerimagelist.cpp | 44 +- linden/indra/newview/llviewerimagelist.h | 20 +- linden/indra/newview/llviewerinventory.cpp | 45 +- linden/indra/newview/llviewerinventory.h | 11 +- linden/indra/newview/llviewerjointattachment.cpp | 25 +- linden/indra/newview/llviewerjointmesh.cpp | 6 +- linden/indra/newview/llviewerjoystick.cpp | 31 +- linden/indra/newview/llviewerjoystick.h | 2 - linden/indra/newview/llviewerkeyboard.cpp | 37 +- linden/indra/newview/llviewerkeyboard.h | 13 +- linden/indra/newview/llviewermedia.cpp | 46 +- linden/indra/newview/llviewermedia.h | 9 + linden/indra/newview/llviewermenu.cpp | 768 ++- linden/indra/newview/llviewermenu.h | 11 +- linden/indra/newview/llviewermenufile.cpp | 278 +- linden/indra/newview/llviewermenufile.h | 6 +- linden/indra/newview/llviewermessage.cpp | 920 ++- linden/indra/newview/llviewermessage.h | 33 +- linden/indra/newview/llviewernetwork.cpp | 8 +- linden/indra/newview/llviewernetwork.h | 1 + linden/indra/newview/llviewerobject.cpp | 339 +- linden/indra/newview/llviewerobject.h | 51 +- linden/indra/newview/llviewerobjectlist.cpp | 61 +- linden/indra/newview/llviewerobjectlist.h | 9 +- linden/indra/newview/llviewerparcelmedia.cpp | 4 +- linden/indra/newview/llviewerparcelmgr.cpp | 43 +- linden/indra/newview/llviewerparcelmgr.h | 2 +- linden/indra/newview/llviewerpartsim.cpp | 211 +- linden/indra/newview/llviewerpartsim.h | 6 +- linden/indra/newview/llviewerpartsource.cpp | 8 +- linden/indra/newview/llviewerprecompiledheaders.h | 1 + linden/indra/newview/llviewerregion.cpp | 108 +- linden/indra/newview/llviewerregion.h | 40 +- linden/indra/newview/llviewershadermgr.cpp | 1098 +++ linden/indra/newview/llviewershadermgr.h | 313 + linden/indra/newview/llviewerstats.cpp | 46 +- linden/indra/newview/llviewerstats.h | 4 +- linden/indra/newview/llviewertexteditor.cpp | 48 +- linden/indra/newview/llviewertexteditor.h | 20 +- linden/indra/newview/llviewerthrottle.cpp | 2 +- linden/indra/newview/llviewerthrottle.h | 2 +- linden/indra/newview/llviewervisualparam.cpp | 2 +- linden/indra/newview/llviewervisualparam.h | 6 +- linden/indra/newview/llviewerwindow.cpp | 1661 +++-- linden/indra/newview/llviewerwindow.h | 234 +- linden/indra/newview/llvoavatar.cpp | 456 +- linden/indra/newview/llvoavatar.h | 62 +- linden/indra/newview/llvograss.cpp | 12 +- linden/indra/newview/llvoiceclient.cpp | 177 +- linden/indra/newview/llvoiceclient.h | 9 +- linden/indra/newview/llvoiceremotectrl.cpp | 10 +- linden/indra/newview/llvoiceremotectrl.h | 2 +- linden/indra/newview/llvoicevisualizer.cpp | 8 - linden/indra/newview/llvopartgroup.cpp | 19 +- linden/indra/newview/llvosky.cpp | 4 +- linden/indra/newview/llvosky.h | 2 +- linden/indra/newview/llvotree.cpp | 10 +- linden/indra/newview/llvovolume.cpp | 78 +- linden/indra/newview/llvovolume.h | 13 +- linden/indra/newview/llwaterparammanager.cpp | 38 +- linden/indra/newview/llwaterparammanager.h | 26 +- linden/indra/newview/llwaterparamset.cpp | 22 +- linden/indra/newview/llwaterparamset.h | 26 +- linden/indra/newview/llwearable.cpp | 69 +- linden/indra/newview/llwearable.h | 34 +- linden/indra/newview/llwearablelist.cpp | 18 +- linden/indra/newview/llwearablelist.h | 4 +- linden/indra/newview/llweb.cpp | 4 +- linden/indra/newview/llweb.h | 2 +- linden/indra/newview/llwebbrowserctrl.cpp | 45 +- linden/indra/newview/llwebbrowserctrl.h | 2 + linden/indra/newview/llwindebug.cpp | 13 +- linden/indra/newview/llwindebug.h | 2 +- linden/indra/newview/llwldaycycle.cpp | 25 +- linden/indra/newview/llwldaycycle.h | 12 +- linden/indra/newview/llwlparammanager.cpp | 50 +- linden/indra/newview/llwlparammanager.h | 26 +- linden/indra/newview/llwlparamset.cpp | 20 +- linden/indra/newview/llwlparamset.h | 22 +- linden/indra/newview/llworld.cpp | 14 +- linden/indra/newview/llworld.h | 9 +- linden/indra/newview/llworldmap.cpp | 53 +- linden/indra/newview/llworldmap.h | 5 +- linden/indra/newview/llworldmapview.cpp | 89 +- linden/indra/newview/llworldmapview.h | 10 +- linden/indra/newview/macview.r | 123 + .../newview/macview.xcodeproj/default.pbxuser | 183 - .../newview/macview.xcodeproj/project.pbxproj | 6200 ----------------- linden/indra/newview/mozilla-theme/classic.jar | Bin 194180 -> 0 bytes .../indra/newview/mozilla-theme/classic.manifest | 4 - linden/indra/newview/newview.vcproj | 3451 ---------- linden/indra/newview/newview_vc8.vcproj | 4647 ------------- linden/indra/newview/newview_vc9.vcproj | 4624 ------------- linden/indra/newview/pipeline.cpp | 229 +- linden/indra/newview/pipeline.h | 36 +- linden/indra/newview/postbuild.bat | 167 - linden/indra/newview/prebuild.bat | 15 - linden/indra/newview/releasenotes.txt | 569 -- linden/indra/newview/res/newViewRes.rc | 288 - linden/indra/newview/res/resource.h | 2 +- linden/indra/newview/res/viewerRes.rc | 288 + .../newview/secondlife setup build A08T01.bat | 4 - .../newview/secondlife setup build B08T01.bat | 4 - .../indra/newview/secondlife setup build aditi.bat | 4 - .../indra/newview/secondlife setup build agni.bat | 4 - .../indra/newview/secondlife setup build aruna.bat | 4 - .../indra/newview/secondlife setup build dmz.bat | 4 - .../indra/newview/secondlife setup build durga.bat | 4 - .../secondlife setup build firstlookwindlight.bat | 4 - .../indra/newview/secondlife setup build ganga.bat | 4 - .../indra/newview/secondlife setup build mitra.bat | 4 - .../newview/secondlife setup build mohini.bat | 4 - .../indra/newview/secondlife setup build nandi.bat | 4 - .../indra/newview/secondlife setup build radha.bat | 4 - .../indra/newview/secondlife setup build ravi.bat | 4 - .../secondlife setup build release candidate.bat | 4 - .../newview/secondlife setup build shakti.bat | 4 - .../indra/newview/secondlife setup build siva.bat | 4 - .../indra/newview/secondlife setup build soma.bat | 4 - .../indra/newview/secondlife setup build uma.bat | 4 - .../indra/newview/secondlife setup build vaak.bat | 4 - .../newview/secondlife setup build voicebeta.bat | 4 - .../secondlife setup build voicefirstlook.bat | 4 - .../indra/newview/secondlife setup build yami.bat | 4 - linden/indra/newview/secondlife setup build.bat | 21 - linden/indra/newview/skins/default/colors_base.xml | 1 + .../newview/skins/default/textures/textures.xml | 4 +- .../indra/newview/skins/default/xui/de/alerts.xml | 36 +- .../newview/skins/default/xui/de/floater_html.xml | 3 + .../skins/default/xui/de/panel_region_estate.xml | 3 - .../newview/skins/default/xui/en-us/LCD_text.xml | 76 - .../newview/skins/default/xui/en-us/alerts.xml | 144 +- .../skins/default/xui/en-us/floater_about_land.xml | 9 +- .../skins/default/xui/en-us/floater_critical.xml | 6 +- .../skins/default/xui/en-us/floater_html.xml | 3 + .../default/xui/en-us/floater_instant_message.xml | 3 + .../xui/en-us/floater_instant_message_ad_hoc.xml | 2 +- .../xui/en-us/floater_instant_message_group.xml | 8 +- .../skins/default/xui/en-us/floater_lagmeter.xml | 3 +- .../default/xui/en-us/floater_live_lsleditor.xml | 5 +- .../default/xui/en-us/floater_mem_leaking.xml | 31 + .../skins/default/xui/en-us/floater_postcard.xml | 7 +- .../default/xui/en-us/floater_report_abuse.xml | 131 +- .../default/xui/en-us/floater_script_ed_panel.xml | 2 +- .../default/xui/en-us/floater_script_search.xml | 2 +- .../xui/en-us/floater_skin_preview_template.xml | 2 +- .../skins/default/xui/en-us/floater_snapshot.xml | 56 +- .../skins/default/xui/en-us/floater_tools.xml | 46 +- .../default/xui/en-us/floater_top_objects.xml | 11 +- .../skins/default/xui/en-us/floater_tos.xml | 32 +- .../skins/default/xui/en-us/floater_world_map.xml | 86 +- .../skins/default/xui/en-us/menu_pie_avatar.xml | 2 +- .../skins/default/xui/en-us/menu_pie_self.xml | 1 + .../skins/default/xui/en-us/menu_viewer.xml | 39 +- .../newview/skins/default/xui/en-us/mime_types.xml | 8 + .../newview/skins/default/xui/en-us/notify.xml | 46 +- .../skins/default/xui/en-us/panel_avatar.xml | 33 +- .../default/xui/en-us/panel_land_covenant.xml | 2 +- .../skins/default/xui/en-us/panel_login.xml | 38 +- .../skins/default/xui/en-us/panel_overlaybar.xml | 5 - .../default/xui/en-us/panel_preferences_LCD.xml | 61 - .../default/xui/en-us/panel_preferences_chat.xml | 104 +- .../xui/en-us/panel_preferences_general.xml | 28 +- .../default/xui/en-us/panel_preferences_im.xml | 67 +- .../default/xui/en-us/panel_preferences_popups.xml | 33 +- .../skins/default/xui/en-us/panel_region_debug.xml | 38 +- .../default/xui/en-us/panel_region_estate.xml | 1 + .../skins/default/xui/en-us/role_actions.xml | 13 + .../newview/skins/default/xui/en-us/strings.xml | 23 +- .../indra/newview/skins/default/xui/es/alerts.xml | 25 +- .../newview/skins/default/xui/es/floater_html.xml | 3 + .../indra/newview/skins/default/xui/fr/alerts.xml | 25 +- .../newview/skins/default/xui/fr/floater_html.xml | 3 + .../indra/newview/skins/default/xui/ja/alerts.xml | 36 +- .../newview/skins/default/xui/ja/floater_html.xml | 3 + .../skins/default/xui/ja/floater_joystick.xml | 14 +- .../skins/default/xui/ja/panel_region_estate.xml | 3 - .../indra/newview/skins/default/xui/ko/alerts.xml | 36 +- .../newview/skins/default/xui/ko/floater_html.xml | 3 + .../skins/default/xui/ko/floater_joystick.xml | 6 + .../skins/default/xui/ko/panel_region_estate.xml | 3 - .../indra/newview/skins/default/xui/pt/alerts.xml | 29 +- .../newview/skins/default/xui/pt/floater_html.xml | 3 + .../indra/newview/skins/default/xui/pt/notify.xml | 4 +- .../skins/default/xui/pt/panel_region_estate.xml | 2 +- .../indra/newview/skins/default/xui/zh/alerts.xml | 25 +- .../newview/skins/default/xui/zh/floater_html.xml | 3 + linden/indra/newview/skins/silver/colors_base.xml | 1 + .../skins/silver/xui/en-us/floater_about_land.xml | 11 +- .../silver/xui/en-us/floater_live_lsleditor.xml | 3 + .../silver/xui/en-us/floater_script_ed_panel.xml | 2 +- .../skins/silver/xui/en-us/floater_tools.xml | 36 +- linden/indra/newview/viewer_manifest.py | 1084 +-- linden/indra/test/CMakeLists.txt | 153 + .../indra/test/MacTester.xcodeproj/project.pbxproj | 1350 ---- linden/indra/test/assembly_tut.cpp | 86 + linden/indra/test/common.cpp | 10 +- linden/indra/test/files.lst | 51 - linden/indra/test/inventory.cpp | 24 +- linden/indra/test/io.cpp | 14 +- linden/indra/test/llapp_tut.cpp | 2 +- linden/indra/test/llassetuploadqueue_tut.cpp | 200 + linden/indra/test/llblowfish_tut.cpp | 20 +- linden/indra/test/llcontrol_tut.cpp | 12 +- linden/indra/test/lldir_tut.cpp | 264 + linden/indra/test/llerror_tut.cpp | 38 +- linden/indra/test/llhost_tut.cpp | 27 +- linden/indra/test/llhttpclient_tut.cpp | 6 +- linden/indra/test/llhttpdate_tut.cpp | 31 +- linden/indra/test/llinventoryparcel_tut.cpp | 12 +- linden/indra/test/lliohttpserver_tut.cpp | 21 +- linden/indra/test/llmessageconfig_tut.cpp | 8 +- linden/indra/test/llmessagetemplateparser_tut.cpp | 2 +- linden/indra/test/llnamevalue_tut.cpp | 5 + linden/indra/test/llquaternion_tut.cpp | 8 +- linden/indra/test/llsd_new_tut.cpp | 26 +- linden/indra/test/llsdmessagereader_tut.cpp | 4 + linden/indra/test/llsdserialize_tut.cpp | 16 +- linden/indra/test/llsdtraits.h | 4 - linden/indra/test/llsdutil_tut.cpp | 8 +- linden/indra/test/llstring_tut.cpp | 544 +- linden/indra/test/lltemplatemessagebuilder_tut.cpp | 4 +- linden/indra/test/lluri_tut.cpp | 5 + linden/indra/test/llxfer_tut.cpp | 8 +- linden/indra/test/message_tut.cpp | 49 +- linden/indra/test/mock_http_client.cpp | 88 + linden/indra/test/mock_http_client.h | 196 + linden/indra/test/test.cpp | 87 +- linden/indra/test/test.vcproj | 344 - linden/indra/test/test_llmanifest.py | 3 +- linden/indra/test/test_vc8.vcproj | 455 -- linden/indra/test/test_vc9.vcproj | 453 -- linden/indra/test/v3dmath_tut.cpp | 8 +- linden/indra/test/v3math_tut.cpp | 2 +- linden/indra/test/v4color_tut.cpp | 4 +- linden/indra/test/v4coloru_tut.cpp | 2 +- linden/indra/test/v4math_tut.cpp | 8 + linden/indra/tools/vstool/README.txt | 9 + linden/indra/tools/vstool/VSTool.csproj | 95 + linden/indra/tools/vstool/VSTool.exe | Bin 0 -> 24576 bytes linden/indra/tools/vstool/VSTool.sln | 19 + linden/indra/tools/vstool/main.cs | 711 ++ linden/indra/win_crash_logger/CMakeLists.txt | 83 + .../win_crash_logger/llcrashloggerwindows.cpp | 12 +- .../indra/win_crash_logger/llcrashloggerwindows.h | 2 +- .../indra/win_crash_logger/win_crash_logger.vcproj | 224 - .../win_crash_logger/win_crash_logger_vc8.vcproj | 336 - .../win_crash_logger/win_crash_logger_vc9.vcproj | 337 - linden/indra/win_updater/CMakeLists.txt | 30 + linden/indra/win_updater/win_updater.vcproj | 194 - linden/indra/win_updater/win_updater_vc8.vcproj | 295 - linden/indra/win_updater/win_updater_vc9.vcproj | 293 - linden/install.xml | 1302 ++++ linden/libraries/i686-win32/include/GL/README.txt | 5 - linden/libraries/i686-win32/include/GL/glext.h | 7271 -------------------- linden/libraries/i686-win32/include/GL/glut.h | 596 -- linden/libraries/i686-win32/include/GL/glxext.h | 785 --- linden/libraries/i686-win32/include/GL/wglext.h | 648 -- linden/libraries/include/GL/glh_extensions.h | 207 - linden/libraries/include/GL/glh_genext.h | 1671 ----- linden/libraries/include/glh/glh_linear.h | 1621 ----- linden/libraries/include/llmozlib2.h | 383 -- linden/scripts/build_version.py | 54 + linden/scripts/install.py | 1086 +++ linden/scripts/messages/message_template.msg | 35 +- 1348 files changed, 79113 insertions(+), 93572 deletions(-) create mode 100644 linden/doc/viewer-changes.txt create mode 100644 linden/indra/CMakeLists.txt delete mode 100644 linden/indra/SConstruct create mode 100644 linden/indra/cmake/00-Common.cmake create mode 100644 linden/indra/cmake/APR.cmake create mode 100644 linden/indra/cmake/Audio.cmake create mode 100644 linden/indra/cmake/BerkeleyDB.cmake create mode 100644 linden/indra/cmake/Boost.cmake create mode 100644 linden/indra/cmake/BuildVersion.cmake create mode 100644 linden/indra/cmake/CARes.cmake create mode 100644 linden/indra/cmake/CMakeCopyIfDifferent.cmake create mode 100644 linden/indra/cmake/CSharpMacros.cmake create mode 100644 linden/indra/cmake/CURL.cmake create mode 100644 linden/indra/cmake/CommonMiscLibs.cmake create mode 100644 linden/indra/cmake/CopyBackToSource.cmake create mode 100644 linden/indra/cmake/CopyWinLibs.cmake create mode 100644 linden/indra/cmake/DirectX.cmake create mode 100644 linden/indra/cmake/ELFIO.cmake create mode 100644 linden/indra/cmake/EXPAT.cmake create mode 100644 linden/indra/cmake/FMOD.cmake create mode 100644 linden/indra/cmake/FindAPR.cmake create mode 100644 linden/indra/cmake/FindBerkeleyDB.cmake create mode 100644 linden/indra/cmake/FindCARes.cmake create mode 100644 linden/indra/cmake/FindELFIO.cmake create mode 100644 linden/indra/cmake/FindGooglePerfTools.cmake create mode 100644 linden/indra/cmake/FindMono.cmake create mode 100644 linden/indra/cmake/FindMySQL.cmake create mode 100644 linden/indra/cmake/FindOpenJPEG.cmake create mode 100644 linden/indra/cmake/FindSCP.cmake create mode 100644 linden/indra/cmake/FindXmlRpcEpi.cmake create mode 100644 linden/indra/cmake/FreeType.cmake create mode 100644 linden/indra/cmake/GStreamer.cmake create mode 100644 linden/indra/cmake/GooglePerfTools.cmake create mode 100644 linden/indra/cmake/JPEG.cmake create mode 100644 linden/indra/cmake/LLAudio.cmake create mode 100644 linden/indra/cmake/LLCharacter.cmake create mode 100644 linden/indra/cmake/LLCommon.cmake create mode 100644 linden/indra/cmake/LLCrashLogger.cmake create mode 100644 linden/indra/cmake/LLDatabase.cmake create mode 100644 linden/indra/cmake/LLImage.cmake create mode 100644 linden/indra/cmake/LLImageJ2COJ.cmake create mode 100644 linden/indra/cmake/LLInventory.cmake create mode 100644 linden/indra/cmake/LLKDU.cmake create mode 100644 linden/indra/cmake/LLMath.cmake create mode 100644 linden/indra/cmake/LLMedia.cmake create mode 100644 linden/indra/cmake/LLMessage.cmake create mode 100644 linden/indra/cmake/LLPhysics.cmake create mode 100644 linden/indra/cmake/LLPrimitive.cmake create mode 100644 linden/indra/cmake/LLRender.cmake create mode 100644 linden/indra/cmake/LLScene.cmake create mode 100644 linden/indra/cmake/LLUI.cmake create mode 100644 linden/indra/cmake/LLVFS.cmake create mode 100644 linden/indra/cmake/LLWindow.cmake create mode 100644 linden/indra/cmake/LLXML.cmake create mode 100644 linden/indra/cmake/LScript.cmake create mode 100644 linden/indra/cmake/Linking.cmake create mode 100644 linden/indra/cmake/MonoDeps.cmake create mode 100644 linden/indra/cmake/MonoEmbed.cmake create mode 100644 linden/indra/cmake/Mozlib.cmake create mode 100644 linden/indra/cmake/MySQL.cmake create mode 100644 linden/indra/cmake/NDOF.cmake create mode 100644 linden/indra/cmake/OpenGL.cmake create mode 100644 linden/indra/cmake/OpenJPEG.cmake create mode 100644 linden/indra/cmake/OpenSSL.cmake create mode 100644 linden/indra/cmake/PNG.cmake create mode 100644 linden/indra/cmake/Prebuilt.cmake create mode 100644 linden/indra/cmake/Python.cmake create mode 100644 linden/indra/cmake/QuickTime.cmake create mode 100644 linden/indra/cmake/TemplateCheck.cmake create mode 100644 linden/indra/cmake/UI.cmake create mode 100644 linden/indra/cmake/UnixInstall.cmake create mode 100644 linden/indra/cmake/Variables.cmake create mode 100644 linden/indra/cmake/ViewerMiscLibs.cmake create mode 100644 linden/indra/cmake/XmlRpcEpi.cmake create mode 100644 linden/indra/cmake/ZLIB.cmake create mode 100644 linden/indra/copy_win_scripts/CMakeLists.txt create mode 100644 linden/indra/copy_win_scripts/start-client.py create mode 100755 linden/indra/develop.py delete mode 100644 linden/indra/indra_complete/indra_complete.sln delete mode 100644 linden/indra/indra_complete/indra_complete_vc8.sln delete mode 100644 linden/indra/indra_complete/indra_complete_vc9.sln create mode 100644 linden/indra/lib/python/indra/base/cllsd_test.py create mode 100644 linden/indra/lib/python/indra/ipc/siesta.py create mode 100644 linden/indra/lib/python/indra/ipc/siesta_test.py create mode 100644 linden/indra/lib/python/indra/util/fastest_elementtree.py create mode 100644 linden/indra/lib/python/indra/util/term.py create mode 100644 linden/indra/linux_crash_logger/CMakeLists.txt delete mode 100644 linden/indra/linux_crash_logger/files.lst create mode 100644 linden/indra/llaudio/CMakeLists.txt delete mode 100644 linden/indra/llaudio/files.lst delete mode 100644 linden/indra/llaudio/llaudio.vcproj delete mode 100644 linden/indra/llaudio/llaudio_vc8.vcproj delete mode 100644 linden/indra/llaudio/llaudio_vc9.vcproj create mode 100644 linden/indra/llcharacter/CMakeLists.txt delete mode 100644 linden/indra/llcharacter/files.lst delete mode 100644 linden/indra/llcharacter/llcharacter.vcproj delete mode 100644 linden/indra/llcharacter/llcharacter_vc8.vcproj delete mode 100644 linden/indra/llcharacter/llcharacter_vc9.vcproj create mode 100644 linden/indra/llcommon/CMakeLists.txt delete mode 100644 linden/indra/llcommon/files.lst delete mode 100644 linden/indra/llcommon/llares.cpp delete mode 100644 linden/indra/llcommon/llares.h delete mode 100644 linden/indra/llcommon/llcommon.vcproj delete mode 100644 linden/indra/llcommon/llcommon_vc8.vcproj delete mode 100644 linden/indra/llcommon/llcommon_vc9.vcproj create mode 100644 linden/indra/llcommon/llcrc.cpp create mode 100644 linden/indra/llcommon/llcrc.h create mode 100644 linden/indra/llcommon/llmd5.cpp create mode 100644 linden/indra/llcommon/llmd5.h create mode 100644 linden/indra/llcommon/llrand.cpp create mode 100644 linden/indra/llcommon/llrand.h create mode 100644 linden/indra/llcommon/lluuid.cpp create mode 100644 linden/indra/llcommon/lluuid.h create mode 100644 linden/indra/llcrashlogger/CMakeLists.txt delete mode 100644 linden/indra/llcrashlogger/files.lst create mode 100644 linden/indra/llimage/CMakeLists.txt delete mode 100644 linden/indra/llimage/files.lst delete mode 100644 linden/indra/llimage/llimage.vcproj delete mode 100644 linden/indra/llimage/llimage_vc8.vcproj delete mode 100644 linden/indra/llimage/llimage_vc9.vcproj create mode 100644 linden/indra/llimagej2coj/CMakeLists.txt delete mode 100644 linden/indra/llimagej2coj/files.lst delete mode 100755 linden/indra/llimagej2coj/llimagej2coj.vcproj create mode 100644 linden/indra/llinventory/CMakeLists.txt delete mode 100644 linden/indra/llinventory/files.lst delete mode 100644 linden/indra/llinventory/llinventory.vcproj delete mode 100644 linden/indra/llinventory/llinventory_vc8.vcproj delete mode 100644 linden/indra/llinventory/llinventory_vc9.vcproj create mode 100644 linden/indra/llmath/CMakeLists.txt delete mode 100644 linden/indra/llmath/files.lst delete mode 100644 linden/indra/llmath/llcrc.cpp delete mode 100644 linden/indra/llmath/llcrc.h delete mode 100644 linden/indra/llmath/llmath.vcproj delete mode 100644 linden/indra/llmath/llmath_vc8.vcproj delete mode 100644 linden/indra/llmath/llmath_vc9.vcproj delete mode 100644 linden/indra/llmath/llmd5.cpp delete mode 100644 linden/indra/llmath/llmd5.h delete mode 100644 linden/indra/llmath/llrand.cpp delete mode 100644 linden/indra/llmath/llrand.h create mode 100644 linden/indra/llmath/llsdutil_math.cpp delete mode 100644 linden/indra/llmath/lluuid.cpp delete mode 100644 linden/indra/llmath/lluuid.h create mode 100644 linden/indra/llmedia/CMakeLists.txt delete mode 100644 linden/indra/llmedia/files.lst delete mode 100644 linden/indra/llmedia/llmedia.vcproj delete mode 100644 linden/indra/llmedia/llmedia_vc8.vcproj delete mode 100644 linden/indra/llmedia/llmedia_vc9.vcproj create mode 100644 linden/indra/llmessage/CMakeLists.txt delete mode 100644 linden/indra/llmessage/files.lst create mode 100644 linden/indra/llmessage/llares.cpp create mode 100644 linden/indra/llmessage/llares.h delete mode 100644 linden/indra/llmessage/llmessage.vcproj delete mode 100644 linden/indra/llmessage/llmessage_vc8.vcproj delete mode 100644 linden/indra/llmessage/llmessage_vc9.vcproj create mode 100644 linden/indra/llprimitive/CMakeLists.txt delete mode 100644 linden/indra/llprimitive/files.lst delete mode 100644 linden/indra/llprimitive/llprimitive.vcproj delete mode 100644 linden/indra/llprimitive/llprimitive_vc8.vcproj delete mode 100644 linden/indra/llprimitive/llprimitive_vc9.vcproj create mode 100644 linden/indra/llrender/CMakeLists.txt delete mode 100644 linden/indra/llrender/files.darwin.lst delete mode 100644 linden/indra/llrender/files.lst create mode 100644 linden/indra/llrender/llcubemap.cpp create mode 100644 linden/indra/llrender/llcubemap.h create mode 100644 linden/indra/llrender/llgl.cpp create mode 100644 linden/indra/llrender/llgl.h create mode 100644 linden/indra/llrender/llglheaders.h create mode 100644 linden/indra/llrender/llglslshader.cpp create mode 100644 linden/indra/llrender/llglslshader.h create mode 100644 linden/indra/llrender/llglstates.h create mode 100644 linden/indra/llrender/llgltypes.h create mode 100644 linden/indra/llrender/llpostprocess.cpp create mode 100644 linden/indra/llrender/llpostprocess.h delete mode 100644 linden/indra/llrender/llrender.vcproj delete mode 100644 linden/indra/llrender/llrender_vc8.vcproj delete mode 100644 linden/indra/llrender/llrender_vc9.vcproj create mode 100644 linden/indra/llrender/llrendersphere.cpp create mode 100644 linden/indra/llrender/llrendersphere.h create mode 100644 linden/indra/llrender/llshadermgr.cpp create mode 100644 linden/indra/llrender/llshadermgr.h create mode 100644 linden/indra/llui/CMakeLists.txt delete mode 100644 linden/indra/llui/files.lst delete mode 100644 linden/indra/llui/llui.vcproj delete mode 100644 linden/indra/llui/llui_vc8.vcproj delete mode 100644 linden/indra/llui/llui_vc9.vcproj create mode 100644 linden/indra/llvfs/CMakeLists.txt delete mode 100755 linden/indra/llvfs/files.linux.lst delete mode 100644 linden/indra/llvfs/files.lst delete mode 100644 linden/indra/llvfs/files.sunos5.lst delete mode 100755 linden/indra/llvfs/files.win32.lst delete mode 100644 linden/indra/llvfs/llvfs.vcproj delete mode 100644 linden/indra/llvfs/llvfs_vc8.vcproj delete mode 100644 linden/indra/llvfs/llvfs_vc9.vcproj create mode 100644 linden/indra/llwindow/CMakeLists.txt create mode 100644 linden/indra/llwindow/GL/glh_extensions.h create mode 100644 linden/indra/llwindow/GL/glh_genext.h delete mode 100644 linden/indra/llwindow/files.darwin.lst delete mode 100644 linden/indra/llwindow/files.linux.lst delete mode 100644 linden/indra/llwindow/files.lst delete mode 100644 linden/indra/llwindow/files.sunos5.lst delete mode 100644 linden/indra/llwindow/files.win32.lst delete mode 100644 linden/indra/llwindow/llgl.cpp delete mode 100644 linden/indra/llwindow/llgl.h delete mode 100644 linden/indra/llwindow/llglheaders.h delete mode 100644 linden/indra/llwindow/llglstates.h delete mode 100644 linden/indra/llwindow/llgltypes.h delete mode 100644 linden/indra/llwindow/lllogitechlcd.cpp delete mode 100644 linden/indra/llwindow/lllogitechlcd.h delete mode 100644 linden/indra/llwindow/llwindow.vcproj delete mode 100644 linden/indra/llwindow/llwindow_vc8.vcproj delete mode 100644 linden/indra/llwindow/llwindow_vc9.vcproj create mode 100644 linden/indra/llxml/CMakeLists.txt delete mode 100644 linden/indra/llxml/files.lst delete mode 100644 linden/indra/llxml/llxml.vcproj delete mode 100644 linden/indra/llxml/llxml_vc8.vcproj delete mode 100644 linden/indra/llxml/llxml_vc9.vcproj create mode 100644 linden/indra/lscript/CMakeLists.txt delete mode 100644 linden/indra/lscript/files.lst create mode 100644 linden/indra/lscript/lscript_compile/CMakeLists.txt create mode 100644 linden/indra/lscript/lscript_compile/bison.bat delete mode 100644 linden/indra/lscript/lscript_compile/lscript_compile.vcproj delete mode 100755 linden/indra/lscript/lscript_compile/lscript_compile_fb.vcproj delete mode 100644 linden/indra/lscript/lscript_compile/lscript_compile_fb_vc8.vcproj delete mode 100644 linden/indra/lscript/lscript_compile/lscript_compile_fb_vc9.vcproj delete mode 100644 linden/indra/lscript/lscript_compile/lscript_compile_ly.vcproj delete mode 100644 linden/indra/lscript/lscript_compile/lscript_compile_ly_vc8.vcproj delete mode 100644 linden/indra/lscript/lscript_compile/lscript_compile_vc8.vcproj delete mode 100644 linden/indra/lscript/lscript_compile/lscript_compile_vc9.vcproj create mode 100644 linden/indra/lscript/lscript_execute/CMakeLists.txt delete mode 100644 linden/indra/lscript/lscript_execute/lscript_execute.vcproj delete mode 100644 linden/indra/lscript/lscript_execute/lscript_execute_vc8.vcproj delete mode 100644 linden/indra/lscript/lscript_execute/lscript_execute_vc9.vcproj create mode 100644 linden/indra/lscript/lscript_execute_mono/assembly.cpp create mode 100644 linden/indra/lscript/lscript_execute_mono/size.cpp create mode 100644 linden/indra/lscript/lscript_library/CMakeLists.txt delete mode 100644 linden/indra/lscript/lscript_library/lscript_library.vcproj delete mode 100644 linden/indra/lscript/lscript_library/lscript_library_vc8.vcproj delete mode 100644 linden/indra/lscript/lscript_library/lscript_library_vc9.vcproj create mode 100644 linden/indra/mac_crash_logger/CMakeLists.txt create mode 100644 linden/indra/mac_updater/CMakeLists.txt delete mode 100644 linden/indra/newview/AutoUpdater-Info.plist create mode 100644 linden/indra/newview/CMakeLists.txt delete mode 100644 linden/indra/newview/CrashReporter.nib/classes.nib delete mode 100644 linden/indra/newview/CrashReporter.nib/info.nib delete mode 100644 linden/indra/newview/CrashReporter.nib/objects.xib create mode 100644 linden/indra/newview/ViewerInstall.cmake delete mode 100644 linden/indra/newview/crashreporter-Info.plist delete mode 100644 linden/indra/newview/files.lst create mode 100644 linden/indra/newview/installers/darwin/firstlook-dmg/Applications-alias.r create mode 100644 linden/indra/newview/installers/darwin/firstlook-dmg/_DS_Store create mode 100644 linden/indra/newview/installers/darwin/firstlook-dmg/_VolumeIcon.icns create mode 100644 linden/indra/newview/installers/darwin/firstlook-dmg/background.jpg delete mode 100644 linden/indra/newview/installers/darwin/mac_image_DS_Store delete mode 100644 linden/indra/newview/installers/darwin/mac_image_background.tga delete mode 100644 linden/indra/newview/installers/darwin/mac_image_hidden create mode 100644 linden/indra/newview/installers/darwin/publicnightly-dmg/Applications-alias.r create mode 100644 linden/indra/newview/installers/darwin/publicnightly-dmg/_DS_Store create mode 100644 linden/indra/newview/installers/darwin/publicnightly-dmg/_VolumeIcon.icns create mode 100644 linden/indra/newview/installers/darwin/publicnightly-dmg/background.jpg create mode 100644 linden/indra/newview/installers/darwin/release-dmg/Applications-alias.r create mode 100644 linden/indra/newview/installers/darwin/release-dmg/_DS_Store create mode 100644 linden/indra/newview/installers/darwin/release-dmg/_VolumeIcon.icns create mode 100644 linden/indra/newview/installers/darwin/release-dmg/background.jpg create mode 100644 linden/indra/newview/installers/darwin/releasecandidate-dmg/Applications-alias.r create mode 100644 linden/indra/newview/installers/darwin/releasecandidate-dmg/_DS_Store create mode 100644 linden/indra/newview/installers/darwin/releasecandidate-dmg/_VolumeIcon.icns create mode 100644 linden/indra/newview/installers/darwin/releasecandidate-dmg/background.jpg delete mode 100644 linden/indra/newview/linux_tools/exposed-symbols.txt create mode 100644 linden/indra/newview/llagentlanguage.cpp create mode 100644 linden/indra/newview/llagentlanguage.h create mode 100644 linden/indra/newview/llassetuploadqueue.cpp create mode 100644 linden/indra/newview/llassetuploadqueue.h delete mode 100644 linden/indra/newview/llcubemap.cpp delete mode 100644 linden/indra/newview/llcubemap.h create mode 100644 linden/indra/newview/llfloatermemleak.cpp create mode 100644 linden/indra/newview/llfloatermemleak.h delete mode 100644 linden/indra/newview/llfloaterreleasemsg.cpp delete mode 100644 linden/indra/newview/llfloaterreleasemsg.h delete mode 100644 linden/indra/newview/llglslshader.cpp delete mode 100644 linden/indra/newview/llglslshader.h delete mode 100644 linden/indra/newview/llhippo.cpp delete mode 100644 linden/indra/newview/llhippo.h delete mode 100644 linden/indra/newview/lllcd.cpp delete mode 100644 linden/indra/newview/lllcd.h delete mode 100644 linden/indra/newview/llpostprocess.cpp delete mode 100644 linden/indra/newview/llpostprocess.h delete mode 100644 linden/indra/newview/llrendersphere.cpp delete mode 100644 linden/indra/newview/llrendersphere.h create mode 100644 linden/indra/newview/llviewershadermgr.cpp create mode 100644 linden/indra/newview/llviewershadermgr.h create mode 100644 linden/indra/newview/macview.r delete mode 100644 linden/indra/newview/macview.xcodeproj/default.pbxuser delete mode 100644 linden/indra/newview/macview.xcodeproj/project.pbxproj delete mode 100644 linden/indra/newview/mozilla-theme/classic.jar delete mode 100644 linden/indra/newview/mozilla-theme/classic.manifest delete mode 100644 linden/indra/newview/newview.vcproj delete mode 100644 linden/indra/newview/newview_vc8.vcproj delete mode 100644 linden/indra/newview/newview_vc9.vcproj delete mode 100644 linden/indra/newview/postbuild.bat delete mode 100755 linden/indra/newview/prebuild.bat delete mode 100644 linden/indra/newview/releasenotes.txt delete mode 100644 linden/indra/newview/res/newViewRes.rc create mode 100644 linden/indra/newview/res/viewerRes.rc delete mode 100644 linden/indra/newview/secondlife setup build A08T01.bat delete mode 100644 linden/indra/newview/secondlife setup build B08T01.bat delete mode 100644 linden/indra/newview/secondlife setup build aditi.bat delete mode 100644 linden/indra/newview/secondlife setup build agni.bat delete mode 100644 linden/indra/newview/secondlife setup build aruna.bat delete mode 100644 linden/indra/newview/secondlife setup build dmz.bat delete mode 100644 linden/indra/newview/secondlife setup build durga.bat delete mode 100644 linden/indra/newview/secondlife setup build firstlookwindlight.bat delete mode 100644 linden/indra/newview/secondlife setup build ganga.bat delete mode 100644 linden/indra/newview/secondlife setup build mitra.bat delete mode 100644 linden/indra/newview/secondlife setup build mohini.bat delete mode 100644 linden/indra/newview/secondlife setup build nandi.bat delete mode 100644 linden/indra/newview/secondlife setup build radha.bat delete mode 100644 linden/indra/newview/secondlife setup build ravi.bat delete mode 100644 linden/indra/newview/secondlife setup build release candidate.bat delete mode 100644 linden/indra/newview/secondlife setup build shakti.bat delete mode 100644 linden/indra/newview/secondlife setup build siva.bat delete mode 100644 linden/indra/newview/secondlife setup build soma.bat delete mode 100644 linden/indra/newview/secondlife setup build uma.bat delete mode 100644 linden/indra/newview/secondlife setup build vaak.bat delete mode 100644 linden/indra/newview/secondlife setup build voicebeta.bat delete mode 100644 linden/indra/newview/secondlife setup build voicefirstlook.bat delete mode 100644 linden/indra/newview/secondlife setup build yami.bat delete mode 100644 linden/indra/newview/secondlife setup build.bat delete mode 100644 linden/indra/newview/skins/default/xui/en-us/LCD_text.xml create mode 100644 linden/indra/newview/skins/default/xui/en-us/floater_mem_leaking.xml delete mode 100644 linden/indra/newview/skins/default/xui/en-us/panel_preferences_LCD.xml create mode 100644 linden/indra/test/CMakeLists.txt delete mode 100644 linden/indra/test/MacTester.xcodeproj/project.pbxproj create mode 100644 linden/indra/test/assembly_tut.cpp delete mode 100644 linden/indra/test/files.lst create mode 100644 linden/indra/test/llassetuploadqueue_tut.cpp create mode 100644 linden/indra/test/lldir_tut.cpp create mode 100644 linden/indra/test/mock_http_client.cpp create mode 100644 linden/indra/test/mock_http_client.h delete mode 100644 linden/indra/test/test.vcproj delete mode 100644 linden/indra/test/test_vc8.vcproj delete mode 100644 linden/indra/test/test_vc9.vcproj create mode 100644 linden/indra/tools/vstool/README.txt create mode 100644 linden/indra/tools/vstool/VSTool.csproj create mode 100755 linden/indra/tools/vstool/VSTool.exe create mode 100644 linden/indra/tools/vstool/VSTool.sln create mode 100644 linden/indra/tools/vstool/main.cs create mode 100644 linden/indra/win_crash_logger/CMakeLists.txt delete mode 100644 linden/indra/win_crash_logger/win_crash_logger.vcproj delete mode 100644 linden/indra/win_crash_logger/win_crash_logger_vc8.vcproj delete mode 100644 linden/indra/win_crash_logger/win_crash_logger_vc9.vcproj create mode 100644 linden/indra/win_updater/CMakeLists.txt delete mode 100644 linden/indra/win_updater/win_updater.vcproj delete mode 100644 linden/indra/win_updater/win_updater_vc8.vcproj delete mode 100644 linden/indra/win_updater/win_updater_vc9.vcproj create mode 100644 linden/install.xml delete mode 100644 linden/libraries/i686-win32/include/GL/README.txt delete mode 100644 linden/libraries/i686-win32/include/GL/glext.h delete mode 100644 linden/libraries/i686-win32/include/GL/glut.h delete mode 100644 linden/libraries/i686-win32/include/GL/glxext.h delete mode 100644 linden/libraries/i686-win32/include/GL/wglext.h delete mode 100644 linden/libraries/include/GL/glh_extensions.h delete mode 100644 linden/libraries/include/GL/glh_genext.h delete mode 100755 linden/libraries/include/glh/glh_linear.h delete mode 100644 linden/libraries/include/llmozlib2.h create mode 100755 linden/scripts/build_version.py create mode 100755 linden/scripts/install.py diff --git a/linden/doc/contributions.txt b/linden/doc/contributions.txt index da98604..ea5ba5d 100644 --- a/linden/doc/contributions.txt +++ b/linden/doc/contributions.txt @@ -79,6 +79,7 @@ bushing Spatula VWR-424 Carjay McGinnis VWR-3737 + VWR-6154 Catherine Pfeffer VWR-1282 Dale Glass @@ -121,12 +122,16 @@ Farallon Greyskin Feep Larsson VWR-447 VWR-1314 + VWR-4444 +Fluf Fredriksson + VWR-3450 Fremont Cunningham VWR-1147 Gudmund Shepherd VWR-1873 Gigs Taggart SVC-493 + VWR-6 VWR-38 VWR-71 VWR-101 @@ -141,7 +146,9 @@ Gigs Taggart VWR-1434 VWR-1987 VWR-2065 + VWR-2491 VWR-2502 + VWR-2331 Ginko Bayliss VWR-4 Grazer Kline @@ -152,6 +159,7 @@ Gudmund Shepherd Hamncheese Omlet VWR-333 Henri Beauchamp + VWR-1320 VWR-1406 VWR-4157 Hikkoshi Sakai @@ -178,6 +186,8 @@ Jacek Antonelli VWR-597 VWR-2448 VWR-3605 +JB Kraft + VWR-5283 Joghert LeSabre VWR-64 Kage Pixel @@ -200,6 +210,9 @@ Michelle2 Zenovka VWR-2652 VWR-2834 VWR-3749 + VWR-4506 + VWR-7831 + VWR-4022 Mm Alder VWR-3777 VWR-4794 @@ -260,6 +273,7 @@ Nicholaz Beresford VWR-1721 VWR-1723 VWR-1732 + VWR-1754 VWR-1769 VWR-1808 VWR-1861 @@ -369,6 +383,7 @@ Wilton Lundquist Whoops Babii VWR-631 VWR-1640 + VWR-3340 Zarkonnen Decosta VWR-253 Zi Ree diff --git a/linden/doc/releasenotes-where.txt b/linden/doc/releasenotes-where.txt index 89125d2..4af5866 100644 --- a/linden/doc/releasenotes-where.txt +++ b/linden/doc/releasenotes-where.txt @@ -1,5 +1,5 @@ For full release notes, see: - indra/newview/releasenotes.txt - -This is the same asset sourced by the viewer for displaying release notes. + http://wiki.secondlife.com/wiki/Release_Notes +For a log of viewer changes, see: + doc/viewer-changes.txt diff --git a/linden/doc/viewer-changes.txt b/linden/doc/viewer-changes.txt new file mode 100644 index 0000000..e69de29 diff --git a/linden/etc/message.xml b/linden/etc/message.xml index 701d049..80dc560 100644 --- a/linden/etc/message.xml +++ b/linden/etc/message.xml @@ -360,6 +360,14 @@ true + ParcelObjectOwnersReply + + flavor + llsd + trusted-sender + true + + ParcelProperties flavor @@ -368,6 +376,14 @@ true + LandStatReply + + flavor + llsd + trusted-sender + true + + avatarnotesrequest service_name @@ -433,6 +449,14 @@ trusted-sender false + + LandStatReply + + flavor + llsd + trusted-sender + false + StartGroupProposal @@ -477,7 +501,7 @@ false UpdateScriptAgentInventory - true + false UpdateGestureTaskInventory false @@ -486,7 +510,7 @@ true UpdateScriptTaskInventory - true + false ViewerStartAuction true diff --git a/linden/indra/CMakeLists.txt b/linden/indra/CMakeLists.txt new file mode 100644 index 0000000..fac2afa --- /dev/null +++ b/linden/indra/CMakeLists.txt @@ -0,0 +1,102 @@ +# -*- cmake -*- + +# cmake_minimum_required should appear before any +# other commands to guarantee full compatibility +# with the version specified + +# The "cmake -E touch" command was released with 2.4.8. +cmake_minimum_required(VERSION 2.4.8 FATAL_ERROR) + +# This makes cmake 2.6 not complain about a version +# 2.4 compatibility mode +if(COMMAND cmake_policy) + cmake_policy(SET CMP0003 OLD) +endif(COMMAND cmake_policy) + +project(SecondLife) + +set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake") + +include(Variables) + +if (NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING + "Build type. One of: Debug Release RelWithDebInfo" FORCE) +endif (NOT CMAKE_BUILD_TYPE) + +# For the library installation process; +# see cmake/Prebuild.cmake for the counterpart code. +file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/temp) +file(WRITE ${CMAKE_BINARY_DIR}/temp/sentinel_installed "0") +add_subdirectory(cmake) + +add_subdirectory(${LIBS_OPEN_PREFIX}llaudio) +add_subdirectory(${LIBS_OPEN_PREFIX}llcharacter) +add_subdirectory(${LIBS_OPEN_PREFIX}llcommon) +add_subdirectory(${LIBS_OPEN_PREFIX}llimage) +add_subdirectory(${LIBS_OPEN_PREFIX}llimagej2coj) +add_subdirectory(${LIBS_OPEN_PREFIX}llinventory) +add_subdirectory(${LIBS_OPEN_PREFIX}llmath) +add_subdirectory(${LIBS_OPEN_PREFIX}llmedia) +add_subdirectory(${LIBS_OPEN_PREFIX}llmessage) +add_subdirectory(${LIBS_OPEN_PREFIX}llprimitive) +add_subdirectory(${LIBS_OPEN_PREFIX}llrender) +add_subdirectory(${LIBS_OPEN_PREFIX}llvfs) +add_subdirectory(${LIBS_OPEN_PREFIX}llwindow) +add_subdirectory(${LIBS_OPEN_PREFIX}llxml) + +if (EXISTS ${LIBS_CLOSED_DIR}llkdu AND NOT STANDALONE) + add_subdirectory(${LIBS_CLOSED_PREFIX}llkdu) +endif (EXISTS ${LIBS_CLOSED_DIR}llkdu AND NOT STANDALONE) + +add_subdirectory(${LIBS_OPEN_PREFIX}lscript) + +if (WINDOWS AND EXISTS ${LIBS_CLOSED_DIR}copy_win_scripts) + add_subdirectory(${LIBS_CLOSED_PREFIX}copy_win_scripts) +endif (WINDOWS AND EXISTS ${LIBS_CLOSED_DIR}copy_win_scripts) + +add_custom_target(viewer) +if (VIEWER) + add_subdirectory(${LIBS_OPEN_PREFIX}llcrashlogger) + add_subdirectory(${LIBS_OPEN_PREFIX}llui) + + if (LINUX) + add_subdirectory(${VIEWER_PREFIX}linux_crash_logger) + add_dependencies(viewer linux-crash-logger) + elseif (DARWIN) + add_subdirectory(${VIEWER_PREFIX}mac_crash_logger) + add_subdirectory(${VIEWER_PREFIX}mac_updater) + add_dependencies(viewer mac-updater mac-crash-logger) + elseif (WINDOWS) + add_subdirectory(${VIEWER_PREFIX}win_crash_logger) + add_subdirectory(${VIEWER_PREFIX}win_updater) + add_dependencies(viewer windows-updater windows-crash-logger) + elseif (SOLARIS) + add_subdirectory(solaris_crash_logger) + add_dependencies(viewer solaris-crash-logger) + endif (LINUX) + + add_subdirectory(${VIEWER_PREFIX}newview) + add_dependencies(viewer secondlife-bin) +endif (VIEWER) + +# Linux builds the viewer and server in 2 separate projects +# In order for ./develop.py build server to work on linux, +# the viewer project needs a server target. +# This is not true for mac and windows. +if (LINUX) + add_custom_target(server) +endif (LINUX) +if (SERVER) + if (NOT LINUX) + add_custom_target(server) + endif (NOT LINUX) + include(${SERVER_PREFIX}Server.cmake) +endif (SERVER) + +# Windows builds include tools like VFS tool +if (SERVER) + if (WINDOWS) + add_subdirectory(${SERVER_PREFIX}tools) + endif (WINDOWS) +endif (SERVER) diff --git a/linden/indra/SConstruct b/linden/indra/SConstruct deleted file mode 100644 index 9353317..0000000 --- a/linden/indra/SConstruct +++ /dev/null @@ -1,895 +0,0 @@ -################################################# -*- python -*- -# -# SConstruct makefile for Second Life viewer and servers. -# -# To build everything: -# -# scons ARCH=all BTARGET=all DISTCC=yes -# -# To build a standalone viewer, you'll need the following packages -# installed, with headers. We pick up the correct flags to use for -# these libraries using the "pkg-config" command. -# -# cairo glib-2.0 atk gmobile-2.0 gdk-2.0 gdk-pixbuf-2.0 pango pangoft2 pangox pangoxft gtk+-2.0 sdl vorbis vorbisenc vorbisfile -# -# Then build as follows: -# -# scons BTARGET=client STANDALONE=yes MOZLIB2=no ELFIO=no DISTCC=no -# -# For help on options: -# -# scons -h -# -# Originally written by Tom Yedwab, 6/2006. -# -################################################# - - -import glob -import os -import random -import re -import sys - -platform = sys.platform -if platform == 'linux2': - platform = 'linux' - -###################### -# GET VERSION # -###################### - -def get_version(type): - file = open('llcommon/llversion%s.h' % type,"r") - file_str = file.read() - file.close() - - m = re.search('const S32 LL_VERSION_MAJOR = (\d+);', file_str) - VER_MAJOR = m.group(1) - m = re.search('const S32 LL_VERSION_MINOR = (\d+);', file_str) - VER_MINOR = m.group(1) - m = re.search('const S32 LL_VERSION_PATCH = (\d+);', file_str) - VER_PATCH = m.group(1) - m = re.search('const S32 LL_VERSION_BUILD = (\d+);', file_str) - VER_BUILD = m.group(1) - version = "%(VER_MAJOR)s.%(VER_MINOR)s.%(VER_PATCH)s.%(VER_BUILD)s" % locals() - - return version - -version_viewer = get_version('viewer') -version_server = get_version('server') - - -############### -# SYSTEM INFO # -############### - -# Debian Sarge has a broken glibc that leads to build failures on -# *non*-Sarge systems (because of prebuilt static libraries built on -# Sarge). - -try: - debian_sarge = open('/etc/debian_version').read().strip() == '3.1' -except: - debian_sarge = False - -######################### -# COMMAND LINE OPTIONS # -######################### - -DEFAULT_CHANNEL='Release' # TODO: Make this the full channel name, i.e. "Second Life Release" - - -opts = Options() -opts.AddOptions( - EnumOption('BUILD', 'Set build type', 'releasefordownload', - allowed_values=('debug', 'release', 'releasenoopt', 'releasefordownload')), - EnumOption('ARCH', 'Set architecture', 'i686', - allowed_values=('i686', 'powerpc', 'x86_64')), - EnumOption('BTARGET', 'Set build target', 'server', - allowed_values=('client', 'server', 'all')), - BoolOption('DISTCC', 'Enabled distcc', True), - BoolOption('MOZLIB2', 'Enabled llmozlib2/mozilla support', True), - BoolOption('FMOD', 'Enabled FMOD audio support', True), - BoolOption('GSTREAMER', 'Enabled GStreamer support', True), - BoolOption('COLORGCC', 'Enabled colorgcc', True), - EnumOption('GRID', 'Client package\'s default grid', 'default', - allowed_values=('default', 'aditi', 'agni', 'durga', 'ganga', 'shakti', 'siva', 'soma', 'uma', 'vaak', 'yami', 'mohini', 'aruna', 'mitra', 'nandi', 'radha', 'ravi')), - ('CHANNEL', 'Client package\'s channel', DEFAULT_CHANNEL), - ('LOGINCHANNEL', 'Client package\'s channel for login only', False), - BoolOption('ELFIO', 'Enabled enhanced backtraces with libELFIO symbol extraction support', True), - BoolOption('STANDALONE', 'Build using system packages (implies OPENSOURCE)', False), - BoolOption('RUNTESTS', 'Run tests at end of compilation', True), - BoolOption('OPENSOURCE', 'Build using only non-proprietary dependencies', True) # OPENSOURCE: do not edit this line -) -optenv = Environment(options = opts) -Help(opts.GenerateHelpText(optenv)) - -build_param = optenv['BUILD'] -arch = optenv['ARCH'] -target_param = optenv['BTARGET'] -enable_distcc = optenv['DISTCC'] -enable_mozlib = optenv['MOZLIB2'] -enable_gstreamer = optenv['GSTREAMER'] -enable_colorgcc = optenv['COLORGCC'] -grid = optenv['GRID'] -channel = optenv['CHANNEL'] -login_channel = optenv['LOGINCHANNEL'] -standalone = optenv['STANDALONE'] -runtests = optenv['RUNTESTS'] -opensource = standalone or optenv['OPENSOURCE'] -enable_fmod = not opensource and optenv['FMOD'] -elfio = optenv['ELFIO'] - -targets = [ target_param ] - -if target_param == 'all': - targets = [ 'client', 'server' ] - -# Set this to False if you don't want your source files copied into -# the object directory in /tmp. -duplicate = True - -if standalone and platform != 'linux': - print >> sys.stderr, 'Warning: standalone builds have only been tested on Linux' - -standalone_pkgs = [ - 'atk', - 'cairo', - 'fontconfig', - 'freetype2', - 'gdk-2.0', - 'gdk-pixbuf-2.0', - 'glib-2.0', - 'gmodule-2.0', - 'gthread-2.0', - 'gtk+-2.0', - 'libpng', - 'pango', - 'pangoft2', - 'pangox', - 'pangoxft', - 'sdl', - 'vorbis', - 'vorbisenc', - 'vorbisfile', - ] - -standalone_net_pkgs = [ - 'apr-1', - 'apr-util-1', - 'libcrypto', - 'libcurl', - 'libssl', - ] - -def pkgconfig(opt, pkgs=None): - if pkgs is None: - pkgs = standalone_pkgs + standalone_net_pkgs - return os.popen('pkg-config %s %s' % - (opt, ' '.join(pkgs))).read().strip() - -if standalone: - missing = [pkg for pkg in standalone_pkgs + standalone_net_pkgs - if os.system('pkg-config --exists ' + pkg)] - if missing: - print >> sys.stderr, ('Error: pkg-config cannot find these ' - 'packages: %s' % ' '.join(missing)) - sys.exit(2) - -##################### -# ITERATE TARGETS # -##################### - -for build_target in targets: - buildtype = build_param - if build_target == 'server' and buildtype == 'releasefordownload': - buildtype = 'release' - - system_str = arch + '-' + platform - - print 'Building ' + build_target + ' ' + version_server + ' on ' + system_str + ' (' + buildtype + ')' - - system_lib_dir = '../libraries/' + system_str - havok_lib_dir = '../libraries/' + system_str - lib_dir = './lib_' + buildtype + '_' + build_target + '/' + system_str - - if build_target == 'client': - system_lib_dir += '/lib_release_client' - elif buildtype == 'debug': - havok_lib_dir += '/lib_debug/havok/hk460' - system_lib_dir += '/lib_debug' - lib_dir = './lib_debug_' + build_target + '/' + system_str - else: - havok_lib_dir += '/lib_release/havok/hk460' - system_lib_dir += '/lib_release' - lib_dir = './lib_release_' + build_target + '/' + system_str - - try: - build_dir_prefix = os.environ['TEMP_BUILD_DIR'] - except: - build_dir_prefix = '/tmp/' + os.environ['USER'] - - build_dir = build_dir_prefix + os.getcwd() + '/' + system_str + '-' + build_target + '-' + buildtype - - ### Base include directories ### - - include_dirs = Split(""" - ./ ./llcommon ./llmath ./llwindow ./llaudio ./llcharacter ./llcrashlogger - ./lldatabase ./llimage ./llinventory ./llmedia ./llmessage ./llphysics - ./llprimitive ./llrender ./llscene ./llui ./llvfs ./llwindow - ./llxml ./lscript ./lscript/lscript_compile - ../libraries/include - """ + - '../libraries/' + system_str + '/include' ) - - client_external_libs = [] - system_link_flags = '' - - include_dirs += Split('../libraries/include/havok/hk460/physics ../libraries/include/havok/hk460/common ') - - if platform != 'linux' and build_target == 'client' and enable_mozlib: - - ### Mozilla include directories ### - - mozilla_dir = '../libraries/' + system_str + '/include/mozilla' - include_dirs += Split( - mozilla_dir + '/include/webbrwsr ' + - mozilla_dir + '/include/docshell ' + - mozilla_dir + '/include/dom ' + - mozilla_dir + '/include/xpcom ' + - mozilla_dir + '/include/widget ' + - mozilla_dir + '/include/gfx ' + - mozilla_dir + '/include/string ' + - mozilla_dir + '/include/uriloader ' + - mozilla_dir + '/include/view ' + - mozilla_dir + '/include/layout ' + - mozilla_dir + '/include/content ' + - mozilla_dir + '/include/locale ' + - mozilla_dir + '/include/profdirserviceprovider ' + - mozilla_dir + '/include/xulapp ' + - mozilla_dir + '/include/pref ' + - mozilla_dir + '/sdk/include') - - ############## - # CPP Flags # - ############## - - # Generic GCC flags - # cflags = '-g -pipe -Wall -Wno-reorder -Wno-trigraphs -Wno-sign-compare -Werror -fexceptions ' - cflags = '-g -pipe -Wall -Wno-reorder -Wno-trigraphs -Wno-sign-compare -fexceptions ' - cxxflags = '' - #cppflags = '-D_FORTIFY_SOURCE=2 ' - cppflags = '' - if standalone: - cppflags += '-DLL_STANDALONE ' - - if arch == 'i686': - cflags += '-m32 ' - system_link_flags += '-m32 ' - - if build_target == 'server': - # Server flags - cppflags += '-D_GNU_SOURCE -DLL_MESA_HEADLESS=1 -DLL_MESA=1 ' - cxxflags += '-ftemplate-depth-60 ' - if arch == 'i686': - cflags += '-march=pentiumpro ' - if debian_sarge: - def_server_cppflags = '' - else: - def_server_cppflags = '-DCTYPE_WORKAROUND' - server_cppflags = os.environ.get('SERVER_CPPFLAGS', - def_server_cppflags) - cppflags += server_cppflags + ' ' - else: - # Viewer flags - cflags += '-pthread -D_REENTRANT -fno-math-errno -fsigned-char -fno-strict-aliasing ' - cppflags += '-DLL_MESA_HEADLESS=0 -DLL_MESA=0 ' - try: - client_cppflags = os.environ['CLIENT_CPPFLAGS'] - except: - client_cppflags = '' - cppflags += client_cppflags + ' ' - - - if platform == 'linux': - # Linux-only flags - cppflags += '-DLL_LINUX=1 ' - if build_target == 'client': - cppflags += '-DAPPID=secondlife -DLL_SDL=1 ' - if arch == 'x86_64' or arch == 'x86_64cross' or not enable_fmod: - cppflags += '-DLL_FMOD=0 ' - cppflags += '-DLL_X11=1 -DLL_GTK=1 ' - if standalone: - include_dirs += [d[2:] for d in - pkgconfig('--cflags-only-I').split()] - client_external_libs += [ 'boost_program_options-gcc34-mt', 'boost_signals-gcc34-mt', 'boost_regex-gcc34-mt'] - else: - client_external_libs += [ 'fontconfig', 'gtk-x11-2.0', 'atk-1.0', 'gmodule-2.0', 'gdk-x11-2.0', 'gdk_pixbuf-2.0', 'pango-1.0', 'pangoft2-1.0', 'pangox-1.0', 'pangoxft-1.0', 'Xinerama', 'boost_program_options-gcc34-mt', 'boost_signals-gcc34-mt', 'boost_regex-gcc34-mt' ] - incdirs = [ 'ELFIO', 'atk-1.0', 'glib-2.0', 'gtk-2.0', - 'llfreetype2', 'pango-1.0' ] - include_dirs += ['../libraries/' + system_str + '/include/' + d - for d in incdirs] - - if elfio: - client_external_libs += [ 'ELFIO' ] - else: - cppflags += '-DLL_ELFBIN=0 ' - - # llmozlib2 stuff - if enable_mozlib: - cppflags += '-DLL_LLMOZLIB_ENABLED=1 ' - client_external_libs += [ 'llmozlib2' ] - client_external_libs += [ 'mozjs', 'nspr4', 'plc4', 'plds4', 'profdirserviceprovider_s', 'xul' ] - else: - cppflags += '-DLL_LLMOZLIB_ENABLED=0 ' - - # GStreamer stuff - if enable_gstreamer: - cppflags += '-DLL_GSTREAMER_ENABLED=1 ' - client_external_libs += [ 'glib-2.0', 'gobject-2.0', 'gthread-2.0' ] - include_dirs += [ '../libraries/' + system_str + '/include/gstreamer-0.10' ] - include_dirs += [ '../libraries/' + system_str + '/include/glib-2.0', '../libraries/' + system_str + '/include/glib-2.0/include' ] - include_dirs += [ '../libraries/' + system_str + '/include/libxml2'] - else: - cppflags += '-DLL_GSTREAMER_ENABLED=0 ' - - cppflags += '-DLL_CURRENT_HAVOK_VERSION=460 ' - else: - # Mac-only flags - cflags += '-x c++ -arch ppc -pipe -Wno-trigraphs -fpascal-strings -faltivec -fasm-blocks -g -fmessage-length=0 -mtune=G4 -Wno-deprecated-declarations -Wno-invalid-offsetof -mmacosx-version-min=10.3 -Wmost -Wno-sign-compare -Wno-switch -fconstant-cfstrings -ffor-scope -Wno-reorder -fexceptions ' - cppflags += '-x c++ -DLL_DARWIN=1 -fpch-preprocess -F./newview/build/Deployment -fconstant-cfstrings -isysroot /Developer/SDKs/MacOSX10.3.9.sdk ' - - if standalone: - gcc_bin = 'g++' - elif build_target != 'client': - gcc_bin = 'g++-3.3' - elif arch == 'x86_64cross': - gcc_bin = '/opt/crosstool/gcc-4.0.2-glibc-2.3.6/x86_64-unknown-linux-gnu/bin/x86_64-unknown-linux-gnu-gcc' - strip_cmd = '/opt/crosstool/gcc-4.0.2-glibc-2.3.6/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/bin/strip -S -o $TARGET $SOURCE' - - else: - gcc_bin = 'g++-4.1' - - # Are we using the Intel compiler? - if gcc_bin.find('icpc') >= 0: - cflags += '-wr193,654,981,1125 -w1 ' - elif build_target == 'client': - cflags += '-falign-loops=16 -ffast-math ' - - cxxflags += cflags - - ### Build type-specific flags ### - - debug_cflags = cflags + '-fno-inline -O0 ' - debug_cxxflags = cxxflags + '-fno-inline -O0 ' - debug_cppflags = cppflags + '-D_DEBUG -DLL_DEBUG=1 ' - release_cflags = cflags + '-O2 ' - release_cxxflags = cxxflags + '-O2 ' - release_cppflags = cppflags + '-DNDEBUG -DLL_RELEASE=1 ' - releasenoopt_cflags = cflags + '-O0 ' - releasenoopt_cxxflags = cxxflags + '-O0 ' - releasenoopt_cppflags = cppflags + '-DNDEBUG -DLL_RELEASE=1 ' - releasefordownload_cflags = cflags + '-O2 -fno-stack-protector ' - releasefordownload_cxxflags = cxxflags + '-O2 -fno-stack-protector ' - releasefordownload_cppflags = cppflags + '-DNDEBUG -DLL_RELEASE=1 -DLL_RELEASE_FOR_DOWNLOAD=1 ' - - ################ - # ENVIRONMENT # - ################ - - # If you strip more aggressively than -S then the quality of crash- - # 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' - - compiler = gcc_bin - compiler_no_distcc = compiler - if enable_distcc: - compiler = 'distcc ' + gcc_bin - - lib_path = [lib_dir] + [system_lib_dir] - - mysql_lib_dir = '/usr/lib/mysql4/mysql' - if os.path.isdir(mysql_lib_dir): - lib_path.append(mysql_lib_dir) - - if standalone: - system_link_flags += pkgconfig('--libs-only-L') + ' ' - system_link_flags += pkgconfig('--libs-only-other') + ' ' - - base_env = Environment(CXX = compiler, - CPPPATH = include_dirs, - LIBPATH = lib_path + [havok_lib_dir], - LINKFLAGS = system_link_flags + '--no-keep-memory --reduce-memory-overheads ' ) - - ### Environments for various build types ### - - env = base_env.Copy(CFLAGS=releasefordownload_cflags, - CPPFLAGS=releasefordownload_cppflags, - CXXFLAGS=releasefordownload_cxxflags) - - if buildtype == 'debug': - env = base_env.Copy(CFLAGS=debug_cflags, - CPPFLAGS=debug_cppflags, - CXXFLAGS=debug_cxxflags) - - if buildtype == 'havok1debug': - env = base_env.Copy(CFLAGS=debug_cflags, - CPPFLAGS=debug_cppflags, - CXXFLAGS=debug_cxxflags) - - if buildtype == 'release': - env = base_env.Copy(CFLAGS=release_cflags, - CPPFLAGS=release_cppflags, - CXXFLAGS=release_cxxflags) - - if buildtype == 'releasenoopt': - env = base_env.Copy(CFLAGS=releasenoopt_cflags, - CPPFLAGS=releasenoopt_cppflags, - CXXFLAGS=releasenoopt_cxxflags) - - # ccache needs this to be set - try: - env['ENV']['CCACHE_DIR'] = os.environ['CCACHE_DIR'] - except: - print "No CCACHE_DIR set." - - env_no_distcc = env.Copy(CXX = compiler_no_distcc) - - vec_match = re.compile("_vec\.") - env_vec = env.Copy() # _vec is for default vector optimizations or none - - sse_match = re.compile("_sse\.") - env_sse = env.Copy() - env_sse.Append(CPPFLAGS = ' -msse -mfpmath=sse') - - sse2_match = re.compile("_sse2\.") - env_sse2 = env.Copy() - env_sse2.Append(CPPFLAGS = ' -msse2 -mfpmath=sse') - - - ### Distributed build hosts ### - - if enable_distcc: - if 'DISTCC_HOSTS' in os.environ: - hosts = os.environ['DISTCC_HOSTS'] - else: - hosts = [ 'localhost/2', ] - if arch == 'i686': - dead = [] - stations = [s for s in xrange(36) if s not in dead] - random.shuffle(stations) - hosts += ['station%d.lindenlab.com/2,lzo' % s for s in stations] - hosts = ' '.join(hosts) - print "Distributing to hosts: " + hosts - env['ENV']['DISTCC_HOSTS'] = hosts - env['ENV']['USER'] = os.environ['USER'] - env['ENV']['HOME'] = os.environ['HOME'] - #env['ENV']['SSH_AUTH_SOCK'] = os.environ['SSH_AUTH_SOCK'] - - if enable_colorgcc: - env['ENV']['PATH'] = os.environ['PATH'] - env['ENV']['TERM'] = os.environ['TERM'] - env['ENV']['HOME'] = os.environ['HOME'] - - ### Configure lex and yacc ### - env.Append(YACCFLAGS = ["-v", "-d"]) - env.CFile(target=build_dir+'/lscript/lscript_compile/indra.l.cpp', source='lscript/lscript_compile/indra.l') - env.CFile(target=build_dir+'/lscript/lscript_compile/indra.y.c', source='lscript/lscript_compile/indra.y') - env.Command(build_dir+'/lscript/lscript_compile/indra.y.cpp',build_dir+'/lscript/lscript_compile/indra.y.c', - [Move('$TARGET','$SOURCE'),Delete(build_dir+'/lscript/lscript_compile/indra.y.output')]) - - ##################### - # HELPER FUNCTIONS # - ##################### - - ## handle special compiler modes - - def file_obj(file): - if file == 'newsim/lltask.cpp': - print 'Found lltask!' - return env_no_distcc.Object(file) - elif vec_match.search(file) != None: - return env_vec.Object(file) - elif sse_match.search(file) != None: - return env_sse.Object(file) - elif sse2_match.search(file) != None: - return env_sse2.Object(file) - else: - return file - - ### Load a files.lst and files.PLATFORM.lst for each module ### - - def load_files(module, source_fname): - new_list = [] - try: - list_file = open('./' + module + '/' + source_fname, 'r') - list = Split(list_file.read()) - for x in list: - if not x.startswith('#'): - file = os.path.join(build_dir, x) - new_list.append(file_obj(file)) - list_file.close() - except IOError, val: - print 'Error: unable to open file list',source_fname, - print 'for module', module + ":", val - return [] - - try: - platform_list_file = open('./' + module + '/files.' + platform + '.lst', 'r') - list = Split(platform_list_file.read()) - for x in list: - file = os.path.join(build_dir, x) - new_list.append(file_obj(file)) - platform_list_file.close() - except IOError: - return new_list - - return new_list - - ### Create a static library from the module ### - - def create_static_module_from_dir( - input_dir, - mod_name, - local_flags="", - source_files = 'files.lst', - extra_depends=None, - source_env=env): - files_list = load_files(input_dir, source_files) - BuildDir(build_dir + '/' + input_dir, input_dir, duplicate=duplicate) - local_env = source_env.Copy(CPPFLAGS=env['CPPFLAGS'] + ' ' + local_flags) - if extra_depends: - for x in files_list: - Depends(local_env.Object(x), extra_depends) - tgt = local_env.StaticLibrary(lib_dir + '/' + mod_name, files_list) - Default(tgt) - - def create_static_module(module, local_flags="", source_env=env, - source_files='files.lst', extra_depends=None): - create_static_module_from_dir(module, module, local_flags, - source_files, extra_depends, - source_env=source_env) - - def create_dynamic_module( - module, - local_flags="", - module_libs = [], - source_files = 'files.lst'): - # -Bsymbolic avoids having the lib pull symbols from the app's - # namespace instead of its own by default. This avoids some - # rediculous problems with multiple destruction of the wrong - # objects, though has some gotchas of its own. - dyn_link_flags = '-Wl,-Bsymbolic' - files_list = load_files(module, source_files) - BuildDir(build_dir + '/' + module, module, duplicate=duplicate) - local_env = env.Copy(CPPFLAGS = env['CPPFLAGS'] + ' ' + local_flags, - LINKFLAGS = env['LINKFLAGS'] + ' ' + dyn_link_flags) - tgt = local_env.SharedLibrary(lib_dir + '/' + module, files_list, LIBS = module_libs) - Default(tgt) - - # Some libraries need to be built using PIC so that they can be - # linked into libllkdu.so. If we're not building libllkdu.so, we - # don't need to add the PIC flag. - def create_cond_module(module, module_libs=[]): - if build_target == 'client' and not opensource: - shared_env = env.Copy(CFLAGS=env['CFLAGS'] + '-fpic ', - CXXFLAGS=env['CXXFLAGS'] + '-fpic ') - create_static_module(module=module, source_env=shared_env) - else: - create_static_module(module=module, source_env=env) - - ### Create an executable from the module ### - - def create_executable( - exec_file, module, module_libs, source_files = 'files.lst'): - files_list = load_files(module, source_files) - BuildDir(build_dir + '/' + module, module, duplicate=duplicate) - tgt = env.Program(exec_file, files_list, LIBS = module_libs) - Default(tgt) - - - ### Check the message template for compatibility with the base ### - tgt = env.Command("template_verifier_output", - '../scripts/template_verifier.py', - 'python $SOURCE --mode="development" --cache_master 2>&1') - Default(tgt) - AlwaysBuild(tgt) - - #################### - # BUILD LIBRARIES # - #################### - - create_cond_module('llcommon') - create_cond_module('llmath') - create_cond_module('llvfs') - create_cond_module('llimagej2coj', module_libs=['openjpeg']) - create_cond_module('llimage', module_libs=['llimagej2coj', 'jpeg', 'png12']) - create_static_module('llcrashlogger') - create_static_module('llmessage') - create_static_module('llinventory') - create_static_module('llcharacter') - create_static_module('llprimitive') - create_static_module('llrender') - create_static_module('llwindow') - create_static_module('llxml') - create_static_module('lscript', extra_depends=build_dir + '/lscript/lscript_compile/indra.y.h') - - if standalone: - net_external_libs = [d[2:] for d in - pkgconfig('--libs-only-l', - standalone_net_pkgs).split()] - else: - net_external_libs = [ 'curl', 'ssl', 'crypto', 'aprutil-1', 'apr-1' ] - net_external_libs += [ 'cares', 'expat' ] - - common_external_libs = net_external_libs + [ 'xmlrpc-epi', 'z' ] - - if build_target == 'client': - if platform == 'linux': - ############################# - # BUILD LINUX_CRASH_LOGGER # - ############################# - output_crashlogger_bin = 'linux_crash_logger/linux-crash-logger-' + arch + '-bin' - if standalone: - external_libs = net_external_libs - external_libs += [d[2:] for d in - pkgconfig('--libs-only-l', ['gtk+-2.0']).split()] - else: - external_libs = net_external_libs + [ 'db-4.2', 'gtk-x11-2.0' ] - external_libs += ['boost_signals-gcc34-mt'] - internal_libs = [ 'llui', 'llxml', 'llmessage', 'llvfs', 'llmath', 'llcommon' ] - 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') - create_static_module('llui') - - if not opensource: - create_dynamic_module('llkdu', '', ['llimage', 'llvfs', 'llmath', 'llcommon', 'apr-1', 'kdu_v42R']) - - ################## - # BUILD NEWVIEW # - ################## - output_bin = 'newview/secondlife-' + arch + '-bin' - - external_libs = client_external_libs + common_external_libs - - if standalone: - external_libs += [ d[2:] for d in - pkgconfig('--libs-only-l').split() ] - else: - external_libs += [ 'freetype', 'SDL', 'vorbisenc', - 'vorbisfile', 'vorbis', 'ogg', 'db-4.2' ] - - external_libs += [ 'jpeg', 'openjpeg', 'png12', 'GL', 'GLU' ] - - if arch != 'x86_64' and arch != 'x86_64cross': - if enable_fmod: - external_libs += [ 'fmod-3.75' ] - if buildtype == 'debug': - external_libs += ['tcmalloc', 'stacktrace'] - - internal_libs = [ 'lscript', 'llwindow', 'llrender', 'llprimitive', - 'llmedia', 'llinventory', - 'llimage', 'llimagej2coj', - 'llcharacter', 'llaudio', 'llui', 'llxml', - 'llmessage', 'llvfs', 'llmath', 'llcommon' ] - - create_executable(output_bin + '-globalsyms', 'newview', internal_libs + external_libs) - env.Command(output_bin, output_bin + '-globalsyms', hidesyms_cmd) - Default(output_bin) - - if buildtype == 'releasefordownload': - - ####################### - # PACKAGE THE CLIENT # - ####################### - - if platform == 'linux': - env.Command(output_bin + '-stripped', output_bin, strip_cmd) - env.Command(output_crashlogger_bin + '-stripped', output_crashlogger_bin, strip_cmd) - product_name = 'SecondLife_' + arch + '_' + "_".join(version_viewer.split(".")) - if grid not in ['default', 'agni']: - product_name += "_" + grid.upper() - if channel != DEFAULT_CHANNEL: - product_name += "_" + "".join((channel.upper()).split()) - package_name = product_name + '.tar.bz2' - complete_channel = 'Second Life ' + channel - cmd = 'rm -rf newview/%(pn)s* && newview/viewer_manifest.py --grid=%(grid)s --channel=\'%(ch)s\' --installer_name=%(pn)s --arch=%(arch)s' % { - 'pn': product_name, - 'grid':grid, - 'ch':complete_channel, - 'arch':arch} - if login_channel: - cmd += ' --login_channel=\'Second Life %s\'' % (login_channel) - env.Command('newview/' + package_name, 'newview/viewer_manifest.py', cmd) - Depends('newview/' + package_name, output_bin + '-stripped') - Depends('newview/' + package_name, output_crashlogger_bin + '-stripped') - Default('newview/' + package_name) - - elif build_target == 'server': - create_static_module('lldatabase') - create_static_module('llphysics', source_files='files.lst') - create_static_module('llscene') - create_static_module_from_dir('llkdu', 'llkdustatic') - - - ################## - # BUILD SERVERS # - ################## - file_suffix = '' - if buildtype == 'debug' or buildtype == 'havok1debug': - file_suffix = '_debug' - boost_signals_lib = 'boost_signals-gcc33-mt-d' - boost_libs = [ 'boost_regex-gcc33-mt-d', boost_signals_lib ] - else: - boost_signals_lib = 'boost_signals-gcc33-mt' - boost_libs = [ 'boost_regex-gcc33-mt', boost_signals_lib ] - - common_external_libs += [ 'pthread' ] - - # Chatter test application - external_libs = common_external_libs - internal_libs = [ 'llmessage', 'llvfs', 'llmath', 'llcommon' ] - create_executable('test_apps/chatter/chatter', 'test_apps/chatter', - internal_libs + external_libs) - - # Tool to buffer all of standard input to memory. - create_executable('tools/simbin2xml/buffer_file/buffer_file', - 'tools/simbin2xml/buffer_file', "") - - # Simstate binary to XML utility. - external_libs = common_external_libs - internal_libs = [ 'llxml', 'llcommon', 'llmath' ] - create_executable('tools/simbin2xml/simbin2xml', 'tools/simbin2xml', - internal_libs + external_libs) - - # Launcher - external_libs = common_external_libs - internal_libs = [ 'llmessage', 'llvfs', 'llmath', 'llcommon' ] - create_executable('launcher/launcher' + file_suffix, 'launcher', - internal_libs + external_libs) - - # Dataserver - external_libs = common_external_libs + boost_libs + [ - 'mysqlclient', 'tcmalloc', 'stacktrace', - ] - internal_libs = [ 'llcharacter', 'lldatabase', 'llimage', 'llimagej2coj', 'llinventory', - 'llscene', 'llmessage', 'llvfs', 'llxml', 'llcommon', 'llmath' ] - create_executable('dataserver/dataserver' + file_suffix, 'dataserver', - internal_libs + external_libs) - - # Spaceserver - external_libs = common_external_libs + ['mysqlclient'] - internal_libs = ['llscene', 'lldatabase', 'llmessage', 'llvfs', - 'llmath', 'llcommon'] - create_executable('newspace/spaceserver' + file_suffix, 'newspace', - internal_libs + external_libs) - - # Rpcserver - external_libs = common_external_libs + ['xmlrpc-epi', 'mysqlclient'] - internal_libs = ['llscene', 'llmessage', 'lldatabase', 'llvfs', - 'llmath', 'llcommon'] - create_executable('rpcserver/rpcserver' + file_suffix, 'rpcserver', - internal_libs + external_libs) - - # Mapserver - external_libs = common_external_libs + [ 'OSMesa16', 'kdu' ] + boost_libs + [ - 'iconv', 'jpeg', 'openjpeg', 'GL', 'mysqlclient', 'png12', 'pthread', 'dl' ] - internal_libs = ['llrender', 'llwindow', 'llimage', 'llimagej2coj', 'lldatabase', 'llprimitive', 'llmessage', 'llkdustatic', - 'llxml', 'llvfs', 'llmath', 'llcommon'] - create_executable('mapserver/mapserver' + file_suffix, 'mapserver', - internal_libs + external_libs) - - # Simulator - Depends('newsim/simulator' + file_suffix, 'mapserver/mapserver' + file_suffix) - external_libs = common_external_libs + boost_libs + [ - 'openjpeg', 'dl', 'kdu', 'mysqlclient', 'iconv', 'tcmalloc', 'stacktrace', 'png12', - ] - - # the order of the havok libs matters - external_libs += [ - 'libhkcompat.a', - 'libhkutilities.a', - 'libhkvisualize.a', - 'libhkdynamics.a', - 'libhkvehicle.a', - 'libhkcollide.a', - 'libhkinternal.a', - 'libhkconstraintsolver.a', - 'libhkmath.a', - 'libhkscenedata.a', - 'libhkserialize.a', - 'libhkgraphicsogl.a', - 'libhkgraphicsbridge.a', - 'libhkgraphics.a', - 'libhkdemoframework.a', - 'libhkbase.a' - ] - internal_libs = [ 'lscript', 'llprimitive', - 'llscene', 'llphysics', 'llinventory', 'llimage', 'llimagej2coj', - 'llcharacter', 'llxml', 'lldatabase', 'llkdustatic', - 'llmessage', 'llvfs', 'llmath', 'llcommon' ] - create_executable('newsim/simulator' + file_suffix, 'newsim', - internal_libs + external_libs) - - # texture upload verifier - external_libs = common_external_libs + [boost_signals_lib, 'kdu', 'openjpeg', 'png12', 'z', 'dl'] - internal_libs = [ - 'llimage', - 'llimagej2coj', - 'llkdustatic', - 'llinventory', - 'llmessage', - 'llvfs', - 'llxml', - 'llcommon', - 'llmath' ] - create_executable( - 'web/doc/asset-upload/plugins/verify-texture', - 'web/doc/asset-upload/plugins', - internal_libs + external_libs, - 'verify-texture.lst') - - # notecard upload verifier - create_executable( - 'web/doc/asset-upload/plugins/verify-notecard', - 'web/doc/asset-upload/plugins', - internal_libs + external_libs, - 'verify-notecard.lst') - - # LSL compiler plugin for asset upload CGI. - external_libs = common_external_libs - internal_libs = ['lscript', 'llmath', 'llcommon'] - create_executable('web/doc/asset-upload/plugins/lsl_compiler/lslc' + file_suffix, 'web/doc/asset-upload/plugins/lsl_compiler/', internal_libs + external_libs); - - # Test - Depends('test/test', 'newsim/simulator' + file_suffix) - external_libs = common_external_libs + ['mysqlclient'] - if platform == 'linux': - external_libs += [boost_signals_lib] - internal_libs = [ 'lldatabase', 'llinventory', 'llmessage', 'llxml', - 'llvfs', 'llcharacter', 'llphysics', 'llprimitive', 'llmath', 'llcommon' ] - test_executable = 'test/test' + file_suffix - create_executable(test_executable, 'test', - internal_libs + external_libs) - - # Run tests - if runtests: - test_results_file = 'test/test_results' + file_suffix + '.txt' - env.Command(test_results_file, - test_executable, - "$SOURCE 2>&1") # tee masks segfaults - Depends(test_results_file, test_executable) - Default(test_results_file) - - test_script = 'test/test.py' - script_test_results = 'test/script_test_result' + file_suffix + '.txt' - env.Command(script_test_results, - test_script, - "$SOURCE 2>&1") # tee masks segfaults - - Depends(script_test_results, test_results_file) - Default(script_test_results) - else: - print '============= SKIPPING TESTS =============' - -######### -# DONE # -######### - diff --git a/linden/indra/cmake/00-Common.cmake b/linden/indra/cmake/00-Common.cmake new file mode 100644 index 0000000..240853a --- /dev/null +++ b/linden/indra/cmake/00-Common.cmake @@ -0,0 +1,206 @@ +# -*- cmake -*- +# +# Compilation options shared by all Second Life components. + +include(Variables) + + +# Portable compilation flags. + +set(CMAKE_CXX_FLAGS_DEBUG "-D_DEBUG -DLL_DEBUG=1") +set(CMAKE_CXX_FLAGS_RELEASE + "-DLL_RELEASE=1 -DLL_RELEASE_FOR_DOWNLOAD=1 -DNDEBUG") +set(CMAKE_CXX_FLAGS_RELWITHDEBINFO + "-DLL_RELEASE=1 -DNDEBUG -DLL_RELEASE_WITH_DEBUG_INFO=1") + + +# Don't bother with a MinSizeRel build. + +set(CMAKE_CONFIGURATION_TYPES "RelWithDebInfo;Release;Debug" CACHE STRING + "Supported build types." FORCE) + + +# Platform-specific compilation flags. + +if (WINDOWS) + # Don't build DLLs. + set(BUILD_SHARED_LIBS OFF) + + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /Od /Zi /MTd" + CACHE STRING "C++ compiler debug options" FORCE) + set(CMAKE_CXX_FLAGS_RELWITHDEBINFO + "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /Od /Zi /MT" + CACHE STRING "C++ compiler release-with-debug options" FORCE) + set(CMAKE_CXX_FLAGS_RELEASE + "${CMAKE_CXX_FLAGS_RELEASE} ${LL_CXX_FLAGS} /O2 /Zi /MT" + CACHE STRING "C++ compiler release options" FORCE) + + add_definitions( + /DLL_WINDOWS=1 + /DUNICODE + /D_UNICODE + /GS + /TP + /W3 + /c + /Zc:forScope + /nologo + /Oy- + ) + + if(MSVC80 OR MSVC90) + add_definitions( + /Zc:wchar_t- + ) + endif (MSVC80 OR MSVC90) + + # Are we using the crummy Visual Studio KDU build workaround? + if (NOT VS_DISABLE_FATAL_WARNINGS) + add_definitions(/WX) + endif (NOT VS_DISABLE_FATAL_WARNINGS) +endif (WINDOWS) + + +if (LINUX) + set(CMAKE_SKIP_RPATH TRUE) + + # Here's a giant hack for Fedora 8, where we can't use + # _FORTIFY_SOURCE if we're using a compiler older than gcc 4.1. + + find_program(GXX g++) + mark_as_advanced(GXX) + + if (GXX) + execute_process( + COMMAND ${GXX} --version + COMMAND sed "s/^[gc+ ]*//" + COMMAND head -1 + OUTPUT_VARIABLE GXX_VERSION + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + else (GXX) + set(GXX_VERSION x) + endif (GXX) + + # The quoting hack here is necessary in case we're using distcc or + # ccache as our compiler. CMake doesn't pass the command line + # through the shell by default, so we end up trying to run "distcc" + # " g++" - notice the leading space. Ugh. + + execute_process( + COMMAND sh -c "${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_ARG1} --version" + COMMAND sed "s/^[gc+ ]*//" + COMMAND head -1 + OUTPUT_VARIABLE CXX_VERSION + OUTPUT_STRIP_TRAILING_WHITESPACE) + + if (${GXX_VERSION} STREQUAL ${CXX_VERSION}) + add_definitions(-D_FORTIFY_SOURCE=2) + else (${GXX_VERSION} STREQUAL ${CXX_VERSION}) + if (NOT ${GXX_VERSION} MATCHES " 4.1.*Red Hat") + add_definitions(-D_FORTIFY_SOURCE=2) + endif (NOT ${GXX_VERSION} MATCHES " 4.1.*Red Hat") + endif (${GXX_VERSION} STREQUAL ${CXX_VERSION}) + + # GCC 4.3 introduces a pile of obnoxious new warnings, which we + # treat as errors due to -Werror. Quiet the most offensive and + # widespread of them. + + if (${CXX_VERSION} MATCHES "4.3") + add_definitions(-Wno-deprecated -Wno-parentheses) + endif (${CXX_VERSION} MATCHES "4.3") + + # End of hacks. + + add_definitions( + -DLL_LINUX=1 + -D_REENTRANT + -fexceptions + -fno-math-errno + -fno-strict-aliasing + -fsigned-char + -g + -pthread + ) + + if (SERVER) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftemplate-depth-60") + if (EXISTS /etc/debian_version) + FILE(READ /etc/debian_version DEBIAN_VERSION) + else (EXISTS /etc/debian_version) + set(DEBIAN_VERSION "") + endif (EXISTS /etc/debian_version) + + if (NOT DEBIAN_VERSION STREQUAL "3.1") + add_definitions(-DCTYPE_WORKAROUND) + endif (NOT DEBIAN_VERSION STREQUAL "3.1") + + if (EXISTS /usr/lib/mysql4/mysql) + link_directories(/usr/lib/mysql4/mysql) + endif (EXISTS /usr/lib/mysql4/mysql) + + add_definitions( + -msse2 + -mfpmath=sse + ) + endif (SERVER) + + if (VIEWER) + add_definitions(-DAPPID=secondlife) + add_definitions(-fvisibility=hidden) + if (NOT STANDALONE) + # this stops us requiring a really recent glibc at runtime + add_definitions(-fno-stack-protector) + endif (NOT STANDALONE) + endif (VIEWER) + + set(CMAKE_CXX_FLAGS_DEBUG "-fno-inline ${CMAKE_CXX_FLAGS_DEBUG}") + set(CMAKE_CXX_FLAGS_RELEASE "-O2 ${CMAKE_CXX_FLAGS_RELEASE}") +endif (LINUX) + + +if (DARWIN) + add_definitions(-DLL_DARWIN=1) + set(CMAKE_CXX_LINK_FLAGS "-Wl,-headerpad_max_install_names,-search_paths_first") + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_CXX_LINK_FLAGS}") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mlong-branch") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mlong-branch") +endif (DARWIN) + + +if (LINUX OR DARWIN) + set(GCC_WARNINGS "-Wall -Wno-sign-compare -Wno-trigraphs") + + if (NOT GCC_DISABLE_FATAL_WARNINGS) + set(GCC_WARNINGS "${GCC_WARNINGS} -Werror") + endif (NOT GCC_DISABLE_FATAL_WARNINGS) + + set(GCC_CXX_WARNINGS "${GCC_WARNINGS} -Wno-reorder") + + set(CMAKE_C_FLAGS "${GCC_WARNINGS} ${CMAKE_C_FLAGS}") + set(CMAKE_CXX_FLAGS "${GCC_CXX_WARNINGS} ${CMAKE_CXX_FLAGS}") +endif (LINUX OR DARWIN) + + +if (STANDALONE) + add_definitions(-DLL_STANDALONE=1) + + if (LINUX AND ${ARCH} STREQUAL "i686") + add_definitions(-march=pentiumpro) + endif (LINUX AND ${ARCH} STREQUAL "i686") + +else (STANDALONE) + set(${ARCH}_linux_INCLUDES + ELFIO + atk-1.0 + glib-2.0 + gstreamer-0.10 + gtk-2.0 + llfreetype2 + pango-1.0 + ) +endif (STANDALONE) + +if(SERVER) + include_directories(${LIBS_PREBUILT_DIR}/include/havok) +endif(SERVER) diff --git a/linden/indra/cmake/APR.cmake b/linden/indra/cmake/APR.cmake new file mode 100644 index 0000000..2a96d70 --- /dev/null +++ b/linden/indra/cmake/APR.cmake @@ -0,0 +1,55 @@ +# -*- cmake -*- + +include(BerkeleyDB) +include(Linking) +include(Prebuilt) + +set(APR_FIND_QUIETLY ON) +set(APR_FIND_REQUIRED ON) + +set(APRUTIL_FIND_QUIETLY ON) +set(APRUTIL_FIND_REQUIRED ON) + +if (STANDALONE) + include(FindAPR) +else (STANDALONE) + use_prebuilt_binary(apr_suite) + if (WINDOWS) + set(WINLIBS_PREBUILT_DEBUG_DIR + ${CMAKE_SOURCE_DIR}/../libraries/i686-win32/lib/debug + ) + set(WINLIBS_PREBUILT_RELEASE_DIR + ${CMAKE_SOURCE_DIR}/../libraries/i686-win32/lib/release + ) + set(APR_LIBRARIES + debug ${WINLIBS_PREBUILT_DEBUG_DIR}/apr-1.lib + optimized ${WINLIBS_PREBUILT_RELEASE_DIR}/apr-1.lib + ) + set(APRUTIL_LIBRARIES + debug ${WINLIBS_PREBUILT_DEBUG_DIR}/aprutil-1.lib + optimized ${WINLIBS_PREBUILT_RELEASE_DIR}/aprutil-1.lib + ) + set(APRICONV_LIBRARIES + debug ${WINLIBS_PREBUILT_DEBUG_DIR}/apriconv-1.lib + optimized ${WINLIBS_PREBUILT_RELEASE_DIR}/apriconv-1.lib + ) + elseif (DARWIN) + set(APR_LIBRARIES + debug ${ARCH_PREBUILT_DIRS_DEBUG}/libapr-1.a + optimized ${ARCH_PREBUILT_DIRS_RELEASE}/libapr-1.a + ) + set(APRUTIL_LIBRARIES + debug ${ARCH_PREBUILT_DIRS_DEBUG}/libaprutil-1.a + optimized ${ARCH_PREBUILT_DIRS_RELEASE}/libaprutil-1.a + ) + set(APRICONV_LIBRARIES apriconv-1) + else (WINDOWS) + set(APR_LIBRARIES apr-1) + set(APRUTIL_LIBRARIES aprutil-1) + endif (WINDOWS) + set(APR_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/include/apr-1) + + if (LINUX AND VIEWER) + list(APPEND APRUTIL_LIBRARIES ${DB_LIBRARIES}) + endif (LINUX AND VIEWER) +endif (STANDALONE) diff --git a/linden/indra/cmake/Audio.cmake b/linden/indra/cmake/Audio.cmake new file mode 100644 index 0000000..c6ccab2 --- /dev/null +++ b/linden/indra/cmake/Audio.cmake @@ -0,0 +1,34 @@ +# -*- cmake -*- +include(Prebuilt) + +if (STANDALONE) + include(FindPkgConfig) + pkg_check_modules(OGG REQUIRED ogg) + pkg_check_modules(VORBIS REQUIRED vorbis) + pkg_check_modules(VORBISENC REQUIRED vorbisenc) + pkg_check_modules(VORBISFILE REQUIRED vorbisfile) +else (STANDALONE) + use_prebuilt_binary(ogg-vorbis) + set(VORBIS_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include) + set(VORBISENC_INCLUDE_DIRS ${VORBIS_INCLUDE_DIRS}) + set(VORBISFILE_INCLUDE_DIRS ${VORBIS_INCLUDE_DIRS}) + + if (WINDOWS) + set(OGG_LIBRARIES ogg_static_mt) + set(VORBIS_LIBRARIES vorbis_static_mt) + set(VORBISENC_LIBRARIES vorbisenc_static_mt) + set(VORBISFILE_LIBRARIES vorbisfile_static_mt) + else (WINDOWS) + set(OGG_LIBRARIES ogg) + set(VORBIS_LIBRARIES vorbis) + set(VORBISENC_LIBRARIES vorbisenc) + set(VORBISFILE_LIBRARIES vorbisfile) + endif (WINDOWS) +endif (STANDALONE) + +link_directories( + ${VORBIS_LIBRARY_DIRS} + ${VORBISENC_LIBRARY_DIRS} + ${VORBISFILE_LIBRARY_DIRS} + ${OGG_LIBRARY_DIRS} + ) diff --git a/linden/indra/cmake/BerkeleyDB.cmake b/linden/indra/cmake/BerkeleyDB.cmake new file mode 100644 index 0000000..d98e791 --- /dev/null +++ b/linden/indra/cmake/BerkeleyDB.cmake @@ -0,0 +1,11 @@ +# -*- cmake -*- + +set(DB_FIND_QUIETLY ON) +set(DB_FIND_REQUIRED ON) + +if (STANDALONE) + include(FindBerkeleyDB) +else (STANDALONE) + set(DB_LIBRARIES db-4.2) + set(DB_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include) +endif (STANDALONE) diff --git a/linden/indra/cmake/Boost.cmake b/linden/indra/cmake/Boost.cmake new file mode 100644 index 0000000..a7db67c --- /dev/null +++ b/linden/indra/cmake/Boost.cmake @@ -0,0 +1,49 @@ +# -*- cmake -*- +include(Prebuilt) + +set(Boost_FIND_QUIETLY ON) +set(Boost_FIND_REQUIRED ON) + +if (STANDALONE) + include(FindBoost) + + set(BOOST_PROGRAM_OPTIONS_LIBRARY boost_program_options-mt) + set(BOOST_REGEX_LIBRARY boost_regex-mt) + set(BOOST_SIGNALS_LIBRARY boost_signals-mt) +else (STANDALONE) + use_prebuilt_binary(boost) + set(Boost_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include) + + if (WINDOWS) + set(BOOST_VERSION 1_34_1) + if (MSVC71) + set(BOOST_PROGRAM_OPTIONS_LIBRARY + optimized libboost_program_options-vc71-mt-s-${BOOST_VERSION} + debug libboost_program_options-vc71-mt-sgd-${BOOST_VERSION}) + set(BOOST_REGEX_LIBRARY + optimized libboost_regex-vc71-mt-s-${BOOST_VERSION} + debug libboost_regex-vc71-mt-sgd-${BOOST_VERSION}) + set(BOOST_SIGNALS_LIBRARY + optimized libboost_signals-vc71-mt-s-${BOOST_VERSION} + debug libboost_signals-vc71-mt-sgd-${BOOST_VERSION}) + else (MSVC71) + set(BOOST_PROGRAM_OPTIONS_LIBRARY + optimized libboost_program_options-vc80-mt-s-${BOOST_VERSION} + debug libboost_program_options-vc80-mt-sgd-${BOOST_VERSION}) + set(BOOST_REGEX_LIBRARY + optimized libboost_regex-vc80-mt-s-${BOOST_VERSION} + debug libboost_regex-vc80-mt-sgd-${BOOST_VERSION}) + set(BOOST_SIGNALS_LIBRARY + optimized libboost_signals-vc80-mt-s-${BOOST_VERSION} + debug libboost_signals-vc80-mt-sgd-${BOOST_VERSION}) + endif (MSVC71) + elseif (DARWIN) + set(BOOST_PROGRAM_OPTIONS_LIBRARY boost_program_options-mt) + set(BOOST_REGEX_LIBRARY boost_regex-mt) + set(BOOST_SIGNALS_LIBRARY boost_signals-mt) + elseif (LINUX) + set(BOOST_PROGRAM_OPTIONS_LIBRARY boost_program_options-mt) + set(BOOST_REGEX_LIBRARY boost_regex-mt) + set(BOOST_SIGNALS_LIBRARY boost_signals-mt) + endif (WINDOWS) +endif (STANDALONE) diff --git a/linden/indra/cmake/BuildVersion.cmake b/linden/indra/cmake/BuildVersion.cmake new file mode 100644 index 0000000..60a519c --- /dev/null +++ b/linden/indra/cmake/BuildVersion.cmake @@ -0,0 +1,18 @@ +# -*- cmake -*- + +include(Python) + +macro (build_version _target) + execute_process( + COMMAND ${PYTHON_EXECUTABLE} ${SCRIPTS_DIR}/build_version.py + llversion${_target}.h ${LLCOMMON_INCLUDE_DIRS} + OUTPUT_VARIABLE ${_target}_VERSION + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + + if (${_target}_VERSION) + message(STATUS "Version of ${_target} is ${${_target}_VERSION}") + else (${_target}_VERSION) + message(SEND_ERROR "Could not determine ${_target} version") + endif (${_target}_VERSION) +endmacro (build_version) diff --git a/linden/indra/cmake/CARes.cmake b/linden/indra/cmake/CARes.cmake new file mode 100644 index 0000000..8a2dc01 --- /dev/null +++ b/linden/indra/cmake/CARes.cmake @@ -0,0 +1,23 @@ +# -*- cmake -*- +include(Linking) +include(Prebuilt) + +set(CARES_FIND_QUIETLY ON) +set(CARES_FIND_REQUIRED ON) + +if (STANDALONE) + include(FindCARes) +else (STANDALONE) + use_prebuilt_binary(ares) + if (WINDOWS) + set(CARES_LIBRARIES areslib) + elseif (DARWIN) + set(CARES_LIBRARIES + optimized ${ARCH_PREBUILT_DIRS_RELEASE}/libcares.a + debug ${ARCH_PREBUILT_DIRS_DEBUG}/libcares.a + ) + else (WINDOWS) + set(CARES_LIBRARIES cares) + endif (WINDOWS) + set(CARES_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include/ares) +endif (STANDALONE) diff --git a/linden/indra/cmake/CMakeCopyIfDifferent.cmake b/linden/indra/cmake/CMakeCopyIfDifferent.cmake new file mode 100644 index 0000000..55e71ff --- /dev/null +++ b/linden/indra/cmake/CMakeCopyIfDifferent.cmake @@ -0,0 +1,41 @@ +# -*- cmake -*- +# Taken from http://www.cmake.org/Wiki/CMakeCopyIfDifferent +# Generates a rule to copy each source file from source directory to destination directory. +# +# Typical use - +# +# SET(SRC_FILES head1.h head2.h head3.h) +# COPY_IF_DIFFERENT( /from_dir /to_dir IncludeTargets ${SRC_FILES}) +# ADD_TARGET(CopyIncludes ALL DEPENDS ${IncludeTargets}) + +MACRO(COPY_IF_DIFFERENT FROM_DIR TO_DIR TARGETS) +# Macro to implement copy_if_different for a list of files +# Arguments - +# FROM_DIR - this is the source directory +# TO_DIR - this is the destination directory +# TARGETS - A variable to receive a list of targets +# FILES - names of the files to copy +# TODO: add globing. +SET(AddTargets "") +FOREACH(SRC ${ARGN}) + GET_FILENAME_COMPONENT(SRCFILE ${SRC} NAME) + IF("${FROM_DIR}" STREQUAL "") + SET(FROM ${SRC}) + ELSE("${FROM_DIR}" STREQUAL "") + SET(FROM ${FROM_DIR}/${SRC}) + ENDIF("${FROM_DIR}" STREQUAL "") + IF("${TO_DIR}" STREQUAL "") + SET(TO ${SRCFILE}) + ELSE("${TO_DIR}" STREQUAL "") + SET(TO ${TO_DIR}/${SRCFILE}) + ENDIF("${TO_DIR}" STREQUAL "") + ADD_CUSTOM_COMMAND( + OUTPUT "${TO}" + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${FROM} ${TO} + DEPENDS ${FROM} + COMMENT "Copying ${SRCFILE} ${TO_DIR}" + ) + SET(AddTargets ${AddTargets} ${TO}) +ENDFOREACH(SRC ${ARGN}) +SET(${TARGETS} ${AddTargets}) +ENDMACRO(COPY_IF_DIFFERENT FROM_DIR TO_DIR TARGETS) diff --git a/linden/indra/cmake/CSharpMacros.cmake b/linden/indra/cmake/CSharpMacros.cmake new file mode 100644 index 0000000..a4dd815 --- /dev/null +++ b/linden/indra/cmake/CSharpMacros.cmake @@ -0,0 +1,142 @@ +# - This is a support module for easy Mono/C# handling with CMake +# It defines the following macros: +# +# ADD_CS_LIBRARY ( ) +# ADD_CS_EXECUTABLE ( ) +# INSTALL_GAC () +# +# Note that the order of the arguments is important. +# +# You can optionally set the variable CS_FLAGS to tell the macros whether +# to pass additional flags to the compiler. This is particularly useful to +# set assembly references, unsafe code, etc... These flags are always reset +# after the target was added so you don't have to care about that. +# +# copyright (c) 2007 Arno Rehn arno@arnorehn.de +# +# Redistribution and use is allowed according to the terms of the GPL license. + + +# ----- support macros ----- +MACRO(GET_CS_LIBRARY_TARGET_DIR) + IF (NOT LIBRARY_OUTPUT_PATH) + SET(CS_LIBRARY_TARGET_DIR ${CMAKE_CURRENT_BINARY_DIR}) + ELSE (NOT LIBRARY_OUTPUT_PATH) + SET(CS_LIBRARY_TARGET_DIR ${LIBRARY_OUTPUT_PATH}) + ENDIF (NOT LIBRARY_OUTPUT_PATH) +ENDMACRO(GET_CS_LIBRARY_TARGET_DIR) + +MACRO(GET_CS_EXECUTABLE_TARGET_DIR) + IF (NOT EXECUTABLE_OUTPUT_PATH) + SET(CS_EXECUTABLE_TARGET_DIR ${CMAKE_CURRENT_BINARY_DIR}) + ELSE (NOT EXECUTABLE_OUTPUT_PATH) + SET(CS_EXECUTABLE_TARGET_DIR ${EXECUTABLE_OUTPUT_PATH}) + ENDIF (NOT EXECUTABLE_OUTPUT_PATH) +ENDMACRO(GET_CS_EXECUTABLE_TARGET_DIR) + +MACRO(MAKE_PROPER_FILE_LIST) + FOREACH(file ${ARGN}) + # first assume it's a relative path + FILE(GLOB globbed ${CMAKE_CURRENT_SOURCE_DIR}/${file}) + IF(globbed) + FILE(TO_NATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/${file} native) + ELSE(globbed) + FILE(TO_NATIVE_PATH ${file} native) + ENDIF(globbed) + SET(proper_file_list ${proper_file_list} ${native}) + SET(native "") + ENDFOREACH(file) +ENDMACRO(MAKE_PROPER_FILE_LIST) +# ----- end support macros ----- + +MACRO(ADD_CS_LIBRARY target) + GET_CS_LIBRARY_TARGET_DIR() + + SET(target_DLL "${CS_LIBRARY_TARGET_DIR}/${target}.dll") + MAKE_PROPER_FILE_LIST(${ARGN}) + FILE(RELATIVE_PATH relative_path ${CMAKE_BINARY_DIR} ${target_DLL}) + + SET(target_KEY "${CMAKE_CURRENT_SOURCE_DIR}/${target}.key") + SET(target_CS_FLAGS "${CS_FLAGS}") + IF(${target}_CS_FLAGS) + LIST(APPEND target_CS_FLAGS ${${target}_CS_FLAGS}) + ENDIF(${target}_CS_FLAGS) + IF(EXISTS ${target_KEY}) + LIST(APPEND target_CS_FLAGS -keyfile:${target_KEY}) + ENDIF(EXISTS ${target_KEY}) + + FOREACH(ref ${${target}_REFS}) + SET(ref_DLL ${CMAKE_CURRENT_BINARY_DIR}/${ref}.dll) + IF(EXISTS ${ref_DLL}) + LIST(APPEND target_CS_FLAGS -r:${ref_DLL}) + ELSE(EXISTS ${ref_DLL}) + LIST(APPEND target_CS_FLAGS -r:${ref}) + ENDIF(EXISTS ${ref_DLL}) + ENDFOREACH(ref ${${target}_REFS}) + + ADD_CUSTOM_COMMAND (OUTPUT ${target_DLL} + COMMAND ${MCS_EXECUTABLE} ${target_CS_FLAGS} -out:${target_DLL} -target:library ${proper_file_list} + MAIN_DEPENDENCY ${proper_file_list} + DEPENDS ${ARGN} + COMMENT "Building ${relative_path}") + ADD_CUSTOM_TARGET (${target} ALL DEPENDS ${target_DLL}) + + FOREACH(ref ${${target}_REFS}) + GET_TARGET_PROPERTY(is_target ${ref} TYPE) + IF(is_target) + ADD_DEPENDENCIES(${target} ${ref}) + ENDIF(is_target) + ENDFOREACH(ref ${${target}_REFS}) + + SET(relative_path "") + SET(proper_file_list "") +ENDMACRO(ADD_CS_LIBRARY) + +MACRO(ADD_CS_EXECUTABLE target) + GET_CS_EXECUTABLE_TARGET_DIR() + + # Seems like cmake doesn't like the ".exe" ending for custom commands. + # If we call it ${target}.exe, 'make' will later complain about a missing rule. + # Create a fake target instead. + SET(target_EXE "${CS_EXECUTABLE_TARGET_DIR}/${target}.exe") + SET(target_TOUCH "${CS_EXECUTABLE_TARGET_DIR}/${target}.exe-built") + GET_DIRECTORY_PROPERTY(clean ADDITIONAL_MAKE_CLEAN_FILES) + LIST(APPEND clean ${target}.exe) + SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${clean}") + MAKE_PROPER_FILE_LIST(${ARGN}) + FILE(RELATIVE_PATH relative_path ${CMAKE_BINARY_DIR} ${target_EXE}) + SET(target_CS_FLAGS "${CS_FLAGS}") + + FOREACH(ref ${${target}_REFS}) + SET(ref_DLL ${CMAKE_CURRENT_SOURCE_DIR}/${ref}.dll) + IF(EXISTS ${ref_DLL}) + LIST(APPEND target_CS_FLAGS -r:${ref_DLL}) + ELSE(EXISTS ${ref_DLL}) + LIST(APPEND target_CS_FLAGS -r:${ref}) + ENDIF(EXISTS ${ref_DLL}) + ENDFOREACH(ref ${${target}_REFS}) + + ADD_CUSTOM_COMMAND (OUTPUT "${target_TOUCH}" + COMMAND ${MCS_EXECUTABLE} ${target_CS_FLAGS} -out:${target_EXE} ${proper_file_list} + COMMAND ${CMAKE_COMMAND} -E touch ${target_TOUCH} + MAIN_DEPENDENCY ${ARGN} + DEPENDS ${ARGN} + COMMENT "Building ${relative_path}") + ADD_CUSTOM_TARGET ("${target}" ALL DEPENDS "${target_TOUCH}") + + FOREACH(ref ${${target}_REFS}) + GET_TARGET_PROPERTY(is_target ${ref} TYPE) + IF(is_target) + ADD_DEPENDENCIES(${target} ${ref}) + ENDIF(is_target) + ENDFOREACH(ref ${${target}_REFS}) + + SET(relative_path "") + SET(proper_file_list "") +ENDMACRO(ADD_CS_EXECUTABLE) + +MACRO(INSTALL_GAC target) + GET_CS_LIBRARY_TARGET_DIR() + + INSTALL(CODE "EXECUTE_PROCESS(COMMAND ${GACUTIL_EXECUTABLE} -i ${CS_LIBRARY_TARGET_DIR}/${target}.dll -package 2.0)") +ENDMACRO(INSTALL_GAC target) diff --git a/linden/indra/cmake/CURL.cmake b/linden/indra/cmake/CURL.cmake new file mode 100644 index 0000000..6e5fed4 --- /dev/null +++ b/linden/indra/cmake/CURL.cmake @@ -0,0 +1,19 @@ +# -*- cmake -*- +include(Prebuilt) + +set(CURL_FIND_QUIETLY ON) +set(CURL_FIND_REQUIRED ON) + +if (STANDALONE) + include(FindCURL) +else (STANDALONE) + use_prebuilt_binary(curl) + if (WINDOWS) + set(CURL_LIBRARIES + debug libcurld + optimized libcurl) + else (WINDOWS) + set(CURL_LIBRARIES curl) + endif (WINDOWS) + set(CURL_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include) +endif (STANDALONE) diff --git a/linden/indra/cmake/CommonMiscLibs.cmake b/linden/indra/cmake/CommonMiscLibs.cmake new file mode 100644 index 0000000..513acf3 --- /dev/null +++ b/linden/indra/cmake/CommonMiscLibs.cmake @@ -0,0 +1,7 @@ +# -*- cmake -*- +include(Prebuilt) + +if (NOT STANDALONE) + use_prebuilt_binary(tut) +endif(NOT STANDALONE) + diff --git a/linden/indra/cmake/CopyBackToSource.cmake b/linden/indra/cmake/CopyBackToSource.cmake new file mode 100644 index 0000000..d217df9 --- /dev/null +++ b/linden/indra/cmake/CopyBackToSource.cmake @@ -0,0 +1,16 @@ +# -*- cmake -*- +# Copies a binary back to the source directory + +MACRO(COPY_BACK_TO_SOURCE target) + GET_TARGET_PROPERTY(FROM ${target} LOCATION) + SET(TO ${CMAKE_CURRENT_SOURCE_DIR}) + #MESSAGE("TARGET ${target} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${FROM} ${TO}") + ADD_CUSTOM_COMMAND( + TARGET ${target} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy ${FROM} ${TO} + DEPENDS ${FROM} + COMMENT "Copying ${target} to ${CMAKE_CURRENT_BINARY_DIR}" + ) +ENDMACRO(COPY_BACK_TO_SOURCE) + + diff --git a/linden/indra/cmake/CopyWinLibs.cmake b/linden/indra/cmake/CopyWinLibs.cmake new file mode 100644 index 0000000..345761a --- /dev/null +++ b/linden/indra/cmake/CopyWinLibs.cmake @@ -0,0 +1,155 @@ +# -*- cmake -*- + +# The copy_win_libs folder contains file lists and a script used to +# copy dlls, exes and such needed to run the SecondLife from within +# VisualStudio. + +include(CMakeCopyIfDifferent) + +set(vivox_src_dir "${CMAKE_SOURCE_DIR}/newview/vivox-runtime/i686-win32") +set(vivox_files + tntk.dll + libeay32.dll + SLVoice.exe + ssleay32.dll + SLVoiceAgent.exe + srtp.dll + alut.dll + vivoxsdk.dll + ortp.dll + wrap_oal.dll + ) + +set(debug_src_dir "${CMAKE_SOURCE_DIR}/../libraries/i686-win32/lib/debug") +set(debug_files + freebl3.dll + gksvggdiplus.dll + js3250.dll + nspr4.dll + nss3.dll + nssckbi.dll + plc4.dll + plds4.dll + smime3.dll + softokn3.dll + ssl3.dll + xpcom.dll + xul.dll + openjpegd.dll + windbgdlg.exe + ) + +copy_if_different( + ${debug_src_dir} + "${CMAKE_CURRENT_BINARY_DIR}/Debug" + out_targets + ${debug_files} + ) +set(all_targets ${all_targets} ${out_targets}) + +copy_if_different( + ${vivox_src_dir} + "${CMAKE_CURRENT_BINARY_DIR}/Debug" + out_targets + ${vivox_files} + ) +set(all_targets ${all_targets} ${out_targets}) + +set(release_src_dir "${CMAKE_SOURCE_DIR}/../libraries/i686-win32/lib/release") +set(release_files + freebl3.dll + gksvggdiplus.dll + js3250.dll + nspr4.dll + nss3.dll + nssckbi.dll + plc4.dll + plds4.dll + smime3.dll + softokn3.dll + ssl3.dll + xpcom.dll + xul.dll + openjpeg.dll + ) + +copy_if_different( + ${release_src_dir} + "${CMAKE_CURRENT_BINARY_DIR}/Release" + out_targets + ${release_files} + ) +set(all_targets ${all_targets} ${out_targets}) + +copy_if_different( + ${vivox_src_dir} + "${CMAKE_CURRENT_BINARY_DIR}/Release" + out_targets + ${vivox_files} + ) +set(all_targets ${all_targets} ${out_targets}) + +copy_if_different( + ${release_src_dir} + "${CMAKE_CURRENT_BINARY_DIR}/RelWithDebInfo" + out_targets + ${release_files} + ) +set(all_targets ${all_targets} ${out_targets}) + +copy_if_different( + ${vivox_src_dir} + "${CMAKE_CURRENT_BINARY_DIR}/RelWithDebInfo" + out_targets + ${vivox_files} + ) +set(all_targets ${all_targets} ${out_targets}) + +set(internal_llkdu_path "${CMAKE_SOURCE_DIR}/llkdu") +if(EXISTS ${internal_llkdu_path}) + set(internal_llkdu_src "${CMAKE_BINARY_DIR}/llkdu/${CMAKE_CFG_INTDIR}/llkdu.dll") + set(llkdu_dst "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/llkdu.dll") + ADD_CUSTOM_COMMAND( + OUTPUT ${llkdu_dst} + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${internal_llkdu_src} ${llkdu_dst} + DEPENDS ${internal_llkdu_src} + COMMENT "Copying llkdu.dll ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}" + ) + set(all_targets ${all_targets} ${llkdu_dst}) +else(EXISTS ${internal_llkdu_path}) + set(debug_llkdu_src "${debug_src_dir}/llkdu.dll") + set(debug_llkdu_dst "${CMAKE_CURRENT_BINARY_DIR}/Debug/llkdu.dll") + ADD_CUSTOM_COMMAND( + OUTPUT ${debug_llkdu_dst} + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${debug_llkdu_src} ${debug_llkdu_dst} + DEPENDS ${debug_llkdu_src} + COMMENT "Copying llkdu.dll ${CMAKE_CURRENT_BINARY_DIR}/Debug" + ) + set(all_targets ${all_targets} ${debug_llkdu_dst}) + + set(release_llkdu_src "${release_src_dir}/llkdu.dll") + set(release_llkdu_dst "${CMAKE_CURRENT_BINARY_DIR}/Release/llkdu.dll") + ADD_CUSTOM_COMMAND( + OUTPUT ${release_llkdu_dst} + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${release_llkdu_src} ${release_llkdu_dst} + DEPENDS ${release_llkdu_src} + COMMENT "Copying llkdu.dll ${CMAKE_CURRENT_BINARY_DIR}/Release" + ) + set(all_targets ${all_targets} ${release_llkdu_dst}) + + set(relwithdebinfo_llkdu_dst "${CMAKE_CURRENT_BINARY_DIR}/RelWithDebInfo/llkdu.dll") + ADD_CUSTOM_COMMAND( + OUTPUT ${relwithdebinfo_llkdu_dst} + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${release_llkdu_src} ${relwithdebinfo_llkdu_dst} + DEPENDS ${release_llkdu_src} + COMMENT "Copying llkdu.dll ${CMAKE_CURRENT_BINARY_DIR}/RelWithDebInfo" + ) + set(all_targets ${all_targets} ${relwithdebinfo_llkdu_dst}) + +endif (EXISTS ${internal_llkdu_path}) + +add_custom_target(copy_win_libs ALL DEPENDS ${all_targets}) + +if(EXISTS ${internal_llkdu_path}) + add_dependencies(copy_win_libs llkdu) +endif(EXISTS ${internal_llkdu_path}) diff --git a/linden/indra/cmake/DirectX.cmake b/linden/indra/cmake/DirectX.cmake new file mode 100644 index 0000000..4d2d5e0 --- /dev/null +++ b/linden/indra/cmake/DirectX.cmake @@ -0,0 +1,40 @@ +# -*- cmake -*- + +if (VIEWER AND WINDOWS) + find_path(DIRECTX_INCLUDE_DIR dxdiag.h + "$ENV{DXSDK_DIR}/Include" + "C:/Program Files/Microsoft DirectX SDK (June 2008)/Include" + "C:/Program Files/Microsoft DirectX SDK (March 2008)/Include" + "C:/Program Files/Microsoft DirectX SDK (November 2007)/Include" + "C:/Program Files/Microsoft DirectX SDK (August 2007)/Include" + "C:/DX90SDK/Include" + "C:/Program Files/DX90SDK/Include" + ) + if (DIRECTX_INCLUDE_DIR) + include_directories(${DIRECTX_INCLUDE_DIR}) + if (DIRECTX_FIND_QUIETLY) + message(STATUS "Found DirectX include: ${DIRECTX_INCLUDE_DIR}") + endif (DIRECTX_FIND_QUIETLY) + else (DIRECTX_INCLUDE_DIR) + message(FATAL_ERROR "Could not find DirectX SDK Include") + endif (DIRECTX_INCLUDE_DIR) + + + find_path(DIRECTX_LIBRARY_DIR dxguid.lib + "$ENV{DXSDK_DIR}/Lib/x86" + "C:/Program Files/Microsoft DirectX SDK (June 2008)/Lib/x86" + "C:/Program Files/Microsoft DirectX SDK (March 2008)/Lib/x86" + "C:/Program Files/Microsoft DirectX SDK (November 2007)/Lib/x86" + "C:/Program Files/Microsoft DirectX SDK (August 2007)/Lib/x86" + "C:/DX90SDK/Lib" + "C:/Program Files/DX90SDK/Lib" + ) + if (DIRECTX_LIBRARY_DIR) + if (DIRECTX_FIND_QUIETLY) + message(STATUS "Found DirectX include: ${DIRECTX_LIBRARY_DIR}") + endif (DIRECTX_FIND_QUIETLY) + else (DIRECTX_LIBRARY_DIR) + message(FATAL_ERROR "Could not find DirectX SDK Libraries") + endif (DIRECTX_LIBRARY_DIR) + +endif (VIEWER AND WINDOWS) diff --git a/linden/indra/cmake/ELFIO.cmake b/linden/indra/cmake/ELFIO.cmake new file mode 100644 index 0000000..e51993b --- /dev/null +++ b/linden/indra/cmake/ELFIO.cmake @@ -0,0 +1,19 @@ +# -*- cmake -*- +include(Prebuilt) + +set(ELFIO_FIND_QUIETLY ON) + +if (STANDALONE) + include(FindELFIO) +elseif (LINUX) + use_prebuilt_binary(elfio) + set(ELFIO_LIBRARIES ELFIO) + set(ELFIO_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/include) + set(ELFIO_FOUND "YES") +endif (STANDALONE) + +if (ELFIO_FOUND) + add_definitions(-DLL_ELFBIN=1) +else (ELFIO_FOUND) + set(ELFIO_INCLUDE_DIR "") +endif (ELFIO_FOUND) diff --git a/linden/indra/cmake/EXPAT.cmake b/linden/indra/cmake/EXPAT.cmake new file mode 100644 index 0000000..acb15dc --- /dev/null +++ b/linden/indra/cmake/EXPAT.cmake @@ -0,0 +1,17 @@ +# -*- cmake -*- +include(Prebuilt) + +set(EXPAT_FIND_QUIETLY ON) +set(EXPAT_FIND_REQUIRED ON) + +if (STANDALONE) + include(FindEXPAT) +else (STANDALONE) + use_prebuilt_binary(expat) + if (WINDOWS) + set(EXPAT_LIBRARIES libexpatMT) + else (WINDOWS) + set(EXPAT_LIBRARIES expat) + endif (WINDOWS) + set(EXPAT_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include) +endif (STANDALONE) diff --git a/linden/indra/cmake/FMOD.cmake b/linden/indra/cmake/FMOD.cmake new file mode 100644 index 0000000..759b8f1 --- /dev/null +++ b/linden/indra/cmake/FMOD.cmake @@ -0,0 +1,64 @@ +# -*- cmake -*- + +include(Linking) + +if(INSTALL_PROPRIETARY) + include(Prebuilt) + use_prebuilt_binary(fmod) +endif(INSTALL_PROPRIETARY) + +find_library(FMOD_LIBRARY_RELEASE + NAMES fmod fmodvc fmod-3.75 + PATHS + ${ARCH_PREBUILT_DIRS_RELEASE} + ) + +find_library(FMOD_LIBRARY_DEBUG + NAMES fmod fmodvc fmod-3.75 + PATHS + ${ARCH_PREBUILT_DIRS_DEBUG} + ) + +if (FMOD_LIBRARY_RELEASE AND FMOD_LIBRARY_DEBUG) + set(FMOD_LIBRARY + debug ${FMOD_LIBRARY_DEBUG} + optimized ${FMOD_LIBRARY_RELEASE}) +elseif (FMOD_LIBRARY_RELEASE) + set(FMOD_LIBRARY ${FMOD_LIBRARY_RELEASE}) +endif (FMOD_LIBRARY_RELEASE AND FMOD_LIBRARY_DEBUG) + +if (NOT FMOD_LIBRARY) + set(FMOD_SDK_DIR CACHE PATH "Path to the FMOD SDK.") + if (FMOD_SDK_DIR) + find_library(FMOD_LIBRARY + NAMES fmodvc fmod-3.75 fmod + PATHS + ${FMOD_SDK_DIR}/api/lib + ${FMOD_SDK_DIR}/api + ${FMOD_SDK_DIR}/lib + ${FMOD_SDK_DIR} + ) + endif (FMOD_SDK_DIR) +endif (NOT FMOD_LIBRARY) + +find_path(FMOD_INCLUDE_DIR fmod.h + ${LIBS_PREBUILT_DIR}/include + ${FMOD_SDK_DIR}/api/inc + ${FMOD_SDK_DIR}/inc + ${FMOD_SDK_DIR} + ) + +if (FMOD_LIBRARY AND FMOD_INCLUDE_DIR) + set(FMOD ON CACHE BOOL "Use closed source FMOD sound library.") +else (FMOD_LIBRARY AND FMOD_INCLUDE_DIR) + set(FMOD_LIBRARY "") + set(FMOD_INCLUDE_DIR "") + if (FMOD) + message(STATUS "No support for FMOD audio (need to set FMOD_SDK_DIR?)") + endif (FMOD) + set(FMOD OFF CACHE BOOL "Use closed source FMOD sound library.") +endif (FMOD_LIBRARY AND FMOD_INCLUDE_DIR) + +if (FMOD) + message(STATUS "Building with FMOD audio support") +endif (FMOD) diff --git a/linden/indra/cmake/FindAPR.cmake b/linden/indra/cmake/FindAPR.cmake new file mode 100644 index 0000000..906b6c9 --- /dev/null +++ b/linden/indra/cmake/FindAPR.cmake @@ -0,0 +1,94 @@ +# -*- cmake -*- + +# - Find Apache Portable Runtime +# Find the APR includes and libraries +# This module defines +# APR_INCLUDE_DIR and APRUTIL_INCLUDE_DIR, where to find apr.h, etc. +# APR_LIBRARIES and APRUTIL_LIBRARIES, the libraries needed to use APR. +# APR_FOUND and APRUTIL_FOUND, If false, do not try to use APR. +# also defined, but not for general use are +# APR_LIBRARY and APRUTIL_LIBRARY, where to find the APR library. + +# APR first. + +FIND_PATH(APR_INCLUDE_DIR apr.h +/usr/local/include/apr-1 +/usr/local/include/apr-1.0 +/usr/include/apr-1 +/usr/include/apr-1.0 +) + +SET(APR_NAMES ${APR_NAMES} apr-1) +FIND_LIBRARY(APR_LIBRARY + NAMES ${APR_NAMES} + PATHS /usr/lib /usr/local/lib + ) + +IF (APR_LIBRARY AND APR_INCLUDE_DIR) + SET(APR_LIBRARIES ${APR_LIBRARY}) + SET(APR_FOUND "YES") +ELSE (APR_LIBRARY AND APR_INCLUDE_DIR) + SET(APR_FOUND "NO") +ENDIF (APR_LIBRARY AND APR_INCLUDE_DIR) + + +IF (APR_FOUND) + IF (NOT APR_FIND_QUIETLY) + MESSAGE(STATUS "Found APR: ${APR_LIBRARIES}") + ENDIF (NOT APR_FIND_QUIETLY) +ELSE (APR_FOUND) + IF (APR_FIND_REQUIRED) + MESSAGE(FATAL_ERROR "Could not find APR library") + ENDIF (APR_FIND_REQUIRED) +ENDIF (APR_FOUND) + +# Deprecated declarations. +SET (NATIVE_APR_INCLUDE_PATH ${APR_INCLUDE_DIR} ) +GET_FILENAME_COMPONENT (NATIVE_APR_LIB_PATH ${APR_LIBRARY} PATH) + +MARK_AS_ADVANCED( + APR_LIBRARY + APR_INCLUDE_DIR + ) + +# Next, APRUTIL. + +FIND_PATH(APRUTIL_INCLUDE_DIR apu.h +/usr/local/include/apr-1 +/usr/local/include/apr-1.0 +/usr/include/apr-1 +/usr/include/apr-1.0 +) + +SET(APRUTIL_NAMES ${APRUTIL_NAMES} aprutil-1) +FIND_LIBRARY(APRUTIL_LIBRARY + NAMES ${APRUTIL_NAMES} + PATHS /usr/lib /usr/local/lib + ) + +IF (APRUTIL_LIBRARY AND APRUTIL_INCLUDE_DIR) + SET(APRUTIL_LIBRARIES ${APRUTIL_LIBRARY}) + SET(APRUTIL_FOUND "YES") +ELSE (APRUTIL_LIBRARY AND APRUTIL_INCLUDE_DIR) + SET(APRUTIL_FOUND "NO") +ENDIF (APRUTIL_LIBRARY AND APRUTIL_INCLUDE_DIR) + + +IF (APRUTIL_FOUND) + IF (NOT APRUTIL_FIND_QUIETLY) + MESSAGE(STATUS "Found APRUTIL: ${APRUTIL_LIBRARIES}") + ENDIF (NOT APRUTIL_FIND_QUIETLY) +ELSE (APRUTIL_FOUND) + IF (APRUTIL_FIND_REQUIRED) + MESSAGE(FATAL_ERROR "Could not find APRUTIL library") + ENDIF (APRUTIL_FIND_REQUIRED) +ENDIF (APRUTIL_FOUND) + +# Deprecated declarations. +SET (NATIVE_APRUTIL_INCLUDE_PATH ${APRUTIL_INCLUDE_DIR} ) +GET_FILENAME_COMPONENT (NATIVE_APRUTIL_LIB_PATH ${APRUTIL_LIBRARY} PATH) + +MARK_AS_ADVANCED( + APRUTIL_LIBRARY + APRUTIL_INCLUDE_DIR + ) diff --git a/linden/indra/cmake/FindBerkeleyDB.cmake b/linden/indra/cmake/FindBerkeleyDB.cmake new file mode 100644 index 0000000..2d633c7 --- /dev/null +++ b/linden/indra/cmake/FindBerkeleyDB.cmake @@ -0,0 +1,50 @@ +# -*- cmake -*- + +# - Find BerkeleyDB +# Find the BerkeleyDB includes and library +# This module defines +# DB_INCLUDE_DIR, where to find db.h, etc. +# DB_LIBRARIES, the libraries needed to use BerkeleyDB. +# DB_FOUND, If false, do not try to use BerkeleyDB. +# also defined, but not for general use are +# DB_LIBRARY, where to find the BerkeleyDB library. + +FIND_PATH(DB_INCLUDE_DIR db.h +/usr/local/include/db4 +/usr/local/include +/usr/include/db4 +/usr/include +) + +SET(DB_NAMES ${DB_NAMES} db) +FIND_LIBRARY(DB_LIBRARY + NAMES ${DB_NAMES} + PATHS /usr/lib /usr/local/lib + ) + +IF (DB_LIBRARY AND DB_INCLUDE_DIR) + SET(DB_LIBRARIES ${DB_LIBRARY}) + SET(DB_FOUND "YES") +ELSE (DB_LIBRARY AND DB_INCLUDE_DIR) + SET(DB_FOUND "NO") +ENDIF (DB_LIBRARY AND DB_INCLUDE_DIR) + + +IF (DB_FOUND) + IF (NOT DB_FIND_QUIETLY) + MESSAGE(STATUS "Found BerkeleyDB: ${DB_LIBRARIES}") + ENDIF (NOT DB_FIND_QUIETLY) +ELSE (DB_FOUND) + IF (DB_FIND_REQUIRED) + MESSAGE(FATAL_ERROR "Could not find BerkeleyDB library") + ENDIF (DB_FIND_REQUIRED) +ENDIF (DB_FOUND) + +# Deprecated declarations. +SET (NATIVE_DB_INCLUDE_PATH ${DB_INCLUDE_DIR} ) +GET_FILENAME_COMPONENT (NATIVE_DB_LIB_PATH ${DB_LIBRARY} PATH) + +MARK_AS_ADVANCED( + DB_LIBRARY + DB_INCLUDE_DIR + ) diff --git a/linden/indra/cmake/FindCARes.cmake b/linden/indra/cmake/FindCARes.cmake new file mode 100644 index 0000000..1ed5b32 --- /dev/null +++ b/linden/indra/cmake/FindCARes.cmake @@ -0,0 +1,48 @@ +# -*- cmake -*- + +# - Find c-ares +# Find the c-ares includes and library +# This module defines +# CARES_INCLUDE_DIR, where to find ares.h, etc. +# CARES_LIBRARIES, the libraries needed to use c-ares. +# CARES_FOUND, If false, do not try to use c-ares. +# also defined, but not for general use are +# CARES_LIBRARY, where to find the c-ares library. + +FIND_PATH(CARES_INCLUDE_DIR ares.h +/usr/local/include +/usr/include +) + +SET(CARES_NAMES ${CARES_NAMES} cares) +FIND_LIBRARY(CARES_LIBRARY + NAMES ${CARES_NAMES} + PATHS /usr/lib /usr/local/lib + ) + +IF (CARES_LIBRARY AND CARES_INCLUDE_DIR) + SET(CARES_LIBRARIES ${CARES_LIBRARY}) + SET(CARES_FOUND "YES") +ELSE (CARES_LIBRARY AND CARES_INCLUDE_DIR) + SET(CARES_FOUND "NO") +ENDIF (CARES_LIBRARY AND CARES_INCLUDE_DIR) + + +IF (CARES_FOUND) + IF (NOT CARES_FIND_QUIETLY) + MESSAGE(STATUS "Found c-ares: ${CARES_LIBRARIES}") + ENDIF (NOT CARES_FIND_QUIETLY) +ELSE (CARES_FOUND) + IF (CARES_FIND_REQUIRED) + MESSAGE(FATAL_ERROR "Could not find c-ares library") + ENDIF (CARES_FIND_REQUIRED) +ENDIF (CARES_FOUND) + +# Deprecated declarations. +SET (NATIVE_CARES_INCLUDE_PATH ${CARES_INCLUDE_DIR} ) +GET_FILENAME_COMPONENT (NATIVE_CARES_LIB_PATH ${CARES_LIBRARY} PATH) + +MARK_AS_ADVANCED( + CARES_LIBRARY + CARES_INCLUDE_DIR + ) diff --git a/linden/indra/cmake/FindELFIO.cmake b/linden/indra/cmake/FindELFIO.cmake new file mode 100644 index 0000000..8a5421a --- /dev/null +++ b/linden/indra/cmake/FindELFIO.cmake @@ -0,0 +1,48 @@ +# -*- cmake -*- + +# - Find ELFIO +# Find the ELFIO includes and library +# This module defines +# ELFIO_INCLUDE_DIR, where to find elfio.h, etc. +# ELFIO_LIBRARIES, the libraries needed to use ELFIO. +# ELFIO_FOUND, If false, do not try to use ELFIO. +# also defined, but not for general use are +# ELFIO_LIBRARY, where to find the ELFIO library. + +FIND_PATH(ELFIO_INCLUDE_DIR ELFIO/ELFIO.h +/usr/local/include +/usr/include +) + +SET(ELFIO_NAMES ${ELFIO_NAMES} ELFIO) +FIND_LIBRARY(ELFIO_LIBRARY + NAMES ${ELFIO_NAMES} + PATHS /usr/lib /usr/local/lib + ) + +IF (ELFIO_LIBRARY AND ELFIO_INCLUDE_DIR) + SET(ELFIO_LIBRARIES ${ELFIO_LIBRARY}) + SET(ELFIO_FOUND "YES") +ELSE (ELFIO_LIBRARY AND ELFIO_INCLUDE_DIR) + SET(ELFIO_FOUND "NO") +ENDIF (ELFIO_LIBRARY AND ELFIO_INCLUDE_DIR) + + +IF (ELFIO_FOUND) + IF (NOT ELFIO_FIND_QUIETLY) + MESSAGE(STATUS "Found ELFIO: ${ELFIO_LIBRARIES}") + ENDIF (NOT ELFIO_FIND_QUIETLY) +ELSE (ELFIO_FOUND) + IF (ELFIO_FIND_REQUIRED) + MESSAGE(FATAL_ERROR "Could not find ELFIO library") + ENDIF (ELFIO_FIND_REQUIRED) +ENDIF (ELFIO_FOUND) + +# Deprecated declarations. +SET (NATIVE_ELFIO_INCLUDE_PATH ${ELFIO_INCLUDE_DIR} ) +GET_FILENAME_COMPONENT (NATIVE_ELFIO_LIB_PATH ${ELFIO_LIBRARY} PATH) + +MARK_AS_ADVANCED( + ELFIO_LIBRARY + ELFIO_INCLUDE_DIR + ) diff --git a/linden/indra/cmake/FindGooglePerfTools.cmake b/linden/indra/cmake/FindGooglePerfTools.cmake new file mode 100644 index 0000000..bb125d5 --- /dev/null +++ b/linden/indra/cmake/FindGooglePerfTools.cmake @@ -0,0 +1,66 @@ +# -*- cmake -*- + +# - Find Google perftools +# Find the Google perftools includes and libraries +# This module defines +# GOOGLE_PERFTOOLS_INCLUDE_DIR, where to find heap-profiler.h, etc. +# GOOGLE_PERFTOOLS_FOUND, If false, do not try to use Google perftools. +# also defined for general use are +# TCMALLOC_LIBRARIES, where to find the tcmalloc library. +# STACKTRACE_LIBRARIES, where to find the stacktrace library. +# PROFILER_LIBRARIES, where to find the profiler library. + +FIND_PATH(GOOGLE_PERFTOOLS_INCLUDE_DIR google/heap-profiler.h +/usr/local/include +/usr/include +) + +SET(TCMALLOC_NAMES ${TCMALLOC_NAMES} tcmalloc) +FIND_LIBRARY(TCMALLOC_LIBRARY + NAMES ${TCMALLOC_NAMES} + PATHS /usr/lib /usr/local/lib + ) + +IF (TCMALLOC_LIBRARY AND GOOGLE_PERFTOOLS_INCLUDE_DIR) + SET(TCMALLOC_LIBRARIES ${TCMALLOC_LIBRARY}) + SET(GOOGLE_PERFTOOLS_FOUND "YES") +ELSE (TCMALLOC_LIBRARY AND GOOGLE_PERFTOOLS_INCLUDE_DIR) + SET(GOOGLE_PERFTOOLS_FOUND "NO") +ENDIF (TCMALLOC_LIBRARY AND GOOGLE_PERFTOOLS_INCLUDE_DIR) + +SET(STACKTRACE_NAMES ${STACKTRACE_NAMES} stacktrace) +FIND_LIBRARY(STACKTRACE_LIBRARY + NAMES ${STACKTRACE_LIBRARY} + PATHS /usr/lib /usr/local/lib + ) + +IF (STACKTRACE_LIBRARY AND GOOGLE_PERFTOOLS_INCLUDE_DIR) + SET(STACKTRACE_LIBRARIES ${STACKTRACE_LIBRARY}) +ENDIF (STACKTRACE_LIBRARY AND GOOGLE_PERFTOOLS_INCLUDE_DIR) + +SET(PROFILER_NAMES ${PROFILER_NAMES} profiler) +FIND_LIBRARY(PROFILER_LIBRARY + NAMES ${PROFILER_LIBRARY} + PATHS /usr/lib /usr/local/lib + ) + +IF (PROFILER_LIBRARY AND GOOGLE_PERFTOOLS_INCLUDE_DIR) + SET(PROFILER_LIBRARIES ${PROFILER_LIBRARY}) +ENDIF (PROFILER_LIBRARY AND GOOGLE_PERFTOOLS_INCLUDE_DIR) + +IF (GOOGLE_PERFTOOLS_FOUND) + IF (NOT GOOGLE_PERFTOOLS_FIND_QUIETLY) + MESSAGE(STATUS "Found Google perftools: ${GOOGLE_PERFTOOLS_LIBRARIES}") + ENDIF (NOT GOOGLE_PERFTOOLS_FIND_QUIETLY) +ELSE (GOOGLE_PERFTOOLS_FOUND) + IF (GOOGLE_PERFTOOLS_FIND_REQUIRED) + MESSAGE(FATAL_ERROR "Could not find Google perftools library") + ENDIF (GOOGLE_PERFTOOLS_FIND_REQUIRED) +ENDIF (GOOGLE_PERFTOOLS_FOUND) + +MARK_AS_ADVANCED( + TCMALLOC_LIBRARY + STACKTRACE_LIBRARY + PROFILER_LIBRARY + GOOGLE_PERFTOOLS_INCLUDE_DIR + ) diff --git a/linden/indra/cmake/FindMono.cmake b/linden/indra/cmake/FindMono.cmake new file mode 100644 index 0000000..f0a0705 --- /dev/null +++ b/linden/indra/cmake/FindMono.cmake @@ -0,0 +1,68 @@ +# - Try to find the mono, mcs, gmcs and gacutil +# +# defines +# +# MONO_FOUND - system has mono, mcs, gmcs and gacutil +# MONO_PATH - where to find 'mono' +# MCS_PATH - where to find 'mcs' +# GMCS_PATH - where to find 'gmcs' +# GACUTIL_PATH - where to find 'gacutil' +# +# copyright (c) 2007 Arno Rehn arno@arnorehn.de +# +# Redistribution and use is allowed according to the terms of the GPL license. +# Removed the check for gmcs + +FIND_PROGRAM (MONO_EXECUTABLE mono + "C:/Program Files/Mono-1.9.1/bin" + "C:/Program Files/Mono-1.2.6/bin" + /bin + /usr/bin + /usr/local/bin +) +FIND_PROGRAM (MCS_EXECUTABLE mcs + "C:/Program Files/Mono-1.9.1/bin" + "C:/Program Files/Mono-1.2.6/bin" + /bin + /usr/bin + /usr/local/bin +) +FIND_PROGRAM (GMCS_EXECUTABLE gmcs + "C:/Program Files/Mono-1.9.1/bin" + "C:/Program Files/Mono-1.2.6/bin" + /bin + /usr/bin + /usr/local/bin +) +FIND_PROGRAM (GACUTIL_EXECUTABLE gacutil + "C:/Program Files/Mono-1.9.1/bin" + "C:/Program Files/Mono-1.2.6/bin" + /bin + /usr/bin + /usr/local/bin +) +FIND_PROGRAM (ILASM_EXECUTABLE + ilasm + NO_DEFAULT_PATH + PATHS "C:/Program Files/Mono-1.9.1/bin" "C:/Apps/Mono-1.2.6/bin" "C:/Program Files/Mono-1.2.6/bin" /bin /usr/bin /usr/local/bin +) + +SET (MONO_FOUND FALSE) + +IF (MONO_EXECUTABLE AND MCS_EXECUTABLE AND GACUTIL_EXECUTABLE) + SET (MONO_FOUND TRUE) +ENDIF (MONO_EXECUTABLE AND MCS_EXECUTABLE AND GACUTIL_EXECUTABLE) + +IF (MONO_FOUND) + IF (NOT Mono_FIND_QUIETLY) + MESSAGE(STATUS "Found mono: ${MONO_EXECUTABLE}") + MESSAGE(STATUS "Found mcs: ${MCS_EXECUTABLE}") + MESSAGE(STATUS "Found gacutil: ${GACUTIL_EXECUTABLE}") + ENDIF (NOT Mono_FIND_QUIETLY) +ELSE (MONO_FOUND) + IF (Mono_FIND_REQUIRED) + MESSAGE(FATAL_ERROR "Could not find one or more of the following programs: mono, mcs, gacutil") + ENDIF (Mono_FIND_REQUIRED) +ENDIF (MONO_FOUND) + +MARK_AS_ADVANCED(MONO_EXECUTABLE MCS_EXECUTABLE GACUTIL_EXECUTABLE) diff --git a/linden/indra/cmake/FindMySQL.cmake b/linden/indra/cmake/FindMySQL.cmake new file mode 100644 index 0000000..4319403 --- /dev/null +++ b/linden/indra/cmake/FindMySQL.cmake @@ -0,0 +1,48 @@ +# -*- cmake -*- + +# - Find MySQL +# Find the MySQL includes and library +# This module defines +# MYSQL_INCLUDE_DIR, where to find mysql.h, etc. +# MYSQL_LIBRARIES, the libraries needed to use Mysql. +# MYSQL_FOUND, If false, do not try to use Mysql. +# also defined, but not for general use are +# MYSQL_LIBRARY, where to find the Mysql library. + +FIND_PATH(MYSQL_INCLUDE_DIR mysql/mysql.h +/usr/local/include +/usr/include +) + +SET(MYSQL_NAMES ${MYSQL_NAMES} mysqlclient) +FIND_LIBRARY(MYSQL_LIBRARY + NAMES ${MYSQL_NAMES} + PATHS /usr/lib/mysql /usr/lib /usr/local/lib/mysql /usr/local/lib + ) + +IF (MYSQL_LIBRARY AND MYSQL_INCLUDE_DIR) + SET(MYSQL_LIBRARIES ${MYSQL_LIBRARY}) + SET(MYSQL_FOUND "YES") +ELSE (MYSQL_LIBRARY AND MYSQL_INCLUDE_DIR) + SET(MYSQL_FOUND "NO") +ENDIF (MYSQL_LIBRARY AND MYSQL_INCLUDE_DIR) + + +IF (MYSQL_FOUND) + IF (NOT MYSQL_FIND_QUIETLY) + MESSAGE(STATUS "Found MySQL: ${MYSQL_LIBRARIES}") + ENDIF (NOT MYSQL_FIND_QUIETLY) +ELSE (MYSQL_FOUND) + IF (MYSQL_FIND_REQUIRED) + MESSAGE(FATAL_ERROR "Could not find MySQL library") + ENDIF (MYSQL_FIND_REQUIRED) +ENDIF (MYSQL_FOUND) + +# Deprecated declarations. +SET (NATIVE_MYSQL_INCLUDE_PATH ${MYSQL_INCLUDE_DIR} ) +GET_FILENAME_COMPONENT (NATIVE_MYSQL_LIB_PATH ${MYSQL_LIBRARY} PATH) + +MARK_AS_ADVANCED( + MYSQL_LIBRARY + MYSQL_INCLUDE_DIR + ) diff --git a/linden/indra/cmake/FindOpenJPEG.cmake b/linden/indra/cmake/FindOpenJPEG.cmake new file mode 100644 index 0000000..949384e --- /dev/null +++ b/linden/indra/cmake/FindOpenJPEG.cmake @@ -0,0 +1,50 @@ +# -*- cmake -*- + +# - Find OpenJPEG +# Find the OpenJPEG includes and library +# This module defines +# OPENJPEG_INCLUDE_DIR, where to find openjpeg.h, etc. +# OPENJPEG_LIBRARIES, the libraries needed to use OpenJPEG. +# OPENJPEG_FOUND, If false, do not try to use OpenJPEG. +# also defined, but not for general use are +# OPENJPEG_LIBRARY, where to find the OpenJPEG library. + +FIND_PATH(OPENJPEG_INCLUDE_DIR openjpeg.h +/usr/local/include/openjpeg +/usr/local/include +/usr/include/openjpeg +/usr/include +) + +SET(OPENJPEG_NAMES ${OPENJPEG_NAMES} openjpeg) +FIND_LIBRARY(OPENJPEG_LIBRARY + NAMES ${OPENJPEG_NAMES} + PATHS /usr/lib /usr/local/lib + ) + +IF (OPENJPEG_LIBRARY AND OPENJPEG_INCLUDE_DIR) + SET(OPENJPEG_LIBRARIES ${OPENJPEG_LIBRARY}) + SET(OPENJPEG_FOUND "YES") +ELSE (OPENJPEG_LIBRARY AND OPENJPEG_INCLUDE_DIR) + SET(OPENJPEG_FOUND "NO") +ENDIF (OPENJPEG_LIBRARY AND OPENJPEG_INCLUDE_DIR) + + +IF (OPENJPEG_FOUND) + IF (NOT OPENJPEG_FIND_QUIETLY) + MESSAGE(STATUS "Found OpenJPEG: ${OPENJPEG_LIBRARIES}") + ENDIF (NOT OPENJPEG_FIND_QUIETLY) +ELSE (OPENJPEG_FOUND) + IF (OPENJPEG_FIND_REQUIRED) + MESSAGE(FATAL_ERROR "Could not find OpenJPEG library") + ENDIF (OPENJPEG_FIND_REQUIRED) +ENDIF (OPENJPEG_FOUND) + +# Deprecated declarations. +SET (NATIVE_OPENJPEG_INCLUDE_PATH ${OPENJPEG_INCLUDE_DIR} ) +GET_FILENAME_COMPONENT (NATIVE_OPENJPEG_LIB_PATH ${OPENJPEG_LIBRARY} PATH) + +MARK_AS_ADVANCED( + OPENJPEG_LIBRARY + OPENJPEG_INCLUDE_DIR + ) diff --git a/linden/indra/cmake/FindSCP.cmake b/linden/indra/cmake/FindSCP.cmake new file mode 100644 index 0000000..ea02102 --- /dev/null +++ b/linden/indra/cmake/FindSCP.cmake @@ -0,0 +1,40 @@ +# -*- cmake -*- +# +# Find the OpenSSH scp ("secure copy") or Putty pscp command. +# +# Input variables: +# SCP_FIND_REQUIRED - set this if configuration should fail without scp +# +# Output variables: +# +# SCP_FOUND - set if scp was found +# SCP_EXECUTABLE - path to scp or pscp executable +# SCP_BATCH_FLAG - how to put scp/pscp into batch mode + +SET(SCP_EXECUTABLE) +IF (WINDOWS) + FIND_PROGRAM(SCP_EXECUTABLE NAMES pscp pscp.exe) +ELSE (WINDOWS) + FIND_PROGRAM(SCP_EXECUTABLE NAMES scp scp.exe) +ENDIF (WINDOWS) + +IF (SCP_EXECUTABLE) + SET(SCP_FOUND ON) +ELSE (SCP_EXECUTABLE) + SET(SCP_FOUND OFF) +ENDIF (SCP_EXECUTABLE) + +IF (SCP_FOUND) + GET_FILENAME_COMPONENT(_scp_name ${SCP_EXECUTABLE} NAME_WE) + IF (_scp_name STREQUAL scp) + SET(SCP_BATCH_FLAG -B) + ELSE (_scp_name STREQUAL scp) + SET(SCP_BATCH_FLAG -batch) + ENDIF (_scp_name STREQUAL scp) +ELSE (SCP_FOUND) + IF (SCP_FIND_REQUIRED) + MESSAGE(FATAL_ERROR "Could not find scp or pscp executable") + ENDIF (SCP_FIND_REQUIRED) +ENDIF (SCP_FOUND) + +MARK_AS_ADVANCED(SCP_EXECUTABLE SCP_FOUND SCP_BATCH_FLAG) diff --git a/linden/indra/cmake/FindXmlRpcEpi.cmake b/linden/indra/cmake/FindXmlRpcEpi.cmake new file mode 100644 index 0000000..ba217e7 --- /dev/null +++ b/linden/indra/cmake/FindXmlRpcEpi.cmake @@ -0,0 +1,48 @@ +# -*- cmake -*- + +# - Find XMLRPC-EPI +# Find the XMLRPC-EPI includes and library +# This module defines +# XMLRPCEPI_INCLUDE_DIR, where to find jpeglib.h, etc. +# XMLRPCEPI_LIBRARIES, the libraries needed to use XMLRPC-EPI. +# XMLRPCEPI_FOUND, If false, do not try to use XMLRPC-EPI. +# also defined, but not for general use are +# XMLRPCEPI_LIBRARY, where to find the XMLRPC-EPI library. + +FIND_PATH(XMLRPCEPI_INCLUDE_DIR xmlrpc-epi/xmlrpc.h +/usr/local/include +/usr/include +) + +SET(XMLRPCEPI_NAMES ${XMLRPCEPI_NAMES} xmlrpc-epi) +FIND_LIBRARY(XMLRPCEPI_LIBRARY + NAMES ${XMLRPCEPI_NAMES} + PATHS /usr/lib /usr/local/lib + ) + +IF (XMLRPCEPI_LIBRARY AND XMLRPCEPI_INCLUDE_DIR) + SET(XMLRPCEPI_LIBRARIES ${XMLRPCEPI_LIBRARY}) + SET(XMLRPCEPI_FOUND "YES") +ELSE (XMLRPCEPI_LIBRARY AND XMLRPCEPI_INCLUDE_DIR) + SET(XMLRPCEPI_FOUND "NO") +ENDIF (XMLRPCEPI_LIBRARY AND XMLRPCEPI_INCLUDE_DIR) + + +IF (XMLRPCEPI_FOUND) + IF (NOT XMLRPCEPI_FIND_QUIETLY) + MESSAGE(STATUS "Found XMLRPC-EPI: ${XMLRPCEPI_LIBRARIES}") + ENDIF (NOT XMLRPCEPI_FIND_QUIETLY) +ELSE (XMLRPCEPI_FOUND) + IF (XMLRPCEPI_FIND_REQUIRED) + MESSAGE(FATAL_ERROR "Could not find XMLRPC-EPI library") + ENDIF (XMLRPCEPI_FIND_REQUIRED) +ENDIF (XMLRPCEPI_FOUND) + +# Deprecated declarations. +SET (NATIVE_XMLRPCEPI_INCLUDE_PATH ${XMLRPCEPI_INCLUDE_DIR} ) +GET_FILENAME_COMPONENT (NATIVE_XMLRPCEPI_LIB_PATH ${XMLRPCEPI_LIBRARY} PATH) + +MARK_AS_ADVANCED( + XMLRPCEPI_LIBRARY + XMLRPCEPI_INCLUDE_DIR + ) diff --git a/linden/indra/cmake/FreeType.cmake b/linden/indra/cmake/FreeType.cmake new file mode 100644 index 0000000..5f1aa26 --- /dev/null +++ b/linden/indra/cmake/FreeType.cmake @@ -0,0 +1,20 @@ +# -*- cmake -*- +include(Prebuilt) + +if (STANDALONE) + include(FindPkgConfig) + + pkg_check_modules(FREETYPE REQUIRED freetype2) +else (STANDALONE) + use_prebuilt_binary(freetype) + if (LINUX) + set(FREETYPE_INCLUDE_DIRS + ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/include) + else (LINUX) + set(FREETYPE_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include) + endif (LINUX) + + set(FREETYPE_LIBRARIES freetype) +endif (STANDALONE) + +link_directories(${FREETYPE_LIBRARY_DIRS}) diff --git a/linden/indra/cmake/GStreamer.cmake b/linden/indra/cmake/GStreamer.cmake new file mode 100644 index 0000000..10d5207 --- /dev/null +++ b/linden/indra/cmake/GStreamer.cmake @@ -0,0 +1,38 @@ +# -*- cmake -*- +include(Prebuilt) + +if (STANDALONE) + include(FindPkgConfig) + + pkg_check_modules(GSTREAMER REQUIRED gstreamer-0.10) + pkg_check_modules(GSTREAMER_PLUGINS_BASE REQUIRED gstreamer-plugins-base-0.10) +elseif (LINUX) + use_prebuilt_binary(gstreamer) + # possible libxml should have its own .cmake file instead + use_prebuilt_binary(libxml) + set(GSTREAMER_FOUND ON FORCE BOOL) + set(GSTREAMER_PLUGINS_BASE_FOUND ON FORCE BOOL) + set(GSTREAMER_INCLUDE_DIRS + ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/include/gstreamer-0.10 + ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/include/glib-2.0 + ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/include/libxml2 + ) + # We don't need to explicitly link against gstreamer itself, because + # LLMediaImplGStreamer probes for the system's copy at runtime. + set(GSTREAMER_LIBRARIES + gobject-2.0 + gmodule-2.0 + dl + gthread-2.0 + rt + glib-2.0 + ) +endif (STANDALONE) + +if (GSTREAMER_FOUND AND GSTREAMER_PLUGINS_BASE_FOUND) + set(GSTREAMER ON CACHE BOOL "Build with GStreamer streaming media support.") +endif (GSTREAMER_FOUND AND GSTREAMER_PLUGINS_BASE_FOUND) + +if (GSTREAMER) + add_definitions(-DLL_GSTREAMER_ENABLED=1) +endif (GSTREAMER) diff --git a/linden/indra/cmake/GooglePerfTools.cmake b/linden/indra/cmake/GooglePerfTools.cmake new file mode 100644 index 0000000..9b3eca0 --- /dev/null +++ b/linden/indra/cmake/GooglePerfTools.cmake @@ -0,0 +1,28 @@ +# -*- cmake -*- +include(Prebuilt) + +if (STANDALONE) + include(FindGooglePerfTools) +else (STANDALONE) + use_prebuilt_binary(google) + if (LINUX) + set(TCMALLOC_LIBRARIES tcmalloc) + set(STACKTRACE_LIBRARIES stacktrace) + set(PROFILER_LIBRARIES profiler) + set(GOOGLE_PERFTOOLS_INCLUDE_DIR + ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/include) + set(GOOGLE_PERFTOOLS_FOUND "YES") + endif (LINUX) +endif (STANDALONE) + +if (GOOGLE_PERFTOOLS_FOUND) + set(USE_GOOGLE_PERFTOOLS ON CACHE BOOL "Build with Google PerfTools support.") +endif (GOOGLE_PERFTOOLS_FOUND) + +if (USE_GOOGLE_PERFTOOLS) + set(TCMALLOC_FLAG -DLL_USE_TCMALLOC=1) + include_directories(${GOOGLE_PERFTOOLS_INCLUDE_DIR}) + set(GOOGLE_PERFTOOLS_LIBRARIES ${TCMALLOC_LIBRARIES} ${STACKTRACE_LIBRARIES}) +else (USE_GOOGLE_PERFTOOLS) + set(TCMALLOC_FLAG -ULL_USE_TCMALLOC) +endif (USE_GOOGLE_PERFTOOLS) diff --git a/linden/indra/cmake/JPEG.cmake b/linden/indra/cmake/JPEG.cmake new file mode 100644 index 0000000..5d0ee0d --- /dev/null +++ b/linden/indra/cmake/JPEG.cmake @@ -0,0 +1,23 @@ +# -*- cmake -*- +include(Prebuilt) + +include(Linking) +set(JPEG_FIND_QUIETLY ON) +set(JPEG_FIND_REQUIRED ON) + +if (STANDALONE) + include(FindJPEG) +else (STANDALONE) + use_prebuilt_binary(jpeglib) + if (LINUX) + set(JPEG_LIBRARIES jpeg) + elseif (DARWIN) + set(JPEG_LIBRARIES + optimized ${ARCH_PREBUILT_DIRS_RELEASE}/liblljpeg.a + debug ${ARCH_PREBUILT_DIRS_DEBUG}/liblljpeg.a + ) + elseif (WINDOWS) + set(JPEG_LIBRARIES jpeglib_6b) + endif (LINUX) + set(JPEG_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include) +endif (STANDALONE) diff --git a/linden/indra/cmake/LLAudio.cmake b/linden/indra/cmake/LLAudio.cmake new file mode 100644 index 0000000..7b9f254 --- /dev/null +++ b/linden/indra/cmake/LLAudio.cmake @@ -0,0 +1,15 @@ +# -*- cmake -*- + +include(Audio) + +set(LLAUDIO_INCLUDE_DIRS + ${LIBS_OPEN_DIR}/llaudio + ) + +set(LLAUDIO_LIBRARIES + llaudio + ${VORBISENC_LIBRARIES} + ${VORBISFILE_LIBRARIES} + ${VORBIS_LIBRARIES} + ${OGG_LIBRARIES} + ) diff --git a/linden/indra/cmake/LLCharacter.cmake b/linden/indra/cmake/LLCharacter.cmake new file mode 100644 index 0000000..c74092c --- /dev/null +++ b/linden/indra/cmake/LLCharacter.cmake @@ -0,0 +1,9 @@ +# -*- cmake -*- + +set(LLCHARACTER_INCLUDE_DIRS + ${LIBS_OPEN_DIR}/llcharacter + ) + +set(LLCHARACTER_LIBRARIES + llcharacter + ) diff --git a/linden/indra/cmake/LLCommon.cmake b/linden/indra/cmake/LLCommon.cmake new file mode 100644 index 0000000..f4b251e --- /dev/null +++ b/linden/indra/cmake/LLCommon.cmake @@ -0,0 +1,21 @@ +# -*- cmake -*- + +include(APR) +include(Boost) +include(EXPAT) +include(ZLIB) + +set(LLCOMMON_INCLUDE_DIRS + ${LIBS_OPEN_DIR}/llcommon + ${APRUTIL_INCLUDE_DIR} + ${APR_INCLUDE_DIR} + ${Boost_INCLUDE_DIRS} + ) + +set(LLCOMMON_LIBRARIES + llcommon + ${APRUTIL_LIBRARIES} + ${APR_LIBRARIES} + ${EXPAT_LIBRARIES} + ${ZLIB_LIBRARIES} + ) diff --git a/linden/indra/cmake/LLCrashLogger.cmake b/linden/indra/cmake/LLCrashLogger.cmake new file mode 100644 index 0000000..7b362d0 --- /dev/null +++ b/linden/indra/cmake/LLCrashLogger.cmake @@ -0,0 +1,9 @@ +# -*- cmake -*- + +set(LLCRASHLOGGER_INCLUDE_DIRS + ${LIBS_OPEN_DIR}/llcrashlogger + ) + +set(LLCRASHLOGGER_LIBRARIES + llcrashlogger + ) diff --git a/linden/indra/cmake/LLDatabase.cmake b/linden/indra/cmake/LLDatabase.cmake new file mode 100644 index 0000000..c3cf622 --- /dev/null +++ b/linden/indra/cmake/LLDatabase.cmake @@ -0,0 +1,13 @@ +# -*- cmake -*- + +include(MySQL) + +set(LLDATABASE_INCLUDE_DIRS + ${LIBS_SERVER_DIR}/lldatabase + ${MYSQL_INCLUDE_DIR} + ) + +set(LLDATABASE_LIBRARIES + lldatabase + ${MYSQL_LIBRARIES} + ) diff --git a/linden/indra/cmake/LLImage.cmake b/linden/indra/cmake/LLImage.cmake new file mode 100644 index 0000000..8874fa5 --- /dev/null +++ b/linden/indra/cmake/LLImage.cmake @@ -0,0 +1,15 @@ +# -*- cmake -*- + +include(JPEG) +include(PNG) + +set(LLIMAGE_INCLUDE_DIRS + ${LIBS_OPEN_DIR}/llimage + ${JPEG_INCLUDE_DIRS} + ) + +set(LLIMAGE_LIBRARIES + llimage + ${JPEG_LIBRARIES} + ${PNG_LIBRARIES} + ) diff --git a/linden/indra/cmake/LLImageJ2COJ.cmake b/linden/indra/cmake/LLImageJ2COJ.cmake new file mode 100644 index 0000000..91973e0 --- /dev/null +++ b/linden/indra/cmake/LLImageJ2COJ.cmake @@ -0,0 +1,8 @@ +# -*- cmake -*- + +include(OpenJPEG) + +set(LLIMAGEJ2COJ_LIBRARIES + llimagej2coj + ${OPENJPEG_LIBRARIES} + ) diff --git a/linden/indra/cmake/LLInventory.cmake b/linden/indra/cmake/LLInventory.cmake new file mode 100644 index 0000000..7d5f492 --- /dev/null +++ b/linden/indra/cmake/LLInventory.cmake @@ -0,0 +1,9 @@ +# -*- cmake -*- + +set(LLINVENTORY_INCLUDE_DIRS + ${LIBS_OPEN_DIR}/llinventory + ) + +set(LLINVENTORY_LIBRARIES + llinventory + ) diff --git a/linden/indra/cmake/LLKDU.cmake b/linden/indra/cmake/LLKDU.cmake new file mode 100644 index 0000000..a02b5d9 --- /dev/null +++ b/linden/indra/cmake/LLKDU.cmake @@ -0,0 +1,20 @@ +# -*- cmake -*- +include(Prebuilt) + +if (NOT STANDALONE AND EXISTS ${LIBS_CLOSED_DIR}/llkdu) + use_prebuilt_binary(kdu) + if (WINDOWS) + set(KDU_LIBRARY debug kdu_cored optimized kdu_core) + elseif (LINUX) + set(KDU_LIBRARY kdu_v42R) + else (WINDOWS) + set(KDU_LIBRARY kdu) + endif (WINDOWS) + + set(KDU_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/include) + + set(LLKDU_LIBRARY llkdu) + set(LLKDU_STATIC_LIBRARY llkdu_static) + set(LLKDU_LIBRARIES ${LLKDU_LIBRARY}) + set(LLKDU_STATIC_LIBRARIES ${LLKDU_STATIC_LIBRARY}) +endif (NOT STANDALONE AND EXISTS ${LIBS_CLOSED_DIR}/llkdu) diff --git a/linden/indra/cmake/LLMath.cmake b/linden/indra/cmake/LLMath.cmake new file mode 100644 index 0000000..8afd45e --- /dev/null +++ b/linden/indra/cmake/LLMath.cmake @@ -0,0 +1,9 @@ +# -*- cmake -*- + +set(LLMATH_INCLUDE_DIRS + ${LIBS_OPEN_DIR}/llmath + ) + +set(LLMATH_LIBRARIES + llmath + ) diff --git a/linden/indra/cmake/LLMedia.cmake b/linden/indra/cmake/LLMedia.cmake new file mode 100644 index 0000000..b7bf11c --- /dev/null +++ b/linden/indra/cmake/LLMedia.cmake @@ -0,0 +1,15 @@ +# -*- cmake -*- + +include(GStreamer) +include(QuickTime) + +set(LLMEDIA_INCLUDE_DIRS + ${LIBS_OPEN_DIR}/llmedia + ) + +set(LLMEDIA_LIBRARIES + llmedia + ${GSTREAMER_LIBRARIES} + ${GSTREAMER_PLUGINS_BASE_LIBRARIES} + ${QUICKTIME_LIBRARY} + ) diff --git a/linden/indra/cmake/LLMessage.cmake b/linden/indra/cmake/LLMessage.cmake new file mode 100644 index 0000000..1cea03a --- /dev/null +++ b/linden/indra/cmake/LLMessage.cmake @@ -0,0 +1,22 @@ +# -*- cmake -*- + +include(CARes) +include(CURL) +include(OpenSSL) +include(XmlRpcEpi) + +set(LLMESSAGE_INCLUDE_DIRS + ${LIBS_OPEN_DIR}/llmessage + ${CARES_INCLUDE_DIRS} + ${CURL_INCLUDE_DIRS} + ${OPENSSL_INCLUDE_DIRS} + ) + +set(LLMESSAGE_LIBRARIES + llmessage + ${CURL_LIBRARIES} + ${CARES_LIBRARIES} + ${OPENSSL_LIBRARIES} + ${CRYPTO_LIBRARIES} + ${XMLRPCEPI_LIBRARIES} + ) diff --git a/linden/indra/cmake/LLPhysics.cmake b/linden/indra/cmake/LLPhysics.cmake new file mode 100644 index 0000000..3ae390e --- /dev/null +++ b/linden/indra/cmake/LLPhysics.cmake @@ -0,0 +1,76 @@ +# -*- cmake -*- +include(Prebuilt) + +use_prebuilt_binary(havok) + +set(HAVOK_VERSION 460) + +set(LLPHYSICS_INCLUDE_DIRS + ${LIBS_SERVER_DIR}/llphysics + ${LIBS_PREBUILT_DIR}/include/havok/hk${HAVOK_VERSION}/common + ${LIBS_PREBUILT_DIR}/include/havok/hk${HAVOK_VERSION}/physics + ) + +add_definitions(-DLL_CURRENT_HAVOK_VERSION=${HAVOK_VERSION}) + +if (LINUX OR DARWIN) + if (DARWIN) + link_directories( + ${LIBS_PREBUILT_DIR}/universal-darwin/lib_release/havok/hk460 + ) + else (DARWIN) + link_directories( + ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/lib_release/havok/hk460 + ) + endif (DARWIN) + + set(LLPHYSICS_LIBRARIES + llphysics + hkcompat + hkutilities + hkvisualize + hkdynamics + hkvehicle + hkcollide + hkinternal + hkconstraintsolver + hkmath + hkscenedata + hkserialize + hkgraphicsogl + hkgraphicsbridge + hkgraphics + hkdemoframework + hkbase + ) +elseif (WINDOWS) + if (MSVC71) + set(HK_DEBUG ${WINLIBS_PREBUILT_DEBUG_DIR}/havok/hk460) + set(HK_RELEASE ${WINLIBS_PREBUILT_RELEASE_DIR}/havok/hk460) + else (MSVC71) + set(HK_DEBUG ${WINLIBS_PREBUILT_DEBUG_DIR}/havok/hk460_net_8-0) + set(HK_RELEASE ${WINLIBS_PREBUILT_RELEASE_DIR}/havok/hk460_net_8-0) + endif (MSVC71) + + set(HAVOK_LIBS + hkbase + hkdynamics + hkmath + hkcollide + hkutilities + hkvisualize + hkinternal + hkconstraintsolver + hkcompat + hkserialize + hkvehicle + hkscenedata + ) + + set(LLPHYSICS_LIBRARIES llphysics) + + foreach(lib ${HAVOK_LIBS}) + list(APPEND LLPHYSICS_LIBRARIES + debug ${HK_DEBUG}/${lib} optimized ${HK_RELEASE}/${lib}) + endforeach(lib) +endif (LINUX OR DARWIN) diff --git a/linden/indra/cmake/LLPrimitive.cmake b/linden/indra/cmake/LLPrimitive.cmake new file mode 100644 index 0000000..0426ae5 --- /dev/null +++ b/linden/indra/cmake/LLPrimitive.cmake @@ -0,0 +1,9 @@ +# -*- cmake -*- + +set(LLPRIMITIVE_INCLUDE_DIRS + ${LIBS_OPEN_DIR}/llprimitive + ) + +set(LLPRIMITIVE_LIBRARIES + llprimitive + ) diff --git a/linden/indra/cmake/LLRender.cmake b/linden/indra/cmake/LLRender.cmake new file mode 100644 index 0000000..bbcf4cd --- /dev/null +++ b/linden/indra/cmake/LLRender.cmake @@ -0,0 +1,32 @@ +# -*- cmake -*- + +include(FreeType) + +set(LLRENDER_INCLUDE_DIRS + ${LIBS_OPEN_DIR}/llrender + ) + +if (SERVER AND LINUX) + set(LLRENDER_LIBRARIES + llrenderheadless + ) +else (SERVER AND LINUX) +set(LLRENDER_LIBRARIES + llrender + ) +endif (SERVER AND LINUX) + +# mapserver requires certain files to be copied so LL_MESA_HEADLESS can be set +# differently for different object files. +macro (copy_server_sources _copied_SOURCES) + foreach (PREFIX ${_copied_SOURCES}) + add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${PREFIX}_server.cpp + COMMAND ${CMAKE_COMMAND} + ARGS -E copy ${CMAKE_CURRENT_SOURCE_DIR}/${PREFIX}.cpp + ${CMAKE_CURRENT_BINARY_DIR}/${PREFIX}_server.cpp + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${PREFIX}.cpp + ) + list(APPEND server_SOURCE_FILES ${PREFIX}_server.cpp) + endforeach (PREFIX ${_copied_SOURCES}) +endmacro (copy_server_sources _copied_SOURCES) diff --git a/linden/indra/cmake/LLScene.cmake b/linden/indra/cmake/LLScene.cmake new file mode 100644 index 0000000..d1c32b3 --- /dev/null +++ b/linden/indra/cmake/LLScene.cmake @@ -0,0 +1,9 @@ +# -*- cmake -*- + +set(LLSCENE_INCLUDE_DIRS + ${LIBS_SERVER_DIR}/llscene + ) + +set(LLSCENE_LIBRARIES + llscene + ) diff --git a/linden/indra/cmake/LLUI.cmake b/linden/indra/cmake/LLUI.cmake new file mode 100644 index 0000000..d1287de --- /dev/null +++ b/linden/indra/cmake/LLUI.cmake @@ -0,0 +1,9 @@ +# -*- cmake -*- + +set(LLUI_INCLUDE_DIRS + ${LIBS_OPEN_DIR}/llui + ) + +set(LLUI_LIBRARIES + llui + ) diff --git a/linden/indra/cmake/LLVFS.cmake b/linden/indra/cmake/LLVFS.cmake new file mode 100644 index 0000000..5ce3d25 --- /dev/null +++ b/linden/indra/cmake/LLVFS.cmake @@ -0,0 +1,13 @@ +# -*- cmake -*- + +set(LLVFS_INCLUDE_DIRS + ${LIBS_OPEN_DIR}/llvfs + ) + +set(LLVFS_LIBRARIES llvfs) + +if (DARWIN) + include(CMakeFindFrameworks) + find_library(CARBON_LIBRARY Carbon) + list(APPEND LLVFS_LIBRARIES ${CARBON_LIBRARY}) +endif (DARWIN) diff --git a/linden/indra/cmake/LLWindow.cmake b/linden/indra/cmake/LLWindow.cmake new file mode 100644 index 0000000..c0efa27 --- /dev/null +++ b/linden/indra/cmake/LLWindow.cmake @@ -0,0 +1,43 @@ +# -*- cmake -*- + +include(OpenGL) +include(Prebuilt) + +if (STANDALONE) + include(FindSDL) + + # This should be done by FindSDL. Sigh. + mark_as_advanced( + SDLMAIN_LIBRARY + SDL_INCLUDE_DIR + SDL_LIBRARY + ) +else (STANDALONE) + use_prebuilt_binary(SDL) + use_prebuilt_binary(mesa) + if (LINUX AND VIEWER) + set (SDL_FOUND TRUE) + set (SDL_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/i686-linux) + set (SDL_LIBRARY SDL) + endif (LINUX AND VIEWER) +endif (STANDALONE) + +if (SDL_FOUND) + add_definitions(-DLL_SDL=1) + include_directories(${SDL_INCLUDE_DIR}) +endif (SDL_FOUND) + +set(LLWINDOW_INCLUDE_DIRS + ${GLEXT_INCLUDE_DIR} + ${LIBS_OPEN_DIR}/llwindow + ) + +if (SERVER AND LINUX) + set(LLWINDOW_LIBRARIES + llwindowheadless + ) +else (SERVER AND LINUX) + set(LLWINDOW_LIBRARIES + llwindow + ) +endif (SERVER AND LINUX) diff --git a/linden/indra/cmake/LLXML.cmake b/linden/indra/cmake/LLXML.cmake new file mode 100644 index 0000000..1ce93c0 --- /dev/null +++ b/linden/indra/cmake/LLXML.cmake @@ -0,0 +1,13 @@ +# -*- cmake -*- + +include(EXPAT) + +set(LLXML_INCLUDE_DIRS + ${LIBS_OPEN_DIR}/llxml + ${EXPAT_INCLUDE_DIRS} + ) + +set(LLXML_LIBRARIES + llxml + ${EXPAT_LIBRARIES} + ) diff --git a/linden/indra/cmake/LScript.cmake b/linden/indra/cmake/LScript.cmake new file mode 100644 index 0000000..86bfcb7 --- /dev/null +++ b/linden/indra/cmake/LScript.cmake @@ -0,0 +1,16 @@ +# -*- cmake -*- + +set(LSCRIPT_INCLUDE_DIRS + ${LIBS_OPEN_DIR}/lscript + ${LIBS_OPEN_DIR}/lscript/lscript_compile + ${LIBS_OPEN_DIR}/lscript/lscript_execute + ${LIBS_OPEN_DIR}/lscript/lscript_execute_mono + ) + +set(LSCRIPT_LIBRARIES + lscript_compile + lscript_execute + lscript_library + ) + +set(LSCRIPT_EXECUTE_MONO_LIBRARIES lscript_execute_mono) \ No newline at end of file diff --git a/linden/indra/cmake/Linking.cmake b/linden/indra/cmake/Linking.cmake new file mode 100644 index 0000000..c9748e3 --- /dev/null +++ b/linden/indra/cmake/Linking.cmake @@ -0,0 +1,45 @@ +# -*- cmake -*- + +if (NOT STANDALONE) + if (WINDOWS) + set(ARCH_PREBUILT_DIRS ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/lib) + set(ARCH_PREBUILT_DIRS_RELEASE ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/lib/release) + set(ARCH_PREBUILT_DIRS_DEBUG ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/lib/debug) + elseif (LINUX) + if (VIEWER) + set(ARCH_PREBUILT_DIRS + ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/lib_release_client) + set(ARCH_PREBUILT_DIRS_RELEASE ${ARCH_PREBUILT_DIRS}) + set(ARCH_PREBUILT_DIRS_DEBUG ${ARCH_PREBUILT_DIRS}) + else (VIEWER) + set(ARCH_PREBUILT_DIRS ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/lib_release) + endif (VIEWER) + elseif (DARWIN) + set(ARCH_PREBUILT_DIRS_RELEASE ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/lib_release) + set(ARCH_PREBUILT_DIRS_DEBUG ${ARCH_PREBUILT_DIRS_RELEASE}) + endif (WINDOWS) +endif (NOT STANDALONE) + +link_directories(${ARCH_PREBUILT_DIRS}) + +if (LINUX) + set(DL_LIBRARY dl) + set(PTHREAD_LIBRARY pthread) +else (LINUX) + set(DL_LIBRARY "") + set(PTHREAD_LIBRARY "") +endif (LINUX) + +if (WINDOWS) + set(WINDOWS_LIBRARIES + ws2_32 + mswsock + psapi + winmm + netapi32 + ) +else (WINDOWS) + set(WINDOWS_LIBRARIES "") +endif (WINDOWS) + +mark_as_advanced(DL_LIBRARY PTHREAD_LIBRARY WINDOWS_LIBRARIES) diff --git a/linden/indra/cmake/MonoDeps.cmake b/linden/indra/cmake/MonoDeps.cmake new file mode 100644 index 0000000..52d5491 --- /dev/null +++ b/linden/indra/cmake/MonoDeps.cmake @@ -0,0 +1,48 @@ +# -*- cmake -*- + +set(MONO_PREBUILT_LIBRARIES_DIR ${LIBS_PREBUILT_DIR}/mono/1.0) + +set(MONO_PREBUILT_LIBRARIES + Iesi.Collections.dll + Iesi.Collections.pdb + Mono.CompilerServices.SymbolWriter.dll + Mono.PEToolkit.dll + Mono.PEToolkit.pdb + Mono.Security.dll + PEAPI.dll + RAIL.dll + RAIL.pdb + ) + + set(MONO_CORE_LIBRARIES + System.dll + System.Xml.dll + mscorlib.dll) + +if(WINDOWS) + set(MONO_DEPENDENCIES + DomainCreator + DomainRegister + LslLibrary + LslUserScript + Script + ScriptTypes + TestFormat + UserScript + UThread + UThreadInjector + ) +else(WINDOWS) + set(MONO_DEPENDENCIES + DomainCreator_POST_BUILD + DomainRegister_POST_BUILD + LslLibrary_POST_BUILD + LslUserScript_POST_BUILD + Script_POST_BUILD + ScriptTypes_POST_BUILD + TestFormat_POST_BUILD + UserScript_POST_BUILD + UThread_POST_BUILD + UThreadInjector_POST_BUILD + ) +endif(WINDOWS) diff --git a/linden/indra/cmake/MonoEmbed.cmake b/linden/indra/cmake/MonoEmbed.cmake new file mode 100644 index 0000000..0f1f233 --- /dev/null +++ b/linden/indra/cmake/MonoEmbed.cmake @@ -0,0 +1,57 @@ +# -*- cmake -*- + +include(Prebuilt) +use_prebuilt_binary(libmono) + +SET(GLIB_2_0 glib-2.0) + +if (WINDOWS) + SET(MONO_LIB mono) +else (WINDOWS) + SET(MONO_LIB mono) + SET(M_LIBRARIES m) + SET(GTHREAD_2_0 gthread-2.0) +endif(WINDOWS) + + +IF (DARWIN) + + FIND_LIBRARY(MONO_LIBRARY NAMES Mono) + # Find_file doesnt work as expected. Hardcode relative to Mono.framework. + #FIND_FILE(GLIB_CONFIG glibconfig.h ${MONO_LIBRARY}) + #FIND_FILE(MONO_GLIB_LIBRARY glib.h ${MONO_LIBRARY}) + SET(MONO_GLIB_LIBRARY ${MONO_LIBRARY}/Headers/glib-2.0/) + SET(GLIB_CONFIG ${MONO_LIBRARY}/Libraries/glib-2.0/include/) + SET(MONO_LIB_DIRECTORY ${MONO_LIBRARY}/Libraries) + + IF (MONO_LIBRARY AND MONO_GLIB_LIBRARY AND GLIB_CONFIG) + MESSAGE(STATUS "Found Mono for embedding") + INCLUDE_DIRECTORIES(${MONO_GLIB_LIBRARY} ${GLIB_CONFIG}) + LINK_DIRECTORIES(${MONO_LIB_DIRECTORY}) + ELSE (MONO_LIBRARY AND MONO_GLIB_LIBRARY AND GLIB_CONFIG) + MESSAGE(FATAL_ERROR "Mono not found for embedding") + MESSAGE(${MONO_LIBRARY}) + MESSAGE(${MONO_GLIB_LIBRARY}) + MESSAGE(${GLIB_CONFIG}) + ENDIF (MONO_LIBRARY AND MONO_GLIB_LIBRARY AND GLIB_CONFIG) + +ELSE (DARWIN) + + SET(MONO_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/include) + SET(GLIB_2_0_PLATFORM_INCLUDE_DIR + ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/include/glib-2.0) + SET(GLIB_2_0_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/include/glib-2.0) + + INCLUDE_DIRECTORIES( + ${MONO_INCLUDE_DIR} + ${GLIB_2_0_PLATFORM_INCLUDE_DIR} + ${GLIB_2_0_INCLUDE_DIR}) + +ENDIF (DARWIN) + +SET(MONO_LIBRARIES + ${MONO_LIB} + ${M_LIBRARIES} + ${GLIB_2_0} + ${GTHREAD_2_0} +) diff --git a/linden/indra/cmake/Mozlib.cmake b/linden/indra/cmake/Mozlib.cmake new file mode 100644 index 0000000..e9555df --- /dev/null +++ b/linden/indra/cmake/Mozlib.cmake @@ -0,0 +1,47 @@ +# -*- cmake -*- +include(Linking) +include(Prebuilt) + +if (STANDALONE) + set(MOZLIB OFF CACHE BOOL + "Enable Mozilla support in the viewer (requires llmozlib library).") +else (STANDALONE) + use_prebuilt_binary(llmozlib) + set(MOZLIB ON CACHE BOOL + "Enable Mozilla support in the viewer (requires llmozlib library).") +endif (STANDALONE) + +if (MOZLIB) + add_definitions(-DLL_LLMOZLIB_ENABLED=1) + + if (LINUX) + link_directories(${CMAKE_SOURCE_DIR}/newview/app_settings/mozilla-runtime-linux-${ARCH}) + set(MOZLIB_LIBRARIES + llmozlib2 + mozjs + nspr4 + plc4 + plds4 + xpcom + xul + profdirserviceprovider_s + ) + elseif (WINDOWS) + if (MSVC71) + set(MOZLIB_LIBRARIES + debug llmozlib2d + optimized llmozlib2) + elseif (MSVC80 OR MSVC90) + set(MOZLIB_LIBRARIES + debug llmozlib2d-vc80 + optimized llmozlib2-vc80) + endif (MSVC71) + else (LINUX) + set(MOZLIB_LIBRARIES + optimized ${ARCH_PREBUILT_DIRS_RELEASE}/libllmozlib2.dylib + debug ${ARCH_PREBUILT_DIRS_DEBUG}/libllmozlib2.dylib + ) + endif (LINUX) +else (MOZLIB) + add_definitions(-DLL_LLMOZLIB_ENABLED=0) +endif (MOZLIB) diff --git a/linden/indra/cmake/MySQL.cmake b/linden/indra/cmake/MySQL.cmake new file mode 100644 index 0000000..97dd091 --- /dev/null +++ b/linden/indra/cmake/MySQL.cmake @@ -0,0 +1,23 @@ +# -*- cmake -*- +include(Linking) +include(Prebuilt) +# We don't prebuild our own MySQL client library. + +use_prebuilt_binary(mysql) + +set(MYSQL_FIND_QUIETLY ON) +set(MYSQL_FIND_REQUIRED ON) + +if (WINDOWS) + set(MYSQL_LIBRARIES mysqlclient) + set(MYSQL_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/include) +elseif (DARWIN) + set(MYSQL_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/include) + set(MYSQL_LIBRARIES + optimized ${LIBS_PREBUILT_DIRS_RELEASE}/libmysqlclient.a + debug ${LIBS_PREBUILT_DIRS_DEBUG}/libmysqlclient.a + ) +else (WINDOWS) + set(MYSQL_FIND_REQUIRED) + include(FindMySQL) +endif (WINDOWS) diff --git a/linden/indra/cmake/NDOF.cmake b/linden/indra/cmake/NDOF.cmake new file mode 100644 index 0000000..3f715a2 --- /dev/null +++ b/linden/indra/cmake/NDOF.cmake @@ -0,0 +1,14 @@ +# -*- cmake -*- +include(Prebuilt) + +use_prebuilt_binary(ndofdev) + +if (WINDOWS OR DARWIN) + add_definitions(-DLIB_NDOF=1) +endif (WINDOWS OR DARWIN) + +if (WINDOWS) + set(NDOF_LIBRARY libndofdev) +elseif (DARWIN) + set(NDOF_LIBRARY ndofdev) +endif (WINDOWS) diff --git a/linden/indra/cmake/OpenGL.cmake b/linden/indra/cmake/OpenGL.cmake new file mode 100644 index 0000000..6a2b681 --- /dev/null +++ b/linden/indra/cmake/OpenGL.cmake @@ -0,0 +1,9 @@ +# -*- cmake -*- +include(Prebuilt) + +if (NOT STANDALONE) + use_prebuilt_binary(GL) + # possible glh_linear should have its own .cmake file instead + use_prebuilt_binary(glh_linear) + set(GLEXT_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/include) +endif (NOT STANDALONE) diff --git a/linden/indra/cmake/OpenJPEG.cmake b/linden/indra/cmake/OpenJPEG.cmake new file mode 100644 index 0000000..fcc82c2 --- /dev/null +++ b/linden/indra/cmake/OpenJPEG.cmake @@ -0,0 +1,22 @@ +# -*- cmake -*- +include(Prebuilt) + +set(OPENJPEG_FIND_QUIETLY ON) +set(OPENJPEG_FIND_REQUIRED ON) + +if (STANDALONE) + include(FindOpenJPEG) +else (STANDALONE) + use_prebuilt_binary(openjpeg) + + if(WINDOWS) + # Windows has differently named release and debug openjpeg(d) libs. + set(OPENJPEG_LIBRARIES + debug openjpegd + optimized openjpeg) + else(WINDOWS) + set(OPENJPEG_LIBRARIES openjpeg) + endif(WINDOWS) + + set(OPENJPEG_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/include/openjpeg) +endif (STANDALONE) diff --git a/linden/indra/cmake/OpenSSL.cmake b/linden/indra/cmake/OpenSSL.cmake new file mode 100644 index 0000000..81584c0 --- /dev/null +++ b/linden/indra/cmake/OpenSSL.cmake @@ -0,0 +1,23 @@ +# -*- cmake -*- +include(Prebuilt) + +set(OpenSSL_FIND_QUIETLY ON) +set(OpenSSL_FIND_REQUIRED ON) + +if (STANDALONE) + include(FindOpenSSL) +else (STANDALONE) + use_prebuilt_binary(openSSL) + if (WINDOWS) + set(OPENSSL_LIBRARIES ssleay32 libeay32) + else (WINDOWS) + set(OPENSSL_LIBRARIES ssl) + endif (WINDOWS) + set(OPENSSL_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/include) +endif (STANDALONE) + +if (LINUX) + set(CRYPTO_LIBRARIES crypto) +elseif (DARWIN) + set(CRYPTO_LIBRARIES llcrypto) +endif (LINUX) diff --git a/linden/indra/cmake/PNG.cmake b/linden/indra/cmake/PNG.cmake new file mode 100644 index 0000000..4d0b7b2 --- /dev/null +++ b/linden/indra/cmake/PNG.cmake @@ -0,0 +1,13 @@ +# -*- cmake -*- +include(Prebuilt) + +set(PNG_FIND_QUIETLY ON) +set(PNG_FIND_REQUIRED ON) + +if (STANDALONE) + include(FindPNG) +else (STANDALONE) + use_prebuilt_binary(libpng) + set(PNG_LIBRARIES png12) + set(PNG_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include) +endif (STANDALONE) diff --git a/linden/indra/cmake/Prebuilt.cmake b/linden/indra/cmake/Prebuilt.cmake new file mode 100644 index 0000000..a915192 --- /dev/null +++ b/linden/indra/cmake/Prebuilt.cmake @@ -0,0 +1,44 @@ +# -*- cmake -*- + +include(Python) +include(FindSCP) + +macro (use_prebuilt_binary _binary) + if (NOT STANDALONE) + if(${CMAKE_BINARY_DIR}/temp/sentinel_installed IS_NEWER_THAN ${CMAKE_BINARY_DIR}/temp/${_binary}_installed) + if(INSTALL_PROPRIETARY) + include(FindSCP) + if(DEBUG_PREBUILT) + message("cd ${SCRIPTS_DIR} && ${PYTHON_EXECUTABLE} install.py --install-dir=${CMAKE_SOURCE_DIR}/.. --scp=${SCP_EXECUTABLE} ${_binary}") + endif(DEBUG_PREBUILT) + execute_process(COMMAND ${PYTHON_EXECUTABLE} + install.py + --install-dir=${CMAKE_SOURCE_DIR}/.. + --scp=${SCP_EXECUTABLE} + ${_binary} + WORKING_DIRECTORY ${SCRIPTS_DIR} + RESULT_VARIABLE ${_binary}_installed + ) + else(INSTALL_PROPRIETARY) + if(DEBUG_PREBUILT) + message("cd ${SCRIPTS_DIR} && ${PYTHON_EXECUTABLE} install.py --install-dir=${CMAKE_SOURCE_DIR}/.. ${_binary}") + endif(DEBUG_PREBUILT) + execute_process(COMMAND ${PYTHON_EXECUTABLE} + install.py + --install-dir=${CMAKE_SOURCE_DIR}/.. + ${_binary} + WORKING_DIRECTORY ${SCRIPTS_DIR} + RESULT_VARIABLE ${_binary}_installed + ) + endif(INSTALL_PROPRIETARY) + file(WRITE ${CMAKE_BINARY_DIR}/temp/${_binary}_installed "${${_binary}_installed}") + else(${CMAKE_BINARY_DIR}/temp/sentinel_installed IS_NEWER_THAN ${CMAKE_BINARY_DIR}/temp/${_binary}_installed) + set(${_binary}_installed 0) + endif(${CMAKE_BINARY_DIR}/temp/sentinel_installed IS_NEWER_THAN ${CMAKE_BINARY_DIR}/temp/${_binary}_installed) + if(NOT ${_binary}_installed EQUAL 0) + message(FATAL_ERROR + "Failed to download or unpack prebuilt '${_binary}'." + " Process returned ${${_binary}_installed}.") + endif (NOT ${_binary}_installed EQUAL 0) + endif (NOT STANDALONE) +endmacro (use_prebuilt_binary _binary) diff --git a/linden/indra/cmake/Python.cmake b/linden/indra/cmake/Python.cmake new file mode 100644 index 0000000..e9505fb --- /dev/null +++ b/linden/indra/cmake/Python.cmake @@ -0,0 +1,49 @@ +# -*- cmake -*- + +set(PYTHONINTERP_FOUND) + +if (WINDOWS) + # On Windows, explicitly avoid Cygwin Python. + + find_program(PYTHON_EXECUTABLE + NAMES python25.exe python23.exe python.exe + NO_DEFAULT_PATH # added so that cmake does not find cygwin python + PATHS + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.5\\InstallPath] + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.4\\InstallPath] + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.3\\InstallPath] + ) +elseif (EXISTS /etc/debian_version) + # On Debian and Ubuntu, avoid Python 2.4 if possible. + + find_program(PYTHON_EXECUTABLE python2.5 python2.3 python PATHS /usr/bin) + + if (PYTHON_EXECUTABLE) + set(PYTHONINTERP_FOUND ON) + endif (PYTHON_EXECUTABLE) +elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + # On MAC OS X be sure to search standard locations first + + string(REPLACE ":" ";" PATH_LIST "$ENV{PATH}") + find_program(PYTHON_EXECUTABLE + NAMES python python25 python24 python23 + NO_DEFAULT_PATH # Avoid searching non-standard locations first + PATHS + /bin + /usr/bin + /usr/local/bin + ${PATH_LIST} + ) + + if (PYTHON_EXECUTABLE) + set(PYTHONINTERP_FOUND ON) + endif (PYTHON_EXECUTABLE) +else (WINDOWS) + include(FindPythonInterp) +endif (WINDOWS) + +if (NOT PYTHON_EXECUTABLE) + message(FATAL_ERROR "No Python interpreter found") +endif (NOT PYTHON_EXECUTABLE) + +mark_as_advanced(PYTHON_EXECUTABLE) diff --git a/linden/indra/cmake/QuickTime.cmake b/linden/indra/cmake/QuickTime.cmake new file mode 100644 index 0000000..b79ac11 --- /dev/null +++ b/linden/indra/cmake/QuickTime.cmake @@ -0,0 +1,33 @@ +# -*- cmake -*- + +if(INSTALL_PROPRIETARY) + include(Prebuilt) + use_prebuilt_binary(quicktime) +endif(INSTALL_PROPRIETARY) + +if (DARWIN) + include(CMakeFindFrameworks) + find_library(QUICKTIME_LIBRARY QuickTime) +elseif (WINDOWS) + set(QUICKTIME_SDK_DIR "C:\\Program Files\\QuickTime SDK" + CACHE PATH "Location of the QuickTime SDK.") + find_library(QUICKTIME_LIBRARY qtmlclient + PATHS + ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/lib/release + "${QUICKTIME_SDK_DIR}\\libraries" + ) + include_directories( + ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/include/quicktime + "${QUICKTIME_SDK_DIR}\\CIncludes" + ) +endif (DARWIN) + +mark_as_advanced(QUICKTIME_LIBRARY) + +if (QUICKTIME_LIBRARY) + set(QUICKTIME ON CACHE BOOL "Build with QuickTime streaming media support.") +endif (QUICKTIME_LIBRARY) + +if (QUICKTIME) + add_definitions(-DLL_QUICKTIME_ENABLED=1) +endif (QUICKTIME) diff --git a/linden/indra/cmake/TemplateCheck.cmake b/linden/indra/cmake/TemplateCheck.cmake new file mode 100644 index 0000000..3b73dc8 --- /dev/null +++ b/linden/indra/cmake/TemplateCheck.cmake @@ -0,0 +1,14 @@ +# -*- cmake -*- + +include(Python) + +macro (check_message_template _target) + add_custom_command( + TARGET ${_target} + PRE_LINK + COMMAND ${PYTHON_EXECUTABLE} + ARGS ${SCRIPTS_DIR}/template_verifier.py + --mode=development --cache_master + COMMENT "Verifying message template" + ) +endmacro (check_message_template) diff --git a/linden/indra/cmake/UI.cmake b/linden/indra/cmake/UI.cmake new file mode 100644 index 0000000..f529f5b --- /dev/null +++ b/linden/indra/cmake/UI.cmake @@ -0,0 +1,64 @@ +# -*- cmake -*- +include(Prebuilt) + +if (STANDALONE) + include(FindPkgConfig) + + if (LINUX) + set(PKGCONFIG_PACKAGES + atk + cairo + gdk-2.0 + gdk-pixbuf-2.0 + glib-2.0 + gmodule-2.0 + gtk+-2.0 + gthread-2.0 + libpng + pango + pangoft2 + pangox + pangoxft + sdl + ) + endif (LINUX) + + foreach(pkg ${PKGCONFIG_PACKAGES}) + pkg_check_modules(${pkg} REQUIRED ${pkg}) + include_directories(${${pkg}_INCLUDE_DIRS}) + link_directories(${${pkg}_LIBRARY_DIRS}) + list(APPEND UI_LIBRARIES ${${pkg}_LIBRARIES}) + add_definitions(${${pkg}_CFLAGS_OTHERS}) + endforeach(pkg) +else (STANDALONE) + use_prebuilt_binary(gtk-atk-pango-glib) + if (LINUX) + set(UI_LIBRARIES + atk-1.0 + gdk-x11-2.0 + gdk_pixbuf-2.0 + Xinerama + glib-2.0 + gmodule-2.0 + gobject-2.0 + gthread-2.0 + gtk-x11-2.0 + pango-1.0 + pangoft2-1.0 + pangox-1.0 + pangoxft-1.0 + ) + endif (LINUX) + + include_directories ( + ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/include + ${LIBS_PREBUILT_DIR}/include + ) + foreach(include ${${LL_ARCH}_INCLUDES}) + include_directories(${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/include/${include}) + endforeach(include) +endif (STANDALONE) + +if (LINUX) + add_definitions(-DLL_GTK=1 -DLL_X11=1) +endif (LINUX) diff --git a/linden/indra/cmake/UnixInstall.cmake b/linden/indra/cmake/UnixInstall.cmake new file mode 100644 index 0000000..139be0a --- /dev/null +++ b/linden/indra/cmake/UnixInstall.cmake @@ -0,0 +1,31 @@ +if (NOT ${viewer_VERSION}) + MESSAGE(FATAL_ERROR "Viewer version not known!") +endif (NOT ${viewer_VERSION}) + +set(INSTALL OFF CACHE BOOL + "Generate install target.") + +if (INSTALL) + set(INSTALL_PREFIX /usr CACHE PATH + "Top-level installation directory.") + + if (EXISTS /lib64) + set(_LIB lib64) + else (EXISTS /lib64) + set(_LIB lib) + endif (EXISTS /lib64) + + set(INSTALL_LIBRARY_DIR ${INSTALL_PREFIX}/${_LIB} CACHE PATH + "Installation directory for read-only shared files.") + + set(INSTALL_SHARE_DIR ${INSTALL_PREFIX}/share CACHE PATH + "Installation directory for read-only shared files.") + + set(APP_BINARY_DIR ${INSTALL_LIBRARY_DIR}/secondlife-${viewer_VERSION} + CACHE PATH + "Installation directory for binaries.") + + set(APP_SHARE_DIR ${INSTALL_SHARE_DIR}/secondlife-${viewer_VERSION} + CACHE PATH + "Installation directory for read-only data files.") +endif (INSTALL) diff --git a/linden/indra/cmake/Variables.cmake b/linden/indra/cmake/Variables.cmake new file mode 100644 index 0000000..5868e4d --- /dev/null +++ b/linden/indra/cmake/Variables.cmake @@ -0,0 +1,100 @@ +# -*- cmake -*- +# +# Definitions of variables used throughout the Second Life build +# process. +# +# Platform variables: +# +# DARWIN - Mac OS X +# LINUX - Linux +# WINDOWS - Windows +# +# What to build: +# +# VIEWER - viewer and other viewer-side components +# SERVER - simulator and other server-side bits + + +# Relative and absolute paths to subtrees. + +set(LIBS_CLOSED_PREFIX) +set(LIBS_OPEN_PREFIX) +set(LIBS_SERVER_PREFIX) +set(SCRIPTS_PREFIX ../scripts) +set(SERVER_PREFIX) +set(VIEWER_PREFIX) + +set(LIBS_CLOSED_DIR ${CMAKE_SOURCE_DIR}/${LIBS_CLOSED_PREFIX}) +set(LIBS_OPEN_DIR ${CMAKE_SOURCE_DIR}/${LIBS_OPEN_PREFIX}) +set(LIBS_SERVER_DIR ${CMAKE_SOURCE_DIR}/${LIBS_SERVER_PREFIX}) +set(SCRIPTS_DIR ${CMAKE_SOURCE_DIR}/${SCRIPTS_PREFIX}) +set(SERVER_DIR ${CMAKE_SOURCE_DIR}/${SERVER_PREFIX}) +set(VIEWER_DIR ${CMAKE_SOURCE_DIR}/${VIEWER_PREFIX}) + +set(LIBS_PREBUILT_DIR ${CMAKE_SOURCE_DIR}/../libraries CACHE PATH + "Location of prebuilt libraries.") + +if (EXISTS ${CMAKE_SOURCE_DIR}/Server.cmake) + # We use this as a marker that you can try to use the proprietary libraries. + set(INSTALL_PROPRIETARY ON CACHE BOOL "Install proprietary binaries") +endif (EXISTS ${CMAKE_SOURCE_DIR}/Server.cmake) + + +if (${CMAKE_SYSTEM_NAME} MATCHES "Windows") + set(WINDOWS ON BOOL FORCE) + set(ARCH i686) + set(LL_ARCH ${ARCH}_win32) + set(LL_ARCH_DIR ${ARCH}-win32) +endif (${CMAKE_SYSTEM_NAME} MATCHES "Windows") + +if (${CMAKE_SYSTEM_NAME} MATCHES "Linux") + set(LINUX ON BOOl FORCE) + execute_process(COMMAND uname -m COMMAND sed s/i.86/i686/ + OUTPUT_VARIABLE ARCH OUTPUT_STRIP_TRAILING_WHITESPACE) + set(LL_ARCH ${ARCH}_linux) + set(LL_ARCH_DIR ${ARCH}-linux) +endif (${CMAKE_SYSTEM_NAME} MATCHES "Linux") + +if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + set(DARWIN 1) + # set this dynamically from the build system now - + # NOTE: wont have a distributable build unless you add this on the configure line with: + # -DCMAKE_OSX_ARCHITECTURES:STRING='i386;ppc' + #set(CMAKE_OSX_ARCHITECTURES i386;ppc) + set(CMAKE_OSX_SYSROOT /Developer/SDKs/MacOSX10.4u.sdk) + if (CMAKE_OSX_ARCHITECTURES MATCHES "i386" AND CMAKE_OSX_ARCHITECTURES MATCHES "ppc") + set(ARCH universal) + else (CMAKE_OSX_ARCHITECTURES MATCHES "i386" AND CMAKE_OSX_ARCHITECTURES MATCHES "ppc") + if (${CMAKE_SYSTEM_PROCESSOR} MATCHES "ppc") + set(ARCH ppc) + else (${CMAKE_SYSTEM_PROCESSOR} MATCHES "ppc") + set(ARCH i386) + endif (${CMAKE_SYSTEM_PROCESSOR} MATCHES "ppc") + endif (CMAKE_OSX_ARCHITECTURES MATCHES "i386" AND CMAKE_OSX_ARCHITECTURES MATCHES "ppc") + set(LL_ARCH ${ARCH}_darwin) + set(LL_ARCH_DIR universal-darwin) +endif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + +# Default deploy grid +set(GRID agni CACHE STRING "Target Grid") + +set(VIEWER ON CACHE BOOL "Build Second Life viewer.") +set(VIEWER_CHANNEL "Developer" CACHE STRING "Viewer Channel Name") +set(VIEWER_LOGIN_CHANNEL ${VIEWER_CHANNEL} CACHE STRING "Fake login channel for A/B Testing") + +set(STANDALONE OFF CACHE BOOL "Do not use Linden-supplied prebuilt libraries.") + +if (NOT STANDALONE AND EXISTS ${CMAKE_SOURCE_DIR}/llphysics) + set(SERVER ON CACHE BOOL "Build Second Life server software.") +endif (NOT STANDALONE AND EXISTS ${CMAKE_SOURCE_DIR}/llphysics) + +if (LINUX AND SERVER AND VIEWER) + MESSAGE(FATAL_ERROR " +The indra source does not currently support building SERVER and VIEWER at the same time. +Please set one of these values to OFF in your CMake cache file. +(either by running ccmake or by editing CMakeCache.txt by hand) +For more information, please see JIRA DEV-14943 - Cmake Linux cannot build both VIEWER and SERVER in one build environment + ") +endif (LINUX AND SERVER AND VIEWER) + +source_group("CMake Rules" FILES CMakeLists.txt) diff --git a/linden/indra/cmake/ViewerMiscLibs.cmake b/linden/indra/cmake/ViewerMiscLibs.cmake new file mode 100644 index 0000000..68ee881 --- /dev/null +++ b/linden/indra/cmake/ViewerMiscLibs.cmake @@ -0,0 +1,10 @@ +# -*- cmake -*- +include(Prebuilt) + +if (NOT STANDALONE) + use_prebuilt_binary(libstdc++) + use_prebuilt_binary(libuuid) + use_prebuilt_binary(vivox) + use_prebuilt_binary(fontconfig) +endif(NOT STANDALONE) + diff --git a/linden/indra/cmake/XmlRpcEpi.cmake b/linden/indra/cmake/XmlRpcEpi.cmake new file mode 100644 index 0000000..107d192 --- /dev/null +++ b/linden/indra/cmake/XmlRpcEpi.cmake @@ -0,0 +1,17 @@ +# -*- cmake -*- +include(Prebuilt) + +set(XMLRPCEPI_FIND_QUIETLY ON) +set(XMLRPCEPI_FIND_REQUIRED ON) + +if (STANDALONE) + include(FindXmlRpcEpi) +else (STANDALONE) + use_prebuilt_binary(xmlrpc-epi) + if (WINDOWS) + set(XMLRPCEPI_LIBRARIES xmlrpcepi) + else (WINDOWS) + set(XMLRPCEPI_LIBRARIES xmlrpc-epi) + endif (WINDOWS) + set(XMLRPCEPI_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include) +endif (STANDALONE) diff --git a/linden/indra/cmake/ZLIB.cmake b/linden/indra/cmake/ZLIB.cmake new file mode 100644 index 0000000..80d4191 --- /dev/null +++ b/linden/indra/cmake/ZLIB.cmake @@ -0,0 +1,20 @@ +# -*- cmake -*- + +set(ZLIB_FIND_QUIETLY ON) +set(ZLIB_FIND_REQUIRED ON) + +include(Prebuilt) + +if (STANDALONE) + include(FindZLIB) +else (STANDALONE) + use_prebuilt_binary(zlib) + if (WINDOWS) + set(ZLIB_LIBRARIES zlib) + else (WINDOWS) + set(ZLIB_LIBRARIES z) + endif (WINDOWS) + if (WINDOWS OR LINUX) + set(ZLIB_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/include/zlib) + endif (WINDOWS OR LINUX) +endif (STANDALONE) diff --git a/linden/indra/copy_win_scripts/CMakeLists.txt b/linden/indra/copy_win_scripts/CMakeLists.txt new file mode 100644 index 0000000..93a8c1d --- /dev/null +++ b/linden/indra/copy_win_scripts/CMakeLists.txt @@ -0,0 +1,35 @@ +# -*- cmake -*- + +# The copy_win_scripts folder contains scripts handy for launching the +# from the windows command line on windows. +# The cmake target created copies the scripts to the +# build directory being used, which where the scripts +# need to be executed from. + +include(CMakeCopyIfDifferent) + +set(win_scripts-src ${CMAKE_SOURCE_DIR}/copy_win_scripts) +set(win_scripts-dst ${CMAKE_BINARY_DIR}/batch) + +set(file-list + llstart.py + start-client.py + start-servers.py + stop-servers.py + user_config.py + ) + +foreach(file ${file-list}) + if(EXISTS ${win_scripts-src}/${file}) + set(win_scripts-files ${win_scripts-files} ${file}) + endif(EXISTS ${win_scripts-src}/${file}) +endforeach(file ${file-list}) + +copy_if_different( + ${win_scripts-src} + ${win_scripts-dst} + win_scripts-targets + ${win_scripts-files} + ) + +add_custom_target(copy_win_scripts ALL DEPENDS ${win_scripts-targets}) diff --git a/linden/indra/copy_win_scripts/start-client.py b/linden/indra/copy_win_scripts/start-client.py new file mode 100644 index 0000000..5f7ff2f --- /dev/null +++ b/linden/indra/copy_win_scripts/start-client.py @@ -0,0 +1,68 @@ +#!/usr/bin/env python +import sys, getopt +import os +import llstart + +def usage(): + print """start-client.py + + --grid + --farm + --region + """ + +def start_client(grid, slurl, build_config, my_args): + login_url = "https://login.%s.lindenlab.com/cgi-bin/login.cgi" % (grid) + + viewer_args = { "--grid" : grid, + "--loginuri" : login_url } + viewer_args.update(my_args) + # *sigh* We must put --url at the end of the argument list. + if viewer_args.has_key("--url"): + slurl = viewer_args["--url"] + del(viewer_args["--url"]) + viewer_args = llstart.get_args_from_dict(viewer_args) + if slurl is not None: + viewer_args += " --url %s" % slurl + + # Figure out path stuff. + # The client should run from indra/newview + # but the exe is at indra/build-/newview/ + build_path = os.path.dirname(os.getcwd()); + f = open("start-client.log", "w") + print >>f, "Viewer startup arguments:" + llstart.start("viewer", "../../newview", + "%s/newview/%s/secondlife-bin.exe" % (build_path, build_config), + viewer_args, f) + f.close() + +if __name__ == "__main__": + grid = llstart.get_config("grid") + + if grid == None: + grid = "aditi" + + build_config = llstart.get_config("build_config") + my_args = llstart.get_config("viewer_args", force_dict = True) + opts, args = getopt.getopt(sys.argv[1:], "u:r:f:g:i:h", + ["region=", "username=", "farm=", "grid=", "ip=", "help"]) + region = None + for o, a in opts: + if o in ("-r", "--region", "-u", "--username"): + region = a + if o in ("-f", "--farm", "-g", "--grid"): + grid = a + if o in ("-h", "--help"): + usage() + sys.exit(0) + + slurl = llstart.get_config("slurl") + if slurl == None: + if region is None: + region = llstart.get_user_name() + slurl = "//%s/128/128/" % (region) + # Ensure the slurl has quotes around it. + if slurl is not None: + slurl = '"%s"' % (slurl.strip('"\'')) + + start_client(grid, slurl, build_config, my_args) diff --git a/linden/indra/develop.py b/linden/indra/develop.py new file mode 100755 index 0000000..8edfccc --- /dev/null +++ b/linden/indra/develop.py @@ -0,0 +1,676 @@ +#!/usr/bin/env python +# +# @file develop.py +# @authors Bryan O'Sullivan, Mark Palange, Aaron Brashears +# @brief Fire and forget script to appropriately configure cmake for SL. +# +# $LicenseInfo:firstyear=2007&license=viewergpl$ +# +# Copyright (c) 2007-2008, Linden Research, Inc. +# +# Second Life Viewer Source Code +# 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://secondlifegrid.net/programs/open_source/licensing/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://secondlifegrid.net/programs/open_source/licensing/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. +# $/LicenseInfo$ + + +import errno +import getopt +import os +import random +import re +import shutil +import socket +import sys +import commands + +class CommandError(Exception): + pass + + +def mkdir(path): + try: + os.mkdir(path) + return path + except OSError, err: + if err.errno != errno.EEXIST or not os.path.isdir(path): + raise + +def quote(opts): + return '"' + '" "'.join([ opt.replace('"', '') for opt in opts ]) + '"' + +class PlatformSetup(object): + generator = None + build_types = {} + for t in ('Debug', 'Release', 'RelWithDebInfo'): + build_types[t.lower()] = t + + build_type = build_types['relwithdebinfo'] + standalone = 'FALSE' + unattended = 'FALSE' + distcc = True + cmake_opts = [] + + def __init__(self): + self.script_dir = os.path.realpath( + os.path.dirname(__import__(__name__).__file__)) + + def os(self): + '''Return the name of the OS.''' + + raise NotImplemented('os') + + def arch(self): + '''Return the CPU architecture.''' + + return None + + def platform(self): + '''Return a stringified two-tuple of the OS name and CPU + architecture.''' + + ret = self.os() + if self.arch(): + ret += '-' + self.arch() + return ret + + def build_dirs(self): + '''Return the top-level directories in which builds occur. + + This can return more than one directory, e.g. if doing a + 32-bit viewer and server build on Linux.''' + + return ['build-' + self.platform()] + + def cmake_commandline(self, src_dir, build_dir, opts, simple): + '''Return the command line to run cmake with.''' + + args = dict( + dir=src_dir, + generator=self.generator, + opts=quote(opts), + standalone=self.standalone, + unattended=self.unattended, + type=self.build_type.upper(), + ) + #if simple: + # return 'cmake %(opts)s %(dir)r' % args + return ('cmake -DCMAKE_BUILD_TYPE:STRING=%(type)s ' + '-DSTANDALONE:BOOL=%(standalone)s ' + '-DUNATTENDED:BOOL=%(unattended)s ' + '-G %(generator)r %(opts)s %(dir)r' % args) + + def run(self, command, name=None): + '''Run a program. If the program fails, raise an exception.''' + ret = os.system(command) + if ret: + if name is None: + name = command.split(None, 1)[0] + if os.WIFEXITED(ret): + event = 'exited' + status = 'status %d' % os.WEXITSTATUS(ret) + elif os.WIFSIGNALED(ret): + event = 'was killed' + status = 'signal %d' % os.WTERMSIG(ret) + else: + event = 'died unexpectedly (!?)' + status = '16-bit status %d' % ret + raise CommandError('the command %r %s with %s' % + (name, event, status)) + + def run_cmake(self, args=[]): + '''Run cmake.''' + + # do a sanity check to make sure we have a generator + if not hasattr(self, 'generator'): + raise "No generator available for '%s'" % (self.__name__,) + cwd = os.getcwd() + created = [] + try: + for d in self.build_dirs(): + simple = True + if mkdir(d): + created.append(d) + simple = False + try: + os.chdir(d) + cmd = self.cmake_commandline(cwd, d, args, simple) + print 'Running %r in %r' % (cmd, d) + self.run(cmd, 'cmake') + finally: + os.chdir(cwd) + except: + # If we created a directory in which to run cmake and + # something went wrong, the directory probably just + # contains garbage, so delete it. + os.chdir(cwd) + for d in created: + print 'Cleaning %r' % d + shutil.rmtree(d) + raise + + def parse_build_opts(self, arguments): + opts, targets = getopt.getopt(arguments, 'o:', ['option=']) + build_opts = [] + for o, a in opts: + if o in ('-o', '--option'): + build_opts.append(a) + return build_opts, targets + + def run_build(self, opts, targets): + '''Build the default targets for this platform.''' + + raise NotImplemented('run_build') + + def cleanup(self): + '''Delete all build directories.''' + + cleaned = 0 + for d in self.build_dirs(): + if os.path.isdir(d): + print 'Cleaning %r' % d + shutil.rmtree(d) + cleaned += 1 + if not cleaned: + print 'Nothing to clean up!' + + def is_internal_tree(self): + '''Indicate whether we are building in an internal source tree.''' + + return os.path.isdir(os.path.join(self.script_dir, 'newsim')) + + +class UnixSetup(PlatformSetup): + '''Generic Unixy build instructions.''' + + def __init__(self): + super(UnixSetup, self).__init__() + self.generator = 'Unix Makefiles' + + def os(self): + return 'unix' + + def arch(self): + cpu = os.uname()[-1] + if cpu.endswith('386'): + cpu = 'i386' + elif cpu.endswith('86'): + cpu = 'i686' + elif cpu in ('athlon',): + cpu = 'i686' + elif cpu == 'Power Macintosh': + cpu = 'ppc' + return cpu + + +class LinuxSetup(UnixSetup): + def __init__(self): + super(LinuxSetup, self).__init__() + + def os(self): + return 'linux' + + def build_dirs(self): + # Only build the server code if (a) we have it and (b) we're + # on 32-bit x86. + if self.arch() == 'i686' and self.is_internal_tree(): + return ['viewer-' + self.platform(), 'server-' + self.platform()] + else: + return ['viewer-' + self.platform()] + + def find_in_path(self, name, defval=None, basename=False): + for p in os.getenv('PATH', '/usr/bin').split(':'): + path = os.path.join(p, name) + if os.access(path, os.X_OK): + return [basename and os.path.basename(path) or path] + if defval: + return [defval] + return [] + + def cmake_commandline(self, src_dir, build_dir, opts, simple): + args = dict( + dir=src_dir, + generator=self.generator, + opts=quote(opts), + standalone=self.standalone, + unattended=self.unattended, + type=self.build_type.upper() + ) + if not self.is_internal_tree(): + args.update({'cxx':'g++', 'server':'FALSE', 'viewer':'TRUE'}) + else: + if self.distcc: + distcc = self.find_in_path('distcc') + baseonly = True + else: + distcc = [] + baseonly = False + if 'server' in build_dir: + gcc33 = distcc + self.find_in_path('g++-3.3', 'g++', baseonly) + args.update({'cxx':' '.join(gcc33), 'server':'TRUE', + 'viewer':'FALSE'}) + else: + gcc41 = distcc + self.find_in_path('g++-4.1', 'g++', baseonly) + args.update({'cxx': ' '.join(gcc41), 'server':'FALSE', + 'viewer':'TRUE'}) + #if simple: + # return (('cmake %(opts)s ' + # '-DSERVER:BOOL=%(server)s ' + # '-DVIEWER:BOOL=%(viewer)s ' + # '%(dir)r') % args) + cmd = (('cmake -DCMAKE_BUILD_TYPE:STRING=%(type)s ' + '-G %(generator)r -DSERVER:BOOL=%(server)s ' + '-DVIEWER:BOOL=%(viewer)s -DSTANDALONE:BOOL=%(standalone)s ' + '-DUNATTENDED:BOOL=%(unattended)s ' + '%(opts)s %(dir)r') + % args) + if 'CXX' not in os.environ: + args.update({'cmd':cmd}) + cmd = ('CXX=%(cxx)r %(cmd)s' % args) + return cmd + + def run_build(self, opts, targets): + job_count = None + + for i in range(len(opts)): + if opts[i].startswith('-j'): + try: + job_count = int(opts[i][2:]) + except ValueError: + try: + job_count = int(opts[i+1]) + except ValueError: + job_count = True + + def get_cpu_count(): + count = 0 + for line in open('/proc/cpuinfo'): + if re.match(r'processor\s*:', line): + count += 1 + return count + + def localhost(): + count = get_cpu_count() + return 'localhost/' + str(count), count + + def get_distcc_hosts(): + try: + hosts = [] + name = os.getenv('DISTCC_DIR', '/etc/distcc') + '/hosts' + for l in open(name): + l = l[l.find('#')+1:].strip() + if l: hosts.append(l) + return hosts + except IOError: + return (os.getenv('DISTCC_HOSTS', '').split() or + [localhost()[0]]) + + def count_distcc_hosts(): + cpus = 0 + hosts = 0 + for host in get_distcc_hosts(): + m = re.match(r'.*/(\d+)', host) + hosts += 1 + cpus += m and int(m.group(1)) or 1 + return hosts, cpus + + def mk_distcc_hosts(): + '''Generate a list of LL-internal machines to build on.''' + loc_entry, cpus = localhost() + hosts = [loc_entry] + dead = [] + stations = [s for s in xrange(36) if s not in dead] + random.shuffle(stations) + hosts += ['station%d.lindenlab.com/2,lzo' % s for s in stations] + cpus += 2 * len(stations) + return ' '.join(hosts), cpus + + if job_count is None: + hosts, job_count = count_distcc_hosts() + if hosts == 1 and socket.gethostname().startswith('station'): + hosts, job_count = mk_distcc_hosts() + os.putenv('DISTCC_HOSTS', hosts) + opts.extend(['-j', str(job_count)]) + + if targets: + targets = ' '.join(targets) + else: + targets = 'all' + + for d in self.build_dirs(): + cmd = 'make -C %r %s %s' % (d, ' '.join(opts), targets) + print 'Running %r' % cmd + self.run(cmd) + + +class DarwinSetup(UnixSetup): + def __init__(self): + super(DarwinSetup, self).__init__() + self.generator = 'Xcode' + + def os(self): + return 'darwin' + + def arch(self): + if self.unattended == 'TRUE': + return 'universal' + else: + return UnixSetup.arch(self) + + def cmake_commandline(self, src_dir, build_dir, opts, simple): + args = dict( + dir=src_dir, + generator=self.generator, + opts=quote(opts), + standalone=self.standalone, + unattended=self.unattended, + universal='', + type=self.build_type.upper() + ) + if self.unattended == 'TRUE': + args['universal'] = '-DCMAKE_OSX_ARCHITECTURES:STRING=\'i386;ppc\'' + #if simple: + # return 'cmake %(opts)s %(dir)r' % args + return ('cmake -G %(generator)r ' + '-DCMAKE_BUILD_TYPE:STRING=%(type)s ' + '-DSTANDALONE:BOOL=%(standalone)s ' + '-DUNATTENDED:BOOL=%(unattended)s ' + '%(universal)s ' + '%(opts)s %(dir)r' % args) + + def run_build(self, opts, targets): + cwd = os.getcwd() + if targets: + targets = ' '.join(['-target ' + repr(t) for t in targets]) + else: + targets = '' + cmd = ('xcodebuild -parallelizeTargets ' + '-configuration %s %s %s' % + (self.build_type, ' '.join(opts), targets)) + for d in self.build_dirs(): + try: + os.chdir(d) + print 'Running %r in %r' % (cmd, d) + self.run(cmd) + finally: + os.chdir(cwd) + + +class WindowsSetup(PlatformSetup): + gens = { + 'vc71' : { + 'gen' : r'Visual Studio 7 .NET 2003', + 'ver' : r'7.1' + }, + 'vc80' : { + 'gen' : r'Visual Studio 8 2005', + 'ver' : r'8.0' + }, + 'vc90' : { + 'gen' : r'Visual Studio 9 2008', + 'ver' : r'9.0' + } + } + gens['vs2003'] = gens['vc71'] + gens['vs2005'] = gens['vc80'] + gens['vs2008'] = gens['vc90'] + + def __init__(self): + super(WindowsSetup, self).__init__() + self._generator = None + self.incredibuild = False + + def _get_generator(self): + if self._generator is None: + for version in 'vc71 vc80 vc90'.split(): + if self.find_visual_studio(version): + self._generator = version + print 'Building with ', self.gens[version]['gen'] + break + else: + print >> sys.stderr, 'Cannot find a Visual Studio installation!' + eys.exit(1) + return self._generator + + def _set_generator(self, gen): + self._generator = gen + + generator = property(_get_generator, _set_generator) + + def os(self): + return 'win32' + + def build_dirs(self): + return ['build-' + self.generator] + + def cmake_commandline(self, src_dir, build_dir, opts, simple): + args = dict( + dir=src_dir, + generator=self.gens[self.generator.lower()]['gen'], + opts=quote(opts), + standalone=self.standalone, + unattended=self.unattended, + ) + #if simple: + # return 'cmake %(opts)s "%(dir)s"' % args + return ('cmake -G "%(generator)s" ' + '-DSTANDALONE:BOOL=%(standalone)s ' + '-DUNATTENDED:BOOL=%(unattended)s ' + '%(opts)s "%(dir)s"' % args) + + def find_visual_studio(self, gen=None): + if gen is None: + gen = self._generator + gen = gen.lower() + try: + import _winreg + key_str = (r'SOFTWARE\Microsoft\VisualStudio\%s\Setup\VS' % + self.gens[gen]['ver']) + value_str = (r'EnvironmentDirectory') + print ('Reading VS environment from HKEY_LOCAL_MACHINE\%s\%s' % + (key_str, value_str)) + print key_str + + reg = _winreg.ConnectRegistry(None, _winreg.HKEY_LOCAL_MACHINE) + key = _winreg.OpenKey(reg, key_str) + value = _winreg.QueryValueEx(key, value_str)[0] + print 'Found: %s' % value + return value + except WindowsError, err: + print >> sys.stderr, "Didn't find ", self.gens[gen]['gen'] + return '' + + def get_build_cmd(self): + if self.incredibuild: + config = self.build_type + if self.gens[self.generator]['ver'] in [ r'8.0', r'9.0' ]: + config = '\"%s|Win32\"' % config + + return "buildconsole Secondlife.sln /build %s" % config + + # devenv.com is CLI friendly, devenv.exe... not so much. + return ('"%sdevenv.com" Secondlife.sln /build %s' % + (self.find_visual_studio(), self.build_type)) + + # this override of run exists because the PlatformSetup version + # uses Unix/Mac only calls. Freakin' os module! + def run(self, command, name=None): + '''Run a program. If the program fails, raise an exception.''' + ret = os.system(command) + if ret: + if name is None: + name = command.split(None, 1)[0] + raise CommandError('the command %r exited with %s' % + (name, ret)) + + def run_cmake(self, args=[]): + '''Override to add the vstool.exe call after running cmake.''' + PlatformSetup.run_cmake(self, args) + if self.unattended == 'FALSE': + for build_dir in self.build_dirs(): + vstool_cmd = os.path.join('tools','vstool','VSTool.exe') \ + + ' --solution ' \ + + os.path.join(build_dir,'SecondLife.sln') \ + + ' --config RelWithDebInfo' \ + + ' --startup secondlife-bin' + print 'Running %r in %r' % (vstool_cmd, os.getcwd()) + self.run(vstool_cmd) + + def run_build(self, opts, targets): + cwd = os.getcwd() + build_cmd = self.get_build_cmd() + + for d in self.build_dirs(): + try: + os.chdir(d) + if targets: + for t in targets: + cmd = '%s /project %s %s' % (build_cmd, t, ' '.join(opts)) + print 'Running %r in %r' % (cmd, d) + self.run(cmd) + else: + cmd = '%s %s' % (build_cmd, ' '.join(opts)) + print 'Running %r in %r' % (cmd, d) + self.run(cmd) + finally: + os.chdir(cwd) + +class CygwinSetup(WindowsSetup): + def __init__(self): + super(CygwinSetup, self).__init__() + self.generator = 'vc71' + + def cmake_commandline(self, src_dir, build_dir, opts, simple): + dos_dir = commands.getoutput("cygpath -w %s" % src_dir) + args = dict( + dir=dos_dir, + generator=self.gens[self.generator.lower()]['gen'], + opts=quote(opts), + standalone=self.standalone, + unattended=self.unattended, + ) + #if simple: + # return 'cmake %(opts)s "%(dir)s"' % args + return ('cmake -G "%(generator)s" ' + '-DUNATTENDED:BOOl=%(unattended)s ' + '-DSTANDALONE:BOOL=%(standalone)s ' + '%(opts)s "%(dir)s"' % args) + +setup_platform = { + 'darwin': DarwinSetup, + 'linux2': LinuxSetup, + 'win32' : WindowsSetup, + 'cygwin' : CygwinSetup + } + + +usage_msg = ''' +Usage: develop.py [options] command [command-options] + +Options: + -h | --help print this help message + --standalone build standalone, without Linden prebuild libraries + --unattended build unattended, do not invoke any tools requiring + a human response + -t | --type=NAME build type ("Debug", "Release", or "RelWithDebInfo") + -N | --no-distcc disable use of distcc + -G | --generator=NAME generator name + Windows: VC71 or VS2003 (default), VC80 (VS2005) or VC90 (VS2008) + Mac OS X: Xcode (default), Unix Makefiles + Linux: Unix Makefiles (default), KDevelop3 +Commands: + build configure and build default target + clean delete all build directories (does not affect sources) + configure configure project by running cmake + +If you do not specify a command, the default is "configure". +''' + +def main(arguments): + setup = setup_platform[sys.platform]() + try: + opts, args = getopt.getopt( + arguments, + '?hNt:G:', + ['help', 'standalone', 'no-distcc', 'unattended', 'type=', 'incredibuild', 'generator=']) + except getopt.GetoptError, err: + print >> sys.stderr, 'Error:', err + sys.exit(1) + + for o, a in opts: + if o in ('-?', '-h', '--help'): + print usage_msg.strip() + sys.exit(0) + elif o in ('--standalone',): + setup.standalone = 'TRUE' + elif o in ('--unattended',): + setup.unattended = 'TRUE' + elif o in ('-t', '--type'): + try: + setup.build_type = setup.build_types[a.lower()] + except KeyError: + print >> sys.stderr, 'Error: unknown build type', repr(a) + print >> sys.stderr, 'Supported build types:' + types = setup.build_types.values() + types.sort() + for t in types: + print ' ', t + sys.exit(1) + elif o in ('-G', '--generator'): + setup.generator = a + elif o in ('-N', '--no-distcc'): + setup.distcc = False + elif o in ('--incredibuild'): + setup.incredibuild = True + else: + print >> sys.stderr, 'INTERNAL ERROR: unhandled option', repr(o) + sys.exit(1) + if not args: + setup.run_cmake() + return + try: + cmd = args.pop(0) + if cmd in ('cmake', 'configure'): + setup.run_cmake(args) + elif cmd == 'build': + for d in setup.build_dirs(): + if not os.path.exists(d): + raise CommandError('run "develop.py cmake" first') + setup.run_cmake() + opts, targets = setup.parse_build_opts(args) + setup.run_build(opts, targets) + elif cmd == 'clean': + if args: + raise CommandError('clean takes no arguments') + setup.cleanup() + else: + print >> sys.stderr, 'Error: unknown subcommand', repr(cmd) + print >> sys.stderr, "(run 'develop.py --help' for help)" + sys.exit(1) + except CommandError, err: + print >> sys.stderr, 'Error:', err + sys.exit(1) + except getopt.GetoptError, err: + print >> sys.stderr, 'Error with %r subcommand: %s' % (cmd, err) + sys.exit(1) + + +if __name__ == '__main__': + main(sys.argv[1:]) diff --git a/linden/indra/indra_complete/indra_complete.sln b/linden/indra/indra_complete/indra_complete.sln deleted file mode 100644 index e990489..0000000 --- a/linden/indra/indra_complete/indra_complete.sln +++ /dev/null @@ -1,573 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 8.00 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "llcommon", "..\llcommon\llcommon.vcproj", "{7BCB4B2C-8378-4186-88EA-5742B5ABE17F}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "llmath", "..\llmath\llmath.vcproj", "{E87FD9BE-BE42-4EA3-BF4D-D992223046D9}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "llmessage", "..\llmessage\llmessage.vcproj", "{E5D94794-5671-4BD6-A16D-26EC18F3DB34}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "llvfs", "..\llvfs\llvfs.vcproj", "{D37774F4-253D-4760-BF64-372A943224A1}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "llxml", "..\llxml\llxml.vcproj", "{A5470DA6-0C3A-4602-B930-43DB25511A59}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "llui", "..\llui\llui.vcproj", "{DE55D666-6A3D-476C-937F-109269B83681}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "llimage", "..\llimage\llimage.vcproj", "{681FDD6C-2FAE-4CB9-AF6D-B952F2B151C5}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "llprimitive", "..\llprimitive\llprimitive.vcproj", "{FCC4483C-5B84-4944-B91F-4589A219BC0B}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "llcharacter", "..\llcharacter\llcharacter.vcproj", "{5EA5DDF0-C7E1-4F49-BEF5-9246A4656B2E}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "llaudio", "..\llaudio\llaudio.vcproj", "{93B2BA29-FBE9-4376-92C1-6108DCFE09D3}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "llrender", "..\llrender\llrender.vcproj", "{2ADE3C14-94C4-40BF-B033-70F3C954EE90}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "llinventory", "..\llinventory\llinventory.vcproj", "{328D1968-924F-4863-AAE8-5F9A95BA68E5}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "newview", "..\newview\newview.vcproj", "{E6F4CF1B-6109-4CA8-B58D-87FA936CDE08}" - ProjectSection(ProjectDependencies) = postProject - {9D0C7E02-6506-4EE7-BC5C-75671D28D594} = {9D0C7E02-6506-4EE7-BC5C-75671D28D594} - {2ADE3C14-94C4-40BF-B033-70F3C954EE90} = {2ADE3C14-94C4-40BF-B033-70F3C954EE90} - {B5B53617-416F-404A-BF10-22EBCCA0E4FB} = {B5B53617-416F-404A-BF10-22EBCCA0E4FB} - {93B2BA29-FBE9-4376-92C1-6108DCFE09D3} = {93B2BA29-FBE9-4376-92C1-6108DCFE09D3} - {7BCB4B2C-8378-4186-88EA-5742B5ABE17F} = {7BCB4B2C-8378-4186-88EA-5742B5ABE17F} - {E928F33B-E090-4FA8-818B-6B5D8B0F1F4B} = {E928F33B-E090-4FA8-818B-6B5D8B0F1F4B} - {FCC4483C-5B84-4944-B91F-4589A219BC0B} = {FCC4483C-5B84-4944-B91F-4589A219BC0B} - {F882263E-4F2A-43D9-A45A-FA4C8EC66552} = {F882263E-4F2A-43D9-A45A-FA4C8EC66552} - {076DD042-2E58-42EA-9401-53210B65C1FC} = {076DD042-2E58-42EA-9401-53210B65C1FC} - {DE55D666-6A3D-476C-937F-109269B83681} = {DE55D666-6A3D-476C-937F-109269B83681} - {328D1968-924F-4863-AAE8-5F9A95BA68E5} = {328D1968-924F-4863-AAE8-5F9A95BA68E5} - {681FDD6C-2FAE-4CB9-AF6D-B952F2B151C5} = {681FDD6C-2FAE-4CB9-AF6D-B952F2B151C5} - {B771CF1B-E253-47BD-8B0A-6B0440CC9228} = {B771CF1B-E253-47BD-8B0A-6B0440CC9228} - {44CE6D82-7320-4609-8FC3-5965C19F4808} = {44CE6D82-7320-4609-8FC3-5965C19F4808} - {E5D94794-5671-4BD6-A16D-26EC18F3DB34} = {E5D94794-5671-4BD6-A16D-26EC18F3DB34} - {A5470DA6-0C3A-4602-B930-43DB25511A59} = {A5470DA6-0C3A-4602-B930-43DB25511A59} - {BFA102B0-C891-4E13-B1CF-C2F28073DA8E} = {BFA102B0-C891-4E13-B1CF-C2F28073DA8E} - {E87FD9BE-BE42-4EA3-BF4D-D992223046D9} = {E87FD9BE-BE42-4EA3-BF4D-D992223046D9} - {4C8D64D5-649F-481E-96BE-EF1E82A77ACB} = {4C8D64D5-649F-481E-96BE-EF1E82A77ACB} - {5EA5DDF0-C7E1-4F49-BEF5-9246A4656B2E} = {5EA5DDF0-C7E1-4F49-BEF5-9246A4656B2E} - {648685F3-8760-4CC5-BB2B-CAF9DECC25A4} = {648685F3-8760-4CC5-BB2B-CAF9DECC25A4} - {D37774F4-253D-4760-BF64-372A943224A1} = {D37774F4-253D-4760-BF64-372A943224A1} - EndProjectSection -EndProject - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "llwindow", "..\llwindow\llwindow.vcproj", "{B5B53617-416F-404A-BF10-22EBCCA0E4FB}" - ProjectSection(ProjectDependencies) = postProject - {A5470DA6-0C3A-4602-B930-43DB25511A59} = {A5470DA6-0C3A-4602-B930-43DB25511A59} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lscript_library", "..\lscript\lscript_library\lscript_library.vcproj", "{BFA102B0-C891-4E13-B1CF-C2F28073DA8E}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lscript_execute", "..\lscript\lscript_execute\lscript_execute.vcproj", "{F882263E-4F2A-43D9-A45A-FA4C8EC66552}" - ProjectSection(ProjectDependencies) = postProject - {BFA102B0-C891-4E13-B1CF-C2F28073DA8E} = {BFA102B0-C891-4E13-B1CF-C2F28073DA8E} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lscript_compile", "..\lscript\lscript_compile\lscript_compile.vcproj", "{44CE6D82-7320-4609-8FC3-5965C19F4808}" - ProjectSection(ProjectDependencies) = postProject - {B771CF1B-E253-47BD-8B0A-6B0440CC9228} = {B771CF1B-E253-47BD-8B0A-6B0440CC9228} - {BFA102B0-C891-4E13-B1CF-C2F28073DA8E} = {BFA102B0-C891-4E13-B1CF-C2F28073DA8E} - EndProjectSection -EndProject - ProjectSection(ProjectDependencies) = postProject - {AF2D801E-EEE7-4B52-A025-F8E648ADC34B} = {AF2D801E-EEE7-4B52-A025-F8E648ADC34B} - {7BCB4B2C-8378-4186-88EA-5742B5ABE17F} = {7BCB4B2C-8378-4186-88EA-5742B5ABE17F} - {FCC4483C-5B84-4944-B91F-4589A219BC0B} = {FCC4483C-5B84-4944-B91F-4589A219BC0B} - {F882263E-4F2A-43D9-A45A-FA4C8EC66552} = {F882263E-4F2A-43D9-A45A-FA4C8EC66552} - {4B19F64E-AB97-4FB9-8E1D-74A8104DE0C4} = {4B19F64E-AB97-4FB9-8E1D-74A8104DE0C4} - {328D1968-924F-4863-AAE8-5F9A95BA68E5} = {328D1968-924F-4863-AAE8-5F9A95BA68E5} - {681FDD6C-2FAE-4CB9-AF6D-B952F2B151C5} = {681FDD6C-2FAE-4CB9-AF6D-B952F2B151C5} - {44CE6D82-7320-4609-8FC3-5965C19F4808} = {44CE6D82-7320-4609-8FC3-5965C19F4808} - {E5D94794-5671-4BD6-A16D-26EC18F3DB34} = {E5D94794-5671-4BD6-A16D-26EC18F3DB34} - {A5470DA6-0C3A-4602-B930-43DB25511A59} = {A5470DA6-0C3A-4602-B930-43DB25511A59} - {BFA102B0-C891-4E13-B1CF-C2F28073DA8E} = {BFA102B0-C891-4E13-B1CF-C2F28073DA8E} - {E87FD9BE-BE42-4EA3-BF4D-D992223046D9} = {E87FD9BE-BE42-4EA3-BF4D-D992223046D9} - {B4B838C7-2C72-428E-BBFD-25764E659A8B} = {B4B838C7-2C72-428E-BBFD-25764E659A8B} - {5EA5DDF0-C7E1-4F49-BEF5-9246A4656B2E} = {5EA5DDF0-C7E1-4F49-BEF5-9246A4656B2E} - {D37774F4-253D-4760-BF64-372A943224A1} = {D37774F4-253D-4760-BF64-372A943224A1} - {020311F7-3DAB-4D93-9CE5-6D3926FD15FE} = {020311F7-3DAB-4D93-9CE5-6D3926FD15FE} - EndProjectSection -EndProject - ProjectSection(ProjectDependencies) = postProject - {7BCB4B2C-8378-4186-88EA-5742B5ABE17F} = {7BCB4B2C-8378-4186-88EA-5742B5ABE17F} - {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 - {7BCB4B2C-8378-4186-88EA-5742B5ABE17F} = {7BCB4B2C-8378-4186-88EA-5742B5ABE17F} - {4B19F64E-AB97-4FB9-8E1D-74A8104DE0C4} = {4B19F64E-AB97-4FB9-8E1D-74A8104DE0C4} - {328D1968-924F-4863-AAE8-5F9A95BA68E5} = {328D1968-924F-4863-AAE8-5F9A95BA68E5} - {E5D94794-5671-4BD6-A16D-26EC18F3DB34} = {E5D94794-5671-4BD6-A16D-26EC18F3DB34} - {A5470DA6-0C3A-4602-B930-43DB25511A59} = {A5470DA6-0C3A-4602-B930-43DB25511A59} - {E87FD9BE-BE42-4EA3-BF4D-D992223046D9} = {E87FD9BE-BE42-4EA3-BF4D-D992223046D9} - {B4B838C7-2C72-428E-BBFD-25764E659A8B} = {B4B838C7-2C72-428E-BBFD-25764E659A8B} - {5EA5DDF0-C7E1-4F49-BEF5-9246A4656B2E} = {5EA5DDF0-C7E1-4F49-BEF5-9246A4656B2E} - {D37774F4-253D-4760-BF64-372A943224A1} = {D37774F4-253D-4760-BF64-372A943224A1} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lscript_compile_fb", "..\lscript\lscript_compile\lscript_compile_fb.vcproj", "{B771CF1B-E253-47BD-8B0A-6B0440CC9228}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject - ProjectSection(ProjectDependencies) = postProject - {7BCB4B2C-8378-4186-88EA-5742B5ABE17F} = {7BCB4B2C-8378-4186-88EA-5742B5ABE17F} - {44CE6D82-7320-4609-8FC3-5965C19F4808} = {44CE6D82-7320-4609-8FC3-5965C19F4808} - {BFA102B0-C891-4E13-B1CF-C2F28073DA8E} = {BFA102B0-C891-4E13-B1CF-C2F28073DA8E} - {E87FD9BE-BE42-4EA3-BF4D-D992223046D9} = {E87FD9BE-BE42-4EA3-BF4D-D992223046D9} - EndProjectSection -EndProject - ProjectSection(ProjectDependencies) = postProject - {7BCB4B2C-8378-4186-88EA-5742B5ABE17F} = {7BCB4B2C-8378-4186-88EA-5742B5ABE17F} - {F882263E-4F2A-43D9-A45A-FA4C8EC66552} = {F882263E-4F2A-43D9-A45A-FA4C8EC66552} - {BFA102B0-C891-4E13-B1CF-C2F28073DA8E} = {BFA102B0-C891-4E13-B1CF-C2F28073DA8E} - {E87FD9BE-BE42-4EA3-BF4D-D992223046D9} = {E87FD9BE-BE42-4EA3-BF4D-D992223046D9} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "win_crash_logger", "..\win_crash_logger\win_crash_logger.vcproj", "{648685F3-8760-4CC5-BB2B-CAF9DECC25A4}" - ProjectSection(ProjectDependencies) = postProject - {B5B53617-416F-404A-BF10-22EBCCA0E4FB} = {B5B53617-416F-404A-BF10-22EBCCA0E4FB} - {7BCB4B2C-8378-4186-88EA-5742B5ABE17F} = {7BCB4B2C-8378-4186-88EA-5742B5ABE17F} - {E5D94794-5671-4BD6-A16D-26EC18F3DB34} = {E5D94794-5671-4BD6-A16D-26EC18F3DB34} - {A5470DA6-0C3A-4602-B930-43DB25511A59} = {A5470DA6-0C3A-4602-B930-43DB25511A59} - {E87FD9BE-BE42-4EA3-BF4D-D992223046D9} = {E87FD9BE-BE42-4EA3-BF4D-D992223046D9} - {D37774F4-253D-4760-BF64-372A943224A1} = {D37774F4-253D-4760-BF64-372A943224A1} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "win_updater", "..\win_updater\win_updater.vcproj", "{E928F33B-E090-4FA8-818B-6B5D8B0F1F4B}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject - ProjectSection(ProjectDependencies) = postProject - {7BCB4B2C-8378-4186-88EA-5742B5ABE17F} = {7BCB4B2C-8378-4186-88EA-5742B5ABE17F} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "llmedia", "..\llmedia\llmedia.vcproj", "{9D0C7E02-6506-4EE7-BC5C-75671D28D594}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test", "..\test\test.vcproj", "{BBAA6588-CA96-4A87-A988-B02270B8D02B}" - ProjectSection(ProjectDependencies) = postProject - {7BCB4B2C-8378-4186-88EA-5742B5ABE17F} = {7BCB4B2C-8378-4186-88EA-5742B5ABE17F} - {FCC4483C-5B84-4944-B91F-4589A219BC0B} = {FCC4483C-5B84-4944-B91F-4589A219BC0B} - {F882263E-4F2A-43D9-A45A-FA4C8EC66552} = {F882263E-4F2A-43D9-A45A-FA4C8EC66552} - {4B19F64E-AB97-4FB9-8E1D-74A8104DE0C4} = {4B19F64E-AB97-4FB9-8E1D-74A8104DE0C4} - {328D1968-924F-4863-AAE8-5F9A95BA68E5} = {328D1968-924F-4863-AAE8-5F9A95BA68E5} - {B771CF1B-E253-47BD-8B0A-6B0440CC9228} = {B771CF1B-E253-47BD-8B0A-6B0440CC9228} - {44CE6D82-7320-4609-8FC3-5965C19F4808} = {44CE6D82-7320-4609-8FC3-5965C19F4808} - {E5D94794-5671-4BD6-A16D-26EC18F3DB34} = {E5D94794-5671-4BD6-A16D-26EC18F3DB34} - {EC2A989E-3F8F-4B8B-9AE6-7C7EA37C84BC} = {EC2A989E-3F8F-4B8B-9AE6-7C7EA37C84BC} - {A5470DA6-0C3A-4602-B930-43DB25511A59} = {A5470DA6-0C3A-4602-B930-43DB25511A59} - {BFA102B0-C891-4E13-B1CF-C2F28073DA8E} = {BFA102B0-C891-4E13-B1CF-C2F28073DA8E} - {777F38BE-2DFE-4051-9AAD-2832ABC474CC} = {777F38BE-2DFE-4051-9AAD-2832ABC474CC} - {E87FD9BE-BE42-4EA3-BF4D-D992223046D9} = {E87FD9BE-BE42-4EA3-BF4D-D992223046D9} - {D37774F4-253D-4760-BF64-372A943224A1} = {D37774F4-253D-4760-BF64-372A943224A1} - {020311F7-3DAB-4D93-9CE5-6D3926FD15FE} = {020311F7-3DAB-4D93-9CE5-6D3926FD15FE} - EndProjectSection -EndProject - ProjectSection(ProjectDependencies) = postProject - {2ADE3C14-94C4-40BF-B033-70F3C954EE90} = {2ADE3C14-94C4-40BF-B033-70F3C954EE90} - {B5B53617-416F-404A-BF10-22EBCCA0E4FB} = {B5B53617-416F-404A-BF10-22EBCCA0E4FB} - {AF2D801E-EEE7-4B52-A025-F8E648ADC34B} = {AF2D801E-EEE7-4B52-A025-F8E648ADC34B} - {7BCB4B2C-8378-4186-88EA-5742B5ABE17F} = {7BCB4B2C-8378-4186-88EA-5742B5ABE17F} - {FCC4483C-5B84-4944-B91F-4589A219BC0B} = {FCC4483C-5B84-4944-B91F-4589A219BC0B} - {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 - {7BCB4B2C-8378-4186-88EA-5742B5ABE17F} = {7BCB4B2C-8378-4186-88EA-5742B5ABE17F} - EndProjectSection -EndProject - ProjectSection(ProjectDependencies) = postProject - {7BCB4B2C-8378-4186-88EA-5742B5ABE17F} = {7BCB4B2C-8378-4186-88EA-5742B5ABE17F} - {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 - {7BCB4B2C-8378-4186-88EA-5742B5ABE17F} = {7BCB4B2C-8378-4186-88EA-5742B5ABE17F} - {681FDD6C-2FAE-4CB9-AF6D-B952F2B151C5} = {681FDD6C-2FAE-4CB9-AF6D-B952F2B151C5} - {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 - {7BCB4B2C-8378-4186-88EA-5742B5ABE17F} = {7BCB4B2C-8378-4186-88EA-5742B5ABE17F} - {681FDD6C-2FAE-4CB9-AF6D-B952F2B151C5} = {681FDD6C-2FAE-4CB9-AF6D-B952F2B151C5} - {E87FD9BE-BE42-4EA3-BF4D-D992223046D9} = {E87FD9BE-BE42-4EA3-BF4D-D992223046D9} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "llimagej2coj", "..\llimagej2coj\llimagej2coj.vcproj", "{4C8D64D5-649F-481E-96BE-EF1E82A77ACB}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Global - GlobalSection(SolutionConfiguration) = preSolution - Debug = Debug - DebugMesaHeadless = DebugMesaHeadless - Release = Release - ReleaseForDownload = ReleaseForDownload - ReleaseNoOpt = ReleaseNoOpt - EndGlobalSection - GlobalSection(ProjectDependencies) = postSolution - EndGlobalSection - GlobalSection(ProjectConfiguration) = postSolution - {7BCB4B2C-8378-4186-88EA-5742B5ABE17F}.Debug.ActiveCfg = Debug|Win32 - {7BCB4B2C-8378-4186-88EA-5742B5ABE17F}.Debug.Build.0 = Debug|Win32 - {7BCB4B2C-8378-4186-88EA-5742B5ABE17F}.DebugMesaHeadless.ActiveCfg = Debug|Win32 - {7BCB4B2C-8378-4186-88EA-5742B5ABE17F}.Release.ActiveCfg = Release|Win32 - {7BCB4B2C-8378-4186-88EA-5742B5ABE17F}.Release.Build.0 = Release|Win32 - {7BCB4B2C-8378-4186-88EA-5742B5ABE17F}.ReleaseForDownload.ActiveCfg = Release|Win32 - {7BCB4B2C-8378-4186-88EA-5742B5ABE17F}.ReleaseForDownload.Build.0 = Release|Win32 - {7BCB4B2C-8378-4186-88EA-5742B5ABE17F}.ReleaseNoOpt.ActiveCfg = ReleaseNoOpt|Win32 - {7BCB4B2C-8378-4186-88EA-5742B5ABE17F}.ReleaseNoOpt.Build.0 = ReleaseNoOpt|Win32 - {E87FD9BE-BE42-4EA3-BF4D-D992223046D9}.Debug.ActiveCfg = Debug|Win32 - {E87FD9BE-BE42-4EA3-BF4D-D992223046D9}.Debug.Build.0 = Debug|Win32 - {E87FD9BE-BE42-4EA3-BF4D-D992223046D9}.DebugMesaHeadless.ActiveCfg = Debug|Win32 - {E87FD9BE-BE42-4EA3-BF4D-D992223046D9}.Release.ActiveCfg = Release|Win32 - {E87FD9BE-BE42-4EA3-BF4D-D992223046D9}.Release.Build.0 = Release|Win32 - {E87FD9BE-BE42-4EA3-BF4D-D992223046D9}.ReleaseForDownload.ActiveCfg = Release|Win32 - {E87FD9BE-BE42-4EA3-BF4D-D992223046D9}.ReleaseForDownload.Build.0 = Release|Win32 - {E87FD9BE-BE42-4EA3-BF4D-D992223046D9}.ReleaseNoOpt.ActiveCfg = ReleaseNoOpt|Win32 - {E87FD9BE-BE42-4EA3-BF4D-D992223046D9}.ReleaseNoOpt.Build.0 = ReleaseNoOpt|Win32 - {E5D94794-5671-4BD6-A16D-26EC18F3DB34}.Debug.ActiveCfg = Debug|Win32 - {E5D94794-5671-4BD6-A16D-26EC18F3DB34}.Debug.Build.0 = Debug|Win32 - {E5D94794-5671-4BD6-A16D-26EC18F3DB34}.DebugMesaHeadless.ActiveCfg = Debug|Win32 - {E5D94794-5671-4BD6-A16D-26EC18F3DB34}.Release.ActiveCfg = Release|Win32 - {E5D94794-5671-4BD6-A16D-26EC18F3DB34}.Release.Build.0 = Release|Win32 - {E5D94794-5671-4BD6-A16D-26EC18F3DB34}.ReleaseForDownload.ActiveCfg = Release|Win32 - {E5D94794-5671-4BD6-A16D-26EC18F3DB34}.ReleaseForDownload.Build.0 = Release|Win32 - {E5D94794-5671-4BD6-A16D-26EC18F3DB34}.ReleaseNoOpt.ActiveCfg = ReleaseNoOpt|Win32 - {E5D94794-5671-4BD6-A16D-26EC18F3DB34}.ReleaseNoOpt.Build.0 = ReleaseNoOpt|Win32 - {D37774F4-253D-4760-BF64-372A943224A1}.Debug.ActiveCfg = Debug|Win32 - {D37774F4-253D-4760-BF64-372A943224A1}.Debug.Build.0 = Debug|Win32 - {D37774F4-253D-4760-BF64-372A943224A1}.DebugMesaHeadless.ActiveCfg = Debug|Win32 - {D37774F4-253D-4760-BF64-372A943224A1}.Release.ActiveCfg = Release|Win32 - {D37774F4-253D-4760-BF64-372A943224A1}.Release.Build.0 = Release|Win32 - {D37774F4-253D-4760-BF64-372A943224A1}.ReleaseForDownload.ActiveCfg = Release|Win32 - {D37774F4-253D-4760-BF64-372A943224A1}.ReleaseForDownload.Build.0 = Release|Win32 - {D37774F4-253D-4760-BF64-372A943224A1}.ReleaseNoOpt.ActiveCfg = ReleaseNoOpt|Win32 - {D37774F4-253D-4760-BF64-372A943224A1}.ReleaseNoOpt.Build.0 = ReleaseNoOpt|Win32 - {A5470DA6-0C3A-4602-B930-43DB25511A59}.Debug.ActiveCfg = Debug|Win32 - {A5470DA6-0C3A-4602-B930-43DB25511A59}.Debug.Build.0 = Debug|Win32 - {A5470DA6-0C3A-4602-B930-43DB25511A59}.DebugMesaHeadless.ActiveCfg = Debug|Win32 - {A5470DA6-0C3A-4602-B930-43DB25511A59}.Release.ActiveCfg = Release|Win32 - {A5470DA6-0C3A-4602-B930-43DB25511A59}.Release.Build.0 = Release|Win32 - {A5470DA6-0C3A-4602-B930-43DB25511A59}.ReleaseForDownload.ActiveCfg = Release|Win32 - {A5470DA6-0C3A-4602-B930-43DB25511A59}.ReleaseForDownload.Build.0 = Release|Win32 - {A5470DA6-0C3A-4602-B930-43DB25511A59}.ReleaseNoOpt.ActiveCfg = ReleaseNoOpt|Win32 - {A5470DA6-0C3A-4602-B930-43DB25511A59}.ReleaseNoOpt.Build.0 = ReleaseNoOpt|Win32 - {DE55D666-6A3D-476C-937F-109269B83681}.Debug.ActiveCfg = Debug|Win32 - {DE55D666-6A3D-476C-937F-109269B83681}.Debug.Build.0 = Debug|Win32 - {DE55D666-6A3D-476C-937F-109269B83681}.DebugMesaHeadless.ActiveCfg = Debug|Win32 - {DE55D666-6A3D-476C-937F-109269B83681}.Release.ActiveCfg = Release|Win32 - {DE55D666-6A3D-476C-937F-109269B83681}.Release.Build.0 = Release|Win32 - {DE55D666-6A3D-476C-937F-109269B83681}.ReleaseForDownload.ActiveCfg = Release|Win32 - {DE55D666-6A3D-476C-937F-109269B83681}.ReleaseForDownload.Build.0 = Release|Win32 - {DE55D666-6A3D-476C-937F-109269B83681}.ReleaseNoOpt.ActiveCfg = ReleaseNoOpt|Win32 - {DE55D666-6A3D-476C-937F-109269B83681}.ReleaseNoOpt.Build.0 = ReleaseNoOpt|Win32 - {681FDD6C-2FAE-4CB9-AF6D-B952F2B151C5}.Debug.ActiveCfg = Debug|Win32 - {681FDD6C-2FAE-4CB9-AF6D-B952F2B151C5}.Debug.Build.0 = Debug|Win32 - {681FDD6C-2FAE-4CB9-AF6D-B952F2B151C5}.DebugMesaHeadless.ActiveCfg = Debug|Win32 - {681FDD6C-2FAE-4CB9-AF6D-B952F2B151C5}.Release.ActiveCfg = Release|Win32 - {681FDD6C-2FAE-4CB9-AF6D-B952F2B151C5}.Release.Build.0 = Release|Win32 - {681FDD6C-2FAE-4CB9-AF6D-B952F2B151C5}.ReleaseForDownload.ActiveCfg = Release|Win32 - {681FDD6C-2FAE-4CB9-AF6D-B952F2B151C5}.ReleaseForDownload.Build.0 = Release|Win32 - {681FDD6C-2FAE-4CB9-AF6D-B952F2B151C5}.ReleaseNoOpt.ActiveCfg = ReleaseNoOpt|Win32 - {681FDD6C-2FAE-4CB9-AF6D-B952F2B151C5}.ReleaseNoOpt.Build.0 = ReleaseNoOpt|Win32 - {FCC4483C-5B84-4944-B91F-4589A219BC0B}.Debug.ActiveCfg = Debug|Win32 - {FCC4483C-5B84-4944-B91F-4589A219BC0B}.Debug.Build.0 = Debug|Win32 - {FCC4483C-5B84-4944-B91F-4589A219BC0B}.DebugMesaHeadless.ActiveCfg = Debug|Win32 - {FCC4483C-5B84-4944-B91F-4589A219BC0B}.Release.ActiveCfg = Release|Win32 - {FCC4483C-5B84-4944-B91F-4589A219BC0B}.Release.Build.0 = Release|Win32 - {FCC4483C-5B84-4944-B91F-4589A219BC0B}.ReleaseForDownload.ActiveCfg = Release|Win32 - {FCC4483C-5B84-4944-B91F-4589A219BC0B}.ReleaseForDownload.Build.0 = Release|Win32 - {FCC4483C-5B84-4944-B91F-4589A219BC0B}.ReleaseNoOpt.ActiveCfg = ReleaseNoOpt|Win32 - {FCC4483C-5B84-4944-B91F-4589A219BC0B}.ReleaseNoOpt.Build.0 = ReleaseNoOpt|Win32 - {5EA5DDF0-C7E1-4F49-BEF5-9246A4656B2E}.Debug.ActiveCfg = Debug|Win32 - {5EA5DDF0-C7E1-4F49-BEF5-9246A4656B2E}.Debug.Build.0 = Debug|Win32 - {5EA5DDF0-C7E1-4F49-BEF5-9246A4656B2E}.DebugMesaHeadless.ActiveCfg = Debug|Win32 - {5EA5DDF0-C7E1-4F49-BEF5-9246A4656B2E}.Release.ActiveCfg = Release|Win32 - {5EA5DDF0-C7E1-4F49-BEF5-9246A4656B2E}.Release.Build.0 = Release|Win32 - {5EA5DDF0-C7E1-4F49-BEF5-9246A4656B2E}.ReleaseForDownload.ActiveCfg = Release|Win32 - {5EA5DDF0-C7E1-4F49-BEF5-9246A4656B2E}.ReleaseForDownload.Build.0 = Release|Win32 - {5EA5DDF0-C7E1-4F49-BEF5-9246A4656B2E}.ReleaseNoOpt.ActiveCfg = ReleaseNoOpt|Win32 - {5EA5DDF0-C7E1-4F49-BEF5-9246A4656B2E}.ReleaseNoOpt.Build.0 = ReleaseNoOpt|Win32 - {93B2BA29-FBE9-4376-92C1-6108DCFE09D3}.Debug.ActiveCfg = Debug|Win32 - {93B2BA29-FBE9-4376-92C1-6108DCFE09D3}.Debug.Build.0 = Debug|Win32 - {93B2BA29-FBE9-4376-92C1-6108DCFE09D3}.DebugMesaHeadless.ActiveCfg = Debug|Win32 - {93B2BA29-FBE9-4376-92C1-6108DCFE09D3}.Release.ActiveCfg = Release|Win32 - {93B2BA29-FBE9-4376-92C1-6108DCFE09D3}.Release.Build.0 = Release|Win32 - {93B2BA29-FBE9-4376-92C1-6108DCFE09D3}.ReleaseForDownload.ActiveCfg = Release|Win32 - {93B2BA29-FBE9-4376-92C1-6108DCFE09D3}.ReleaseForDownload.Build.0 = Release|Win32 - {93B2BA29-FBE9-4376-92C1-6108DCFE09D3}.ReleaseNoOpt.ActiveCfg = ReleaseNoOpt|Win32 - {93B2BA29-FBE9-4376-92C1-6108DCFE09D3}.ReleaseNoOpt.Build.0 = ReleaseNoOpt|Win32 - {2ADE3C14-94C4-40BF-B033-70F3C954EE90}.Debug.ActiveCfg = Debug|Win32 - {2ADE3C14-94C4-40BF-B033-70F3C954EE90}.Debug.Build.0 = Debug|Win32 - {2ADE3C14-94C4-40BF-B033-70F3C954EE90}.DebugMesaHeadless.ActiveCfg = Debug|Win32 - {2ADE3C14-94C4-40BF-B033-70F3C954EE90}.Release.ActiveCfg = Release|Win32 - {2ADE3C14-94C4-40BF-B033-70F3C954EE90}.Release.Build.0 = Release|Win32 - {2ADE3C14-94C4-40BF-B033-70F3C954EE90}.ReleaseForDownload.ActiveCfg = Release|Win32 - {2ADE3C14-94C4-40BF-B033-70F3C954EE90}.ReleaseForDownload.Build.0 = Release|Win32 - {2ADE3C14-94C4-40BF-B033-70F3C954EE90}.ReleaseNoOpt.ActiveCfg = ReleaseNoOpt|Win32 - {2ADE3C14-94C4-40BF-B033-70F3C954EE90}.ReleaseNoOpt.Build.0 = ReleaseNoOpt|Win32 - {328D1968-924F-4863-AAE8-5F9A95BA68E5}.Debug.ActiveCfg = Debug|Win32 - {328D1968-924F-4863-AAE8-5F9A95BA68E5}.Debug.Build.0 = Debug|Win32 - {328D1968-924F-4863-AAE8-5F9A95BA68E5}.DebugMesaHeadless.ActiveCfg = Debug|Win32 - {328D1968-924F-4863-AAE8-5F9A95BA68E5}.Release.ActiveCfg = Release|Win32 - {328D1968-924F-4863-AAE8-5F9A95BA68E5}.Release.Build.0 = Release|Win32 - {328D1968-924F-4863-AAE8-5F9A95BA68E5}.ReleaseForDownload.ActiveCfg = Release|Win32 - {328D1968-924F-4863-AAE8-5F9A95BA68E5}.ReleaseForDownload.Build.0 = Release|Win32 - {328D1968-924F-4863-AAE8-5F9A95BA68E5}.ReleaseNoOpt.ActiveCfg = ReleaseNoOpt|Win32 - {328D1968-924F-4863-AAE8-5F9A95BA68E5}.ReleaseNoOpt.Build.0 = ReleaseNoOpt|Win32 - {E6F4CF1B-6109-4CA8-B58D-87FA936CDE08}.Debug.ActiveCfg = Debug|Win32 - {E6F4CF1B-6109-4CA8-B58D-87FA936CDE08}.Debug.Build.0 = Debug|Win32 - {E6F4CF1B-6109-4CA8-B58D-87FA936CDE08}.DebugMesaHeadless.ActiveCfg = Debug|Win32 - {E6F4CF1B-6109-4CA8-B58D-87FA936CDE08}.Release.ActiveCfg = Release|Win32 - {E6F4CF1B-6109-4CA8-B58D-87FA936CDE08}.Release.Build.0 = Release|Win32 - {E6F4CF1B-6109-4CA8-B58D-87FA936CDE08}.ReleaseForDownload.ActiveCfg = ReleaseForDownload|Win32 - {E6F4CF1B-6109-4CA8-B58D-87FA936CDE08}.ReleaseForDownload.Build.0 = ReleaseForDownload|Win32 - {E6F4CF1B-6109-4CA8-B58D-87FA936CDE08}.ReleaseNoOpt.ActiveCfg = ReleaseNoOpt|Win32 - {E6F4CF1B-6109-4CA8-B58D-87FA936CDE08}.ReleaseNoOpt.Build.0 = ReleaseNoOpt|Win32 - {B4B838C7-2C72-428E-BBFD-25764E659A8B}.Debug.ActiveCfg = Debug|Win32 - {B4B838C7-2C72-428E-BBFD-25764E659A8B}.Debug.Build.0 = Debug|Win32 - {B4B838C7-2C72-428E-BBFD-25764E659A8B}.DebugMesaHeadless.ActiveCfg = Debug|Win32 - {B4B838C7-2C72-428E-BBFD-25764E659A8B}.Release.ActiveCfg = Release|Win32 - {B4B838C7-2C72-428E-BBFD-25764E659A8B}.Release.Build.0 = Release|Win32 - {B4B838C7-2C72-428E-BBFD-25764E659A8B}.ReleaseForDownload.ActiveCfg = Release|Win32 - {B4B838C7-2C72-428E-BBFD-25764E659A8B}.ReleaseForDownload.Build.0 = Release|Win32 - {B4B838C7-2C72-428E-BBFD-25764E659A8B}.ReleaseNoOpt.ActiveCfg = ReleaseNoOpt|Win32 - {B4B838C7-2C72-428E-BBFD-25764E659A8B}.ReleaseNoOpt.Build.0 = ReleaseNoOpt|Win32 - {B5B53617-416F-404A-BF10-22EBCCA0E4FB}.Debug.ActiveCfg = Debug|Win32 - {B5B53617-416F-404A-BF10-22EBCCA0E4FB}.Debug.Build.0 = Debug|Win32 - {B5B53617-416F-404A-BF10-22EBCCA0E4FB}.DebugMesaHeadless.ActiveCfg = DebugMesaHeadless|Win32 - {B5B53617-416F-404A-BF10-22EBCCA0E4FB}.Release.ActiveCfg = Release|Win32 - {B5B53617-416F-404A-BF10-22EBCCA0E4FB}.Release.Build.0 = Release|Win32 - {B5B53617-416F-404A-BF10-22EBCCA0E4FB}.ReleaseForDownload.ActiveCfg = Release|Win32 - {B5B53617-416F-404A-BF10-22EBCCA0E4FB}.ReleaseForDownload.Build.0 = Release|Win32 - {B5B53617-416F-404A-BF10-22EBCCA0E4FB}.ReleaseNoOpt.ActiveCfg = ReleaseNoOpt|Win32 - {B5B53617-416F-404A-BF10-22EBCCA0E4FB}.ReleaseNoOpt.Build.0 = ReleaseNoOpt|Win32 - {BFA102B0-C891-4E13-B1CF-C2F28073DA8E}.Debug.ActiveCfg = Debug|Win32 - {BFA102B0-C891-4E13-B1CF-C2F28073DA8E}.Debug.Build.0 = Debug|Win32 - {BFA102B0-C891-4E13-B1CF-C2F28073DA8E}.DebugMesaHeadless.ActiveCfg = Debug|Win32 - {BFA102B0-C891-4E13-B1CF-C2F28073DA8E}.Release.ActiveCfg = Release|Win32 - {BFA102B0-C891-4E13-B1CF-C2F28073DA8E}.Release.Build.0 = Release|Win32 - {BFA102B0-C891-4E13-B1CF-C2F28073DA8E}.ReleaseForDownload.ActiveCfg = Release|Win32 - {BFA102B0-C891-4E13-B1CF-C2F28073DA8E}.ReleaseForDownload.Build.0 = Release|Win32 - {BFA102B0-C891-4E13-B1CF-C2F28073DA8E}.ReleaseNoOpt.ActiveCfg = ReleaseNoOpt|Win32 - {BFA102B0-C891-4E13-B1CF-C2F28073DA8E}.ReleaseNoOpt.Build.0 = ReleaseNoOpt|Win32 - {F882263E-4F2A-43D9-A45A-FA4C8EC66552}.Debug.ActiveCfg = Debug|Win32 - {F882263E-4F2A-43D9-A45A-FA4C8EC66552}.Debug.Build.0 = Debug|Win32 - {F882263E-4F2A-43D9-A45A-FA4C8EC66552}.DebugMesaHeadless.ActiveCfg = Debug|Win32 - {F882263E-4F2A-43D9-A45A-FA4C8EC66552}.Release.ActiveCfg = Release|Win32 - {F882263E-4F2A-43D9-A45A-FA4C8EC66552}.Release.Build.0 = Release|Win32 - {F882263E-4F2A-43D9-A45A-FA4C8EC66552}.ReleaseForDownload.ActiveCfg = Release|Win32 - {F882263E-4F2A-43D9-A45A-FA4C8EC66552}.ReleaseForDownload.Build.0 = Release|Win32 - {F882263E-4F2A-43D9-A45A-FA4C8EC66552}.ReleaseNoOpt.ActiveCfg = ReleaseNoOpt|Win32 - {F882263E-4F2A-43D9-A45A-FA4C8EC66552}.ReleaseNoOpt.Build.0 = ReleaseNoOpt|Win32 - {44CE6D82-7320-4609-8FC3-5965C19F4808}.Debug.ActiveCfg = Debug|Win32 - {44CE6D82-7320-4609-8FC3-5965C19F4808}.Debug.Build.0 = Debug|Win32 - {44CE6D82-7320-4609-8FC3-5965C19F4808}.DebugMesaHeadless.ActiveCfg = Debug|Win32 - {44CE6D82-7320-4609-8FC3-5965C19F4808}.Release.ActiveCfg = Release|Win32 - {44CE6D82-7320-4609-8FC3-5965C19F4808}.Release.Build.0 = Release|Win32 - {44CE6D82-7320-4609-8FC3-5965C19F4808}.ReleaseForDownload.ActiveCfg = Release|Win32 - {44CE6D82-7320-4609-8FC3-5965C19F4808}.ReleaseForDownload.Build.0 = Release|Win32 - {44CE6D82-7320-4609-8FC3-5965C19F4808}.ReleaseNoOpt.ActiveCfg = ReleaseNoOpt|Win32 - {44CE6D82-7320-4609-8FC3-5965C19F4808}.ReleaseNoOpt.Build.0 = ReleaseNoOpt|Win32 - {D0FDC1C3-A589-40F2-ABCA-A84FF3835624}.Debug.ActiveCfg = Debug|Win32 - {D0FDC1C3-A589-40F2-ABCA-A84FF3835624}.Debug.Build.0 = Debug|Win32 - {D0FDC1C3-A589-40F2-ABCA-A84FF3835624}.DebugMesaHeadless.ActiveCfg = Debug|Win32 - {D0FDC1C3-A589-40F2-ABCA-A84FF3835624}.Release.ActiveCfg = Release|Win32 - {D0FDC1C3-A589-40F2-ABCA-A84FF3835624}.Release.Build.0 = Release|Win32 - {D0FDC1C3-A589-40F2-ABCA-A84FF3835624}.ReleaseForDownload.ActiveCfg = Release|Win32 - {D0FDC1C3-A589-40F2-ABCA-A84FF3835624}.ReleaseForDownload.Build.0 = Release|Win32 - {D0FDC1C3-A589-40F2-ABCA-A84FF3835624}.ReleaseNoOpt.ActiveCfg = ReleaseNoOpt|Win32 - {D0FDC1C3-A589-40F2-ABCA-A84FF3835624}.ReleaseNoOpt.Build.0 = ReleaseNoOpt|Win32 - {C6CA76F5-DCB4-4789-BBA7-43D11EE7C8E2}.Debug.ActiveCfg = Debug|Win32 - {C6CA76F5-DCB4-4789-BBA7-43D11EE7C8E2}.Debug.Build.0 = Debug|Win32 - {C6CA76F5-DCB4-4789-BBA7-43D11EE7C8E2}.DebugMesaHeadless.ActiveCfg = Debug|Win32 - {C6CA76F5-DCB4-4789-BBA7-43D11EE7C8E2}.Release.ActiveCfg = Release|Win32 - {C6CA76F5-DCB4-4789-BBA7-43D11EE7C8E2}.Release.Build.0 = Release|Win32 - {C6CA76F5-DCB4-4789-BBA7-43D11EE7C8E2}.ReleaseForDownload.ActiveCfg = Release|Win32 - {C6CA76F5-DCB4-4789-BBA7-43D11EE7C8E2}.ReleaseForDownload.Build.0 = Release|Win32 - {C6CA76F5-DCB4-4789-BBA7-43D11EE7C8E2}.ReleaseNoOpt.ActiveCfg = ReleaseNoOpt|Win32 - {C6CA76F5-DCB4-4789-BBA7-43D11EE7C8E2}.ReleaseNoOpt.Build.0 = ReleaseNoOpt|Win32 - {A5504A1E-8BA4-45D2-8144-1B6937E37E98}.Debug.ActiveCfg = Debug|Win32 - {A5504A1E-8BA4-45D2-8144-1B6937E37E98}.Debug.Build.0 = Debug|Win32 - {A5504A1E-8BA4-45D2-8144-1B6937E37E98}.DebugMesaHeadless.ActiveCfg = Debug|Win32 - {A5504A1E-8BA4-45D2-8144-1B6937E37E98}.Release.ActiveCfg = Release|Win32 - {A5504A1E-8BA4-45D2-8144-1B6937E37E98}.Release.Build.0 = Release|Win32 - {A5504A1E-8BA4-45D2-8144-1B6937E37E98}.ReleaseForDownload.ActiveCfg = Release|Win32 - {A5504A1E-8BA4-45D2-8144-1B6937E37E98}.ReleaseForDownload.Build.0 = Release|Win32 - {A5504A1E-8BA4-45D2-8144-1B6937E37E98}.ReleaseNoOpt.ActiveCfg = ReleaseNoOpt|Win32 - {A5504A1E-8BA4-45D2-8144-1B6937E37E98}.ReleaseNoOpt.Build.0 = ReleaseNoOpt|Win32 - {B771CF1B-E253-47BD-8B0A-6B0440CC9228}.Debug.ActiveCfg = Debug|Win32 - {B771CF1B-E253-47BD-8B0A-6B0440CC9228}.Debug.Build.0 = Debug|Win32 - {B771CF1B-E253-47BD-8B0A-6B0440CC9228}.DebugMesaHeadless.ActiveCfg = Debug|Win32 - {B771CF1B-E253-47BD-8B0A-6B0440CC9228}.Release.ActiveCfg = Release|Win32 - {B771CF1B-E253-47BD-8B0A-6B0440CC9228}.Release.Build.0 = Release|Win32 - {B771CF1B-E253-47BD-8B0A-6B0440CC9228}.ReleaseForDownload.ActiveCfg = Release|Win32 - {B771CF1B-E253-47BD-8B0A-6B0440CC9228}.ReleaseForDownload.Build.0 = Release|Win32 - {B771CF1B-E253-47BD-8B0A-6B0440CC9228}.ReleaseNoOpt.ActiveCfg = Release|Win32 - {B771CF1B-E253-47BD-8B0A-6B0440CC9228}.ReleaseNoOpt.Build.0 = Release|Win32 - {777F38BE-2DFE-4051-9AAD-2832ABC474CC}.Debug.ActiveCfg = Debug|Win32 - {777F38BE-2DFE-4051-9AAD-2832ABC474CC}.Debug.Build.0 = Debug|Win32 - {777F38BE-2DFE-4051-9AAD-2832ABC474CC}.DebugMesaHeadless.ActiveCfg = Debug|Win32 - {777F38BE-2DFE-4051-9AAD-2832ABC474CC}.Release.ActiveCfg = Release|Win32 - {777F38BE-2DFE-4051-9AAD-2832ABC474CC}.Release.Build.0 = Release|Win32 - {777F38BE-2DFE-4051-9AAD-2832ABC474CC}.ReleaseForDownload.ActiveCfg = Release|Win32 - {777F38BE-2DFE-4051-9AAD-2832ABC474CC}.ReleaseNoOpt.ActiveCfg = Release|Win32 - {EC2A989E-3F8F-4B8B-9AE6-7C7EA37C84BC}.Debug.ActiveCfg = Debug|Win32 - {EC2A989E-3F8F-4B8B-9AE6-7C7EA37C84BC}.Debug.Build.0 = Debug|Win32 - {EC2A989E-3F8F-4B8B-9AE6-7C7EA37C84BC}.DebugMesaHeadless.ActiveCfg = Debug|Win32 - {EC2A989E-3F8F-4B8B-9AE6-7C7EA37C84BC}.Release.ActiveCfg = Release|Win32 - {EC2A989E-3F8F-4B8B-9AE6-7C7EA37C84BC}.Release.Build.0 = Release|Win32 - {EC2A989E-3F8F-4B8B-9AE6-7C7EA37C84BC}.ReleaseForDownload.ActiveCfg = Release|Win32 - {EC2A989E-3F8F-4B8B-9AE6-7C7EA37C84BC}.ReleaseNoOpt.ActiveCfg = Release|Win32 - {648685F3-8760-4CC5-BB2B-CAF9DECC25A4}.Debug.ActiveCfg = Debug|Win32 - {648685F3-8760-4CC5-BB2B-CAF9DECC25A4}.Debug.Build.0 = Debug|Win32 - {648685F3-8760-4CC5-BB2B-CAF9DECC25A4}.DebugMesaHeadless.ActiveCfg = Debug|Win32 - {648685F3-8760-4CC5-BB2B-CAF9DECC25A4}.Release.ActiveCfg = Release|Win32 - {648685F3-8760-4CC5-BB2B-CAF9DECC25A4}.Release.Build.0 = Release|Win32 - {648685F3-8760-4CC5-BB2B-CAF9DECC25A4}.ReleaseForDownload.ActiveCfg = Release|Win32 - {648685F3-8760-4CC5-BB2B-CAF9DECC25A4}.ReleaseForDownload.Build.0 = Release|Win32 - {648685F3-8760-4CC5-BB2B-CAF9DECC25A4}.ReleaseNoOpt.ActiveCfg = ReleaseNoOpt|Win32 - {648685F3-8760-4CC5-BB2B-CAF9DECC25A4}.ReleaseNoOpt.Build.0 = ReleaseNoOpt|Win32 - {E928F33B-E090-4FA8-818B-6B5D8B0F1F4B}.Debug.ActiveCfg = Debug|Win32 - {E928F33B-E090-4FA8-818B-6B5D8B0F1F4B}.Debug.Build.0 = Debug|Win32 - {E928F33B-E090-4FA8-818B-6B5D8B0F1F4B}.DebugMesaHeadless.ActiveCfg = Debug|Win32 - {E928F33B-E090-4FA8-818B-6B5D8B0F1F4B}.Release.ActiveCfg = Release|Win32 - {E928F33B-E090-4FA8-818B-6B5D8B0F1F4B}.Release.Build.0 = Release|Win32 - {E928F33B-E090-4FA8-818B-6B5D8B0F1F4B}.ReleaseForDownload.ActiveCfg = Release|Win32 - {E928F33B-E090-4FA8-818B-6B5D8B0F1F4B}.ReleaseForDownload.Build.0 = Release|Win32 - {E928F33B-E090-4FA8-818B-6B5D8B0F1F4B}.ReleaseNoOpt.ActiveCfg = ReleaseNoOpt|Win32 - {E928F33B-E090-4FA8-818B-6B5D8B0F1F4B}.ReleaseNoOpt.Build.0 = ReleaseNoOpt|Win32 - {F56CA265-93E9-4068-8A67-8B104C876D70}.Debug.ActiveCfg = Debug|Win32 - {F56CA265-93E9-4068-8A67-8B104C876D70}.DebugMesaHeadless.ActiveCfg = Debug|Win32 - {F56CA265-93E9-4068-8A67-8B104C876D70}.Release.ActiveCfg = Release|Win32 - {F56CA265-93E9-4068-8A67-8B104C876D70}.ReleaseForDownload.ActiveCfg = Release|Win32 - {F56CA265-93E9-4068-8A67-8B104C876D70}.ReleaseNoOpt.ActiveCfg = ReleaseNoOpt|Win32 - {9D0C7E02-6506-4EE7-BC5C-75671D28D594}.Debug.ActiveCfg = Debug|Win32 - {9D0C7E02-6506-4EE7-BC5C-75671D28D594}.Debug.Build.0 = Debug|Win32 - {9D0C7E02-6506-4EE7-BC5C-75671D28D594}.DebugMesaHeadless.ActiveCfg = Debug|Win32 - {9D0C7E02-6506-4EE7-BC5C-75671D28D594}.Release.ActiveCfg = Release|Win32 - {9D0C7E02-6506-4EE7-BC5C-75671D28D594}.Release.Build.0 = Release|Win32 - {9D0C7E02-6506-4EE7-BC5C-75671D28D594}.ReleaseForDownload.ActiveCfg = Release|Win32 - {9D0C7E02-6506-4EE7-BC5C-75671D28D594}.ReleaseForDownload.Build.0 = Release|Win32 - {9D0C7E02-6506-4EE7-BC5C-75671D28D594}.ReleaseNoOpt.ActiveCfg = ReleaseNoOpt|Win32 - {9D0C7E02-6506-4EE7-BC5C-75671D28D594}.ReleaseNoOpt.Build.0 = ReleaseNoOpt|Win32 - {4B19F64E-AB97-4FB9-8E1D-74A8104DE0C4}.Debug.ActiveCfg = Debug|Win32 - {4B19F64E-AB97-4FB9-8E1D-74A8104DE0C4}.Debug.Build.0 = Debug|Win32 - {4B19F64E-AB97-4FB9-8E1D-74A8104DE0C4}.DebugMesaHeadless.ActiveCfg = Debug|Win32 - {4B19F64E-AB97-4FB9-8E1D-74A8104DE0C4}.Release.ActiveCfg = Release|Win32 - {4B19F64E-AB97-4FB9-8E1D-74A8104DE0C4}.Release.Build.0 = Release|Win32 - {4B19F64E-AB97-4FB9-8E1D-74A8104DE0C4}.ReleaseForDownload.ActiveCfg = Release|Win32 - {4B19F64E-AB97-4FB9-8E1D-74A8104DE0C4}.ReleaseForDownload.Build.0 = Release|Win32 - {4B19F64E-AB97-4FB9-8E1D-74A8104DE0C4}.ReleaseNoOpt.ActiveCfg = ReleaseNoOpt|Win32 - {4B19F64E-AB97-4FB9-8E1D-74A8104DE0C4}.ReleaseNoOpt.Build.0 = ReleaseNoOpt|Win32 - {BBAA6588-CA96-4A87-A988-B02270B8D02B}.Debug.ActiveCfg = Debug|Win32 - {BBAA6588-CA96-4A87-A988-B02270B8D02B}.Debug.Build.0 = Debug|Win32 - {BBAA6588-CA96-4A87-A988-B02270B8D02B}.DebugMesaHeadless.ActiveCfg = Debug|Win32 - {BBAA6588-CA96-4A87-A988-B02270B8D02B}.Release.ActiveCfg = Release|Win32 - {BBAA6588-CA96-4A87-A988-B02270B8D02B}.Release.Build.0 = Release|Win32 - {BBAA6588-CA96-4A87-A988-B02270B8D02B}.ReleaseForDownload.ActiveCfg = Release|Win32 - {BBAA6588-CA96-4A87-A988-B02270B8D02B}.ReleaseNoOpt.ActiveCfg = ReleaseNoOpt|Win32 - {BBAA6588-CA96-4A87-A988-B02270B8D02B}.ReleaseNoOpt.Build.0 = ReleaseNoOpt|Win32 - {E9F5BD55-F8E8-4C61-B9B5-CCE7C1048241}.Debug.ActiveCfg = Debug|Win32 - {E9F5BD55-F8E8-4C61-B9B5-CCE7C1048241}.Debug.Build.0 = Debug|Win32 - {E9F5BD55-F8E8-4C61-B9B5-CCE7C1048241}.DebugMesaHeadless.ActiveCfg = Debug|Win32 - {E9F5BD55-F8E8-4C61-B9B5-CCE7C1048241}.Release.ActiveCfg = Release|Win32 - {E9F5BD55-F8E8-4C61-B9B5-CCE7C1048241}.Release.Build.0 = Release|Win32 - {E9F5BD55-F8E8-4C61-B9B5-CCE7C1048241}.ReleaseForDownload.ActiveCfg = Release|Win32 - {E9F5BD55-F8E8-4C61-B9B5-CCE7C1048241}.ReleaseForDownload.Build.0 = Release|Win32 - {E9F5BD55-F8E8-4C61-B9B5-CCE7C1048241}.ReleaseNoOpt.ActiveCfg = ReleaseNoOpt|Win32 - {E9F5BD55-F8E8-4C61-B9B5-CCE7C1048241}.ReleaseNoOpt.Build.0 = ReleaseNoOpt|Win32 - {020311F7-3DAB-4D93-9CE5-6D3926FD15FE}.Debug.ActiveCfg = Debug|Win32 - {020311F7-3DAB-4D93-9CE5-6D3926FD15FE}.Debug.Build.0 = Debug|Win32 - {020311F7-3DAB-4D93-9CE5-6D3926FD15FE}.DebugMesaHeadless.ActiveCfg = DebugHk460|Win32 - {020311F7-3DAB-4D93-9CE5-6D3926FD15FE}.DebugMesaHeadless.Build.0 = DebugHk460|Win32 - {020311F7-3DAB-4D93-9CE5-6D3926FD15FE}.Release.ActiveCfg = Release|Win32 - {020311F7-3DAB-4D93-9CE5-6D3926FD15FE}.Release.Build.0 = Release|Win32 - {020311F7-3DAB-4D93-9CE5-6D3926FD15FE}.ReleaseForDownload.ActiveCfg = Release|Win32 - {020311F7-3DAB-4D93-9CE5-6D3926FD15FE}.ReleaseForDownload.Build.0 = Release|Win32 - {020311F7-3DAB-4D93-9CE5-6D3926FD15FE}.ReleaseNoOpt.ActiveCfg = ReleaseNoOpt|Win32 - {020311F7-3DAB-4D93-9CE5-6D3926FD15FE}.ReleaseNoOpt.Build.0 = ReleaseNoOpt|Win32 - {6AEE004D-BFE8-4082-B4D3-E51163B01EEB}.Debug.ActiveCfg = Debug|Win32 - {6AEE004D-BFE8-4082-B4D3-E51163B01EEB}.Debug.Build.0 = Debug|Win32 - {6AEE004D-BFE8-4082-B4D3-E51163B01EEB}.DebugMesaHeadless.ActiveCfg = Debug|Win32 - {6AEE004D-BFE8-4082-B4D3-E51163B01EEB}.Release.ActiveCfg = Release|Win32 - {6AEE004D-BFE8-4082-B4D3-E51163B01EEB}.Release.Build.0 = Release|Win32 - {6AEE004D-BFE8-4082-B4D3-E51163B01EEB}.ReleaseForDownload.ActiveCfg = Release|Win32 - {6AEE004D-BFE8-4082-B4D3-E51163B01EEB}.ReleaseForDownload.Build.0 = Release|Win32 - {6AEE004D-BFE8-4082-B4D3-E51163B01EEB}.ReleaseNoOpt.ActiveCfg = ReleaseNoOpt|Win32 - {6AEE004D-BFE8-4082-B4D3-E51163B01EEB}.ReleaseNoOpt.Build.0 = ReleaseNoOpt|Win32 - {076DD042-2E58-42EA-9401-53210B65C1FC}.Debug.ActiveCfg = Debug|Win32 - {076DD042-2E58-42EA-9401-53210B65C1FC}.Debug.Build.0 = Debug|Win32 - {076DD042-2E58-42EA-9401-53210B65C1FC}.DebugMesaHeadless.ActiveCfg = Debug|Win32 - {076DD042-2E58-42EA-9401-53210B65C1FC}.Release.ActiveCfg = Release|Win32 - {076DD042-2E58-42EA-9401-53210B65C1FC}.Release.Build.0 = Release|Win32 - {076DD042-2E58-42EA-9401-53210B65C1FC}.ReleaseForDownload.ActiveCfg = Release|Win32 - {076DD042-2E58-42EA-9401-53210B65C1FC}.ReleaseForDownload.Build.0 = Release|Win32 - {076DD042-2E58-42EA-9401-53210B65C1FC}.ReleaseNoOpt.ActiveCfg = ReleaseNoOpt|Win32 - {076DD042-2E58-42EA-9401-53210B65C1FC}.ReleaseNoOpt.Build.0 = ReleaseNoOpt|Win32 - {AF2D801E-EEE7-4B52-A025-F8E648ADC34B}.Debug.ActiveCfg = Debug|Win32 - {AF2D801E-EEE7-4B52-A025-F8E648ADC34B}.Debug.Build.0 = Debug|Win32 - {AF2D801E-EEE7-4B52-A025-F8E648ADC34B}.DebugMesaHeadless.ActiveCfg = Debug|Win32 - {AF2D801E-EEE7-4B52-A025-F8E648ADC34B}.Release.ActiveCfg = Release|Win32 - {AF2D801E-EEE7-4B52-A025-F8E648ADC34B}.Release.Build.0 = Release|Win32 - {AF2D801E-EEE7-4B52-A025-F8E648ADC34B}.ReleaseForDownload.ActiveCfg = Release|Win32 - {AF2D801E-EEE7-4B52-A025-F8E648ADC34B}.ReleaseForDownload.Build.0 = Release|Win32 - {AF2D801E-EEE7-4B52-A025-F8E648ADC34B}.ReleaseNoOpt.ActiveCfg = ReleaseNoOpt|Win32 - {AF2D801E-EEE7-4B52-A025-F8E648ADC34B}.ReleaseNoOpt.Build.0 = ReleaseNoOpt|Win32 - {4C8D64D5-649F-481E-96BE-EF1E82A77ACB}.Debug.ActiveCfg = Debug|Win32 - {4C8D64D5-649F-481E-96BE-EF1E82A77ACB}.Debug.Build.0 = Debug|Win32 - {4C8D64D5-649F-481E-96BE-EF1E82A77ACB}.DebugMesaHeadless.ActiveCfg = Debug|Win32 - {4C8D64D5-649F-481E-96BE-EF1E82A77ACB}.Release.ActiveCfg = Release|Win32 - {4C8D64D5-649F-481E-96BE-EF1E82A77ACB}.Release.Build.0 = Release|Win32 - {4C8D64D5-649F-481E-96BE-EF1E82A77ACB}.ReleaseForDownload.ActiveCfg = Release|Win32 - {4C8D64D5-649F-481E-96BE-EF1E82A77ACB}.ReleaseForDownload.Build.0 = Release|Win32 - {4C8D64D5-649F-481E-96BE-EF1E82A77ACB}.ReleaseNoOpt.ActiveCfg = ReleaseNoOpt|Win32 - {4C8D64D5-649F-481E-96BE-EF1E82A77ACB}.ReleaseNoOpt.Build.0 = ReleaseNoOpt|Win32 - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - EndGlobalSection - GlobalSection(ExtensibilityAddIns) = postSolution - EndGlobalSection -EndGlobal diff --git a/linden/indra/indra_complete/indra_complete_vc8.sln b/linden/indra/indra_complete/indra_complete_vc8.sln deleted file mode 100644 index 452608f..0000000 --- a/linden/indra/indra_complete/indra_complete_vc8.sln +++ /dev/null @@ -1,619 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 9.00 -# Visual Studio 2005 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "llcommon", "..\llcommon\llcommon_vc8.vcproj", "{7BCB4B2C-8378-4186-88EA-5742B5ABE17F}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "llmath", "..\llmath\llmath_vc8.vcproj", "{E87FD9BE-BE42-4EA3-BF4D-D992223046D9}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "llmessage", "..\llmessage\llmessage_vc8.vcproj", "{E5D94794-5671-4BD6-A16D-26EC18F3DB34}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "llvfs", "..\llvfs\llvfs_vc8.vcproj", "{D37774F4-253D-4760-BF64-372A943224A1}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "llxml", "..\llxml\llxml_vc8.vcproj", "{A5470DA6-0C3A-4602-B930-43DB25511A59}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "llui", "..\llui\llui_vc8.vcproj", "{DE55D666-6A3D-476C-937F-109269B83681}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "llimage", "..\llimage\llimage_vc8.vcproj", "{681FDD6C-2FAE-4CB9-AF6D-B952F2B151C5}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "llprimitive", "..\llprimitive\llprimitive_vc8.vcproj", "{FCC4483C-5B84-4944-B91F-4589A219BC0B}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "llcharacter", "..\llcharacter\llcharacter_vc8.vcproj", "{5EA5DDF0-C7E1-4F49-BEF5-9246A4656B2E}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "llaudio", "..\llaudio\llaudio_vc8.vcproj", "{93B2BA29-FBE9-4376-92C1-6108DCFE09D3}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "llrender", "..\llrender\llrender_vc8.vcproj", "{2ADE3C14-94C4-40BF-B033-70F3C954EE90}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "llinventory", "..\llinventory\llinventory_vc8.vcproj", "{328D1968-924F-4863-AAE8-5F9A95BA68E5}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "newview", "..\newview\newview_vc8.vcproj", "{E6F4CF1B-6109-4CA8-B58D-87FA936CDE08}" - ProjectSection(ProjectDependencies) = postProject - {9D0C7E02-6506-4EE7-BC5C-75671D28D594} = {9D0C7E02-6506-4EE7-BC5C-75671D28D594} - {2ADE3C14-94C4-40BF-B033-70F3C954EE90} = {2ADE3C14-94C4-40BF-B033-70F3C954EE90} - {B5B53617-416F-404A-BF10-22EBCCA0E4FB} = {B5B53617-416F-404A-BF10-22EBCCA0E4FB} - {93B2BA29-FBE9-4376-92C1-6108DCFE09D3} = {93B2BA29-FBE9-4376-92C1-6108DCFE09D3} - {7BCB4B2C-8378-4186-88EA-5742B5ABE17F} = {7BCB4B2C-8378-4186-88EA-5742B5ABE17F} - {E928F33B-E090-4FA8-818B-6B5D8B0F1F4B} = {E928F33B-E090-4FA8-818B-6B5D8B0F1F4B} - {FCC4483C-5B84-4944-B91F-4589A219BC0B} = {FCC4483C-5B84-4944-B91F-4589A219BC0B} - {F882263E-4F2A-43D9-A45A-FA4C8EC66552} = {F882263E-4F2A-43D9-A45A-FA4C8EC66552} - {076DD042-2E58-42EA-9401-53210B65C1FC} = {076DD042-2E58-42EA-9401-53210B65C1FC} - {DE55D666-6A3D-476C-937F-109269B83681} = {DE55D666-6A3D-476C-937F-109269B83681} - {328D1968-924F-4863-AAE8-5F9A95BA68E5} = {328D1968-924F-4863-AAE8-5F9A95BA68E5} - {681FDD6C-2FAE-4CB9-AF6D-B952F2B151C5} = {681FDD6C-2FAE-4CB9-AF6D-B952F2B151C5} - {44CE6D82-7320-4609-8FC3-5965C19F4808} = {44CE6D82-7320-4609-8FC3-5965C19F4808} - {E5D94794-5671-4BD6-A16D-26EC18F3DB34} = {E5D94794-5671-4BD6-A16D-26EC18F3DB34} - {A5470DA6-0C3A-4602-B930-43DB25511A59} = {A5470DA6-0C3A-4602-B930-43DB25511A59} - {BFA102B0-C891-4E13-B1CF-C2F28073DA8E} = {BFA102B0-C891-4E13-B1CF-C2F28073DA8E} - {E87FD9BE-BE42-4EA3-BF4D-D992223046D9} = {E87FD9BE-BE42-4EA3-BF4D-D992223046D9} - {4C8D64D5-649F-481E-96BE-EF1E82A77ACB} = {4C8D64D5-649F-481E-96BE-EF1E82A77ACB} - {5EA5DDF0-C7E1-4F49-BEF5-9246A4656B2E} = {5EA5DDF0-C7E1-4F49-BEF5-9246A4656B2E} - {648685F3-8760-4CC5-BB2B-CAF9DECC25A4} = {648685F3-8760-4CC5-BB2B-CAF9DECC25A4} - {D37774F4-253D-4760-BF64-372A943224A1} = {D37774F4-253D-4760-BF64-372A943224A1} - EndProjectSection -EndProject -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "llwindow", "..\llwindow\llwindow_vc8.vcproj", "{B5B53617-416F-404A-BF10-22EBCCA0E4FB}" - ProjectSection(ProjectDependencies) = postProject - {A5470DA6-0C3A-4602-B930-43DB25511A59} = {A5470DA6-0C3A-4602-B930-43DB25511A59} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lscript_library", "..\lscript\lscript_library\lscript_library_vc8.vcproj", "{BFA102B0-C891-4E13-B1CF-C2F28073DA8E}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lscript_execute", "..\lscript\lscript_execute\lscript_execute_vc8.vcproj", "{F882263E-4F2A-43D9-A45A-FA4C8EC66552}" - ProjectSection(ProjectDependencies) = postProject - {BFA102B0-C891-4E13-B1CF-C2F28073DA8E} = {BFA102B0-C891-4E13-B1CF-C2F28073DA8E} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lscript_compile", "..\lscript\lscript_compile\lscript_compile_vc8.vcproj", "{44CE6D82-7320-4609-8FC3-5965C19F4808}" - ProjectSection(ProjectDependencies) = postProject - {B771CF1B-E253-47BD-8B0A-6B0440CC9228} = {B771CF1B-E253-47BD-8B0A-6B0440CC9228} - {BFA102B0-C891-4E13-B1CF-C2F28073DA8E} = {BFA102B0-C891-4E13-B1CF-C2F28073DA8E} - EndProjectSection -EndProject - ProjectSection(ProjectDependencies) = postProject - {D37774F4-253D-4760-BF64-372A943224A1} = {D37774F4-253D-4760-BF64-372A943224A1} - {020311F7-3DAB-4D93-9CE5-6D3926FD15FE} = {020311F7-3DAB-4D93-9CE5-6D3926FD15FE} - {7BCB4B2C-8378-4186-88EA-5742B5ABE17F} = {7BCB4B2C-8378-4186-88EA-5742B5ABE17F} - {FCC4483C-5B84-4944-B91F-4589A219BC0B} = {FCC4483C-5B84-4944-B91F-4589A219BC0B} - {F882263E-4F2A-43D9-A45A-FA4C8EC66552} = {F882263E-4F2A-43D9-A45A-FA4C8EC66552} - {4B19F64E-AB97-4FB9-8E1D-74A8104DE0C4} = {4B19F64E-AB97-4FB9-8E1D-74A8104DE0C4} - {328D1968-924F-4863-AAE8-5F9A95BA68E5} = {328D1968-924F-4863-AAE8-5F9A95BA68E5} - {681FDD6C-2FAE-4CB9-AF6D-B952F2B151C5} = {681FDD6C-2FAE-4CB9-AF6D-B952F2B151C5} - {44CE6D82-7320-4609-8FC3-5965C19F4808} = {44CE6D82-7320-4609-8FC3-5965C19F4808} - {E5D94794-5671-4BD6-A16D-26EC18F3DB34} = {E5D94794-5671-4BD6-A16D-26EC18F3DB34} - {A5470DA6-0C3A-4602-B930-43DB25511A59} = {A5470DA6-0C3A-4602-B930-43DB25511A59} - {BFA102B0-C891-4E13-B1CF-C2F28073DA8E} = {BFA102B0-C891-4E13-B1CF-C2F28073DA8E} - {E87FD9BE-BE42-4EA3-BF4D-D992223046D9} = {E87FD9BE-BE42-4EA3-BF4D-D992223046D9} - {B4B838C7-2C72-428E-BBFD-25764E659A8B} = {B4B838C7-2C72-428E-BBFD-25764E659A8B} - {5EA5DDF0-C7E1-4F49-BEF5-9246A4656B2E} = {5EA5DDF0-C7E1-4F49-BEF5-9246A4656B2E} - {D37774F4-253D-4760-BF64-372A943224A1} = {D37774F4-253D-4760-BF64-372A943224A1} - EndProjectSection -EndProject - ProjectSection(ProjectDependencies) = postProject - {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} - {7BCB4B2C-8378-4186-88EA-5742B5ABE17F} = {7BCB4B2C-8378-4186-88EA-5742B5ABE17F} - EndProjectSection -EndProject - ProjectSection(ProjectDependencies) = postProject - {7BCB4B2C-8378-4186-88EA-5742B5ABE17F} = {7BCB4B2C-8378-4186-88EA-5742B5ABE17F} - {4B19F64E-AB97-4FB9-8E1D-74A8104DE0C4} = {4B19F64E-AB97-4FB9-8E1D-74A8104DE0C4} - {328D1968-924F-4863-AAE8-5F9A95BA68E5} = {328D1968-924F-4863-AAE8-5F9A95BA68E5} - {E5D94794-5671-4BD6-A16D-26EC18F3DB34} = {E5D94794-5671-4BD6-A16D-26EC18F3DB34} - {A5470DA6-0C3A-4602-B930-43DB25511A59} = {A5470DA6-0C3A-4602-B930-43DB25511A59} - {E87FD9BE-BE42-4EA3-BF4D-D992223046D9} = {E87FD9BE-BE42-4EA3-BF4D-D992223046D9} - {B4B838C7-2C72-428E-BBFD-25764E659A8B} = {B4B838C7-2C72-428E-BBFD-25764E659A8B} - {5EA5DDF0-C7E1-4F49-BEF5-9246A4656B2E} = {5EA5DDF0-C7E1-4F49-BEF5-9246A4656B2E} - {D37774F4-253D-4760-BF64-372A943224A1} = {D37774F4-253D-4760-BF64-372A943224A1} - EndProjectSection -EndProject - ProjectSection(ProjectDependencies) = postProject - {44CE6D82-7320-4609-8FC3-5965C19F4808} = {44CE6D82-7320-4609-8FC3-5965C19F4808} - EndProjectSection -EndProject - ProjectSection(ProjectDependencies) = postProject - {F882263E-4F2A-43D9-A45A-FA4C8EC66552} = {F882263E-4F2A-43D9-A45A-FA4C8EC66552} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "win_crash_logger", "..\win_crash_logger\win_crash_logger_vc8.vcproj", "{648685F3-8760-4CC5-BB2B-CAF9DECC25A4}" - ProjectSection(ProjectDependencies) = postProject - {B5B53617-416F-404A-BF10-22EBCCA0E4FB} = {B5B53617-416F-404A-BF10-22EBCCA0E4FB} - {7BCB4B2C-8378-4186-88EA-5742B5ABE17F} = {7BCB4B2C-8378-4186-88EA-5742B5ABE17F} - {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 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "win_updater", "..\win_updater\win_updater_vc8.vcproj", "{E928F33B-E090-4FA8-818B-6B5D8B0F1F4B}" -EndProject - ProjectSection(ProjectDependencies) = postProject - {7BCB4B2C-8378-4186-88EA-5742B5ABE17F} = {7BCB4B2C-8378-4186-88EA-5742B5ABE17F} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "llmedia", "..\llmedia\llmedia_vc8.vcproj", "{9D0C7E02-6506-4EE7-BC5C-75671D28D594}" -EndProject -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test", "..\test\test_vc8.vcproj", "{BBAA6588-CA96-4A87-A988-B02270B8D02B}" - ProjectSection(ProjectDependencies) = postProject - {7BCB4B2C-8378-4186-88EA-5742B5ABE17F} = {7BCB4B2C-8378-4186-88EA-5742B5ABE17F} - {FCC4483C-5B84-4944-B91F-4589A219BC0B} = {FCC4483C-5B84-4944-B91F-4589A219BC0B} - {F882263E-4F2A-43D9-A45A-FA4C8EC66552} = {F882263E-4F2A-43D9-A45A-FA4C8EC66552} - {4B19F64E-AB97-4FB9-8E1D-74A8104DE0C4} = {4B19F64E-AB97-4FB9-8E1D-74A8104DE0C4} - {328D1968-924F-4863-AAE8-5F9A95BA68E5} = {328D1968-924F-4863-AAE8-5F9A95BA68E5} - {44CE6D82-7320-4609-8FC3-5965C19F4808} = {44CE6D82-7320-4609-8FC3-5965C19F4808} - {E5D94794-5671-4BD6-A16D-26EC18F3DB34} = {E5D94794-5671-4BD6-A16D-26EC18F3DB34} - {EC2A989E-3F8F-4B8B-9AE6-7C7EA37C84BC} = {EC2A989E-3F8F-4B8B-9AE6-7C7EA37C84BC} - {A5470DA6-0C3A-4602-B930-43DB25511A59} = {A5470DA6-0C3A-4602-B930-43DB25511A59} - {BFA102B0-C891-4E13-B1CF-C2F28073DA8E} = {BFA102B0-C891-4E13-B1CF-C2F28073DA8E} - {777F38BE-2DFE-4051-9AAD-2832ABC474CC} = {777F38BE-2DFE-4051-9AAD-2832ABC474CC} - {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 - {2ADE3C14-94C4-40BF-B033-70F3C954EE90} = {2ADE3C14-94C4-40BF-B033-70F3C954EE90} - {B5B53617-416F-404A-BF10-22EBCCA0E4FB} = {B5B53617-416F-404A-BF10-22EBCCA0E4FB} - {AF2D801E-EEE7-4B52-A025-F8E648ADC34B} = {AF2D801E-EEE7-4B52-A025-F8E648ADC34B} - {7BCB4B2C-8378-4186-88EA-5742B5ABE17F} = {7BCB4B2C-8378-4186-88EA-5742B5ABE17F} - {FCC4483C-5B84-4944-B91F-4589A219BC0B} = {FCC4483C-5B84-4944-B91F-4589A219BC0B} - {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 -EndProject - ProjectSection(ProjectDependencies) = postProject - {7BCB4B2C-8378-4186-88EA-5742B5ABE17F} = {7BCB4B2C-8378-4186-88EA-5742B5ABE17F} - {681FDD6C-2FAE-4CB9-AF6D-B952F2B151C5} = {681FDD6C-2FAE-4CB9-AF6D-B952F2B151C5} - {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 - {7BCB4B2C-8378-4186-88EA-5742B5ABE17F} = {7BCB4B2C-8378-4186-88EA-5742B5ABE17F} - {681FDD6C-2FAE-4CB9-AF6D-B952F2B151C5} = {681FDD6C-2FAE-4CB9-AF6D-B952F2B151C5} - {E87FD9BE-BE42-4EA3-BF4D-D992223046D9} = {E87FD9BE-BE42-4EA3-BF4D-D992223046D9} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "llimagej2coj", "..\llimagej2coj\llimagej2coj_vc8.vcproj", "{4C8D64D5-649F-481E-96BE-EF1E82A77ACB}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lscript_compile_fb_vc8", "..\lscript\lscript_compile\lscript_compile_fb_vc8.vcproj", "{B771CF1B-E253-47BD-8B0A-6B0440CC9228}" -EndProject -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - DebugHk460|Win32 = DebugHk460|Win32 - DebugMesaHeadless|Win32 = DebugMesaHeadless|Win32 - Release|Win32 = Release|Win32 - ReleaseForDownload|Win32 = ReleaseForDownload|Win32 - ReleaseNoOpt|Win32 = ReleaseNoOpt|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {7BCB4B2C-8378-4186-88EA-5742B5ABE17F}.Debug|Win32.ActiveCfg = Debug|Win32 - {7BCB4B2C-8378-4186-88EA-5742B5ABE17F}.Debug|Win32.Build.0 = Debug|Win32 - {7BCB4B2C-8378-4186-88EA-5742B5ABE17F}.DebugHk460|Win32.ActiveCfg = Debug|Win32 - {7BCB4B2C-8378-4186-88EA-5742B5ABE17F}.DebugHk460|Win32.Build.0 = Debug|Win32 - {7BCB4B2C-8378-4186-88EA-5742B5ABE17F}.DebugMesaHeadless|Win32.ActiveCfg = Debug|Win32 - {7BCB4B2C-8378-4186-88EA-5742B5ABE17F}.DebugMesaHeadless|Win32.Build.0 = Debug|Win32 - {7BCB4B2C-8378-4186-88EA-5742B5ABE17F}.Release|Win32.ActiveCfg = Release|Win32 - {7BCB4B2C-8378-4186-88EA-5742B5ABE17F}.Release|Win32.Build.0 = Release|Win32 - {7BCB4B2C-8378-4186-88EA-5742B5ABE17F}.ReleaseForDownload|Win32.ActiveCfg = Release|Win32 - {7BCB4B2C-8378-4186-88EA-5742B5ABE17F}.ReleaseForDownload|Win32.Build.0 = Release|Win32 - {7BCB4B2C-8378-4186-88EA-5742B5ABE17F}.ReleaseNoOpt|Win32.ActiveCfg = ReleaseNoOpt|Win32 - {7BCB4B2C-8378-4186-88EA-5742B5ABE17F}.ReleaseNoOpt|Win32.Build.0 = ReleaseNoOpt|Win32 - {E87FD9BE-BE42-4EA3-BF4D-D992223046D9}.Debug|Win32.ActiveCfg = Debug|Win32 - {E87FD9BE-BE42-4EA3-BF4D-D992223046D9}.Debug|Win32.Build.0 = Debug|Win32 - {E87FD9BE-BE42-4EA3-BF4D-D992223046D9}.DebugHk460|Win32.ActiveCfg = Debug|Win32 - {E87FD9BE-BE42-4EA3-BF4D-D992223046D9}.DebugHk460|Win32.Build.0 = Debug|Win32 - {E87FD9BE-BE42-4EA3-BF4D-D992223046D9}.DebugMesaHeadless|Win32.ActiveCfg = Debug|Win32 - {E87FD9BE-BE42-4EA3-BF4D-D992223046D9}.DebugMesaHeadless|Win32.Build.0 = Debug|Win32 - {E87FD9BE-BE42-4EA3-BF4D-D992223046D9}.Release|Win32.ActiveCfg = Release|Win32 - {E87FD9BE-BE42-4EA3-BF4D-D992223046D9}.Release|Win32.Build.0 = Release|Win32 - {E87FD9BE-BE42-4EA3-BF4D-D992223046D9}.ReleaseForDownload|Win32.ActiveCfg = Release|Win32 - {E87FD9BE-BE42-4EA3-BF4D-D992223046D9}.ReleaseForDownload|Win32.Build.0 = Release|Win32 - {E87FD9BE-BE42-4EA3-BF4D-D992223046D9}.ReleaseNoOpt|Win32.ActiveCfg = ReleaseNoOpt|Win32 - {E87FD9BE-BE42-4EA3-BF4D-D992223046D9}.ReleaseNoOpt|Win32.Build.0 = ReleaseNoOpt|Win32 - {E5D94794-5671-4BD6-A16D-26EC18F3DB34}.Debug|Win32.ActiveCfg = Debug|Win32 - {E5D94794-5671-4BD6-A16D-26EC18F3DB34}.Debug|Win32.Build.0 = Debug|Win32 - {E5D94794-5671-4BD6-A16D-26EC18F3DB34}.DebugHk460|Win32.ActiveCfg = Debug|Win32 - {E5D94794-5671-4BD6-A16D-26EC18F3DB34}.DebugHk460|Win32.Build.0 = Debug|Win32 - {E5D94794-5671-4BD6-A16D-26EC18F3DB34}.DebugMesaHeadless|Win32.ActiveCfg = Debug|Win32 - {E5D94794-5671-4BD6-A16D-26EC18F3DB34}.DebugMesaHeadless|Win32.Build.0 = Debug|Win32 - {E5D94794-5671-4BD6-A16D-26EC18F3DB34}.Release|Win32.ActiveCfg = Release|Win32 - {E5D94794-5671-4BD6-A16D-26EC18F3DB34}.Release|Win32.Build.0 = Release|Win32 - {E5D94794-5671-4BD6-A16D-26EC18F3DB34}.ReleaseForDownload|Win32.ActiveCfg = Release|Win32 - {E5D94794-5671-4BD6-A16D-26EC18F3DB34}.ReleaseForDownload|Win32.Build.0 = Release|Win32 - {E5D94794-5671-4BD6-A16D-26EC18F3DB34}.ReleaseNoOpt|Win32.ActiveCfg = ReleaseNoOpt|Win32 - {E5D94794-5671-4BD6-A16D-26EC18F3DB34}.ReleaseNoOpt|Win32.Build.0 = ReleaseNoOpt|Win32 - {D37774F4-253D-4760-BF64-372A943224A1}.Debug|Win32.ActiveCfg = Debug|Win32 - {D37774F4-253D-4760-BF64-372A943224A1}.Debug|Win32.Build.0 = Debug|Win32 - {D37774F4-253D-4760-BF64-372A943224A1}.DebugHk460|Win32.ActiveCfg = Debug|Win32 - {D37774F4-253D-4760-BF64-372A943224A1}.DebugHk460|Win32.Build.0 = Debug|Win32 - {D37774F4-253D-4760-BF64-372A943224A1}.DebugMesaHeadless|Win32.ActiveCfg = Debug|Win32 - {D37774F4-253D-4760-BF64-372A943224A1}.DebugMesaHeadless|Win32.Build.0 = Debug|Win32 - {D37774F4-253D-4760-BF64-372A943224A1}.Release|Win32.ActiveCfg = Release|Win32 - {D37774F4-253D-4760-BF64-372A943224A1}.Release|Win32.Build.0 = Release|Win32 - {D37774F4-253D-4760-BF64-372A943224A1}.ReleaseForDownload|Win32.ActiveCfg = Release|Win32 - {D37774F4-253D-4760-BF64-372A943224A1}.ReleaseForDownload|Win32.Build.0 = Release|Win32 - {D37774F4-253D-4760-BF64-372A943224A1}.ReleaseNoOpt|Win32.ActiveCfg = ReleaseNoOpt|Win32 - {D37774F4-253D-4760-BF64-372A943224A1}.ReleaseNoOpt|Win32.Build.0 = ReleaseNoOpt|Win32 - {A5470DA6-0C3A-4602-B930-43DB25511A59}.Debug|Win32.ActiveCfg = Debug|Win32 - {A5470DA6-0C3A-4602-B930-43DB25511A59}.Debug|Win32.Build.0 = Debug|Win32 - {A5470DA6-0C3A-4602-B930-43DB25511A59}.DebugHk460|Win32.ActiveCfg = Debug|Win32 - {A5470DA6-0C3A-4602-B930-43DB25511A59}.DebugHk460|Win32.Build.0 = Debug|Win32 - {A5470DA6-0C3A-4602-B930-43DB25511A59}.DebugMesaHeadless|Win32.ActiveCfg = Debug|Win32 - {A5470DA6-0C3A-4602-B930-43DB25511A59}.DebugMesaHeadless|Win32.Build.0 = Debug|Win32 - {A5470DA6-0C3A-4602-B930-43DB25511A59}.Release|Win32.ActiveCfg = Release|Win32 - {A5470DA6-0C3A-4602-B930-43DB25511A59}.Release|Win32.Build.0 = Release|Win32 - {A5470DA6-0C3A-4602-B930-43DB25511A59}.ReleaseForDownload|Win32.ActiveCfg = Release|Win32 - {A5470DA6-0C3A-4602-B930-43DB25511A59}.ReleaseForDownload|Win32.Build.0 = Release|Win32 - {A5470DA6-0C3A-4602-B930-43DB25511A59}.ReleaseNoOpt|Win32.ActiveCfg = ReleaseNoOpt|Win32 - {A5470DA6-0C3A-4602-B930-43DB25511A59}.ReleaseNoOpt|Win32.Build.0 = ReleaseNoOpt|Win32 - {DE55D666-6A3D-476C-937F-109269B83681}.Debug|Win32.ActiveCfg = Debug|Win32 - {DE55D666-6A3D-476C-937F-109269B83681}.Debug|Win32.Build.0 = Debug|Win32 - {DE55D666-6A3D-476C-937F-109269B83681}.DebugHk460|Win32.ActiveCfg = Debug|Win32 - {DE55D666-6A3D-476C-937F-109269B83681}.DebugHk460|Win32.Build.0 = Debug|Win32 - {DE55D666-6A3D-476C-937F-109269B83681}.DebugMesaHeadless|Win32.ActiveCfg = Debug|Win32 - {DE55D666-6A3D-476C-937F-109269B83681}.DebugMesaHeadless|Win32.Build.0 = Debug|Win32 - {DE55D666-6A3D-476C-937F-109269B83681}.Release|Win32.ActiveCfg = Release|Win32 - {DE55D666-6A3D-476C-937F-109269B83681}.Release|Win32.Build.0 = Release|Win32 - {DE55D666-6A3D-476C-937F-109269B83681}.ReleaseForDownload|Win32.ActiveCfg = Release|Win32 - {DE55D666-6A3D-476C-937F-109269B83681}.ReleaseForDownload|Win32.Build.0 = Release|Win32 - {DE55D666-6A3D-476C-937F-109269B83681}.ReleaseNoOpt|Win32.ActiveCfg = ReleaseNoOpt|Win32 - {DE55D666-6A3D-476C-937F-109269B83681}.ReleaseNoOpt|Win32.Build.0 = ReleaseNoOpt|Win32 - {681FDD6C-2FAE-4CB9-AF6D-B952F2B151C5}.Debug|Win32.ActiveCfg = Debug|Win32 - {681FDD6C-2FAE-4CB9-AF6D-B952F2B151C5}.Debug|Win32.Build.0 = Debug|Win32 - {681FDD6C-2FAE-4CB9-AF6D-B952F2B151C5}.DebugHk460|Win32.ActiveCfg = Debug|Win32 - {681FDD6C-2FAE-4CB9-AF6D-B952F2B151C5}.DebugHk460|Win32.Build.0 = Debug|Win32 - {681FDD6C-2FAE-4CB9-AF6D-B952F2B151C5}.DebugMesaHeadless|Win32.ActiveCfg = Debug|Win32 - {681FDD6C-2FAE-4CB9-AF6D-B952F2B151C5}.DebugMesaHeadless|Win32.Build.0 = Debug|Win32 - {681FDD6C-2FAE-4CB9-AF6D-B952F2B151C5}.Release|Win32.ActiveCfg = Release|Win32 - {681FDD6C-2FAE-4CB9-AF6D-B952F2B151C5}.Release|Win32.Build.0 = Release|Win32 - {681FDD6C-2FAE-4CB9-AF6D-B952F2B151C5}.ReleaseForDownload|Win32.ActiveCfg = Release|Win32 - {681FDD6C-2FAE-4CB9-AF6D-B952F2B151C5}.ReleaseForDownload|Win32.Build.0 = Release|Win32 - {681FDD6C-2FAE-4CB9-AF6D-B952F2B151C5}.ReleaseNoOpt|Win32.ActiveCfg = ReleaseNoOpt|Win32 - {681FDD6C-2FAE-4CB9-AF6D-B952F2B151C5}.ReleaseNoOpt|Win32.Build.0 = ReleaseNoOpt|Win32 - {FCC4483C-5B84-4944-B91F-4589A219BC0B}.Debug|Win32.ActiveCfg = Debug|Win32 - {FCC4483C-5B84-4944-B91F-4589A219BC0B}.Debug|Win32.Build.0 = Debug|Win32 - {FCC4483C-5B84-4944-B91F-4589A219BC0B}.DebugHk460|Win32.ActiveCfg = Debug|Win32 - {FCC4483C-5B84-4944-B91F-4589A219BC0B}.DebugHk460|Win32.Build.0 = Debug|Win32 - {FCC4483C-5B84-4944-B91F-4589A219BC0B}.DebugMesaHeadless|Win32.ActiveCfg = Debug|Win32 - {FCC4483C-5B84-4944-B91F-4589A219BC0B}.DebugMesaHeadless|Win32.Build.0 = Debug|Win32 - {FCC4483C-5B84-4944-B91F-4589A219BC0B}.Release|Win32.ActiveCfg = Release|Win32 - {FCC4483C-5B84-4944-B91F-4589A219BC0B}.Release|Win32.Build.0 = Release|Win32 - {FCC4483C-5B84-4944-B91F-4589A219BC0B}.ReleaseForDownload|Win32.ActiveCfg = Release|Win32 - {FCC4483C-5B84-4944-B91F-4589A219BC0B}.ReleaseForDownload|Win32.Build.0 = Release|Win32 - {FCC4483C-5B84-4944-B91F-4589A219BC0B}.ReleaseNoOpt|Win32.ActiveCfg = ReleaseNoOpt|Win32 - {FCC4483C-5B84-4944-B91F-4589A219BC0B}.ReleaseNoOpt|Win32.Build.0 = ReleaseNoOpt|Win32 - {5EA5DDF0-C7E1-4F49-BEF5-9246A4656B2E}.Debug|Win32.ActiveCfg = Debug|Win32 - {5EA5DDF0-C7E1-4F49-BEF5-9246A4656B2E}.Debug|Win32.Build.0 = Debug|Win32 - {5EA5DDF0-C7E1-4F49-BEF5-9246A4656B2E}.DebugHk460|Win32.ActiveCfg = Debug|Win32 - {5EA5DDF0-C7E1-4F49-BEF5-9246A4656B2E}.DebugHk460|Win32.Build.0 = Debug|Win32 - {5EA5DDF0-C7E1-4F49-BEF5-9246A4656B2E}.DebugMesaHeadless|Win32.ActiveCfg = Debug|Win32 - {5EA5DDF0-C7E1-4F49-BEF5-9246A4656B2E}.DebugMesaHeadless|Win32.Build.0 = Debug|Win32 - {5EA5DDF0-C7E1-4F49-BEF5-9246A4656B2E}.Release|Win32.ActiveCfg = Release|Win32 - {5EA5DDF0-C7E1-4F49-BEF5-9246A4656B2E}.Release|Win32.Build.0 = Release|Win32 - {5EA5DDF0-C7E1-4F49-BEF5-9246A4656B2E}.ReleaseForDownload|Win32.ActiveCfg = Release|Win32 - {5EA5DDF0-C7E1-4F49-BEF5-9246A4656B2E}.ReleaseForDownload|Win32.Build.0 = Release|Win32 - {5EA5DDF0-C7E1-4F49-BEF5-9246A4656B2E}.ReleaseNoOpt|Win32.ActiveCfg = ReleaseNoOpt|Win32 - {5EA5DDF0-C7E1-4F49-BEF5-9246A4656B2E}.ReleaseNoOpt|Win32.Build.0 = ReleaseNoOpt|Win32 - {93B2BA29-FBE9-4376-92C1-6108DCFE09D3}.Debug|Win32.ActiveCfg = Debug|Win32 - {93B2BA29-FBE9-4376-92C1-6108DCFE09D3}.Debug|Win32.Build.0 = Debug|Win32 - {93B2BA29-FBE9-4376-92C1-6108DCFE09D3}.DebugHk460|Win32.ActiveCfg = Debug|Win32 - {93B2BA29-FBE9-4376-92C1-6108DCFE09D3}.DebugHk460|Win32.Build.0 = Debug|Win32 - {93B2BA29-FBE9-4376-92C1-6108DCFE09D3}.DebugMesaHeadless|Win32.ActiveCfg = Debug|Win32 - {93B2BA29-FBE9-4376-92C1-6108DCFE09D3}.DebugMesaHeadless|Win32.Build.0 = Debug|Win32 - {93B2BA29-FBE9-4376-92C1-6108DCFE09D3}.Release|Win32.ActiveCfg = Release|Win32 - {93B2BA29-FBE9-4376-92C1-6108DCFE09D3}.Release|Win32.Build.0 = Release|Win32 - {93B2BA29-FBE9-4376-92C1-6108DCFE09D3}.ReleaseForDownload|Win32.ActiveCfg = Release|Win32 - {93B2BA29-FBE9-4376-92C1-6108DCFE09D3}.ReleaseForDownload|Win32.Build.0 = Release|Win32 - {93B2BA29-FBE9-4376-92C1-6108DCFE09D3}.ReleaseNoOpt|Win32.ActiveCfg = ReleaseNoOpt|Win32 - {93B2BA29-FBE9-4376-92C1-6108DCFE09D3}.ReleaseNoOpt|Win32.Build.0 = ReleaseNoOpt|Win32 - {2ADE3C14-94C4-40BF-B033-70F3C954EE90}.Debug|Win32.ActiveCfg = Debug|Win32 - {2ADE3C14-94C4-40BF-B033-70F3C954EE90}.Debug|Win32.Build.0 = Debug|Win32 - {2ADE3C14-94C4-40BF-B033-70F3C954EE90}.DebugHk460|Win32.ActiveCfg = Debug|Win32 - {2ADE3C14-94C4-40BF-B033-70F3C954EE90}.DebugHk460|Win32.Build.0 = Debug|Win32 - {2ADE3C14-94C4-40BF-B033-70F3C954EE90}.DebugMesaHeadless|Win32.ActiveCfg = Debug|Win32 - {2ADE3C14-94C4-40BF-B033-70F3C954EE90}.DebugMesaHeadless|Win32.Build.0 = Debug|Win32 - {2ADE3C14-94C4-40BF-B033-70F3C954EE90}.Release|Win32.ActiveCfg = Release|Win32 - {2ADE3C14-94C4-40BF-B033-70F3C954EE90}.Release|Win32.Build.0 = Release|Win32 - {2ADE3C14-94C4-40BF-B033-70F3C954EE90}.ReleaseForDownload|Win32.ActiveCfg = Release|Win32 - {2ADE3C14-94C4-40BF-B033-70F3C954EE90}.ReleaseForDownload|Win32.Build.0 = Release|Win32 - {2ADE3C14-94C4-40BF-B033-70F3C954EE90}.ReleaseNoOpt|Win32.ActiveCfg = ReleaseNoOpt|Win32 - {2ADE3C14-94C4-40BF-B033-70F3C954EE90}.ReleaseNoOpt|Win32.Build.0 = ReleaseNoOpt|Win32 - {328D1968-924F-4863-AAE8-5F9A95BA68E5}.Debug|Win32.ActiveCfg = Debug|Win32 - {328D1968-924F-4863-AAE8-5F9A95BA68E5}.Debug|Win32.Build.0 = Debug|Win32 - {328D1968-924F-4863-AAE8-5F9A95BA68E5}.DebugHk460|Win32.ActiveCfg = Debug|Win32 - {328D1968-924F-4863-AAE8-5F9A95BA68E5}.DebugHk460|Win32.Build.0 = Debug|Win32 - {328D1968-924F-4863-AAE8-5F9A95BA68E5}.DebugMesaHeadless|Win32.ActiveCfg = Debug|Win32 - {328D1968-924F-4863-AAE8-5F9A95BA68E5}.DebugMesaHeadless|Win32.Build.0 = Debug|Win32 - {328D1968-924F-4863-AAE8-5F9A95BA68E5}.Release|Win32.ActiveCfg = Release|Win32 - {328D1968-924F-4863-AAE8-5F9A95BA68E5}.Release|Win32.Build.0 = Release|Win32 - {328D1968-924F-4863-AAE8-5F9A95BA68E5}.ReleaseForDownload|Win32.ActiveCfg = Release|Win32 - {328D1968-924F-4863-AAE8-5F9A95BA68E5}.ReleaseForDownload|Win32.Build.0 = Release|Win32 - {328D1968-924F-4863-AAE8-5F9A95BA68E5}.ReleaseNoOpt|Win32.ActiveCfg = ReleaseNoOpt|Win32 - {328D1968-924F-4863-AAE8-5F9A95BA68E5}.ReleaseNoOpt|Win32.Build.0 = ReleaseNoOpt|Win32 - {E6F4CF1B-6109-4CA8-B58D-87FA936CDE08}.Debug|Win32.ActiveCfg = Debug|Win32 - {E6F4CF1B-6109-4CA8-B58D-87FA936CDE08}.Debug|Win32.Build.0 = Debug|Win32 - {E6F4CF1B-6109-4CA8-B58D-87FA936CDE08}.DebugHk460|Win32.ActiveCfg = Debug|Win32 - {E6F4CF1B-6109-4CA8-B58D-87FA936CDE08}.DebugHk460|Win32.Build.0 = Debug|Win32 - {E6F4CF1B-6109-4CA8-B58D-87FA936CDE08}.DebugMesaHeadless|Win32.ActiveCfg = Debug|Win32 - {E6F4CF1B-6109-4CA8-B58D-87FA936CDE08}.DebugMesaHeadless|Win32.Build.0 = Debug|Win32 - {E6F4CF1B-6109-4CA8-B58D-87FA936CDE08}.Release|Win32.ActiveCfg = Release|Win32 - {E6F4CF1B-6109-4CA8-B58D-87FA936CDE08}.Release|Win32.Build.0 = Release|Win32 - {E6F4CF1B-6109-4CA8-B58D-87FA936CDE08}.ReleaseForDownload|Win32.ActiveCfg = ReleaseForDownload|Win32 - {E6F4CF1B-6109-4CA8-B58D-87FA936CDE08}.ReleaseForDownload|Win32.Build.0 = ReleaseForDownload|Win32 - {E6F4CF1B-6109-4CA8-B58D-87FA936CDE08}.ReleaseNoOpt|Win32.ActiveCfg = ReleaseNoOpt|Win32 - {E6F4CF1B-6109-4CA8-B58D-87FA936CDE08}.ReleaseNoOpt|Win32.Build.0 = ReleaseNoOpt|Win32 - {B4B838C7-2C72-428E-BBFD-25764E659A8B}.Debug|Win32.ActiveCfg = Debug|Win32 - {B4B838C7-2C72-428E-BBFD-25764E659A8B}.Debug|Win32.Build.0 = Debug|Win32 - {B4B838C7-2C72-428E-BBFD-25764E659A8B}.DebugHk460|Win32.ActiveCfg = Debug|Win32 - {B4B838C7-2C72-428E-BBFD-25764E659A8B}.DebugHk460|Win32.Build.0 = Debug|Win32 - {B4B838C7-2C72-428E-BBFD-25764E659A8B}.DebugMesaHeadless|Win32.ActiveCfg = Debug|Win32 - {B4B838C7-2C72-428E-BBFD-25764E659A8B}.DebugMesaHeadless|Win32.Build.0 = Debug|Win32 - {B4B838C7-2C72-428E-BBFD-25764E659A8B}.Release|Win32.ActiveCfg = Release|Win32 - {B4B838C7-2C72-428E-BBFD-25764E659A8B}.Release|Win32.Build.0 = Release|Win32 - {B4B838C7-2C72-428E-BBFD-25764E659A8B}.ReleaseForDownload|Win32.ActiveCfg = Release|Win32 - {B4B838C7-2C72-428E-BBFD-25764E659A8B}.ReleaseForDownload|Win32.Build.0 = Release|Win32 - {B4B838C7-2C72-428E-BBFD-25764E659A8B}.ReleaseNoOpt|Win32.ActiveCfg = ReleaseNoOpt|Win32 - {B4B838C7-2C72-428E-BBFD-25764E659A8B}.ReleaseNoOpt|Win32.Build.0 = ReleaseNoOpt|Win32 - {B5B53617-416F-404A-BF10-22EBCCA0E4FB}.Debug|Win32.ActiveCfg = Debug|Win32 - {B5B53617-416F-404A-BF10-22EBCCA0E4FB}.Debug|Win32.Build.0 = Debug|Win32 - {B5B53617-416F-404A-BF10-22EBCCA0E4FB}.DebugHk460|Win32.ActiveCfg = DebugMesaHeadless|Win32 - {B5B53617-416F-404A-BF10-22EBCCA0E4FB}.DebugHk460|Win32.Build.0 = DebugMesaHeadless|Win32 - {B5B53617-416F-404A-BF10-22EBCCA0E4FB}.DebugMesaHeadless|Win32.ActiveCfg = DebugMesaHeadless|Win32 - {B5B53617-416F-404A-BF10-22EBCCA0E4FB}.DebugMesaHeadless|Win32.Build.0 = DebugMesaHeadless|Win32 - {B5B53617-416F-404A-BF10-22EBCCA0E4FB}.Release|Win32.ActiveCfg = Release|Win32 - {B5B53617-416F-404A-BF10-22EBCCA0E4FB}.Release|Win32.Build.0 = Release|Win32 - {B5B53617-416F-404A-BF10-22EBCCA0E4FB}.ReleaseForDownload|Win32.ActiveCfg = Release|Win32 - {B5B53617-416F-404A-BF10-22EBCCA0E4FB}.ReleaseForDownload|Win32.Build.0 = Release|Win32 - {B5B53617-416F-404A-BF10-22EBCCA0E4FB}.ReleaseNoOpt|Win32.ActiveCfg = ReleaseNoOpt|Win32 - {B5B53617-416F-404A-BF10-22EBCCA0E4FB}.ReleaseNoOpt|Win32.Build.0 = ReleaseNoOpt|Win32 - {BFA102B0-C891-4E13-B1CF-C2F28073DA8E}.Debug|Win32.ActiveCfg = Debug|Win32 - {BFA102B0-C891-4E13-B1CF-C2F28073DA8E}.Debug|Win32.Build.0 = Debug|Win32 - {BFA102B0-C891-4E13-B1CF-C2F28073DA8E}.DebugHk460|Win32.ActiveCfg = Debug|Win32 - {BFA102B0-C891-4E13-B1CF-C2F28073DA8E}.DebugHk460|Win32.Build.0 = Debug|Win32 - {BFA102B0-C891-4E13-B1CF-C2F28073DA8E}.DebugMesaHeadless|Win32.ActiveCfg = Debug|Win32 - {BFA102B0-C891-4E13-B1CF-C2F28073DA8E}.DebugMesaHeadless|Win32.Build.0 = Debug|Win32 - {BFA102B0-C891-4E13-B1CF-C2F28073DA8E}.Release|Win32.ActiveCfg = Release|Win32 - {BFA102B0-C891-4E13-B1CF-C2F28073DA8E}.Release|Win32.Build.0 = Release|Win32 - {BFA102B0-C891-4E13-B1CF-C2F28073DA8E}.ReleaseForDownload|Win32.ActiveCfg = Release|Win32 - {BFA102B0-C891-4E13-B1CF-C2F28073DA8E}.ReleaseForDownload|Win32.Build.0 = Release|Win32 - {BFA102B0-C891-4E13-B1CF-C2F28073DA8E}.ReleaseNoOpt|Win32.ActiveCfg = ReleaseNoOpt|Win32 - {BFA102B0-C891-4E13-B1CF-C2F28073DA8E}.ReleaseNoOpt|Win32.Build.0 = ReleaseNoOpt|Win32 - {F882263E-4F2A-43D9-A45A-FA4C8EC66552}.Debug|Win32.ActiveCfg = Debug|Win32 - {F882263E-4F2A-43D9-A45A-FA4C8EC66552}.Debug|Win32.Build.0 = Debug|Win32 - {F882263E-4F2A-43D9-A45A-FA4C8EC66552}.DebugHk460|Win32.ActiveCfg = Debug|Win32 - {F882263E-4F2A-43D9-A45A-FA4C8EC66552}.DebugHk460|Win32.Build.0 = Debug|Win32 - {F882263E-4F2A-43D9-A45A-FA4C8EC66552}.DebugMesaHeadless|Win32.ActiveCfg = Debug|Win32 - {F882263E-4F2A-43D9-A45A-FA4C8EC66552}.DebugMesaHeadless|Win32.Build.0 = Debug|Win32 - {F882263E-4F2A-43D9-A45A-FA4C8EC66552}.Release|Win32.ActiveCfg = Release|Win32 - {F882263E-4F2A-43D9-A45A-FA4C8EC66552}.Release|Win32.Build.0 = Release|Win32 - {F882263E-4F2A-43D9-A45A-FA4C8EC66552}.ReleaseForDownload|Win32.ActiveCfg = Release|Win32 - {F882263E-4F2A-43D9-A45A-FA4C8EC66552}.ReleaseForDownload|Win32.Build.0 = Release|Win32 - {F882263E-4F2A-43D9-A45A-FA4C8EC66552}.ReleaseNoOpt|Win32.ActiveCfg = ReleaseNoOpt|Win32 - {F882263E-4F2A-43D9-A45A-FA4C8EC66552}.ReleaseNoOpt|Win32.Build.0 = ReleaseNoOpt|Win32 - {44CE6D82-7320-4609-8FC3-5965C19F4808}.Debug|Win32.ActiveCfg = Debug|Win32 - {44CE6D82-7320-4609-8FC3-5965C19F4808}.Debug|Win32.Build.0 = Debug|Win32 - {44CE6D82-7320-4609-8FC3-5965C19F4808}.DebugHk460|Win32.ActiveCfg = Debug|Win32 - {44CE6D82-7320-4609-8FC3-5965C19F4808}.DebugHk460|Win32.Build.0 = Debug|Win32 - {44CE6D82-7320-4609-8FC3-5965C19F4808}.DebugMesaHeadless|Win32.ActiveCfg = Debug|Win32 - {44CE6D82-7320-4609-8FC3-5965C19F4808}.DebugMesaHeadless|Win32.Build.0 = Debug|Win32 - {44CE6D82-7320-4609-8FC3-5965C19F4808}.Release|Win32.ActiveCfg = Release|Win32 - {44CE6D82-7320-4609-8FC3-5965C19F4808}.Release|Win32.Build.0 = Release|Win32 - {44CE6D82-7320-4609-8FC3-5965C19F4808}.ReleaseForDownload|Win32.ActiveCfg = Release|Win32 - {44CE6D82-7320-4609-8FC3-5965C19F4808}.ReleaseForDownload|Win32.Build.0 = Release|Win32 - {44CE6D82-7320-4609-8FC3-5965C19F4808}.ReleaseNoOpt|Win32.ActiveCfg = ReleaseNoOpt|Win32 - {44CE6D82-7320-4609-8FC3-5965C19F4808}.ReleaseNoOpt|Win32.Build.0 = ReleaseNoOpt|Win32 - {D0FDC1C3-A589-40F2-ABCA-A84FF3835624}.Debug|Win32.ActiveCfg = Debug|Win32 - {D0FDC1C3-A589-40F2-ABCA-A84FF3835624}.Debug|Win32.Build.0 = Debug|Win32 - {D0FDC1C3-A589-40F2-ABCA-A84FF3835624}.DebugHk460|Win32.ActiveCfg = Debug|Win32 - {D0FDC1C3-A589-40F2-ABCA-A84FF3835624}.DebugHk460|Win32.Build.0 = Debug|Win32 - {D0FDC1C3-A589-40F2-ABCA-A84FF3835624}.DebugMesaHeadless|Win32.ActiveCfg = Debug|Win32 - {D0FDC1C3-A589-40F2-ABCA-A84FF3835624}.DebugMesaHeadless|Win32.Build.0 = Debug|Win32 - {D0FDC1C3-A589-40F2-ABCA-A84FF3835624}.Release|Win32.ActiveCfg = Release|Win32 - {D0FDC1C3-A589-40F2-ABCA-A84FF3835624}.Release|Win32.Build.0 = Release|Win32 - {D0FDC1C3-A589-40F2-ABCA-A84FF3835624}.ReleaseForDownload|Win32.ActiveCfg = Release|Win32 - {D0FDC1C3-A589-40F2-ABCA-A84FF3835624}.ReleaseForDownload|Win32.Build.0 = Release|Win32 - {D0FDC1C3-A589-40F2-ABCA-A84FF3835624}.ReleaseNoOpt|Win32.ActiveCfg = ReleaseNoOpt|Win32 - {C6CA76F5-DCB4-4789-BBA7-43D11EE7C8E2}.Debug|Win32.ActiveCfg = Debug|Win32 - {C6CA76F5-DCB4-4789-BBA7-43D11EE7C8E2}.Debug|Win32.Build.0 = Debug|Win32 - {C6CA76F5-DCB4-4789-BBA7-43D11EE7C8E2}.DebugHk460|Win32.ActiveCfg = Debug|Win32 - {C6CA76F5-DCB4-4789-BBA7-43D11EE7C8E2}.DebugHk460|Win32.Build.0 = Debug|Win32 - {C6CA76F5-DCB4-4789-BBA7-43D11EE7C8E2}.DebugMesaHeadless|Win32.ActiveCfg = Debug|Win32 - {C6CA76F5-DCB4-4789-BBA7-43D11EE7C8E2}.DebugMesaHeadless|Win32.Build.0 = Debug|Win32 - {C6CA76F5-DCB4-4789-BBA7-43D11EE7C8E2}.Release|Win32.ActiveCfg = Release|Win32 - {C6CA76F5-DCB4-4789-BBA7-43D11EE7C8E2}.Release|Win32.Build.0 = Release|Win32 - {C6CA76F5-DCB4-4789-BBA7-43D11EE7C8E2}.ReleaseForDownload|Win32.ActiveCfg = Release|Win32 - {C6CA76F5-DCB4-4789-BBA7-43D11EE7C8E2}.ReleaseForDownload|Win32.Build.0 = Release|Win32 - {C6CA76F5-DCB4-4789-BBA7-43D11EE7C8E2}.ReleaseNoOpt|Win32.ActiveCfg = ReleaseNoOpt|Win32 - {A5504A1E-8BA4-45D2-8144-1B6937E37E98}.Debug|Win32.ActiveCfg = Debug|Win32 - {A5504A1E-8BA4-45D2-8144-1B6937E37E98}.Debug|Win32.Build.0 = Debug|Win32 - {A5504A1E-8BA4-45D2-8144-1B6937E37E98}.DebugHk460|Win32.ActiveCfg = Debug|Win32 - {A5504A1E-8BA4-45D2-8144-1B6937E37E98}.DebugHk460|Win32.Build.0 = Debug|Win32 - {A5504A1E-8BA4-45D2-8144-1B6937E37E98}.DebugMesaHeadless|Win32.ActiveCfg = Debug|Win32 - {A5504A1E-8BA4-45D2-8144-1B6937E37E98}.DebugMesaHeadless|Win32.Build.0 = Debug|Win32 - {A5504A1E-8BA4-45D2-8144-1B6937E37E98}.Release|Win32.ActiveCfg = Release|Win32 - {A5504A1E-8BA4-45D2-8144-1B6937E37E98}.Release|Win32.Build.0 = Release|Win32 - {A5504A1E-8BA4-45D2-8144-1B6937E37E98}.ReleaseForDownload|Win32.ActiveCfg = Release|Win32 - {A5504A1E-8BA4-45D2-8144-1B6937E37E98}.ReleaseForDownload|Win32.Build.0 = Release|Win32 - {A5504A1E-8BA4-45D2-8144-1B6937E37E98}.ReleaseNoOpt|Win32.ActiveCfg = ReleaseNoOpt|Win32 - {777F38BE-2DFE-4051-9AAD-2832ABC474CC}.Debug|Win32.ActiveCfg = Debug|Win32 - {777F38BE-2DFE-4051-9AAD-2832ABC474CC}.Debug|Win32.Build.0 = Debug|Win32 - {777F38BE-2DFE-4051-9AAD-2832ABC474CC}.DebugHk460|Win32.ActiveCfg = Debug|Win32 - {777F38BE-2DFE-4051-9AAD-2832ABC474CC}.DebugHk460|Win32.Build.0 = Debug|Win32 - {777F38BE-2DFE-4051-9AAD-2832ABC474CC}.DebugMesaHeadless|Win32.ActiveCfg = Debug|Win32 - {777F38BE-2DFE-4051-9AAD-2832ABC474CC}.DebugMesaHeadless|Win32.Build.0 = Debug|Win32 - {777F38BE-2DFE-4051-9AAD-2832ABC474CC}.Release|Win32.ActiveCfg = Release|Win32 - {777F38BE-2DFE-4051-9AAD-2832ABC474CC}.Release|Win32.Build.0 = Release|Win32 - {777F38BE-2DFE-4051-9AAD-2832ABC474CC}.ReleaseForDownload|Win32.ActiveCfg = Release|Win32 - {777F38BE-2DFE-4051-9AAD-2832ABC474CC}.ReleaseNoOpt|Win32.ActiveCfg = Release|Win32 - {777F38BE-2DFE-4051-9AAD-2832ABC474CC}.ReleaseNoOpt|Win32.Build.0 = Release|Win32 - {EC2A989E-3F8F-4B8B-9AE6-7C7EA37C84BC}.Debug|Win32.ActiveCfg = Debug|Win32 - {EC2A989E-3F8F-4B8B-9AE6-7C7EA37C84BC}.Debug|Win32.Build.0 = Debug|Win32 - {EC2A989E-3F8F-4B8B-9AE6-7C7EA37C84BC}.DebugHk460|Win32.ActiveCfg = Debug|Win32 - {EC2A989E-3F8F-4B8B-9AE6-7C7EA37C84BC}.DebugHk460|Win32.Build.0 = Debug|Win32 - {EC2A989E-3F8F-4B8B-9AE6-7C7EA37C84BC}.DebugMesaHeadless|Win32.ActiveCfg = Debug|Win32 - {EC2A989E-3F8F-4B8B-9AE6-7C7EA37C84BC}.DebugMesaHeadless|Win32.Build.0 = Debug|Win32 - {EC2A989E-3F8F-4B8B-9AE6-7C7EA37C84BC}.Release|Win32.ActiveCfg = Release|Win32 - {EC2A989E-3F8F-4B8B-9AE6-7C7EA37C84BC}.Release|Win32.Build.0 = Release|Win32 - {EC2A989E-3F8F-4B8B-9AE6-7C7EA37C84BC}.ReleaseForDownload|Win32.ActiveCfg = Release|Win32 - {EC2A989E-3F8F-4B8B-9AE6-7C7EA37C84BC}.ReleaseNoOpt|Win32.ActiveCfg = Release|Win32 - {EC2A989E-3F8F-4B8B-9AE6-7C7EA37C84BC}.ReleaseNoOpt|Win32.Build.0 = Release|Win32 - {648685F3-8760-4CC5-BB2B-CAF9DECC25A4}.Debug|Win32.ActiveCfg = Debug|Win32 - {648685F3-8760-4CC5-BB2B-CAF9DECC25A4}.Debug|Win32.Build.0 = Debug|Win32 - {648685F3-8760-4CC5-BB2B-CAF9DECC25A4}.DebugHk460|Win32.ActiveCfg = Debug|Win32 - {648685F3-8760-4CC5-BB2B-CAF9DECC25A4}.DebugHk460|Win32.Build.0 = Debug|Win32 - {648685F3-8760-4CC5-BB2B-CAF9DECC25A4}.DebugMesaHeadless|Win32.ActiveCfg = Debug|Win32 - {648685F3-8760-4CC5-BB2B-CAF9DECC25A4}.DebugMesaHeadless|Win32.Build.0 = Debug|Win32 - {648685F3-8760-4CC5-BB2B-CAF9DECC25A4}.Release|Win32.ActiveCfg = Release|Win32 - {648685F3-8760-4CC5-BB2B-CAF9DECC25A4}.Release|Win32.Build.0 = Release|Win32 - {648685F3-8760-4CC5-BB2B-CAF9DECC25A4}.ReleaseForDownload|Win32.ActiveCfg = Release|Win32 - {648685F3-8760-4CC5-BB2B-CAF9DECC25A4}.ReleaseForDownload|Win32.Build.0 = Release|Win32 - {648685F3-8760-4CC5-BB2B-CAF9DECC25A4}.ReleaseNoOpt|Win32.ActiveCfg = ReleaseNoOpt|Win32 - {E928F33B-E090-4FA8-818B-6B5D8B0F1F4B}.Debug|Win32.ActiveCfg = Debug|Win32 - {E928F33B-E090-4FA8-818B-6B5D8B0F1F4B}.Debug|Win32.Build.0 = Debug|Win32 - {E928F33B-E090-4FA8-818B-6B5D8B0F1F4B}.DebugHk460|Win32.ActiveCfg = Debug|Win32 - {E928F33B-E090-4FA8-818B-6B5D8B0F1F4B}.DebugHk460|Win32.Build.0 = Debug|Win32 - {E928F33B-E090-4FA8-818B-6B5D8B0F1F4B}.DebugMesaHeadless|Win32.ActiveCfg = Debug|Win32 - {E928F33B-E090-4FA8-818B-6B5D8B0F1F4B}.DebugMesaHeadless|Win32.Build.0 = Debug|Win32 - {E928F33B-E090-4FA8-818B-6B5D8B0F1F4B}.Release|Win32.ActiveCfg = Release|Win32 - {E928F33B-E090-4FA8-818B-6B5D8B0F1F4B}.Release|Win32.Build.0 = Release|Win32 - {E928F33B-E090-4FA8-818B-6B5D8B0F1F4B}.ReleaseForDownload|Win32.ActiveCfg = Release|Win32 - {E928F33B-E090-4FA8-818B-6B5D8B0F1F4B}.ReleaseForDownload|Win32.Build.0 = Release|Win32 - {E928F33B-E090-4FA8-818B-6B5D8B0F1F4B}.ReleaseNoOpt|Win32.ActiveCfg = ReleaseNoOpt|Win32 - {E928F33B-E090-4FA8-818B-6B5D8B0F1F4B}.ReleaseNoOpt|Win32.Build.0 = ReleaseNoOpt|Win32 - {F56CA265-93E9-4068-8A67-8B104C876D70}.Debug|Win32.ActiveCfg = Debug|Win32 - {F56CA265-93E9-4068-8A67-8B104C876D70}.DebugHk460|Win32.ActiveCfg = Debug|Win32 - {F56CA265-93E9-4068-8A67-8B104C876D70}.DebugHk460|Win32.Build.0 = Debug|Win32 - {F56CA265-93E9-4068-8A67-8B104C876D70}.DebugMesaHeadless|Win32.ActiveCfg = Debug|Win32 - {F56CA265-93E9-4068-8A67-8B104C876D70}.DebugMesaHeadless|Win32.Build.0 = Debug|Win32 - {F56CA265-93E9-4068-8A67-8B104C876D70}.Release|Win32.ActiveCfg = Release|Win32 - {F56CA265-93E9-4068-8A67-8B104C876D70}.ReleaseForDownload|Win32.ActiveCfg = Release|Win32 - {F56CA265-93E9-4068-8A67-8B104C876D70}.ReleaseNoOpt|Win32.ActiveCfg = ReleaseNoOpt|Win32 - {9D0C7E02-6506-4EE7-BC5C-75671D28D594}.Debug|Win32.ActiveCfg = Debug|Win32 - {9D0C7E02-6506-4EE7-BC5C-75671D28D594}.Debug|Win32.Build.0 = Debug|Win32 - {9D0C7E02-6506-4EE7-BC5C-75671D28D594}.DebugHk460|Win32.ActiveCfg = Debug|Win32 - {9D0C7E02-6506-4EE7-BC5C-75671D28D594}.DebugHk460|Win32.Build.0 = Debug|Win32 - {9D0C7E02-6506-4EE7-BC5C-75671D28D594}.DebugMesaHeadless|Win32.ActiveCfg = Debug|Win32 - {9D0C7E02-6506-4EE7-BC5C-75671D28D594}.DebugMesaHeadless|Win32.Build.0 = Debug|Win32 - {9D0C7E02-6506-4EE7-BC5C-75671D28D594}.Release|Win32.ActiveCfg = Release|Win32 - {9D0C7E02-6506-4EE7-BC5C-75671D28D594}.Release|Win32.Build.0 = Release|Win32 - {9D0C7E02-6506-4EE7-BC5C-75671D28D594}.ReleaseForDownload|Win32.ActiveCfg = Release|Win32 - {9D0C7E02-6506-4EE7-BC5C-75671D28D594}.ReleaseForDownload|Win32.Build.0 = Release|Win32 - {9D0C7E02-6506-4EE7-BC5C-75671D28D594}.ReleaseNoOpt|Win32.ActiveCfg = ReleaseNoOpt|Win32 - {9D0C7E02-6506-4EE7-BC5C-75671D28D594}.ReleaseNoOpt|Win32.Build.0 = ReleaseNoOpt|Win32 - {4B19F64E-AB97-4FB9-8E1D-74A8104DE0C4}.Debug|Win32.ActiveCfg = Debug|Win32 - {4B19F64E-AB97-4FB9-8E1D-74A8104DE0C4}.Debug|Win32.Build.0 = Debug|Win32 - {4B19F64E-AB97-4FB9-8E1D-74A8104DE0C4}.DebugHk460|Win32.ActiveCfg = Debug|Win32 - {4B19F64E-AB97-4FB9-8E1D-74A8104DE0C4}.DebugHk460|Win32.Build.0 = Debug|Win32 - {4B19F64E-AB97-4FB9-8E1D-74A8104DE0C4}.DebugMesaHeadless|Win32.ActiveCfg = Debug|Win32 - {4B19F64E-AB97-4FB9-8E1D-74A8104DE0C4}.DebugMesaHeadless|Win32.Build.0 = Debug|Win32 - {4B19F64E-AB97-4FB9-8E1D-74A8104DE0C4}.Release|Win32.ActiveCfg = Release|Win32 - {4B19F64E-AB97-4FB9-8E1D-74A8104DE0C4}.Release|Win32.Build.0 = Release|Win32 - {4B19F64E-AB97-4FB9-8E1D-74A8104DE0C4}.ReleaseForDownload|Win32.ActiveCfg = Release|Win32 - {4B19F64E-AB97-4FB9-8E1D-74A8104DE0C4}.ReleaseForDownload|Win32.Build.0 = Release|Win32 - {4B19F64E-AB97-4FB9-8E1D-74A8104DE0C4}.ReleaseNoOpt|Win32.ActiveCfg = ReleaseNoOpt|Win32 - {4B19F64E-AB97-4FB9-8E1D-74A8104DE0C4}.ReleaseNoOpt|Win32.Build.0 = ReleaseNoOpt|Win32 - {BBAA6588-CA96-4A87-A988-B02270B8D02B}.Debug|Win32.ActiveCfg = Debug|Win32 - {BBAA6588-CA96-4A87-A988-B02270B8D02B}.Debug|Win32.Build.0 = Debug|Win32 - {BBAA6588-CA96-4A87-A988-B02270B8D02B}.DebugHk460|Win32.ActiveCfg = Debug|Win32 - {BBAA6588-CA96-4A87-A988-B02270B8D02B}.DebugHk460|Win32.Build.0 = Debug|Win32 - {BBAA6588-CA96-4A87-A988-B02270B8D02B}.DebugMesaHeadless|Win32.ActiveCfg = Debug|Win32 - {BBAA6588-CA96-4A87-A988-B02270B8D02B}.DebugMesaHeadless|Win32.Build.0 = Debug|Win32 - {BBAA6588-CA96-4A87-A988-B02270B8D02B}.Release|Win32.ActiveCfg = Release|Win32 - {BBAA6588-CA96-4A87-A988-B02270B8D02B}.Release|Win32.Build.0 = Release|Win32 - {BBAA6588-CA96-4A87-A988-B02270B8D02B}.ReleaseForDownload|Win32.ActiveCfg = Release|Win32 - {BBAA6588-CA96-4A87-A988-B02270B8D02B}.ReleaseNoOpt|Win32.ActiveCfg = ReleaseNoOpt|Win32 - {BBAA6588-CA96-4A87-A988-B02270B8D02B}.ReleaseNoOpt|Win32.Build.0 = ReleaseNoOpt|Win32 - {E9F5BD55-F8E8-4C61-B9B5-CCE7C1048241}.Debug|Win32.ActiveCfg = Debug|Win32 - {E9F5BD55-F8E8-4C61-B9B5-CCE7C1048241}.Debug|Win32.Build.0 = Debug|Win32 - {E9F5BD55-F8E8-4C61-B9B5-CCE7C1048241}.DebugHk460|Win32.ActiveCfg = Debug|Win32 - {E9F5BD55-F8E8-4C61-B9B5-CCE7C1048241}.DebugHk460|Win32.Build.0 = Debug|Win32 - {E9F5BD55-F8E8-4C61-B9B5-CCE7C1048241}.DebugMesaHeadless|Win32.ActiveCfg = Debug|Win32 - {E9F5BD55-F8E8-4C61-B9B5-CCE7C1048241}.DebugMesaHeadless|Win32.Build.0 = Debug|Win32 - {E9F5BD55-F8E8-4C61-B9B5-CCE7C1048241}.Release|Win32.ActiveCfg = Release|Win32 - {E9F5BD55-F8E8-4C61-B9B5-CCE7C1048241}.Release|Win32.Build.0 = Release|Win32 - {E9F5BD55-F8E8-4C61-B9B5-CCE7C1048241}.ReleaseForDownload|Win32.ActiveCfg = Release|Win32 - {E9F5BD55-F8E8-4C61-B9B5-CCE7C1048241}.ReleaseForDownload|Win32.Build.0 = Release|Win32 - {E9F5BD55-F8E8-4C61-B9B5-CCE7C1048241}.ReleaseNoOpt|Win32.ActiveCfg = ReleaseNoOpt|Win32 - {E9F5BD55-F8E8-4C61-B9B5-CCE7C1048241}.ReleaseNoOpt|Win32.Build.0 = ReleaseNoOpt|Win32 - {6AEE004D-BFE8-4082-B4D3-E51163B01EEB}.Debug|Win32.ActiveCfg = Debug|Win32 - {6AEE004D-BFE8-4082-B4D3-E51163B01EEB}.Debug|Win32.Build.0 = Debug|Win32 - {6AEE004D-BFE8-4082-B4D3-E51163B01EEB}.DebugHk460|Win32.ActiveCfg = Debug|Win32 - {6AEE004D-BFE8-4082-B4D3-E51163B01EEB}.DebugHk460|Win32.Build.0 = Debug|Win32 - {6AEE004D-BFE8-4082-B4D3-E51163B01EEB}.DebugMesaHeadless|Win32.ActiveCfg = Debug|Win32 - {6AEE004D-BFE8-4082-B4D3-E51163B01EEB}.DebugMesaHeadless|Win32.Build.0 = Debug|Win32 - {6AEE004D-BFE8-4082-B4D3-E51163B01EEB}.Release|Win32.ActiveCfg = Release|Win32 - {6AEE004D-BFE8-4082-B4D3-E51163B01EEB}.Release|Win32.Build.0 = Release|Win32 - {6AEE004D-BFE8-4082-B4D3-E51163B01EEB}.ReleaseForDownload|Win32.ActiveCfg = Release|Win32 - {6AEE004D-BFE8-4082-B4D3-E51163B01EEB}.ReleaseForDownload|Win32.Build.0 = Release|Win32 - {6AEE004D-BFE8-4082-B4D3-E51163B01EEB}.ReleaseNoOpt|Win32.ActiveCfg = ReleaseNoOpt|Win32 - {6AEE004D-BFE8-4082-B4D3-E51163B01EEB}.ReleaseNoOpt|Win32.Build.0 = ReleaseNoOpt|Win32 - {076DD042-2E58-42EA-9401-53210B65C1FC}.Debug|Win32.ActiveCfg = Debug|Win32 - {076DD042-2E58-42EA-9401-53210B65C1FC}.Debug|Win32.Build.0 = Debug|Win32 - {076DD042-2E58-42EA-9401-53210B65C1FC}.DebugHk460|Win32.ActiveCfg = Debug|Win32 - {076DD042-2E58-42EA-9401-53210B65C1FC}.DebugHk460|Win32.Build.0 = Debug|Win32 - {076DD042-2E58-42EA-9401-53210B65C1FC}.DebugMesaHeadless|Win32.ActiveCfg = Debug|Win32 - {076DD042-2E58-42EA-9401-53210B65C1FC}.DebugMesaHeadless|Win32.Build.0 = Debug|Win32 - {076DD042-2E58-42EA-9401-53210B65C1FC}.Release|Win32.ActiveCfg = Release|Win32 - {076DD042-2E58-42EA-9401-53210B65C1FC}.Release|Win32.Build.0 = Release|Win32 - {076DD042-2E58-42EA-9401-53210B65C1FC}.ReleaseForDownload|Win32.ActiveCfg = Release|Win32 - {076DD042-2E58-42EA-9401-53210B65C1FC}.ReleaseForDownload|Win32.Build.0 = Release|Win32 - {076DD042-2E58-42EA-9401-53210B65C1FC}.ReleaseNoOpt|Win32.ActiveCfg = ReleaseNoOpt|Win32 - {076DD042-2E58-42EA-9401-53210B65C1FC}.ReleaseNoOpt|Win32.Build.0 = ReleaseNoOpt|Win32 - {AF2D801E-EEE7-4B52-A025-F8E648ADC34B}.Debug|Win32.ActiveCfg = Debug|Win32 - {AF2D801E-EEE7-4B52-A025-F8E648ADC34B}.Debug|Win32.Build.0 = Debug|Win32 - {AF2D801E-EEE7-4B52-A025-F8E648ADC34B}.DebugHk460|Win32.ActiveCfg = Debug|Win32 - {AF2D801E-EEE7-4B52-A025-F8E648ADC34B}.DebugHk460|Win32.Build.0 = Debug|Win32 - {AF2D801E-EEE7-4B52-A025-F8E648ADC34B}.DebugMesaHeadless|Win32.ActiveCfg = Debug|Win32 - {AF2D801E-EEE7-4B52-A025-F8E648ADC34B}.DebugMesaHeadless|Win32.Build.0 = Debug|Win32 - {AF2D801E-EEE7-4B52-A025-F8E648ADC34B}.Release|Win32.ActiveCfg = Release|Win32 - {AF2D801E-EEE7-4B52-A025-F8E648ADC34B}.Release|Win32.Build.0 = Release|Win32 - {AF2D801E-EEE7-4B52-A025-F8E648ADC34B}.ReleaseForDownload|Win32.ActiveCfg = Release|Win32 - {AF2D801E-EEE7-4B52-A025-F8E648ADC34B}.ReleaseForDownload|Win32.Build.0 = Release|Win32 - {AF2D801E-EEE7-4B52-A025-F8E648ADC34B}.ReleaseNoOpt|Win32.ActiveCfg = ReleaseNoOpt|Win32 - {AF2D801E-EEE7-4B52-A025-F8E648ADC34B}.ReleaseNoOpt|Win32.Build.0 = ReleaseNoOpt|Win32 - {4C8D64D5-649F-481E-96BE-EF1E82A77ACB}.Debug|Win32.ActiveCfg = Debug|Win32 - {4C8D64D5-649F-481E-96BE-EF1E82A77ACB}.Debug|Win32.Build.0 = Debug|Win32 - {4C8D64D5-649F-481E-96BE-EF1E82A77ACB}.DebugHk460|Win32.ActiveCfg = Debug|Win32 - {4C8D64D5-649F-481E-96BE-EF1E82A77ACB}.DebugHk460|Win32.Build.0 = Debug|Win32 - {4C8D64D5-649F-481E-96BE-EF1E82A77ACB}.DebugMesaHeadless|Win32.ActiveCfg = Debug|Win32 - {4C8D64D5-649F-481E-96BE-EF1E82A77ACB}.DebugMesaHeadless|Win32.Build.0 = Debug|Win32 - {4C8D64D5-649F-481E-96BE-EF1E82A77ACB}.Release|Win32.ActiveCfg = Release|Win32 - {4C8D64D5-649F-481E-96BE-EF1E82A77ACB}.Release|Win32.Build.0 = Release|Win32 - {4C8D64D5-649F-481E-96BE-EF1E82A77ACB}.ReleaseForDownload|Win32.ActiveCfg = Release|Win32 - {4C8D64D5-649F-481E-96BE-EF1E82A77ACB}.ReleaseForDownload|Win32.Build.0 = Release|Win32 - {4C8D64D5-649F-481E-96BE-EF1E82A77ACB}.ReleaseNoOpt|Win32.ActiveCfg = ReleaseNoOpt|Win32 - {4C8D64D5-649F-481E-96BE-EF1E82A77ACB}.ReleaseNoOpt|Win32.Build.0 = ReleaseNoOpt|Win32 - {B771CF1B-E253-47BD-8B0A-6B0440CC9228}.Debug|Win32.ActiveCfg = Debug|Win32 - {B771CF1B-E253-47BD-8B0A-6B0440CC9228}.Debug|Win32.Build.0 = Debug|Win32 - {B771CF1B-E253-47BD-8B0A-6B0440CC9228}.DebugHk460|Win32.ActiveCfg = Debug|Win32 - {B771CF1B-E253-47BD-8B0A-6B0440CC9228}.DebugHk460|Win32.Build.0 = Debug|Win32 - {B771CF1B-E253-47BD-8B0A-6B0440CC9228}.DebugMesaHeadless|Win32.ActiveCfg = Debug|Win32 - {B771CF1B-E253-47BD-8B0A-6B0440CC9228}.DebugMesaHeadless|Win32.Build.0 = Debug|Win32 - {B771CF1B-E253-47BD-8B0A-6B0440CC9228}.Release|Win32.ActiveCfg = Release|Win32 - {B771CF1B-E253-47BD-8B0A-6B0440CC9228}.Release|Win32.Build.0 = Release|Win32 - {B771CF1B-E253-47BD-8B0A-6B0440CC9228}.ReleaseForDownload|Win32.ActiveCfg = Release|Win32 - {B771CF1B-E253-47BD-8B0A-6B0440CC9228}.ReleaseForDownload|Win32.Build.0 = Release|Win32 - {B771CF1B-E253-47BD-8B0A-6B0440CC9228}.ReleaseNoOpt|Win32.ActiveCfg = Release|Win32 - {B771CF1B-E253-47BD-8B0A-6B0440CC9228}.ReleaseNoOpt|Win32.Build.0 = Release|Win32 - {020311F7-3DAB-4D93-9CE5-6D3926FD15FE}.Debug|Win32.ActiveCfg = Debug|Win32 - {020311F7-3DAB-4D93-9CE5-6D3926FD15FE}.Debug|Win32.Build.0 = Debug|Win32 - {020311F7-3DAB-4D93-9CE5-6D3926FD15FE}.DebugHk460|Win32.ActiveCfg = DebugHk460|Win32 - {020311F7-3DAB-4D93-9CE5-6D3926FD15FE}.DebugHk460|Win32.Build.0 = DebugHk460|Win32 - {020311F7-3DAB-4D93-9CE5-6D3926FD15FE}.DebugMesaHeadless|Win32.ActiveCfg = DebugHk460|Win32 - {020311F7-3DAB-4D93-9CE5-6D3926FD15FE}.DebugMesaHeadless|Win32.Build.0 = DebugHk460|Win32 - {020311F7-3DAB-4D93-9CE5-6D3926FD15FE}.Release|Win32.ActiveCfg = Release|Win32 - {020311F7-3DAB-4D93-9CE5-6D3926FD15FE}.Release|Win32.Build.0 = Release|Win32 - {020311F7-3DAB-4D93-9CE5-6D3926FD15FE}.ReleaseForDownload|Win32.ActiveCfg = Release|Win32 - {020311F7-3DAB-4D93-9CE5-6D3926FD15FE}.ReleaseForDownload|Win32.Build.0 = Release|Win32 - {020311F7-3DAB-4D93-9CE5-6D3926FD15FE}.ReleaseNoOpt|Win32.ActiveCfg = ReleaseNoOpt|Win32 - {020311F7-3DAB-4D93-9CE5-6D3926FD15FE}.ReleaseNoOpt|Win32.Build.0 = ReleaseNoOpt|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/linden/indra/indra_complete/indra_complete_vc9.sln b/linden/indra/indra_complete/indra_complete_vc9.sln deleted file mode 100644 index 3ef987d..0000000 --- a/linden/indra/indra_complete/indra_complete_vc9.sln +++ /dev/null @@ -1,621 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual C++ Express 2008 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "llcommon", "..\llcommon\llcommon_vc9.vcproj", "{7BCB4B2C-8378-4186-88EA-5742B5ABE17F}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "llmath", "..\llmath\llmath_vc9.vcproj", "{E87FD9BE-BE42-4EA3-BF4D-D992223046D9}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "llmessage", "..\llmessage\llmessage_vc9.vcproj", "{E5D94794-5671-4BD6-A16D-26EC18F3DB34}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "llvfs", "..\llvfs\llvfs_vc9.vcproj", "{D37774F4-253D-4760-BF64-372A943224A1}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "llxml", "..\llxml\llxml_vc9.vcproj", "{A5470DA6-0C3A-4602-B930-43DB25511A59}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "llui", "..\llui\llui_vc9.vcproj", "{DE55D666-6A3D-476C-937F-109269B83681}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "llimage", "..\llimage\llimage_vc9.vcproj", "{681FDD6C-2FAE-4CB9-AF6D-B952F2B151C5}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "llprimitive", "..\llprimitive\llprimitive_vc9.vcproj", "{FCC4483C-5B84-4944-B91F-4589A219BC0B}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "llcharacter", "..\llcharacter\llcharacter_vc9.vcproj", "{5EA5DDF0-C7E1-4F49-BEF5-9246A4656B2E}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "llaudio", "..\llaudio\llaudio_vc9.vcproj", "{93B2BA29-FBE9-4376-92C1-6108DCFE09D3}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "llrender", "..\llrender\llrender_vc9.vcproj", "{2ADE3C14-94C4-40BF-B033-70F3C954EE90}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "llinventory", "..\llinventory\llinventory_vc9.vcproj", "{328D1968-924F-4863-AAE8-5F9A95BA68E5}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "newview", "..\newview\newview_vc9.vcproj", "{E6F4CF1B-6109-4CA8-B58D-87FA936CDE08}" - ProjectSection(ProjectDependencies) = postProject - {9D0C7E02-6506-4EE7-BC5C-75671D28D594} = {9D0C7E02-6506-4EE7-BC5C-75671D28D594} - {2ADE3C14-94C4-40BF-B033-70F3C954EE90} = {2ADE3C14-94C4-40BF-B033-70F3C954EE90} - {B5B53617-416F-404A-BF10-22EBCCA0E4FB} = {B5B53617-416F-404A-BF10-22EBCCA0E4FB} - {93B2BA29-FBE9-4376-92C1-6108DCFE09D3} = {93B2BA29-FBE9-4376-92C1-6108DCFE09D3} - {7BCB4B2C-8378-4186-88EA-5742B5ABE17F} = {7BCB4B2C-8378-4186-88EA-5742B5ABE17F} - {E928F33B-E090-4FA8-818B-6B5D8B0F1F4B} = {E928F33B-E090-4FA8-818B-6B5D8B0F1F4B} - {FCC4483C-5B84-4944-B91F-4589A219BC0B} = {FCC4483C-5B84-4944-B91F-4589A219BC0B} - {F882263E-4F2A-43D9-A45A-FA4C8EC66552} = {F882263E-4F2A-43D9-A45A-FA4C8EC66552} - {076DD042-2E58-42EA-9401-53210B65C1FC} = {076DD042-2E58-42EA-9401-53210B65C1FC} - {DE55D666-6A3D-476C-937F-109269B83681} = {DE55D666-6A3D-476C-937F-109269B83681} - {328D1968-924F-4863-AAE8-5F9A95BA68E5} = {328D1968-924F-4863-AAE8-5F9A95BA68E5} - {681FDD6C-2FAE-4CB9-AF6D-B952F2B151C5} = {681FDD6C-2FAE-4CB9-AF6D-B952F2B151C5} - {44CE6D82-7320-4609-8FC3-5965C19F4808} = {44CE6D82-7320-4609-8FC3-5965C19F4808} - {E5D94794-5671-4BD6-A16D-26EC18F3DB34} = {E5D94794-5671-4BD6-A16D-26EC18F3DB34} - {A5470DA6-0C3A-4602-B930-43DB25511A59} = {A5470DA6-0C3A-4602-B930-43DB25511A59} - {BFA102B0-C891-4E13-B1CF-C2F28073DA8E} = {BFA102B0-C891-4E13-B1CF-C2F28073DA8E} - {E87FD9BE-BE42-4EA3-BF4D-D992223046D9} = {E87FD9BE-BE42-4EA3-BF4D-D992223046D9} - {4C8D64D5-649F-481E-96BE-EF1E82A77ACB} = {4C8D64D5-649F-481E-96BE-EF1E82A77ACB} - {5EA5DDF0-C7E1-4F49-BEF5-9246A4656B2E} = {5EA5DDF0-C7E1-4F49-BEF5-9246A4656B2E} - {648685F3-8760-4CC5-BB2B-CAF9DECC25A4} = {648685F3-8760-4CC5-BB2B-CAF9DECC25A4} - {D37774F4-253D-4760-BF64-372A943224A1} = {D37774F4-253D-4760-BF64-372A943224A1} - EndProjectSection -EndProject -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "llwindow", "..\llwindow\llwindow_vc9.vcproj", "{B5B53617-416F-404A-BF10-22EBCCA0E4FB}" - ProjectSection(ProjectDependencies) = postProject - {A5470DA6-0C3A-4602-B930-43DB25511A59} = {A5470DA6-0C3A-4602-B930-43DB25511A59} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lscript_library", "..\lscript\lscript_library\lscript_library_vc9.vcproj", "{BFA102B0-C891-4E13-B1CF-C2F28073DA8E}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lscript_execute", "..\lscript\lscript_execute\lscript_execute_vc9.vcproj", "{F882263E-4F2A-43D9-A45A-FA4C8EC66552}" - ProjectSection(ProjectDependencies) = postProject - {BFA102B0-C891-4E13-B1CF-C2F28073DA8E} = {BFA102B0-C891-4E13-B1CF-C2F28073DA8E} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lscript_compile", "..\lscript\lscript_compile\lscript_compile_vc9.vcproj", "{44CE6D82-7320-4609-8FC3-5965C19F4808}" - ProjectSection(ProjectDependencies) = postProject - {B771CF1B-E253-47BD-8B0A-6B0440CC9228} = {B771CF1B-E253-47BD-8B0A-6B0440CC9228} - {BFA102B0-C891-4E13-B1CF-C2F28073DA8E} = {BFA102B0-C891-4E13-B1CF-C2F28073DA8E} - EndProjectSection -EndProject - ProjectSection(ProjectDependencies) = postProject - {7BCB4B2C-8378-4186-88EA-5742B5ABE17F} = {7BCB4B2C-8378-4186-88EA-5742B5ABE17F} - {FCC4483C-5B84-4944-B91F-4589A219BC0B} = {FCC4483C-5B84-4944-B91F-4589A219BC0B} - {F882263E-4F2A-43D9-A45A-FA4C8EC66552} = {F882263E-4F2A-43D9-A45A-FA4C8EC66552} - {4B19F64E-AB97-4FB9-8E1D-74A8104DE0C4} = {4B19F64E-AB97-4FB9-8E1D-74A8104DE0C4} - {328D1968-924F-4863-AAE8-5F9A95BA68E5} = {328D1968-924F-4863-AAE8-5F9A95BA68E5} - {681FDD6C-2FAE-4CB9-AF6D-B952F2B151C5} = {681FDD6C-2FAE-4CB9-AF6D-B952F2B151C5} - {44CE6D82-7320-4609-8FC3-5965C19F4808} = {44CE6D82-7320-4609-8FC3-5965C19F4808} - {E5D94794-5671-4BD6-A16D-26EC18F3DB34} = {E5D94794-5671-4BD6-A16D-26EC18F3DB34} - {A5470DA6-0C3A-4602-B930-43DB25511A59} = {A5470DA6-0C3A-4602-B930-43DB25511A59} - {BFA102B0-C891-4E13-B1CF-C2F28073DA8E} = {BFA102B0-C891-4E13-B1CF-C2F28073DA8E} - {E87FD9BE-BE42-4EA3-BF4D-D992223046D9} = {E87FD9BE-BE42-4EA3-BF4D-D992223046D9} - {B4B838C7-2C72-428E-BBFD-25764E659A8B} = {B4B838C7-2C72-428E-BBFD-25764E659A8B} - {5EA5DDF0-C7E1-4F49-BEF5-9246A4656B2E} = {5EA5DDF0-C7E1-4F49-BEF5-9246A4656B2E} - {D37774F4-253D-4760-BF64-372A943224A1} = {D37774F4-253D-4760-BF64-372A943224A1} - {020311F7-3DAB-4D93-9CE5-6D3926FD15FE} = {020311F7-3DAB-4D93-9CE5-6D3926FD15FE} - EndProjectSection -EndProject - ProjectSection(ProjectDependencies) = postProject - {7BCB4B2C-8378-4186-88EA-5742B5ABE17F} = {7BCB4B2C-8378-4186-88EA-5742B5ABE17F} - {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 - {7BCB4B2C-8378-4186-88EA-5742B5ABE17F} = {7BCB4B2C-8378-4186-88EA-5742B5ABE17F} - {4B19F64E-AB97-4FB9-8E1D-74A8104DE0C4} = {4B19F64E-AB97-4FB9-8E1D-74A8104DE0C4} - {328D1968-924F-4863-AAE8-5F9A95BA68E5} = {328D1968-924F-4863-AAE8-5F9A95BA68E5} - {E5D94794-5671-4BD6-A16D-26EC18F3DB34} = {E5D94794-5671-4BD6-A16D-26EC18F3DB34} - {A5470DA6-0C3A-4602-B930-43DB25511A59} = {A5470DA6-0C3A-4602-B930-43DB25511A59} - {E87FD9BE-BE42-4EA3-BF4D-D992223046D9} = {E87FD9BE-BE42-4EA3-BF4D-D992223046D9} - {B4B838C7-2C72-428E-BBFD-25764E659A8B} = {B4B838C7-2C72-428E-BBFD-25764E659A8B} - {5EA5DDF0-C7E1-4F49-BEF5-9246A4656B2E} = {5EA5DDF0-C7E1-4F49-BEF5-9246A4656B2E} - {D37774F4-253D-4760-BF64-372A943224A1} = {D37774F4-253D-4760-BF64-372A943224A1} - EndProjectSection -EndProject - ProjectSection(ProjectDependencies) = postProject - {44CE6D82-7320-4609-8FC3-5965C19F4808} = {44CE6D82-7320-4609-8FC3-5965C19F4808} - EndProjectSection -EndProject - ProjectSection(ProjectDependencies) = postProject - {F882263E-4F2A-43D9-A45A-FA4C8EC66552} = {F882263E-4F2A-43D9-A45A-FA4C8EC66552} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "win_crash_logger", "..\win_crash_logger\win_crash_logger_vc9.vcproj", "{648685F3-8760-4CC5-BB2B-CAF9DECC25A4}" - ProjectSection(ProjectDependencies) = postProject - {B5B53617-416F-404A-BF10-22EBCCA0E4FB} = {B5B53617-416F-404A-BF10-22EBCCA0E4FB} - {7BCB4B2C-8378-4186-88EA-5742B5ABE17F} = {7BCB4B2C-8378-4186-88EA-5742B5ABE17F} - {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 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "win_updater", "..\win_updater\win_updater_vc9.vcproj", "{E928F33B-E090-4FA8-818B-6B5D8B0F1F4B}" -EndProject - ProjectSection(ProjectDependencies) = postProject - {7BCB4B2C-8378-4186-88EA-5742B5ABE17F} = {7BCB4B2C-8378-4186-88EA-5742B5ABE17F} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "llmedia", "..\llmedia\llmedia_vc9.vcproj", "{9D0C7E02-6506-4EE7-BC5C-75671D28D594}" -EndProject -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test", "..\test\test_vc9.vcproj", "{BBAA6588-CA96-4A87-A988-B02270B8D02B}" - ProjectSection(ProjectDependencies) = postProject - {7BCB4B2C-8378-4186-88EA-5742B5ABE17F} = {7BCB4B2C-8378-4186-88EA-5742B5ABE17F} - {FCC4483C-5B84-4944-B91F-4589A219BC0B} = {FCC4483C-5B84-4944-B91F-4589A219BC0B} - {F882263E-4F2A-43D9-A45A-FA4C8EC66552} = {F882263E-4F2A-43D9-A45A-FA4C8EC66552} - {4B19F64E-AB97-4FB9-8E1D-74A8104DE0C4} = {4B19F64E-AB97-4FB9-8E1D-74A8104DE0C4} - {328D1968-924F-4863-AAE8-5F9A95BA68E5} = {328D1968-924F-4863-AAE8-5F9A95BA68E5} - {44CE6D82-7320-4609-8FC3-5965C19F4808} = {44CE6D82-7320-4609-8FC3-5965C19F4808} - {E5D94794-5671-4BD6-A16D-26EC18F3DB34} = {E5D94794-5671-4BD6-A16D-26EC18F3DB34} - {EC2A989E-3F8F-4B8B-9AE6-7C7EA37C84BC} = {EC2A989E-3F8F-4B8B-9AE6-7C7EA37C84BC} - {A5470DA6-0C3A-4602-B930-43DB25511A59} = {A5470DA6-0C3A-4602-B930-43DB25511A59} - {BFA102B0-C891-4E13-B1CF-C2F28073DA8E} = {BFA102B0-C891-4E13-B1CF-C2F28073DA8E} - {777F38BE-2DFE-4051-9AAD-2832ABC474CC} = {777F38BE-2DFE-4051-9AAD-2832ABC474CC} - {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 - {2ADE3C14-94C4-40BF-B033-70F3C954EE90} = {2ADE3C14-94C4-40BF-B033-70F3C954EE90} - {B5B53617-416F-404A-BF10-22EBCCA0E4FB} = {B5B53617-416F-404A-BF10-22EBCCA0E4FB} - {AF2D801E-EEE7-4B52-A025-F8E648ADC34B} = {AF2D801E-EEE7-4B52-A025-F8E648ADC34B} - {7BCB4B2C-8378-4186-88EA-5742B5ABE17F} = {7BCB4B2C-8378-4186-88EA-5742B5ABE17F} - {FCC4483C-5B84-4944-B91F-4589A219BC0B} = {FCC4483C-5B84-4944-B91F-4589A219BC0B} - {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 -EndProject - ProjectSection(ProjectDependencies) = postProject - {7BCB4B2C-8378-4186-88EA-5742B5ABE17F} = {7BCB4B2C-8378-4186-88EA-5742B5ABE17F} - {681FDD6C-2FAE-4CB9-AF6D-B952F2B151C5} = {681FDD6C-2FAE-4CB9-AF6D-B952F2B151C5} - {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 - {7BCB4B2C-8378-4186-88EA-5742B5ABE17F} = {7BCB4B2C-8378-4186-88EA-5742B5ABE17F} - {681FDD6C-2FAE-4CB9-AF6D-B952F2B151C5} = {681FDD6C-2FAE-4CB9-AF6D-B952F2B151C5} - {E87FD9BE-BE42-4EA3-BF4D-D992223046D9} = {E87FD9BE-BE42-4EA3-BF4D-D992223046D9} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "llimagej2coj", "..\llimagej2coj\llimagej2coj_vc9.vcproj", "{4C8D64D5-649F-481E-96BE-EF1E82A77ACB}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lscript_compile_fb_vc8", "..\lscript\lscript_compile\lscript_compile_fb_vc9.vcproj", "{B771CF1B-E253-47BD-8B0A-6B0440CC9228}" -EndProject -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - DebugHk460|Win32 = DebugHk460|Win32 - DebugMesaHeadless|Win32 = DebugMesaHeadless|Win32 - Release|Win32 = Release|Win32 - ReleaseForDownload|Win32 = ReleaseForDownload|Win32 - ReleaseNoOpt|Win32 = ReleaseNoOpt|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {7BCB4B2C-8378-4186-88EA-5742B5ABE17F}.Debug|Win32.ActiveCfg = Debug|Win32 - {7BCB4B2C-8378-4186-88EA-5742B5ABE17F}.Debug|Win32.Build.0 = Debug|Win32 - {7BCB4B2C-8378-4186-88EA-5742B5ABE17F}.DebugHk460|Win32.ActiveCfg = Debug|Win32 - {7BCB4B2C-8378-4186-88EA-5742B5ABE17F}.DebugHk460|Win32.Build.0 = Debug|Win32 - {7BCB4B2C-8378-4186-88EA-5742B5ABE17F}.DebugMesaHeadless|Win32.ActiveCfg = Debug|Win32 - {7BCB4B2C-8378-4186-88EA-5742B5ABE17F}.DebugMesaHeadless|Win32.Build.0 = Debug|Win32 - {7BCB4B2C-8378-4186-88EA-5742B5ABE17F}.Release|Win32.ActiveCfg = Release|Win32 - {7BCB4B2C-8378-4186-88EA-5742B5ABE17F}.Release|Win32.Build.0 = Release|Win32 - {7BCB4B2C-8378-4186-88EA-5742B5ABE17F}.ReleaseForDownload|Win32.ActiveCfg = Release|Win32 - {7BCB4B2C-8378-4186-88EA-5742B5ABE17F}.ReleaseForDownload|Win32.Build.0 = Release|Win32 - {7BCB4B2C-8378-4186-88EA-5742B5ABE17F}.ReleaseNoOpt|Win32.ActiveCfg = ReleaseNoOpt|Win32 - {7BCB4B2C-8378-4186-88EA-5742B5ABE17F}.ReleaseNoOpt|Win32.Build.0 = ReleaseNoOpt|Win32 - {E87FD9BE-BE42-4EA3-BF4D-D992223046D9}.Debug|Win32.ActiveCfg = Debug|Win32 - {E87FD9BE-BE42-4EA3-BF4D-D992223046D9}.Debug|Win32.Build.0 = Debug|Win32 - {E87FD9BE-BE42-4EA3-BF4D-D992223046D9}.DebugHk460|Win32.ActiveCfg = Debug|Win32 - {E87FD9BE-BE42-4EA3-BF4D-D992223046D9}.DebugHk460|Win32.Build.0 = Debug|Win32 - {E87FD9BE-BE42-4EA3-BF4D-D992223046D9}.DebugMesaHeadless|Win32.ActiveCfg = Debug|Win32 - {E87FD9BE-BE42-4EA3-BF4D-D992223046D9}.DebugMesaHeadless|Win32.Build.0 = Debug|Win32 - {E87FD9BE-BE42-4EA3-BF4D-D992223046D9}.Release|Win32.ActiveCfg = Release|Win32 - {E87FD9BE-BE42-4EA3-BF4D-D992223046D9}.Release|Win32.Build.0 = Release|Win32 - {E87FD9BE-BE42-4EA3-BF4D-D992223046D9}.ReleaseForDownload|Win32.ActiveCfg = Release|Win32 - {E87FD9BE-BE42-4EA3-BF4D-D992223046D9}.ReleaseForDownload|Win32.Build.0 = Release|Win32 - {E87FD9BE-BE42-4EA3-BF4D-D992223046D9}.ReleaseNoOpt|Win32.ActiveCfg = ReleaseNoOpt|Win32 - {E87FD9BE-BE42-4EA3-BF4D-D992223046D9}.ReleaseNoOpt|Win32.Build.0 = ReleaseNoOpt|Win32 - {E5D94794-5671-4BD6-A16D-26EC18F3DB34}.Debug|Win32.ActiveCfg = Debug|Win32 - {E5D94794-5671-4BD6-A16D-26EC18F3DB34}.Debug|Win32.Build.0 = Debug|Win32 - {E5D94794-5671-4BD6-A16D-26EC18F3DB34}.DebugHk460|Win32.ActiveCfg = Debug|Win32 - {E5D94794-5671-4BD6-A16D-26EC18F3DB34}.DebugHk460|Win32.Build.0 = Debug|Win32 - {E5D94794-5671-4BD6-A16D-26EC18F3DB34}.DebugMesaHeadless|Win32.ActiveCfg = Debug|Win32 - {E5D94794-5671-4BD6-A16D-26EC18F3DB34}.DebugMesaHeadless|Win32.Build.0 = Debug|Win32 - {E5D94794-5671-4BD6-A16D-26EC18F3DB34}.Release|Win32.ActiveCfg = Release|Win32 - {E5D94794-5671-4BD6-A16D-26EC18F3DB34}.Release|Win32.Build.0 = Release|Win32 - {E5D94794-5671-4BD6-A16D-26EC18F3DB34}.ReleaseForDownload|Win32.ActiveCfg = Release|Win32 - {E5D94794-5671-4BD6-A16D-26EC18F3DB34}.ReleaseForDownload|Win32.Build.0 = Release|Win32 - {E5D94794-5671-4BD6-A16D-26EC18F3DB34}.ReleaseNoOpt|Win32.ActiveCfg = ReleaseNoOpt|Win32 - {E5D94794-5671-4BD6-A16D-26EC18F3DB34}.ReleaseNoOpt|Win32.Build.0 = ReleaseNoOpt|Win32 - {D37774F4-253D-4760-BF64-372A943224A1}.Debug|Win32.ActiveCfg = Debug|Win32 - {D37774F4-253D-4760-BF64-372A943224A1}.Debug|Win32.Build.0 = Debug|Win32 - {D37774F4-253D-4760-BF64-372A943224A1}.DebugHk460|Win32.ActiveCfg = Debug|Win32 - {D37774F4-253D-4760-BF64-372A943224A1}.DebugHk460|Win32.Build.0 = Debug|Win32 - {D37774F4-253D-4760-BF64-372A943224A1}.DebugMesaHeadless|Win32.ActiveCfg = Debug|Win32 - {D37774F4-253D-4760-BF64-372A943224A1}.DebugMesaHeadless|Win32.Build.0 = Debug|Win32 - {D37774F4-253D-4760-BF64-372A943224A1}.Release|Win32.ActiveCfg = Release|Win32 - {D37774F4-253D-4760-BF64-372A943224A1}.Release|Win32.Build.0 = Release|Win32 - {D37774F4-253D-4760-BF64-372A943224A1}.ReleaseForDownload|Win32.ActiveCfg = Release|Win32 - {D37774F4-253D-4760-BF64-372A943224A1}.ReleaseForDownload|Win32.Build.0 = Release|Win32 - {D37774F4-253D-4760-BF64-372A943224A1}.ReleaseNoOpt|Win32.ActiveCfg = ReleaseNoOpt|Win32 - {D37774F4-253D-4760-BF64-372A943224A1}.ReleaseNoOpt|Win32.Build.0 = ReleaseNoOpt|Win32 - {A5470DA6-0C3A-4602-B930-43DB25511A59}.Debug|Win32.ActiveCfg = Debug|Win32 - {A5470DA6-0C3A-4602-B930-43DB25511A59}.Debug|Win32.Build.0 = Debug|Win32 - {A5470DA6-0C3A-4602-B930-43DB25511A59}.DebugHk460|Win32.ActiveCfg = Debug|Win32 - {A5470DA6-0C3A-4602-B930-43DB25511A59}.DebugHk460|Win32.Build.0 = Debug|Win32 - {A5470DA6-0C3A-4602-B930-43DB25511A59}.DebugMesaHeadless|Win32.ActiveCfg = Debug|Win32 - {A5470DA6-0C3A-4602-B930-43DB25511A59}.DebugMesaHeadless|Win32.Build.0 = Debug|Win32 - {A5470DA6-0C3A-4602-B930-43DB25511A59}.Release|Win32.ActiveCfg = Release|Win32 - {A5470DA6-0C3A-4602-B930-43DB25511A59}.Release|Win32.Build.0 = Release|Win32 - {A5470DA6-0C3A-4602-B930-43DB25511A59}.ReleaseForDownload|Win32.ActiveCfg = Release|Win32 - {A5470DA6-0C3A-4602-B930-43DB25511A59}.ReleaseForDownload|Win32.Build.0 = Release|Win32 - {A5470DA6-0C3A-4602-B930-43DB25511A59}.ReleaseNoOpt|Win32.ActiveCfg = ReleaseNoOpt|Win32 - {A5470DA6-0C3A-4602-B930-43DB25511A59}.ReleaseNoOpt|Win32.Build.0 = ReleaseNoOpt|Win32 - {DE55D666-6A3D-476C-937F-109269B83681}.Debug|Win32.ActiveCfg = Debug|Win32 - {DE55D666-6A3D-476C-937F-109269B83681}.Debug|Win32.Build.0 = Debug|Win32 - {DE55D666-6A3D-476C-937F-109269B83681}.DebugHk460|Win32.ActiveCfg = Debug|Win32 - {DE55D666-6A3D-476C-937F-109269B83681}.DebugHk460|Win32.Build.0 = Debug|Win32 - {DE55D666-6A3D-476C-937F-109269B83681}.DebugMesaHeadless|Win32.ActiveCfg = Debug|Win32 - {DE55D666-6A3D-476C-937F-109269B83681}.DebugMesaHeadless|Win32.Build.0 = Debug|Win32 - {DE55D666-6A3D-476C-937F-109269B83681}.Release|Win32.ActiveCfg = Release|Win32 - {DE55D666-6A3D-476C-937F-109269B83681}.Release|Win32.Build.0 = Release|Win32 - {DE55D666-6A3D-476C-937F-109269B83681}.ReleaseForDownload|Win32.ActiveCfg = Release|Win32 - {DE55D666-6A3D-476C-937F-109269B83681}.ReleaseForDownload|Win32.Build.0 = Release|Win32 - {DE55D666-6A3D-476C-937F-109269B83681}.ReleaseNoOpt|Win32.ActiveCfg = ReleaseNoOpt|Win32 - {DE55D666-6A3D-476C-937F-109269B83681}.ReleaseNoOpt|Win32.Build.0 = ReleaseNoOpt|Win32 - {681FDD6C-2FAE-4CB9-AF6D-B952F2B151C5}.Debug|Win32.ActiveCfg = Debug|Win32 - {681FDD6C-2FAE-4CB9-AF6D-B952F2B151C5}.Debug|Win32.Build.0 = Debug|Win32 - {681FDD6C-2FAE-4CB9-AF6D-B952F2B151C5}.DebugHk460|Win32.ActiveCfg = Debug|Win32 - {681FDD6C-2FAE-4CB9-AF6D-B952F2B151C5}.DebugHk460|Win32.Build.0 = Debug|Win32 - {681FDD6C-2FAE-4CB9-AF6D-B952F2B151C5}.DebugMesaHeadless|Win32.ActiveCfg = Debug|Win32 - {681FDD6C-2FAE-4CB9-AF6D-B952F2B151C5}.DebugMesaHeadless|Win32.Build.0 = Debug|Win32 - {681FDD6C-2FAE-4CB9-AF6D-B952F2B151C5}.Release|Win32.ActiveCfg = Release|Win32 - {681FDD6C-2FAE-4CB9-AF6D-B952F2B151C5}.Release|Win32.Build.0 = Release|Win32 - {681FDD6C-2FAE-4CB9-AF6D-B952F2B151C5}.ReleaseForDownload|Win32.ActiveCfg = Release|Win32 - {681FDD6C-2FAE-4CB9-AF6D-B952F2B151C5}.ReleaseForDownload|Win32.Build.0 = Release|Win32 - {681FDD6C-2FAE-4CB9-AF6D-B952F2B151C5}.ReleaseNoOpt|Win32.ActiveCfg = ReleaseNoOpt|Win32 - {681FDD6C-2FAE-4CB9-AF6D-B952F2B151C5}.ReleaseNoOpt|Win32.Build.0 = ReleaseNoOpt|Win32 - {FCC4483C-5B84-4944-B91F-4589A219BC0B}.Debug|Win32.ActiveCfg = Debug|Win32 - {FCC4483C-5B84-4944-B91F-4589A219BC0B}.Debug|Win32.Build.0 = Debug|Win32 - {FCC4483C-5B84-4944-B91F-4589A219BC0B}.DebugHk460|Win32.ActiveCfg = Debug|Win32 - {FCC4483C-5B84-4944-B91F-4589A219BC0B}.DebugHk460|Win32.Build.0 = Debug|Win32 - {FCC4483C-5B84-4944-B91F-4589A219BC0B}.DebugMesaHeadless|Win32.ActiveCfg = Debug|Win32 - {FCC4483C-5B84-4944-B91F-4589A219BC0B}.DebugMesaHeadless|Win32.Build.0 = Debug|Win32 - {FCC4483C-5B84-4944-B91F-4589A219BC0B}.Release|Win32.ActiveCfg = Release|Win32 - {FCC4483C-5B84-4944-B91F-4589A219BC0B}.Release|Win32.Build.0 = Release|Win32 - {FCC4483C-5B84-4944-B91F-4589A219BC0B}.ReleaseForDownload|Win32.ActiveCfg = Release|Win32 - {FCC4483C-5B84-4944-B91F-4589A219BC0B}.ReleaseForDownload|Win32.Build.0 = Release|Win32 - {FCC4483C-5B84-4944-B91F-4589A219BC0B}.ReleaseNoOpt|Win32.ActiveCfg = ReleaseNoOpt|Win32 - {FCC4483C-5B84-4944-B91F-4589A219BC0B}.ReleaseNoOpt|Win32.Build.0 = ReleaseNoOpt|Win32 - {5EA5DDF0-C7E1-4F49-BEF5-9246A4656B2E}.Debug|Win32.ActiveCfg = Debug|Win32 - {5EA5DDF0-C7E1-4F49-BEF5-9246A4656B2E}.Debug|Win32.Build.0 = Debug|Win32 - {5EA5DDF0-C7E1-4F49-BEF5-9246A4656B2E}.DebugHk460|Win32.ActiveCfg = Debug|Win32 - {5EA5DDF0-C7E1-4F49-BEF5-9246A4656B2E}.DebugHk460|Win32.Build.0 = Debug|Win32 - {5EA5DDF0-C7E1-4F49-BEF5-9246A4656B2E}.DebugMesaHeadless|Win32.ActiveCfg = Debug|Win32 - {5EA5DDF0-C7E1-4F49-BEF5-9246A4656B2E}.DebugMesaHeadless|Win32.Build.0 = Debug|Win32 - {5EA5DDF0-C7E1-4F49-BEF5-9246A4656B2E}.Release|Win32.ActiveCfg = Release|Win32 - {5EA5DDF0-C7E1-4F49-BEF5-9246A4656B2E}.Release|Win32.Build.0 = Release|Win32 - {5EA5DDF0-C7E1-4F49-BEF5-9246A4656B2E}.ReleaseForDownload|Win32.ActiveCfg = Release|Win32 - {5EA5DDF0-C7E1-4F49-BEF5-9246A4656B2E}.ReleaseForDownload|Win32.Build.0 = Release|Win32 - {5EA5DDF0-C7E1-4F49-BEF5-9246A4656B2E}.ReleaseNoOpt|Win32.ActiveCfg = ReleaseNoOpt|Win32 - {5EA5DDF0-C7E1-4F49-BEF5-9246A4656B2E}.ReleaseNoOpt|Win32.Build.0 = ReleaseNoOpt|Win32 - {93B2BA29-FBE9-4376-92C1-6108DCFE09D3}.Debug|Win32.ActiveCfg = Debug|Win32 - {93B2BA29-FBE9-4376-92C1-6108DCFE09D3}.Debug|Win32.Build.0 = Debug|Win32 - {93B2BA29-FBE9-4376-92C1-6108DCFE09D3}.DebugHk460|Win32.ActiveCfg = Debug|Win32 - {93B2BA29-FBE9-4376-92C1-6108DCFE09D3}.DebugHk460|Win32.Build.0 = Debug|Win32 - {93B2BA29-FBE9-4376-92C1-6108DCFE09D3}.DebugMesaHeadless|Win32.ActiveCfg = Debug|Win32 - {93B2BA29-FBE9-4376-92C1-6108DCFE09D3}.DebugMesaHeadless|Win32.Build.0 = Debug|Win32 - {93B2BA29-FBE9-4376-92C1-6108DCFE09D3}.Release|Win32.ActiveCfg = Release|Win32 - {93B2BA29-FBE9-4376-92C1-6108DCFE09D3}.Release|Win32.Build.0 = Release|Win32 - {93B2BA29-FBE9-4376-92C1-6108DCFE09D3}.ReleaseForDownload|Win32.ActiveCfg = Release|Win32 - {93B2BA29-FBE9-4376-92C1-6108DCFE09D3}.ReleaseForDownload|Win32.Build.0 = Release|Win32 - {93B2BA29-FBE9-4376-92C1-6108DCFE09D3}.ReleaseNoOpt|Win32.ActiveCfg = ReleaseNoOpt|Win32 - {93B2BA29-FBE9-4376-92C1-6108DCFE09D3}.ReleaseNoOpt|Win32.Build.0 = ReleaseNoOpt|Win32 - {2ADE3C14-94C4-40BF-B033-70F3C954EE90}.Debug|Win32.ActiveCfg = Debug|Win32 - {2ADE3C14-94C4-40BF-B033-70F3C954EE90}.Debug|Win32.Build.0 = Debug|Win32 - {2ADE3C14-94C4-40BF-B033-70F3C954EE90}.DebugHk460|Win32.ActiveCfg = Debug|Win32 - {2ADE3C14-94C4-40BF-B033-70F3C954EE90}.DebugHk460|Win32.Build.0 = Debug|Win32 - {2ADE3C14-94C4-40BF-B033-70F3C954EE90}.DebugMesaHeadless|Win32.ActiveCfg = Debug|Win32 - {2ADE3C14-94C4-40BF-B033-70F3C954EE90}.DebugMesaHeadless|Win32.Build.0 = Debug|Win32 - {2ADE3C14-94C4-40BF-B033-70F3C954EE90}.Release|Win32.ActiveCfg = Release|Win32 - {2ADE3C14-94C4-40BF-B033-70F3C954EE90}.Release|Win32.Build.0 = Release|Win32 - {2ADE3C14-94C4-40BF-B033-70F3C954EE90}.ReleaseForDownload|Win32.ActiveCfg = Release|Win32 - {2ADE3C14-94C4-40BF-B033-70F3C954EE90}.ReleaseForDownload|Win32.Build.0 = Release|Win32 - {2ADE3C14-94C4-40BF-B033-70F3C954EE90}.ReleaseNoOpt|Win32.ActiveCfg = ReleaseNoOpt|Win32 - {2ADE3C14-94C4-40BF-B033-70F3C954EE90}.ReleaseNoOpt|Win32.Build.0 = ReleaseNoOpt|Win32 - {328D1968-924F-4863-AAE8-5F9A95BA68E5}.Debug|Win32.ActiveCfg = Debug|Win32 - {328D1968-924F-4863-AAE8-5F9A95BA68E5}.Debug|Win32.Build.0 = Debug|Win32 - {328D1968-924F-4863-AAE8-5F9A95BA68E5}.DebugHk460|Win32.ActiveCfg = Debug|Win32 - {328D1968-924F-4863-AAE8-5F9A95BA68E5}.DebugHk460|Win32.Build.0 = Debug|Win32 - {328D1968-924F-4863-AAE8-5F9A95BA68E5}.DebugMesaHeadless|Win32.ActiveCfg = Debug|Win32 - {328D1968-924F-4863-AAE8-5F9A95BA68E5}.DebugMesaHeadless|Win32.Build.0 = Debug|Win32 - {328D1968-924F-4863-AAE8-5F9A95BA68E5}.Release|Win32.ActiveCfg = Release|Win32 - {328D1968-924F-4863-AAE8-5F9A95BA68E5}.Release|Win32.Build.0 = Release|Win32 - {328D1968-924F-4863-AAE8-5F9A95BA68E5}.ReleaseForDownload|Win32.ActiveCfg = Release|Win32 - {328D1968-924F-4863-AAE8-5F9A95BA68E5}.ReleaseForDownload|Win32.Build.0 = Release|Win32 - {328D1968-924F-4863-AAE8-5F9A95BA68E5}.ReleaseNoOpt|Win32.ActiveCfg = ReleaseNoOpt|Win32 - {328D1968-924F-4863-AAE8-5F9A95BA68E5}.ReleaseNoOpt|Win32.Build.0 = ReleaseNoOpt|Win32 - {E6F4CF1B-6109-4CA8-B58D-87FA936CDE08}.Debug|Win32.ActiveCfg = Debug|Win32 - {E6F4CF1B-6109-4CA8-B58D-87FA936CDE08}.Debug|Win32.Build.0 = Debug|Win32 - {E6F4CF1B-6109-4CA8-B58D-87FA936CDE08}.DebugHk460|Win32.ActiveCfg = Debug|Win32 - {E6F4CF1B-6109-4CA8-B58D-87FA936CDE08}.DebugHk460|Win32.Build.0 = Debug|Win32 - {E6F4CF1B-6109-4CA8-B58D-87FA936CDE08}.DebugMesaHeadless|Win32.ActiveCfg = Debug|Win32 - {E6F4CF1B-6109-4CA8-B58D-87FA936CDE08}.DebugMesaHeadless|Win32.Build.0 = Debug|Win32 - {E6F4CF1B-6109-4CA8-B58D-87FA936CDE08}.Release|Win32.ActiveCfg = Release|Win32 - {E6F4CF1B-6109-4CA8-B58D-87FA936CDE08}.Release|Win32.Build.0 = Release|Win32 - {E6F4CF1B-6109-4CA8-B58D-87FA936CDE08}.ReleaseForDownload|Win32.ActiveCfg = ReleaseForDownload|Win32 - {E6F4CF1B-6109-4CA8-B58D-87FA936CDE08}.ReleaseForDownload|Win32.Build.0 = ReleaseForDownload|Win32 - {E6F4CF1B-6109-4CA8-B58D-87FA936CDE08}.ReleaseNoOpt|Win32.ActiveCfg = ReleaseNoOpt|Win32 - {E6F4CF1B-6109-4CA8-B58D-87FA936CDE08}.ReleaseNoOpt|Win32.Build.0 = ReleaseNoOpt|Win32 - {B4B838C7-2C72-428E-BBFD-25764E659A8B}.Debug|Win32.ActiveCfg = Debug|Win32 - {B4B838C7-2C72-428E-BBFD-25764E659A8B}.Debug|Win32.Build.0 = Debug|Win32 - {B4B838C7-2C72-428E-BBFD-25764E659A8B}.DebugHk460|Win32.ActiveCfg = Debug|Win32 - {B4B838C7-2C72-428E-BBFD-25764E659A8B}.DebugHk460|Win32.Build.0 = Debug|Win32 - {B4B838C7-2C72-428E-BBFD-25764E659A8B}.DebugMesaHeadless|Win32.ActiveCfg = Debug|Win32 - {B4B838C7-2C72-428E-BBFD-25764E659A8B}.DebugMesaHeadless|Win32.Build.0 = Debug|Win32 - {B4B838C7-2C72-428E-BBFD-25764E659A8B}.Release|Win32.ActiveCfg = Release|Win32 - {B4B838C7-2C72-428E-BBFD-25764E659A8B}.Release|Win32.Build.0 = Release|Win32 - {B4B838C7-2C72-428E-BBFD-25764E659A8B}.ReleaseForDownload|Win32.ActiveCfg = Release|Win32 - {B4B838C7-2C72-428E-BBFD-25764E659A8B}.ReleaseForDownload|Win32.Build.0 = Release|Win32 - {B4B838C7-2C72-428E-BBFD-25764E659A8B}.ReleaseNoOpt|Win32.ActiveCfg = ReleaseNoOpt|Win32 - {B4B838C7-2C72-428E-BBFD-25764E659A8B}.ReleaseNoOpt|Win32.Build.0 = ReleaseNoOpt|Win32 - {B5B53617-416F-404A-BF10-22EBCCA0E4FB}.Debug|Win32.ActiveCfg = Debug|Win32 - {B5B53617-416F-404A-BF10-22EBCCA0E4FB}.Debug|Win32.Build.0 = Debug|Win32 - {B5B53617-416F-404A-BF10-22EBCCA0E4FB}.DebugHk460|Win32.ActiveCfg = DebugMesaHeadless|Win32 - {B5B53617-416F-404A-BF10-22EBCCA0E4FB}.DebugHk460|Win32.Build.0 = DebugMesaHeadless|Win32 - {B5B53617-416F-404A-BF10-22EBCCA0E4FB}.DebugMesaHeadless|Win32.ActiveCfg = DebugMesaHeadless|Win32 - {B5B53617-416F-404A-BF10-22EBCCA0E4FB}.DebugMesaHeadless|Win32.Build.0 = DebugMesaHeadless|Win32 - {B5B53617-416F-404A-BF10-22EBCCA0E4FB}.Release|Win32.ActiveCfg = Release|Win32 - {B5B53617-416F-404A-BF10-22EBCCA0E4FB}.Release|Win32.Build.0 = Release|Win32 - {B5B53617-416F-404A-BF10-22EBCCA0E4FB}.ReleaseForDownload|Win32.ActiveCfg = Release|Win32 - {B5B53617-416F-404A-BF10-22EBCCA0E4FB}.ReleaseForDownload|Win32.Build.0 = Release|Win32 - {B5B53617-416F-404A-BF10-22EBCCA0E4FB}.ReleaseNoOpt|Win32.ActiveCfg = ReleaseNoOpt|Win32 - {B5B53617-416F-404A-BF10-22EBCCA0E4FB}.ReleaseNoOpt|Win32.Build.0 = ReleaseNoOpt|Win32 - {BFA102B0-C891-4E13-B1CF-C2F28073DA8E}.Debug|Win32.ActiveCfg = Debug|Win32 - {BFA102B0-C891-4E13-B1CF-C2F28073DA8E}.Debug|Win32.Build.0 = Debug|Win32 - {BFA102B0-C891-4E13-B1CF-C2F28073DA8E}.DebugHk460|Win32.ActiveCfg = Debug|Win32 - {BFA102B0-C891-4E13-B1CF-C2F28073DA8E}.DebugHk460|Win32.Build.0 = Debug|Win32 - {BFA102B0-C891-4E13-B1CF-C2F28073DA8E}.DebugMesaHeadless|Win32.ActiveCfg = Debug|Win32 - {BFA102B0-C891-4E13-B1CF-C2F28073DA8E}.DebugMesaHeadless|Win32.Build.0 = Debug|Win32 - {BFA102B0-C891-4E13-B1CF-C2F28073DA8E}.Release|Win32.ActiveCfg = Release|Win32 - {BFA102B0-C891-4E13-B1CF-C2F28073DA8E}.Release|Win32.Build.0 = Release|Win32 - {BFA102B0-C891-4E13-B1CF-C2F28073DA8E}.ReleaseForDownload|Win32.ActiveCfg = Release|Win32 - {BFA102B0-C891-4E13-B1CF-C2F28073DA8E}.ReleaseForDownload|Win32.Build.0 = Release|Win32 - {BFA102B0-C891-4E13-B1CF-C2F28073DA8E}.ReleaseNoOpt|Win32.ActiveCfg = ReleaseNoOpt|Win32 - {BFA102B0-C891-4E13-B1CF-C2F28073DA8E}.ReleaseNoOpt|Win32.Build.0 = ReleaseNoOpt|Win32 - {F882263E-4F2A-43D9-A45A-FA4C8EC66552}.Debug|Win32.ActiveCfg = Debug|Win32 - {F882263E-4F2A-43D9-A45A-FA4C8EC66552}.Debug|Win32.Build.0 = Debug|Win32 - {F882263E-4F2A-43D9-A45A-FA4C8EC66552}.DebugHk460|Win32.ActiveCfg = Debug|Win32 - {F882263E-4F2A-43D9-A45A-FA4C8EC66552}.DebugHk460|Win32.Build.0 = Debug|Win32 - {F882263E-4F2A-43D9-A45A-FA4C8EC66552}.DebugMesaHeadless|Win32.ActiveCfg = Debug|Win32 - {F882263E-4F2A-43D9-A45A-FA4C8EC66552}.DebugMesaHeadless|Win32.Build.0 = Debug|Win32 - {F882263E-4F2A-43D9-A45A-FA4C8EC66552}.Release|Win32.ActiveCfg = Release|Win32 - {F882263E-4F2A-43D9-A45A-FA4C8EC66552}.Release|Win32.Build.0 = Release|Win32 - {F882263E-4F2A-43D9-A45A-FA4C8EC66552}.ReleaseForDownload|Win32.ActiveCfg = Release|Win32 - {F882263E-4F2A-43D9-A45A-FA4C8EC66552}.ReleaseForDownload|Win32.Build.0 = Release|Win32 - {F882263E-4F2A-43D9-A45A-FA4C8EC66552}.ReleaseNoOpt|Win32.ActiveCfg = ReleaseNoOpt|Win32 - {F882263E-4F2A-43D9-A45A-FA4C8EC66552}.ReleaseNoOpt|Win32.Build.0 = ReleaseNoOpt|Win32 - {44CE6D82-7320-4609-8FC3-5965C19F4808}.Debug|Win32.ActiveCfg = Debug|Win32 - {44CE6D82-7320-4609-8FC3-5965C19F4808}.Debug|Win32.Build.0 = Debug|Win32 - {44CE6D82-7320-4609-8FC3-5965C19F4808}.DebugHk460|Win32.ActiveCfg = Debug|Win32 - {44CE6D82-7320-4609-8FC3-5965C19F4808}.DebugHk460|Win32.Build.0 = Debug|Win32 - {44CE6D82-7320-4609-8FC3-5965C19F4808}.DebugMesaHeadless|Win32.ActiveCfg = Debug|Win32 - {44CE6D82-7320-4609-8FC3-5965C19F4808}.DebugMesaHeadless|Win32.Build.0 = Debug|Win32 - {44CE6D82-7320-4609-8FC3-5965C19F4808}.Release|Win32.ActiveCfg = Release|Win32 - {44CE6D82-7320-4609-8FC3-5965C19F4808}.Release|Win32.Build.0 = Release|Win32 - {44CE6D82-7320-4609-8FC3-5965C19F4808}.ReleaseForDownload|Win32.ActiveCfg = Release|Win32 - {44CE6D82-7320-4609-8FC3-5965C19F4808}.ReleaseForDownload|Win32.Build.0 = Release|Win32 - {44CE6D82-7320-4609-8FC3-5965C19F4808}.ReleaseNoOpt|Win32.ActiveCfg = ReleaseNoOpt|Win32 - {44CE6D82-7320-4609-8FC3-5965C19F4808}.ReleaseNoOpt|Win32.Build.0 = ReleaseNoOpt|Win32 - {D0FDC1C3-A589-40F2-ABCA-A84FF3835624}.Debug|Win32.ActiveCfg = Debug|Win32 - {D0FDC1C3-A589-40F2-ABCA-A84FF3835624}.Debug|Win32.Build.0 = Debug|Win32 - {D0FDC1C3-A589-40F2-ABCA-A84FF3835624}.DebugHk460|Win32.ActiveCfg = Debug|Win32 - {D0FDC1C3-A589-40F2-ABCA-A84FF3835624}.DebugHk460|Win32.Build.0 = Debug|Win32 - {D0FDC1C3-A589-40F2-ABCA-A84FF3835624}.DebugMesaHeadless|Win32.ActiveCfg = Debug|Win32 - {D0FDC1C3-A589-40F2-ABCA-A84FF3835624}.DebugMesaHeadless|Win32.Build.0 = Debug|Win32 - {D0FDC1C3-A589-40F2-ABCA-A84FF3835624}.Release|Win32.ActiveCfg = Release|Win32 - {D0FDC1C3-A589-40F2-ABCA-A84FF3835624}.Release|Win32.Build.0 = Release|Win32 - {D0FDC1C3-A589-40F2-ABCA-A84FF3835624}.ReleaseForDownload|Win32.ActiveCfg = Release|Win32 - {D0FDC1C3-A589-40F2-ABCA-A84FF3835624}.ReleaseForDownload|Win32.Build.0 = Release|Win32 - {D0FDC1C3-A589-40F2-ABCA-A84FF3835624}.ReleaseNoOpt|Win32.ActiveCfg = ReleaseNoOpt|Win32 - {D0FDC1C3-A589-40F2-ABCA-A84FF3835624}.ReleaseNoOpt|Win32.Build.0 = ReleaseNoOpt|Win32 - {C6CA76F5-DCB4-4789-BBA7-43D11EE7C8E2}.Debug|Win32.ActiveCfg = Debug|Win32 - {C6CA76F5-DCB4-4789-BBA7-43D11EE7C8E2}.Debug|Win32.Build.0 = Debug|Win32 - {C6CA76F5-DCB4-4789-BBA7-43D11EE7C8E2}.DebugHk460|Win32.ActiveCfg = Debug|Win32 - {C6CA76F5-DCB4-4789-BBA7-43D11EE7C8E2}.DebugHk460|Win32.Build.0 = Debug|Win32 - {C6CA76F5-DCB4-4789-BBA7-43D11EE7C8E2}.DebugMesaHeadless|Win32.ActiveCfg = Debug|Win32 - {C6CA76F5-DCB4-4789-BBA7-43D11EE7C8E2}.DebugMesaHeadless|Win32.Build.0 = Debug|Win32 - {C6CA76F5-DCB4-4789-BBA7-43D11EE7C8E2}.Release|Win32.ActiveCfg = Release|Win32 - {C6CA76F5-DCB4-4789-BBA7-43D11EE7C8E2}.Release|Win32.Build.0 = Release|Win32 - {C6CA76F5-DCB4-4789-BBA7-43D11EE7C8E2}.ReleaseForDownload|Win32.ActiveCfg = Release|Win32 - {C6CA76F5-DCB4-4789-BBA7-43D11EE7C8E2}.ReleaseForDownload|Win32.Build.0 = Release|Win32 - {C6CA76F5-DCB4-4789-BBA7-43D11EE7C8E2}.ReleaseNoOpt|Win32.ActiveCfg = ReleaseNoOpt|Win32 - {C6CA76F5-DCB4-4789-BBA7-43D11EE7C8E2}.ReleaseNoOpt|Win32.Build.0 = ReleaseNoOpt|Win32 - {A5504A1E-8BA4-45D2-8144-1B6937E37E98}.Debug|Win32.ActiveCfg = Debug|Win32 - {A5504A1E-8BA4-45D2-8144-1B6937E37E98}.Debug|Win32.Build.0 = Debug|Win32 - {A5504A1E-8BA4-45D2-8144-1B6937E37E98}.DebugHk460|Win32.ActiveCfg = Debug|Win32 - {A5504A1E-8BA4-45D2-8144-1B6937E37E98}.DebugHk460|Win32.Build.0 = Debug|Win32 - {A5504A1E-8BA4-45D2-8144-1B6937E37E98}.DebugMesaHeadless|Win32.ActiveCfg = Debug|Win32 - {A5504A1E-8BA4-45D2-8144-1B6937E37E98}.DebugMesaHeadless|Win32.Build.0 = Debug|Win32 - {A5504A1E-8BA4-45D2-8144-1B6937E37E98}.Release|Win32.ActiveCfg = Release|Win32 - {A5504A1E-8BA4-45D2-8144-1B6937E37E98}.Release|Win32.Build.0 = Release|Win32 - {A5504A1E-8BA4-45D2-8144-1B6937E37E98}.ReleaseForDownload|Win32.ActiveCfg = Release|Win32 - {A5504A1E-8BA4-45D2-8144-1B6937E37E98}.ReleaseForDownload|Win32.Build.0 = Release|Win32 - {A5504A1E-8BA4-45D2-8144-1B6937E37E98}.ReleaseNoOpt|Win32.ActiveCfg = ReleaseNoOpt|Win32 - {A5504A1E-8BA4-45D2-8144-1B6937E37E98}.ReleaseNoOpt|Win32.Build.0 = ReleaseNoOpt|Win32 - {777F38BE-2DFE-4051-9AAD-2832ABC474CC}.Debug|Win32.ActiveCfg = Debug|Win32 - {777F38BE-2DFE-4051-9AAD-2832ABC474CC}.Debug|Win32.Build.0 = Debug|Win32 - {777F38BE-2DFE-4051-9AAD-2832ABC474CC}.DebugHk460|Win32.ActiveCfg = Debug|Win32 - {777F38BE-2DFE-4051-9AAD-2832ABC474CC}.DebugHk460|Win32.Build.0 = Debug|Win32 - {777F38BE-2DFE-4051-9AAD-2832ABC474CC}.DebugMesaHeadless|Win32.ActiveCfg = Debug|Win32 - {777F38BE-2DFE-4051-9AAD-2832ABC474CC}.DebugMesaHeadless|Win32.Build.0 = Debug|Win32 - {777F38BE-2DFE-4051-9AAD-2832ABC474CC}.Release|Win32.ActiveCfg = Release|Win32 - {777F38BE-2DFE-4051-9AAD-2832ABC474CC}.Release|Win32.Build.0 = Release|Win32 - {777F38BE-2DFE-4051-9AAD-2832ABC474CC}.ReleaseForDownload|Win32.ActiveCfg = Release|Win32 - {777F38BE-2DFE-4051-9AAD-2832ABC474CC}.ReleaseNoOpt|Win32.ActiveCfg = Release|Win32 - {777F38BE-2DFE-4051-9AAD-2832ABC474CC}.ReleaseNoOpt|Win32.Build.0 = Release|Win32 - {EC2A989E-3F8F-4B8B-9AE6-7C7EA37C84BC}.Debug|Win32.ActiveCfg = Debug|Win32 - {EC2A989E-3F8F-4B8B-9AE6-7C7EA37C84BC}.Debug|Win32.Build.0 = Debug|Win32 - {EC2A989E-3F8F-4B8B-9AE6-7C7EA37C84BC}.DebugHk460|Win32.ActiveCfg = Debug|Win32 - {EC2A989E-3F8F-4B8B-9AE6-7C7EA37C84BC}.DebugHk460|Win32.Build.0 = Debug|Win32 - {EC2A989E-3F8F-4B8B-9AE6-7C7EA37C84BC}.DebugMesaHeadless|Win32.ActiveCfg = Debug|Win32 - {EC2A989E-3F8F-4B8B-9AE6-7C7EA37C84BC}.DebugMesaHeadless|Win32.Build.0 = Debug|Win32 - {EC2A989E-3F8F-4B8B-9AE6-7C7EA37C84BC}.Release|Win32.ActiveCfg = Release|Win32 - {EC2A989E-3F8F-4B8B-9AE6-7C7EA37C84BC}.Release|Win32.Build.0 = Release|Win32 - {EC2A989E-3F8F-4B8B-9AE6-7C7EA37C84BC}.ReleaseForDownload|Win32.ActiveCfg = Release|Win32 - {EC2A989E-3F8F-4B8B-9AE6-7C7EA37C84BC}.ReleaseNoOpt|Win32.ActiveCfg = Release|Win32 - {EC2A989E-3F8F-4B8B-9AE6-7C7EA37C84BC}.ReleaseNoOpt|Win32.Build.0 = Release|Win32 - {648685F3-8760-4CC5-BB2B-CAF9DECC25A4}.Debug|Win32.ActiveCfg = Debug|Win32 - {648685F3-8760-4CC5-BB2B-CAF9DECC25A4}.Debug|Win32.Build.0 = Debug|Win32 - {648685F3-8760-4CC5-BB2B-CAF9DECC25A4}.DebugHk460|Win32.ActiveCfg = Debug|Win32 - {648685F3-8760-4CC5-BB2B-CAF9DECC25A4}.DebugHk460|Win32.Build.0 = Debug|Win32 - {648685F3-8760-4CC5-BB2B-CAF9DECC25A4}.DebugMesaHeadless|Win32.ActiveCfg = Debug|Win32 - {648685F3-8760-4CC5-BB2B-CAF9DECC25A4}.DebugMesaHeadless|Win32.Build.0 = Debug|Win32 - {648685F3-8760-4CC5-BB2B-CAF9DECC25A4}.Release|Win32.ActiveCfg = Release|Win32 - {648685F3-8760-4CC5-BB2B-CAF9DECC25A4}.Release|Win32.Build.0 = Release|Win32 - {648685F3-8760-4CC5-BB2B-CAF9DECC25A4}.ReleaseForDownload|Win32.ActiveCfg = Release|Win32 - {648685F3-8760-4CC5-BB2B-CAF9DECC25A4}.ReleaseForDownload|Win32.Build.0 = Release|Win32 - {648685F3-8760-4CC5-BB2B-CAF9DECC25A4}.ReleaseNoOpt|Win32.ActiveCfg = ReleaseNoOpt|Win32 - {E928F33B-E090-4FA8-818B-6B5D8B0F1F4B}.Debug|Win32.ActiveCfg = Debug|Win32 - {E928F33B-E090-4FA8-818B-6B5D8B0F1F4B}.Debug|Win32.Build.0 = Debug|Win32 - {E928F33B-E090-4FA8-818B-6B5D8B0F1F4B}.DebugHk460|Win32.ActiveCfg = Debug|Win32 - {E928F33B-E090-4FA8-818B-6B5D8B0F1F4B}.DebugHk460|Win32.Build.0 = Debug|Win32 - {E928F33B-E090-4FA8-818B-6B5D8B0F1F4B}.DebugMesaHeadless|Win32.ActiveCfg = Debug|Win32 - {E928F33B-E090-4FA8-818B-6B5D8B0F1F4B}.DebugMesaHeadless|Win32.Build.0 = Debug|Win32 - {E928F33B-E090-4FA8-818B-6B5D8B0F1F4B}.Release|Win32.ActiveCfg = Release|Win32 - {E928F33B-E090-4FA8-818B-6B5D8B0F1F4B}.Release|Win32.Build.0 = Release|Win32 - {E928F33B-E090-4FA8-818B-6B5D8B0F1F4B}.ReleaseForDownload|Win32.ActiveCfg = Release|Win32 - {E928F33B-E090-4FA8-818B-6B5D8B0F1F4B}.ReleaseForDownload|Win32.Build.0 = Release|Win32 - {E928F33B-E090-4FA8-818B-6B5D8B0F1F4B}.ReleaseNoOpt|Win32.ActiveCfg = ReleaseNoOpt|Win32 - {E928F33B-E090-4FA8-818B-6B5D8B0F1F4B}.ReleaseNoOpt|Win32.Build.0 = ReleaseNoOpt|Win32 - {F56CA265-93E9-4068-8A67-8B104C876D70}.Debug|Win32.ActiveCfg = Debug|Win32 - {F56CA265-93E9-4068-8A67-8B104C876D70}.DebugHk460|Win32.ActiveCfg = Debug|Win32 - {F56CA265-93E9-4068-8A67-8B104C876D70}.DebugHk460|Win32.Build.0 = Debug|Win32 - {F56CA265-93E9-4068-8A67-8B104C876D70}.DebugMesaHeadless|Win32.ActiveCfg = Debug|Win32 - {F56CA265-93E9-4068-8A67-8B104C876D70}.DebugMesaHeadless|Win32.Build.0 = Debug|Win32 - {F56CA265-93E9-4068-8A67-8B104C876D70}.Release|Win32.ActiveCfg = Release|Win32 - {F56CA265-93E9-4068-8A67-8B104C876D70}.ReleaseForDownload|Win32.ActiveCfg = Release|Win32 - {F56CA265-93E9-4068-8A67-8B104C876D70}.ReleaseNoOpt|Win32.ActiveCfg = ReleaseNoOpt|Win32 - {9D0C7E02-6506-4EE7-BC5C-75671D28D594}.Debug|Win32.ActiveCfg = Debug|Win32 - {9D0C7E02-6506-4EE7-BC5C-75671D28D594}.Debug|Win32.Build.0 = Debug|Win32 - {9D0C7E02-6506-4EE7-BC5C-75671D28D594}.DebugHk460|Win32.ActiveCfg = Debug|Win32 - {9D0C7E02-6506-4EE7-BC5C-75671D28D594}.DebugHk460|Win32.Build.0 = Debug|Win32 - {9D0C7E02-6506-4EE7-BC5C-75671D28D594}.DebugMesaHeadless|Win32.ActiveCfg = Debug|Win32 - {9D0C7E02-6506-4EE7-BC5C-75671D28D594}.DebugMesaHeadless|Win32.Build.0 = Debug|Win32 - {9D0C7E02-6506-4EE7-BC5C-75671D28D594}.Release|Win32.ActiveCfg = Release|Win32 - {9D0C7E02-6506-4EE7-BC5C-75671D28D594}.Release|Win32.Build.0 = Release|Win32 - {9D0C7E02-6506-4EE7-BC5C-75671D28D594}.ReleaseForDownload|Win32.ActiveCfg = Release|Win32 - {9D0C7E02-6506-4EE7-BC5C-75671D28D594}.ReleaseForDownload|Win32.Build.0 = Release|Win32 - {9D0C7E02-6506-4EE7-BC5C-75671D28D594}.ReleaseNoOpt|Win32.ActiveCfg = ReleaseNoOpt|Win32 - {9D0C7E02-6506-4EE7-BC5C-75671D28D594}.ReleaseNoOpt|Win32.Build.0 = ReleaseNoOpt|Win32 - {4B19F64E-AB97-4FB9-8E1D-74A8104DE0C4}.Debug|Win32.ActiveCfg = Debug|Win32 - {4B19F64E-AB97-4FB9-8E1D-74A8104DE0C4}.Debug|Win32.Build.0 = Debug|Win32 - {4B19F64E-AB97-4FB9-8E1D-74A8104DE0C4}.DebugHk460|Win32.ActiveCfg = Debug|Win32 - {4B19F64E-AB97-4FB9-8E1D-74A8104DE0C4}.DebugHk460|Win32.Build.0 = Debug|Win32 - {4B19F64E-AB97-4FB9-8E1D-74A8104DE0C4}.DebugMesaHeadless|Win32.ActiveCfg = Debug|Win32 - {4B19F64E-AB97-4FB9-8E1D-74A8104DE0C4}.DebugMesaHeadless|Win32.Build.0 = Debug|Win32 - {4B19F64E-AB97-4FB9-8E1D-74A8104DE0C4}.Release|Win32.ActiveCfg = Release|Win32 - {4B19F64E-AB97-4FB9-8E1D-74A8104DE0C4}.Release|Win32.Build.0 = Release|Win32 - {4B19F64E-AB97-4FB9-8E1D-74A8104DE0C4}.ReleaseForDownload|Win32.ActiveCfg = Release|Win32 - {4B19F64E-AB97-4FB9-8E1D-74A8104DE0C4}.ReleaseForDownload|Win32.Build.0 = Release|Win32 - {4B19F64E-AB97-4FB9-8E1D-74A8104DE0C4}.ReleaseNoOpt|Win32.ActiveCfg = ReleaseNoOpt|Win32 - {4B19F64E-AB97-4FB9-8E1D-74A8104DE0C4}.ReleaseNoOpt|Win32.Build.0 = ReleaseNoOpt|Win32 - {BBAA6588-CA96-4A87-A988-B02270B8D02B}.Debug|Win32.ActiveCfg = Debug|Win32 - {BBAA6588-CA96-4A87-A988-B02270B8D02B}.Debug|Win32.Build.0 = Debug|Win32 - {BBAA6588-CA96-4A87-A988-B02270B8D02B}.DebugHk460|Win32.ActiveCfg = Debug|Win32 - {BBAA6588-CA96-4A87-A988-B02270B8D02B}.DebugHk460|Win32.Build.0 = Debug|Win32 - {BBAA6588-CA96-4A87-A988-B02270B8D02B}.DebugMesaHeadless|Win32.ActiveCfg = Debug|Win32 - {BBAA6588-CA96-4A87-A988-B02270B8D02B}.DebugMesaHeadless|Win32.Build.0 = Debug|Win32 - {BBAA6588-CA96-4A87-A988-B02270B8D02B}.Release|Win32.ActiveCfg = Release|Win32 - {BBAA6588-CA96-4A87-A988-B02270B8D02B}.Release|Win32.Build.0 = Release|Win32 - {BBAA6588-CA96-4A87-A988-B02270B8D02B}.ReleaseForDownload|Win32.ActiveCfg = Release|Win32 - {BBAA6588-CA96-4A87-A988-B02270B8D02B}.ReleaseNoOpt|Win32.ActiveCfg = ReleaseNoOpt|Win32 - {BBAA6588-CA96-4A87-A988-B02270B8D02B}.ReleaseNoOpt|Win32.Build.0 = ReleaseNoOpt|Win32 - {E9F5BD55-F8E8-4C61-B9B5-CCE7C1048241}.Debug|Win32.ActiveCfg = Debug|Win32 - {E9F5BD55-F8E8-4C61-B9B5-CCE7C1048241}.Debug|Win32.Build.0 = Debug|Win32 - {E9F5BD55-F8E8-4C61-B9B5-CCE7C1048241}.DebugHk460|Win32.ActiveCfg = Debug|Win32 - {E9F5BD55-F8E8-4C61-B9B5-CCE7C1048241}.DebugHk460|Win32.Build.0 = Debug|Win32 - {E9F5BD55-F8E8-4C61-B9B5-CCE7C1048241}.DebugMesaHeadless|Win32.ActiveCfg = Debug|Win32 - {E9F5BD55-F8E8-4C61-B9B5-CCE7C1048241}.DebugMesaHeadless|Win32.Build.0 = Debug|Win32 - {E9F5BD55-F8E8-4C61-B9B5-CCE7C1048241}.Release|Win32.ActiveCfg = Release|Win32 - {E9F5BD55-F8E8-4C61-B9B5-CCE7C1048241}.Release|Win32.Build.0 = Release|Win32 - {E9F5BD55-F8E8-4C61-B9B5-CCE7C1048241}.ReleaseForDownload|Win32.ActiveCfg = Release|Win32 - {E9F5BD55-F8E8-4C61-B9B5-CCE7C1048241}.ReleaseForDownload|Win32.Build.0 = Release|Win32 - {E9F5BD55-F8E8-4C61-B9B5-CCE7C1048241}.ReleaseNoOpt|Win32.ActiveCfg = ReleaseNoOpt|Win32 - {E9F5BD55-F8E8-4C61-B9B5-CCE7C1048241}.ReleaseNoOpt|Win32.Build.0 = ReleaseNoOpt|Win32 - {6AEE004D-BFE8-4082-B4D3-E51163B01EEB}.Debug|Win32.ActiveCfg = Debug|Win32 - {6AEE004D-BFE8-4082-B4D3-E51163B01EEB}.Debug|Win32.Build.0 = Debug|Win32 - {6AEE004D-BFE8-4082-B4D3-E51163B01EEB}.DebugHk460|Win32.ActiveCfg = Debug|Win32 - {6AEE004D-BFE8-4082-B4D3-E51163B01EEB}.DebugHk460|Win32.Build.0 = Debug|Win32 - {6AEE004D-BFE8-4082-B4D3-E51163B01EEB}.DebugMesaHeadless|Win32.ActiveCfg = Debug|Win32 - {6AEE004D-BFE8-4082-B4D3-E51163B01EEB}.DebugMesaHeadless|Win32.Build.0 = Debug|Win32 - {6AEE004D-BFE8-4082-B4D3-E51163B01EEB}.Release|Win32.ActiveCfg = Release|Win32 - {6AEE004D-BFE8-4082-B4D3-E51163B01EEB}.Release|Win32.Build.0 = Release|Win32 - {6AEE004D-BFE8-4082-B4D3-E51163B01EEB}.ReleaseForDownload|Win32.ActiveCfg = Release|Win32 - {6AEE004D-BFE8-4082-B4D3-E51163B01EEB}.ReleaseForDownload|Win32.Build.0 = Release|Win32 - {6AEE004D-BFE8-4082-B4D3-E51163B01EEB}.ReleaseNoOpt|Win32.ActiveCfg = ReleaseNoOpt|Win32 - {6AEE004D-BFE8-4082-B4D3-E51163B01EEB}.ReleaseNoOpt|Win32.Build.0 = ReleaseNoOpt|Win32 - {076DD042-2E58-42EA-9401-53210B65C1FC}.Debug|Win32.ActiveCfg = Debug|Win32 - {076DD042-2E58-42EA-9401-53210B65C1FC}.Debug|Win32.Build.0 = Debug|Win32 - {076DD042-2E58-42EA-9401-53210B65C1FC}.DebugHk460|Win32.ActiveCfg = Debug|Win32 - {076DD042-2E58-42EA-9401-53210B65C1FC}.DebugHk460|Win32.Build.0 = Debug|Win32 - {076DD042-2E58-42EA-9401-53210B65C1FC}.DebugMesaHeadless|Win32.ActiveCfg = Debug|Win32 - {076DD042-2E58-42EA-9401-53210B65C1FC}.DebugMesaHeadless|Win32.Build.0 = Debug|Win32 - {076DD042-2E58-42EA-9401-53210B65C1FC}.Release|Win32.ActiveCfg = Release|Win32 - {076DD042-2E58-42EA-9401-53210B65C1FC}.Release|Win32.Build.0 = Release|Win32 - {076DD042-2E58-42EA-9401-53210B65C1FC}.ReleaseForDownload|Win32.ActiveCfg = Release|Win32 - {076DD042-2E58-42EA-9401-53210B65C1FC}.ReleaseForDownload|Win32.Build.0 = Release|Win32 - {076DD042-2E58-42EA-9401-53210B65C1FC}.ReleaseNoOpt|Win32.ActiveCfg = ReleaseNoOpt|Win32 - {076DD042-2E58-42EA-9401-53210B65C1FC}.ReleaseNoOpt|Win32.Build.0 = ReleaseNoOpt|Win32 - {AF2D801E-EEE7-4B52-A025-F8E648ADC34B}.Debug|Win32.ActiveCfg = Debug|Win32 - {AF2D801E-EEE7-4B52-A025-F8E648ADC34B}.Debug|Win32.Build.0 = Debug|Win32 - {AF2D801E-EEE7-4B52-A025-F8E648ADC34B}.DebugHk460|Win32.ActiveCfg = Debug|Win32 - {AF2D801E-EEE7-4B52-A025-F8E648ADC34B}.DebugHk460|Win32.Build.0 = Debug|Win32 - {AF2D801E-EEE7-4B52-A025-F8E648ADC34B}.DebugMesaHeadless|Win32.ActiveCfg = Debug|Win32 - {AF2D801E-EEE7-4B52-A025-F8E648ADC34B}.DebugMesaHeadless|Win32.Build.0 = Debug|Win32 - {AF2D801E-EEE7-4B52-A025-F8E648ADC34B}.Release|Win32.ActiveCfg = Release|Win32 - {AF2D801E-EEE7-4B52-A025-F8E648ADC34B}.Release|Win32.Build.0 = Release|Win32 - {AF2D801E-EEE7-4B52-A025-F8E648ADC34B}.ReleaseForDownload|Win32.ActiveCfg = Release|Win32 - {AF2D801E-EEE7-4B52-A025-F8E648ADC34B}.ReleaseForDownload|Win32.Build.0 = Release|Win32 - {AF2D801E-EEE7-4B52-A025-F8E648ADC34B}.ReleaseNoOpt|Win32.ActiveCfg = ReleaseNoOpt|Win32 - {AF2D801E-EEE7-4B52-A025-F8E648ADC34B}.ReleaseNoOpt|Win32.Build.0 = ReleaseNoOpt|Win32 - {4C8D64D5-649F-481E-96BE-EF1E82A77ACB}.Debug|Win32.ActiveCfg = Debug|Win32 - {4C8D64D5-649F-481E-96BE-EF1E82A77ACB}.Debug|Win32.Build.0 = Debug|Win32 - {4C8D64D5-649F-481E-96BE-EF1E82A77ACB}.DebugHk460|Win32.ActiveCfg = Debug|Win32 - {4C8D64D5-649F-481E-96BE-EF1E82A77ACB}.DebugHk460|Win32.Build.0 = Debug|Win32 - {4C8D64D5-649F-481E-96BE-EF1E82A77ACB}.DebugMesaHeadless|Win32.ActiveCfg = Debug|Win32 - {4C8D64D5-649F-481E-96BE-EF1E82A77ACB}.DebugMesaHeadless|Win32.Build.0 = Debug|Win32 - {4C8D64D5-649F-481E-96BE-EF1E82A77ACB}.Release|Win32.ActiveCfg = Release|Win32 - {4C8D64D5-649F-481E-96BE-EF1E82A77ACB}.Release|Win32.Build.0 = Release|Win32 - {4C8D64D5-649F-481E-96BE-EF1E82A77ACB}.ReleaseForDownload|Win32.ActiveCfg = Release|Win32 - {4C8D64D5-649F-481E-96BE-EF1E82A77ACB}.ReleaseForDownload|Win32.Build.0 = Release|Win32 - {4C8D64D5-649F-481E-96BE-EF1E82A77ACB}.ReleaseNoOpt|Win32.ActiveCfg = ReleaseNoOpt|Win32 - {4C8D64D5-649F-481E-96BE-EF1E82A77ACB}.ReleaseNoOpt|Win32.Build.0 = ReleaseNoOpt|Win32 - {B771CF1B-E253-47BD-8B0A-6B0440CC9228}.Debug|Win32.ActiveCfg = Debug|Win32 - {B771CF1B-E253-47BD-8B0A-6B0440CC9228}.Debug|Win32.Build.0 = Debug|Win32 - {B771CF1B-E253-47BD-8B0A-6B0440CC9228}.DebugHk460|Win32.ActiveCfg = Debug|Win32 - {B771CF1B-E253-47BD-8B0A-6B0440CC9228}.DebugHk460|Win32.Build.0 = Debug|Win32 - {B771CF1B-E253-47BD-8B0A-6B0440CC9228}.DebugMesaHeadless|Win32.ActiveCfg = Debug|Win32 - {B771CF1B-E253-47BD-8B0A-6B0440CC9228}.DebugMesaHeadless|Win32.Build.0 = Debug|Win32 - {B771CF1B-E253-47BD-8B0A-6B0440CC9228}.Release|Win32.ActiveCfg = Release|Win32 - {B771CF1B-E253-47BD-8B0A-6B0440CC9228}.Release|Win32.Build.0 = Release|Win32 - {B771CF1B-E253-47BD-8B0A-6B0440CC9228}.ReleaseForDownload|Win32.ActiveCfg = Release|Win32 - {B771CF1B-E253-47BD-8B0A-6B0440CC9228}.ReleaseForDownload|Win32.Build.0 = Release|Win32 - {B771CF1B-E253-47BD-8B0A-6B0440CC9228}.ReleaseNoOpt|Win32.ActiveCfg = Release|Win32 - {B771CF1B-E253-47BD-8B0A-6B0440CC9228}.ReleaseNoOpt|Win32.Build.0 = Release|Win32 - {020311F7-3DAB-4D93-9CE5-6D3926FD15FE}.Debug|Win32.ActiveCfg = Debug|Win32 - {020311F7-3DAB-4D93-9CE5-6D3926FD15FE}.Debug|Win32.Build.0 = Debug|Win32 - {020311F7-3DAB-4D93-9CE5-6D3926FD15FE}.DebugHk460|Win32.ActiveCfg = DebugHk460|Win32 - {020311F7-3DAB-4D93-9CE5-6D3926FD15FE}.DebugHk460|Win32.Build.0 = DebugHk460|Win32 - {020311F7-3DAB-4D93-9CE5-6D3926FD15FE}.DebugMesaHeadless|Win32.ActiveCfg = DebugHk460|Win32 - {020311F7-3DAB-4D93-9CE5-6D3926FD15FE}.DebugMesaHeadless|Win32.Build.0 = DebugHk460|Win32 - {020311F7-3DAB-4D93-9CE5-6D3926FD15FE}.Release|Win32.ActiveCfg = Release|Win32 - {020311F7-3DAB-4D93-9CE5-6D3926FD15FE}.Release|Win32.Build.0 = Release|Win32 - {020311F7-3DAB-4D93-9CE5-6D3926FD15FE}.ReleaseForDownload|Win32.ActiveCfg = Release|Win32 - {020311F7-3DAB-4D93-9CE5-6D3926FD15FE}.ReleaseForDownload|Win32.Build.0 = Release|Win32 - {020311F7-3DAB-4D93-9CE5-6D3926FD15FE}.ReleaseNoOpt|Win32.ActiveCfg = ReleaseNoOpt|Win32 - {020311F7-3DAB-4D93-9CE5-6D3926FD15FE}.ReleaseNoOpt|Win32.Build.0 = ReleaseNoOpt|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/linden/indra/lib/python/indra/base/cllsd_test.py b/linden/indra/lib/python/indra/base/cllsd_test.py new file mode 100644 index 0000000..3af59e7 --- /dev/null +++ b/linden/indra/lib/python/indra/base/cllsd_test.py @@ -0,0 +1,51 @@ +from indra.base import llsd, lluuid +from datetime import datetime +import cllsd +import time, sys + +class myint(int): + pass + +values = ( + '&<>', + u'\u81acj', + llsd.uri('http://foo<'), + lluuid.LLUUID(), + llsd.LLSD(['thing']), + 1, + myint(31337), + sys.maxint + 10, + llsd.binary('foo'), + [], + {}, + {u'f&\u1212': 3}, + 3.1, + True, + None, + datetime.fromtimestamp(time.time()), + ) + +def valuator(values): + for v in values: + yield v + +longvalues = () # (values, list(values), iter(values), valuator(values)) + +for v in values + longvalues: + print '%r => %r' % (v, cllsd.llsd_to_xml(v)) + +a = [[{'a':3}]] * 1000000 + +s = time.time() +print hash(cllsd.llsd_to_xml(a)) +e = time.time() +t1 = e - s +print t1 + +s = time.time() +print hash(llsd.LLSDXMLFormatter()._format(a)) +e = time.time() +t2 = e - s +print t2 + +print 'Speedup:', t2 / t1 diff --git a/linden/indra/lib/python/indra/base/config.py b/linden/indra/lib/python/indra/base/config.py index 3865f5e..9c37ecf 100644 --- a/linden/indra/lib/python/indra/base/config.py +++ b/linden/indra/lib/python/indra/base/config.py @@ -26,74 +26,224 @@ THE SOFTWARE. $/LicenseInfo$ """ -from os.path import dirname, join, realpath +import copy +import os +import traceback +import time import types + +from os.path import dirname, getmtime, join, realpath from indra.base import llsd -_g_config_dict = None - -def load(indra_xml_file=None): - global _g_config_dict - if _g_config_dict == None: - if indra_xml_file is None: - ## going from: - ## "/opt/linden/indra/lib/python/indra/base/config.py" - ## to: - ## "/opt/linden/etc/indra.xml" - indra_xml_file = realpath( - dirname(realpath(__file__)) + "../../../../../../etc/indra.xml") - config_file = file(indra_xml_file) - _g_config_dict = llsd.LLSD().parse(config_file.read()) +_g_config = None + +class IndraConfig(object): + """ + IndraConfig loads a 'indra' xml configuration file + and loads into memory. This representation in memory + can get updated to overwrite values or add new values. + + The xml configuration file is considered a live file and changes + to the file are checked and reloaded periodically. If a value had + been overwritten via the update or set method, the loaded values + from the file are ignored (the values from the update/set methods + override) + """ + def __init__(self, indra_config_file): + self._indra_config_file = indra_config_file + self._reload_check_interval = 30 # seconds + self._last_check_time = 0 + self._last_mod_time = 0 + + self._config_overrides = {} + self._config_file_dict = {} + self._combined_dict = {} + + self._load() + + def _load(self): + if self._indra_config_file is None: + return + + config_file = open(self._indra_config_file) + self._config_file_dict = llsd.parse(config_file.read()) + self._combine_dictionaries() config_file.close() - #print "loaded config from",indra_xml_file,"into",_g_config_dict -def dump(indra_xml_file, indra_cfg={}, update_in_mem=False): + self._last_mod_time = self._get_last_modified_time() + self._last_check_time = time.time() # now + + def _get_last_modified_time(self): + """ + Returns the mtime (last modified time) of the config file, + if such exists. + """ + if self._indra_config_file is not None: + return os.path.getmtime(self._indra_config_file) + + return 0 + + def _combine_dictionaries(self): + self._combined_dict = {} + self._combined_dict.update(self._config_file_dict) + self._combined_dict.update(self._config_overrides) + + def _reload_if_necessary(self): + now = time.time() + + if (now - self._last_check_time) > self._reload_check_interval: + self._last_check_time = now + try: + modtime = self._get_last_modified_time() + if modtime > self._last_mod_time: + self._load() + except OSError, e: + if e.errno == errno.ENOENT: # file not found + # someone messed with our internal state + # or removed the file + + print 'WARNING: Configuration file has been removed ' + (self._indra_config_file) + print 'Disabling reloading of configuration file.' + + traceback.print_exc() + + self._indra_config_file = None + self._last_check_time = 0 + self._last_mod_time = 0 + else: + raise # pass the exception along to the caller + + def __getitem__(self, key): + self._reload_if_necessary() + + return self._combined_dict[key] + + def get(self, key, default = None): + try: + return self.__getitem__(key) + except KeyError: + return default + + def __setitem__(self, key, value): + """ + Sets the value of the config setting of key to be newval + + Once any key/value pair is changed via the set method, + that key/value pair will remain set with that value until + change via the update or set method + """ + self._config_overrides[key] = value + self._combine_dictionaries() + + def set(self, key, newval): + return self.__setitem__(key, newval) + + def update(self, new_conf): + """ + Load an XML file and apply its map as overrides or additions + to the existing config. Update can be a file or a dict. + + Once any key/value pair is changed via the update method, + that key/value pair will remain set with that value until + change via the update or set method + """ + if isinstance(new_conf, dict): + overrides = new_conf + else: + # assuming that it is a filename + config_file = open(new_conf) + overrides = llsd.parse(config_file.read()) + config_file.close() + + self._config_overrides.update(overrides) + self._combine_dictionaries() + + def as_dict(self): + """ + Returns immutable copy of the IndraConfig as a dictionary + """ + return copy.deepcopy(self._combined_dict) + +def load(indra_xml_file = None): + global _g_config + + if indra_xml_file is None: + ## going from: + ## "/opt/linden/indra/lib/python/indra/base/config.py" + ## to: + ## "/opt/linden/etc/indra.xml" + indra_xml_file = realpath( + dirname(realpath(__file__)) + "../../../../../../etc/indra.xml") + + try: + _g_config = IndraConfig(indra_xml_file) + except IOError: + # indra.xml was not openable, so let's initialize with an empty dict + # some code relies on config behaving this way + _g_config = IndraConfig(None) + +def dump(indra_xml_file, indra_cfg = None, update_in_mem=False): ''' Dump config contents into a file Kindof reverse of load. Optionally takes a new config to dump. Does NOT update global config unless requested. ''' - global _g_config_dict + global _g_config + if not indra_cfg: - indra_cfg = _g_config_dict + if _g_config is None: + return + + indra_cfg = _g_config.as_dict() + if not indra_cfg: return + config_file = open(indra_xml_file, 'w') _config_xml = llsd.format_xml(indra_cfg) config_file.write(_config_xml) config_file.close() + if update_in_mem: update(indra_cfg) def update(new_conf): - """Load an XML file and apply its map as overrides or additions - to the existing config. The dataserver does this with indra.xml - and dataserver.xml.""" - global _g_config_dict - if _g_config_dict == None: - _g_config_dict = {} - if isinstance(new_conf, dict): - overrides = new_conf - else: - config_file = file(new_conf) - overrides = llsd.LLSD().parse(config_file.read()) - config_file.close() - - _g_config_dict.update(overrides) + global _g_config + + if _g_config is None: + # To keep with how this function behaved + # previously, a call to update + # before the global is defined + # make a new global config which does not + # load data from a file. + _g_config = IndraConfig(None) + + return _g_config.update(new_conf) def get(key, default = None): - global _g_config_dict - if _g_config_dict == None: + global _g_config + + if _g_config is None: load() - return _g_config_dict.get(key, default) + + return _g_config.get(key, default) def set(key, newval): - global _g_config_dict - if _g_config_dict == None: - load() - _g_config_dict[key] = newval + """ + Sets the value of the config setting of key to be newval + + Once any key/value pair is changed via the set method, + that key/value pair will remain set with that value until + change via the update or set method or program termination + """ + global _g_config + + if _g_config is None: + _g_config = IndraConfig(None) + + _g_config.set(key, newval) -def as_dict(): - global _g_config_dict - return _g_config_dict +def get_config(): + global _g_config + return _g_config diff --git a/linden/indra/lib/python/indra/base/llsd.py b/linden/indra/lib/python/indra/base/llsd.py index cd23551..995ace7 100644 --- a/linden/indra/lib/python/indra/base/llsd.py +++ b/linden/indra/lib/python/indra/base/llsd.py @@ -33,14 +33,7 @@ import time import types import re -#from cElementTree import fromstring ## This does not work under Windows -try: - ## This is the old name of elementtree, for use with 2.3 - from elementtree.ElementTree import fromstring -except ImportError: - ## This is the name of elementtree under python 2.5 - from xml.etree.ElementTree import fromstring - +from indra.util.fastest_elementtree import fromstring from indra.base import lluuid int_regex = re.compile("[-+]?\d+") @@ -67,6 +60,39 @@ BOOL_TRUE = ('1', '1.0', 'true') BOOL_FALSE = ('0', '0.0', 'false', '') +def format_datestr(v): + """ Formats a datetime object into the string format shared by xml and notation serializations.""" + second_str = "" + if v.microsecond > 0: + seconds = v.second + float(v.microsecond) / 1000000 + second_str = "%05.2f" % seconds + else: + second_str = "%d" % v.second + return '%s%sZ' % (v.strftime('%Y-%m-%dT%H:%M:'), second_str) + + +def parse_datestr(datestr): + """Parses a datetime object from the string format shared by xml and notation serializations.""" + if datestr == "": + return datetime.datetime(1970, 1, 1) + + match = re.match(date_regex, datestr) + if not match: + raise LLSDParseError("invalid date string '%s'." % datestr) + + year = int(match.group('year')) + month = int(match.group('month')) + day = int(match.group('day')) + hour = int(match.group('hour')) + minute = int(match.group('minute')) + second = int(match.group('second')) + seconds_float = match.group('second_float') + microsecond = 0 + if seconds_float: + microsecond = int(seconds_float[1:]) * 10000 + return datetime.datetime(year, month, day, hour, minute, second, microsecond) + + def bool_to_python(node): val = node.text or '' if val in BOOL_TRUE: @@ -99,8 +125,7 @@ def date_to_python(node): val = node.text or '' if not val: val = "1970-01-01T00:00:00Z" - return datetime.datetime( - *time.strptime(val, '%Y-%m-%dT%H:%M:%SZ')[:6]) + return parse_datestr(val) def uri_to_python(node): val = node.text or '' @@ -194,7 +219,7 @@ class LLSDXMLFormatter(object): def URI(self, v): return self.elt('uri', self.xml_esc(str(v))) def DATE(self, v): - return self.elt('date', v.strftime('%Y-%m-%dT%H:%M:%SZ')) + return self.elt('date', format_datestr(v)) def ARRAY(self, v): return self.elt('array', ''.join([self.generate(item) for item in v])) def MAP(self, v): @@ -215,8 +240,12 @@ class LLSDXMLFormatter(object): def format(self, something): return '' + self.elt("llsd", self.generate(something)) +_g_xml_formatter = None def format_xml(something): - return LLSDXMLFormatter().format(something) + global _g_xml_formatter + if _g_xml_formatter is None: + _g_xml_formatter = LLSDXMLFormatter() + return _g_xml_formatter.format(something) class LLSDXMLPrettyFormatter(LLSDXMLFormatter): def __init__(self, indent_atom = None): @@ -333,13 +362,7 @@ class LLSDNotationFormatter(object): def URI(self, v): return 'l"%s"' % str(v).replace("\\", "\\\\").replace('"', '\\"') def DATE(self, v): - second_str = "" - if v.microsecond > 0: - seconds = v.second + float(v.microsecond) / 1000000 - second_str = "%05.2f" % seconds - else: - second_str = "%d" % v.second - return 'd"%s%sZ"' % (v.strftime('%Y-%m-%dT%H:%M:'), second_str) + return 'd"%s"' % format_datestr(v) def ARRAY(self, v): return "[%s]" % ','.join([self.generate(item) for item in v]) def MAP(self, v): @@ -548,10 +571,11 @@ class LLSDNotationParser(object): integer: i#### real: r#### uuid: u#### - string: "g'day" | 'have a "nice" day' | s(size)"raw data" + string: "g\'day" | 'have a "nice" day' | s(size)"raw data" uri: l"escaped" date: d"YYYY-MM-DDTHH:MM:SS.FFZ" - binary: b##"ff3120ab1" | b(size)"raw data" """ + binary: b##"ff3120ab1" | b(size)"raw data" + """ def __init__(self): pass @@ -614,7 +638,6 @@ class LLSDNotationParser(object): elif cc == 'b': raise LLSDParseError("binary notation not yet supported") else: - print cc raise LLSDParseError("invalid token at index %d: %d" % ( self._index - 1, ord(cc))) @@ -695,25 +718,7 @@ class LLSDNotationParser(object): delim = self._buffer[self._index] self._index += 1 datestr = self._parse_string(delim) - - if datestr == "": - return datetime.datetime(1970, 1, 1) - - match = re.match(date_regex, datestr) - if not match: - raise LLSDParseError("invalid date string '%s'." % datestr) - - year = int(match.group('year')) - month = int(match.group('month')) - day = int(match.group('day')) - hour = int(match.group('hour')) - minute = int(match.group('minute')) - second = int(match.group('second')) - seconds_float = match.group('second_float') - microsecond = 0 - if seconds_float: - microsecond = int(seconds_float[1:]) * 10000 - return datetime.datetime(year, month, day, hour, minute, second, microsecond) + return parse_datestr(datestr) def _parse_real(self): match = re.match(real_regex, self._buffer[self._index:]) @@ -738,7 +743,7 @@ class LLSDNotationParser(object): return int( self._buffer[start:end] ) def _parse_string(self, delim): - """ string: "g'day" | 'have a "nice" day' | s(size)"raw data" """ + """ string: "g\'day" | 'have a "nice" day' | s(size)"raw data" """ rv = "" if delim in ("'", '"'): @@ -908,22 +913,17 @@ class LLSD(object): undef = LLSD(None) -# register converters for stacked, if stacked is available +# register converters for llsd in mulib, if it is available try: - from mulib import stacked + from mulib import stacked, mu stacked.NoProducer() # just to exercise stacked + mu.safe_load(None) # just to exercise mu except: - print "Couldn't import mulib.stacked, not registering LLSD converters" + # mulib not available, don't print an error message since this is normal + pass else: - def llsd_convert_json(llsd_stuff, request): - callback = request.get_header('callback') - if callback is not None: - ## See Yahoo's ajax documentation for information about using this - ## callback style of programming - ## http://developer.yahoo.com/common/json.html#callbackparam - req.write("%s(%s)" % (callback, simplejson.dumps(llsd_stuff))) - else: - req.write(simplejson.dumps(llsd_stuff)) + mu.add_parser(parse, 'application/llsd+xml') + mu.add_parser(parse, 'application/llsd+binary') def llsd_convert_xml(llsd_stuff, request): request.write(format_xml(llsd_stuff)) @@ -932,8 +932,6 @@ else: request.write(format_binary(llsd_stuff)) for typ in [LLSD, dict, list, tuple, str, int, float, bool, unicode, type(None)]: - stacked.add_producer(typ, llsd_convert_json, 'application/json') - stacked.add_producer(typ, llsd_convert_xml, 'application/llsd+xml') stacked.add_producer(typ, llsd_convert_xml, 'application/xml') stacked.add_producer(typ, llsd_convert_xml, 'text/xml') diff --git a/linden/indra/lib/python/indra/base/lluuid.py b/linden/indra/lib/python/indra/base/lluuid.py index dd336f0..0756889 100644 --- a/linden/indra/lib/python/indra/base/lluuid.py +++ b/linden/indra/lib/python/indra/base/lluuid.py @@ -74,21 +74,29 @@ class UUID(object): hexip = ''.join(["%04x" % long(i) for i in ip.split('.')]) lastid = '' - def __init__(self, string_with_uuid=None): + def __init__(self, possible_uuid=None): """ - Initialize to first valid UUID in string argument, - or to null UUID if none found or string is not supplied. + Initialize to first valid UUID in argument (if a string), + or to null UUID if none found or argument is not supplied. + + If the argument is a UUID, the constructed object will be a copy of it. """ self._bits = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" - if string_with_uuid: - uuid_match = UUID.uuid_regex.search(string_with_uuid) - if uuid_match: - uuid_string = uuid_match.group() - s = string.replace(uuid_string, '-', '') - self._bits = _int2binstr(string.atol(s[:8],16),4) + \ - _int2binstr(string.atol(s[8:16],16),4) + \ - _int2binstr(string.atol(s[16:24],16),4) + \ - _int2binstr(string.atol(s[24:],16),4) + if possible_uuid is None: + return + + if isinstance(possible_uuid, type(self)): + self.set(possible_uuid) + return + + uuid_match = UUID.uuid_regex.search(possible_uuid) + if uuid_match: + uuid_string = uuid_match.group() + s = string.replace(uuid_string, '-', '') + self._bits = _int2binstr(string.atol(s[:8],16),4) + \ + _int2binstr(string.atol(s[8:16],16),4) + \ + _int2binstr(string.atol(s[16:24],16),4) + \ + _int2binstr(string.atol(s[24:],16),4) def __len__(self): """ diff --git a/linden/indra/lib/python/indra/ipc/llsdhttp.py b/linden/indra/lib/python/indra/ipc/llsdhttp.py index 24cad61..1cf1146 100644 --- a/linden/indra/lib/python/indra/ipc/llsdhttp.py +++ b/linden/indra/lib/python/indra/ipc/llsdhttp.py @@ -48,7 +48,11 @@ put_ = suite.put_ request = suite.request request_ = suite.request_ -for x in (httpc.ConnectionError, httpc.NotFound, httpc.Forbidden): +# import every httpc error exception into our namespace for convenience +for x in httpc.status_to_error_map.itervalues(): + globals()[x.__name__] = x + +for x in (httpc.ConnectionError,): globals()[x.__name__] = x @@ -60,21 +64,22 @@ def postFile(url, filename): return post_(url, llsd_body) +# deprecated in favor of get_ def getStatus(url, use_proxy=False): status, _headers, _body = get_(url, use_proxy=use_proxy) return status - +# deprecated in favor of put_ def putStatus(url, data): status, _headers, _body = put_(url, data) return status - +# deprecated in favor of delete_ def deleteStatus(url): status, _headers, _body = delete_(url) return status - +# deprecated in favor of post_ def postStatus(url, data): status, _headers, _body = post_(url, data) return status diff --git a/linden/indra/lib/python/indra/ipc/mysql_pool.py b/linden/indra/lib/python/indra/ipc/mysql_pool.py index 01e31bb..507b185 100644 --- a/linden/indra/lib/python/indra/ipc/mysql_pool.py +++ b/linden/indra/lib/python/indra/ipc/mysql_pool.py @@ -1,6 +1,6 @@ """\ @file mysql_pool.py -@brief Uses saranwrap to implement a pool of nonblocking database connections to a mysql server. +@brief Thin wrapper around eventlet.db_pool that chooses MySQLdb and Tpool. $LicenseInfo:firstyear=2007&license=mit$ @@ -26,44 +26,14 @@ THE SOFTWARE. $/LicenseInfo$ """ -import os - -from eventlet.pools import Pool -from eventlet.processes import DeadProcess -from indra.ipc import saranwrap - import MySQLdb +from eventlet import db_pool -# method 2: better -- admits the existence of the pool -# dbp = my_db_connector.get() -# dbh = dbp.get() -# dbc = dbh.cursor() -# dbc.execute(named_query) -# dbc.close() -# dbp.put(dbh) - -class DatabaseConnector(object): - """\ -@brief This is an object which will maintain a collection of database -connection pools keyed on host,databasename""" +class DatabaseConnector(db_pool.DatabaseConnector): def __init__(self, credentials, min_size = 0, max_size = 4, *args, **kwargs): - """\ - @brief constructor - @param min_size the minimum size of a child pool. - @param max_size the maximum size of a child pool.""" - self._min_size = min_size - self._max_size = max_size - self._args = args - self._kwargs = kwargs - self._credentials = credentials # this is a map of hostname to username/password - self._databases = {} - - def credentials_for(self, host): - if host in self._credentials: - return self._credentials[host] - else: - return self._credentials.get('default', None) + super(DatabaseConnector, self).__init__(MySQLdb, credentials, min_size, max_size, conn_pool=db_pool.ConnectionPool, *args, **kwargs) + # get is extended relative to eventlet.db_pool to accept a port argument def get(self, host, dbname, port=3306): key = (host, dbname, port) if key not in self._databases: @@ -77,28 +47,44 @@ connection pools keyed on host,databasename""" return self._databases[key] - -class ConnectionPool(Pool): +class ConnectionPool(db_pool.TpooledConnectionPool): """A pool which gives out saranwrapped MySQLdb connections from a pool """ - def __init__(self, min_size = 0, max_size = 4, *args, **kwargs): - self._args = args - self._kwargs = kwargs - Pool.__init__(self, min_size, max_size) - def create(self): - return saranwrap.wrap(MySQLdb).connect(*self._args, **self._kwargs) - - def put(self, conn): - # rollback any uncommitted changes, so that the next process - # has a clean slate. This also pokes the process to see if - # it's dead or None - try: - conn.rollback() - except (AttributeError, DeadProcess), e: - conn = self.create() - # TODO figure out if we're still connected to the database - if conn is not None: - Pool.put(self, conn) - else: - self.current_size -= 1 + def __init__(self, min_size = 0, max_size = 4, *args, **kwargs): + super(ConnectionPool, self).__init__(MySQLdb, min_size, max_size, *args, **kwargs) + + def get(self): + conn = super(ConnectionPool, self).get() + # annotate the connection object with the details on the + # connection; this is used elsewhere to check that you haven't + # suddenly changed databases in midstream while making a + # series of queries on a connection. + arg_names = ['host','user','passwd','db','port','unix_socket','conv','connect_timeout', + 'compress', 'named_pipe', 'init_command', 'read_default_file', 'read_default_group', + 'cursorclass', 'use_unicode', 'charset', 'sql_mode', 'client_flag', 'ssl', + 'local_infile'] + # you could have constructed this connectionpool with a mix of + # keyword and non-keyword arguments, but we want to annotate + # the connection object with a dict so it's easy to check + # against so here we are converting the list of non-keyword + # arguments (in self._args) into a dict of keyword arguments, + # and merging that with the actual keyword arguments + # (self._kwargs). The arg_names variable lists the + # constructor arguments for MySQLdb Connection objects. + converted_kwargs = dict([ (arg_names[i], arg) for i, arg in enumerate(self._args) ]) + converted_kwargs.update(self._kwargs) + conn.connection_parameters = converted_kwargs + return conn + + def clear(self): + """ Close all connections that this pool still holds a reference to, leaving it empty.""" + for conn in self.free_items: + try: + conn.close() + except: + pass # even if stuff happens here, we still want to at least try to close all the other connections + self.free_items.clear() + + def __del__(self): + self.clear() diff --git a/linden/indra/lib/python/indra/ipc/siesta.py b/linden/indra/lib/python/indra/ipc/siesta.py new file mode 100644 index 0000000..5fbea29 --- /dev/null +++ b/linden/indra/lib/python/indra/ipc/siesta.py @@ -0,0 +1,402 @@ +from indra.base import llsd +from webob import exc +import webob +import re, socket + +try: + from cStringIO import StringIO +except ImportError: + from StringIO import StringIO + +try: + import cjson + json_decode = cjson.decode + json_encode = cjson.encode + JsonDecodeError = cjson.DecodeError + JsonEncodeError = cjson.EncodeError +except ImportError: + import simplejson + json_decode = simplejson.loads + json_encode = simplejson.dumps + JsonDecodeError = ValueError + JsonEncodeError = TypeError + + +llsd_parsers = { + 'application/json': json_decode, + 'application/llsd+binary': llsd.parse_binary, + 'application/llsd+notation': llsd.parse_notation, + 'application/llsd+xml': llsd.parse_xml, + 'application/xml': llsd.parse_xml, + } + + +def mime_type(content_type): + '''Given a Content-Type header, return only the MIME type.''' + + return content_type.split(';', 1)[0].strip().lower() + +class BodyLLSD(object): + '''Give a webob Request or Response an llsd property. + + Getting the llsd property parses the body, and caches the result. + + Setting the llsd property formats a payload, and the body property + is set.''' + + def _llsd__get(self): + '''Get, set, or delete the LLSD value stored in this object.''' + + try: + return self._llsd + except AttributeError: + if not self.body: + raise AttributeError('No llsd attribute has been set') + else: + mtype = mime_type(self.content_type) + try: + parser = llsd_parsers[mtype] + except KeyError: + raise exc.HTTPUnsupportedMediaType( + 'Content type %s not supported' % mtype).exception + try: + self._llsd = parser(self.body) + except (llsd.LLSDParseError, JsonDecodeError, TypeError), err: + raise exc.HTTPBadRequest( + 'Could not parse body: %r' % err.args).exception + return self._llsd + + def _llsd__set(self, val): + req = getattr(self, 'request', None) + if req is not None: + formatter, ctype = formatter_for_request(req) + self.content_type = ctype + else: + formatter, ctype = formatter_for_mime_type( + mime_type(self.content_type)) + self.body = formatter(val) + + def _llsd__del(self): + if hasattr(self, '_llsd'): + del self._llsd + + llsd = property(_llsd__get, _llsd__set, _llsd__del) + + +class Response(webob.Response, BodyLLSD): + '''Response class with LLSD support. + + A sensible default content type is used. + + Setting the llsd property also sets the body. Getting the llsd + property parses the body if necessary. + + If you set the body property directly, the llsd property will be + deleted.''' + + default_content_type = 'application/llsd+xml' + + def _body__set(self, body): + if hasattr(self, '_llsd'): + del self._llsd + super(Response, self)._body__set(body) + + def cache_forever(self): + self.cache_expires(86400 * 365) + + body = property(webob.Response._body__get, _body__set, + webob.Response._body__del, + webob.Response._body__get.__doc__) + + +class Request(webob.Request, BodyLLSD): + '''Request class with LLSD support. + + Sensible content type and accept headers are used by default. + + Setting the llsd property also sets the body. Getting the llsd + property parses the body if necessary. + + If you set the body property directly, the llsd property will be + deleted.''' + + default_content_type = 'application/llsd+xml' + default_accept = ('application/llsd+xml; q=0.5, ' + 'application/llsd+notation; q=0.3, ' + 'application/llsd+binary; q=0.2, ' + 'application/xml; q=0.1, ' + 'application/json; q=0.0') + + def __init__(self, environ=None, *args, **kwargs): + if environ is None: + environ = {} + else: + environ = environ.copy() + if 'CONTENT_TYPE' not in environ: + environ['CONTENT_TYPE'] = self.default_content_type + if 'HTTP_ACCEPT' not in environ: + environ['HTTP_ACCEPT'] = self.default_accept + super(Request, self).__init__(environ, *args, **kwargs) + + def _body__set(self, body): + if hasattr(self, '_llsd'): + del self._llsd + super(Request, self)._body__set(body) + + def path_urljoin(self, *parts): + return '/'.join([path_url.rstrip('/')] + list(parts)) + + body = property(webob.Request._body__get, _body__set, + webob.Request._body__del, webob.Request._body__get.__doc__) + + def create_response(self, llsd=None, status='200 OK', + conditional_response=webob.NoDefault): + resp = self.ResponseClass(status=status, request=self, + conditional_response=conditional_response) + resp.llsd = llsd + return resp + + def curl(self): + '''Create and fill out a pycurl easy object from this request.''' + + import pycurl + c = pycurl.Curl() + c.setopt(pycurl.URL, self.url()) + if self.headers: + c.setopt(pycurl.HTTPHEADER, + ['%s: %s' % (k, self.headers[k]) for k in self.headers]) + c.setopt(pycurl.FOLLOWLOCATION, True) + c.setopt(pycurl.AUTOREFERER, True) + c.setopt(pycurl.MAXREDIRS, 16) + c.setopt(pycurl.NOSIGNAL, True) + c.setopt(pycurl.READFUNCTION, self.body_file.read) + c.setopt(pycurl.SSL_VERIFYHOST, 2) + + if self.method == 'POST': + c.setopt(pycurl.POST, True) + post301 = getattr(pycurl, 'POST301', None) + if post301 is not None: + # Added in libcurl 7.17.1. + c.setopt(post301, True) + elif self.method == 'PUT': + c.setopt(pycurl.PUT, True) + elif self.method != 'GET': + c.setopt(pycurl.CUSTOMREQUEST, self.method) + return c + +Request.ResponseClass = Response +Response.RequestClass = Request + + +llsd_formatters = { + 'application/json': json_encode, + 'application/llsd+binary': llsd.format_binary, + 'application/llsd+notation': llsd.format_notation, + 'application/llsd+xml': llsd.format_xml, + 'application/xml': llsd.format_xml, + } + + +def formatter_for_mime_type(mime_type): + '''Return a formatter that encodes to the given MIME type. + + The result is a pair of function and MIME type.''' + + try: + return llsd_formatters[mime_type], mime_type + except KeyError: + raise exc.HTTPInternalServerError( + 'Could not use MIME type %r to format response' % + mime_type).exception + + +def formatter_for_request(req): + '''Return a formatter that encodes to the preferred type of the client. + + The result is a pair of function and actual MIME type.''' + + for ctype in req.accept.best_matches('application/llsd+xml'): + try: + return llsd_formatters[ctype], ctype + except KeyError: + pass + else: + raise exc.HTTPNotAcceptable().exception + + +def wsgi_adapter(func, environ, start_response): + '''Adapt a Siesta callable to act as a WSGI application.''' + + try: + req = Request(environ) + resp = func(req, **req.urlvars) + if not isinstance(resp, webob.Response): + try: + formatter, ctype = formatter_for_request(req) + resp = req.ResponseClass(formatter(resp), content_type=ctype) + resp._llsd = resp + except (JsonEncodeError, TypeError), err: + resp = exc.HTTPInternalServerError( + detail='Could not format response') + except exc.HTTPException, e: + resp = e + except socket.error, e: + resp = exc.HTTPInternalServerError(detail=e.args[1]) + return resp(environ, start_response) + + +def llsd_callable(func): + '''Turn a callable into a Siesta application.''' + + def replacement(environ, start_response): + return wsgi_adapter(func, environ, start_response) + + return replacement + + +def llsd_method(http_method, func): + def replacement(environ, start_response): + if environ['REQUEST_METHOD'] == http_method: + return wsgi_adapter(func, environ, start_response) + return exc.HTTPMethodNotAllowed()(environ, start_response) + + return replacement + + +http11_methods = 'OPTIONS GET HEAD POST PUT DELETE TRACE CONNECT'.split() +http11_methods.sort() + +def llsd_class(cls): + '''Turn a class into a Siesta application. + + A new instance is created for each request. A HTTP method FOO is + turned into a call to the handle_foo method of the instance.''' + + def foo(req, **kwargs): + instance = cls() + method = req.method.lower() + try: + handler = getattr(instance, 'handle_' + method) + except AttributeError: + allowed = [m for m in http11_methods + if hasattr(instance, 'handle_' + m.lower())] + raise exc.HTTPMethodNotAllowed( + headers={'Allowed': ', '.join(allowed)}).exception + return handler(req, **kwargs) + + def replacement(environ, start_response): + return wsgi_adapter(foo, environ, start_response) + + return replacement + + +def curl(reqs): + import pycurl + + m = pycurl.CurlMulti() + curls = [r.curl() for r in reqs] + io = {} + for c in curls: + fp = StringIO() + hdr = StringIO() + c.setopt(pycurl.WRITEFUNCTION, fp.write) + c.setopt(pycurl.HEADERFUNCTION, hdr.write) + io[id(c)] = fp, hdr + m.handles = curls + try: + while True: + ret, num_handles = m.perform() + if ret != pycurl.E_CALL_MULTI_PERFORM: + break + finally: + m.close() + + for req, c in zip(reqs, curls): + fp, hdr = io[id(c)] + hdr.seek(0) + status = hdr.readline().rstrip() + headers = [] + name, values = None, None + + # XXX We don't currently handle bogus header data. + + for line in hdr.readlines(): + if not line[0].isspace(): + if name: + headers.append((name, ' '.join(values))) + name, value = line.strip().split(':', 1) + value = [value] + else: + values.append(line.strip()) + if name: + headers.append((name, ' '.join(values))) + + resp = c.ResponseClass(fp.getvalue(), status, headers, request=req) + + +route_re = re.compile(r''' + \{ # exact character "{" + (\w+) # variable name (restricted to a-z, 0-9, _) + (?:([:~])([^}]+))? # optional :type or ~regex part + \} # exact character "}" + ''', re.VERBOSE) + +predefined_regexps = { + 'uuid': r'[a-f0-9][a-f0-9-]{31,35}', + 'int': r'\d+', + } + +def compile_route(route): + fp = StringIO() + last_pos = 0 + for match in route_re.finditer(route): + fp.write(re.escape(route[last_pos:match.start()])) + var_name = match.group(1) + sep = match.group(2) + expr = match.group(3) + if expr: + if sep == ':': + expr = predefined_regexps[expr] + # otherwise, treat what follows '~' as a regexp + else: + expr = '[^/]+' + expr = '(?P<%s>%s)' % (var_name, expr) + fp.write(expr) + last_pos = match.end() + fp.write(re.escape(route[last_pos:])) + return '^%s$' % fp.getvalue() + +class Router(object): + '''WSGI routing class. Parses a URL and hands off a request to + some other WSGI application. If no suitable application is found, + responds with a 404.''' + + def __init__(self): + self.routes = [] + self.paths = [] + + def add(self, route, app, methods=None): + self.paths.append(route) + self.routes.append((re.compile(compile_route(route)), app, + methods and dict.fromkeys(methods))) + + def __call__(self, environ, start_response): + path_info = environ['PATH_INFO'] + request_method = environ['REQUEST_METHOD'] + allowed = [] + for regex, app, methods in self.routes: + m = regex.match(path_info) + if m: + if not methods or request_method in methods: + environ['paste.urlvars'] = m.groupdict() + return app(environ, start_response) + else: + allowed += methods + if allowed: + allowed = dict.fromkeys(allows).keys() + allowed.sort() + resp = exc.HTTPMethodNotAllowed( + headers={'Allowed': ', '.join(allowed)}) + else: + resp = exc.HTTPNotFound() + return resp(environ, start_response) diff --git a/linden/indra/lib/python/indra/ipc/siesta_test.py b/linden/indra/lib/python/indra/ipc/siesta_test.py new file mode 100644 index 0000000..177ea71 --- /dev/null +++ b/linden/indra/lib/python/indra/ipc/siesta_test.py @@ -0,0 +1,214 @@ +from indra.base import llsd, lluuid +from indra.ipc import siesta +import datetime, math, unittest +from webob import exc + + +class ClassApp(object): + def handle_get(self, req): + pass + + def handle_post(self, req): + return req.llsd + + +def callable_app(req): + if req.method == 'UNDERPANTS': + raise exc.HTTPMethodNotAllowed() + elif req.method == 'GET': + return None + return req.llsd + + +class TestBase: + def test_basic_get(self): + req = siesta.Request.blank('/') + self.assertEquals(req.get_response(self.server).body, + llsd.format_xml(None)) + + def test_bad_method(self): + req = siesta.Request.blank('/') + req.environ['REQUEST_METHOD'] = 'UNDERPANTS' + self.assertEquals(req.get_response(self.server).status_int, + exc.HTTPMethodNotAllowed.code) + + json_safe = { + 'none': None, + 'bool_true': True, + 'bool_false': False, + 'int_zero': 0, + 'int_max': 2147483647, + 'int_min': -2147483648, + 'long_zero': 0, + 'long_max': 2147483647L, + 'long_min': -2147483648L, + 'float_zero': 0, + 'float': math.pi, + 'float_huge': 3.14159265358979323846e299, + 'str_empty': '', + 'str': 'foo', + u'unic\u1e51de_empty': u'', + u'unic\u1e51de': u'\u1e4exx\u10480', + } + json_safe['array'] = json_safe.values() + json_safe['tuple'] = tuple(json_safe.values()) + json_safe['dict'] = json_safe.copy() + + json_unsafe = { + 'uuid_empty': lluuid.UUID(), + 'uuid_full': lluuid.UUID('dc61ab0530200d7554d23510559102c1a98aab1b'), + 'binary_empty': llsd.binary(), + 'binary': llsd.binary('f\0\xff'), + 'uri_empty': llsd.uri(), + 'uri': llsd.uri('http://www.secondlife.com/'), + 'datetime_empty': datetime.datetime(1970,1,1), + 'datetime': datetime.datetime(1999,9,9,9,9,9), + } + json_unsafe.update(json_safe) + json_unsafe['array'] = json_unsafe.values() + json_unsafe['tuple'] = tuple(json_unsafe.values()) + json_unsafe['dict'] = json_unsafe.copy() + json_unsafe['iter'] = iter(json_unsafe.values()) + + def _test_client_content_type_good(self, content_type, ll): + def run(ll): + req = siesta.Request.blank('/') + req.environ['REQUEST_METHOD'] = 'POST' + req.content_type = content_type + req.llsd = ll + req.accept = content_type + resp = req.get_response(self.server) + self.assertEquals(resp.status_int, 200) + return req, resp + + if False and isinstance(ll, dict): + def fixup(v): + if isinstance(v, float): + return '%.5f' % v + if isinstance(v, long): + return int(v) + if isinstance(v, (llsd.binary, llsd.uri)): + return v + if isinstance(v, (tuple, list)): + return [fixup(i) for i in v] + if isinstance(v, dict): + return dict([(k, fixup(i)) for k, i in v.iteritems()]) + return v + for k, v in ll.iteritems(): + l = [k, v] + req, resp = run(l) + self.assertEquals(fixup(resp.llsd), fixup(l)) + + run(ll) + + def test_client_content_type_json_good(self): + self._test_client_content_type_good('application/json', self.json_safe) + + def test_client_content_type_llsd_xml_good(self): + self._test_client_content_type_good('application/llsd+xml', + self.json_unsafe) + + def test_client_content_type_llsd_notation_good(self): + self._test_client_content_type_good('application/llsd+notation', + self.json_unsafe) + + def test_client_content_type_llsd_binary_good(self): + self._test_client_content_type_good('application/llsd+binary', + self.json_unsafe) + + def test_client_content_type_xml_good(self): + self._test_client_content_type_good('application/xml', + self.json_unsafe) + + def _test_client_content_type_bad(self, content_type): + req = siesta.Request.blank('/') + req.environ['REQUEST_METHOD'] = 'POST' + req.body = '\0invalid nonsense under all encodings' + req.content_type = content_type + self.assertEquals(req.get_response(self.server).status_int, + exc.HTTPBadRequest.code) + + def test_client_content_type_json_bad(self): + self._test_client_content_type_bad('application/json') + + def test_client_content_type_llsd_xml_bad(self): + self._test_client_content_type_bad('application/llsd+xml') + + def test_client_content_type_llsd_notation_bad(self): + self._test_client_content_type_bad('application/llsd+notation') + + def test_client_content_type_llsd_binary_bad(self): + self._test_client_content_type_bad('application/llsd+binary') + + def test_client_content_type_xml_bad(self): + self._test_client_content_type_bad('application/xml') + + def test_client_content_type_bad(self): + req = siesta.Request.blank('/') + req.environ['REQUEST_METHOD'] = 'POST' + req.body = 'XXX' + req.content_type = 'application/nonsense' + self.assertEquals(req.get_response(self.server).status_int, + exc.HTTPUnsupportedMediaType.code) + + def test_request_default_content_type(self): + req = siesta.Request.blank('/') + self.assertEquals(req.content_type, req.default_content_type) + + def test_request_default_accept(self): + req = siesta.Request.blank('/') + from webob import acceptparse + self.assertEquals(str(req.accept).replace(' ', ''), + req.default_accept.replace(' ', '')) + + def test_request_llsd_auto_body(self): + req = siesta.Request.blank('/') + req.llsd = {'a': 2} + self.assertEquals(req.body, '' + 'a2') + + def test_request_llsd_mod_body_changes_llsd(self): + req = siesta.Request.blank('/') + req.llsd = {'a': 2} + req.body = '1337' + self.assertEquals(req.llsd, 1337) + + def test_request_bad_llsd_fails(self): + def crashme(ctype): + def boom(): + class foo(object): pass + req = siesta.Request.blank('/') + req.content_type = ctype + req.llsd = foo() + for mime_type in siesta.llsd_parsers: + self.assertRaises(TypeError, crashme(mime_type)) + + +class ClassServer(TestBase, unittest.TestCase): + def __init__(self, *args, **kwargs): + unittest.TestCase.__init__(self, *args, **kwargs) + self.server = siesta.llsd_class(ClassApp) + + +class CallableServer(TestBase, unittest.TestCase): + def __init__(self, *args, **kwargs): + unittest.TestCase.__init__(self, *args, **kwargs) + self.server = siesta.llsd_callable(callable_app) + + +class RouterServer(unittest.TestCase): + def test_router(self): + def foo(req, quux): + print quux + + r = siesta.Router() + r.add('/foo/{quux:int}', siesta.llsd_callable(foo), methods=['GET']) + req = siesta.Request.blank('/foo/33') + req.get_response(r) + + req = siesta.Request.blank('/foo/bar') + self.assertEquals(req.get_response(r).status_int, + exc.HTTPNotFound.code) + +if __name__ == '__main__': + unittest.main() diff --git a/linden/indra/lib/python/indra/util/fastest_elementtree.py b/linden/indra/lib/python/indra/util/fastest_elementtree.py new file mode 100644 index 0000000..64aed09 --- /dev/null +++ b/linden/indra/lib/python/indra/util/fastest_elementtree.py @@ -0,0 +1,52 @@ +"""\ +@file fastest_elementtree.py +@brief Concealing some gnarly import logic in here. This should export the interface of elementtree. + +$LicenseInfo:firstyear=2006&license=mit$ + +Copyright (c) 2006-2008, Linden Research, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +$/LicenseInfo$ +""" + +# Using celementree might cause some unforeseen problems so here's a +# convenient off switch. + +# *NOTE: turned off cause of problems. :-( *TODO: debug +use_celementree = False + +try: + if not use_celementree: + raise ImportError() + from cElementTree import * ## This does not work under Windows +except ImportError: + try: + if not use_celementree: + raise ImportError() + ## This is the name of cElementTree under python 2.5 + from xml.etree.cElementTree import * + except ImportError: + try: + ## This is the old name of elementtree, for use with 2.3 + from elementtree.ElementTree import * + except ImportError: + ## This is the name of elementtree under python 2.5 + from xml.etree.ElementTree import * + diff --git a/linden/indra/lib/python/indra/util/llmanifest.py b/linden/indra/lib/python/indra/util/llmanifest.py index 89c14e8..4675177 100644 --- a/linden/indra/lib/python/indra/util/llmanifest.py +++ b/linden/indra/lib/python/indra/util/llmanifest.py @@ -34,7 +34,6 @@ import fnmatch import getopt import glob import os -import os.path import re import shutil import sys @@ -42,10 +41,10 @@ import tarfile import errno def path_ancestors(path): - path = os.path.normpath(path) + drive, path = os.path.splitdrive(os.path.normpath(path)) result = [] - while len(path) > 0: - result.append(path) + while len(path) > 0 and path != os.path.sep: + result.append(drive+path) path, sub = os.path.split(path) return result @@ -57,13 +56,13 @@ def proper_windows_path(path, current_platform = sys.platform): drive_letter = None rel = None match = re.match("/cygdrive/([a-z])/(.*)", path) - if(not match): + if not match: match = re.match('([a-zA-Z]):\\\(.*)', path) - if(not match): + if not match: return None # not an absolute path drive_letter = match.group(1) rel = match.group(2) - if(current_platform == "cygwin"): + if current_platform == "cygwin": return "/cygdrive/" + drive_letter.lower() + '/' + rel.replace('\\', '/') else: return drive_letter.upper() + ':\\' + rel.replace('/', '\\') @@ -98,6 +97,7 @@ def get_channel(srctree): return channel +DEFAULT_SRCTREE = os.path.dirname(sys.argv[0]) DEFAULT_CHANNEL = 'Second Life Release' ARGUMENTS=[ @@ -118,10 +118,12 @@ ARGUMENTS=[ Example use: %(name)s --arch=i686 On Linux this would try to use Linux_i686Manifest.""", default=""), + dict(name='build', description='Build directory.', default=DEFAULT_SRCTREE), dict(name='configuration', description="""The build configuration used. Only used on OS X for now, but it could be used for other platforms as well.""", default="Universal"), + dict(name='dest', description='Destination directory.', default=DEFAULT_SRCTREE), dict(name='grid', description="""Which grid the client will try to connect to. Even though it's not strictly a grid, 'firstlook' is also an acceptable @@ -144,6 +146,15 @@ ARGUMENTS=[ description="""The current platform, to be used for looking up which manifest class to run.""", default=get_default_platform), + dict(name='source', + description='Source directory.', + default=DEFAULT_SRCTREE), + dict(name='artwork', description='Artwork directory.', default=DEFAULT_SRCTREE), + dict(name='touch', + description="""File to touch when action is finished. Touch file will + contain the name of the final package in a form suitable + for use by a .bat file.""", + default=None), dict(name='version', description="""This specifies the version of Second Life that is being packaged up.""", @@ -167,63 +178,75 @@ def usage(srctree=""): default, arg['description'] % nd) -def main(argv=None, srctree='.', dsttree='./dst'): - if(argv == None): - argv = sys.argv - +def main(): option_names = [arg['name'] + '=' for arg in ARGUMENTS] option_names.append('help') - options, remainder = getopt.getopt(argv[1:], "", option_names) - if len(remainder) >= 1: - dsttree = remainder[0] - - print "Source tree:", srctree - print "Destination tree:", dsttree + options, remainder = getopt.getopt(sys.argv[1:], "", option_names) # convert options to a hash - args = {} + args = {'source': DEFAULT_SRCTREE, + 'artwork': DEFAULT_SRCTREE, + 'build': DEFAULT_SRCTREE, + 'dest': DEFAULT_SRCTREE } for opt in options: args[opt[0].replace("--", "")] = opt[1] + for k in 'artwork build dest source'.split(): + args[k] = os.path.normpath(args[k]) + + print "Source tree:", args['source'] + print "Artwork tree:", args['artwork'] + print "Build tree:", args['build'] + print "Destination tree:", args['dest'] + # early out for help - if args.has_key('help'): + if 'help' in args: # *TODO: it is a huge hack to pass around the srctree like this - usage(srctree) + usage(args['source']) return # defaults for arg in ARGUMENTS: - if not args.has_key(arg['name']): + if arg['name'] not in args: default = arg['default'] if hasattr(default, '__call__'): - default = default(srctree) + default = default(args['source']) if default is not None: args[arg['name']] = default # fix up version - if args.has_key('version') and type(args['version']) == str: + if isinstance(args.get('version'), str): args['version'] = args['version'].split('.') # default and agni are default if args['grid'] in ['default', 'agni']: args['grid'] = '' - if args.has_key('actions'): + if 'actions' in args: args['actions'] = args['actions'].split() # debugging for opt in args: print "Option:", opt, "=", args[opt] - wm = LLManifest.for_platform(args['platform'], args.get('arch'))(srctree, dsttree, args) + wm = LLManifest.for_platform(args['platform'], args.get('arch'))(args) wm.do(*args['actions']) + + # Write out the package file in this format, so that it can easily be called + # and used in a .bat file - yeah, it sucks, but this is the simplest... + touch = args.get('touch') + if touch: + fp = open(touch, 'w') + fp.write('set package_file=%s\n' % wm.package_file) + fp.close() + print 'touched', touch return 0 class LLManifestRegistry(type): def __init__(cls, name, bases, dct): super(LLManifestRegistry, cls).__init__(name, bases, dct) match = re.match("(\w+)Manifest", name) - if(match): + if match: cls.manifests[match.group(1).lower()] = cls class LLManifest(object): @@ -235,15 +258,18 @@ class LLManifest(object): return self.manifests[platform.lower()] for_platform = classmethod(for_platform) - def __init__(self, srctree, dsttree, args): + def __init__(self, args): super(LLManifest, self).__init__() self.args = args self.file_list = [] self.excludes = [] self.actions = [] - self.src_prefix = [srctree] - self.dst_prefix = [dsttree] + self.src_prefix = [args['source']] + self.artwork_prefix = [args['artwork']] + self.build_prefix = [args['build']] + self.dst_prefix = [args['dest']] self.created_paths = [] + self.package_name = "Unknown" def default_grid(self): return self.args.get('grid', None) == '' @@ -260,16 +286,20 @@ class LLManifest(object): in the file list by path().""" self.excludes.append(glob) - def prefix(self, src='', dst=None): + def prefix(self, src='', build=None, dst=None): """ Pushes a prefix onto the stack. Until end_prefix is called, all relevant method calls (esp. to path()) will prefix paths with the entire prefix stack. Source and destination prefixes can be different, though if only one is provided they are both equal. To specify a no-op, use an empty string, not None.""" - if(dst == None): + if dst is None: dst = src + if build is None: + build = src self.src_prefix.append(src) + self.artwork_prefix.append(src) + self.build_prefix.append(build) self.dst_prefix.append(dst) return True # so that you can wrap it in an if to get indentation @@ -281,14 +311,24 @@ class LLManifest(object): exception is raised.""" # as an error-prevention mechanism, check the prefix and see if it matches the source or destination prefix. If not, improper nesting may have occurred. src = self.src_prefix.pop() + artwork = self.artwork_prefix.pop() + build = self.build_prefix.pop() dst = self.dst_prefix.pop() - if descr and not(src == descr or dst == descr): + if descr and not(src == descr or build == descr or dst == descr): raise ValueError, "End prefix '" + descr + "' didn't match '" +src+ "' or '" +dst + "'" def get_src_prefix(self): """ Returns the current source prefix.""" return os.path.join(*self.src_prefix) + def get_artwork_prefix(self): + """ Returns the current artwork prefix.""" + return os.path.join(*self.artwork_prefix) + + def get_build_prefix(self): + """ Returns the current build prefix.""" + return os.path.join(*self.build_prefix) + def get_dst_prefix(self): """ Returns the current destination prefix.""" return os.path.join(*self.dst_prefix) @@ -298,6 +338,11 @@ class LLManifest(object): relative to the source directory.""" return os.path.join(self.get_src_prefix(), relpath) + def build_path_of(self, relpath): + """Returns the full path to a file or directory specified + relative to the build directory.""" + return os.path.join(self.get_build_prefix(), relpath) + def dst_path_of(self, relpath): """Returns the full path to a file or directory specified relative to the destination directory.""" @@ -329,13 +374,13 @@ class LLManifest(object): lines = [] while True: lines.append(fd.readline()) - if(lines[-1] == ''): + if lines[-1] == '': break else: print lines[-1], output = ''.join(lines) status = fd.close() - if(status): + if status: raise RuntimeError( "Command %s returned non-zero status (%s) \noutput:\n%s" % (command, status, output) ) @@ -356,7 +401,7 @@ class LLManifest(object): f.close() def replace_in(self, src, dst=None, searchdict={}): - if(dst == None): + if dst == None: dst = src # read src f = open(self.src_path_of(src), "rbU") @@ -369,11 +414,11 @@ class LLManifest(object): self.created_paths.append(dst) def copy_action(self, src, dst): - if(src and (os.path.exists(src) or os.path.islink(src))): + if src and (os.path.exists(src) or os.path.islink(src)): # ensure that destination path exists self.cmakedirs(os.path.dirname(dst)) self.created_paths.append(dst) - if(not os.path.isdir(src)): + if not os.path.isdir(src): self.ccopy(src,dst) else: # src is a dir @@ -408,7 +453,7 @@ class LLManifest(object): print "Cleaning up " + c def process_file(self, src, dst): - if(self.includes(src, dst)): + if self.includes(src, dst): # print src, "=>", dst for action in self.actions: methodname = action + "_action" @@ -416,26 +461,29 @@ class LLManifest(object): if method is not None: method(src, dst) self.file_list.append([src, dst]) + return 1 else: - print "Excluding: ", src, dst - + sys.stdout.write(" (excluding %r, %r)" % (src, dst)) + sys.stdout.flush() + return 0 def process_directory(self, src, dst): - if(not self.includes(src, dst)): - print "Excluding: ", src, dst - return + if not self.includes(src, dst): + sys.stdout.write(" (excluding %r, %r)" % (src, dst)) + sys.stdout.flush() + return 0 names = os.listdir(src) self.cmakedirs(dst) errors = [] + count = 0 for name in names: srcname = os.path.join(src, name) dstname = os.path.join(dst, name) if os.path.isdir(srcname): - self.process_directory(srcname, dstname) + count += self.process_directory(srcname, dstname) else: - self.process_file(srcname, dstname) - - + count += self.process_file(srcname, dstname) + return count def includes(self, src, dst): if src: @@ -446,9 +494,9 @@ class LLManifest(object): def remove(self, *paths): for path in paths: - if(os.path.exists(path)): + if os.path.exists(path): print "Removing path", path - if(os.path.isdir(path)): + if os.path.isdir(path): shutil.rmtree(path) else: os.remove(path) @@ -457,17 +505,17 @@ class LLManifest(object): """ Copy a single file or symlink. Uses filecmp to skip copying for existing files.""" if os.path.islink(src): linkto = os.readlink(src) - if(os.path.islink(dst) or os.path.exists(dst)): + if os.path.islink(dst) or os.path.exists(dst): os.remove(dst) # because symlinking over an existing link fails os.symlink(linkto, dst) else: # Don't recopy file if it's up-to-date. # If we seem to be not not overwriting files that have been # updated, set the last arg to False, but it will take longer. - if(os.path.exists(dst) and filecmp.cmp(src, dst, True)): + if os.path.exists(dst) and filecmp.cmp(src, dst, True): return # only copy if it's not excluded - if(self.includes(src, dst)): + if self.includes(src, dst): try: os.unlink(dst) except OSError, err: @@ -481,7 +529,7 @@ class LLManifest(object): feature that the destination directory can exist. It is so dumb that Python doesn't come with this. Also it implements the excludes functionality.""" - if(not self.includes(src, dst)): + if not self.includes(src, dst): return names = os.listdir(src) self.cmakedirs(dst) @@ -512,7 +560,7 @@ class LLManifest(object): def find_existing_file(self, *list): for f in list: - if(os.path.exists(f)): + if os.path.exists(f): return f # didn't find it, return last item in list if len(list) > 0: @@ -535,62 +583,63 @@ class LLManifest(object): def wildcard_regex(self, src_glob, dst_glob): - # print "regex_pair:", src_glob, dst_glob src_re = re.escape(src_glob) src_re = src_re.replace('\*', '([-a-zA-Z0-9._ ]+)') dst_temp = dst_glob i = 1 - while(dst_temp.count("*") > 0): + while dst_temp.count("*") > 0: dst_temp = dst_temp.replace('*', '\g<' + str(i) + '>', 1) i = i+1 - # print "regex_result:", src_re, dst_temp return re.compile(src_re), dst_temp def check_file_exists(self, path): - if(not os.path.exists(path) and not os.path.islink(path)): + if not os.path.exists(path) and not os.path.islink(path): raise RuntimeError("Path %s doesn't exist" % ( os.path.normpath(os.path.join(os.getcwd(), path)),)) wildcard_pattern = re.compile('\*') def expand_globs(self, src, dst): - def fw_slash(str): - return str.replace('\\', '/') - def os_slash(str): - return str.replace('/', os.path.sep) - dst = fw_slash(dst) - src = fw_slash(src) src_list = glob.glob(src) - src_re, d_template = self.wildcard_regex(src, dst) + src_re, d_template = self.wildcard_regex(src.replace('\\', '/'), + dst.replace('\\', '/')) for s in src_list: - s = fw_slash(s) - d = src_re.sub(d_template, s) - #print "s:",s, "d_t", d_template, "dst", dst, "d", d - yield os_slash(s), os_slash(d) + d = src_re.sub(d_template, s.replace('\\', '/')) + yield os.path.normpath(s), os.path.normpath(d) def path(self, src, dst=None): - print "Processing", src, "=>", dst + sys.stdout.write("Processing %s => %s ... " % (src, dst)) + sys.stdout.flush() if src == None: raise RuntimeError("No source file, dst is " + dst) if dst == None: dst = src dst = os.path.join(self.get_dst_prefix(), dst) - src = os.path.join(self.get_src_prefix(), src) - # expand globs - if(self.wildcard_pattern.search(src)): - for s,d in self.expand_globs(src, dst): - self.process_file(s, d) - else: - # if we're specifying a single path (not a glob), - # we should error out if it doesn't exist - self.check_file_exists(src) - # if it's a directory, recurse through it - if(os.path.isdir(src)): - self.process_directory(src, dst) + def try_path(src): + # expand globs + count = 0 + if self.wildcard_pattern.search(src): + for s,d in self.expand_globs(src, dst): + count += self.process_file(s, d) else: - self.process_file(src, dst) - + # if we're specifying a single path (not a glob), + # we should error out if it doesn't exist + self.check_file_exists(src) + # if it's a directory, recurse through it + if os.path.isdir(src): + count += self.process_directory(src, dst) + else: + count += self.process_file(src, dst) + return count + try: + count = try_path(os.path.join(self.get_src_prefix(), src)) + except RuntimeError: + try: + count = try_path(os.path.join(self.get_artwork_prefix(), src)) + except RuntimeError: + count = try_path(os.path.join(self.get_build_prefix(), src)) + print "%d files" % count def do(self, *actions): self.actions = actions diff --git a/linden/indra/lib/python/indra/util/named_query.py b/linden/indra/lib/python/indra/util/named_query.py index 680d1f9..20f2ec7 100644 --- a/linden/indra/lib/python/indra/util/named_query.py +++ b/linden/indra/lib/python/indra/util/named_query.py @@ -47,7 +47,7 @@ except NameError: from indra.base import llsd from indra.base import config -NQ_FILE_SUFFIX = config.get('named-query-file-suffix', '') +NQ_FILE_SUFFIX = config.get('named-query-file-suffix', '.nq') NQ_FILE_SUFFIX_LEN = len(NQ_FILE_SUFFIX) _g_named_manager = None @@ -60,6 +60,11 @@ def _init_g_named_manager(sql_dir = None): because it's tricky to control the config from inside a test.""" if sql_dir is None: sql_dir = config.get('named-query-base-dir') + + # extra fallback directory in case config doesn't return what we want + if sql_dir is None: + sql_dir = os.path.dirname(__file__) + "../../../../web/dataservice/sql" + global _g_named_manager _g_named_manager = NamedQueryManager( os.path.abspath(os.path.realpath(sql_dir))) diff --git a/linden/indra/lib/python/indra/util/term.py b/linden/indra/lib/python/indra/util/term.py new file mode 100644 index 0000000..8238b78 --- /dev/null +++ b/linden/indra/lib/python/indra/util/term.py @@ -0,0 +1,222 @@ +''' +@file term.py +@brief a better shutil.copytree replacement + +$LicenseInfo:firstyear=2007&license=mit$ + +Copyright (c) 2007-2008, Linden Research, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +$/LicenseInfo$ +''' + +#http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/475116 + +import sys, re + +class TerminalController: + """ + A class that can be used to portably generate formatted output to + a terminal. + + `TerminalController` defines a set of instance variables whose + values are initialized to the control sequence necessary to + perform a given action. These can be simply included in normal + output to the terminal: + + >>> term = TerminalController() + >>> print 'This is '+term.GREEN+'green'+term.NORMAL + + Alternatively, the `render()` method can used, which replaces + '${action}' with the string required to perform 'action': + + >>> term = TerminalController() + >>> print term.render('This is ${GREEN}green${NORMAL}') + + If the terminal doesn't support a given action, then the value of + the corresponding instance variable will be set to ''. As a + result, the above code will still work on terminals that do not + support color, except that their output will not be colored. + Also, this means that you can test whether the terminal supports a + given action by simply testing the truth value of the + corresponding instance variable: + + >>> term = TerminalController() + >>> if term.CLEAR_SCREEN: + ... print 'This terminal supports clearning the screen.' + + Finally, if the width and height of the terminal are known, then + they will be stored in the `COLS` and `LINES` attributes. + """ + # Cursor movement: + BOL = '' #: Move the cursor to the beginning of the line + UP = '' #: Move the cursor up one line + DOWN = '' #: Move the cursor down one line + LEFT = '' #: Move the cursor left one char + RIGHT = '' #: Move the cursor right one char + + # Deletion: + CLEAR_SCREEN = '' #: Clear the screen and move to home position + CLEAR_EOL = '' #: Clear to the end of the line. + CLEAR_BOL = '' #: Clear to the beginning of the line. + CLEAR_EOS = '' #: Clear to the end of the screen + + # Output modes: + BOLD = '' #: Turn on bold mode + BLINK = '' #: Turn on blink mode + DIM = '' #: Turn on half-bright mode + REVERSE = '' #: Turn on reverse-video mode + NORMAL = '' #: Turn off all modes + + # Cursor display: + HIDE_CURSOR = '' #: Make the cursor invisible + SHOW_CURSOR = '' #: Make the cursor visible + + # Terminal size: + COLS = None #: Width of the terminal (None for unknown) + LINES = None #: Height of the terminal (None for unknown) + + # Foreground colors: + BLACK = BLUE = GREEN = CYAN = RED = MAGENTA = YELLOW = WHITE = '' + + # Background colors: + BG_BLACK = BG_BLUE = BG_GREEN = BG_CYAN = '' + BG_RED = BG_MAGENTA = BG_YELLOW = BG_WHITE = '' + + _STRING_CAPABILITIES = """ + BOL=cr UP=cuu1 DOWN=cud1 LEFT=cub1 RIGHT=cuf1 + CLEAR_SCREEN=clear CLEAR_EOL=el CLEAR_BOL=el1 CLEAR_EOS=ed BOLD=bold + BLINK=blink DIM=dim REVERSE=rev UNDERLINE=smul NORMAL=sgr0 + HIDE_CURSOR=cinvis SHOW_CURSOR=cnorm""".split() + _COLORS = """BLACK BLUE GREEN CYAN RED MAGENTA YELLOW WHITE""".split() + _ANSICOLORS = "BLACK RED GREEN YELLOW BLUE MAGENTA CYAN WHITE".split() + + def __init__(self, term_stream=sys.stdout): + """ + Create a `TerminalController` and initialize its attributes + with appropriate values for the current terminal. + `term_stream` is the stream that will be used for terminal + output; if this stream is not a tty, then the terminal is + assumed to be a dumb terminal (i.e., have no capabilities). + """ + # Curses isn't available on all platforms + try: import curses + except: return + + # If the stream isn't a tty, then assume it has no capabilities. + if not term_stream.isatty(): return + + # Check the terminal type. If we fail, then assume that the + # terminal has no capabilities. + try: curses.setupterm() + except: return + + # Look up numeric capabilities. + self.COLS = curses.tigetnum('cols') + self.LINES = curses.tigetnum('lines') + + # Look up string capabilities. + for capability in self._STRING_CAPABILITIES: + (attrib, cap_name) = capability.split('=') + setattr(self, attrib, self._tigetstr(cap_name) or '') + + # Colors + set_fg = self._tigetstr('setf') + if set_fg: + for i,color in zip(range(len(self._COLORS)), self._COLORS): + setattr(self, color, curses.tparm(set_fg, i) or '') + set_fg_ansi = self._tigetstr('setaf') + if set_fg_ansi: + for i,color in zip(range(len(self._ANSICOLORS)), self._ANSICOLORS): + setattr(self, color, curses.tparm(set_fg_ansi, i) or '') + set_bg = self._tigetstr('setb') + if set_bg: + for i,color in zip(range(len(self._COLORS)), self._COLORS): + setattr(self, 'BG_'+color, curses.tparm(set_bg, i) or '') + set_bg_ansi = self._tigetstr('setab') + if set_bg_ansi: + for i,color in zip(range(len(self._ANSICOLORS)), self._ANSICOLORS): + setattr(self, 'BG_'+color, curses.tparm(set_bg_ansi, i) or '') + + def _tigetstr(self, cap_name): + # String capabilities can include "delays" of the form "$<2>". + # For any modern terminal, we should be able to just ignore + # these, so strip them out. + import curses + cap = curses.tigetstr(cap_name) or '' + return re.sub(r'\$<\d+>[/*]?', '', cap) + + def render(self, template): + """ + Replace each $-substitutions in the given template string with + the corresponding terminal control string (if it's defined) or + '' (if it's not). + """ + return re.sub(r'\$\$|\${\w+}', self._render_sub, template) + + def _render_sub(self, match): + s = match.group() + if s == '$$': return s + else: return getattr(self, s[2:-1]) + +####################################################################### +# Example use case: progress bar +####################################################################### + +class ProgressBar: + """ + A 3-line progress bar, which looks like:: + + Header + 20% [===========----------------------------------] + progress message + + The progress bar is colored, if the terminal supports color + output; and adjusts to the width of the terminal. + """ + BAR = '%3d%% ${GREEN}[${BOLD}%s%s${NORMAL}${GREEN}]${NORMAL}\n' + HEADER = '${BOLD}${CYAN}%s${NORMAL}\n\n' + + def __init__(self, term, header): + self.term = term + if not (self.term.CLEAR_EOL and self.term.UP and self.term.BOL): + raise ValueError("Terminal isn't capable enough -- you " + "should use a simpler progress dispaly.") + self.width = self.term.COLS or 75 + self.bar = term.render(self.BAR) + self.header = self.term.render(self.HEADER % header.center(self.width)) + self.cleared = 1 #: true if we haven't drawn the bar yet. + self.update(0, '') + + def update(self, percent, message): + if self.cleared: + sys.stdout.write(self.header) + self.cleared = 0 + n = int((self.width-10)*percent) + sys.stdout.write( + self.term.BOL + self.term.UP + self.term.CLEAR_EOL + + (self.bar % (100*percent, '='*n, '-'*(self.width-10-n))) + + self.term.CLEAR_EOL + message.center(self.width)) + + def clear(self): + if not self.cleared: + sys.stdout.write(self.term.BOL + self.term.CLEAR_EOL + + self.term.UP + self.term.CLEAR_EOL + + self.term.UP + self.term.CLEAR_EOL) + self.cleared = 1 diff --git a/linden/indra/linux_crash_logger/CMakeLists.txt b/linden/indra/linux_crash_logger/CMakeLists.txt new file mode 100644 index 0000000..628d4ac --- /dev/null +++ b/linden/indra/linux_crash_logger/CMakeLists.txt @@ -0,0 +1,68 @@ +# -*- cmake -*- + +project(linux_crash_logger) + +include(00-Common) +include(Boost) +include(LLCommon) +include(LLCrashLogger) +include(LLMath) +include(LLMessage) +include(LLVFS) +include(LLXML) +include(Linking) +include(UI) + +include_directories( + ${LLCOMMON_INCLUDE_DIRS} + ${LLCRASHLOGGER_INCLUDE_DIRS} + ${LLMATH_INCLUDE_DIRS} + ${LLVFS_INCLUDE_DIRS} + ${LLXML_INCLUDE_DIRS} + ) + +set(linux_crash_logger_SOURCE_FILES + linux_crash_logger.cpp + llcrashloggerlinux.cpp + ) + +set(linux_crash_logger_HEADER_FILES + CMakeLists.txt + + llcrashloggerlinux.h + ) + +set_source_files_properties(${linux_crash_logger_HEADER_FILES} + PROPERTIES HEADER_FILE_ONLY TRUE) + +list(APPEND linux_crash_logger_SOURCE_FILES + ${linux_crash_logger_HEADER_FILES} + ) + +list(APPEND CMAKE_EXE_LINKER_FLAGS -Wl,--as-needed) + +add_executable(linux-crash-logger ${linux_crash_logger_SOURCE_FILES}) + +target_link_libraries(linux-crash-logger + ${LLCRASHLOGGER_LIBRARIES} + ${LLVFS_LIBRARIES} + ${LLXML_LIBRARIES} + ${LLMESSAGE_LIBRARIES} + ${LLVFS_LIBRARIES} + ${LLMATH_LIBRARIES} + ${LLCOMMON_LIBRARIES} + ${UI_LIBRARIES} + ${BOOST_SIGNALS_LIBRARY} + ${DB_LIBRARIES} + ) + +add_custom_command( + OUTPUT linux-crash-logger-stripped + COMMAND strip + ARGS --strip-debug -o linux-crash-logger-stripped + linux-crash-logger + DEPENDS linux-crash-logger + ) + +add_custom_target(linux-crash-logger-stripped ALL + DEPENDS linux-crash-logger-stripped) diff --git a/linden/indra/linux_crash_logger/files.lst b/linden/indra/linux_crash_logger/files.lst deleted file mode 100644 index 5c8b9a2..0000000 --- a/linden/indra/linux_crash_logger/files.lst +++ /dev/null @@ -1,3 +0,0 @@ -llcrashlogger/llcrashlogger.cpp -linux_crash_logger/linux_crash_logger.cpp -linux_crash_logger/llcrashloggerlinux.cpp diff --git a/linden/indra/linux_crash_logger/llcrashloggerlinux.cpp b/linden/indra/linux_crash_logger/llcrashloggerlinux.cpp index f90fea2..aa2b82c 100644 --- a/linden/indra/linux_crash_logger/llcrashloggerlinux.cpp +++ b/linden/indra/linux_crash_logger/llcrashloggerlinux.cpp @@ -132,7 +132,7 @@ bool LLCrashLoggerLinux::mainLoop() return true; } -void LLCrashLoggerLinux::updateApplication(LLString message) +void LLCrashLoggerLinux::updateApplication(const std::string& message) { LLCrashLogger::updateApplication(message); } diff --git a/linden/indra/linux_crash_logger/llcrashloggerlinux.h b/linden/indra/linux_crash_logger/llcrashloggerlinux.h index f34c934..4708493 100644 --- a/linden/indra/linux_crash_logger/llcrashloggerlinux.h +++ b/linden/indra/linux_crash_logger/llcrashloggerlinux.h @@ -42,7 +42,7 @@ public: LLCrashLoggerLinux(void); ~LLCrashLoggerLinux(void); virtual bool mainLoop(); - virtual void updateApplication(LLString message = ""); + virtual void updateApplication(const std::string& = LLStringUtil::null); virtual void gatherPlatformSpecificFiles(); }; diff --git a/linden/indra/llaudio/CMakeLists.txt b/linden/indra/llaudio/CMakeLists.txt new file mode 100644 index 0000000..b662023 --- /dev/null +++ b/linden/indra/llaudio/CMakeLists.txt @@ -0,0 +1,67 @@ +# -*- cmake -*- + +project(llaudio) + +include(00-Common) +include(Audio) +include(FMOD) +include(LLCommon) +include(LLMath) +include(LLMessage) +include(LLVFS) + +include_directories( + ${FMOD_INCLUDE_DIR} + ${LLCOMMON_INCLUDE_DIRS} + ${LLMATH_INCLUDE_DIRS} + ${LLMESSAGE_INCLUDE_DIRS} + ${LLVFS_INCLUDE_DIRS} + ${OGG_INCLUDE_DIRS} + ${VORBISENC_INCLUDE_DIRS} + ${VORBISFILE_INCLUDE_DIRS} + ${VORBIS_INCLUDE_DIRS} + ) + +set(llaudio_SOURCE_FILES + audioengine.cpp + listener.cpp + llaudiodecodemgr.cpp + vorbisdecode.cpp + vorbisencode.cpp + ) + +set(llaudio_HEADER_FILES + CMakeLists.txt + + audioengine.h + listener.h + llaudiodecodemgr.h + vorbisdecode.h + vorbisencode.h + ) + +if (FMOD) + list(APPEND llaudio_SOURCE_FILES + audioengine_fmod.cpp + listener_fmod.cpp + ) + + list(APPEND llaudio_HEADER_FILES + audioengine_fmod.h + listener_fmod.h + ) + + if (LINUX) + if (${CXX_VERSION} MATCHES "4.[23]") + set_source_files_properties(audioengine_fmod.cpp + COMPILE_FLAGS -Wno-error=write-strings) + endif (${CXX_VERSION} MATCHES "4.[23]") + endif (LINUX) +endif (FMOD) + +set_source_files_properties(${llaudio_HEADER_FILES} + PROPERTIES HEADER_FILE_ONLY TRUE) + +list(APPEND llaudio_SOURCE_FILES ${llaudio_HEADER_FILES}) + +add_library (llaudio ${llaudio_SOURCE_FILES}) diff --git a/linden/indra/llaudio/audioengine.cpp b/linden/indra/llaudio/audioengine.cpp index af43b42..5dd5b28 100644 --- a/linden/indra/llaudio/audioengine.cpp +++ b/linden/indra/llaudio/audioengine.cpp @@ -1,4 +1,4 @@ -/** + /** * @file audioengine.cpp * @brief implementation of LLAudioEngine class abstracting the Open * AL audio support @@ -916,7 +916,7 @@ void LLAudioEngine::cleanupAudioSource(LLAudioSource *asp) BOOL LLAudioEngine::hasDecodedFile(const LLUUID &uuid) { - char uuid_str[UUID_STR_LENGTH]; /*Flawfinder: ignore*/ + std::string uuid_str; uuid.toString(uuid_str); std::string wav_path; @@ -1653,10 +1653,10 @@ BOOL LLAudioData::load() return FALSE; } - char uuid_str[UUID_STR_LENGTH]; /*Flawfinder: ignore*/ - char wav_path[MAX_PATH]; /*Flawfinder: ignore*/ + std::string uuid_str; + std::string wav_path; mID.toString(uuid_str); - snprintf(wav_path, MAX_PATH, "%s.dsf",gDirUtilp->getExpandedFilename(LL_PATH_CACHE,uuid_str).c_str()); /* Flawfinder: ignore */ + wav_path= gDirUtilp->getExpandedFilename(LL_PATH_CACHE,uuid_str) + ".dsf"; if (!mBufferp->loadWAV(wav_path)) { diff --git a/linden/indra/llaudio/audioengine.h b/linden/indra/llaudio/audioengine.h index 8994703..e38413f 100644 --- a/linden/indra/llaudio/audioengine.h +++ b/linden/indra/llaudio/audioengine.h @@ -36,10 +36,6 @@ #include #include -#ifndef LL_FMOD -# define LL_FMOD 1 -#endif - #include "listener.h" #include "v3math.h" #include "v3dmath.h" @@ -136,14 +132,14 @@ public: LLAudioData *getAudioData(const LLUUID &audio_uuid); - virtual void startInternetStream(const char* url) = 0; + virtual void startInternetStream(const std::string& url) = 0; virtual void stopInternetStream() = 0; virtual void pauseInternetStream(int pause) = 0; virtual int isInternetStreamPlaying() = 0; virtual void getInternetStreamInfo(char* artist, char* title) { artist[0] = 0; title[0] = 0; } // use a value from 0.0 to 1.0, inclusive virtual void setInternetStreamGain(F32 vol) { mInternetStreamGain = vol; } - virtual const char* getInternetStreamURL() { return ""; } + virtual const std::string& getInternetStreamURL() { return LLStringUtil::null; } // For debugging usage virtual LLVector3 getListenerPos(); @@ -416,7 +412,7 @@ class LLAudioBuffer { public: virtual ~LLAudioBuffer() {}; - virtual BOOL loadWAV(const char *filename) = 0; + virtual BOOL loadWAV(const std::string& filename) = 0; virtual U32 getLength() = 0; friend class LLAudioEngine; diff --git a/linden/indra/llaudio/audioengine_fmod.cpp b/linden/indra/llaudio/audioengine_fmod.cpp index cc2042d..16d820c 100644 --- a/linden/indra/llaudio/audioengine_fmod.cpp +++ b/linden/indra/llaudio/audioengine_fmod.cpp @@ -33,9 +33,6 @@ #include "linden_common.h" #include "audioengine_fmod.h" - -#if LL_FMOD - #include "listener_fmod.h" #include "llerror.h" @@ -72,7 +69,7 @@ F32 gCurrentPanGainR = 0.5f; // Safe strcpy -#if LL_WINDOWS || LL_LINUX +#if 0 //(unused) //LL_WINDOWS || LL_LINUX static size_t strlcpy( char* dest, const char* src, size_t dst_size ) { size_t source_len = 0; @@ -655,11 +652,11 @@ LLAudioBufferFMOD::~LLAudioBufferFMOD() } -BOOL LLAudioBufferFMOD::loadWAV(const char *filename) +BOOL LLAudioBufferFMOD::loadWAV(const std::string& filename) { // Try to open a wav file from disk. This will eventually go away, as we don't // really want to block doing this. - if (filename == NULL) + if (filename.empty()) { // invalid filename, abort. return FALSE; @@ -705,7 +702,7 @@ BOOL LLAudioBufferFMOD::loadWAV(const char *filename) fclose(sound_file); } #else - mSamplep = FSOUND_Sample_Load(FSOUND_UNMANAGED, filename, FSOUND_LOOP_NORMAL, 0, 0); + mSamplep = FSOUND_Sample_Load(FSOUND_UNMANAGED, filename.c_str(), FSOUND_LOOP_NORMAL, 0, 0); #endif if (!mSamplep) @@ -777,11 +774,11 @@ void LLAudioEngine_FMOD::initInternetStream() // Leave the net buffer properties at the default. //FSOUND_Stream_Net_SetBufferProperties(20000, 40, 80); - mInternetStreamURL[0] = 0; + mInternetStreamURL.clear(); } -void LLAudioEngine_FMOD::startInternetStream(const char* url) +void LLAudioEngine_FMOD::startInternetStream(const std::string& url) { if (!mInited) { @@ -791,16 +788,16 @@ void LLAudioEngine_FMOD::startInternetStream(const char* url) // "stop" stream but don't clear url, etc. in calse url == mInternetStreamURL stopInternetStream(); - if (url) + if (!url.empty()) { llinfos << "Starting internet stream: " << url << llendl; mCurrentInternetStreamp = new LLAudioStreamFMOD(url); - strlcpy(mInternetStreamURL, url, 1024); + mInternetStreamURL = url; } else { llinfos << "Set internet stream to null" << llendl; - mInternetStreamURL[0] = 0; + mInternetStreamURL.clear(); } } @@ -930,7 +927,7 @@ void LLAudioEngine_FMOD::stopInternetStream() mDeadStreams.push_back(mCurrentInternetStreamp); } mCurrentInternetStreamp = NULL; - //mInternetStreamURL[0] = 0; + //mInternetStreamURL.clear(); } } @@ -963,7 +960,7 @@ int LLAudioEngine_FMOD::isInternetStreamPlaying() { return 1; // Active and playing } - else if (mInternetStreamURL[0]) + else if (!mInternetStreamURL.empty()) { return 2; // "Paused" } @@ -993,19 +990,18 @@ void LLAudioEngine_FMOD::setInternetStreamGain(F32 vol) } -const char* LLAudioEngine_FMOD::getInternetStreamURL() +const std::string& LLAudioEngine_FMOD::getInternetStreamURL() { return mInternetStreamURL; } -LLAudioStreamFMOD::LLAudioStreamFMOD(const char *url) : +LLAudioStreamFMOD::LLAudioStreamFMOD(const std::string& url) : mInternetStream(NULL), mReady(FALSE) { - mInternetStreamURL[0] = 0; - strlcpy(mInternetStreamURL, url, 1024); - mInternetStream = FSOUND_Stream_Open(url, FSOUND_NORMAL | FSOUND_NONBLOCKING, 0, 0); + mInternetStreamURL = url; + mInternetStream = FSOUND_Stream_Open(url.c_str(), FSOUND_NORMAL | FSOUND_NONBLOCKING, 0, 0); if (!mInternetStream) { llwarns << "Couldn't open fmod stream, error " @@ -1171,6 +1167,3 @@ void * F_CALLBACKAPI windCallback(void *originalbuffer, void *newbuffer, int len return newbuffer; } - -#endif // LL_FMOD - diff --git a/linden/indra/llaudio/audioengine_fmod.h b/linden/indra/llaudio/audioengine_fmod.h index 3ee4334..41177b6 100644 --- a/linden/indra/llaudio/audioengine_fmod.h +++ b/linden/indra/llaudio/audioengine_fmod.h @@ -34,9 +34,6 @@ #define LL_AUDIOENGINE_FMOD_H #include "audioengine.h" - -#if LL_FMOD - #include "listener_fmod.h" #include "fmod.h" @@ -59,14 +56,14 @@ public: // Internet stream methods virtual void initInternetStream(); - virtual void startInternetStream(const char* url); + virtual void startInternetStream(const std::string& url); virtual void updateInternetStream(); virtual void stopInternetStream(); virtual void pauseInternetStream(int pause); virtual int isInternetStreamPlaying(); virtual void getInternetStreamInfo(char* artist, char* title); virtual void setInternetStreamGain(F32 vol); - virtual const char* getInternetStreamURL(); + virtual const std::string& getInternetStreamURL(); /*virtual*/ void initWind(); /*virtual*/ void cleanupWind(); @@ -82,7 +79,7 @@ protected: static signed char F_CALLBACKAPI callbackMetaData(char* name, char* value, void* userdata); LLAudioStreamFMOD *mCurrentInternetStreamp; - char mInternetStreamURL[1024]; /*Flawfinder: ignore*/ + std::string mInternetStreamURL; int mInternetStreamChannel; std::list mDeadStreams; @@ -127,7 +124,7 @@ public: LLAudioBufferFMOD(); virtual ~LLAudioBufferFMOD(); - /*virtual*/ BOOL loadWAV(const char *filename); + /*virtual*/ BOOL loadWAV(const std::string& filename); /*virtual*/ U32 getLength(); friend class LLAudioChannelFMOD; @@ -141,22 +138,19 @@ protected: class LLAudioStreamFMOD { public: - LLAudioStreamFMOD(const char *url); + LLAudioStreamFMOD(const std::string& url); int startStream(); BOOL stopStream(); // Returns true if the stream was successfully stopped. BOOL ready(); - char *getURL() { return mInternetStreamURL; } + const std::string& getURL() { return mInternetStreamURL; } int getOpenState(); protected: FSOUND_STREAM* mInternetStream; BOOL mReady; - char mInternetStreamURL[1024]; /*Flawfinder: ignore*/ + std::string mInternetStreamURL; }; -#endif - -#endif - +#endif // LL_AUDIOENGINE_FMOD_H diff --git a/linden/indra/llaudio/files.lst b/linden/indra/llaudio/files.lst deleted file mode 100644 index abc8710..0000000 --- a/linden/indra/llaudio/files.lst +++ /dev/null @@ -1,7 +0,0 @@ -llaudio/audioengine.cpp -llaudio/audioengine_fmod.cpp -llaudio/listener.cpp -llaudio/listener_fmod.cpp -llaudio/llaudiodecodemgr.cpp -llaudio/vorbisdecode.cpp -llaudio/vorbisencode.cpp diff --git a/linden/indra/llaudio/listener_fmod.cpp b/linden/indra/llaudio/listener_fmod.cpp index e80a775..9e48408 100644 --- a/linden/indra/llaudio/listener_fmod.cpp +++ b/linden/indra/llaudio/listener_fmod.cpp @@ -32,9 +32,6 @@ #include "linden_common.h" #include "audioengine.h" - -#if LL_FMOD - #include "listener_fmod.h" #include "fmod.h" @@ -143,7 +140,3 @@ F32 LLListener_FMOD::getDistanceFactor() { return mDistanceFactor; } - -#endif // LL_FMOD - - diff --git a/linden/indra/llaudio/listener_fmod.h b/linden/indra/llaudio/listener_fmod.h index 71604bd..7b7c4c6 100644 --- a/linden/indra/llaudio/listener_fmod.h +++ b/linden/indra/llaudio/listener_fmod.h @@ -37,15 +37,11 @@ class LLListener_FMOD : public LLListener { - private: protected: F32 mDopplerFactor; F32 mDistanceFactor; F32 mRolloffFactor; - public: - private: - protected: public: LLListener_FMOD(); virtual ~LLListener_FMOD(); diff --git a/linden/indra/llaudio/llaudio.vcproj b/linden/indra/llaudio/llaudio.vcproj deleted file mode 100644 index dee6916..0000000 --- a/linden/indra/llaudio/llaudio.vcproj +++ /dev/null @@ -1,225 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/linden/indra/llaudio/llaudio_vc8.vcproj b/linden/indra/llaudio/llaudio_vc8.vcproj deleted file mode 100644 index 6cfe76c..0000000 --- a/linden/indra/llaudio/llaudio_vc8.vcproj +++ /dev/null @@ -1,323 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/linden/indra/llaudio/llaudio_vc9.vcproj b/linden/indra/llaudio/llaudio_vc9.vcproj deleted file mode 100644 index e51623c..0000000 --- a/linden/indra/llaudio/llaudio_vc9.vcproj +++ /dev/null @@ -1,324 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/linden/indra/llaudio/llaudiodecodemgr.cpp b/linden/indra/llaudio/llaudiodecodemgr.cpp index af7ab92..7cd48a9 100644 --- a/linden/indra/llaudio/llaudiodecodemgr.cpp +++ b/linden/indra/llaudio/llaudiodecodemgr.cpp @@ -70,7 +70,7 @@ public: LLPointer mDecoder; }; - LLVorbisDecodeState(const LLUUID &uuid, const LLString &out_filename); + LLVorbisDecodeState(const LLUUID &uuid, const std::string &out_filename); BOOL initDecode(); BOOL decodeSection(); // Return TRUE if done. @@ -93,7 +93,7 @@ protected: std::vector mWAVBuffer; #if !defined(USE_WAV_VFILE) - LLString mOutFilename; + std::string mOutFilename; LLLFSThread::handle_t mFileHandle; #endif @@ -166,7 +166,7 @@ long vfs_tell (void *datasource) return file->tell(); } -LLVorbisDecodeState::LLVorbisDecodeState(const LLUUID &uuid, const LLString &out_filename) +LLVorbisDecodeState::LLVorbisDecodeState(const LLUUID &uuid, const std::string &out_filename) { mDone = FALSE; mValid = FALSE; @@ -386,7 +386,7 @@ BOOL LLVorbisDecodeState::finishDecode() mWAVBuffer[7] = (data_length >> 24) & 0x000000FF; // - // FUCK!!! Vorbis encode/decode messes up loop point transitions (pop) + // FUDGECAKES!!! Vorbis encode/decode messes up loop point transitions (pop) // do a cheap-and-cheesy crossfade // { @@ -413,12 +413,12 @@ BOOL LLVorbisDecodeState::finishDecode() if((WAV_HEADER_SIZE+(2 * fade_length)) < (S32)mWAVBuffer.size()) { memcpy(&mWAVBuffer[WAV_HEADER_SIZE], pcmout, (2 * fade_length)); /*Flawfinder: ignore*/ - } + } S32 near_end = mWAVBuffer.size() - (2 * fade_length); if ((S32)mWAVBuffer.size() >= ( near_end + 2* fade_length)) { memcpy(pcmout, &mWAVBuffer[near_end], (2 * fade_length)); /*Flawfinder: ignore*/ - } + } llendianswizzle(&pcmout, 2, fade_length); samplep = (S16 *)pcmout; @@ -443,8 +443,8 @@ BOOL LLVorbisDecodeState::finishDecode() } #if !defined(USE_WAV_VFILE) mBytesRead = -1; - mFileHandle = LLLFSThread::sLocal->write(mOutFilename, &mWAVBuffer[0], 0, data_length, - new WriteResponder(this)); + mFileHandle = LLLFSThread::sLocal->write(mOutFilename, &mWAVBuffer[0], 0, mWAVBuffer.size(), + new WriteResponder(this)); #endif } @@ -583,14 +583,14 @@ void LLAudioDecodeMgr::Impl::processQueue(const F32 num_secs) lldebugs << "Decoding " << uuid << " from audio queue!" << llendl; - char uuid_str[64]; /*Flawfinder: ignore*/ - char d_path[LL_MAX_PATH]; /*Flawfinder: ignore*/ + std::string uuid_str; + std::string d_path; LLTimer timer; timer.reset(); uuid.toString(uuid_str); - snprintf(d_path, LL_MAX_PATH, "%s.dsf", gDirUtilp->getExpandedFilename(LL_PATH_CACHE,uuid_str).c_str()); /* Flawfinder: ignore */ + d_path = gDirUtilp->getExpandedFilename(LL_PATH_CACHE,uuid_str) + ".dsf"; mCurrentDecodep = new LLVorbisDecodeState(uuid, d_path); if (!mCurrentDecodep->initDecode()) diff --git a/linden/indra/llaudio/vorbisencode.cpp b/linden/indra/llaudio/vorbisencode.cpp index 805e666..3a107b9 100644 --- a/linden/indra/llaudio/vorbisencode.cpp +++ b/linden/indra/llaudio/vorbisencode.cpp @@ -70,7 +70,7 @@ #endif -S32 check_for_invalid_wav_formats(const char *in_fname, char *error_msg) +S32 check_for_invalid_wav_formats(const std::string& in_fname, std::string& error_msg) { U16 num_channels = 0; U32 sample_rate = 0; @@ -83,12 +83,12 @@ S32 check_for_invalid_wav_formats(const char *in_fname, char *error_msg) unsigned char wav_header[44]; /*Flawfinder: ignore*/ - error_msg[0] = '\0'; + error_msg.clear(); apr_file_t* infp = ll_apr_file_open(in_fname,LL_APR_RB); if (!infp) { - strcpy(error_msg, "CannotUploadSoundFile"); /*Flawfinder: ignore*/ + error_msg = "CannotUploadSoundFile"; return(LLVORBISENC_SOURCE_OPEN_ERR); } @@ -97,14 +97,14 @@ S32 check_for_invalid_wav_formats(const char *in_fname, char *error_msg) if (strncmp((char *)&(wav_header[0]),"RIFF",4)) { - strcpy(error_msg, "SoundFileNotRIFF"); /*Flawfinder: ignore*/ + error_msg = "SoundFileNotRIFF"; apr_file_close(infp); return(LLVORBISENC_WAV_FORMAT_ERR); } if (strncmp((char *)&(wav_header[8]),"WAVE",4)) { - strcpy(error_msg, "SoundFileNotRIFF"); /*Flawfinder: ignore*/ + error_msg = "SoundFileNotRIFF"; apr_file_close(infp); return(LLVORBISENC_WAV_FORMAT_ERR); } @@ -154,31 +154,31 @@ S32 check_for_invalid_wav_formats(const char *in_fname, char *error_msg) if (!uncompressed_pcm) { - strcpy(error_msg, "SoundFileNotPCM"); /*Flawfinder: ignore*/ + error_msg = "SoundFileNotPCM"; return(LLVORBISENC_PCM_FORMAT_ERR); } if ((num_channels < 1) || (num_channels > 2)) { - strcpy(error_msg, "SoundFileInvalidChannelCount"); /*Flawfinder: ignore*/ + error_msg = "SoundFileInvalidChannelCount"; return(LLVORBISENC_MULTICHANNEL_ERR); } if (sample_rate != 44100) { - strcpy(error_msg, "SoundFileInvalidSampleRate"); /*Flawfinder: ignore*/ + error_msg = "SoundFileInvalidSampleRate"; return(LLVORBISENC_UNSUPPORTED_SAMPLE_RATE); } if ((bits_per_sample != 16) && (bits_per_sample != 8)) { - strcpy(error_msg, "SoundFileInvalidWordSize"); /*Flawfinder: ignore*/ + error_msg = "SoundFileInvalidWordSize"; return(LLVORBISENC_UNSUPPORTED_WORD_SIZE); } if (!raw_data_length) { - strcpy(error_msg, "SoundFileInvalidHeader"); /*Flawfinder: ignore*/ + error_msg = "SoundFileInvalidHeader"; return(LLVORBISENC_CLIP_TOO_LONG); } @@ -186,14 +186,14 @@ S32 check_for_invalid_wav_formats(const char *in_fname, char *error_msg) if (clip_length > 10.0f) { - strcpy(error_msg, "SoundFileInvalidTooLong"); /*Flawfinder: ignore*/ + error_msg = "SoundFileInvalidTooLong"; return(LLVORBISENC_CLIP_TOO_LONG); } return(LLVORBISENC_NOERR); } -S32 encode_vorbis_file(const char *in_fname, const char *out_fname) +S32 encode_vorbis_file(const std::string& in_fname, const std::string& out_fname) { #define READ_BUFFER 1024 unsigned char readbuffer[READ_BUFFER*4+44]; /* out of the data segment, not the stack */ /*Flawfinder: ignore*/ @@ -216,7 +216,7 @@ S32 encode_vorbis_file(const char *in_fname, const char *out_fname) U32 bits_per_sample = 0; S32 format_error = 0; - char error_msg[MAX_STRING]; /*Flawfinder: ignore*/ + std::string error_msg; if ((format_error = check_for_invalid_wav_formats(in_fname, error_msg))) { llwarns << error_msg << ": " << in_fname << llendl; diff --git a/linden/indra/llaudio/vorbisencode.h b/linden/indra/llaudio/vorbisencode.h index 2dae529..6ad0819 100644 --- a/linden/indra/llaudio/vorbisencode.h +++ b/linden/indra/llaudio/vorbisencode.h @@ -45,8 +45,8 @@ const S32 LLVORBISENC_UNSUPPORTED_WORD_SIZE = 9; // unsupported word size const S32 LLVORBISENC_CLIP_TOO_LONG = 10; // source file is too long -S32 check_for_invalid_wav_formats(const char *in_fname, char *error_msg); -S32 encode_vorbis_file(const char *in_fname, const char *out_fname); +S32 check_for_invalid_wav_formats(const std::string& in_fname, std::string& error_msg); +S32 encode_vorbis_file(const std::string& in_fname, const std::string& out_fname); #endif diff --git a/linden/indra/llcharacter/CMakeLists.txt b/linden/indra/llcharacter/CMakeLists.txt new file mode 100644 index 0000000..6301062 --- /dev/null +++ b/linden/indra/llcharacter/CMakeLists.txt @@ -0,0 +1,76 @@ +# -*- cmake -*- + +project(llcharacter) + +include(00-Common) +include(LLCommon) +include(LLMath) +include(LLMessage) +include(LLVFS) +include(LLXML) + +include_directories( + ${LLCOMMON_INCLUDE_DIRS} + ${LLMATH_INCLUDE_DIRS} + ${LLMESSAGE_INCLUDE_DIRS} + ${LLVFS_INCLUDE_DIRS} + ${LLXML_INCLUDE_DIRS} + ) + +set(llcharacter_SOURCE_FILES + llanimationstates.cpp + llbvhloader.cpp + llcharacter.cpp + lleditingmotion.cpp + llgesture.cpp + llhandmotion.cpp + llheadrotmotion.cpp + lljoint.cpp + lljointsolverrp3.cpp + llkeyframefallmotion.cpp + llkeyframemotion.cpp + llkeyframemotionparam.cpp + llkeyframestandmotion.cpp + llkeyframewalkmotion.cpp + llmotioncontroller.cpp + llmotion.cpp + llmultigesture.cpp + llpose.cpp + llstatemachine.cpp + lltargetingmotion.cpp + llvisualparam.cpp + ) + +set(llcharacter_HEADER_FILES + CMakeLists.txt + + llanimationstates.h + llbvhloader.h + llcharacter.h + lleditingmotion.h + llgesture.h + llhandmotion.h + llheadrotmotion.h + lljoint.h + lljointsolverrp3.h + lljointstate.h + llkeyframefallmotion.h + llkeyframemotion.h + llkeyframemotionparam.h + llkeyframestandmotion.h + llkeyframewalkmotion.h + llmotion.h + llmotioncontroller.h + llmultigesture.h + llpose.h + llstatemachine.h + lltargetingmotion.h + llvisualparam.h + ) + +set_source_files_properties(${llcharacter_HEADER_FILES} + PROPERTIES HEADER_FILE_ONLY TRUE) + +list(APPEND llcharacter_SOURCE_FILES ${llcharacter_HEADER_FILES}) + +add_library (llcharacter ${llcharacter_SOURCE_FILES}) diff --git a/linden/indra/llcharacter/files.lst b/linden/indra/llcharacter/files.lst deleted file mode 100644 index 3b7aba2..0000000 --- a/linden/indra/llcharacter/files.lst +++ /dev/null @@ -1,21 +0,0 @@ -llcharacter/llanimationstates.cpp -llcharacter/llbvhloader.cpp -llcharacter/llcharacter.cpp -llcharacter/lleditingmotion.cpp -llcharacter/llgesture.cpp -llcharacter/llhandmotion.cpp -llcharacter/llheadrotmotion.cpp -llcharacter/lljoint.cpp -llcharacter/lljointsolverrp3.cpp -llcharacter/llkeyframefallmotion.cpp -llcharacter/llkeyframemotion.cpp -llcharacter/llkeyframemotionparam.cpp -llcharacter/llkeyframestandmotion.cpp -llcharacter/llkeyframewalkmotion.cpp -llcharacter/llmotioncontroller.cpp -llcharacter/llmotion.cpp -llcharacter/llmultigesture.cpp -llcharacter/llpose.cpp -llcharacter/llstatemachine.cpp -llcharacter/lltargetingmotion.cpp -llcharacter/llvisualparam.cpp diff --git a/linden/indra/llcharacter/llanimationstates.cpp b/linden/indra/llcharacter/llanimationstates.cpp index 2b13b0a..fdeffc5 100644 --- a/linden/indra/llcharacter/llanimationstates.cpp +++ b/linden/indra/llcharacter/llanimationstates.cpp @@ -228,10 +228,10 @@ const char *LLAnimationLibrary::animStateToString( const LLUUID& state ) //----------------------------------------------------------------------------- // Return the animation state for a given name //----------------------------------------------------------------------------- -LLUUID LLAnimationLibrary::stringToAnimState( const char *name, BOOL allow_ids ) +LLUUID LLAnimationLibrary::stringToAnimState( const std::string& name, BOOL allow_ids ) { - LLString lower_case_name(name); - LLString::toLower(lower_case_name); + std::string lower_case_name(name); + LLStringUtil::toLower(lower_case_name); char *true_name = mAnimStringTable.checkString(lower_case_name.c_str()); diff --git a/linden/indra/llcharacter/llanimationstates.h b/linden/indra/llcharacter/llanimationstates.h index dd269de..aa9e517 100644 --- a/linden/indra/llcharacter/llanimationstates.h +++ b/linden/indra/llcharacter/llanimationstates.h @@ -222,7 +222,7 @@ public: // Return the animation state for the given name. // Retun NULL if the name is invalid. //----------------------------------------------------------------------------- - LLUUID stringToAnimState( const char *name, BOOL allow_ids = TRUE ); + LLUUID stringToAnimState( const std::string& name, BOOL allow_ids = TRUE ); }; struct LLAnimStateEntry diff --git a/linden/indra/llcharacter/llbvhloader.cpp b/linden/indra/llcharacter/llbvhloader.cpp index e6e49f8..cd1f492 100644 --- a/linden/indra/llcharacter/llbvhloader.cpp +++ b/linden/indra/llcharacter/llbvhloader.cpp @@ -59,37 +59,37 @@ char gOutFile[1024]; /* Flawfinder: ignore */ //------------------------------------------------------------------------ // Status Codes //------------------------------------------------------------------------ -char *LLBVHLoader::ST_OK = "Ok"; -char *LLBVHLoader::ST_EOF = "Premature end of file."; -char *LLBVHLoader::ST_NO_CONSTRAINT = "Can't read constraint definition."; -char *LLBVHLoader::ST_NO_FILE = "Can't open BVH file."; -char *LLBVHLoader::ST_NO_HIER = "Invalid HIERARCHY header."; -char *LLBVHLoader::ST_NO_JOINT = "Can't find ROOT or JOINT."; -char *LLBVHLoader::ST_NO_NAME = "Can't get JOINT name."; -char *LLBVHLoader::ST_NO_OFFSET = "Can't find OFFSET."; -char *LLBVHLoader::ST_NO_CHANNELS = "Can't find CHANNELS."; -char *LLBVHLoader::ST_NO_ROTATION = "Can't get rotation order."; -char *LLBVHLoader::ST_NO_AXIS = "Can't get rotation axis."; -char *LLBVHLoader::ST_NO_MOTION = "Can't find MOTION."; -char *LLBVHLoader::ST_NO_FRAMES = "Can't get number of frames."; -char *LLBVHLoader::ST_NO_FRAME_TIME = "Can't get frame time."; -char *LLBVHLoader::ST_NO_POS = "Can't get position values."; -char *LLBVHLoader::ST_NO_ROT = "Can't get rotation values."; -char *LLBVHLoader::ST_NO_XLT_FILE = "Can't open translation file."; -char *LLBVHLoader::ST_NO_XLT_HEADER = "Can't read translation header."; -char *LLBVHLoader::ST_NO_XLT_NAME = "Can't read translation names."; -char *LLBVHLoader::ST_NO_XLT_IGNORE = "Can't read translation ignore value."; -char *LLBVHLoader::ST_NO_XLT_RELATIVE = "Can't read translation relative value."; -char *LLBVHLoader::ST_NO_XLT_OUTNAME = "Can't read translation outname value."; -char *LLBVHLoader::ST_NO_XLT_MATRIX = "Can't read translation matrix."; -char *LLBVHLoader::ST_NO_XLT_MERGECHILD = "Can't get mergechild name."; -char *LLBVHLoader::ST_NO_XLT_MERGEPARENT = "Can't get mergeparent name."; -char *LLBVHLoader::ST_NO_XLT_PRIORITY = "Can't get priority value."; -char *LLBVHLoader::ST_NO_XLT_LOOP = "Can't get loop value."; -char *LLBVHLoader::ST_NO_XLT_EASEIN = "Can't get easeIn values."; -char *LLBVHLoader::ST_NO_XLT_EASEOUT = "Can't get easeOut values."; -char *LLBVHLoader::ST_NO_XLT_HAND = "Can't get hand morph value."; -char *LLBVHLoader::ST_NO_XLT_EMOTE = "Can't read emote name."; +const char *LLBVHLoader::ST_OK = "Ok"; +const char *LLBVHLoader::ST_EOF = "Premature end of file."; +const char *LLBVHLoader::ST_NO_CONSTRAINT = "Can't read constraint definition."; +const char *LLBVHLoader::ST_NO_FILE = "Can't open BVH file."; +const char *LLBVHLoader::ST_NO_HIER = "Invalid HIERARCHY header."; +const char *LLBVHLoader::ST_NO_JOINT = "Can't find ROOT or JOINT."; +const char *LLBVHLoader::ST_NO_NAME = "Can't get JOINT name."; +const char *LLBVHLoader::ST_NO_OFFSET = "Can't find OFFSET."; +const char *LLBVHLoader::ST_NO_CHANNELS = "Can't find CHANNELS."; +const char *LLBVHLoader::ST_NO_ROTATION = "Can't get rotation order."; +const char *LLBVHLoader::ST_NO_AXIS = "Can't get rotation axis."; +const char *LLBVHLoader::ST_NO_MOTION = "Can't find MOTION."; +const char *LLBVHLoader::ST_NO_FRAMES = "Can't get number of frames."; +const char *LLBVHLoader::ST_NO_FRAME_TIME = "Can't get frame time."; +const char *LLBVHLoader::ST_NO_POS = "Can't get position values."; +const char *LLBVHLoader::ST_NO_ROT = "Can't get rotation values."; +const char *LLBVHLoader::ST_NO_XLT_FILE = "Can't open translation file."; +const char *LLBVHLoader::ST_NO_XLT_HEADER = "Can't read translation header."; +const char *LLBVHLoader::ST_NO_XLT_NAME = "Can't read translation names."; +const char *LLBVHLoader::ST_NO_XLT_IGNORE = "Can't read translation ignore value."; +const char *LLBVHLoader::ST_NO_XLT_RELATIVE = "Can't read translation relative value."; +const char *LLBVHLoader::ST_NO_XLT_OUTNAME = "Can't read translation outname value."; +const char *LLBVHLoader::ST_NO_XLT_MATRIX = "Can't read translation matrix."; +const char *LLBVHLoader::ST_NO_XLT_MERGECHILD = "Can't get mergechild name."; +const char *LLBVHLoader::ST_NO_XLT_MERGEPARENT = "Can't get mergeparent name."; +const char *LLBVHLoader::ST_NO_XLT_PRIORITY = "Can't get priority value."; +const char *LLBVHLoader::ST_NO_XLT_LOOP = "Can't get loop value."; +const char *LLBVHLoader::ST_NO_XLT_EASEIN = "Can't get easeIn values."; +const char *LLBVHLoader::ST_NO_XLT_EASEOUT = "Can't get easeOut values."; +const char *LLBVHLoader::ST_NO_XLT_HAND = "Can't get hand morph value."; +const char *LLBVHLoader::ST_NO_XLT_EMOTE = "Can't read emote name."; //------------------------------------------------------------------------ // find_next_whitespace() @@ -175,11 +175,7 @@ LLBVHLoader::Status LLBVHLoader::loadTranslationTable(const char *fileName) //-------------------------------------------------------------------- // open file //-------------------------------------------------------------------- - char path[LL_MAX_PATH]; /* Flawfinder: ignore */ - - snprintf( path, sizeof(path), "%s", /* Flawfinder: ignore */ - gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS,fileName).c_str()); - + std::string path = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS,fileName); apr_file_t *fp = ll_apr_file_open(path, LL_APR_R); if (!fp) @@ -243,7 +239,7 @@ LLBVHLoader::Status LLBVHLoader::loadTranslationTable(const char *fileName) //---------------------------------------------------------------- // check for optional emote //---------------------------------------------------------------- - if (loadingGlobals && LLString::compareInsensitive(token, "emote")==0) + if (loadingGlobals && LLStringUtil::compareInsensitive(token, "emote")==0) { char emote_str[1024]; /* Flawfinder: ignore */ if ( sscanf(mLine, " %*s = %1023s", emote_str) != 1 ) /* Flawfinder: ignore */ @@ -258,7 +254,7 @@ LLBVHLoader::Status LLBVHLoader::loadTranslationTable(const char *fileName) //---------------------------------------------------------------- // check for global priority setting //---------------------------------------------------------------- - if (loadingGlobals && LLString::compareInsensitive(token, "priority")==0) + if (loadingGlobals && LLStringUtil::compareInsensitive(token, "priority")==0) { S32 priority; if ( sscanf(mLine, " %*s = %d", &priority) != 1 ) @@ -272,7 +268,7 @@ LLBVHLoader::Status LLBVHLoader::loadTranslationTable(const char *fileName) //---------------------------------------------------------------- // check for global loop setting //---------------------------------------------------------------- - if (loadingGlobals && LLString::compareInsensitive(token, "loop")==0) + if (loadingGlobals && LLStringUtil::compareInsensitive(token, "loop")==0) { char trueFalse[128]; /* Flawfinder: ignore */ trueFalse[0] = '\0'; @@ -286,7 +282,7 @@ LLBVHLoader::Status LLBVHLoader::loadTranslationTable(const char *fileName) } else if ( sscanf(mLine, " %*s = %127s", trueFalse) == 1 ) /* Flawfinder: ignore */ { - mLoop = (LLString::compareInsensitive(trueFalse, "true")==0); + mLoop = (LLStringUtil::compareInsensitive(trueFalse, "true")==0); } else { @@ -302,7 +298,7 @@ LLBVHLoader::Status LLBVHLoader::loadTranslationTable(const char *fileName) //---------------------------------------------------------------- // check for global easeIn setting //---------------------------------------------------------------- - if (loadingGlobals && LLString::compareInsensitive(token, "easein")==0) + if (loadingGlobals && LLStringUtil::compareInsensitive(token, "easein")==0) { F32 duration; char type[128]; /* Flawfinder: ignore */ @@ -316,7 +312,7 @@ LLBVHLoader::Status LLBVHLoader::loadTranslationTable(const char *fileName) //---------------------------------------------------------------- // check for global easeOut setting //---------------------------------------------------------------- - if (loadingGlobals && LLString::compareInsensitive(token, "easeout")==0) + if (loadingGlobals && LLStringUtil::compareInsensitive(token, "easeout")==0) { F32 duration; char type[128]; /* Flawfinder: ignore */ @@ -330,7 +326,7 @@ LLBVHLoader::Status LLBVHLoader::loadTranslationTable(const char *fileName) //---------------------------------------------------------------- // check for global handMorph setting //---------------------------------------------------------------- - if (loadingGlobals && LLString::compareInsensitive(token, "hand")==0) + if (loadingGlobals && LLStringUtil::compareInsensitive(token, "hand")==0) { S32 handMorph; if (sscanf(mLine, " %*s = %d", &handMorph) != 1) @@ -340,7 +336,7 @@ LLBVHLoader::Status LLBVHLoader::loadTranslationTable(const char *fileName) continue; } - if (loadingGlobals && LLString::compareInsensitive(token, "constraint")==0) + if (loadingGlobals && LLStringUtil::compareInsensitive(token, "constraint")==0) { Constraint constraint; @@ -400,7 +396,7 @@ LLBVHLoader::Status LLBVHLoader::loadTranslationTable(const char *fileName) continue; } - if (loadingGlobals && LLString::compareInsensitive(token, "planar_constraint")==0) + if (loadingGlobals && LLStringUtil::compareInsensitive(token, "planar_constraint")==0) { Constraint constraint; @@ -470,20 +466,20 @@ LLBVHLoader::Status LLBVHLoader::loadTranslationTable(const char *fileName) //---------------------------------------------------------------- // check for ignore flag //---------------------------------------------------------------- - if ( LLString::compareInsensitive(token, "ignore")==0 ) + if ( LLStringUtil::compareInsensitive(token, "ignore")==0 ) { char trueFalse[128]; /* Flawfinder: ignore */ if ( sscanf(mLine, " %*s = %127s", trueFalse) != 1 ) /* Flawfinder: ignore */ return ST_NO_XLT_IGNORE; - trans->mIgnore = (LLString::compareInsensitive(trueFalse, "true")==0); + trans->mIgnore = (LLStringUtil::compareInsensitive(trueFalse, "true")==0); continue; } //---------------------------------------------------------------- // check for relativepos flag //---------------------------------------------------------------- - if ( LLString::compareInsensitive(token, "relativepos")==0 ) + if ( LLStringUtil::compareInsensitive(token, "relativepos")==0 ) { F32 x, y, z; char relpos[128]; /* Flawfinder: ignore */ @@ -493,7 +489,7 @@ LLBVHLoader::Status LLBVHLoader::loadTranslationTable(const char *fileName) } else if ( sscanf(mLine, " %*s = %127s", relpos) == 1 ) /* Flawfinder: ignore */ { - if ( LLString::compareInsensitive(relpos, "firstkey")==0 ) + if ( LLStringUtil::compareInsensitive(relpos, "firstkey")==0 ) { trans->mRelativePositionKey = TRUE; } @@ -513,13 +509,13 @@ LLBVHLoader::Status LLBVHLoader::loadTranslationTable(const char *fileName) //---------------------------------------------------------------- // check for relativerot flag //---------------------------------------------------------------- - if ( LLString::compareInsensitive(token, "relativerot")==0 ) + if ( LLStringUtil::compareInsensitive(token, "relativerot")==0 ) { //F32 x, y, z; char relpos[128]; /* Flawfinder: ignore */ if ( sscanf(mLine, " %*s = %127s", relpos) == 1 ) /* Flawfinder: ignore */ { - if ( LLString::compareInsensitive(relpos, "firstkey")==0 ) + if ( LLStringUtil::compareInsensitive(relpos, "firstkey")==0 ) { trans->mRelativeRotationKey = TRUE; } @@ -539,7 +535,7 @@ LLBVHLoader::Status LLBVHLoader::loadTranslationTable(const char *fileName) //---------------------------------------------------------------- // check for outname value //---------------------------------------------------------------- - if ( LLString::compareInsensitive(token, "outname")==0 ) + if ( LLStringUtil::compareInsensitive(token, "outname")==0 ) { char outName[128]; /* Flawfinder: ignore */ if ( sscanf(mLine, " %*s = %127s", outName) != 1 ) /* Flawfinder: ignore */ @@ -552,7 +548,7 @@ LLBVHLoader::Status LLBVHLoader::loadTranslationTable(const char *fileName) //---------------------------------------------------------------- // check for frame matrix value //---------------------------------------------------------------- - if ( LLString::compareInsensitive(token, "frame")==0 ) + if ( LLStringUtil::compareInsensitive(token, "frame")==0 ) { LLMatrix3 fm; if ( sscanf(mLine, " %*s = %f %f %f, %f %f %f, %f %f %f", @@ -568,7 +564,7 @@ LLBVHLoader::Status LLBVHLoader::loadTranslationTable(const char *fileName) //---------------------------------------------------------------- // check for offset matrix value //---------------------------------------------------------------- - if ( LLString::compareInsensitive(token, "offset")==0 ) + if ( LLStringUtil::compareInsensitive(token, "offset")==0 ) { LLMatrix3 om; if ( sscanf(mLine, " %*s = %f %f %f, %f %f %f, %f %f %f", @@ -584,7 +580,7 @@ LLBVHLoader::Status LLBVHLoader::loadTranslationTable(const char *fileName) //---------------------------------------------------------------- // check for mergeparent value //---------------------------------------------------------------- - if ( LLString::compareInsensitive(token, "mergeparent")==0 ) + if ( LLStringUtil::compareInsensitive(token, "mergeparent")==0 ) { char mergeParentName[128]; /* Flawfinder: ignore */ if ( sscanf(mLine, " %*s = %127s", mergeParentName) != 1 ) /* Flawfinder: ignore */ @@ -597,7 +593,7 @@ LLBVHLoader::Status LLBVHLoader::loadTranslationTable(const char *fileName) //---------------------------------------------------------------- // check for mergechild value //---------------------------------------------------------------- - if ( LLString::compareInsensitive(token, "mergechild")==0 ) + if ( LLStringUtil::compareInsensitive(token, "mergechild")==0 ) { char mergeChildName[128]; /* Flawfinder: ignore */ if ( sscanf(mLine, " %*s = %127s", mergeChildName) != 1 ) /* Flawfinder: ignore */ @@ -610,7 +606,7 @@ LLBVHLoader::Status LLBVHLoader::loadTranslationTable(const char *fileName) //---------------------------------------------------------------- // check for per-joint priority //---------------------------------------------------------------- - if ( LLString::compareInsensitive(token, "priority")==0 ) + if ( LLStringUtil::compareInsensitive(token, "priority")==0 ) { S32 priority; if ( sscanf(mLine, " %*s = %d", &priority) != 1 ) @@ -1304,7 +1300,7 @@ BOOL LLBVHLoader::serialize(LLDataPacker& dp) dp.packU16(KEYFRAME_MOTION_SUBVERSION, "sub_version"); dp.packS32(mPriority, "base_priority"); dp.packF32(mDuration, "duration"); - dp.packString(mEmoteName.c_str(), "emote_name"); + dp.packString(mEmoteName, "emote_name"); dp.packF32(mLoopInPoint, "loop_in_point"); dp.packF32(mLoopOutPoint, "loop_out_point"); dp.packS32(mLoop, "loop"); @@ -1325,7 +1321,7 @@ BOOL LLBVHLoader::serialize(LLDataPacker& dp) LLQuaternion first_frame_rot; LLQuaternion fixup_rot; - dp.packString(joint->mOutName.c_str(), "joint_name"); + dp.packString(joint->mOutName, "joint_name"); dp.packS32(joint->mPriority, "joint_priority"); // compute coordinate frame rotation diff --git a/linden/indra/llcharacter/llbvhloader.h b/linden/indra/llcharacter/llbvhloader.h index 3935ebe..f360fc8 100644 --- a/linden/indra/llcharacter/llbvhloader.h +++ b/linden/indra/llcharacter/llbvhloader.h @@ -203,38 +203,38 @@ public: ~LLBVHLoader(); // Status Codes - typedef char *Status; - static char *ST_OK; - static char *ST_EOF; - static char *ST_NO_CONSTRAINT; - static char *ST_NO_FILE; - static char *ST_NO_HIER; - static char *ST_NO_JOINT; - static char *ST_NO_NAME; - static char *ST_NO_OFFSET; - static char *ST_NO_CHANNELS; - static char *ST_NO_ROTATION; - static char *ST_NO_AXIS; - static char *ST_NO_MOTION; - static char *ST_NO_FRAMES; - static char *ST_NO_FRAME_TIME; - static char *ST_NO_POS; - static char *ST_NO_ROT; - static char *ST_NO_XLT_FILE; - static char *ST_NO_XLT_HEADER; - static char *ST_NO_XLT_NAME; - static char *ST_NO_XLT_IGNORE; - static char *ST_NO_XLT_RELATIVE; - static char *ST_NO_XLT_OUTNAME; - static char *ST_NO_XLT_MATRIX; - static char *ST_NO_XLT_MERGECHILD; - static char *ST_NO_XLT_MERGEPARENT; - static char *ST_NO_XLT_PRIORITY; - static char *ST_NO_XLT_LOOP; - static char *ST_NO_XLT_EASEIN; - static char *ST_NO_XLT_EASEOUT; - static char *ST_NO_XLT_HAND; - static char *ST_NO_XLT_EMOTE; + typedef const char *Status; + static const char *ST_OK; + static const char *ST_EOF; + static const char *ST_NO_CONSTRAINT; + static const char *ST_NO_FILE; + static const char *ST_NO_HIER; + static const char *ST_NO_JOINT; + static const char *ST_NO_NAME; + static const char *ST_NO_OFFSET; + static const char *ST_NO_CHANNELS; + static const char *ST_NO_ROTATION; + static const char *ST_NO_AXIS; + static const char *ST_NO_MOTION; + static const char *ST_NO_FRAMES; + static const char *ST_NO_FRAME_TIME; + static const char *ST_NO_POS; + static const char *ST_NO_ROT; + static const char *ST_NO_XLT_FILE; + static const char *ST_NO_XLT_HEADER; + static const char *ST_NO_XLT_NAME; + static const char *ST_NO_XLT_IGNORE; + static const char *ST_NO_XLT_RELATIVE; + static const char *ST_NO_XLT_OUTNAME; + static const char *ST_NO_XLT_MATRIX; + static const char *ST_NO_XLT_MERGECHILD; + static const char *ST_NO_XLT_MERGEPARENT; + static const char *ST_NO_XLT_PRIORITY; + static const char *ST_NO_XLT_LOOP; + static const char *ST_NO_XLT_EASEIN; + static const char *ST_NO_XLT_EASEOUT; + static const char *ST_NO_XLT_HAND; + static const char *ST_NO_XLT_EMOTE; // Loads the specified translation table. Status loadTranslationTable(const char *fileName); diff --git a/linden/indra/llcharacter/llcharacter.cpp b/linden/indra/llcharacter/llcharacter.cpp index 83487bc..71c5c40 100644 --- a/linden/indra/llcharacter/llcharacter.cpp +++ b/linden/indra/llcharacter/llcharacter.cpp @@ -287,8 +287,8 @@ BOOL LLCharacter::setVisualParamWeight(LLVisualParam* which_param, F32 weight, B //----------------------------------------------------------------------------- BOOL LLCharacter::setVisualParamWeight(const char* param_name, F32 weight, BOOL set_by_user) { - LLString tname(param_name); - LLString::toLower(tname); + std::string tname(param_name); + LLStringUtil::toLower(tname); char *tableptr = sVisualParamNames.checkString(tname); VisualParamNameMap_t::iterator name_iter = mVisualParamNameMap.find(tableptr); if (name_iter != mVisualParamNameMap.end()) @@ -338,8 +338,8 @@ F32 LLCharacter::getVisualParamWeight(LLVisualParam *which_param) //----------------------------------------------------------------------------- F32 LLCharacter::getVisualParamWeight(const char* param_name) { - LLString tname(param_name); - LLString::toLower(tname); + std::string tname(param_name); + LLStringUtil::toLower(tname); char *tableptr = sVisualParamNames.checkString(tname); VisualParamNameMap_t::iterator name_iter = mVisualParamNameMap.find(tableptr); if (name_iter != mVisualParamNameMap.end()) @@ -409,8 +409,8 @@ BOOL LLCharacter::visualParamWeightsAreDefault() //----------------------------------------------------------------------------- LLVisualParam* LLCharacter::getVisualParam(const char *param_name) { - LLString tname(param_name); - LLString::toLower(tname); + std::string tname(param_name); + LLStringUtil::toLower(tname); char *tableptr = sVisualParamNames.checkString(tname); VisualParamNameMap_t::iterator name_iter = mVisualParamNameMap.find(tableptr); if (name_iter != mVisualParamNameMap.end()) @@ -467,8 +467,8 @@ void LLCharacter::addVisualParam(LLVisualParam *param) if (param->getInfo()) { // Add name map - LLString tname(param->getName()); - LLString::toLower(tname); + std::string tname(param->getName()); + LLStringUtil::toLower(tname); char *tableptr = sVisualParamNames.addString(tname); std::pair nameres; nameres = mVisualParamNameMap.insert(VisualParamNameMap_t::value_type(tableptr, param)); diff --git a/linden/indra/llcharacter/llcharacter.vcproj b/linden/indra/llcharacter/llcharacter.vcproj deleted file mode 100644 index 82f17ae..0000000 --- a/linden/indra/llcharacter/llcharacter.vcproj +++ /dev/null @@ -1,296 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/linden/indra/llcharacter/llcharacter_vc8.vcproj b/linden/indra/llcharacter/llcharacter_vc8.vcproj deleted file mode 100644 index fdad9c2..0000000 --- a/linden/indra/llcharacter/llcharacter_vc8.vcproj +++ /dev/null @@ -1,419 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/linden/indra/llcharacter/llcharacter_vc9.vcproj b/linden/indra/llcharacter/llcharacter_vc9.vcproj deleted file mode 100644 index 837ec04..0000000 --- a/linden/indra/llcharacter/llcharacter_vc9.vcproj +++ /dev/null @@ -1,420 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/linden/indra/llcharacter/llgesture.cpp b/linden/indra/llcharacter/llgesture.cpp index 60f0624..335e5c6 100644 --- a/linden/indra/llcharacter/llgesture.cpp +++ b/linden/indra/llcharacter/llgesture.cpp @@ -191,11 +191,11 @@ LLGestureList::LLGestureList() mList.put(gesture); gesture = new LLGesture(KEY_F4, MASK_NONE, "/boogie", - LLUUID::null, "dance4", LLString::null ); + LLUUID::null, "dance4", LLStringUtil::null ); mList.put(gesture); gesture = new LLGesture(KEY_F5, MASK_SHIFT, "/tongue", - LLUUID::null, "Express_Tongue_Out", LLString::null ); + LLUUID::null, "Express_Tongue_Out", LLStringUtil::null ); mList.put(gesture); */ } @@ -219,9 +219,9 @@ void LLGestureList::deleteAll() // Iterates through space delimited tokens in string, triggering any gestures found. // Generates a revised string that has the found tokens replaced by their replacement strings // and (as a minor side effect) has multiple spaces in a row replaced by single spaces. -BOOL LLGestureList::triggerAndReviseString(const LLString &string, LLString* revised_string) +BOOL LLGestureList::triggerAndReviseString(const std::string &string, std::string* revised_string) { - LLString tokenized = string; + std::string tokenized = string; BOOL found_gestures = FALSE; BOOL first_token = TRUE; @@ -237,8 +237,8 @@ BOOL LLGestureList::triggerAndReviseString(const LLString &string, LLString* rev if( !found_gestures ) // Only pay attention to the first gesture in the string. { - LLString cur_token_lower = *token_iter; - LLString::toLower(cur_token_lower); + std::string cur_token_lower = *token_iter; + LLStringUtil::toLower(cur_token_lower); for (S32 i = 0; i < mList.count(); i++) { @@ -254,15 +254,15 @@ BOOL LLGestureList::triggerAndReviseString(const LLString &string, LLString* rev // Don't muck with the user's capitalization if we don't have to. const std::string& output = gesture->getOutputString(); - LLString output_lower = LLString(output.c_str()); - LLString::toLower(output_lower); + std::string output_lower = std::string(output.c_str()); + LLStringUtil::toLower(output_lower); if( cur_token_lower == output_lower ) { revised_string->append(*token_iter); } else { - revised_string->append(output.c_str()); + revised_string->append(output); } } diff --git a/linden/indra/llcharacter/llgesture.h b/linden/indra/llcharacter/llgesture.h index 003d236..8800887 100644 --- a/linden/indra/llcharacter/llgesture.h +++ b/linden/indra/llcharacter/llgesture.h @@ -93,7 +93,7 @@ public: BOOL trigger(KEY key, MASK mask); // Triggers if substring matches and generates revised string. - BOOL triggerAndReviseString(const LLString &string, LLString* revised_string); + BOOL triggerAndReviseString(const std::string &string, std::string* revised_string); // Used for construction from UI S32 count() const { return mList.count(); } diff --git a/linden/indra/llcharacter/llhandmotion.cpp b/linden/indra/llcharacter/llhandmotion.cpp index 3902518..f51e0d0 100644 --- a/linden/indra/llcharacter/llhandmotion.cpp +++ b/linden/indra/llcharacter/llhandmotion.cpp @@ -201,16 +201,16 @@ void LLHandMotion::onDeactivate() //----------------------------------------------------------------------------- // LLHandMotion::getHandPoseName() //----------------------------------------------------------------------------- -LLString LLHandMotion::getHandPoseName(eHandPose pose) +std::string LLHandMotion::getHandPoseName(eHandPose pose) { if ((S32)pose < LLHandMotion::NUM_HAND_POSES && (S32)pose >= 0) { - return gHandPoseNames[pose]; + return std::string(gHandPoseNames[pose]); } - return ""; + return LLStringUtil::null; } -LLHandMotion::eHandPose LLHandMotion::getHandPose(LLString posename) +LLHandMotion::eHandPose LLHandMotion::getHandPose(std::string posename) { for (S32 pose = 0; pose < LLHandMotion::NUM_HAND_POSES; ++pose) { diff --git a/linden/indra/llcharacter/llhandmotion.h b/linden/indra/llcharacter/llhandmotion.h index 548e4de..b6cc175 100644 --- a/linden/indra/llcharacter/llhandmotion.h +++ b/linden/indra/llcharacter/llhandmotion.h @@ -126,8 +126,8 @@ public: virtual BOOL canDeprecate() { return FALSE; } - static LLString getHandPoseName(eHandPose pose); - static eHandPose getHandPose(LLString posename); + static std::string getHandPoseName(eHandPose pose); + static eHandPose getHandPose(std::string posename); public: //------------------------------------------------------------------------- diff --git a/linden/indra/llcharacter/llkeyframemotion.cpp b/linden/indra/llcharacter/llkeyframemotion.cpp index 34decd6..f53b01f 100644 --- a/linden/indra/llcharacter/llkeyframemotion.cpp +++ b/linden/indra/llcharacter/llkeyframemotion.cpp @@ -71,6 +71,15 @@ static F32 MAX_CONSTRAINTS = 10; // JointMotionList //----------------------------------------------------------------------------- LLKeyframeMotion::JointMotionList::JointMotionList() + : mDuration(0.f), + mLoop(FALSE), + mLoopInPoint(0.f), + mLoopOutPoint(0.f), + mEaseInDuration(0.f), + mEaseOutDuration(0.f), + mBasePriority(LLJoint::LOW_PRIORITY), + mHandPose(LLHandMotion::HAND_POSE_SPREAD), + mMaxPriority(LLJoint::LOW_PRIORITY) { } @@ -646,9 +655,9 @@ BOOL LLKeyframeMotion::setupPose() BOOL LLKeyframeMotion::onActivate() { // If the keyframe anim has an associated emote, trigger it. - if( mEmoteName.length() > 0 ) + if( mJointMotionList->mEmoteName.length() > 0 ) { - mCharacter->startMotion( gAnimLibrary.stringToAnimState(mEmoteName.c_str()) ); + mCharacter->startMotion( gAnimLibrary.stringToAnimState(mJointMotionList->mEmoteName) ); } mLastLoopedTime = 0.f; @@ -1221,7 +1230,7 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp) //------------------------------------------------------------------------- // get emote (optional) //------------------------------------------------------------------------- - if (!dp.unpackString(mEmoteName, "emote_name")) + if (!dp.unpackString(mJointMotionList->mEmoteName, "emote_name")) { llwarns << "can't read optional_emote_animation" << llendl; return FALSE; @@ -1663,7 +1672,7 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp) if (!parent) { llwarns << "Joint with no parent: " << joint->getName() - << " Emote: " << mEmoteName << llendl; + << " Emote: " << mJointMotionList->mEmoteName << llendl; return FALSE; } joint = parent; @@ -1701,7 +1710,7 @@ BOOL LLKeyframeMotion::serialize(LLDataPacker& dp) const success &= dp.packU16(KEYFRAME_MOTION_SUBVERSION, "sub_version"); success &= dp.packS32(mJointMotionList->mBasePriority, "base_priority"); success &= dp.packF32(mJointMotionList->mDuration, "duration"); - success &= dp.packString(mEmoteName.c_str(), "emote_name"); + success &= dp.packString(mJointMotionList->mEmoteName, "emote_name"); success &= dp.packF32(mJointMotionList->mLoopInPoint, "loop_in_point"); success &= dp.packF32(mJointMotionList->mLoopOutPoint, "loop_out_point"); success &= dp.packS32(mJointMotionList->mLoop, "loop"); @@ -1713,7 +1722,7 @@ BOOL LLKeyframeMotion::serialize(LLDataPacker& dp) const for (U32 i = 0; i < mJointMotionList->getNumJointMotions(); i++) { JointMotion* joint_motionp = mJointMotionList->getJointMotion(i); - success &= dp.packString(joint_motionp->mJointName.c_str(), "joint_name"); + success &= dp.packString(joint_motionp->mJointName, "joint_name"); success &= dp.packS32(joint_motionp->mPriority, "joint_priority"); success &= dp.packS32(joint_motionp->mRotationCurve.mNumKeys, "num_rot_keys"); @@ -1839,11 +1848,11 @@ void LLKeyframeMotion::setEmote(const LLUUID& emote_id) const char* emote_name = gAnimLibrary.animStateToString(emote_id); if (emote_name) { - mEmoteName = emote_name; + mJointMotionList->mEmoteName = emote_name; } else { - mEmoteName = ""; + mJointMotionList->mEmoteName = ""; } } @@ -2114,11 +2123,19 @@ void LLKeyframeDataCache::clear() //----------------------------------------------------------------------------- LLKeyframeMotion::JointConstraint::JointConstraint(JointConstraintSharedData* shared_data) : mSharedData(shared_data) { + mWeight = 0.f; mTotalLength = 0.f; mActive = FALSE; mSourceVolume = NULL; mTargetVolume = NULL; mFixupDistanceRMS = 0.f; + + int i; + for (i=0; i constraint_list_t; constraint_list_t mConstraints; LLBBoxLocal mPelvisBBox; + // mEmoteName is a facial motion, but it's necessary to appear here so that it's cached. + // TODO: LLKeyframeDataCache::getKeyframeData should probably return a class containing + // JointMotionList and mEmoteName, see LLKeyframeMotion::onInitialize. + std::string mEmoteName; public: JointMotionList(); ~JointMotionList(); @@ -435,7 +443,6 @@ protected: std::vector > mJointStates; LLJoint* mPelvisp; LLCharacter* mCharacter; - std::string mEmoteName; typedef std::list constraint_list_t; constraint_list_t mConstraints; U32 mLastSkeletonSerialNum; diff --git a/linden/indra/llcharacter/llkeyframemotionparam.cpp b/linden/indra/llcharacter/llkeyframemotionparam.cpp index 0e7388c..c22ef26 100644 --- a/linden/indra/llcharacter/llkeyframemotionparam.cpp +++ b/linden/indra/llcharacter/llkeyframemotionparam.cpp @@ -346,10 +346,8 @@ BOOL LLKeyframeMotionParam::loadMotions() // Load named file by concatenating the character prefix with the motion name. // Load data into a buffer to be parsed. //------------------------------------------------------------------------- - char path[LL_MAX_PATH]; /* Flawfinder: ignore */ - snprintf( path,sizeof(path), "%s_%s.llp", - gDirUtilp->getExpandedFilename(LL_PATH_MOTIONS,mCharacter->getAnimationPrefix()).c_str(), - getName().c_str() ); + std::string path = gDirUtilp->getExpandedFilename(LL_PATH_MOTIONS,mCharacter->getAnimationPrefix()) + + "_" + getName() + ".llp"; //------------------------------------------------------------------------- // open the file @@ -436,7 +434,7 @@ BOOL LLKeyframeMotionParam::loadMotions() return FALSE; } - addKeyframeMotion(strA, gAnimLibrary.stringToAnimState(strA), strB, floatA); + addKeyframeMotion(strA, gAnimLibrary.stringToAnimState(std::string(strA)), strB, floatA); if (isFirstMotion) { isFirstMotion = FALSE; diff --git a/linden/indra/llcharacter/llkeyframewalkmotion.cpp b/linden/indra/llcharacter/llkeyframewalkmotion.cpp index d5f6b81..dae24ee 100644 --- a/linden/indra/llcharacter/llkeyframewalkmotion.cpp +++ b/linden/indra/llcharacter/llkeyframewalkmotion.cpp @@ -139,9 +139,16 @@ BOOL LLKeyframeWalkMotion::onUpdate(F32 time, U8* joint_mask) // LLWalkAdjustMotion() // Class Constructor //----------------------------------------------------------------------------- -LLWalkAdjustMotion::LLWalkAdjustMotion(const LLUUID &id) : LLMotion(id) +LLWalkAdjustMotion::LLWalkAdjustMotion(const LLUUID &id) : + LLMotion(id), + mLastTime(0.f), + mAvgCorrection(0.f), + mSpeedAdjust(0.f), + mAnimSpeed(0.f), + mAvgSpeed(0.f), + mRelativeDir(0.f), + mAnkleOffset(0.f) { - mLastTime = 0.f; mName = "walk_adjust"; mPelvisState = new LLJointState; @@ -349,7 +356,8 @@ void LLWalkAdjustMotion::onDeactivate() // LLFlyAdjustMotion::LLFlyAdjustMotion() //----------------------------------------------------------------------------- LLFlyAdjustMotion::LLFlyAdjustMotion(const LLUUID &id) - : LLMotion(id) + : LLMotion(id), + mRoll(0.f) { mName = "fly_adjust"; diff --git a/linden/indra/llcharacter/llmotion.h b/linden/indra/llcharacter/llmotion.h index 5a622a8..49f102a 100644 --- a/linden/indra/llcharacter/llmotion.h +++ b/linden/indra/llcharacter/llmotion.h @@ -51,13 +51,13 @@ class LLMotion friend class LLMotionController; public: - typedef enum LLMotionBlendType + enum LLMotionBlendType { NORMAL_BLEND, ADDITIVE_BLEND }; - typedef enum LLMotionInitStatus + enum LLMotionInitStatus { STATUS_FAILURE, STATUS_SUCCESS, diff --git a/linden/indra/llcharacter/llmotioncontroller.h b/linden/indra/llcharacter/llmotioncontroller.h index 209f689..ee85fd0 100644 --- a/linden/indra/llcharacter/llmotioncontroller.h +++ b/linden/indra/llcharacter/llmotioncontroller.h @@ -215,10 +215,10 @@ protected: F32 mLastTime; BOOL mHasRunOnce; BOOL mPaused; + F32 mPauseTime; F32 mTimeStep; S32 mTimeStepCount; F32 mLastInterp; - F32 mPauseTime; U8 mJointSignature[2][LL_CHARACTER_MAX_JOINTS]; }; diff --git a/linden/indra/llcharacter/llmultigesture.cpp b/linden/indra/llcharacter/llmultigesture.cpp index 02016a0..5e6a0d6 100644 --- a/linden/indra/llcharacter/llmultigesture.cpp +++ b/linden/indra/llcharacter/llmultigesture.cpp @@ -124,8 +124,8 @@ BOOL LLMultiGesture::serialize(LLDataPacker& dp) const dp.packS32(GESTURE_VERSION, "version"); dp.packU8(mKey, "key"); dp.packU32(mMask, "mask"); - dp.packString(mTrigger.c_str(), "trigger"); - dp.packString(mReplaceText.c_str(), "replace"); + dp.packString(mTrigger, "trigger"); + dp.packString(mReplaceText, "replace"); S32 count = (S32)mSteps.size(); dp.packS32(count, "step_count"); @@ -269,7 +269,7 @@ S32 LLGestureStepAnimation::getMaxSerialSize() const BOOL LLGestureStepAnimation::serialize(LLDataPacker& dp) const { - dp.packString(mAnimName.c_str(), "anim_name"); + dp.packString(mAnimName, "anim_name"); dp.packUUID(mAnimAssetID, "asset_id"); dp.packU32(mFlags, "flags"); return TRUE; @@ -344,7 +344,7 @@ S32 LLGestureStepSound::getMaxSerialSize() const BOOL LLGestureStepSound::serialize(LLDataPacker& dp) const { - dp.packString(mSoundName.c_str(), "sound_name"); + dp.packString(mSoundName, "sound_name"); dp.packUUID(mSoundAssetID, "asset_id"); dp.packU32(mFlags, "flags"); return TRUE; @@ -401,7 +401,7 @@ S32 LLGestureStepChat::getMaxSerialSize() const BOOL LLGestureStepChat::serialize(LLDataPacker& dp) const { - dp.packString(mChatText.c_str(), "chat_text"); + dp.packString(mChatText, "chat_text"); dp.packU32(mFlags, "flags"); return TRUE; } diff --git a/linden/indra/llcharacter/llpose.cpp b/linden/indra/llcharacter/llpose.cpp index f496b7b..5b75a98 100644 --- a/linden/indra/llcharacter/llpose.cpp +++ b/linden/indra/llcharacter/llpose.cpp @@ -188,6 +188,7 @@ LLJointStateBlender::LLJointStateBlender() { mJointStates[i] = NULL; mPriorities[i] = S32_MIN; + mAdditiveBlends[i] = FALSE; } } @@ -458,6 +459,7 @@ void LLJointStateBlender::resetCachedJoint() //----------------------------------------------------------------------------- LLPoseBlender::LLPoseBlender() + : mNextPoseSlot(0) { } diff --git a/linden/indra/llcharacter/llstatemachine.cpp b/linden/indra/llcharacter/llstatemachine.cpp index eab6e7f..564fbbc 100644 --- a/linden/indra/llcharacter/llstatemachine.cpp +++ b/linden/indra/llcharacter/llstatemachine.cpp @@ -206,7 +206,7 @@ LLFSMState* LLStateDiagram::getState(U32 state_id) return NULL; } -BOOL LLStateDiagram::saveDotFile(const char* filename) +BOOL LLStateDiagram::saveDotFile(const std::string& filename) { apr_file_t* dot_file = ll_apr_file_open(filename, LL_APR_W); diff --git a/linden/indra/llcharacter/llstatemachine.h b/linden/indra/llcharacter/llstatemachine.h index 873e938..a833629 100644 --- a/linden/indra/llcharacter/llstatemachine.h +++ b/linden/indra/llcharacter/llstatemachine.h @@ -115,7 +115,7 @@ protected: public: // save the graph in a DOT file for rendering and visualization - BOOL saveDotFile(const char* filename); + BOOL saveDotFile(const std::string& filename); }; class LLStateMachine diff --git a/linden/indra/llcharacter/llvisualparam.cpp b/linden/indra/llcharacter/llvisualparam.cpp index 00b1072..e3320f8 100644 --- a/linden/indra/llcharacter/llvisualparam.cpp +++ b/linden/indra/llcharacter/llvisualparam.cpp @@ -89,7 +89,7 @@ BOOL LLVisualParamInfo::parseXml(LLXmlTreeNode *node) } // attribute: sex - LLString sex = "both"; + std::string sex = "both"; static LLStdStringHandle sex_string = LLXmlTree::addAttributeString("sex"); node->getFastAttributeString( sex_string, sex ); // optional if( sex == "both" ) @@ -127,7 +127,7 @@ BOOL LLVisualParamInfo::parseXml(LLXmlTreeNode *node) // JC - make sure the display name includes the capitalization in the XML file, // not the lowercased version. - LLString::toLower(mName); + LLStringUtil::toLower(mName); // attribute: label_min static LLStdStringHandle label_min_string = LLXmlTree::addAttributeString("label_min"); diff --git a/linden/indra/llcharacter/llvisualparam.h b/linden/indra/llcharacter/llvisualparam.h index 41b8a05..39fff0f 100644 --- a/linden/indra/llcharacter/llvisualparam.h +++ b/linden/indra/llcharacter/llvisualparam.h @@ -71,10 +71,10 @@ public: protected: S32 mID; // ID associated with VisualParam - LLString mName; // name (for internal purposes) - LLString mDisplayName; // name displayed to the user - LLString mMinName; // name associated with minimum value - LLString mMaxName; // name associated with maximum value + std::string mName; // name (for internal purposes) + std::string mDisplayName; // name displayed to the user + std::string mMinName; // name associated with minimum value + std::string mMaxName; // name associated with maximum value EVisualParamGroup mGroup; // morph group for separating UI controls F32 mMinWeight; // minimum weight that can be assigned to this morph target F32 mMaxWeight; // maximum weight that can be assigned to this morph target @@ -114,14 +114,14 @@ public: S32 getID() { return mID; } void setID(S32 id) { llassert(!mInfo); mID = id; } - const LLString& getName() const { return mInfo->mName; } - const LLString& getDisplayName() const { return mInfo->mDisplayName; } - const LLString& getMaxDisplayName() const { return mInfo->mMaxName; } - const LLString& getMinDisplayName() const { return mInfo->mMinName; } - - void setDisplayName(const LLString& s) { mInfo->mDisplayName = s; } - void setMaxDisplayName(const LLString& s) { mInfo->mMaxName = s; } - void setMinDisplayName(const LLString& s) { mInfo->mMinName = s; } + const std::string& getName() const { return mInfo->mName; } + const std::string& getDisplayName() const { return mInfo->mDisplayName; } + const std::string& getMaxDisplayName() const { return mInfo->mMaxName; } + const std::string& getMinDisplayName() const { return mInfo->mMinName; } + + void setDisplayName(const std::string& s) { mInfo->mDisplayName = s; } + void setMaxDisplayName(const std::string& s) { mInfo->mMaxName = s; } + void setMinDisplayName(const std::string& s) { mInfo->mMinName = s; } EVisualParamGroup getGroup() { return mInfo->mGroup; } F32 getMinWeight() { return mInfo->mMinWeight; } diff --git a/linden/indra/llcommon/CMakeLists.txt b/linden/indra/llcommon/CMakeLists.txt new file mode 100644 index 0000000..72d267d --- /dev/null +++ b/linden/indra/llcommon/CMakeLists.txt @@ -0,0 +1,188 @@ +# -*- cmake -*- + +project(llcommon) + +include(00-Common) +include(LLCommon) + +include_directories( + ${EXPAT_INCLUDE_DIRS} + ${LLCOMMON_INCLUDE_DIRS} + ${ZLIB_INCLUDE_DIRS} + ) + +set(llcommon_SOURCE_FILES + llapp.cpp + llapr.cpp + llassettype.cpp + llbase32.cpp + llbase64.cpp + llcommon.cpp + llcrc.cpp + llcriticaldamp.cpp + lldate.cpp + llerror.cpp + llerrorthread.cpp + llevent.cpp + llfasttimer.cpp + llfile.cpp + llfindlocale.cpp + llfixedbuffer.cpp + llformat.cpp + llframetimer.cpp + llheartbeat.cpp + llindraconfigfile.cpp + llliveappconfig.cpp + lllivefile.cpp + lllog.cpp + llmd5.cpp + llmemory.cpp + llmemorystream.cpp + llmetrics.cpp + llmortician.cpp + llprocessor.cpp + llqueuedthread.cpp + llrand.cpp + llrun.cpp + llsd.cpp + llsdserialize.cpp + llsdserialize_xml.cpp + llsdutil.cpp + llsecondlifeurls.cpp + llstat.cpp + llstreamtools.cpp + llstring.cpp + llstringtable.cpp + llsys.cpp + llthread.cpp + lltimer.cpp + lluri.cpp + lluuid.cpp + llworkerthread.cpp + metaclass.cpp + metaproperty.cpp + reflective.cpp + timing.cpp + u64.cpp + ) + +set(llcommon_HEADER_FILES + CMakeLists.txt + + bitpack.h + ctype_workaround.h + doublelinkedlist.h + imageids.h + indra_constants.h + linden_common.h + linked_lists.h + llagentconstants.h + llapp.h + llapr.h + llassettype.h + llassoclist.h + llavatarconstants.h + llbase32.h + llbase64.h + llboost.h + llchat.h + llclickaction.h + llcommon.h + llcrc.h + llcriticaldamp.h + lldarray.h + lldarrayptr.h + lldate.h + lldefs.h + lldepthstack.h + lldlinked.h + lldqueueptr.h + llendianswizzle.h + llenum.h + llerror.h + llerrorcontrol.h + llerrorlegacy.h + llerrorthread.h + llevent.h + lleventemitter.h + llextendedstatus.h + llfasttimer.h + llfile.h + llfindlocale.h + llfixedbuffer.h + llformat.h + llframetimer.h + llhash.h + llheartbeat.h + llindexedqueue.h + llindraconfigfile.h + llkeythrottle.h + lllinkedqueue.h + llliveappconfig.h + lllivefile.h + lllocalidhashmap.h + lllog.h + lllslconstants.h + llmap.h + llmd5.h + llmemory.h + llmemorystream.h + llmemtype.h + llmetrics.h + llmortician.h + llnametable.h + llpreprocessor.h + llpriqueuemap.h + llprocessor.h + llptrskiplist.h + llptrskipmap.h + llqueuedthread.h + llrand.h + llrun.h + llsd.h + llsdserialize.h + llsdserialize_xml.h + llsdutil.h + llsecondlifeurls.h + llsimplehash.h + llskiplist.h + llskipmap.h + llstack.h + llstat.h + llstatenums.h + llstl.h + llstreamtools.h + llstrider.h + llstring.h + llstringtable.h + llsys.h + llthread.h + lltimer.h + lluri.h + lluuid.h + lluuidhashmap.h + llversionserver.h + llversionviewer.h + llworkerthread.h + metaclass.h + metaclasst.h + metaproperty.h + metapropertyt.h + processor.h + reflective.h + reflectivet.h + roles_constants.h + stdenums.h + stdtypes.h + string_table.h + timer.h + timing.h + u64.h + ) + +set_source_files_properties(${llcommon_HEADER_FILES} + PROPERTIES HEADER_FILE_ONLY TRUE) + +list(APPEND llcommon_SOURCE_FILES ${llcommon_HEADER_FILES}) + +add_library (llcommon ${llcommon_SOURCE_FILES}) diff --git a/linden/indra/llcommon/files.lst b/linden/indra/llcommon/files.lst deleted file mode 100644 index d698773..0000000 --- a/linden/indra/llcommon/files.lst +++ /dev/null @@ -1,49 +0,0 @@ -llcommon/llapp.cpp -llcommon/llapr.cpp -llcommon/llares.cpp -llcommon/llassettype.cpp -llcommon/llbase32.cpp -llcommon/llbase64.cpp -llcommon/llcommon.cpp -llcommon/llcriticaldamp.cpp -llcommon/lldate.cpp -llcommon/llerror.cpp -llcommon/llerrorthread.cpp -llcommon/llevent.cpp -llcommon/llfasttimer.cpp -llcommon/llfile.cpp -llcommon/llfindlocale.cpp -llcommon/llfixedbuffer.cpp -llcommon/llformat.cpp -llcommon/llframetimer.cpp -llcommon/llheartbeat.cpp -llcommon/llindraconfigfile.cpp -llcommon/lllog.cpp -llcommon/llliveappconfig.cpp -llcommon/lllivefile.cpp -llcommon/llmemory.cpp -llcommon/llmemorystream.cpp -llcommon/llmetrics.cpp -llcommon/llmortician.cpp -llcommon/llprocessor.cpp -llcommon/llqueuedthread.cpp -llcommon/llrun.cpp -llcommon/llsd.cpp -llcommon/llsdserialize.cpp -llcommon/llsdserialize_xml.cpp -llcommon/llsdutil.cpp -llcommon/llsecondlifeurls.cpp -llcommon/llstat.cpp -llcommon/llstreamtools.cpp -llcommon/llstring.cpp -llcommon/llstringtable.cpp -llcommon/llsys.cpp -llcommon/llthread.cpp -llcommon/lltimer.cpp -llcommon/lluri.cpp -llcommon/llworkerthread.cpp -llcommon/metaclass.cpp -llcommon/metaproperty.cpp -llcommon/reflective.cpp -llcommon/timing.cpp -llcommon/u64.cpp diff --git a/linden/indra/llcommon/indra_constants.h b/linden/indra/llcommon/indra_constants.h index 77f3d8c..1c48a5c 100644 --- a/linden/indra/llcommon/indra_constants.h +++ b/linden/indra/llcommon/indra_constants.h @@ -38,7 +38,11 @@ // At 45 Hz collisions seem stable and objects seem // to settle down at a reasonable rate. // JC 3/18/2003 -const F32 PHYSICS_TIMESTEP = 1.f / 45.f; + +// const F32 PHYSICS_TIMESTEP = 1.f / 45.f; +// This must be a #define due to anal retentive restrictions on const expressions +// CG 2008-06-05 +#define PHYSICS_TIMESTEP (1.f / 45.f) const F32 COLLISION_TOLERANCE = 0.1f; const F32 HALF_COLLISION_TOLERANCE = COLLISION_TOLERANCE * 0.5f; @@ -50,9 +54,9 @@ const U32 DAYS_PER_LINDEN_YEAR = 11; const U32 SEC_PER_LINDEN_DAY = HOURS_PER_LINDEN_DAY * 60 * 60; const U32 SEC_PER_LINDEN_YEAR = DAYS_PER_LINDEN_YEAR * SEC_PER_LINDEN_DAY; -const F32 REGION_WIDTH_METERS = 256.f; -const S32 REGION_WIDTH_UNITS = 256; -const U32 REGION_WIDTH_U32 = 256; +static const F32 REGION_WIDTH_METERS = 256.f; +static const S32 REGION_WIDTH_UNITS = 256; +static const U32 REGION_WIDTH_U32 = 256; const F32 REGION_HEIGHT_METERS = 4096.f; @@ -74,7 +78,7 @@ enum LAND_STAT_REPORT_TYPE const U32 STAT_FILTER_MASK = 0x1FFFFFFF; // Default maximum number of tasks/prims per region. -const U32 MAX_TASKS_PER_REGION = 15000; +const U32 DEFAULT_MAX_REGION_WIDE_PRIM_COUNT = 15000; const F32 MIN_AGENT_DEPTH = 0.30f; const F32 DEFAULT_AGENT_DEPTH = 0.45f; diff --git a/linden/indra/llcommon/linden_common.h b/linden/indra/llcommon/linden_common.h index 547cceb..7d3c82d 100644 --- a/linden/indra/llcommon/linden_common.h +++ b/linden/indra/llcommon/linden_common.h @@ -45,9 +45,10 @@ #include #include -// Work around stupid Microsoft STL warning +// Work Microsoft compiler warnings #ifdef LL_WINDOWS -#pragma warning (disable : 4702) // warning C4702: unreachable code +#pragma warning (disable : 4702) // unreachable code +#pragma warning (disable : 4244) // conversion from time_t to S32 #endif // LL_WINDOWS #include diff --git a/linden/indra/llcommon/llapp.cpp b/linden/indra/llcommon/llapp.cpp index ebace4e..3ca3782 100644 --- a/linden/indra/llcommon/llapp.cpp +++ b/linden/indra/llcommon/llapp.cpp @@ -224,6 +224,7 @@ LLSD LLApp::getOptionData(OptionPriority level) void LLApp::stepFrame() { LLFrameTimer::updateFrameTime(); + LLFrameTimer::updateFrameCount(); LLEventTimer::updateClass(); mRunner.run(); } @@ -492,6 +493,7 @@ void LLApp::setDefaultChildCallback(LLAppChildCallback callback) pid_t LLApp::fork() { + fflush(NULL); // flush all buffers before the child inherits them pid_t pid = ::fork(); if( pid < 0 ) { diff --git a/linden/indra/llcommon/llapr.cpp b/linden/indra/llcommon/llapr.cpp index 78bf876..73e715a 100644 --- a/linden/indra/llcommon/llapr.cpp +++ b/linden/indra/llcommon/llapr.cpp @@ -129,7 +129,7 @@ void ll_apr_assert_status(apr_status_t status) } // File I/O -apr_file_t* ll_apr_file_open(const LLString& filename, apr_int32_t flags, S32* sizep, apr_pool_t* pool) +apr_file_t* ll_apr_file_open(const std::string& filename, apr_int32_t flags, S32* sizep, apr_pool_t* pool) { apr_file_t* apr_file; apr_status_t s; @@ -160,15 +160,15 @@ apr_file_t* ll_apr_file_open(const LLString& filename, apr_int32_t flags, S32* s return apr_file; } -apr_file_t* ll_apr_file_open(const LLString& filename, apr_int32_t flags, S32* sizep) +apr_file_t* ll_apr_file_open(const std::string& filename, apr_int32_t flags, S32* sizep) { return ll_apr_file_open(filename, flags, sizep, NULL); } -apr_file_t* ll_apr_file_open(const LLString& filename, apr_int32_t flags, apr_pool_t* pool) +apr_file_t* ll_apr_file_open(const std::string& filename, apr_int32_t flags, apr_pool_t* pool) { return ll_apr_file_open(filename, flags, NULL, pool); } -apr_file_t* ll_apr_file_open(const LLString& filename, apr_int32_t flags) +apr_file_t* ll_apr_file_open(const std::string& filename, apr_int32_t flags) { return ll_apr_file_open(filename, flags, NULL, NULL); } @@ -188,7 +188,7 @@ S32 ll_apr_file_read(apr_file_t* apr_file, void *buf, S32 nbytes) } } -S32 ll_apr_file_read_ex(const LLString& filename, apr_pool_t* pool, void *buf, S32 offset, S32 nbytes) +S32 ll_apr_file_read_ex(const std::string& filename, apr_pool_t* pool, void *buf, S32 offset, S32 nbytes) { if (pool == NULL) pool = gAPRPoolp; apr_file_t* filep = ll_apr_file_open(filename, APR_READ|APR_BINARY, pool); @@ -230,7 +230,7 @@ S32 ll_apr_file_write(apr_file_t* apr_file, const void *buf, S32 nbytes) } } -S32 ll_apr_file_write_ex(const LLString& filename, apr_pool_t* pool, void *buf, S32 offset, S32 nbytes) +S32 ll_apr_file_write_ex(const std::string& filename, apr_pool_t* pool, void *buf, S32 offset, S32 nbytes) { if (pool == NULL) pool = gAPRPoolp; apr_int32_t flags = APR_CREATE|APR_WRITE|APR_BINARY; @@ -287,7 +287,7 @@ S32 ll_apr_file_seek(apr_file_t* apr_file, apr_seek_where_t where, S32 offset) } } -bool ll_apr_file_remove(const LLString& filename, apr_pool_t* pool) +bool ll_apr_file_remove(const std::string& filename, apr_pool_t* pool) { apr_status_t s; if (pool == NULL) pool = gAPRPoolp; @@ -301,7 +301,7 @@ bool ll_apr_file_remove(const LLString& filename, apr_pool_t* pool) return true; } -bool ll_apr_file_rename(const LLString& filename, const LLString& newname, apr_pool_t* pool) +bool ll_apr_file_rename(const std::string& filename, const std::string& newname, apr_pool_t* pool) { apr_status_t s; if (pool == NULL) pool = gAPRPoolp; @@ -315,7 +315,7 @@ bool ll_apr_file_rename(const LLString& filename, const LLString& newname, apr_p return true; } -bool ll_apr_file_exists(const LLString& filename, apr_pool_t* pool) +bool ll_apr_file_exists(const std::string& filename, apr_pool_t* pool) { apr_file_t* apr_file; apr_status_t s; @@ -332,7 +332,7 @@ bool ll_apr_file_exists(const LLString& filename, apr_pool_t* pool) } } -S32 ll_apr_file_size(const LLString& filename, apr_pool_t* pool) +S32 ll_apr_file_size(const std::string& filename, apr_pool_t* pool) { apr_file_t* apr_file; apr_finfo_t info; @@ -358,7 +358,7 @@ S32 ll_apr_file_size(const LLString& filename, apr_pool_t* pool) } } -bool ll_apr_dir_make(const LLString& dirname, apr_pool_t* pool) +bool ll_apr_dir_make(const std::string& dirname, apr_pool_t* pool) { apr_status_t s; if (pool == NULL) pool = gAPRPoolp; @@ -372,7 +372,7 @@ bool ll_apr_dir_make(const LLString& dirname, apr_pool_t* pool) return true; } -bool ll_apr_dir_remove(const LLString& dirname, apr_pool_t* pool) +bool ll_apr_dir_remove(const std::string& dirname, apr_pool_t* pool) { apr_status_t s; if (pool == NULL) pool = gAPRPoolp; diff --git a/linden/indra/llcommon/llapr.h b/linden/indra/llcommon/llapr.h index 695b93e..323dcb2 100644 --- a/linden/indra/llcommon/llapr.h +++ b/linden/indra/llcommon/llapr.h @@ -40,11 +40,11 @@ #include -#include "apr-1/apr_thread_proc.h" -#include "apr-1/apr_thread_mutex.h" -#include "apr-1/apr_getopt.h" -#include "apr-1/apr_signal.h" -#include "apr-1/apr_atomic.h" +#include "apr_thread_proc.h" +#include "apr_thread_mutex.h" +#include "apr_getopt.h" +#include "apr_signal.h" +#include "apr_atomic.h" #include "llstring.h" extern apr_thread_mutex_t* gLogMutexp; @@ -130,24 +130,24 @@ typedef LLAtomic32 LLAtomicS32; #define LL_APR_WB (APR_CREATE|APR_TRUNCATE|APR_WRITE|APR_BINARY) // "wb" #define LL_APR_RPB (APR_READ|APR_WRITE|APR_BINARY) // "r+b" #define LL_APR_WPB (APR_CREATE|APR_TRUNCATE|APR_READ|APR_WRITE|APR_BINARY) // "w+b" -apr_file_t* ll_apr_file_open(const LLString& filename, apr_int32_t flags, S32* sizep, apr_pool_t* pool); -apr_file_t* ll_apr_file_open(const LLString& filename, apr_int32_t flags, S32* sizep); -apr_file_t* ll_apr_file_open(const LLString& filename, apr_int32_t flags, apr_pool_t* pool); -apr_file_t* ll_apr_file_open(const LLString& filename, apr_int32_t flags); +apr_file_t* ll_apr_file_open(const std::string& filename, apr_int32_t flags, S32* sizep, apr_pool_t* pool); +apr_file_t* ll_apr_file_open(const std::string& filename, apr_int32_t flags, S32* sizep); +apr_file_t* ll_apr_file_open(const std::string& filename, apr_int32_t flags, apr_pool_t* pool); +apr_file_t* ll_apr_file_open(const std::string& filename, apr_int32_t flags); // Returns actual offset, -1 if seek fails S32 ll_apr_file_seek(apr_file_t* apr_file, apr_seek_where_t where, S32 offset); // Returns bytes read/written, 0 if read/write fails: S32 ll_apr_file_read(apr_file_t* apr_file, void* buf, S32 nbytes); -S32 ll_apr_file_read_ex(const LLString& filename, apr_pool_t* pool, void *buf, S32 offset, S32 nbytes); +S32 ll_apr_file_read_ex(const std::string& filename, apr_pool_t* pool, void *buf, S32 offset, S32 nbytes); S32 ll_apr_file_write(apr_file_t* apr_file, const void* buf, S32 nbytes); -S32 ll_apr_file_write_ex(const LLString& filename, apr_pool_t* pool, void *buf, S32 offset, S32 nbytes); +S32 ll_apr_file_write_ex(const std::string& filename, apr_pool_t* pool, void *buf, S32 offset, S32 nbytes); // returns false if failure: -bool ll_apr_file_remove(const LLString& filename, apr_pool_t* pool = NULL); -bool ll_apr_file_rename(const LLString& filename, const LLString& newname, apr_pool_t* pool = NULL); -bool ll_apr_file_exists(const LLString& filename, apr_pool_t* pool = NULL); -S32 ll_apr_file_size(const LLString& filename, apr_pool_t* pool = NULL); -bool ll_apr_dir_make(const LLString& dirname, apr_pool_t* pool = NULL); -bool ll_apr_dir_remove(const LLString& dirname, apr_pool_t* pool = NULL); +bool ll_apr_file_remove(const std::string& filename, apr_pool_t* pool = NULL); +bool ll_apr_file_rename(const std::string& filename, const std::string& newname, apr_pool_t* pool = NULL); +bool ll_apr_file_exists(const std::string& filename, apr_pool_t* pool = NULL); +S32 ll_apr_file_size(const std::string& filename, apr_pool_t* pool = NULL); +bool ll_apr_dir_make(const std::string& dirname, apr_pool_t* pool = NULL); +bool ll_apr_dir_remove(const std::string& dirname, apr_pool_t* pool = NULL); /** * @brief Function which approprately logs error or remains quiet on diff --git a/linden/indra/llcommon/llares.cpp b/linden/indra/llcommon/llares.cpp deleted file mode 100644 index 4d054e4..0000000 --- a/linden/indra/llcommon/llares.cpp +++ /dev/null @@ -1,805 +0,0 @@ -/** - * @file llares.cpp - * @author Bryan O'Sullivan - * @date 2007-08-15 - * @brief Wrapper for asynchronous DNS lookups. - * - * $LicenseInfo:firstyear=2007&license=viewergpl$ - * - * Copyright (c) 2007-2008, Linden Research, Inc. - * - * Second Life Viewer Source Code - * 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://secondlifegrid.net/programs/open_source/licensing/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://secondlifegrid.net/programs/open_source/licensing/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. - * $/LicenseInfo$ - */ - -#ifdef LL_STANDALONE -# include -#else -# include -#endif - -#include "apr-1/apr_portable.h" -#include "apr-1/apr_network_io.h" -#include "apr-1/apr_poll.h" - -#include "linden_common.h" -#include "llapr.h" -#include "llares.h" - -#if defined(LL_WINDOWS) -# define ns_c_in 1 -# define NS_HFIXEDSZ 12 /* #/bytes of fixed data in header */ -# define NS_QFIXEDSZ 4 /* #/bytes of fixed data in query */ -# define NS_RRFIXEDSZ 10 /* #/bytes of fixed data in r record */ -#else -# include -#endif - -LLAres::HostResponder::~HostResponder() -{ -} - -void LLAres::HostResponder::hostResult(const hostent *ent) -{ - llinfos << "LLAres::HostResponder::hostResult not implemented" << llendl; -} - -void LLAres::HostResponder::hostError(int code) -{ - llinfos << "LLAres::HostResponder::hostError " << code << ": " - << LLAres::strerror(code) << llendl; -} - -LLAres::NameInfoResponder::~NameInfoResponder() -{ -} - -void LLAres::NameInfoResponder::nameInfoResult(const char *node, - const char *service) -{ - llinfos << "LLAres::NameInfoResponder::nameInfoResult not implemented" - << llendl; -} - -void LLAres::NameInfoResponder::nameInfoError(int code) -{ - llinfos << "LLAres::NameInfoResponder::nameInfoError " << code << ": " - << LLAres::strerror(code) << llendl; -} - -LLAres::QueryResponder::~QueryResponder() -{ -} - -void LLAres::QueryResponder::queryResult(const char *buf, size_t len) -{ - llinfos << "LLAres::QueryResponder::queryResult not implemented" - << llendl; -} - -void LLAres::QueryResponder::queryError(int code) -{ - llinfos << "LLAres::QueryResponder::queryError " << code << ": " - << LLAres::strerror(code) << llendl; -} - -LLAres::LLAres() - : chan_(NULL) -{ - ares_init(&chan_); -} - -LLAres::~LLAres() -{ - if (chan_) - ares_destroy(chan_); -} - -void LLAres::cancel() -{ - if (chan_) - ares_cancel(chan_); -} - -static void host_callback(void *arg, int status, struct hostent *ent) -{ - LLPointer *resp = - (LLPointer *) arg; - - if (status == ARES_SUCCESS) - { - (*resp)->hostResult(ent); - } else { - (*resp)->hostError(status); - } - - delete resp; -} - -void LLAres::getHostByName(const char *name, HostResponder *resp, - int family) -{ - if (!chan_) - { - resp->hostError(ARES_EBADRESP); - return; - } - ares_gethostbyname(chan_, name, family, host_callback, - new LLPointer(resp)); -} - -void LLAres::getSrvRecords(const std::string &name, SrvResponder *resp) -{ - search(name, RES_SRV, resp); -} - -void LLAres::rewriteURI(const std::string &uri, UriRewriteResponder *resp) -{ - LL_DEBUGS2("AppInit","Rewrite") << "Rewriting " << uri << LL_ENDL; - - resp->mUri = LLURI(uri); - search("_" + resp->mUri.scheme() + "._tcp." + resp->mUri.hostName(), - RES_SRV, resp); -} - -LLQueryResponder::LLQueryResponder() - : LLAres::QueryResponder(), - mResult(ARES_ENODATA), - mType(RES_INVALID) -{ -} - -int LLQueryResponder::parseRR(const char *buf, size_t len, const char *&pos, - LLPointer &r) -{ - std::string rrname; - size_t enclen; - int ret; - - // RR name. - - ret = LLAres::expandName(pos, buf, len, rrname, enclen); - if (ret != ARES_SUCCESS) - { - return ret; - } - - pos += enclen; - - if (pos + NS_RRFIXEDSZ > buf + len) - { - return ARES_EBADRESP; - } - - int rrtype = DNS_RR_TYPE(pos); - int rrclass = DNS_RR_CLASS(pos); - int rrttl = DNS_RR_TTL(pos); - int rrlen = DNS_RR_LEN(pos); - - if (rrclass != ns_c_in) - { - return ARES_EBADRESP; - } - - pos += NS_RRFIXEDSZ; - - if (pos + rrlen > buf + len) - { - return ARES_EBADRESP; - } - - switch (rrtype) - { - case RES_A: - r = new LLARecord(rrname, rrttl); - break; - case RES_NS: - r = new LLNsRecord(rrname, rrttl); - break; - case RES_CNAME: - r = new LLCnameRecord(rrname, rrttl); - break; - case RES_PTR: - r = new LLPtrRecord(rrname, rrttl); - break; - case RES_AAAA: - r = new LLAaaaRecord(rrname, rrttl); - break; - case RES_SRV: - r = new LLSrvRecord(rrname, rrttl); - break; - default: - llinfos << "LLQueryResponder::parseRR got unknown RR type " << rrtype - << llendl; - return ARES_EBADRESP; - } - - ret = r->parse(buf, len, pos, rrlen); - - if (ret == ARES_SUCCESS) - { - pos += rrlen; - } else { - r = NULL; - } - - return ret; -} - -int LLQueryResponder::parseSection(const char *buf, size_t len, - size_t count, const char *&pos, - dns_rrs_t &rrs) -{ - int ret = ARES_SUCCESS; - - for (size_t i = 0; i < count; i++) - { - LLPointer r; - ret = parseRR(buf, len, pos, r); - if (ret != ARES_SUCCESS) - { - break; - } - rrs.push_back(r); - } - - return ret; -} - -void LLQueryResponder::queryResult(const char *buf, size_t len) -{ - const char *pos = buf; - int qdcount = DNS_HEADER_QDCOUNT(pos); - int ancount = DNS_HEADER_ANCOUNT(pos); - int nscount = DNS_HEADER_NSCOUNT(pos); - int arcount = DNS_HEADER_ARCOUNT(pos); - int ret; - - if (qdcount == 0 || ancount + nscount + arcount == 0) - { - ret = ARES_ENODATA; - goto bail; - } - - pos += NS_HFIXEDSZ; - - for (int i = 0; i < qdcount; i++) - { - std::string ignore; - size_t enclen; - - ret = LLAres::expandName(pos, buf, len, i == 0 ? mQuery : ignore, - enclen); - if (ret != ARES_SUCCESS) - { - goto bail; - } - - pos += enclen; - - if (i == 0) - { - int t = DNS_QUESTION_TYPE(pos); - switch (t) - { - case RES_A: - case RES_NS: - case RES_CNAME: - case RES_PTR: - case RES_AAAA: - case RES_SRV: - mType = (LLResType) t; - break; - default: - llinfos << "Cannot grok query type " << t << llendl; - ret = ARES_EBADQUERY; - goto bail; - } - } - - pos += NS_QFIXEDSZ; - if (pos > buf + len) - { - ret = ARES_EBADRESP; - goto bail; - } - } - - ret = parseSection(buf, len, ancount, pos, mAnswers); - if (ret != ARES_SUCCESS) - { - goto bail; - } - - ret = parseSection(buf, len, nscount, pos, mAuthorities); - if (ret != ARES_SUCCESS) - { - goto bail; - } - - ret = parseSection(buf, len, arcount, pos, mAdditional); - -bail: - mResult = ret; - if (mResult == ARES_SUCCESS) - { - queryResult(); - } else { - queryError(mResult); - } -} - -void LLQueryResponder::queryResult() -{ - llinfos << "LLQueryResponder::queryResult not implemented" << llendl; -} - -void LLAres::SrvResponder::queryResult() -{ - if (mType == RES_SRV) - { - srvResult(mAnswers); - } else { - srvError(ARES_EBADRESP); - } -} - -void LLAres::SrvResponder::queryError(int code) -{ - srvError(code); -} - -void LLAres::SrvResponder::srvResult(const dns_rrs_t &ents) -{ - llinfos << "LLAres::SrvResponder::srvResult not implemented" << llendl; - - for (size_t i = 0; i < ents.size(); i++) - { - const LLSrvRecord *s = (const LLSrvRecord *) ents[i].get(); - - llinfos << "[" << i << "] " << s->host() << ":" << s->port() - << " priority " << s->priority() - << " weight " << s->weight() - << llendl; - } -} - -void LLAres::SrvResponder::srvError(int code) -{ - llinfos << "LLAres::SrvResponder::srvError " << code << ": " - << LLAres::strerror(code) << llendl; -} - -static void nameinfo_callback(void *arg, int status, char *node, char *service) -{ - LLPointer *resp = - (LLPointer *) arg; - - if (status == ARES_SUCCESS) - { - (*resp)->nameInfoResult(node, service); - } else { - (*resp)->nameInfoError(status); - } - - delete resp; -} - -void LLAres::getNameInfo(const struct sockaddr &sa, socklen_t salen, int flags, - NameInfoResponder *resp) -{ - if (!chan_) - { - resp->nameInfoError(ARES_EBADRESP); - return; - } - ares_getnameinfo(chan_, &sa, salen, flags, nameinfo_callback, - new LLPointer(resp)); -} - -static void search_callback(void *arg, int status, unsigned char *abuf, - int alen) -{ - LLPointer *resp = - (LLPointer *) arg; - - if (status == ARES_SUCCESS) - { - (*resp)->queryResult((const char *) abuf, alen); - } else { - (*resp)->queryError(status); - } - - delete resp; -} - -void LLAres::search(const std::string &query, LLResType type, - QueryResponder *resp) -{ - if (!chan_) - { - resp->queryError(ARES_EBADRESP); - return; - } - ares_search(chan_, query.c_str(), ns_c_in, type, search_callback, - new LLPointer(resp)); -} - -bool LLAres::process(U64 timeout) -{ - if (!gAPRPoolp) - { - ll_init_apr(); - } - - int socks[ARES_GETSOCK_MAXNUM]; - apr_pollfd_t aprFds[ARES_GETSOCK_MAXNUM]; - apr_int32_t nsds = 0; - apr_status_t status; - apr_pool_t *pool; - int nactive = 0; - int bitmask; - - if (!chan_) - { - goto bail; - } - - bitmask = ares_getsock(chan_, socks, ARES_GETSOCK_MAXNUM); - - if (bitmask == 0) - { - goto bail; - } - - status = apr_pool_create(&pool, gAPRPoolp); - ll_apr_assert_status(status); - - for (int i = 0; i < ARES_GETSOCK_MAXNUM; i++) - { - if (ARES_GETSOCK_READABLE(bitmask, i)) - { - aprFds[nactive].reqevents = APR_POLLIN | APR_POLLERR; - } - else if (ARES_GETSOCK_WRITABLE(bitmask, i)) - { - aprFds[nactive].reqevents = APR_POLLOUT | APR_POLLERR; - } else { - continue; - } - - apr_socket_t *aprSock = NULL; - - status = apr_os_sock_put(&aprSock, (apr_os_sock_t *) &socks[i], pool); - if (status != APR_SUCCESS) - { - ll_apr_warn_status(status); - goto bail_pool; - } - - aprFds[nactive].desc.s = aprSock; - aprFds[nactive].desc_type = APR_POLL_SOCKET; - aprFds[nactive].p = pool; - aprFds[nactive].rtnevents = 0; - aprFds[nactive].client_data = &socks[i]; - - nactive++; - } - - if (nactive > 0) - { - status = apr_poll(aprFds, nactive, &nsds, timeout); - - if (status != APR_SUCCESS && status != APR_TIMEUP) - { - ll_apr_warn_status(status); - } - - for (int i = 0; i < nactive; i++) - { - int evts = aprFds[i].rtnevents; - int ifd = (evts & (APR_POLLIN | APR_POLLERR)) - ? *((int *) aprFds[i].client_data) : ARES_SOCKET_BAD; - int ofd = (evts & (APR_POLLOUT | APR_POLLERR)) - ? *((int *) aprFds[i].client_data) : ARES_SOCKET_BAD; - - ares_process_fd(chan_, ifd, ofd); - } - } - -bail_pool: - apr_pool_destroy(pool); - -bail: - return nsds > 0; -} - -bool LLAres::processAll() -{ - if (!chan_) - { - return false; - } - - bool anyProcessed = false, ret; - - do { - timeval tv; - - ret = ares_timeout(chan_, NULL, &tv) != NULL; - - if (ret) - { - ret = process(tv.tv_sec * 1000000LL + tv.tv_usec); - anyProcessed |= ret; - } - } while (ret); - - return anyProcessed; -} - -int LLAres::expandName(const char *encoded, const char *abuf, size_t alen, - std::string &s, size_t &enclen) -{ - char *t; - int ret; - long e; - - ret = ares_expand_name((const unsigned char *) encoded, - (const unsigned char *) abuf, alen, &t, &e); - if (ret == ARES_SUCCESS) - { - s.assign(t); - enclen = e; - ares_free_string(t); - } - return ret; -} - -const char *LLAres::strerror(int code) -{ - return ares_strerror(code); -} - -LLAres *gAres; - -LLAres *ll_init_ares() -{ - if (gAres == NULL) - { - gAres = new LLAres(); - } - return gAres; -} - -LLDnsRecord::LLDnsRecord(LLResType type, const std::string &name, - unsigned ttl) - : LLRefCount(), - mType(type), - mName(name), - mTTL(ttl) -{ -} - -LLHostRecord::LLHostRecord(LLResType type, const std::string &name, - unsigned ttl) - : LLDnsRecord(type, name, ttl) -{ -} - -int LLHostRecord::parse(const char *buf, size_t len, const char *pos, - size_t rrlen) -{ - int ret; - - ret = LLAres::expandName(pos, buf, len, mHost); - if (ret != ARES_SUCCESS) - { - goto bail; - } - - ret = ARES_SUCCESS; - -bail: - return ret; -} - -LLCnameRecord::LLCnameRecord(const std::string &name, unsigned ttl) - : LLHostRecord(RES_CNAME, name, ttl) -{ -} - -LLPtrRecord::LLPtrRecord(const std::string &name, unsigned ttl) - : LLHostRecord(RES_PTR, name, ttl) -{ -} - -LLAddrRecord::LLAddrRecord(LLResType type, const std::string &name, - unsigned ttl) - : LLDnsRecord(type, name, ttl) -{ -} - -LLARecord::LLARecord(const std::string &name, unsigned ttl) - : LLAddrRecord(RES_A, name, ttl) -{ -} - -int LLARecord::parse(const char *buf, size_t len, const char *pos, - size_t rrlen) -{ - int ret; - - if (rrlen != sizeof(mSA.sin.sin_addr.s_addr)) - { - ret = ARES_EBADRESP; - goto bail; - } - - memset(&mSA, 0, sizeof(mSA)); - memcpy(&mSA.sin.sin_addr.s_addr, pos, rrlen); - mSA.sin.sin_family = AF_INET6; - mSize = sizeof(mSA.sin); - - ret = ARES_SUCCESS; - -bail: - return ret; -} - -LLAaaaRecord::LLAaaaRecord(const std::string &name, unsigned ttl) - : LLAddrRecord(RES_AAAA, name, ttl) -{ -} - -int LLAaaaRecord::parse(const char *buf, size_t len, const char *pos, - size_t rrlen) -{ - int ret; - - if (rrlen != sizeof(mSA.sin6.sin6_addr)) - { - ret = ARES_EBADRESP; - goto bail; - } - - memset(&mSA, 0, sizeof(mSA)); - memcpy(&mSA.sin6.sin6_addr.s6_addr, pos, rrlen); - mSA.sin6.sin6_family = AF_INET6; - mSize = sizeof(mSA.sin6); - - ret = ARES_SUCCESS; - -bail: - return ret; -} - -LLSrvRecord::LLSrvRecord(const std::string &name, unsigned ttl) - : LLHostRecord(RES_SRV, name, ttl) -{ -} - -int LLSrvRecord::parse(const char *buf, size_t len, const char *pos, - size_t rrlen) -{ - int ret; - - if (rrlen < 6) - { - ret = ARES_EBADRESP; - goto bail; - } - - memcpy(&mPriority, pos, 2); - memcpy(&mWeight, pos + 2, 2); - memcpy(&mPort, pos + 4, 2); - - mPriority = ntohs(mPriority); - mWeight = ntohs(mWeight); - mPort = ntohs(mPort); - - ret = LLHostRecord::parse(buf, len, pos + 6, rrlen - 6); - -bail: - return ret; -} - -LLNsRecord::LLNsRecord(const std::string &name, unsigned ttl) - : LLHostRecord(RES_NS, name, ttl) -{ -} - -void LLAres::UriRewriteResponder::queryError(int code) -{ - std::vector uris; - uris.push_back(mUri.asString()); - rewriteResult(uris); -} - -void LLAres::UriRewriteResponder::queryResult() -{ - std::vector uris; - - if (mType != RES_SRV) - { - goto bail; - } - - for (size_t i = 0; i < mAnswers.size(); i++) - { - const LLSrvRecord *r = (const LLSrvRecord *) mAnswers[i].get(); - - if (r->type() == RES_SRV) - { - // Check the domain in the response to ensure that it's - // the same as the domain in the request, so that bad guys - // can't forge responses that point to their own login - // servers with their own certificates. - - // Hard-coding the domain to check here is a bit of a - // hack. Hoist it to an outer caller if anyone ever needs - // this functionality on other domains. - - static const std::string domain(".lindenlab.com"); - const std::string &host = r->host(); - - std::string::size_type s = host.find(domain) + domain.length(); - - if (s != host.length() && s != host.length() - 1) - { - continue; - } - - LLURI uri(mUri.scheme(), - mUri.userName(), - mUri.password(), - r->host(), - mUri.defaultPort() ? r->port() : mUri.hostPort(), - mUri.escapedPath(), - mUri.escapedQuery()); - uris.push_back(uri.asString()); - } - } - - if (!uris.empty()) - { - goto done; - } - -bail: - uris.push_back(mUri.asString()); - -done: - rewriteResult(uris); -} - -void LLAres::UriRewriteResponder::rewriteResult( - const std::vector &uris) -{ - llinfos << "LLAres::UriRewriteResponder::rewriteResult not implemented" - << llendl; - - for (size_t i = 0; i < uris.size(); i++) - { - llinfos << "[" << i << "] " << uris[i] << llendl; - } -} diff --git a/linden/indra/llcommon/llares.h b/linden/indra/llcommon/llares.h deleted file mode 100644 index 07957f1..0000000 --- a/linden/indra/llcommon/llares.h +++ /dev/null @@ -1,572 +0,0 @@ -/** - * @file llares.h - * @author Bryan O'Sullivan - * @date 2007-08-15 - * @brief Wrapper for asynchronous DNS lookups. - * - * $LicenseInfo:firstyear=2007&license=viewergpl$ - * - * Copyright (c) 2007-2008, Linden Research, Inc. - * - * Second Life Viewer Source Code - * 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://secondlifegrid.net/programs/open_source/licensing/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://secondlifegrid.net/programs/open_source/licensing/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. - * $/LicenseInfo$ - */ - -#ifndef LL_LLARES_H -#define LL_LLARES_H - -#ifdef LL_WINDOWS -# include -#endif - -#ifdef LL_STANDALONE -# include -#else -# include -#endif - -#include "llmemory.h" -#include "lluri.h" - -class LLQueryResponder; - -/** - * @brief Supported DNS RR types. - */ -enum LLResType -{ - RES_INVALID = 0, /**< Cookie. */ - RES_A = 1, /**< "A" record. IPv4 address. */ - RES_NS = 2, /**< "NS" record. Authoritative server. */ - RES_CNAME = 5, /**< "CNAME" record. Canonical name. */ - RES_PTR = 12, /**< "PTR" record. Domain name pointer. */ - RES_AAAA = 28, /**< "AAAA" record. IPv6 Address. */ - RES_SRV = 33, /**< "SRV" record. Server Selection. */ - RES_MAX = 65536 /**< Sentinel; RR types are 16 bits wide. */ -}; - -/** - * @class LLDnsRecord - * @brief Base class for all DNS RR types. - */ -class LLDnsRecord : public LLRefCount -{ -protected: - friend class LLQueryResponder; - - LLResType mType; - std::string mName; - unsigned mTTL; - - virtual int parse(const char *buf, size_t len, const char *pos, - size_t rrlen) = 0; - - LLDnsRecord(LLResType type, const std::string &name, unsigned ttl); - -public: - /** - * @brief Record name. - */ - const std::string &name() const { return mName; } - - /** - * @brief Time-to-live value, in seconds. - */ - unsigned ttl() const { return mTTL; } - - /** - * @brief RR type. - */ - LLResType type() const { return mType; } -}; - -/** - * @class LLAddrRecord - * @brief Base class for address-related RRs. - */ -class LLAddrRecord : public LLDnsRecord -{ -protected: - friend class LLQueryResponder; - - LLAddrRecord(LLResType type, const std::string &name, unsigned ttl); - - union - { - sockaddr sa; - sockaddr_in sin; - sockaddr_in6 sin6; - } mSA; - - socklen_t mSize; - -public: - /** - * @brief Generic socket address. - */ - const sockaddr &addr() const { return mSA.sa; } - - /** - * @brief Size of the socket structure. - */ - socklen_t size() const { return mSize; } -}; - -/** - * @class LLARecord - * @brief A RR, for IPv4 addresses. - */ -class LLARecord : public LLAddrRecord -{ -protected: - friend class LLQueryResponder; - - LLARecord(const std::string &name, unsigned ttl); - - int parse(const char *buf, size_t len, const char *pos, size_t rrlen); - -public: - /** - * @brief Socket address. - */ - const sockaddr_in &addr_in() const { return mSA.sin; } -}; - -/** - * @class LLAaaaRecord - * @brief AAAA RR, for IPv6 addresses. - */ -class LLAaaaRecord : public LLAddrRecord -{ -protected: - friend class LLQueryResponder; - - LLAaaaRecord(const std::string &name, unsigned ttl); - - int parse(const char *buf, size_t len, const char *pos, size_t rrlen); - -public: - /** - * @brief Socket address. - */ - const sockaddr_in6 &addr_in6() const { return mSA.sin6; } -}; - -/** - * @class LLHostRecord - * @brief Base class for host-related RRs. - */ -class LLHostRecord : public LLDnsRecord -{ -protected: - LLHostRecord(LLResType type, const std::string &name, unsigned ttl); - - int parse(const char *buf, size_t len, const char *pos, size_t rrlen); - - std::string mHost; - -public: - /** - * @brief Host name. - */ - const std::string &host() const { return mHost; } -}; - -/** - * @class LLCnameRecord - * @brief CNAME RR. - */ -class LLCnameRecord : public LLHostRecord -{ -protected: - friend class LLQueryResponder; - - LLCnameRecord(const std::string &name, unsigned ttl); -}; - -/** - * @class LLPtrRecord - * @brief PTR RR. - */ -class LLPtrRecord : public LLHostRecord -{ -protected: - friend class LLQueryResponder; - - LLPtrRecord(const std::string &name, unsigned ttl); -}; - -/** - * @class LLSrvRecord - * @brief SRV RR. - */ -class LLSrvRecord : public LLHostRecord -{ -protected: - U16 mPriority; - U16 mWeight; - U16 mPort; - - int parse(const char *buf, size_t len, const char *pos, size_t rrlen); - -public: - LLSrvRecord(const std::string &name, unsigned ttl); - - /** - * @brief Service priority. - */ - U16 priority() const { return mPriority; } - - /** - * @brief Service weight. - */ - U16 weight() const { return mWeight; } - - /** - * @brief Port number of service. - */ - U16 port() const { return mPort; } - - /** - * @brief Functor for sorting SRV records by priority. - */ - struct ComparePriorityLowest - { - bool operator()(const LLSrvRecord& lhs, const LLSrvRecord& rhs) - { - return lhs.mPriority < rhs.mPriority; - } - }; -}; - -/** - * @class LLNsRecord - * @brief NS RR. - */ -class LLNsRecord : public LLHostRecord -{ -public: - LLNsRecord(const std::string &name, unsigned ttl); -}; - -class LLQueryResponder; - -/** - * @class LLAres - * @brief Asynchronous address resolver. - */ -class LLAres -{ -public: - /** - * @class HostResponder - * @brief Base class for responding to hostname lookups. - * @see LLAres::getHostByName - */ - class HostResponder : public LLRefCount - { - public: - virtual ~HostResponder(); - - virtual void hostResult(const hostent *ent); - virtual void hostError(int code); - }; - - /** - * @class NameInfoResponder - * @brief Base class for responding to address lookups. - * @see LLAres::getNameInfo - */ - class NameInfoResponder : public LLRefCount - { - public: - virtual ~NameInfoResponder(); - - virtual void nameInfoResult(const char *node, const char *service); - virtual void nameInfoError(int code); - }; - - /** - * @class QueryResponder - * @brief Base class for responding to custom searches. - * @see LLAres::search - */ - class QueryResponder : public LLRefCount - { - public: - virtual ~QueryResponder(); - - virtual void queryResult(const char *buf, size_t len); - virtual void queryError(int code); - }; - - class SrvResponder; - class UriRewriteResponder; - - LLAres(); - - ~LLAres(); - - /** - * Cancel all outstanding requests. The error methods of the - * corresponding responders will be called, with ARES_ETIMEOUT. - */ - void cancel(); - - /** - * Look up the address of a host. - * - * @param name name of host to look up - * @param resp responder to call with result - * @param family AF_INET for IPv4 addresses, AF_INET6 for IPv6 - */ - void getHostByName(const std::string &name, HostResponder *resp, - int family = AF_INET) { - getHostByName(name.c_str(), resp, family); - } - - /** - * Look up the address of a host. - * - * @param name name of host to look up - * @param resp responder to call with result - * @param family AF_INET for IPv4 addresses, AF_INET6 for IPv6 - */ - void getHostByName(const char *name, HostResponder *resp, - int family = PF_INET); - - /** - * Look up the name associated with a socket address. - * - * @param sa socket address to look up - * @param salen size of socket address - * @param flags flags to use - * @param resp responder to call with result - */ - void getNameInfo(const struct sockaddr &sa, socklen_t salen, int flags, - NameInfoResponder *resp); - - /** - * Look up SRV (service location) records for a service name. - * - * @param name service name (e.g. "_https._tcp.login.agni.lindenlab.com") - * @param resp responder to call with result - */ - void getSrvRecords(const std::string &name, SrvResponder *resp); - - /** - * Rewrite a URI, using SRV (service location) records for its - * protocol if available. If no SRV records are published, the - * existing URI is handed to the responder. - * - * @param uri URI to rewrite - * @param resp responder to call with result - */ - void rewriteURI(const std::string &uri, - UriRewriteResponder *resp); - - /** - * Start a custom search. - * - * @param query query to make - * @param type type of query to perform - * @param resp responder to call with result - */ - void search(const std::string &query, LLResType type, - QueryResponder *resp); - - /** - * Process any outstanding queries. This method takes an optional - * timeout parameter (specified in microseconds). If provided, it - * will block the calling thread for that length of time to await - * possible responses. A timeout of zero will return immediately - * if there are no responses or timeouts to process. - * - * @param timeoutUsecs number of microseconds to block before timing out - * @return whether any responses were processed - */ - bool process(U64 timeoutUsecs = 0); - - /** - * Process all outstanding queries, blocking the calling thread - * until all have either been responded to or timed out. - * - * @return whether any responses were processed - */ - bool processAll(); - - /** - * Expand a DNS-encoded compressed string into a normal string. - * - * @param encoded the encoded name (null-terminated) - * @param abuf the response buffer in which the string is embedded - * @param alen the length of the response buffer - * @param s the string into which to place the result - * @return ARES_SUCCESS on success, otherwise an error indicator - */ - static int expandName(const char *encoded, const char *abuf, size_t alen, - std::string &s) { - size_t ignore; - return expandName(encoded, abuf, alen, s, ignore); - } - - static int expandName(const char *encoded, const char *abuf, size_t alen, - std::string &s, size_t &enclen); - - /** - * Return a string describing an error code. - */ - static const char *strerror(int code); - -protected: - ares_channel chan_; - -}; - -/** - * An ordered collection of DNS resource records. - */ -typedef std::vector > dns_rrs_t; - -/** - * @class LLQueryResponder - * @brief Base class for friendly handling of DNS query responses. - * - * This class parses a DNS response and represents it in a friendly - * manner. - * - * @see LLDnsRecord - * @see LLARecord - * @see LLNsRecord - * @see LLCnameRecord - * @see LLPtrRecord - * @see LLAaaaRecord - * @see LLSrvRecord - */ -class LLQueryResponder : public LLAres::QueryResponder -{ -protected: - int mResult; - std::string mQuery; - LLResType mType; - - dns_rrs_t mAnswers; - dns_rrs_t mAuthorities; - dns_rrs_t mAdditional; - - /** - * Parse a single RR. - */ - int parseRR(const char *buf, size_t len, const char *&pos, - LLPointer &r); - /** - * Parse one section of a response. - */ - int parseSection(const char *buf, size_t len, - size_t count, const char *& pos, dns_rrs_t &rrs); - - void queryResult(const char *buf, size_t len); - virtual void queryResult(); - -public: - LLQueryResponder(); - - /** - * Indicate whether the response could be parsed successfully. - */ - bool valid() const { return mResult == ARES_SUCCESS; } - - /** - * The more detailed result of parsing the response. - */ - int result() const { return mResult; } - - /** - * Return the query embedded in the response. - */ - const std::string &query() const { return mQuery; } - - /** - * Return the contents of the "answers" section of the response. - */ - const dns_rrs_t &answers() const { return mAnswers; } - - /** - * Return the contents of the "authorities" section of the - * response. - */ - const dns_rrs_t &authorities() const { return mAuthorities; } - - /** - * Return the contents of the "additional records" section of the - * response. - */ - const dns_rrs_t &additional() const { return mAdditional; } -}; - -/** - * @class LLAres::SrvResponder - * @brief Class for handling SRV query responses. - */ -class LLAres::SrvResponder : public LLQueryResponder -{ -public: - friend void LLAres::getSrvRecords(const std::string &name, - SrvResponder *resp); - void queryResult(); - void queryError(int code); - - virtual void srvResult(const dns_rrs_t &ents); - virtual void srvError(int code); -}; - -/** - * @class LLAres::UriRewriteResponder - * @brief Class for handling URI rewrites based on SRV records. - */ -class LLAres::UriRewriteResponder : public LLQueryResponder -{ -protected: - LLURI mUri; - -public: - friend void LLAres::rewriteURI(const std::string &uri, - UriRewriteResponder *resp); - void queryResult(); - void queryError(int code); - - virtual void rewriteResult(const std::vector &uris); -}; - -/** - * Singleton responder. - */ -extern LLAres *gAres; - -/** - * Set up the singleton responder. It's safe to call this more than - * once from within a single thread, but this function is not - * thread safe. - */ -extern LLAres *ll_init_ares(); - -#endif // LL_LLARES_H diff --git a/linden/indra/llcommon/llassettype.cpp b/linden/indra/llcommon/llassettype.cpp index 4b2a862..27b8310 100644 --- a/linden/indra/llcommon/llassettype.cpp +++ b/linden/indra/llcommon/llassettype.cpp @@ -75,7 +75,7 @@ asset_info_t asset_types[] = LLAssetType::EType LLAssetType::getType(const std::string& sin) { std::string s = sin; - LLString::toUpper(s); + LLStringUtil::toUpper(s); for (S32 idx = 0; ;idx++) { asset_info_t* info = asset_types + idx; @@ -128,7 +128,7 @@ const char* LLAssetType::mAssetTypeNames[LLAssetType::AT_COUNT] = "jpeg", "animatn", "gesture", - "simstate", + "simstate" }; // This table is meant for decoding to human readable form. Put any @@ -158,7 +158,7 @@ const char* LLAssetType::mAssetTypeHumanNames[LLAssetType::AT_COUNT] = "jpeg image", "animation", "gesture", - "simstate", + "simstate" }; ///---------------------------------------------------------------------------- @@ -181,9 +181,14 @@ const char* LLAssetType::lookup( LLAssetType::EType type ) // static LLAssetType::EType LLAssetType::lookup( const char* name ) { + return lookup(ll_safe_string(name)); +} + +LLAssetType::EType LLAssetType::lookup( const std::string& name ) +{ for( S32 i = 0; i < AT_COUNT; i++ ) { - if( 0 == strcmp(name, mAssetTypeNames[i]) ) + if( name == mAssetTypeNames[i] ) { // match return (EType)i; @@ -208,9 +213,14 @@ const char* LLAssetType::lookupHumanReadable(LLAssetType::EType type) // static LLAssetType::EType LLAssetType::lookupHumanReadable( const char* name ) { + return lookupHumanReadable(ll_safe_string(name)); +} + +LLAssetType::EType LLAssetType::lookupHumanReadable( const std::string& name ) +{ for( S32 i = 0; i < AT_COUNT; i++ ) { - if( 0 == strcmp(name, mAssetTypeHumanNames[i]) ) + if( name == mAssetTypeHumanNames[i] ) { // match return (EType)i; diff --git a/linden/indra/llcommon/llassettype.h b/linden/indra/llcommon/llassettype.h index f5ef05b..f976df4 100644 --- a/linden/indra/llcommon/llassettype.h +++ b/linden/indra/llcommon/llassettype.h @@ -145,11 +145,13 @@ public: }; // machine transation between type and strings - static EType lookup(const char* name); + static EType lookup(const char* name); // safe conversion to std::string, *TODO: deprecate + static EType lookup(const std::string& name); static const char* lookup(EType type); // translation from a type to a human readable form. - static EType lookupHumanReadable( const char* name ); + static EType lookupHumanReadable( const char* name ); // safe conversion to std::string, *TODO: deprecate + static EType lookupHumanReadable( const std::string& name ); static const char* lookupHumanReadable(EType type); static EDragAndDropType lookupDragAndDropType( EType ); diff --git a/linden/indra/llcommon/llbase64.cpp b/linden/indra/llcommon/llbase64.cpp index 950ce6e..c2421d8 100644 --- a/linden/indra/llcommon/llbase64.cpp +++ b/linden/indra/llcommon/llbase64.cpp @@ -36,7 +36,7 @@ #include -#include "apr-1/apr_base64.h" +#include "apr_base64.h" // static diff --git a/linden/indra/llcommon/llchat.h b/linden/indra/llcommon/llchat.h index a46b8aa..ea1a579 100644 --- a/linden/indra/llcommon/llchat.h +++ b/linden/indra/llcommon/llchat.h @@ -68,7 +68,7 @@ typedef enum e_chat_audible_level class LLChat { public: - LLChat(const LLString& text = LLString::null) + LLChat(const std::string& text = LLStringUtil::null) : mText(text), mFromName(), mFromID(), @@ -80,8 +80,8 @@ public: mPosAgent() { } - LLString mText; // UTF-8 line of text - LLString mFromName; // agent or object name + std::string mText; // UTF-8 line of text + std::string mFromName; // agent or object name LLUUID mFromID; // agent id or object id EChatSourceType mSourceType; EChatType mChatType; diff --git a/linden/indra/llcommon/llcommon.vcproj b/linden/indra/llcommon/llcommon.vcproj deleted file mode 100644 index f54ea13..0000000 --- a/linden/indra/llcommon/llcommon.vcproj +++ /dev/null @@ -1,608 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/linden/indra/llcommon/llcommon_vc8.vcproj b/linden/indra/llcommon/llcommon_vc8.vcproj deleted file mode 100644 index a298499..0000000 --- a/linden/indra/llcommon/llcommon_vc8.vcproj +++ /dev/null @@ -1,847 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/linden/indra/llcommon/llcommon_vc9.vcproj b/linden/indra/llcommon/llcommon_vc9.vcproj deleted file mode 100644 index 1ae534d..0000000 --- a/linden/indra/llcommon/llcommon_vc9.vcproj +++ /dev/null @@ -1,828 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/linden/indra/llcommon/llcrc.cpp b/linden/indra/llcommon/llcrc.cpp new file mode 100644 index 0000000..beb76d1 --- /dev/null +++ b/linden/indra/llcommon/llcrc.cpp @@ -0,0 +1,224 @@ +/** + * @file llcrc.cpp + * @brief implementation of the crc class. + * + * $LicenseInfo:firstyear=2002&license=viewergpl$ + * + * Copyright (c) 2002-2008, Linden Research, Inc. + * + * Second Life Viewer Source Code + * 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://secondlifegrid.net/programs/open_source/licensing/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://secondlifegrid.net/programs/open_source/licensing/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. + * $/LicenseInfo$ + */ + +#include "linden_common.h" + +#include "llcrc.h" +#include "llerror.h" + +/* Copyright (C) 1986 Gary S. Brown. You may use this program, or + code or tables extracted from it, as desired without restriction.*/ + +/* First, the polynomial itself and its table of feedback terms. The */ +/* polynomial is */ +/* X^32+X^26+X^23+X^22+X^16+X^12+X^11+X^10+X^8+X^7+X^5+X^4+X^2+X^1+X^0 */ +/* Note that we take it "backwards" and put the highest-order term in */ +/* the lowest-order bit. The X^32 term is "implied"; the LSB is the */ +/* X^31 term, etc. The X^0 term (usually shown as "+1") results in */ +/* the MSB being 1. */ + +/* Note that the usual hardware shift register implementation, which */ +/* is what we're using (we're merely optimizing it by doing eight-bit */ +/* chunks at a time) shifts bits into the lowest-order term. In our */ +/* implementation, that means shifting towards the right. Why do we */ +/* do it this way? Because the calculated CRC must be transmitted in */ +/* order from highest-order term to lowest-order term. UARTs transmit */ +/* characters in order from LSB to MSB. By storing the CRC this way, */ +/* we hand it to the UART in the order low-byte to high-byte; the UART */ +/* sends each low-bit to hight-bit; and the result is transmission bit */ +/* by bit from highest- to lowest-order term without requiring any bit */ +/* shuffling on our part. Reception works similarly. */ + +/* The feedback terms table consists of 256, 32-bit entries. Notes: */ +/* */ +/* 1. The table can be generated at runtime if desired; code to do so */ +/* is shown later. It might not be obvious, but the feedback */ +/* terms simply represent the results of eight shift/xor opera- */ +/* tions for all combinations of data and CRC register values. */ +/* */ +/* 2. The CRC accumulation logic is the same for all CRC polynomials, */ +/* be they sixteen or thirty-two bits wide. You simply choose the */ +/* appropriate table. Alternatively, because the table can be */ +/* generated at runtime, you can start by generating the table for */ +/* the polynomial in question and use exactly the same "updcrc", */ +/* if your application needn't simultaneously handle two CRC */ +/* polynomials. (Note, however, that XMODEM is strange.) */ +/* */ +/* 3. For 16-bit CRCs, the table entries need be only 16 bits wide; */ +/* of course, 32-bit entries work OK if the high 16 bits are zero. */ +/* */ +/* 4. The values must be right-shifted by eight bits by the "updcrc" */ +/* logic; the shift must be unsigned (bring in zeroes). On some */ +/* hardware you could probably optimize the shift in assembler by */ +/* using byte-swap instructions. */ + +///---------------------------------------------------------------------------- +/// Local function declarations, constants, enums, and typedefs +///---------------------------------------------------------------------------- + +#define UPDC32(octet,crc) (crc_32_tab[((crc) \ + ^ ((U8)octet)) & 0xff] ^ ((crc) >> 8)) + + +static U32 crc_32_tab[] = { /* CRC polynomial 0xedb88320 */ +0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, +0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, +0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2, +0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, +0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, +0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, +0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa, 0x42b2986c, +0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59, +0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, +0xcfba9599, 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, +0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, 0x01db7106, +0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433, +0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, +0x91646c97, 0xe6635c01, 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, +0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950, +0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65, +0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7, +0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, +0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, +0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, +0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81, +0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, +0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, 0xe3630b12, 0x94643b84, +0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, +0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, +0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, +0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, 0xd6d6a3e8, 0xa1d1937e, +0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b, +0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, +0x316e8eef, 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, +0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, 0xb2bd0b28, +0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d, +0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f, +0x72076785, 0x05005713, 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, +0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242, +0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777, +0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69, +0x616bffd3, 0x166ccf45, 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, +0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, +0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, +0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693, +0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, +0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d +}; + + +///---------------------------------------------------------------------------- +/// Class llcrc +///---------------------------------------------------------------------------- + +// Default constructor +LLCRC::LLCRC() : mCurrent(0xffffffff) +{ +} + + +U32 LLCRC::getCRC() const +{ + return ~mCurrent; +} + +void LLCRC::update(U8 next_byte) +{ + mCurrent = UPDC32(next_byte, mCurrent); +} + +void LLCRC::update(const U8* buffer, size_t buffer_size) +{ + for (size_t i = 0; i < buffer_size; i++) + { + mCurrent = UPDC32(buffer[i], mCurrent); + } +} + +void LLCRC::update(const std::string& filename) +{ + if (filename.empty()) + { + llerrs << "No filename specified" << llendl; + return; + } + + FILE* fp = LLFile::fopen(filename, "rb"); /* Flawfinder: ignore */ + + if (fp) + { + fseek(fp, 0, SEEK_END); + long size = ftell(fp); + + fseek(fp, 0, SEEK_SET); + + if (size > 0) + { + U8* data = new U8[size]; + size_t nread; + + nread = fread(data, 1, size, fp); + fclose(fp); + + if (nread < (size_t) size) + { + llwarns << "Short read on " << filename << llendl; + } + + update(data, nread); + delete[] data; + } + } +} + + +#ifdef _DEBUG +BOOL LLCRC::testHarness() +{ + const S32 TEST_BUFFER_SIZE = 16; + const char TEST_BUFFER[TEST_BUFFER_SIZE] = "hello &#$)$&Nd0"; /* Flawfinder: ignore */ + LLCRC c1, c2; + c1.update((U8*)TEST_BUFFER, TEST_BUFFER_SIZE - 1); + char* rh = (char*)TEST_BUFFER; + while(*rh != '\0') + { + c2.update(*rh); + ++rh; + } + return(c1.getCRC() == c2.getCRC()); +} +#endif + + + +///---------------------------------------------------------------------------- +/// Local function definitions +///---------------------------------------------------------------------------- diff --git a/linden/indra/llcommon/llcrc.h b/linden/indra/llcommon/llcrc.h new file mode 100644 index 0000000..20f214e --- /dev/null +++ b/linden/indra/llcommon/llcrc.h @@ -0,0 +1,73 @@ +/** + * @file llcrc.h + * @brief LLCRC class header file. + * + * $LicenseInfo:firstyear=2002&license=viewergpl$ + * + * Copyright (c) 2002-2008, Linden Research, Inc. + * + * Second Life Viewer Source Code + * 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://secondlifegrid.net/programs/open_source/licensing/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://secondlifegrid.net/programs/open_source/licensing/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. + * $/LicenseInfo$ + */ + +#ifndef LL_LLCRC_H +#define LL_LLCRC_H + +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// Class llcrc +// +// Simple 32 bit crc. To use, instantiate an LLCRC instance and feed +// it the bytes you want to check. It will update the internal crc as +// you go, and you can qery it at the end. As a horribly inefficient +// example (don't try this at work kids): +// +// LLCRC crc; +// FILE* fp = LLFile::fopen(filename,"rb"); +// while(!feof(fp)) { +// crc.update(fgetc(fp)); +// } +// fclose(fp); +// llinfos << "File crc: " << crc.getCRC() << llendl; +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +class LLCRC +{ +protected: + U32 mCurrent; + +public: + LLCRC(); + + U32 getCRC() const; + void update(U8 next_byte); + void update(const U8* buffer, size_t buffer_size); + void update(const std::string& filename); + +#ifdef _DEBUG + // This function runs tests to make sure the crc is + // working. Returns TRUE if it is. + static BOOL testHarness(); +#endif +}; + + +#endif // LL_LLCRC_H diff --git a/linden/indra/llcommon/lldarray.h b/linden/indra/llcommon/lldarray.h index 45e564f..32ece4e 100644 --- a/linden/indra/llcommon/lldarray.h +++ b/linden/indra/llcommon/lldarray.h @@ -32,7 +32,6 @@ #ifndef LL_LLDARRAY_H #define LL_LLDARRAY_H -#include "llmath.h" #include "llerror.h" #include diff --git a/linden/indra/llcommon/lldate.cpp b/linden/indra/llcommon/lldate.cpp index 5d36d2b..a313246 100644 --- a/linden/indra/llcommon/lldate.cpp +++ b/linden/indra/llcommon/lldate.cpp @@ -34,7 +34,7 @@ #include "linden_common.h" #include "lldate.h" -#include "apr-1/apr_time.h" +#include "apr_time.h" #include #include diff --git a/linden/indra/llcommon/llerror.cpp b/linden/indra/llcommon/llerror.cpp index b74b288..5c7c3cd 100644 --- a/linden/indra/llcommon/llerror.cpp +++ b/linden/indra/llcommon/llerror.cpp @@ -102,7 +102,7 @@ namespace { public: RecordToFile(const std::string& filename) { - mFile.open(filename.c_str(), llofstream::out | llofstream::app); + mFile.open(filename, llofstream::out | llofstream::app); if (!mFile) { llinfos << "Error setting log file to " << filename << llendl; @@ -168,7 +168,7 @@ namespace { private: bool mTimestamp; - typedef enum ANSIState {ANSI_PROBE, ANSI_YES, ANSI_NO}; + enum ANSIState {ANSI_PROBE, ANSI_YES, ANSI_NO}; ANSIState mUseANSI; void colorANSI(const std::string color) { @@ -196,7 +196,7 @@ namespace { virtual void recordMessage(LLError::ELevel level, const std::string& message) { - mBuffer.addLine(message.c_str()); + mBuffer.addLine(message); } private: @@ -305,7 +305,7 @@ namespace std::string file = dirBase + "logcontrol-dev.xml"; llstat stat_info; - if (LLFile::stat(file.c_str(), &stat_info)) { + if (LLFile::stat(file, &stat_info)) { // NB: stat returns non-zero if it can't read the file, for example // if it doesn't exist. LLFile has no better abstraction for // testing for file existence. @@ -321,7 +321,7 @@ namespace LLSD configuration; { - llifstream file(filename().c_str()); + llifstream file(filename()); if (file.is_open()) { LLSDSerialize::fromXML(configuration, file); @@ -1040,17 +1040,37 @@ namespace LLError << "(" << site.mLine << ") : "; } - if (message.find(functionName(site.mFunction)) == std::string::npos) - { #if LL_WINDOWS - // DevStudio: __FUNCTION__ already includes the full class name + // DevStudio: __FUNCTION__ already includes the full class name #else - if (site.mClassInfo != typeid(NoClassInfo)) + if (site.mClassInfo != typeid(NoClassInfo)) + { + prefix << className(site.mClassInfo) << "::"; + } + #endif + prefix << site.mFunction << ": "; + + if (site.mPrintOnce) + { + std::map::iterator messageIter = s.uniqueLogMessages.find(message); + if (messageIter != s.uniqueLogMessages.end()) + { + messageIter->second++; + unsigned int num_messages = messageIter->second; + if (num_messages == 10 || num_messages == 50 || (num_messages % 100) == 0) + { + prefix << "ONCE (" << num_messages << "th time seen): "; + } + else + { + return; + } + } + else { - prefix << className(site.mClassInfo) << "::"; + prefix << "ONCE: "; + s.uniqueLogMessages[message] = 1; } - #endif - prefix << site.mFunction << ": "; } if (site.mPrintOnce) diff --git a/linden/indra/llcommon/llevent.cpp b/linden/indra/llcommon/llevent.cpp index 33af028..7d701a1 100644 --- a/linden/indra/llcommon/llevent.cpp +++ b/linden/indra/llcommon/llevent.cpp @@ -219,7 +219,7 @@ std::vector LLSimpleDispatcher::getListeners() const bool LLSimpleDispatcher::fireEvent(LLPointer event, LLSD filter) { std::vector::iterator itor; - LLString filter_string = filter.asString(); + std::string filter_string = filter.asString(); for (itor=mListeners.begin(); itor!=mListeners.end(); ++itor) { LLListenerEntry& entry = *itor; diff --git a/linden/indra/llcommon/llfile.cpp b/linden/indra/llcommon/llfile.cpp index fc0d481..b32437f 100644 --- a/linden/indra/llcommon/llfile.cpp +++ b/linden/indra/llcommon/llfile.cpp @@ -32,6 +32,10 @@ * $/LicenseInfo$ */ +#if LL_WINDOWS +#include +#endif + #include "linden_common.h" #include "llfile.h" #include "llstring.h" @@ -40,7 +44,7 @@ using namespace std; // static -int LLFile::mkdir(const char* dirname, int perms) +int LLFile::mkdir(const std::string& dirname, int perms) { #if LL_WINDOWS // permissions are ignored on Windows @@ -48,12 +52,12 @@ int LLFile::mkdir(const char* dirname, int perms) llutf16string utf16dirname = utf8str_to_utf16str(utf8dirname); return _wmkdir(utf16dirname.c_str()); #else - return ::mkdir(dirname, (mode_t)perms); + return ::mkdir(dirname.c_str(), (mode_t)perms); #endif } // static -int LLFile::rmdir(const char* dirname) +int LLFile::rmdir(const std::string& dirname) { #if LL_WINDOWS // permissions are ignored on Windows @@ -61,29 +65,29 @@ int LLFile::rmdir(const char* dirname) llutf16string utf16dirname = utf8str_to_utf16str(utf8dirname); return _wrmdir(utf16dirname.c_str()); #else - return ::rmdir(dirname); + return ::rmdir(dirname.c_str()); #endif } // static -LLFILE* LLFile::fopen(const char* filename, const char* mode) /* Flawfinder: ignore */ +LLFILE* LLFile::fopen(const std::string& filename, const char* mode) /* Flawfinder: ignore */ { #if LL_WINDOWS std::string utf8filename = filename; - std::string utf8mode = mode; + std::string utf8mode = std::string(mode); llutf16string utf16filename = utf8str_to_utf16str(utf8filename); llutf16string utf16mode = utf8str_to_utf16str(utf8mode); return _wfopen(utf16filename.c_str(),utf16mode.c_str()); #else - return ::fopen(filename,mode); /* Flawfinder: ignore */ + return ::fopen(filename.c_str(),mode); /* Flawfinder: ignore */ #endif } -LLFILE* LLFile::_fsopen(const char* filename, const char* mode, int sharingFlag) +LLFILE* LLFile::_fsopen(const std::string& filename, const char* mode, int sharingFlag) { #if LL_WINDOWS std::string utf8filename = filename; - std::string utf8mode = mode; + std::string utf8mode = std::string(mode); llutf16string utf16filename = utf8str_to_utf16str(utf8filename); llutf16string utf16mode = utf8str_to_utf16str(utf8mode); return _wfsopen(utf16filename.c_str(),utf16mode.c_str(),sharingFlag); @@ -93,18 +97,18 @@ LLFILE* LLFile::_fsopen(const char* filename, const char* mode, int sharingFlag) #endif } -int LLFile::remove(const char* filename) +int LLFile::remove(const std::string& filename) { #if LL_WINDOWS std::string utf8filename = filename; llutf16string utf16filename = utf8str_to_utf16str(utf8filename); return _wremove(utf16filename.c_str()); #else - return ::remove(filename); + return ::remove(filename.c_str()); #endif } -int LLFile::rename(const char* filename, const char* newname) +int LLFile::rename(const std::string& filename, const std::string& newname) { #if LL_WINDOWS std::string utf8filename = filename; @@ -113,19 +117,63 @@ int LLFile::rename(const char* filename, const char* newname) llutf16string utf16newname = utf8str_to_utf16str(utf8newname); return _wrename(utf16filename.c_str(),utf16newname.c_str()); #else - return ::rename(filename,newname); + return ::rename(filename.c_str(),newname.c_str()); #endif } -int LLFile::stat(const char* filename, llstat* filestatus) +int LLFile::stat(const std::string& filename, llstat* filestatus) { #if LL_WINDOWS std::string utf8filename = filename; llutf16string utf16filename = utf8str_to_utf16str(utf8filename); return _wstat(utf16filename.c_str(),filestatus); #else - return ::stat(filename,filestatus); + return ::stat(filename.c_str(),filestatus); +#endif +} + +bool LLFile::isdir(const std::string& filename) +{ + llstat st; + + return stat(filename, &st) == 0 && S_ISDIR(st.st_mode); +} + +bool LLFile::isfile(const std::string& filename) +{ + llstat st; + + return stat(filename, &st) == 0 && S_ISREG(st.st_mode); +} + +const char *LLFile::tmpdir() +{ + static std::string utf8path; + + if (utf8path.empty()) + { + char sep; +#if LL_WINDOWS + sep = '\\'; + + DWORD len = GetTempPathW(0, L""); + llutf16string utf16path; + utf16path.resize(len + 1); + len = GetTempPathW(static_cast(utf16path.size()), &utf16path[0]); + utf8path = utf16str_to_utf8str(utf16path); +#else + sep = '/'; + + char *env = getenv("TMPDIR"); + + utf8path = env ? env : "/tmp/"; #endif + if (utf8path[utf8path.size() - 1] != sep) + { + utf8path += sep; + } + } + return utf8path.c_str(); } @@ -133,7 +181,7 @@ int LLFile::stat(const char* filename, llstat* filestatus) #if USE_LLFILESTREAMS -LLFILE * LLFile::_Fiopen(const char *filename, std::ios::openmode mode,int) // protection currently unused +LLFILE * LLFile::_Fiopen(const std::string& filename, std::ios::openmode mode,int) // protection currently unused { // open a file static const char *mods[] = { // fopen mode strings corresponding to valid[i] @@ -202,7 +250,7 @@ void llifstream::close() } } -void llifstream::open(const char* _Filename, /* Flawfinder: ignore */ +void llifstream::open(const std::string& _Filename, /* Flawfinder: ignore */ ios_base::openmode _Mode, int _Prot) { // open a C stream with specified mode @@ -234,7 +282,7 @@ llifstream::~llifstream() delete _Filebuffer; } -llifstream::llifstream(const char *_Filename, +llifstream::llifstream(const std::string& _Filename, ios_base::openmode _Mode, int _Prot) : std::basic_istream< char , std::char_traits< char > >(NULL,true),_Filebuffer(NULL),_ShouldClose(false) @@ -253,7 +301,7 @@ bool llofstream::is_open() const return false; } -void llofstream::open(const char* _Filename, /* Flawfinder: ignore */ +void llofstream::open(const std::string& _Filename, /* Flawfinder: ignore */ ios_base::openmode _Mode, int _Prot) { // open a C stream with specified mode @@ -279,7 +327,7 @@ void llofstream::close() } } -llofstream::llofstream(const char *_Filename, +llofstream::llofstream(const std::string& _Filename, std::ios_base::openmode _Mode, int _Prot) : std::basic_ostream >(NULL,true),_Filebuffer(NULL),_ShouldClose(false) diff --git a/linden/indra/llcommon/llfile.h b/linden/indra/llcommon/llfile.h index 189edbf..f3e3af5 100644 --- a/linden/indra/llcommon/llfile.h +++ b/linden/indra/llcommon/llfile.h @@ -50,31 +50,45 @@ typedef FILE LLFILE; #define USE_LLFILESTREAMS 0 #endif +#include #if LL_WINDOWS // windows version of stat function and stat data structure are called _stat typedef struct _stat llstat; #else -#include typedef struct stat llstat; #endif +#ifndef S_ISREG +# define S_ISREG(x) (((x) & S_IFMT) == S_IFREG) +#endif + +#ifndef S_ISDIR +# define S_ISDIR(x) (((x) & S_IFMT) == S_IFDIR) +#endif + +#include "llstring.h" // safe char* -> std::string conversion + class LLFile { public: // All these functions take UTF8 path/filenames. - static LLFILE* fopen(const char* filename,const char* accessmode); /* Flawfinder: ignore */ - static LLFILE* _fsopen(const char* filename,const char* accessmode,int sharingFlag); + static LLFILE* fopen(const std::string& filename,const char* accessmode); /* Flawfinder: ignore */ + static LLFILE* _fsopen(const std::string& filename,const char* accessmode,int sharingFlag); // perms is a permissions mask like 0777 or 0700. In most cases it will // be overridden by the user's umask. It is ignored on Windows. - static int mkdir(const char* filename, int perms = 0700); + static int mkdir(const std::string& filename, int perms = 0700); - static int rmdir(const char* filename); - static int remove(const char* filename); - static int rename(const char* filename,const char* newname); - static int stat(const char* filename,llstat* file_status); - static LLFILE * _Fiopen(const char *filename, std::ios::openmode mode,int); // protection currently unused + static int rmdir(const std::string& filename); + static int remove(const std::string& filename); + static int rename(const std::string& filename,const std::string& newname); + static int stat(const std::string& filename,llstat* file_status); + static bool isdir(const std::string& filename); + static bool isfile(const std::string& filename); + static LLFILE * _Fiopen(const std::string& filename, std::ios::openmode mode,int); // protection currently unused + + static const char * tmpdir(); }; @@ -93,7 +107,7 @@ public: { // construct unopened } - explicit llifstream(const char *_Filename, + explicit llifstream(const std::string& _Filename, ios_base::openmode _Mode = ios_base::in, int _Prot = (int)ios_base::_Openprot); @@ -110,7 +124,7 @@ public: return _Filebuffer; } bool is_open() const; - void open(const char* _Filename, /* Flawfinder: ignore */ + void open(const std::string& _Filename, /* Flawfinder: ignore */ ios_base::openmode _Mode = ios_base::in, int _Prot = (int)ios_base::_Openprot); void close(); @@ -133,7 +147,7 @@ public: { // construct unopened } - explicit llofstream(const char *_Filename, + explicit llofstream(const std::string& _Filename, std::ios_base::openmode _Mode = ios_base::out, int _Prot = (int)std::ios_base::_Openprot); @@ -154,7 +168,7 @@ public: bool is_open() const; - void open(const char *_Filename,ios_base::openmode _Mode = ios_base::out,int _Prot = (int)ios_base::_Openprot); /* Flawfinder: ignore */ + void open(const std::string& _Filename,ios_base::openmode _Mode = ios_base::out,int _Prot = (int)ios_base::_Openprot); /* Flawfinder: ignore */ void close(); @@ -167,8 +181,45 @@ private: #else //Use standard file streams on non windows platforms -#define llifstream std::ifstream -#define llofstream std::ofstream +//#define llifstream std::ifstream +//#define llofstream std::ofstream + +class llifstream : public std::ifstream +{ +public: + llifstream() : std::ifstream() + { + } + + explicit llifstream(const std::string& _Filename, std::_Ios_Openmode _Mode = in) + : std::ifstream(_Filename.c_str(), _Mode) + { + } + void open(const std::string& _Filename, std::_Ios_Openmode _Mode = in) /* Flawfinder: ignore */ + { + std::ifstream::open(_Filename.c_str(), _Mode); + } +}; + + +class llofstream : public std::ofstream +{ +public: + llofstream() : std::ofstream() + { + } + + explicit llofstream(const std::string& _Filename, std::_Ios_Openmode _Mode = out) + : std::ofstream(_Filename.c_str(), _Mode) + { + } + + void open(const std::string& _Filename, std::_Ios_Openmode _Mode = out) /* Flawfinder: ignore */ + { + std::ofstream::open(_Filename.c_str(), _Mode); + } + +}; #endif diff --git a/linden/indra/llcommon/llfixedbuffer.cpp b/linden/indra/llcommon/llfixedbuffer.cpp index 776de0d..a3ebae1 100644 --- a/linden/indra/llcommon/llfixedbuffer.cpp +++ b/linden/indra/llcommon/llfixedbuffer.cpp @@ -54,7 +54,7 @@ void LLFixedBuffer::clear() } -void LLFixedBuffer::addLine(const LLString& utf8line) +void LLFixedBuffer::addLine(const std::string& utf8line) { LLWString wstring = utf8str_to_wstring(utf8line); LLFixedBuffer::addLine(wstring); diff --git a/linden/indra/llcommon/llfixedbuffer.h b/linden/indra/llcommon/llfixedbuffer.h index 06a7f45..1641bee 100644 --- a/linden/indra/llcommon/llfixedbuffer.h +++ b/linden/indra/llcommon/llfixedbuffer.h @@ -52,7 +52,7 @@ public: std::deque mLineLengths; void clear(); // Clear the buffer, and reset it. - virtual void addLine(const LLString& utf8line); + virtual void addLine(const std::string& utf8line); virtual void addLine(const LLWString& line); // Get lines currently in the buffer, up to max_size chars, max_length lines diff --git a/linden/indra/llcommon/llframetimer.cpp b/linden/indra/llcommon/llframetimer.cpp index 96e5014..e4e8a18 100644 --- a/linden/indra/llcommon/llframetimer.cpp +++ b/linden/indra/llcommon/llframetimer.cpp @@ -53,7 +53,6 @@ void LLFrameTimer::updateFrameTime() sTotalTime = total_time; sTotalSeconds = U64_to_F64(sTotalTime) * USEC_TO_SEC_F64; sFrameTime = U64_to_F64(sTotalTime - sStartTotalTime) * USEC_TO_SEC_F64; - sFrameCount++; } void LLFrameTimer::start() diff --git a/linden/indra/llcommon/llframetimer.h b/linden/indra/llcommon/llframetimer.h index 11c4cfc..d13018f 100644 --- a/linden/indra/llcommon/llframetimer.h +++ b/linden/indra/llcommon/llframetimer.h @@ -67,10 +67,14 @@ public: return sTotalSeconds; } - // Call this method once per frame to update the current frame time. + // Call this method once per frame to update the current frame time. This is actually called + // at some other times as well static void updateFrameTime(); - static S32 getFrameCount() { return sFrameCount; } + // Call this method once, and only once, per frame to update the current frame count. + static void updateFrameCount() { sFrameCount++; } + + static U32 getFrameCount() { return sFrameCount; } static F32 getFrameDeltaTimeF32(); diff --git a/linden/indra/llcommon/llhash.h b/linden/indra/llcommon/llhash.h index 716d9df..e259a11 100644 --- a/linden/indra/llcommon/llhash.h +++ b/linden/indra/llcommon/llhash.h @@ -38,7 +38,9 @@ #include #include #elif LL_DARWIN || LL_LINUX -# if GCC_VERSION >= 30400 // gcc 3.4 and up +# if GCC_VERSION >= 40300 // gcc 4.3 and up +# include +# elif GCC_VERSION >= 30400 // gcc 3.4 and up # include # elif __GNUC__ >= 3 # include diff --git a/linden/indra/llcommon/llheartbeat.cpp b/linden/indra/llcommon/llheartbeat.cpp index 13bcd46..b67d3f2 100644 --- a/linden/indra/llcommon/llheartbeat.cpp +++ b/linden/indra/llcommon/llheartbeat.cpp @@ -72,8 +72,13 @@ LLHeartbeat::rawSend() if (mSuppressed) return 0; // Pretend we succeeded. + int result; +#ifndef LL_DARWIN union sigval dummy; - int result = sigqueue(getppid(), LL_HEARTBEAT_SIGNAL, dummy); + result = sigqueue(getppid(), LL_HEARTBEAT_SIGNAL, dummy); +#else + result = kill(getppid(), LL_HEARTBEAT_SIGNAL); +#endif if (result == 0) return 0; // success diff --git a/linden/indra/llcommon/llindraconfigfile.cpp b/linden/indra/llcommon/llindraconfigfile.cpp index 7ef1a9b..60b498d 100644 --- a/linden/indra/llcommon/llindraconfigfile.cpp +++ b/linden/indra/llcommon/llindraconfigfile.cpp @@ -81,7 +81,7 @@ void LLIndraConfigFile::loadFile() LLSD config; { - llifstream file(filename().c_str()); + llifstream file(filename()); if (file.is_open()) { LLSDSerialize::fromXML(config, file); diff --git a/linden/indra/llcommon/llkeythrottle.h b/linden/indra/llcommon/llkeythrottle.h index 8314269..eb1519a 100644 --- a/linden/indra/llcommon/llkeythrottle.h +++ b/linden/indra/llcommon/llkeythrottle.h @@ -55,33 +55,40 @@ class LLKeyThrottleImpl protected: struct Entry { U32 count; - BOOL blocked; + bool blocked; - Entry() : count(0), blocked(FALSE) { } + Entry() : count(0), blocked(false) { } }; typedef std::map EntryMap; - EntryMap * prevMap; - EntryMap * currMap; + EntryMap* prevMap; + EntryMap* currMap; U32 countLimit; // maximum number of keys allowed per interval - U64 interval_usec; - // each map covers this time period - U64 start_usec; + U64 intervalLength; // each map covers this time period (usec or frame number) + U64 startTime; // start of the time period (usec or frame number) // currMap started counting at this time // prevMap covers the previous interval - LLKeyThrottleImpl() : prevMap(0), currMap(0), - countLimit(0), interval_usec(0), - start_usec(0) { }; + LLKeyThrottleImpl() : + prevMap(NULL), + currMap(NULL), + countLimit(0), + intervalLength(1), + startTime(0) + {} static U64 getTime() { return LLFrameTimer::getTotalTime(); } + static U64 getFrame() // Return the current frame number + { + return (U64) LLFrameTimer::getFrameCount(); + } }; @@ -89,17 +96,12 @@ template< class T > class LLKeyThrottle { public: - LLKeyThrottle(U32 limit, F32 interval) + // @param realtime = FALSE for frame-based throttle, TRUE for usec + // real-time throttle + LLKeyThrottle(U32 limit, F32 interval, BOOL realtime = TRUE) : m(* new LLKeyThrottleImpl) { - // limit is the maximum number of keys - // allowed per interval (in seconds) - m.countLimit = limit; - m.interval_usec = (U64)(interval * USEC_PER_SEC); - m.start_usec = LLKeyThrottleImpl::getTime(); - - m.prevMap = new typename LLKeyThrottleImpl::EntryMap; - m.currMap = new typename LLKeyThrottleImpl::EntryMap; + setParameters( limit, interval, realtime ); } ~LLKeyThrottle() @@ -118,18 +120,26 @@ public: // call each time the key wants use State noteAction(const T& id, S32 weight = 1) { - U64 now = LLKeyThrottleImpl::getTime(); + U64 now = 0; + if ( mIsRealtime ) + { + now = LLKeyThrottleImpl::getTime(); + } + else + { + now = LLKeyThrottleImpl::getFrame(); + } - if (now >= (m.start_usec + m.interval_usec)) + if (now >= (m.startTime + m.intervalLength)) { - if (now < (m.start_usec + 2 * m.interval_usec)) + if (now < (m.startTime + 2 * m.intervalLength)) { // prune old data delete m.prevMap; m.prevMap = m.currMap; m.currMap = new typename LLKeyThrottleImpl::EntryMap; - m.start_usec += m.interval_usec; + m.startTime += m.intervalLength; } else { @@ -139,12 +149,12 @@ public: m.prevMap = new typename LLKeyThrottleImpl::EntryMap; m.currMap = new typename LLKeyThrottleImpl::EntryMap; - m.start_usec = now; + m.startTime = now; } } U32 prevCount = 0; - BOOL prevBlocked = FALSE; + bool prevBlocked = false; typename LLKeyThrottleImpl::EntryMap::const_iterator prev = m.prevMap->find(id); if (prev != m.prevMap->end()) @@ -166,7 +176,7 @@ public: // (now) time. // compute current, windowed rate - F64 timeInCurrent = ((F64)(now - m.start_usec) / m.interval_usec); + F64 timeInCurrent = ((F64)(now - m.startTime) / m.intervalLength); F64 averageCount = curr.count + prevCount * (1.0 - timeInCurrent); curr.blocked |= averageCount > m.countLimit; @@ -193,17 +203,17 @@ public: noteAction(id); typename LLKeyThrottleImpl::Entry& curr = (*m.currMap)[id]; curr.count = llmax(m.countLimit, curr.count); - curr.blocked = TRUE; + curr.blocked = true; } - // returns TRUE if key is blocked - BOOL isThrottled(const T& id) const + // returns true if key is blocked + bool isThrottled(const T& id) const { if (m.currMap->empty() && m.prevMap->empty()) { // most of the time we'll fall in here - return FALSE; + return false; } // NOTE, we ignore the case where id is in the map but the map is stale. @@ -221,11 +231,49 @@ public: { return entry->second.blocked; } - return FALSE; + return false; + } + + // Get the throttling parameters + void getParameters( U32 & out_limit, F32 & out_interval, BOOL & out_realtime ) + { + out_limit = m.countLimit; + out_interval = m.intervalLength; + out_realtime = mIsRealtime; + } + + // Set the throttling behavior + void setParameters( U32 limit, F32 interval, BOOL realtime ) + { + // limit is the maximum number of keys + // allowed per interval (in seconds or frames) + mIsRealtime = realtime; + m.countLimit = limit; + if ( mIsRealtime ) + { + m.intervalLength = (U64)(interval * USEC_PER_SEC); + m.startTime = LLKeyThrottleImpl::getTime(); + } + else + { + m.intervalLength = (U64)interval; + m.startTime = LLKeyThrottleImpl::getFrame(); + } + + if ( m.intervalLength == 0 ) + { // Don't allow zero intervals + m.intervalLength = 1; + } + + delete m.prevMap; + m.prevMap = new typename LLKeyThrottleImpl::EntryMap; + delete m.currMap; + m.currMap = new typename LLKeyThrottleImpl::EntryMap; } protected: LLKeyThrottleImpl& m; + BOOL mIsRealtime; // TRUE to be time based (default), FALSE for frame based }; #endif diff --git a/linden/indra/llcommon/llliveappconfig.cpp b/linden/indra/llcommon/llliveappconfig.cpp index ad11987..a11f5b0 100644 --- a/linden/indra/llcommon/llliveappconfig.cpp +++ b/linden/indra/llcommon/llliveappconfig.cpp @@ -51,7 +51,7 @@ void LLLiveAppConfig::loadFile() { llinfos << "LLLiveAppConfig::loadFile(): reading from " << filename() << llendl; - llifstream file(filename().c_str()); + llifstream file(filename()); LLSD config; if (file.is_open()) { diff --git a/linden/indra/llcommon/lllivefile.cpp b/linden/indra/llcommon/lllivefile.cpp index 6e027ef..8ac6bb4 100644 --- a/linden/indra/llcommon/lllivefile.cpp +++ b/linden/indra/llcommon/lllivefile.cpp @@ -93,7 +93,7 @@ bool LLLiveFile::Impl::check() // Stat the file to see if it exists and when it was last modified. llstat stat_data; - int res = LLFile::stat(mFilename.c_str(), &stat_data); + int res = LLFile::stat(mFilename, &stat_data); if (res) { diff --git a/linden/indra/llcommon/lllslconstants.h b/linden/indra/llcommon/lllslconstants.h index 508fb42..24120a2 100644 --- a/linden/indra/llcommon/lllslconstants.h +++ b/linden/indra/llcommon/lllslconstants.h @@ -126,6 +126,9 @@ const S32 LSL_PRIM_SCULPT_TYPE_SPHERE = 1; const S32 LSL_PRIM_SCULPT_TYPE_TORUS = 2; const S32 LSL_PRIM_SCULPT_TYPE_PLANE = 3; const S32 LSL_PRIM_SCULPT_TYPE_CYLINDER = 4; +const S32 LSL_PRIM_SCULPT_TYPE_MASK = 7; +const S32 LSL_PRIM_SCULPT_FLAG_INVERT = 64; +const S32 LSL_PRIM_SCULPT_FLAG_MIRROR = 128; const S32 LSL_ALL_SIDES = -1; const S32 LSL_LINK_ROOT = 1; @@ -181,4 +184,7 @@ const S32 OBJECT_OWNER = 6; const S32 OBJECT_GROUP = 7; const S32 OBJECT_CREATOR = 8; +// llTextBox() magic token string - yes this is a hack. sue me. +const std::string TEXTBOX_MAGIC_TOKEN = "!!llTextBox!!"; + #endif diff --git a/linden/indra/llcommon/llmd5.cpp b/linden/indra/llcommon/llmd5.cpp new file mode 100644 index 0000000..a0ac92f --- /dev/null +++ b/linden/indra/llcommon/llmd5.cpp @@ -0,0 +1,531 @@ +/** + * @file llmd5.cpp + * + * $LicenseInfo:firstyear=2001&license=viewergpl$ + * + * Copyright (c) 2001-2008, Linden Research, Inc. + * + * Second Life Viewer Source Code + * 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://secondlifegrid.net/programs/open_source/licensing/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://secondlifegrid.net/programs/open_source/licensing/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. + * $/LicenseInfo$ + */ + +// llMD5.CC - source code for the C++/object oriented translation and +// modification of MD5. +// +// Adapted to Linden Lab by Frank Filipanits, 6/25/2002 +// Fixed potential memory leak, James Cook, 6/27/2002 + +// Translation and modification (c) 1995 by Mordechai T. Abzug + +// This translation/ modification is provided "as is," without express or +// implied warranty of any kind. + +// The translator/ modifier does not claim (1) that MD5 will do what you think +// it does; (2) that this translation/ modification is accurate; or (3) that +// this software is "merchantible." (Language for this disclaimer partially +// copied from the disclaimer below). + +/* based on: + + MD5C.C - RSA Data Security, Inc., MD5 message-digest algorithm + MDDRIVER.C - test driver for MD2, MD4 and MD5 + + + Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All +rights reserved. + +License to copy and use this software is granted provided that it +is identified as the "RSA Data Security, Inc. MD5 Message-Digest +Algorithm" in all material mentioning or referencing this software +or this function. + +License is also granted to make and use derivative works provided +that such works are identified as "derived from the RSA Data +Security, Inc. MD5 Message-Digest Algorithm" in all material +mentioning or referencing the derived work. + +RSA Data Security, Inc. makes no representations concerning either +the merchantability of this software or the suitability of this +software for any particular purpose. It is provided "as is" +without express or implied warranty of any kind. + +These notices must be retained in any copies of any part of this +documentation and/or software. + + */ + + + + + +#include "linden_common.h" + +#include "llmd5.h" + +#include + +// how many bytes to grab at a time when checking files +const int LLMD5::BLOCK_LEN = 4096; + + +// LLMD5 simple initialization method + +LLMD5::LLMD5() +{ + init(); +} + + + + +// MD5 block update operation. Continues an MD5 message-digest +// operation, processing another message block, and updating the +// context. + +void LLMD5::update (const uint1 *input, const uint4 input_length) { + + uint4 input_index, buffer_index; + uint4 buffer_space; // how much space is left in buffer + + if (finalized){ // so we can't update! + std::cerr << "LLMD5::update: Can't update a finalized digest!" << std::endl; + return; + } + + // Compute number of bytes mod 64 + buffer_index = (unsigned int)((count[0] >> 3) & 0x3F); + + // Update number of bits + if ( (count[0] += ((uint4) input_length << 3))<((uint4) input_length << 3) ) + count[1]++; + + count[1] += ((uint4)input_length >> 29); + + + buffer_space = 64 - buffer_index; // how much space is left in buffer + + // Transform as many times as possible. + if (input_length >= buffer_space) { // ie. we have enough to fill the buffer + // fill the rest of the buffer and transform + memcpy( /* Flawfinder: ignore */ + buffer + buffer_index, + input, + buffer_space); + transform (buffer); + + // now, transform each 64-byte piece of the input, bypassing the buffer + if (input == NULL || input_length == 0){ + std::cerr << "LLMD5::update: Invalid input!" << std::endl; + return; + } + + for (input_index = buffer_space; input_index + 63 < input_length; + input_index += 64) + transform (input+input_index); + + buffer_index = 0; // so we can buffer remaining + } + else + input_index=0; // so we can buffer the whole input + + + // and here we do the buffering: + memcpy(buffer+buffer_index, input+input_index, input_length-input_index); /* Flawfinder: ignore */ +} + + + +// MD5 update for files. +// Like above, except that it works on files (and uses above as a primitive.) + +void LLMD5::update(FILE* file){ + + unsigned char buffer[BLOCK_LEN]; /* Flawfinder: ignore */ + int len; + + while ( (len=(int)fread(buffer, 1, BLOCK_LEN, file)) ) + update(buffer, len); + + fclose (file); + +} + + + + + + +// MD5 update for istreams. +// Like update for files; see above. + +void LLMD5::update(std::istream& stream){ + + unsigned char buffer[BLOCK_LEN]; /* Flawfinder: ignore */ + int len; + + while (stream.good()){ + stream.read( (char*)buffer, BLOCK_LEN); /* Flawfinder: ignore */ // note that return value of read is unusable. + len=stream.gcount(); + update(buffer, len); + } + +} + + + + + +// MD5 finalization. Ends an MD5 message-digest operation, writing the +// the message digest and zeroizing the context. + + +void LLMD5::finalize (){ + + unsigned char bits[8]; /* Flawfinder: ignore */ + unsigned int index, padLen; + static uint1 PADDING[64]={ + 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + }; + + if (finalized){ + std::cerr << "LLMD5::finalize: Already finalized this digest!" << std::endl; + return; + } + + // Save number of bits + encode (bits, count, 8); + + // Pad out to 56 mod 64. + index = (uint4) ((count[0] >> 3) & 0x3f); + padLen = (index < 56) ? (56 - index) : (120 - index); + update (PADDING, padLen); + + // Append length (before padding) + update (bits, 8); + + // Store state in digest + encode (digest, state, 16); + + // Zeroize sensitive information + memset (buffer, 0, sizeof(*buffer)); + + finalized=1; + +} + + + + +LLMD5::LLMD5(FILE *file){ + + init(); // must be called be all constructors + update(file); + finalize (); +} + + + + +LLMD5::LLMD5(std::istream& stream){ + + init(); // must called by all constructors + update (stream); + finalize(); +} + +// Digest a string of the format ("%s:%i" % (s, number)) +LLMD5::LLMD5(const unsigned char *string, const unsigned int number) +{ + const char *colon = ":"; + char tbuf[16]; /* Flawfinder: ignore */ + init(); + update(string, (U32)strlen((const char *) string)); /* Flawfinder: ignore */ + update((const unsigned char *) colon, (U32)strlen(colon)); /* Flawfinder: ignore */ + snprintf(tbuf, sizeof(tbuf), "%i", number); /* Flawfinder: ignore */ + update((const unsigned char *) tbuf, (U32)strlen(tbuf)); /* Flawfinder: ignore */ + finalize(); +} + +// Digest a string +LLMD5::LLMD5(const unsigned char *s) +{ + init(); + update(s, (U32)strlen((const char *) s)); /* Flawfinder: ignore */ + finalize(); +} + +void LLMD5::raw_digest(unsigned char *s) +{ + if (!finalized) + { + std::cerr << "LLMD5::raw_digest: Can't get digest if you haven't "<< + "finalized the digest!" << std::endl; + s[0] = '\0'; + return; + } + + memcpy(s, digest, 16); /* Flawfinder: ignore */ + return; +} + + + +void LLMD5::hex_digest(char *s) +{ + int i; + + if (!finalized) + { + std::cerr << "LLMD5::hex_digest: Can't get digest if you haven't "<< + "finalized the digest!" <> (32-(n)))) + +/* FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4. +Rotation is separate from addition to prevent recomputation. + */ +#define FF(a, b, c, d, x, s, ac) { \ + (a) += F ((b), (c), (d)) + (x) + (U32)(ac); \ + (a) = ROTATE_LEFT ((a), (s)); \ + (a) += (b); \ + } +#define GG(a, b, c, d, x, s, ac) { \ + (a) += G ((b), (c), (d)) + (x) + (U32)(ac); \ + (a) = ROTATE_LEFT ((a), (s)); \ + (a) += (b); \ + } +#define HH(a, b, c, d, x, s, ac) { \ + (a) += H ((b), (c), (d)) + (x) + (U32)(ac); \ + (a) = ROTATE_LEFT ((a), (s)); \ + (a) += (b); \ + } +#define II(a, b, c, d, x, s, ac) { \ + (a) += I ((b), (c), (d)) + (x) + (U32)(ac); \ + (a) = ROTATE_LEFT ((a), (s)); \ + (a) += (b); \ + } + + + +// LLMD5 basic transformation. Transforms state based on block. +void LLMD5::transform (const U8 block[64]){ + + uint4 a = state[0], b = state[1], c = state[2], d = state[3], x[16]; + + decode (x, block, 64); + + assert(!finalized); // not just a user error, since the method is private + + /* Round 1 */ + FF (a, b, c, d, x[ 0], S11, 0xd76aa478); /* 1 */ + FF (d, a, b, c, x[ 1], S12, 0xe8c7b756); /* 2 */ + FF (c, d, a, b, x[ 2], S13, 0x242070db); /* 3 */ + FF (b, c, d, a, x[ 3], S14, 0xc1bdceee); /* 4 */ + FF (a, b, c, d, x[ 4], S11, 0xf57c0faf); /* 5 */ + FF (d, a, b, c, x[ 5], S12, 0x4787c62a); /* 6 */ + FF (c, d, a, b, x[ 6], S13, 0xa8304613); /* 7 */ + FF (b, c, d, a, x[ 7], S14, 0xfd469501); /* 8 */ + FF (a, b, c, d, x[ 8], S11, 0x698098d8); /* 9 */ + FF (d, a, b, c, x[ 9], S12, 0x8b44f7af); /* 10 */ + FF (c, d, a, b, x[10], S13, 0xffff5bb1); /* 11 */ + FF (b, c, d, a, x[11], S14, 0x895cd7be); /* 12 */ + FF (a, b, c, d, x[12], S11, 0x6b901122); /* 13 */ + FF (d, a, b, c, x[13], S12, 0xfd987193); /* 14 */ + FF (c, d, a, b, x[14], S13, 0xa679438e); /* 15 */ + FF (b, c, d, a, x[15], S14, 0x49b40821); /* 16 */ + + /* Round 2 */ + GG (a, b, c, d, x[ 1], S21, 0xf61e2562); /* 17 */ + GG (d, a, b, c, x[ 6], S22, 0xc040b340); /* 18 */ + GG (c, d, a, b, x[11], S23, 0x265e5a51); /* 19 */ + GG (b, c, d, a, x[ 0], S24, 0xe9b6c7aa); /* 20 */ + GG (a, b, c, d, x[ 5], S21, 0xd62f105d); /* 21 */ + GG (d, a, b, c, x[10], S22, 0x2441453); /* 22 */ + GG (c, d, a, b, x[15], S23, 0xd8a1e681); /* 23 */ + GG (b, c, d, a, x[ 4], S24, 0xe7d3fbc8); /* 24 */ + GG (a, b, c, d, x[ 9], S21, 0x21e1cde6); /* 25 */ + GG (d, a, b, c, x[14], S22, 0xc33707d6); /* 26 */ + GG (c, d, a, b, x[ 3], S23, 0xf4d50d87); /* 27 */ + GG (b, c, d, a, x[ 8], S24, 0x455a14ed); /* 28 */ + GG (a, b, c, d, x[13], S21, 0xa9e3e905); /* 29 */ + GG (d, a, b, c, x[ 2], S22, 0xfcefa3f8); /* 30 */ + GG (c, d, a, b, x[ 7], S23, 0x676f02d9); /* 31 */ + GG (b, c, d, a, x[12], S24, 0x8d2a4c8a); /* 32 */ + + /* Round 3 */ + HH (a, b, c, d, x[ 5], S31, 0xfffa3942); /* 33 */ + HH (d, a, b, c, x[ 8], S32, 0x8771f681); /* 34 */ + HH (c, d, a, b, x[11], S33, 0x6d9d6122); /* 35 */ + HH (b, c, d, a, x[14], S34, 0xfde5380c); /* 36 */ + HH (a, b, c, d, x[ 1], S31, 0xa4beea44); /* 37 */ + HH (d, a, b, c, x[ 4], S32, 0x4bdecfa9); /* 38 */ + HH (c, d, a, b, x[ 7], S33, 0xf6bb4b60); /* 39 */ + HH (b, c, d, a, x[10], S34, 0xbebfbc70); /* 40 */ + HH (a, b, c, d, x[13], S31, 0x289b7ec6); /* 41 */ + HH (d, a, b, c, x[ 0], S32, 0xeaa127fa); /* 42 */ + HH (c, d, a, b, x[ 3], S33, 0xd4ef3085); /* 43 */ + HH (b, c, d, a, x[ 6], S34, 0x4881d05); /* 44 */ + HH (a, b, c, d, x[ 9], S31, 0xd9d4d039); /* 45 */ + HH (d, a, b, c, x[12], S32, 0xe6db99e5); /* 46 */ + HH (c, d, a, b, x[15], S33, 0x1fa27cf8); /* 47 */ + HH (b, c, d, a, x[ 2], S34, 0xc4ac5665); /* 48 */ + + /* Round 4 */ + II (a, b, c, d, x[ 0], S41, 0xf4292244); /* 49 */ + II (d, a, b, c, x[ 7], S42, 0x432aff97); /* 50 */ + II (c, d, a, b, x[14], S43, 0xab9423a7); /* 51 */ + II (b, c, d, a, x[ 5], S44, 0xfc93a039); /* 52 */ + II (a, b, c, d, x[12], S41, 0x655b59c3); /* 53 */ + II (d, a, b, c, x[ 3], S42, 0x8f0ccc92); /* 54 */ + II (c, d, a, b, x[10], S43, 0xffeff47d); /* 55 */ + II (b, c, d, a, x[ 1], S44, 0x85845dd1); /* 56 */ + II (a, b, c, d, x[ 8], S41, 0x6fa87e4f); /* 57 */ + II (d, a, b, c, x[15], S42, 0xfe2ce6e0); /* 58 */ + II (c, d, a, b, x[ 6], S43, 0xa3014314); /* 59 */ + II (b, c, d, a, x[13], S44, 0x4e0811a1); /* 60 */ + II (a, b, c, d, x[ 4], S41, 0xf7537e82); /* 61 */ + II (d, a, b, c, x[11], S42, 0xbd3af235); /* 62 */ + II (c, d, a, b, x[ 2], S43, 0x2ad7d2bb); /* 63 */ + II (b, c, d, a, x[ 9], S44, 0xeb86d391); /* 64 */ + + state[0] += a; + state[1] += b; + state[2] += c; + state[3] += d; + + // Zeroize sensitive information. + memset ( (uint1 *) x, 0, sizeof(x)); + +} + + + +// Encodes input (UINT4) into output (unsigned char). Assumes len is +// a multiple of 4. +void LLMD5::encode (uint1 *output, const uint4 *input, const uint4 len) { + + unsigned int i, j; + + for (i = 0, j = 0; j < len; i++, j += 4) { + output[j] = (uint1) (input[i] & 0xff); + output[j+1] = (uint1) ((input[i] >> 8) & 0xff); + output[j+2] = (uint1) ((input[i] >> 16) & 0xff); + output[j+3] = (uint1) ((input[i] >> 24) & 0xff); + } +} + + + + +// Decodes input (unsigned char) into output (UINT4). Assumes len is +// a multiple of 4. +void LLMD5::decode (uint4 *output, const uint1 *input, const uint4 len){ + + unsigned int i, j; + + for (i = 0, j = 0; j < len; i++, j += 4) + output[i] = ((uint4)input[j]) | (((uint4)input[j+1]) << 8) | + (((uint4)input[j+2]) << 16) | (((uint4)input[j+3]) << 24); +} diff --git a/linden/indra/llcommon/llmd5.h b/linden/indra/llcommon/llmd5.h new file mode 100644 index 0000000..6d21b31 --- /dev/null +++ b/linden/indra/llcommon/llmd5.h @@ -0,0 +1,133 @@ +/** + * @file llmd5.h + * + * $LicenseInfo:firstyear=2001&license=viewergpl$ + * + * Copyright (c) 2001-2008, Linden Research, Inc. + * + * Second Life Viewer Source Code + * 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://secondlifegrid.net/programs/open_source/licensing/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://secondlifegrid.net/programs/open_source/licensing/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. + * $/LicenseInfo$ + */ + +#ifndef LL_LLMD5_H +#define LL_LLMD5_H + +// LLMD5.CC - source code for the C++/object oriented translation and +// modification of MD5. + +// Translation and modification (c) 1995 by Mordechai T. Abzug + +// This translation/ modification is provided "as is," without express or +// implied warranty of any kind. + +// The translator/ modifier does not claim (1) that MD5 will do what you think +// it does; (2) that this translation/ modification is accurate; or (3) that +// this software is "merchantible." (Language for this disclaimer partially +// copied from the disclaimer below). + +/* based on: + + MD5.H - header file for MD5C.C + MDDRIVER.C - test driver for MD2, MD4 and MD5 + + Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All +rights reserved. + +License to copy and use this software is granted provided that it +is identified as the "RSA Data Security, Inc. MD5 Message-Digest +Algorithm" in all material mentioning or referencing this software +or this function. + +License is also granted to make and use derivative works provided +that such works are identified as "derived from the RSA Data +Security, Inc. MD5 Message-Digest Algorithm" in all material +mentioning or referencing the derived work. + +RSA Data Security, Inc. makes no representations concerning either +the merchantability of this software or the suitability of this +software for any particular purpose. It is provided "as is" +without express or implied warranty of any kind. + +These notices must be retained in any copies of any part of this +documentation and/or software. + +*/ + +// use for the raw digest output +const int MD5RAW_BYTES = 16; + +// use for outputting hex digests +const int MD5HEX_STR_SIZE = 33; // char hex[MD5HEX_STR_SIZE]; with null +const int MD5HEX_STR_BYTES = 32; // message system fixed size + +class LLMD5 { +// first, some types: + typedef unsigned int uint4; // assumes integer is 4 words long + typedef unsigned short int uint2; // assumes short integer is 2 words long + typedef unsigned char uint1; // assumes char is 1 word long + +// how many bytes to grab at a time when checking files + static const int BLOCK_LEN; + +public: +// methods for controlled operation: + LLMD5 (); // simple initializer + void update (const uint1 *input, const uint4 input_length); + void update (std::istream& stream); + void update (FILE *file); + void finalize (); + +// constructors for special circumstances. All these constructors finalize +// the MD5 context. + LLMD5 (const unsigned char *string); // digest string, finalize + LLMD5 (std::istream& stream); // digest stream, finalize + LLMD5 (FILE *file); // digest file, close, finalize + LLMD5 (const unsigned char *string, const unsigned int number); + +// methods to acquire finalized result + void raw_digest(unsigned char *array); // provide 16-byte array for binary data + void hex_digest(char *string); // provide 33-byte array for ascii-hex string + friend std::ostream& operator<< (std::ostream&, LLMD5 context); + + + +private: + + +// next, the private data: + uint4 state[4]; + uint4 count[2]; // number of *bits*, mod 2^64 + uint1 buffer[64]; // input buffer + uint1 digest[16]; + uint1 finalized; + +// last, the private methods, mostly static: + void init (); // called by all constructors + void transform (const uint1 *buffer); // does the real update work. Note + // that length is implied to be 64. + + static void encode (uint1 *dest, const uint4 *src, const uint4 length); + static void decode (uint4 *dest, const uint1 *src, const uint4 length); + +}; + +#endif // LL_LLMD5_H diff --git a/linden/indra/llcommon/llmemory.cpp b/linden/indra/llcommon/llmemory.cpp index 9b6f893..3fec50f 100644 --- a/linden/indra/llcommon/llmemory.cpp +++ b/linden/indra/llcommon/llmemory.cpp @@ -335,7 +335,6 @@ U64 getCurrentRSS() U64 getCurrentRSS() { U64 residentSize = 0; - task_basic_info_data_t basicInfo; mach_msg_type_number_t basicInfoCount = TASK_BASIC_INFO_COUNT; if (task_info(mach_task_self(), TASK_BASIC_INFO, (task_info_t)&basicInfo, &basicInfoCount) == KERN_SUCCESS) diff --git a/linden/indra/llcommon/llmemtype.h b/linden/indra/llcommon/llmemtype.h index 4a4702b..bd80930 100644 --- a/linden/indra/llcommon/llmemtype.h +++ b/linden/indra/llcommon/llmemtype.h @@ -80,6 +80,7 @@ public: MTYPE_SPACE_PARTITION, MTYPE_PIPELINE, MTYPE_AVATAR, + MTYPE_AVATAR_MESH, MTYPE_PARTICLES, MTYPE_REGIONS, MTYPE_INVENTORY, diff --git a/linden/indra/llcommon/llpreprocessor.h b/linden/indra/llcommon/llpreprocessor.h index e99b103..4809a2f 100644 --- a/linden/indra/llcommon/llpreprocessor.h +++ b/linden/indra/llcommon/llpreprocessor.h @@ -64,6 +64,9 @@ #ifndef LL_MSVC #define LL_MSVC 1 #endif + #if _MSC_VER < 1400 + #define LL_MSVC7 //Visual C++ 2003 or earlier + #endif #endif // Deal with minor differences on Unixy OSes. @@ -104,9 +107,7 @@ using snprintf_hack::snprintf; #if defined(LL_WINDOWS) #define BOOST_REGEX_NO_LIB 1 #define CURL_STATICLIB 1 - -//#define LL_LCD_COMPILE 0 - +#define XML_STATIC #endif // LL_WINDOWS diff --git a/linden/indra/llcommon/llprocessor.cpp b/linden/indra/llcommon/llprocessor.cpp index 1c0f7e0..f132b86 100644 --- a/linden/indra/llcommon/llprocessor.cpp +++ b/linden/indra/llcommon/llprocessor.cpp @@ -2216,12 +2216,12 @@ bool CProcessor::CPUInfoToText(char *strBuffer, unsigned int uiMaxLen) return true; } -// bool CProcessor::WriteInfoTextFile(const char *strFilename) +// bool CProcessor::WriteInfoTextFile(const std::string& strFilename) // =========================================================== // Takes use of CProcessor::CPUInfoToText and saves the string to a // file /////////////////////////////////////////////////////////////////// -bool CProcessor::WriteInfoTextFile(const char *strFilename) +bool CProcessor::WriteInfoTextFile(const std::string& strFilename) { char buf[16384]; /* Flawfinder: ignore */ diff --git a/linden/indra/llcommon/llprocessor.h b/linden/indra/llcommon/llprocessor.h index a188b1a..6abbd96 100644 --- a/linden/indra/llcommon/llprocessor.h +++ b/linden/indra/llcommon/llprocessor.h @@ -188,7 +188,7 @@ public: F64 GetCPUFrequency(unsigned int uiMeasureMSecs); const ProcessorInfo *GetCPUInfo(); bool CPUInfoToText(char *strBuffer, unsigned int uiMaxLen); - bool WriteInfoTextFile(const char *strFilename); + bool WriteInfoTextFile(const std::string& strFilename); }; diff --git a/linden/indra/llcommon/llptrskiplist.h b/linden/indra/llcommon/llptrskiplist.h index f1df27a..ebd297d 100644 --- a/linden/indra/llcommon/llptrskiplist.h +++ b/linden/indra/llcommon/llptrskiplist.h @@ -33,6 +33,7 @@ #define LL_LLPTRSKIPLIST_H #include "llerror.h" +#include "llrand.h" //#include "vmath.h" #include "llrand.h" diff --git a/linden/indra/llcommon/llrand.cpp b/linden/indra/llcommon/llrand.cpp new file mode 100644 index 0000000..bc8c867 --- /dev/null +++ b/linden/indra/llcommon/llrand.cpp @@ -0,0 +1,176 @@ +/** + * @file llrand.cpp + * @brief Global random generator. + * + * $LicenseInfo:firstyear=2000&license=viewergpl$ + * + * Copyright (c) 2000-2008, Linden Research, Inc. + * + * Second Life Viewer Source Code + * 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://secondlifegrid.net/programs/open_source/licensing/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://secondlifegrid.net/programs/open_source/licensing/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. + * $/LicenseInfo$ + */ + +#include "linden_common.h" + +#include "llrand.h" +#include "lluuid.h" + +/** + * Through analysis, we have decided that we want to take values which + * are close enough to 1.0 to map back to 0.0. We came to this + * conclusion from noting that: + * + * [0.0, 1.0) + * + * when scaled to the integer set: + * + * [0, 4) + * + * there is some value close enough to 1.0 that when multiplying by 4, + * gets truncated to 4. Therefore: + * + * [0,1-eps] => 0 + * [1,2-eps] => 1 + * [2,3-eps] => 2 + * [3,4-eps] => 3 + * + * So 0 gets uneven distribution if we simply clamp. The actual + * clamp utilized in this file is to map values out of range back + * to 0 to restore uniform distribution. + * + * Also, for clamping floats when asking for a distribution from + * [0.0,g) we have determined that for values of g < 0.5, then + * rand*g=g, which is not the desired result. As above, we clamp to 0 + * to restore uniform distribution. + */ + +// *NOTE: The system rand implementation is probably not correct. +#define LL_USE_SYSTEM_RAND 0 + +#if LL_USE_SYSTEM_RAND +#include +#endif + +#if LL_USE_SYSTEM_RAND +class LLSeedRand +{ +public: + LLSeedRand() + { +#if LL_WINDOWS + srand(LLUUID::getRandomSeed()); +#else + srand48(LLUUID::getRandomSeed()); +#endif + } +}; +static LLSeedRand sRandomSeeder; +inline F64 ll_internal_random_double() +{ +#if LL_WINDOWS + return (F64)rand() / (F64)RAND_MAX; +#else + return drand48(); +#endif +} +inline F32 ll_internal_random_float() +{ +#if LL_WINDOWS + return (F32)rand() / (F32)RAND_MAX; +#else + return (F32)drand48(); +#endif +} +#else +static LLRandLagFib2281 gRandomGenerator(LLUUID::getRandomSeed()); +inline F64 ll_internal_random_double() +{ + // *HACK: Through experimentation, we have found that dual core + // CPUs (or at least multi-threaded processes) seem to + // occasionally give an obviously incorrect random number -- like + // 5^15 or something. Sooooo, clamp it as described above. + F64 rv = gRandomGenerator(); + if(!((rv >= 0.0) && (rv < 1.0))) return fmod(rv, 1.0); + return rv; +} + +inline F32 ll_internal_random_float() +{ + // The clamping rules are described above. + F32 rv = (F32)gRandomGenerator(); + if(!((rv >= 0.0f) && (rv < 1.0f))) return fmod(rv, 1.f); + return rv; +} +#endif + +S32 ll_rand() +{ + return ll_rand(RAND_MAX); +} + +S32 ll_rand(S32 val) +{ + // The clamping rules are described above. + S32 rv = (S32)(ll_internal_random_double() * val); + if(rv == val) return 0; + return rv; +} + +F32 ll_frand() +{ + return ll_internal_random_float(); +} + +F32 ll_frand(F32 val) +{ + // The clamping rules are described above. + F32 rv = ll_internal_random_float() * val; + if(val > 0) + { + if(rv >= val) return 0.0f; + } + else + { + if(rv <= val) return 0.0f; + } + return rv; +} + +F64 ll_drand() +{ + return ll_internal_random_double(); +} + +F64 ll_drand(F64 val) +{ + // The clamping rules are described above. + F64 rv = ll_internal_random_double() * val; + if(val > 0) + { + if(rv >= val) return 0.0; + } + else + { + if(rv <= val) return 0.0; + } + return rv; +} diff --git a/linden/indra/llcommon/llrand.h b/linden/indra/llcommon/llrand.h new file mode 100644 index 0000000..0a28213 --- /dev/null +++ b/linden/indra/llcommon/llrand.h @@ -0,0 +1,132 @@ +/** + * @file llrand.h + * @brief Information, functions, and typedefs for randomness. + * + * $LicenseInfo:firstyear=2000&license=viewergpl$ + * + * Copyright (c) 2000-2008, Linden Research, Inc. + * + * Second Life Viewer Source Code + * 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://secondlifegrid.net/programs/open_source/licensing/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://secondlifegrid.net/programs/open_source/licensing/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. + * $/LicenseInfo$ + */ + +#ifndef LL_LLRAND_H +#define LL_LLRAND_H + +#include +#include + +/** + * 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 + */ + +/** + *@brief Generate a float from [0, RAND_MAX). + */ +S32 ll_rand(); + +/** + *@brief Generate a float from [0, val) or (val, 0]. + */ +S32 ll_rand(S32 val); + +/** + *@brief Generate a float from [0, 1.0). + */ +F32 ll_frand(); + +/** + *@brief Generate a float from [0, val) or (val, 0]. + */ +F32 ll_frand(F32 val); + +/** + *@brief Generate a double from [0, 1.0). + */ +F64 ll_drand(); + +/** + *@brief Generate a double from [0, val) or (val, 0]. + */ +F64 ll_drand(F64 val); + +/** + * @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(); + */ + +typedef boost::lagged_fibonacci607 LLRandLagFib607; +/**< + * lengh of cycle: 2^32,000 + * memory: 607*sizeof(double) (about 5K) + */ + +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/llcommon/llsd.cpp b/linden/indra/llcommon/llsd.cpp index fa0531b..2c32184 100644 --- a/linden/indra/llcommon/llsd.cpp +++ b/linden/indra/llcommon/llsd.cpp @@ -42,10 +42,11 @@ #endif #ifdef NAME_UNNAMED_NAMESPACE -namespace LLSDUnnamedNamespace { +namespace LLSDUnnamedNamespace #else -namespace { +namespace #endif +{ class ImplMap; class ImplArray; } @@ -127,10 +128,10 @@ public: virtual void erase(Integer) { } virtual const LLSD& ref(Integer) const { return undef(); } - virtual LLSD::map_const_iterator beginMap() const { return LLSD::map_const_iterator(); } - virtual LLSD::map_const_iterator endMap() const { return LLSD::map_const_iterator(); } - virtual LLSD::array_const_iterator beginArray() const { return LLSD::array_const_iterator(); } - virtual LLSD::array_const_iterator endArray() const { return LLSD::array_const_iterator(); } + virtual LLSD::map_const_iterator beginMap() const { return endMap(); } + virtual LLSD::map_const_iterator endMap() const { static const std::map empty; return empty.end(); } + virtual LLSD::array_const_iterator beginArray() const { return endArray(); } + virtual LLSD::array_const_iterator endArray() const { static const std::vector empty; return empty.end(); } static const LLSD& undef(); @@ -139,10 +140,11 @@ public: }; #ifdef NAME_UNNAMED_NAMESPACE -namespace LLSDUnnamedNamespace { +namespace LLSDUnnamedNamespace #else -namespace { +namespace #endif +{ template class ImplBase : public LLSD::Impl ///< This class handles most of the work for a subclass of Impl @@ -185,6 +187,11 @@ namespace { }; LLSD::String ImplBoolean::asString() const + // *NOTE: The reason that false is not converted to "false" is + // because that would break roundtripping, + // e.g. LLSD(false).asString().asBoolean(). There are many + // reasons for wanting LLSD("false").asBoolean() == true, such + // as "everything else seems to work that way". { return mValue ? "true" : ""; } @@ -650,10 +657,11 @@ U32 LLSD::Impl::sOutstandingCount = 0; #ifdef NAME_UNNAMED_NAMESPACE -namespace LLSDUnnamedNamespace { +namespace LLSDUnnamedNamespace #else -namespace { +namespace #endif +{ inline LLSD::Impl& safe(LLSD::Impl* impl) { return LLSD::Impl::safe(impl); } diff --git a/linden/indra/llcommon/llsd.h b/linden/indra/llcommon/llsd.h index 3f53735..98a6692 100644 --- a/linden/indra/llcommon/llsd.h +++ b/linden/indra/llcommon/llsd.h @@ -40,7 +40,7 @@ #include "lldate.h" #include "lluri.h" -#include "../llmath/lluuid.h" +#include "lluuid.h" /** LLSD provides a flexible data system similar to the data facilities of @@ -394,7 +394,7 @@ std::ostream& operator<<(std::ostream& s, const LLSD& llsd); - as UTF8 encoded strings (making not like UUID<->String) - as Base64 or Base96 encoded (making like UUID<->String) - Conversions to std::string and LLUUID do not result in easy assignment - to std::string, LLString or LLUUID due to non-unique conversion paths + to std::string, std::string or LLUUID due to non-unique conversion paths */ #endif // LL_LLSD_NEW_H diff --git a/linden/indra/llcommon/llsdserialize.cpp b/linden/indra/llcommon/llsdserialize.cpp index a556d5d..d42842d 100644 --- a/linden/indra/llcommon/llsdserialize.cpp +++ b/linden/indra/llcommon/llsdserialize.cpp @@ -37,7 +37,7 @@ #include "llstreamtools.h" // for fullread #include -#include "apr-1/apr_base64.h" +#include "apr_base64.h" #if !LL_WINDOWS #include // htonl & ntohl @@ -146,12 +146,15 @@ bool LLSDSerialize::deserialize(LLSD& sd, std::istream& str, S32 max_bytes) * Create the parser as appropriate */ if (legacy_no_header) - { - LLSDXMLParser* x = new LLSDXMLParser; - x->parsePart(hdr_buf, inbuf); - p = x; + { // Create a LLSD XML parser, and parse the first chunk read above + LLSDXMLParser* x = new LLSDXMLParser(); + x->parsePart(hdr_buf, inbuf); // Parse the first part that was already read + x->parseLines(str, sd); // Parse the rest of it + delete x; + return true; } - else if (header == LLSD_BINARY_HEADER) + + if (header == LLSD_BINARY_HEADER) { p = new LLSDBinaryParser; } @@ -300,7 +303,8 @@ static const char BINARY_FALSE_SERIAL = '0'; /** * LLSDParser */ -LLSDParser::LLSDParser() : mCheckLimits(true), mMaxBytesLeft(0) +LLSDParser::LLSDParser() + : mCheckLimits(true), mMaxBytesLeft(0), mParseLines(false) { } @@ -316,6 +320,15 @@ S32 LLSDParser::parse(std::istream& istr, LLSD& data, S32 max_bytes) } +// Parse using routine to get() lines, faster than parse() +S32 LLSDParser::parseLines(std::istream& istr, LLSD& data) +{ + mCheckLimits = false; + mParseLines = false; // was true, Emergency fix DEV-17785 parsing newline failure + return doParse(istr, data); +} + + int LLSDParser::get(std::istream& istr) const { if(mCheckLimits) --mMaxBytesLeft; @@ -1217,8 +1230,7 @@ void LLSDFormatter::realFormat(const std::string& format) void LLSDFormatter::formatReal(LLSD::Real real, std::ostream& ostr) const { - char buffer[MAX_STRING]; /* Flawfinder: ignore */ - snprintf(buffer, MAX_STRING, mRealFormat.c_str(), real); /* Flawfinder: ignore */ + std::string buffer = llformat(mRealFormat.c_str(), real); ostr << buffer; } diff --git a/linden/indra/llcommon/llsdserialize.h b/linden/indra/llcommon/llsdserialize.h index f5282b4..94ad824 100644 --- a/linden/indra/llcommon/llsdserialize.h +++ b/linden/indra/llcommon/llsdserialize.h @@ -83,6 +83,18 @@ public: */ S32 parse(std::istream& istr, LLSD& data, S32 max_bytes); + /** Like parse(), but uses a different call (istream.getline()) to read by lines + * This API is better suited for XML, where the parse cannot tell + * where the document actually ends. + */ + S32 parseLines(std::istream& istr, LLSD& data); + + /** + * @brief Resets the parser so parse() or parseLines() can be called again for another chunk. + */ + void reset() { doReset(); }; + + protected: /** * @brief Pure virtual base for doing the parse. @@ -100,6 +112,11 @@ protected: */ virtual S32 doParse(std::istream& istr, LLSD& data) const = 0; + /** + * @brief Virtual default function for resetting the parser + */ + virtual void doReset() {}; + /* @name Simple istream helper methods * * These helper methods exist to help correctly use the @@ -191,6 +208,11 @@ protected: * @brief The maximum number of bytes left to be parsed. */ mutable S32 mMaxBytesLeft; + + /** + * @brief Use line-based reading to get text + */ + bool mParseLines; }; /** @@ -301,6 +323,11 @@ protected: */ virtual S32 doParse(std::istream& istr, LLSD& data) const; + /** + * @brief Virtual default function for resetting the parser + */ + virtual void doReset(); + private: class Impl; Impl& impl; @@ -674,7 +701,7 @@ public: U32 options = LLSDFormatter::OPTIONS_NONE); /** - * @breif Examine a stream, and parse 1 sd object out based on contents. + * @brief Examine a stream, and parse 1 sd object out based on contents. * * @param sd [out] The data found on the stream * @param str The incoming stream @@ -718,13 +745,23 @@ public: return f->format(sd, str, LLSDFormatter::OPTIONS_PRETTY); } - static S32 fromXML(LLSD& sd, std::istream& str) + static S32 fromXMLEmbedded(LLSD& sd, std::istream& str) { // no need for max_bytes since xml formatting is not // subvertable by bad sizes. LLPointer p = new LLSDXMLParser; return p->parse(str, sd, LLSDSerialize::SIZE_UNLIMITED); } + static S32 fromXMLDocument(LLSD& sd, std::istream& str) + { + LLPointer p = new LLSDXMLParser(); + return p->parseLines(str, sd); + } + static S32 fromXML(LLSD& sd, std::istream& str) + { + return fromXMLEmbedded(sd, str); +// return fromXMLDocument(sd, str); + } /* * Binary Methods diff --git a/linden/indra/llcommon/llsdserialize_xml.cpp b/linden/indra/llcommon/llsdserialize_xml.cpp index 7de0c35..690ab67 100644 --- a/linden/indra/llcommon/llsdserialize_xml.cpp +++ b/linden/indra/llcommon/llsdserialize_xml.cpp @@ -35,7 +35,7 @@ #include #include -#include "apr-1/apr_base64.h" +#include "apr_base64.h" extern "C" { @@ -63,7 +63,7 @@ S32 LLSDXMLFormatter::format(const LLSD& data, std::ostream& ostr, U32 options) { std::streamsize old_precision = ostr.precision(25); - LLString post = ""; + std::string post; if (options & LLSDFormatter::OPTIONS_PRETTY) { post = "\n"; @@ -79,8 +79,8 @@ S32 LLSDXMLFormatter::format(const LLSD& data, std::ostream& ostr, U32 options) S32 LLSDXMLFormatter::format_impl(const LLSD& data, std::ostream& ostr, U32 options, U32 level) const { S32 format_count = 1; - LLString pre = ""; - LLString post = ""; + std::string pre; + std::string post; if (options & LLSDFormatter::OPTIONS_PRETTY) { @@ -262,12 +262,13 @@ public: ~Impl(); S32 parse(std::istream& input, LLSD& data); + S32 parseLines(std::istream& input, LLSD& data); void parsePart(const char *buf, int len); -private: void reset(); - + +private: void startElementHandler(const XML_Char* name, const XML_Char** attributes); void endElementHandler(const XML_Char* name); void characterDataHandler(const XML_Char* data, int length); @@ -307,8 +308,8 @@ private: LLSD mResult; S32 mParseCount; - bool mInLLSDElement; - bool mGracefullStop; + bool mInLLSDElement; // true if we're on LLSD + bool mGracefullStop; // true if we found the LLSDRefStack; LLSDRefStack mStack; @@ -319,15 +320,12 @@ private: std::string mCurrentKey; std::ostringstream mCurrentContent; - - bool mPreStaged; }; LLSDXMLParser::Impl::Impl() { mParser = XML_ParserCreate(NULL); - mPreStaged = false; reset(); } @@ -336,7 +334,7 @@ LLSDXMLParser::Impl::~Impl() XML_ParserFree(mParser); } -bool is_eol(char c) +inline bool is_eol(char c) { return (c == '\n' || c == '\r'); } @@ -356,9 +354,9 @@ static unsigned get_till_eol(std::istream& input, char *buf, unsigned bufsize) unsigned count = 0; while (count < bufsize && input.good()) { - input.get(buf[count]); - count++; - if (is_eol(buf[count - 1])) + char c = input.get(); + buf[count++] = c; + if (is_eol(c)) break; } return count; @@ -366,7 +364,6 @@ static unsigned get_till_eol(std::istream& input, char *buf, unsigned bufsize) S32 LLSDXMLParser::Impl::parse(std::istream& input, LLSD& data) { - reset(); XML_Status status; static const int BUFFER_SIZE = 1024; @@ -420,14 +417,86 @@ S32 LLSDXMLParser::Impl::parse(std::istream& input, LLSD& data) return mParseCount; } -void LLSDXMLParser::Impl::reset() + +S32 LLSDXMLParser::Impl::parseLines(std::istream& input, LLSD& data) { - if (mPreStaged) + XML_Status status = XML_STATUS_OK; + + data = LLSD(); + + static const int BUFFER_SIZE = 1024; + + //static char last_buffer[ BUFFER_SIZE ]; + //std::streamsize last_num_read; + + // Must get rid of any leading \n, otherwise the stream gets into an error/eof state + clear_eol(input); + + while( !mGracefullStop + && input.good() + && !input.eof()) { - mPreStaged = false; - return; + void* buffer = XML_GetBuffer(mParser, BUFFER_SIZE); + /* + * If we happened to end our last buffer right at the end of the llsd, but the + * stream is still going we will get a null buffer here. Check for mGracefullStop. + * -- I don't think this is actually true - zero 2008-05-09 + */ + if (!buffer) + { + break; + } + + // Get one line + input.getline((char*)buffer, BUFFER_SIZE); + std::streamsize num_read = input.gcount(); + + //memcpy( last_buffer, buffer, num_read ); + //last_num_read = num_read; + + if ( num_read > 0 ) + { + if (!input.good() ) + { // Clear state that's set when we run out of buffer + input.clear(); + } + + // Don't parse the NULL at the end which might be added if \n was absorbed by getline() + char * text = (char *) buffer; + if ( text[num_read - 1] == 0) + { + num_read--; + } + } + + status = XML_ParseBuffer(mParser, num_read, false); + if (status == XML_STATUS_ERROR) + { + break; + } } + if (status != XML_STATUS_ERROR + && !mGracefullStop) + { // Parse last bit + status = XML_ParseBuffer(mParser, 0, true); + } + + if (status == XML_STATUS_ERROR + && !mGracefullStop) + { + llinfos << "LLSDXMLParser::Impl::parseLines: XML_STATUS_ERROR" << llendl; + return LLSDParser::PARSE_FAILURE; + } + + clear_eol(input); + data = mResult; + return mParseCount; +} + + +void LLSDXMLParser::Impl::reset() +{ mResult.clear(); mParseCount = 0; @@ -476,14 +545,15 @@ LLSDXMLParser::Impl::findAttribute(const XML_Char* name, const XML_Char** pairs) void LLSDXMLParser::Impl::parsePart(const char* buf, int len) { - void * buffer = XML_GetBuffer(mParser, len); - if (buffer != NULL && buf != NULL) + if ( buf != NULL + && len > 0 ) { - memcpy(buffer, buf, len); + XML_Status status = XML_Parse(mParser, buf, len, false); + if (status == XML_STATUS_ERROR) + { + llinfos << "Unexpected XML parsing error at start" << llendl; + } } - XML_ParseBuffer(mParser, len, false); - - mPreStaged = true; } void LLSDXMLParser::Impl::startElementHandler(const XML_Char* name, const XML_Char** attributes) @@ -738,5 +808,18 @@ void LLSDXMLParser::parsePart(const char *buf, int len) // virtual S32 LLSDXMLParser::doParse(std::istream& input, LLSD& data) const { - return impl.parse(input, data); +// Remove code - emergency fix DEV-17785 parsing newline failure +// if (mParseLines) +// { + // Use line-based reading (faster code) +// return impl.parseLines(input, data); +// } + + return impl.parse(input, data); +} + +// virtual +void LLSDXMLParser::doReset() +{ + impl.reset(); } diff --git a/linden/indra/llcommon/llsdutil.cpp b/linden/indra/llcommon/llsdutil.cpp index d1ccce0..b619fb6 100644 --- a/linden/indra/llcommon/llsdutil.cpp +++ b/linden/indra/llcommon/llsdutil.cpp @@ -46,124 +46,6 @@ #include "llsdserialize.h" -// vector3 -LLSD ll_sd_from_vector3(const LLVector3& vec) -{ - LLSD rv; - rv.append((F64)vec.mV[VX]); - rv.append((F64)vec.mV[VY]); - rv.append((F64)vec.mV[VZ]); - return rv; -} - -LLVector3 ll_vector3_from_sd(const LLSD& sd, S32 start_index) -{ - LLVector3 rv; - rv.mV[VX] = (F32)sd[start_index].asReal(); - rv.mV[VY] = (F32)sd[++start_index].asReal(); - rv.mV[VZ] = (F32)sd[++start_index].asReal(); - return rv; -} - -// vector4 -LLSD ll_sd_from_vector4(const LLVector4& vec) -{ - LLSD rv; - rv.append((F64)vec.mV[VX]); - rv.append((F64)vec.mV[VY]); - rv.append((F64)vec.mV[VZ]); - rv.append((F64)vec.mV[VW]); - return rv; -} - -LLVector4 ll_vector4_from_sd(const LLSD& sd, S32 start_index) -{ - LLVector4 rv; - rv.mV[VX] = (F32)sd[start_index].asReal(); - rv.mV[VY] = (F32)sd[++start_index].asReal(); - rv.mV[VZ] = (F32)sd[++start_index].asReal(); - rv.mV[VW] = (F32)sd[++start_index].asReal(); - return rv; -} - -// vector3d -LLSD ll_sd_from_vector3d(const LLVector3d& vec) -{ - LLSD rv; - rv.append(vec.mdV[VX]); - rv.append(vec.mdV[VY]); - rv.append(vec.mdV[VZ]); - return rv; -} - -LLVector3d ll_vector3d_from_sd(const LLSD& sd, S32 start_index) -{ - LLVector3d rv; - rv.mdV[VX] = sd[start_index].asReal(); - rv.mdV[VY] = sd[++start_index].asReal(); - rv.mdV[VZ] = sd[++start_index].asReal(); - return rv; -} - -//vector2 -LLSD ll_sd_from_vector2(const LLVector2& vec) -{ - LLSD rv; - rv.append((F64)vec.mV[VX]); - rv.append((F64)vec.mV[VY]); - return rv; -} - -LLVector2 ll_vector2_from_sd(const LLSD& sd) -{ - LLVector2 rv; - rv.mV[VX] = (F32)sd[0].asReal(); - rv.mV[VY] = (F32)sd[1].asReal(); - return rv; -} - -// Quaternion -LLSD ll_sd_from_quaternion(const LLQuaternion& quat) -{ - LLSD rv; - rv.append((F64)quat.mQ[VX]); - rv.append((F64)quat.mQ[VY]); - rv.append((F64)quat.mQ[VZ]); - rv.append((F64)quat.mQ[VW]); - return rv; -} - -LLQuaternion ll_quaternion_from_sd(const LLSD& sd) -{ - LLQuaternion quat; - quat.mQ[VX] = (F32)sd[0].asReal(); - quat.mQ[VY] = (F32)sd[1].asReal(); - quat.mQ[VZ] = (F32)sd[2].asReal(); - quat.mQ[VW] = (F32)sd[3].asReal(); - return quat; -} - -// color4 -LLSD ll_sd_from_color4(const LLColor4& c) -{ - LLSD rv; - rv.append(c.mV[0]); - rv.append(c.mV[1]); - rv.append(c.mV[2]); - rv.append(c.mV[3]); - return rv; -} - -LLColor4 ll_color4_from_sd(const LLSD& sd) -{ - LLColor4 c; - c.mV[0] = (F32)sd[0].asReal(); - c.mV[1] = (F32)sd[1].asReal(); - c.mV[2] = (F32)sd[2].asReal(); - c.mV[3] = (F32)sd[3].asReal(); - return c; -} - // U32 LLSD ll_sd_from_U32(const U32 val) { @@ -263,12 +145,11 @@ LLSD ll_binary_from_string(const LLSD& sd) { std::vector binary_value; - LLString string_value = sd.asString(); - const char* string_p = string_value.c_str(); - while (*string_p) + std::string string_value = sd.asString(); + for (std::string::iterator iter = string_value.begin(); + iter != string_value.end(); ++iter) { - binary_value.push_back(*string_p); - string_p++; + binary_value.push_back(*iter); } binary_value.push_back('\0'); @@ -303,8 +184,9 @@ char* ll_pretty_print_sd(const LLSD& sd) } //compares the structure of an LLSD to a template LLSD and stores the -//"valid" values in a 3rd LLSD. Default values are stored in the template -// +//"valid" values in a 3rd LLSD. Default values pulled from the template +//if the tested LLSD does not contain the key/value pair. +//Excess values in the test LLSD are ignored in the resultant_llsd. //If the llsd to test has a specific key to a map and the values //are not of the same type, false is returned or if the LLSDs are not //of the same value. Ordering of arrays matters diff --git a/linden/indra/llcommon/llsdutil.h b/linden/indra/llcommon/llsdutil.h index ae6d694..905c031 100644 --- a/linden/indra/llcommon/llsdutil.h +++ b/linden/indra/llcommon/llsdutil.h @@ -35,35 +35,34 @@ #define LL_LLSDUTIL_H #include "llsd.h" -#include "../llmath/v3math.h" -#include "../llmath/v4math.h" -#include "../llmath/v3dmath.h" -#include "../llmath/v2math.h" -#include "../llmath/llquaternion.h" -#include "../llmath/v4color.h" -#include "../llprimitive/lltextureanim.h" // vector3 +class LLVector3; LLSD ll_sd_from_vector3(const LLVector3& vec); LLVector3 ll_vector3_from_sd(const LLSD& sd, S32 start_index = 0); // vector4 +class LLVector4; LLSD ll_sd_from_vector4(const LLVector4& vec); LLVector4 ll_vector4_from_sd(const LLSD& sd, S32 start_index = 0); // vector3d (double) +class LLVector3d; LLSD ll_sd_from_vector3d(const LLVector3d& vec); LLVector3d ll_vector3d_from_sd(const LLSD& sd, S32 start_index = 0); // vector2 +class LLVector2; LLSD ll_sd_from_vector2(const LLVector2& vec); LLVector2 ll_vector2_from_sd(const LLSD& sd); // Quaternion +class LLQuaternion; LLSD ll_sd_from_quaternion(const LLQuaternion& quat); LLQuaternion ll_quaternion_from_sd(const LLSD& sd); // color4 +class LLColor4; LLSD ll_sd_from_color4(const LLColor4& c); LLColor4 ll_color4_from_sd(const LLSD& sd); @@ -93,9 +92,11 @@ char* ll_pretty_print_sd(const LLSD& sd); //compares the structure of an LLSD to a template LLSD and stores the //"valid" values in a 3rd LLSD. Default values -//are pulled from the template. Ordering of arrays matters +//are pulled from the template. Extra keys/values in the test +//are ignored in the resultant LLSD. Ordering of arrays matters //Returns false if the test is of same type but values differ in type //Otherwise, returns true + BOOL compare_llsd_with_template( const LLSD& llsd_to_test, const LLSD& template_llsd, diff --git a/linden/indra/llcommon/llsecondlifeurls.cpp b/linden/indra/llcommon/llsecondlifeurls.cpp index 46b8cde..ee478fe 100644 --- a/linden/indra/llcommon/llsecondlifeurls.cpp +++ b/linden/indra/llcommon/llsecondlifeurls.cpp @@ -32,56 +32,56 @@ #include "linden_common.h" #include "llsecondlifeurls.h" -const char CREATE_ACCOUNT_URL[] = - "http://secondlife.com/registration/"; +const std::string CREATE_ACCOUNT_URL ( + "http://secondlife.com/registration/"); -const char MANAGE_ACCOUNT[] = - "http://secondlife.com/account/"; +const std::string MANAGE_ACCOUNT ( + "http://secondlife.com/account/"); -const char AUCTION_URL[] = - "http://secondlife.com/auctions/auction-detail.php?id="; +const std::string AUCTION_URL ( + "http://secondlife.com/auctions/auction-detail.php?id="); -const char EVENTS_URL[] = - "http://secondlife.com/events/"; +const std::string EVENTS_URL ( + "http://secondlife.com/events/"); -const char TIER_UP_URL[] = - "http://secondlife.com/app/landtier"; +const std::string TIER_UP_URL ( + "http://secondlife.com/app/landtier"); -const char LAND_URL[] = - "http://secondlife.com/app/landtier"; +const std::string LAND_URL ( + "http://secondlife.com/app/landtier"); -const char UPGRADE_TO_PREMIUM_URL[] = - "http://secondlife.com/app/upgrade/"; +const std::string UPGRADE_TO_PREMIUM_URL ( + "http://secondlife.com/app/upgrade/"); -const char DIRECTX_9_URL[] = - "http://secondlife.com/support/"; +const std::string DIRECTX_9_URL ( + "http://secondlife.com/support/"); -const char AMD_AGP_URL[] = - "http://secondlife.com/support/"; +const std::string AMD_AGP_URL ( + "http://secondlife.com/support/"); -const char VIA_URL[] = - "http://secondlife.com/support/"; +const std::string VIA_URL ( + "http://secondlife.com/support/"); -const char SUPPORT_URL[] = - "http://secondlife.com/support/"; +const std::string SUPPORT_URL ( + "http://secondlife.com/support/"); -const char INTEL_CHIPSET_URL[] = - "http://secondlife.com/support/"; +const std::string INTEL_CHIPSET_URL ( + "http://secondlife.com/support/"); -const char SIS_CHIPSET_URL[] = - "http://secondlife.com/support/"; +const std::string SIS_CHIPSET_URL ( + "http://secondlife.com/support/"); -const char BLOGS_URL[] = - "http://blog.secondlife.com/"; +const std::string BLOGS_URL ( + "http://blog.secondlife.com/"); -const char BUY_CURRENCY_URL[] = - "http://secondlife.com/app/currency/"; +const std::string BUY_CURRENCY_URL ( + "http://secondlife.com/app/currency/"); -const char LSL_DOC_URL[] = - "http://secondlife.com/app/lsldoc/"; +const std::string LSL_DOC_URL ( + "http://secondlife.com/app/lsldoc/"); -const char SL_KB_URL[] = - "http://secondlife.com/knowledgebase/"; - -const char RELEASE_NOTES[] = "releasenotes.txt"; +const std::string SL_KB_URL ( + "http://secondlife.com/knowledgebase/"); +const std::string RELEASE_NOTES_BASE_URL ( + "http://secondlife.com/app/releasenotes/"); diff --git a/linden/indra/llcommon/llsecondlifeurls.h b/linden/indra/llcommon/llsecondlifeurls.h index 3fe086a..f612d5e 100644 --- a/linden/indra/llcommon/llsecondlifeurls.h +++ b/linden/indra/llcommon/llsecondlifeurls.h @@ -33,46 +33,46 @@ #define LL_LLSECONDLIFEURLS_H // Account registration web page -extern const char CREATE_ACCOUNT_URL[]; +extern const std::string CREATE_ACCOUNT_URL; // Manage Account -extern const char MANAGE_ACCOUNT[]; +extern const std::string MANAGE_ACCOUNT; -extern const char AUCTION_URL[]; +extern const std::string AUCTION_URL; -extern const char EVENTS_URL[]; +extern const std::string EVENTS_URL; // Tier up to a new land level. -extern const char TIER_UP_URL[]; +extern const std::string TIER_UP_URL; // Tier up to a new land level. -extern const char LAND_URL[]; +extern const std::string LAND_URL; // Upgrade from basic membership to premium membership -extern const char UPGRADE_TO_PREMIUM_URL[]; +extern const std::string UPGRADE_TO_PREMIUM_URL; // How to get DirectX 9 -extern const char DIRECTX_9_URL[]; +extern const std::string DIRECTX_9_URL; // Out of date VIA chipset -extern const char VIA_URL[]; +extern const std::string VIA_URL; // Support URL -extern const char SUPPORT_URL[]; +extern const std::string SUPPORT_URL; // Linden Blogs page -extern const char BLOGS_URL[]; +extern const std::string BLOGS_URL; // Currency page -extern const char BUY_CURRENCY_URL[]; +extern const std::string BUY_CURRENCY_URL; // LSL script wiki -extern const char LSL_DOC_URL[]; +extern const std::string LSL_DOC_URL; // SL KnowledgeBase page -extern const char SL_KB_URL[]; +extern const std::string SL_KB_URL; -// Local Url Release Notes -extern const char RELEASE_NOTES[]; +// Release Notes Redirect URL for Server and Viewer +extern const std::string RELEASE_NOTES_BASE_URL; #endif diff --git a/linden/indra/llcommon/llstat.cpp b/linden/indra/llcommon/llstat.cpp index 11e4c64..4b79fcb 100644 --- a/linden/indra/llcommon/llstat.cpp +++ b/linden/indra/llcommon/llstat.cpp @@ -76,10 +76,11 @@ public: U64 LLStatAccum::impl::sScaleTimes[IMPL_NUM_SCALES] = { + USEC_PER_SEC / 10, // 100 millisec USEC_PER_SEC * 1, // seconds USEC_PER_SEC * 60, // minutes - USEC_PER_SEC * 60 * 2 // minutes -#if 0 + USEC_PER_SEC * 60 * 2 // two minutes +#if ENABLE_LONG_TIME_STATS // enable these when more time scales are desired USEC_PER_SEC * 60*60, // hours USEC_PER_SEC * 24*60*60, // days diff --git a/linden/indra/llcommon/llstat.h b/linden/indra/llcommon/llstat.h index a0a86e6..0a7e014 100644 --- a/linden/indra/llcommon/llstat.h +++ b/linden/indra/llcommon/llstat.h @@ -37,6 +37,9 @@ #include "lltimer.h" #include "llframetimer.h" +// Set this if longer stats are needed +#define ENABLE_LONG_TIME_STATS 0 + // // Accumulates statistics for an arbitrary length of time. // Does this by maintaining a chain of accumulators, each one @@ -52,19 +55,22 @@ protected: public: enum TimeScale { + SCALE_100MS, SCALE_SECOND, SCALE_MINUTE, SCALE_TWO_MINUTE, +#if ENABLE_LONG_TIME_STATS SCALE_HOUR, SCALE_DAY, SCALE_WEEK, - +#endif NUM_SCALES }; F32 meanValue(TimeScale scale) const; // see the subclasses for the specific meaning of value + F32 meanValueOverLast100ms() const { return meanValue(SCALE_100MS); } F32 meanValueOverLastSecond() const { return meanValue(SCALE_SECOND); } F32 meanValueOverLastMinute() const { return meanValue(SCALE_MINUTE); } diff --git a/linden/indra/llcommon/llstatenums.h b/linden/indra/llcommon/llstatenums.h index bde6ade..6866586 100644 --- a/linden/indra/llcommon/llstatenums.h +++ b/linden/indra/llcommon/llstatenums.h @@ -63,7 +63,8 @@ enum LL_SIM_STAT_SIMPHYSICSSTEPMS, LL_SIM_STAT_SIMPHYSICSSHAPEMS, LL_SIM_STAT_SIMPHYSICSOTHERMS, - LL_SIM_STAT_SIMPHYSICSMEMORY + LL_SIM_STAT_SIMPHYSICSMEMORY, + LL_SIM_STAT_SCRIPT_EPS, }; #endif diff --git a/linden/indra/llcommon/llstl.h b/linden/indra/llcommon/llstl.h index 9a24185..4486727 100644 --- a/linden/indra/llcommon/llstl.h +++ b/linden/indra/llcommon/llstl.h @@ -105,6 +105,7 @@ struct DeletePairedPointer template void operator()(T &ptr) const { delete ptr.second; + ptr.second = NULL; } }; struct DeletePairedPointerArray @@ -112,6 +113,7 @@ struct DeletePairedPointerArray template void operator()(T &ptr) const { delete[] ptr.second; + ptr.second = NULL; } }; diff --git a/linden/indra/llcommon/llstring.cpp b/linden/indra/llcommon/llstring.cpp index a1f19ad..6a8efa8 100644 --- a/linden/indra/llcommon/llstring.cpp +++ b/linden/indra/llcommon/llstring.cpp @@ -1,6 +1,6 @@ /** * @file llstring.cpp - * @brief String utility functions and the LLString class. + * @brief String utility functions and the std::string class. * * $LicenseInfo:firstyear=2001&license=viewergpl$ * @@ -47,6 +47,12 @@ std::string ll_safe_string(const char* in) return std::string(); } +std::string ll_safe_string(const char* in, S32 maxlen) +{ + if(in) return std::string(in, maxlen); + return std::string(); +} + U8 hex_as_nybble(char hex) { if((hex >= '0') && (hex <= '9')) @@ -65,12 +71,12 @@ U8 hex_as_nybble(char hex) } -bool _read_file_into_string(std::string& str, const char* filename) +bool _read_file_into_string(std::string& str, const std::string& filename) { llifstream ifs(filename, llifstream::binary); if (!ifs.is_open()) { - llinfos << "Unable to open file" << filename << llendl; + llinfos << "Unable to open file " << filename << llendl; return false; } @@ -174,20 +180,6 @@ S32 utf16chars_to_wchar(const U16* inchars, llwchar* outchar) return inchars - base; } -S32 utf16chars_to_utf8chars(const U16* inchars, char* outchars, S32* nchars8p) -{ - // Get 32 bit char32 - llwchar char32; - S32 nchars16 = utf16chars_to_wchar(inchars, &char32); - // Convert to utf8 - S32 nchars8 = wchar_to_utf8chars(char32, outchars); - if (nchars8p) - { - *nchars8p = nchars8; - } - return nchars16; -} - llutf16string wstring_to_utf16str(const LLWString &utf32str, S32 len) { llutf16string out; @@ -216,7 +208,7 @@ llutf16string wstring_to_utf16str(const LLWString &utf32str) return wstring_to_utf16str(utf32str, len); } -llutf16string utf8str_to_utf16str ( const LLString& utf8str ) +llutf16string utf8str_to_utf16str ( const std::string& utf8str ) { LLWString wstr = utf8str_to_wstring ( utf8str ); return wstring_to_utf16str ( wstr ); @@ -492,210 +484,10 @@ std::string utf16str_to_utf8str(const llutf16string& utf16str, S32 len) return wstring_to_utf8str(utf16str_to_wstring(utf16str, len), len); } - -//LLWString wstring_truncate(const LLWString &wstr, const S32 max_len) -//{ -// return wstr.substr(0, llmin((S32)wstr.length(), max_len)); -//} -// -// -//LLWString wstring_trim(const LLWString &wstr) -//{ -// LLWString outstr; -// outstr = wstring_trimhead(wstr); -// outstr = wstring_trimtail(outstr); -// return outstr; -//} -// -// -//LLWString wstring_trimhead(const LLWString &wstr) -//{ -// if(wstr.empty()) -// { -// return wstr; -// } -// -// S32 i = 0; -// while((i < (S32)wstr.length()) && iswspace(wstr[i])) -// { -// i++; -// } -// return wstr.substr(i, wstr.length() - i); -//} -// -// -//LLWString wstring_trimtail(const LLWString &wstr) -//{ -// if(wstr.empty()) -// { -// return wstr; -// } -// -// S32 len = (S32)wstr.length(); -// -// S32 i = len - 1; -// while (i >= 0 && iswspace(wstr[i])) -// { -// i--; -// } -// -// if (i >= 0) -// { -// return wstr.substr(0, i + 1); -// } -// return wstr; -//} -// -// -//LLWString wstring_copyinto(const LLWString &dest, const LLWString &src, const S32 insert_offset) -//{ -// llassert( insert_offset <= (S32)dest.length() ); -// -// LLWString out_str = dest.substr(0, insert_offset); -// out_str += src; -// LLWString tail = dest.substr(insert_offset); -// out_str += tail; -// -// return out_str; -//} - - -//LLWString wstring_detabify(const LLWString &wstr, const S32 num_spaces) -//{ -// LLWString out_str; -// // Replace tabs with spaces -// for (S32 i = 0; i < (S32)wstr.length(); i++) -// { -// if (wstr[i] == '\t') -// { -// for (S32 j = 0; j < num_spaces; j++) -// out_str += ' '; -// } -// else -// { -// out_str += wstr[i]; -// } -// } -// return out_str; -//} - - -//LLWString wstring_makeASCII(const LLWString &wstr) -//{ -// // Replace non-ASCII chars with replace_char -// LLWString out_str = wstr; -// for (S32 i = 0; i < (S32)out_str.length(); i++) -// { -// if (out_str[i] > 0x7f) -// { -// out_str[i] = LL_UNKNOWN_CHAR; -// } -// } -// return out_str; -//} - - -//LLWString wstring_substChar(const LLWString &wstr, const llwchar target_char, const llwchar replace_char) -//{ -// // Replace all occurences of target_char with replace_char -// LLWString out_str = wstr; -// for (S32 i = 0; i < (S32)out_str.length(); i++) -// { -// if (out_str[i] == target_char) -// { -// out_str[i] = replace_char; -// } -// } -// return out_str; -//} -// -// -//LLWString wstring_tolower(const LLWString &wstr) -//{ -// LLWString out_str = wstr; -// for (S32 i = 0; i < (S32)out_str.length(); i++) -// { -// out_str[i] = towlower(out_str[i]); -// } -// return out_str; -//} -// -// -//LLWString wstring_convert_to_lf(const LLWString &wstr) -//{ -// const llwchar CR = 13; -// // Remove carriage returns from string with CRLF -// LLWString out_str; -// -// for (S32 i = 0; i < (S32)wstr.length(); i++) -// { -// if (wstr[i] != CR) -// { -// out_str += wstr[i]; -// } -// } -// return out_str; -//} -// -// -//LLWString wstring_convert_to_crlf(const LLWString &wstr) -//{ -// const llwchar LF = 10; -// const llwchar CR = 13; -// // Remove carriage returns from string with CRLF -// LLWString out_str; -// -// for (S32 i = 0; i < (S32)wstr.length(); i++) -// { -// if (wstr[i] == LF) -// { -// out_str += CR; -// } -// out_str += wstr[i]; -// } -// return out_str; -//} - - -//S32 wstring_compare_insensitive(const LLWString &lhs, const LLWString &rhs) -//{ -// -// if (lhs == rhs) -// { -// return 0; -// } -// -// if (lhs.empty()) -// { -// return rhs.empty() ? 0 : 1; -// } -// -// if (rhs.empty()) -// { -// return -1; -// } -// -//#ifdef LL_LINUX -// // doesn't work because gcc 2.95 doesn't correctly implement c_str(). Sigh... -// llerrs << "wstring_compare_insensitive doesn't work on Linux!" << llendl; -// return 0; -//#else -// LLWString lhs_lower = lhs; -// LLWString::toLower(lhs_lower); -// std::string lhs_lower = wstring_to_utf8str(lhs_lower); -// LLWString rhs_lower = lhs; -// LLWString::toLower(rhs_lower); -// std::string rhs_lower = wstring_to_utf8str(rhs_lower); -// -// return strcmp(lhs_lower.c_str(), rhs_lower.c_str()); -//#endif -//} - - std::string utf8str_trim(const std::string& utf8str) { LLWString wstr = utf8str_to_wstring(utf8str); - LLWString::trim(wstr); + LLWStringUtil::trim(wstr); return wstring_to_utf8str(wstr); } @@ -703,7 +495,7 @@ std::string utf8str_trim(const std::string& utf8str) std::string utf8str_tolower(const std::string& utf8str) { LLWString out_str = utf8str_to_wstring(utf8str); - LLWString::toLower(out_str); + LLWStringUtil::toLower(out_str); return wstring_to_utf8str(out_str); } @@ -712,7 +504,7 @@ S32 utf8str_compare_insensitive(const std::string& lhs, const std::string& rhs) { LLWString wlhs = utf8str_to_wstring(lhs); LLWString wrhs = utf8str_to_wstring(rhs); - return LLWString::compareInsensitive(wlhs.c_str(), wrhs.c_str()); + return LLWStringUtil::compareInsensitive(wlhs, wrhs); } std::string utf8str_truncate(const std::string& utf8str, const S32 max_len) @@ -756,7 +548,7 @@ std::string utf8str_substChar( const llwchar replace_char) { LLWString wstr = utf8str_to_wstring(utf8str); - LLWString::replaceChar(wstr, target_char, replace_char); + LLWStringUtil::replaceChar(wstr, target_char, replace_char); //wstr = wstring_substChar(wstr, target_char, replace_char); return wstring_to_utf8str(wstr); } @@ -764,7 +556,7 @@ std::string utf8str_substChar( std::string utf8str_makeASCII(const std::string& utf8str) { LLWString wstr = utf8str_to_wstring(utf8str); - LLWString::_makeASCII(wstr); + LLWStringUtil::_makeASCII(wstr); return wstring_to_utf8str(wstr); } @@ -929,6 +721,32 @@ namespace LLStringFn } } } + + // https://wiki.lindenlab.com/wiki/Unicode_Guidelines has details on + // allowable code points for XML. Specifically, they are: + // 0x09, 0x0a, 0x0d, and 0x20 on up. JC + std::string strip_invalid_xml(const std::string& input) + { + std::string output; + output.reserve( input.size() ); + std::string::const_iterator it = input.begin(); + while (it != input.end()) + { + // Must compare as unsigned for >= + // Test most likely match first + const unsigned char c = (unsigned char)*it; + if ( c >= (unsigned char)0x20 // SPACE + || c == (unsigned char)0x09 // TAB + || c == (unsigned char)0x0a // LINE_FEED + || c == (unsigned char)0x0d ) // CARRIAGE_RETURN + { + output.push_back(c); + } + ++it; + } + return output; + } + } @@ -938,19 +756,19 @@ namespace LLStringFn #ifdef _DEBUG template -void LLStringBase::testHarness() +void LLStringUtilBase::testHarness() { - LLString s1; + std::string s1; llassert( s1.c_str() == NULL ); llassert( s1.size() == 0 ); llassert( s1.empty() ); - LLString s2( "hello"); + std::string s2( "hello"); llassert( !strcmp( s2.c_str(), "hello" ) ); llassert( s2.size() == 5 ); llassert( !s2.empty() ); - LLString s3( s2 ); + std::string s3( s2 ); llassert( "hello" == s2 ); llassert( s2 == "hello" ); @@ -959,12 +777,12 @@ void LLStringBase::testHarness() llassert( "gello" != s2 ); llassert( s2 != "gello" ); - LLString s4 = s2; + std::string s4 = s2; llassert( !s4.empty() ); s4.empty(); llassert( s4.empty() ); - LLString s5(""); + std::string s5(""); llassert( s5.empty() ); llassert( isValidIndex(s5, 0) ); @@ -978,8 +796,8 @@ void LLStringBase::testHarness() llassert( s4 == "hello again!hello again!" ); - LLString s6 = s2 + " " + s2; - LLString s7 = s6; + std::string s6 = s2 + " " + s2; + std::string s7 = s6; llassert( s6 == s7 ); llassert( !( s6 != s7) ); llassert( !(s6 < s7) ); @@ -1002,10 +820,10 @@ void LLStringBase::testHarness() s2.insert( 1, "awn, don't yel"); llassert( s2 == "yawn, don't yell"); - LLString s8 = s2.substr( 6, 5 ); + std::string s8 = s2.substr( 6, 5 ); llassert( s8 == "don't" ); - LLString s9 = " \t\ntest \t\t\n "; + std::string s9 = " \t\ntest \t\t\n "; trim(s9); llassert( s9 == "test" ); @@ -1020,17 +838,17 @@ void LLStringBase::testHarness() llassert( s9 == "abc123&*(abc" ); - LLString s10( 10, 'x' ); + std::string s10( 10, 'x' ); llassert( s10 == "xxxxxxxxxx" ); - LLString s11( "monkey in the middle", 7, 2 ); + std::string s11( "monkey in the middle", 7, 2 ); llassert( s11 == "in" ); - LLString s12; //empty + std::string s12; //empty s12 += "foo"; llassert( s12 == "foo" ); - LLString s13; //empty + std::string s13; //empty s13 += 'f'; llassert( s13 == "f" ); } diff --git a/linden/indra/llcommon/llstring.h b/linden/indra/llcommon/llstring.h index 82ebdc9..60a4492 100644 --- a/linden/indra/llcommon/llstring.h +++ b/linden/indra/llcommon/llstring.h @@ -1,6 +1,6 @@ /** * @file llstring.h - * @brief String utility functions and LLString class. + * @brief String utility functions and std::string class. * * $LicenseInfo:firstyear=2001&license=viewergpl$ * @@ -39,15 +39,8 @@ const char LL_UNKNOWN_CHAR = '?'; -class LLVector3; -class LLVector3d; -class LLQuaternion; -class LLUUID; -class LLColor4; -class LLColor4U; - -#if (LL_DARWIN || LL_SOLARIS || (LL_LINUX && __GNUC__ > 2)) -// Template specialization of char_traits for U16s. Only necessary on Mac for now (exists on Windows, unused/broken on Linux/gcc2.95) +#if LL_DARWIN || LL_LINUX || LL_SOLARIS +// Template specialization of char_traits for U16s. Only necessary on Mac and Linux (exists on Windows already) namespace std { template<> @@ -162,79 +155,29 @@ public: static BOOL isDigit(llwchar a) { return iswdigit(a) != 0; } }; -//RN: I used a templated base class instead of a pure interface class to minimize code duplication -// but it might be worthwhile to just go with two implementations (LLString and LLWString) of -// an interface class, unless we can think of a good reason to have a std::basic_string polymorphic base - -//**************************************************************** -// NOTA BENE: do *NOT* dynamically allocate memory inside of LLStringBase as the {*()^#%*)#%W^*)#%*)STL implentation -// of basic_string doesn't provide a virtual destructor. If we need to allocate resources specific to LLString -// then we should either customize std::basic_string to linden::basic_string or change LLString to be a wrapper -// that contains an instance of std::basic_string. Similarly, overriding methods defined in std::basic_string will *not* -// be called in a polymorphic manner (passing an instance of basic_string to a particular function) -//**************************************************************** +// Allowing assignments from non-strings into format_map_t is apparently +// *really* error-prone, so subclass std::string with just basic c'tors. +class FormatMapString : public std::string +{ +public: + FormatMapString() : std::string() {}; + FormatMapString(const char* s) : std::string(s) {}; + FormatMapString(const std::string& s) : std::string(s) {}; +}; template -class LLStringBase : public std::basic_string +class LLStringUtilBase { public: typedef typename std::basic_string::size_type size_type; - // naming convention follows those set for LLUUID -// static LLStringBase null; // deprecated for std::string compliance -// static LLStringBase zero_length; // deprecated for std::string compliance - - - // standard constructors - LLStringBase() : std::basic_string() {} - LLStringBase(const LLStringBase& s): std::basic_string(s) {} - LLStringBase(const std::basic_string& s) : std::basic_string(s) {} - LLStringBase(const std::basic_string& s, size_type pos, size_type n = std::basic_string::npos) - : std::basic_string(s, pos, n) {} - LLStringBase(size_type count, const T& c) : std::basic_string() { assign(count, c);} - // custom constructors - LLStringBase(const T* s); - LLStringBase(const T* s, size_type n); - LLStringBase(const T* s, size_type pos, size_type n ); - -#if LL_LINUX || LL_SOLARIS - void clear() { assign(null); } - - LLStringBase& assign(const T* s); - LLStringBase& assign(const T* s, size_type n); - LLStringBase& assign(const LLStringBase& s); - LLStringBase& assign(size_type n, const T& c); - LLStringBase& assign(const T* a, const T* b); - LLStringBase& assign(typename LLStringBase::iterator &it1, typename LLStringBase::iterator &it2); - LLStringBase& assign(typename LLStringBase::const_iterator &it1, typename LLStringBase::const_iterator &it2); - - // workaround for bug in gcc2 STL headers. - #if ((__GNUC__ <= 2) && (!defined _STLPORT_VERSION)) - const T* c_str () const - { - if (length () == 0) - { - static const T zero = 0; - return &zero; - } - - //terminate (); - { string_char_traits::assign(const_cast(data())[length()], string_char_traits::eos()); } - - return data (); - } - #endif -#endif - - bool operator==(const T* _Right) const { return _Right ? (std::basic_string::compare(_Right) == 0) : this->empty(); } - public: ///////////////////////////////////////////////////////////////////////////////////////// // Static Utility functions that operate on std::strings - static LLStringBase null; + static std::basic_string null; - typedef std::map format_map_t; + typedef std::map format_map_t; static S32 format(std::basic_string& s, const format_map_t& fmt_map); static BOOL isValidIndex(const std::basic_string& string, size_type i) @@ -266,8 +209,8 @@ public: /** * @brief Unsafe way to make ascii characters. You should probably * only call this when interacting with the host operating system. - * The 1 byte LLString does not work correctly. - * The 2 and 4 byte LLString probably work, so LLWString::_makeASCII + * The 1 byte std::string does not work correctly. + * The 2 and 4 byte std::string probably work, so LLWStringUtil::_makeASCII * should work. */ static void _makeASCII(std::basic_string& string); @@ -289,11 +232,13 @@ public: // Like strcmp but also handles empty strings. Uses // current locale. static S32 compareStrings(const T* lhs, const T* rhs); + static S32 compareStrings(const std::basic_string& lhs, const std::basic_string& rhs); // case insensitive version of above. Uses current locale on // Win32, and falls back to a non-locale aware comparison on // Linux. static S32 compareInsensitive(const T* lhs, const T* rhs); + static S32 compareInsensitive(const std::basic_string& lhs, const std::basic_string& rhs); // Case sensitive comparison with good handling of numbers. Does not use current locale. // a.k.a. strdictcmp() @@ -320,21 +265,21 @@ public: }; -template LLStringBase LLStringBase::null; +template std::basic_string LLStringUtilBase::null; -typedef LLStringBase LLString; -typedef LLStringBase LLWString; +typedef LLStringUtilBase LLStringUtil; +typedef LLStringUtilBase LLWStringUtil; +typedef std::basic_string LLWString; //@ Use this where we want to disallow input in the form of "foo" // This is used to catch places where english text is embedded in the code // instead of in a translatable XUI file. -class LLStringExplicit : public LLString +class LLStringExplicit : public std::string { public: - explicit LLStringExplicit(const char* s) : LLString(s) {} - LLStringExplicit(const LLString& s) : LLString(s) {} - LLStringExplicit(const std::string& s) : LLString(s) {} - LLStringExplicit(const std::string& s, size_type pos, size_type n = std::string::npos) : LLString(s, pos, n) {} + explicit LLStringExplicit(const char* s) : std::string(s) {} + LLStringExplicit(const std::string& s) : std::string(s) {} + LLStringExplicit(const std::string& s, size_type pos, size_type n = std::string::npos) : std::string(s, pos, n) {} }; struct LLDictionaryLess @@ -342,7 +287,7 @@ struct LLDictionaryLess public: bool operator()(const std::string& a, const std::string& b) { - return (LLString::precedesDict(a, b) ? true : false); + return (LLStringUtil::precedesDict(a, b) ? true : false); } }; @@ -371,6 +316,7 @@ inline std::string chop_tail_copy( * pointer is NULL. */ std::string ll_safe_string(const char* in); +std::string ll_safe_string(const char* in, S32 maxlen); /** * @brief This translates a nybble stored as a hex value from 0-f back @@ -387,7 +333,7 @@ U8 hex_as_nybble(char hex); * @param filename The full name of the file to read. * @return Returns true on success. If false, str is unmodified. */ -bool _read_file_into_string(std::string& str, const char* filename); +bool _read_file_into_string(std::string& str, const std::string& filename); /** * Unicode support @@ -409,20 +355,17 @@ LLWString utf16str_to_wstring(const llutf16string &utf16str); llutf16string wstring_to_utf16str(const LLWString &utf32str, S32 len); llutf16string wstring_to_utf16str(const LLWString &utf32str); -llutf16string utf8str_to_utf16str ( const LLString& utf8str, S32 len); -llutf16string utf8str_to_utf16str ( const LLString& utf8str ); +llutf16string utf8str_to_utf16str ( const std::string& utf8str, S32 len); +llutf16string utf8str_to_utf16str ( const std::string& utf8str ); LLWString utf8str_to_wstring(const std::string &utf8str, S32 len); LLWString utf8str_to_wstring(const std::string &utf8str); // Same function, better name. JC inline LLWString utf8string_to_wstring(const std::string& utf8_string) { return utf8str_to_wstring(utf8_string); } -// Special hack for llfilepicker.cpp: -S32 utf16chars_to_utf8chars(const U16* inchars, char* outchars, S32* nchars8 = 0); -S32 utf16chars_to_wchar(const U16* inchars, llwchar* outchar); +// S32 wchar_to_utf8chars(llwchar inchar, char* outchars); -// std::string wstring_to_utf8str(const LLWString &utf32str, S32 len); std::string wstring_to_utf8str(const LLWString &utf32str); @@ -484,15 +427,6 @@ std::string mbcsstring_makeASCII(const std::string& str); std::string utf8str_removeCRLF(const std::string& utf8str); -template -std::ostream& operator<<(std::ostream &s, const LLStringBase &str) -{ - s << ((std::basic_string)str); - return s; -} - -std::ostream& operator<<(std::ostream &s, const LLWString &wstr); - #if LL_WINDOWS /* @name Windows string helpers */ @@ -528,7 +462,7 @@ std::string ll_convert_wide_to_string(const wchar_t* in); #endif // LL_WINDOWS /** - * Many of the 'strip' and 'replace' methods of LLStringBase need + * Many of the 'strip' and 'replace' methods of LLStringUtilBase need * specialization to work with the signed char type. * Sadly, it is not possible (AFAIK) to specialize a single method of * a template class. @@ -581,30 +515,68 @@ namespace LLStringFn */ void replace_nonprintable_and_pipe(std::basic_string& str, llwchar replacement); + + /** + * @brief Remove all characters that are not allowed in XML 1.0. + * Returns a copy of the string with those characters removed. + * Works with US ASCII and UTF-8 encoded strings. JC + */ + std::string strip_invalid_xml(const std::string& input); } //////////////////////////////////////////////////////////// +// LLStringBase::format() +// +// This function takes a string 's' and a map 'fmt_map' of strings-to-strings. +// All occurances of strings in 's' from the left-hand side of 'fmt_map' are +// then replaced with the corresponding right-hand side of 'fmt_map', non- +// recursively. The function returns the number of substitutions made. + // static template -S32 LLStringBase::format(std::basic_string& s, const format_map_t& fmt_map) +S32 LLStringUtilBase::format(std::basic_string& s, const format_map_t& fmt_map) { typedef typename std::basic_string::size_type string_size_type_t; + string_size_type_t scanstart = 0; S32 res = 0; - for (format_map_t::const_iterator iter = fmt_map.begin(); iter != fmt_map.end(); ++iter) + + // Look for the first match of any keyword, replace that keyword, + // repeat from the end of the replacement string. This avoids + // accidentally performing substitution on a substituted string. + while (1) { - U32 fmtlen = iter->first.size(); - string_size_type_t n = 0; - while (1) + string_size_type_t first_match_pos = scanstart; + string_size_type_t first_match_str_length = 0; + std::basic_string first_match_str_replacement; + + for (format_map_t::const_iterator iter = fmt_map.begin(); + iter != fmt_map.end(); + ++iter) { - n = s.find(iter->first, n); - if (n == std::basic_string::npos) + string_size_type_t n = s.find(iter->first, scanstart); + if (n != std::basic_string::npos && + (n < first_match_pos || + 0 == first_match_str_length)) { - break; + first_match_pos = n; + first_match_str_length = iter->first.length(); + first_match_str_replacement = iter->second; } - s.erase(n, fmtlen); - s.insert(n, iter->second); - n += fmtlen; + } + + if (0 == first_match_str_length) + { + // no more keys found to substitute from this point + // in the string forward. + break; + } + else + { + s.erase(first_match_pos, first_match_str_length); + s.insert(first_match_pos, first_match_str_replacement); + scanstart = first_match_pos + + first_match_str_replacement.length(); ++res; } } @@ -613,7 +585,7 @@ S32 LLStringBase::format(std::basic_string& s, const format_map_t& fmt_map // static template -S32 LLStringBase::compareStrings(const T* lhs, const T* rhs) +S32 LLStringUtilBase::compareStrings(const T* lhs, const T* rhs) { S32 result; if( lhs == rhs ) @@ -637,9 +609,16 @@ S32 LLStringBase::compareStrings(const T* lhs, const T* rhs) return result; } +//static +template +S32 LLStringUtilBase::compareStrings(const std::basic_string& lhs, const std::basic_string& rhs) +{ + return LLStringOps::collate(lhs.c_str(), rhs.c_str()); +} + // static template -S32 LLStringBase::compareInsensitive(const T* lhs, const T* rhs ) +S32 LLStringUtilBase::compareInsensitive(const T* lhs, const T* rhs ) { S32 result; if( lhs == rhs ) @@ -658,22 +637,32 @@ S32 LLStringBase::compareInsensitive(const T* lhs, const T* rhs ) } else { - LLStringBase lhs_string(lhs); - LLStringBase rhs_string(rhs); - LLStringBase::toUpper(lhs_string); - LLStringBase::toUpper(rhs_string); + std::basic_string lhs_string(lhs); + std::basic_string rhs_string(rhs); + LLStringUtilBase::toUpper(lhs_string); + LLStringUtilBase::toUpper(rhs_string); result = LLStringOps::collate(lhs_string.c_str(), rhs_string.c_str()); } return result; } +//static +template +S32 LLStringUtilBase::compareInsensitive(const std::basic_string& lhs, const std::basic_string& rhs) +{ + std::basic_string lhs_string(lhs); + std::basic_string rhs_string(rhs); + LLStringUtilBase::toUpper(lhs_string); + LLStringUtilBase::toUpper(rhs_string); + return LLStringOps::collate(lhs_string.c_str(), rhs_string.c_str()); +} // Case sensitive comparison with good handling of numbers. Does not use current locale. // a.k.a. strdictcmp() //static template -S32 LLStringBase::compareDict(const std::basic_string& astr, const std::basic_string& bstr) +S32 LLStringUtilBase::compareDict(const std::basic_string& astr, const std::basic_string& bstr) { const T* a = astr.c_str(); const T* b = bstr.c_str(); @@ -712,8 +701,9 @@ S32 LLStringBase::compareDict(const std::basic_string& astr, const std::ba return ca-cb; } +// static template -S32 LLStringBase::compareDictInsensitive(const std::basic_string& astr, const std::basic_string& bstr) +S32 LLStringUtilBase::compareDictInsensitive(const std::basic_string& astr, const std::basic_string& bstr) { const T* a = astr.c_str(); const T* b = bstr.c_str(); @@ -748,11 +738,11 @@ S32 LLStringBase::compareDictInsensitive(const std::basic_string& astr, co // Puts compareDict() in a form appropriate for LL container classes to use for sorting. // static template -BOOL LLStringBase::precedesDict( const std::basic_string& a, const std::basic_string& b ) +BOOL LLStringUtilBase::precedesDict( const std::basic_string& a, const std::basic_string& b ) { if( a.size() && b.size() ) { - return (LLStringBase::compareDict(a.c_str(), b.c_str()) < 0); + return (LLStringUtilBase::compareDict(a.c_str(), b.c_str()) < 0); } else { @@ -760,108 +750,9 @@ BOOL LLStringBase::precedesDict( const std::basic_string& a, const std::ba } } -// Constructors -template -LLStringBase::LLStringBase(const T* s ) : std::basic_string() -{ - if (s) assign(s); -} - -template -LLStringBase::LLStringBase(const T* s, size_type n ) : std::basic_string() -{ - if (s) assign(s, n); -} - -// Init from a substring -template -LLStringBase::LLStringBase(const T* s, size_type pos, size_type n ) : std::basic_string() -{ - if( s ) - { - assign(s + pos, n); - } - else - { - assign(LLStringBase::null); - } -} - -#if LL_LINUX || LL_SOLARIS -template -LLStringBase& LLStringBase::assign(const T* s) -{ - if (s) - { - std::basic_string::assign(s); - } - else - { - assign(LLStringBase::null); - } - return *this; -} - -template -LLStringBase& LLStringBase::assign(const T* s, size_type n) -{ - if (s) - { - std::basic_string::assign(s, n); - } - else - { - assign(LLStringBase::null); - } - return *this; -} - -template -LLStringBase& LLStringBase::assign(const LLStringBase& s) -{ - std::basic_string::assign(s); - return *this; -} - -template -LLStringBase& LLStringBase::assign(size_type n, const T& c) -{ - std::basic_string::assign(n, c); - return *this; -} - -template -LLStringBase& LLStringBase::assign(const T* a, const T* b) -{ - if (a > b) - assign(LLStringBase::null); - else - assign(a, (size_type) (b-a)); - return *this; -} - -template -LLStringBase& LLStringBase::assign(typename LLStringBase::iterator &it1, typename LLStringBase::iterator &it2) -{ - assign(LLStringBase::null); - while(it1 != it2) - *this += *it1++; - return *this; -} - -template -LLStringBase& LLStringBase::assign(typename LLStringBase::const_iterator &it1, typename LLStringBase::const_iterator &it2) -{ - assign(LLStringBase::null); - while(it1 != it2) - *this += *it1++; - return *this; -} -#endif - //static template -void LLStringBase::toUpper(std::basic_string& string) +void LLStringUtilBase::toUpper(std::basic_string& string) { if( !string.empty() ) { @@ -875,7 +766,7 @@ void LLStringBase::toUpper(std::basic_string& string) //static template -void LLStringBase::toLower(std::basic_string& string) +void LLStringUtilBase::toLower(std::basic_string& string) { if( !string.empty() ) { @@ -889,7 +780,7 @@ void LLStringBase::toLower(std::basic_string& string) //static template -void LLStringBase::trimHead(std::basic_string& string) +void LLStringUtilBase::trimHead(std::basic_string& string) { if( !string.empty() ) { @@ -904,7 +795,7 @@ void LLStringBase::trimHead(std::basic_string& string) //static template -void LLStringBase::trimTail(std::basic_string& string) +void LLStringUtilBase::trimTail(std::basic_string& string) { if( string.size() ) { @@ -923,7 +814,7 @@ void LLStringBase::trimTail(std::basic_string& string) // Replace line feeds with carriage return-line feed pairs. //static template -void LLStringBase::addCRLF(std::basic_string& string) +void LLStringUtilBase::addCRLF(std::basic_string& string) { const T LF = 10; const T CR = 13; @@ -964,7 +855,7 @@ void LLStringBase::addCRLF(std::basic_string& string) // Remove all carriage returns //static template -void LLStringBase::removeCRLF(std::basic_string& string) +void LLStringUtilBase::removeCRLF(std::basic_string& string) { const T CR = 13; @@ -985,7 +876,7 @@ void LLStringBase::removeCRLF(std::basic_string& string) //static template -void LLStringBase::replaceChar( std::basic_string& string, T target, T replacement ) +void LLStringUtilBase::replaceChar( std::basic_string& string, T target, T replacement ) { size_type found_pos = 0; for (found_pos = string.find(target, found_pos); @@ -998,7 +889,7 @@ void LLStringBase::replaceChar( std::basic_string& string, T target, T rep //static template -void LLStringBase::replaceNonstandardASCII( std::basic_string& string, T replacement ) +void LLStringUtilBase::replaceNonstandardASCII( std::basic_string& string, T replacement ) { const char LF = 10; const S8 MIN = 32; @@ -1018,12 +909,12 @@ void LLStringBase::replaceNonstandardASCII( std::basic_string& string, T r //static template -void LLStringBase::replaceTabsWithSpaces( std::basic_string& str, size_type spaces_per_tab ) +void LLStringUtilBase::replaceTabsWithSpaces( std::basic_string& str, size_type spaces_per_tab ) { const T TAB = '\t'; const T SPACE = ' '; - LLStringBase out_str; + std::basic_string out_str; // Replace tabs with spaces for (size_type i = 0; i < str.length(); i++) { @@ -1042,7 +933,7 @@ void LLStringBase::replaceTabsWithSpaces( std::basic_string& str, size_typ //static template -BOOL LLStringBase::containsNonprintable(const std::basic_string& string) +BOOL LLStringUtilBase::containsNonprintable(const std::basic_string& string) { const char MIN = 32; BOOL rv = FALSE; @@ -1059,7 +950,7 @@ BOOL LLStringBase::containsNonprintable(const std::basic_string& string) //static template -void LLStringBase::stripNonprintable(std::basic_string& string) +void LLStringUtilBase::stripNonprintable(std::basic_string& string) { const char MIN = 32; size_type j = 0; @@ -1090,7 +981,7 @@ void LLStringBase::stripNonprintable(std::basic_string& string) } template -void LLStringBase::_makeASCII(std::basic_string& string) +void LLStringUtilBase::_makeASCII(std::basic_string& string) { // Replace non-ASCII chars with LL_UNKNOWN_CHAR for (size_type i = 0; i < string.length(); i++) @@ -1104,7 +995,7 @@ void LLStringBase::_makeASCII(std::basic_string& string) // static template -void LLStringBase::copy( T* dst, const T* src, size_type dst_size ) +void LLStringUtilBase::copy( T* dst, const T* src, size_type dst_size ) { if( dst_size > 0 ) { @@ -1120,7 +1011,7 @@ void LLStringBase::copy( T* dst, const T* src, size_type dst_size ) // static template -void LLStringBase::copyInto(std::basic_string& dst, const std::basic_string& src, size_type offset) +void LLStringUtilBase::copyInto(std::basic_string& dst, const std::basic_string& src, size_type offset) { if ( offset == dst.length() ) { @@ -1141,7 +1032,7 @@ void LLStringBase::copyInto(std::basic_string& dst, const std::basic_strin // True if this is the head of s. //static template -BOOL LLStringBase::isHead( const std::basic_string& string, const T* s ) +BOOL LLStringUtilBase::isHead( const std::basic_string& string, const T* s ) { if( string.empty() ) { @@ -1155,14 +1046,14 @@ BOOL LLStringBase::isHead( const std::basic_string& string, const T* s ) } template -BOOL LLStringBase::convertToBOOL(const std::basic_string& string, BOOL& value) +BOOL LLStringUtilBase::convertToBOOL(const std::basic_string& string, BOOL& value) { if( string.empty() ) { return FALSE; } - LLStringBase temp( string ); + std::basic_string temp( string ); trim(temp); if( (temp == "1") || @@ -1192,7 +1083,7 @@ BOOL LLStringBase::convertToBOOL(const std::basic_string& string, BOOL& va } template -BOOL LLStringBase::convertToU8(const std::basic_string& string, U8& value) +BOOL LLStringUtilBase::convertToU8(const std::basic_string& string, U8& value) { S32 value32 = 0; BOOL success = convertToS32(string, value32); @@ -1205,7 +1096,7 @@ BOOL LLStringBase::convertToU8(const std::basic_string& string, U8& value) } template -BOOL LLStringBase::convertToS8(const std::basic_string& string, S8& value) +BOOL LLStringUtilBase::convertToS8(const std::basic_string& string, S8& value) { S32 value32 = 0; BOOL success = convertToS32(string, value32); @@ -1218,7 +1109,7 @@ BOOL LLStringBase::convertToS8(const std::basic_string& string, S8& value) } template -BOOL LLStringBase::convertToS16(const std::basic_string& string, S16& value) +BOOL LLStringUtilBase::convertToS16(const std::basic_string& string, S16& value) { S32 value32 = 0; BOOL success = convertToS32(string, value32); @@ -1231,7 +1122,7 @@ BOOL LLStringBase::convertToS16(const std::basic_string& string, S16& valu } template -BOOL LLStringBase::convertToU16(const std::basic_string& string, U16& value) +BOOL LLStringUtilBase::convertToU16(const std::basic_string& string, U16& value) { S32 value32 = 0; BOOL success = convertToS32(string, value32); @@ -1244,14 +1135,14 @@ BOOL LLStringBase::convertToU16(const std::basic_string& string, U16& valu } template -BOOL LLStringBase::convertToU32(const std::basic_string& string, U32& value) +BOOL LLStringUtilBase::convertToU32(const std::basic_string& string, U32& value) { if( string.empty() ) { return FALSE; } - LLStringBase temp( string ); + std::basic_string temp( string ); trim(temp); U32 v; std::basic_istringstream i_stream((std::basic_string)temp); @@ -1271,14 +1162,14 @@ BOOL LLStringBase::convertToU32(const std::basic_string& string, U32& valu } template -BOOL LLStringBase::convertToS32(const std::basic_string& string, S32& value) +BOOL LLStringUtilBase::convertToS32(const std::basic_string& string, S32& value) { if( string.empty() ) { return FALSE; } - LLStringBase temp( string ); + std::basic_string temp( string ); trim(temp); S32 v; std::basic_istringstream i_stream((std::basic_string)temp); @@ -1298,7 +1189,7 @@ BOOL LLStringBase::convertToS32(const std::basic_string& string, S32& valu } template -BOOL LLStringBase::convertToF32(const std::basic_string& string, F32& value) +BOOL LLStringUtilBase::convertToF32(const std::basic_string& string, F32& value) { F64 value64 = 0.0; BOOL success = convertToF64(string, value64); @@ -1311,14 +1202,14 @@ BOOL LLStringBase::convertToF32(const std::basic_string& string, F32& valu } template -BOOL LLStringBase::convertToF64(const std::basic_string& string, F64& value) +BOOL LLStringUtilBase::convertToF64(const std::basic_string& string, F64& value) { if( string.empty() ) { return FALSE; } - LLStringBase temp( string ); + std::basic_string temp( string ); trim(temp); F64 v; std::basic_istringstream i_stream((std::basic_string)temp); @@ -1338,7 +1229,7 @@ BOOL LLStringBase::convertToF64(const std::basic_string& string, F64& valu } template -void LLStringBase::truncate(std::basic_string& string, size_type count) +void LLStringUtilBase::truncate(std::basic_string& string, size_type count) { size_type cur_size = string.size(); string.resize(count < cur_size ? count : cur_size); diff --git a/linden/indra/llcommon/llsys.cpp b/linden/indra/llcommon/llsys.cpp index 1285851..cb2e34a 100644 --- a/linden/indra/llcommon/llsys.cpp +++ b/linden/indra/llcommon/llsys.cpp @@ -143,28 +143,22 @@ LLOSInfo::LLOSInfo() : std::string csdversion = utf16str_to_utf8str(osvi.szCSDVersion); // Display version, service pack (if any), and build number. - char tmp[MAX_STRING]; /* Flawfinder: ignore */ + std::string tmpstr; if(osvi.dwMajorVersion <= 4) { - snprintf( /* Flawfinder: ignore */ - tmp, - sizeof(tmp), - "version %d.%d %s (Build %d)", - osvi.dwMajorVersion, - osvi.dwMinorVersion, - csdversion.c_str(), - (osvi.dwBuildNumber & 0xffff)); + tmpstr = llformat("version %d.%d %s (Build %d)", + osvi.dwMajorVersion, + osvi.dwMinorVersion, + csdversion.c_str(), + (osvi.dwBuildNumber & 0xffff)); } else { - snprintf( /* Flawfinder: ignore */ - tmp, - sizeof(tmp), - "%s (Build %d)", - csdversion.c_str(), - (osvi.dwBuildNumber & 0xffff)); + tmpstr = llformat("%s (Build %d)", + csdversion.c_str(), + (osvi.dwBuildNumber & 0xffff)); } - mOSString = mOSStringSimple + tmp; + mOSString = mOSStringSimple + tmpstr; } break; @@ -397,7 +391,7 @@ LLCPUInfo::LLCPUInfo() mCPUString = out.str(); #elif LL_LINUX - std::map< LLString, LLString > cpuinfo; + std::map< std::string, std::string > cpuinfo; LLFILE* cpuinfo_fp = LLFile::fopen(CPUINFO_FILE, "rb"); if(cpuinfo_fp) { @@ -420,21 +414,21 @@ LLCPUInfo::LLCPUInfo() if (nlspot == NULL) nlspot = line + strlen( line ); // Fallback to terminating NUL std::string linename( line, tabspot ); - LLString llinename(linename); - LLString::toLower(llinename); + std::string llinename(linename); + LLStringUtil::toLower(llinename); std::string lineval( spacespot + 1, nlspot ); cpuinfo[ llinename ] = lineval; } fclose(cpuinfo_fp); } # if LL_X86 - LLString flags = " " + cpuinfo["flags"] + " "; - LLString::toLower(flags); + std::string flags = " " + cpuinfo["flags"] + " "; + LLStringUtil::toLower(flags); mHasSSE = ( flags.find( " sse " ) != std::string::npos ); mHasSSE2 = ( flags.find( " sse2 " ) != std::string::npos ); F64 mhz; - if (LLString::convertToF64(cpuinfo["cpu mhz"], mhz) + if (LLStringUtil::convertToF64(cpuinfo["cpu mhz"], mhz) && 200.0 < mhz && mhz < 10000.0) { mCPUMhz = (S32)llrint(mhz); @@ -658,18 +652,17 @@ std::ostream& operator<<(std::ostream& s, const LLMemoryInfo& info) return s; } -BOOL gunzip_file(const char *srcfile, const char *dstfile) +BOOL gunzip_file(const std::string& srcfile, const std::string& dstfile) { - char tmpfile[LL_MAX_PATH]; /* Flawfinder: ignore */ + std::string tmpfile; const S32 UNCOMPRESS_BUFFER_SIZE = 32768; BOOL retval = FALSE; gzFile src = NULL; U8 buffer[UNCOMPRESS_BUFFER_SIZE]; LLFILE *dst = NULL; S32 bytes = 0; - (void *) strcpy(tmpfile, dstfile); /* Flawfinder: ignore */ - (void *) strncat(tmpfile, ".t", sizeof(tmpfile) - strlen(tmpfile) -1); /* Flawfinder: ignore */ - src = gzopen(srcfile, "rb"); + tmpfile = dstfile + ".t"; + src = gzopen(srcfile.c_str(), "rb"); if (! src) goto err; dst = LLFile::fopen(tmpfile, "wb"); /* Flawfinder: ignore */ if (! dst) goto err; @@ -693,18 +686,17 @@ err: return retval; } -BOOL gzip_file(const char *srcfile, const char *dstfile) +BOOL gzip_file(const std::string& srcfile, const std::string& dstfile) { const S32 COMPRESS_BUFFER_SIZE = 32768; - char tmpfile[LL_MAX_PATH]; /* Flawfinder: ignore */ + std::string tmpfile; BOOL retval = FALSE; U8 buffer[COMPRESS_BUFFER_SIZE]; gzFile dst = NULL; LLFILE *src = NULL; S32 bytes = 0; - (void *) strcpy(tmpfile, dstfile); /* Flawfinder: ignore */ - (void *) strncat(tmpfile, ".t", sizeof(tmpfile) - strlen(tmpfile) -1); /* Flawfinder: ignore */ - dst = gzopen(tmpfile, "wb"); /* Flawfinder: ignore */ + tmpfile = dstfile + ".t"; + dst = gzopen(tmpfile.c_str(), "wb"); /* Flawfinder: ignore */ if (! dst) goto err; src = LLFile::fopen(srcfile, "rb"); /* Flawfinder: ignore */ if (! src) goto err; diff --git a/linden/indra/llcommon/llsys.h b/linden/indra/llcommon/llsys.h index da7f07e..b764ca9 100644 --- a/linden/indra/llcommon/llsys.h +++ b/linden/indra/llcommon/llsys.h @@ -127,9 +127,9 @@ std::ostream& operator<<(std::ostream& s, const LLCPUInfo& info); std::ostream& operator<<(std::ostream& s, const LLMemoryInfo& info); // gunzip srcfile into dstfile. Returns FALSE on error. -BOOL gunzip_file(const char *srcfile, const char *dstfile); +BOOL gunzip_file(const std::string& srcfile, const std::string& dstfile); // gzip srcfile into dstfile. Returns FALSE on error. -BOOL gzip_file(const char *srcfile, const char *dstfile); +BOOL gzip_file(const std::string& srcfile, const std::string& dstfile); extern LLCPUInfo gSysCPU; diff --git a/linden/indra/llcommon/llthread.cpp b/linden/indra/llcommon/llthread.cpp index 48ebc4b..e07170b 100644 --- a/linden/indra/llcommon/llthread.cpp +++ b/linden/indra/llcommon/llthread.cpp @@ -31,7 +31,7 @@ #include "linden_common.h" #include "llapr.h" -#include "apr-1/apr_portable.h" +#include "apr_portable.h" #include "llthread.h" diff --git a/linden/indra/llcommon/llthread.h b/linden/indra/llcommon/llthread.h index 608b218..9da3134 100644 --- a/linden/indra/llcommon/llthread.h +++ b/linden/indra/llcommon/llthread.h @@ -36,7 +36,7 @@ #include "llapp.h" #include "llmemory.h" -#include "apr-1/apr_thread_cond.h" +#include "apr_thread_cond.h" class LLThread; class LLMutex; diff --git a/linden/indra/llcommon/lltimer.cpp b/linden/indra/llcommon/lltimer.cpp index 25d9897..967570d 100644 --- a/linden/indra/llcommon/lltimer.cpp +++ b/linden/indra/llcommon/lltimer.cpp @@ -429,10 +429,9 @@ BOOL LLTimer::knownBadTimer() // /////////////////////////////////////////////////////////////////////////////// -U32 time_corrected() +time_t time_corrected() { - U32 corrected_time = (U32)time(NULL) + gUTCOffset; - return corrected_time; + return time(NULL) + gUTCOffset; } @@ -452,27 +451,25 @@ BOOL is_daylight_savings() } -struct tm* utc_to_pacific_time(S32 utc_time, BOOL pacific_daylight_time) +struct tm* utc_to_pacific_time(time_t utc_time, BOOL pacific_daylight_time) { - time_t unix_time = (time_t)utc_time; - S32 pacific_offset_hours; if (pacific_daylight_time) { - pacific_offset_hours = -7; + pacific_offset_hours = 7; } else { - pacific_offset_hours = -8; + pacific_offset_hours = 8; } // We subtract off the PST/PDT offset _before_ getting // "UTC" time, because this will handle wrapping around // for 5 AM UTC -> 10 PM PDT of the previous day. - unix_time += pacific_offset_hours * MIN_PER_HOUR * SEC_PER_MIN; + utc_time -= pacific_offset_hours * MIN_PER_HOUR * SEC_PER_MIN; // Internal buffer to PST/PDT (see above) - struct tm* internal_time = gmtime(&unix_time); + struct tm* internal_time = gmtime(&utc_time); /* // Don't do this, this won't correctly tell you if daylight savings is active in CA or not. @@ -486,7 +483,7 @@ struct tm* utc_to_pacific_time(S32 utc_time, BOOL pacific_daylight_time) } -void microsecondsToTimecodeString(U64 current_time, char *tcstring) +void microsecondsToTimecodeString(U64 current_time, std::string& tcstring) { U64 hours; U64 minutes; @@ -504,11 +501,11 @@ void microsecondsToTimecodeString(U64 current_time, char *tcstring) subframes = current_time / (U64)42; subframes %= 100; - sprintf(tcstring,"%3.3d:%2.2d:%2.2d:%2.2d.%2.2d",(int)hours,(int)minutes,(int)seconds,(int)frames,(int)subframes); /* Flawfinder: ignore */ + tcstring = llformat("%3.3d:%2.2d:%2.2d:%2.2d.%2.2d",(int)hours,(int)minutes,(int)seconds,(int)frames,(int)subframes); } -void secondsToTimecodeString(F32 current_time, char *tcstring) +void secondsToTimecodeString(F32 current_time, std::string& tcstring) { microsecondsToTimecodeString((U64)((F64)(SEC_TO_MICROSEC*current_time)), tcstring); } @@ -541,7 +538,7 @@ void LLEventTimer::updateClass() { LLEventTimer* timer = *iter++; F32 et = timer->mEventTimer.getElapsedTimeF32(); - if (et > timer->mPeriod) { + if (timer->mEventTimer.getStarted() && et > timer->mPeriod) { timer->mEventTimer.reset(); if ( timer->tick() ) { diff --git a/linden/indra/llcommon/lltimer.h b/linden/indra/llcommon/lltimer.h index 91b93d6..8d94276 100644 --- a/linden/indra/llcommon/lltimer.h +++ b/linden/indra/llcommon/lltimer.h @@ -35,6 +35,7 @@ #if LL_LINUX || LL_DARWIN #include #endif +#include #include "stdtypes.h" @@ -117,7 +118,35 @@ void ms_sleep(U32 ms); // Returns the correct UTC time in seconds, like time(NULL). // Useful on the viewer, which may have its local clock set wrong. -U32 time_corrected(); +time_t time_corrected(); + +static inline time_t time_min() +{ + if (sizeof(time_t) == 4) + { + return (time_t) INT_MIN; + } else { +#ifdef LLONG_MIN + return (time_t) LLONG_MIN; +#else + return (time_t) LONG_MIN; +#endif + } +} + +static inline time_t time_max() +{ + if (sizeof(time_t) == 4) + { + return (time_t) INT_MAX; + } else { +#ifdef LLONG_MAX + return (time_t) LLONG_MAX; +#else + return (time_t) LONG_MAX; +#endif + } +} // Correction factor used by time_corrected() above. extern S32 gUTCOffset; @@ -131,10 +160,10 @@ BOOL is_daylight_savings(); // S32 utc_time; // utc_time = time_corrected(); // struct tm* internal_time = utc_to_pacific_time(utc_time, gDaylight); -struct tm* utc_to_pacific_time(S32 utc_time, BOOL pacific_daylight_time); +struct tm* utc_to_pacific_time(time_t utc_time, BOOL pacific_daylight_time); -void microsecondsToTimecodeString(U64 current_time, char *tcstring); -void secondsToTimecodeString(F32 current_time, char *tcstring); +void microsecondsToTimecodeString(U64 current_time, std::string& tcstring); +void secondsToTimecodeString(F32 current_time, std::string& tcstring); // class for scheduling a function to be called at a given frequency (approximate, inprecise) class LLEventTimer diff --git a/linden/indra/llcommon/lluri.cpp b/linden/indra/llcommon/lluri.cpp index 7db8f3b..b83036b 100644 --- a/linden/indra/llcommon/lluri.cpp +++ b/linden/indra/llcommon/lluri.cpp @@ -38,7 +38,7 @@ #include "llsd.h" #include -#include "../llmath/lluuid.h" +#include "lluuid.h" // system includes #include diff --git a/linden/indra/llcommon/lluuid.cpp b/linden/indra/llcommon/lluuid.cpp new file mode 100644 index 0000000..7e4eb50 --- /dev/null +++ b/linden/indra/llcommon/lluuid.cpp @@ -0,0 +1,923 @@ +/** + * @file lluuid.cpp + * + * $LicenseInfo:firstyear=2000&license=viewergpl$ + * + * Copyright (c) 2000-2008, Linden Research, Inc. + * + * Second Life Viewer Source Code + * 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://secondlifegrid.net/programs/open_source/licensing/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://secondlifegrid.net/programs/open_source/licensing/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. + * $/LicenseInfo$ + */ + +#include "linden_common.h" + +// We can't use WIN32_LEAN_AND_MEAN here, needs lots of includes. +#if LL_WINDOWS +# undef WIN32_LEAN_AND_MEAN +# include +# include +#endif + +#include "lldefs.h" +#include "llerror.h" + +#include "lluuid.h" +#include "llerror.h" +#include "llrand.h" +#include "llmd5.h" +#include "llstring.h" +#include "lltimer.h" + +const LLUUID LLUUID::null; +const LLTransactionID LLTransactionID::tnull; + +/* + +NOT DONE YET!!! + +static char BASE85_TABLE[] = { + '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', + 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', + 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', + 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', + 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', + 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', + 'y', 'z', '!', '#', '$', '%', '&', '(', ')', '*', + '+', '-', ';', '[', '=', '>', '?', '@', '^', '_', + '`', '{', '|', '}', '~', '\0' +}; + + +void encode( char * fiveChars, unsigned int word ) throw( ) +{ +for( int ix = 0; ix < 5; ++ix ) { +fiveChars[4-ix] = encodeTable[ word % 85]; +word /= 85; +} +} + +To decode: +unsigned int decode( char const * fiveChars ) throw( bad_input_data ) +{ +unsigned int ret = 0; +for( int ix = 0; ix < 5; ++ix ) { +char * s = strchr( encodeTable, fiveChars[ ix ] ); +if( s == 0 ) throw bad_input_data(); +ret = ret * 85 + (s-encodeTable); +} +return ret; +} + +void LLUUID::toBase85(char* out) +{ + U32* me = (U32*)&(mData[0]); + for(S32 i = 0; i < 4; ++i) + { + char* o = &out[i*i]; + for(S32 j = 0; j < 5; ++j) + { + o[4-j] = BASE85_TABLE[ me[i] % 85]; + word /= 85; + } + } +} + +unsigned int decode( char const * fiveChars ) throw( bad_input_data ) +{ + unsigned int ret = 0; + for( S32 ix = 0; ix < 5; ++ix ) + { + char * s = strchr( encodeTable, fiveChars[ ix ] ); + ret = ret * 85 + (s-encodeTable); + } + return ret; +} +*/ + +#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(std::string& out) const +{ + out = llformat( + "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x", + (U8)(mData[0]), + (U8)(mData[1]), + (U8)(mData[2]), + (U8)(mData[3]), + (U8)(mData[4]), + (U8)(mData[5]), + (U8)(mData[6]), + (U8)(mData[7]), + (U8)(mData[8]), + (U8)(mData[9]), + (U8)(mData[10]), + (U8)(mData[11]), + (U8)(mData[12]), + (U8)(mData[13]), + (U8)(mData[14]), + (U8)(mData[15])); +} + +// *TODO: deprecate +void LLUUID::toString(char *out) const +{ + std::string buffer; + toString(buffer); + strcpy(out,buffer.c_str()); /* Flawfinder: ignore */ +} + +void LLUUID::toCompressedString(std::string& out) const +{ + char bytes[UUID_BYTES+1]; + memcpy(bytes, mData, UUID_BYTES); /* Flawfinder: ignore */ + bytes[UUID_BYTES] = '\0'; + out.assign(bytes, UUID_BYTES); +} + +// *TODO: deprecate +void LLUUID::toCompressedString(char *out) const +{ + memcpy(out, mData, UUID_BYTES); /* Flawfinder: ignore */ + out[UUID_BYTES] = '\0'; +} + +std::string LLUUID::getString() const +{ + return asString(); +} + +std::string LLUUID::asString() const +{ + std::string str; + toString(str); + return str; +} + +BOOL LLUUID::set(const char* in_string, BOOL emit) +{ + return set(ll_safe_string(in_string)); +} + +BOOL LLUUID::set(const std::string& in_string, BOOL emit) +{ + BOOL broken_format = FALSE; + + // empty strings should make NULL uuid + if (in_string.empty()) + { + setNull(); + return TRUE; + } + + if (in_string.length() != (UUID_STR_LENGTH - 1)) /* Flawfinder: ignore */ + { + // I'm a moron. First implementation didn't have the right UUID format. + // Shouldn't see any of these any more + if (in_string.length() == (UUID_STR_LENGTH - 2)) /* Flawfinder: ignore */ + { + if(emit) + { + llinfos << "Warning! Using broken UUID string format" << llendl; + } + broken_format = TRUE; + } + else + { + // Bad UUID string. Spam as INFO, as most cases we don't care. + if(emit) + { + llinfos << "Bad UUID string: " << in_string << llendl; + } + setNull(); + return FALSE; + } + } + + U8 cur_pos = 0; + S32 i; + for (i = 0; i < UUID_BYTES; i++) + { + if ((i == 4) || (i == 6) || (i == 8) || (i == 10)) + { + cur_pos++; + if (broken_format && (i==10)) + { + // Missing - in the broken format + cur_pos--; + } + } + + mData[i] = 0; + + if ((in_string[cur_pos] >= '0') && (in_string[cur_pos] <= '9')) + { + mData[i] += (U8)(in_string[cur_pos] - '0'); + } + else if ((in_string[cur_pos] >= 'a') && (in_string[cur_pos] <='f')) + { + mData[i] += (U8)(10 + in_string[cur_pos] - 'a'); + } + else if ((in_string[cur_pos] >= 'A') && (in_string[cur_pos] <='F')) + { + mData[i] += (U8)(10 + in_string[cur_pos] - 'A'); + } + else + { + if(emit) + { + llwarns << "Invalid UUID string character" << llendl; + } + setNull(); + return FALSE; + } + + mData[i] = mData[i] << 4; + cur_pos++; + + if ((in_string[cur_pos] >= '0') && (in_string[cur_pos] <= '9')) + { + mData[i] += (U8)(in_string[cur_pos] - '0'); + } + else if ((in_string[cur_pos] >= 'a') && (in_string[cur_pos] <='f')) + { + mData[i] += (U8)(10 + in_string[cur_pos] - 'a'); + } + else if ((in_string[cur_pos] >= 'A') && (in_string[cur_pos] <='F')) + { + mData[i] += (U8)(10 + in_string[cur_pos] - 'A'); + } + else + { + if(emit) + { + llwarns << "Invalid UUID string character" << llendl; + } + setNull(); + return FALSE; + } + cur_pos++; + } + + return TRUE; +} + +BOOL LLUUID::validate(const std::string& in_string) +{ + BOOL broken_format = FALSE; + if (in_string.length() != (UUID_STR_LENGTH - 1)) /* Flawfinder: ignore */ + { + // I'm a moron. First implementation didn't have the right UUID format. + if (in_string.length() == (UUID_STR_LENGTH - 2)) /* Flawfinder: ignore */ + { + broken_format = TRUE; + } + else + { + return FALSE; + } + } + + U8 cur_pos = 0; + for (U32 i = 0; i < 16; i++) + { + if ((i == 4) || (i == 6) || (i == 8) || (i == 10)) + { + cur_pos++; + if (broken_format && (i==10)) + { + // Missing - in the broken format + cur_pos--; + } + } + + if ((in_string[cur_pos] >= '0') && (in_string[cur_pos] <= '9')) + { + } + else if ((in_string[cur_pos] >= 'a') && (in_string[cur_pos] <='f')) + { + } + else if ((in_string[cur_pos] >= 'A') && (in_string[cur_pos] <='F')) + { + } + else + { + return FALSE; + } + + cur_pos++; + + if ((in_string[cur_pos] >= '0') && (in_string[cur_pos] <= '9')) + { + } + else if ((in_string[cur_pos] >= 'a') && (in_string[cur_pos] <='f')) + { + } + else if ((in_string[cur_pos] >= 'A') && (in_string[cur_pos] <='F')) + { + } + else + { + return FALSE; + } + cur_pos++; + } + return TRUE; +} + +const LLUUID& LLUUID::operator^=(const LLUUID& rhs) +{ + U32* me = (U32*)&(mData[0]); + const U32* other = (U32*)&(rhs.mData[0]); + for(S32 i = 0; i < 4; ++i) + { + me[i] = me[i] ^ other[i]; + } + return *this; +} + +LLUUID LLUUID::operator^(const LLUUID& rhs) const +{ + LLUUID id(*this); + id ^= rhs; + return id; +} + +void LLUUID::combine(const LLUUID& other, LLUUID& result) const +{ + LLMD5 md5_uuid; + md5_uuid.update((unsigned char*)mData, 16); + md5_uuid.update((unsigned char*)other.mData, 16); + md5_uuid.finalize(); + md5_uuid.raw_digest(result.mData); +} + +LLUUID LLUUID::combine(const LLUUID &other) const +{ + LLUUID combination; + combine(other, combination); + return combination; +} + +std::ostream& operator<<(std::ostream& s, const LLUUID &uuid) +{ + std::string uuid_str; + uuid.toString(uuid_str); + s << uuid_str; + return s; +} + +std::istream& operator>>(std::istream &s, LLUUID &uuid) +{ + U32 i; + char uuid_str[UUID_STR_LENGTH]; /* Flawfinder: ignore */ + for (i = 0; i < UUID_STR_LENGTH-1; i++) + { + s >> uuid_str[i]; + } + uuid_str[i] = '\0'; + uuid.set(std::string(uuid_str)); + return s; +} + +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++) +#if LL_USE_JANKY_RANDOM_NUMBER_GENERATOR + *cp++ = janky_fast_random_bytes() & 0xFF; +#else + *cp++ = ll_rand() & 0xFF; +#endif + return; +} + +#if LL_WINDOWS +typedef struct _ASTAT_ +{ + ADAPTER_STATUS adapt; + NAME_BUFFER NameBuff [30]; +}ASTAT, * PASTAT; + +// static +S32 LLUUID::getNodeID(unsigned char * node_id) +{ + ASTAT Adapter; + NCB Ncb; + UCHAR uRetCode; + LANA_ENUM lenum; + int i; + int retval = 0; + + memset( &Ncb, 0, sizeof(Ncb) ); + Ncb.ncb_command = NCBENUM; + Ncb.ncb_buffer = (UCHAR *)&lenum; + Ncb.ncb_length = sizeof(lenum); + uRetCode = Netbios( &Ncb ); + // printf( "The NCBENUM return code is: 0x%x \n", uRetCode ); + + for(i=0; i < lenum.length ;i++) + { + memset( &Ncb, 0, sizeof(Ncb) ); + Ncb.ncb_command = NCBRESET; + Ncb.ncb_lana_num = lenum.lana[i]; + + uRetCode = Netbios( &Ncb ); + // printf( "The NCBRESET on LANA %d return code is: 0x%x \n", + // lenum.lana[i], uRetCode ); + + memset( &Ncb, 0, sizeof (Ncb) ); + Ncb.ncb_command = NCBASTAT; + Ncb.ncb_lana_num = lenum.lana[i]; + + strcpy( (char *)Ncb.ncb_callname, "* " ); /* Flawfinder: ignore */ + Ncb.ncb_buffer = (unsigned char *)&Adapter; + Ncb.ncb_length = sizeof(Adapter); + + uRetCode = Netbios( &Ncb ); +// printf( "The NCBASTAT on LANA %d return code is: 0x%x \n", +// lenum.lana[i], uRetCode ); + if ( uRetCode == 0 ) + { +// printf( "The Ethernet Number on LANA %d is: %02x%02x%02x%02x%02x%02x\n", +// lenum.lana[i], +// Adapter.adapt.adapter_address[0], +// Adapter.adapt.adapter_address[1], +// Adapter.adapt.adapter_address[2], +// Adapter.adapt.adapter_address[3], +// Adapter.adapt.adapter_address[4], +// Adapter.adapt.adapter_address[5] ); + memcpy(node_id,Adapter.adapt.adapter_address,6); /* Flawfinder: ignore */ + retval = 1; + + } + } + return retval; +} + +#elif LL_DARWIN +// Mac OS X version of the UUID generation code... +/* + * Get an ethernet hardware address, if we can find it... + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// static +S32 LLUUID::getNodeID(unsigned char *node_id) +{ + int i; + unsigned char *a = NULL; + struct ifaddrs *ifap, *ifa; + int rv; + S32 result = 0; + + if ((rv=getifaddrs(&ifap))==-1) + { + return -1; + } + if (ifap == NULL) + { + return -1; + } + + for (ifa = ifap; ifa != NULL; ifa = ifa->ifa_next) + { +// printf("Interface %s, address family %d, ", ifa->ifa_name, ifa->ifa_addr->sa_family); + for(i=0; i< ifa->ifa_addr->sa_len; i++) + { +// printf("%02X ", (unsigned char)ifa->ifa_addr->sa_data[i]); + } +// printf("\n"); + + if(ifa->ifa_addr->sa_family == AF_LINK) + { + // This is a link-level address + struct sockaddr_dl *lla = (struct sockaddr_dl *)ifa->ifa_addr; + +// printf("\tLink level address, type %02X\n", lla->sdl_type); + + if(lla->sdl_type == IFT_ETHER) + { + // Use the first ethernet MAC in the list. + // For some reason, the macro LLADDR() defined in net/if_dl.h doesn't expand correctly. This is what it would do. + a = (unsigned char *)&((lla)->sdl_data); + a += (lla)->sdl_nlen; + + if (!a[0] && !a[1] && !a[2] && !a[3] && !a[4] && !a[5]) + { + continue; + } + + if (node_id) + { + memcpy(node_id, a, 6); + result = 1; + } + + // We found one. + break; + } + } + } + freeifaddrs(ifap); + + return result; +} + +#else + +// Linux version of the UUID generation code... +/* + * Get the ethernet hardware address, if we can find it... + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#define HAVE_NETINET_IN_H +#ifdef HAVE_NETINET_IN_H +#include +#if LL_SOLARIS +#include +#elif !LL_DARWIN +#include +#endif +#endif + +// static +S32 LLUUID::getNodeID(unsigned char *node_id) +{ + int sd; + struct ifreq ifr, *ifrp; + struct ifconf ifc; + char buf[1024]; + int n, i; + unsigned char *a; + +/* + * BSD 4.4 defines the size of an ifreq to be + * max(sizeof(ifreq), sizeof(ifreq.ifr_name)+ifreq.ifr_addr.sa_len + * However, under earlier systems, sa_len isn't present, so the size is + * just sizeof(struct ifreq) + */ +#ifdef HAVE_SA_LEN +#ifndef max +#define max(a,b) ((a) > (b) ? (a) : (b)) +#endif +#define ifreq_size(i) max(sizeof(struct ifreq),\ + sizeof((i).ifr_name)+(i).ifr_addr.sa_len) +#else +#define ifreq_size(i) sizeof(struct ifreq) +#endif /* HAVE_SA_LEN*/ + + sd = socket(AF_INET, SOCK_DGRAM, IPPROTO_IP); + if (sd < 0) { + return -1; + } + memset(buf, 0, sizeof(buf)); + ifc.ifc_len = sizeof(buf); + ifc.ifc_buf = buf; + if (ioctl (sd, SIOCGIFCONF, (char *)&ifc) < 0) { + close(sd); + return -1; + } + n = ifc.ifc_len; + for (i = 0; i < n; i+= ifreq_size(*ifr) ) { + ifrp = (struct ifreq *)((char *) ifc.ifc_buf+i); + strncpy(ifr.ifr_name, ifrp->ifr_name, IFNAMSIZ); /* Flawfinder: ignore */ +#ifdef SIOCGIFHWADDR + if (ioctl(sd, SIOCGIFHWADDR, &ifr) < 0) + continue; + a = (unsigned char *) &ifr.ifr_hwaddr.sa_data; +#else +#ifdef SIOCGENADDR + if (ioctl(sd, SIOCGENADDR, &ifr) < 0) + continue; + a = (unsigned char *) ifr.ifr_enaddr; +#else + /* + * XXX we don't have a way of getting the hardware + * address + */ + close(sd); + return 0; +#endif /* SIOCGENADDR */ +#endif /* SIOCGIFHWADDR */ + if (!a[0] && !a[1] && !a[2] && !a[3] && !a[4] && !a[5]) + continue; + if (node_id) { + memcpy(node_id, a, 6); /* Flawfinder: ignore */ + close(sd); + return 1; + } + } + close(sd); + return 0; +} + +#endif + +S32 LLUUID::cmpTime(uuid_time_t *t1, uuid_time_t *t2) +{ + // Compare two time values. + + if (t1->high < t2->high) return -1; + if (t1->high > t2->high) return 1; + if (t1->low < t2->low) return -1; + if (t1->low > t2->low) return 1; + return 0; +} + +void LLUUID::getSystemTime(uuid_time_t *timestamp) +{ + // Get system time with 100ns precision. Time is since Oct 15, 1582. +#if LL_WINDOWS + ULARGE_INTEGER time; + GetSystemTimeAsFileTime((FILETIME *)&time); + // NT keeps time in FILETIME format which is 100ns ticks since + // Jan 1, 1601. UUIDs use time in 100ns ticks since Oct 15, 1582. + // The difference is 17 Days in Oct + 30 (Nov) + 31 (Dec) + // + 18 years and 5 leap days. + time.QuadPart += + (unsigned __int64) (1000*1000*10) // seconds + * (unsigned __int64) (60 * 60 * 24) // days + * (unsigned __int64) (17+30+31+365*18+5); // # of days + + timestamp->high = time.HighPart; + timestamp->low = time.LowPart; +#else + struct timeval tp; + gettimeofday(&tp, 0); + + // Offset between UUID formatted times and Unix formatted times. + // UUID UTC base time is October 15, 1582. + // Unix base time is January 1, 1970. + U64 uuid_time = ((U64)tp.tv_sec * 10000000) + (tp.tv_usec * 10) + + U64L(0x01B21DD213814000); + timestamp->high = (U32) (uuid_time >> 32); + timestamp->low = (U32) (uuid_time & 0xFFFFFFFF); +#endif +} + +void LLUUID::getCurrentTime(uuid_time_t *timestamp) +{ + // Get current time as 60 bit 100ns ticks since whenever. + // Compensate for the fact that real clock resolution is less + // than 100ns. + + const U32 uuids_per_tick = 1024; + + static uuid_time_t time_last; + static U32 uuids_this_tick; + static BOOL init = FALSE; + + if (!init) { + getSystemTime(&time_last); + uuids_this_tick = uuids_per_tick; + init = TRUE; + } + + uuid_time_t time_now = {0,0}; + + while (1) { + getSystemTime(&time_now); + + // if clock reading changed since last UUID generated + if (cmpTime(&time_last, &time_now)) { + // reset count of uuid's generated with this clock reading + uuids_this_tick = 0; + break; + } + if (uuids_this_tick < uuids_per_tick) { + uuids_this_tick++; + break; + } + // going too fast for our clock; spin + } + + time_last = time_now; + + if (uuids_this_tick != 0) { + if (time_now.low & 0x80000000) { + time_now.low += uuids_this_tick; + if (!(time_now.low & 0x80000000)) + time_now.high++; + } else + time_now.low += uuids_this_tick; + } + + timestamp->high = time_now.high; + timestamp->low = time_now.low; +} + +void LLUUID::generate() +{ + // Create a UUID. + uuid_time_t timestamp; + + static unsigned char node_id[6]; /* Flawfinder: ignore */ + static int has_init = 0; + + // 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) + { + get_random_bytes(node_id, 6); + /* + * Set multicast bit, to prevent conflicts + * with IEEE 802 addresses obtained from + * network cards + */ + node_id[0] |= 0x80; + } + + getCurrentTime(&time_last); +#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; + } + + // get current time + getCurrentTime(×tamp); + + // if clock went backward change clockseq + if (cmpTime(×tamp, &time_last) == -1) { + clock_seq = (clock_seq + 1) & 0x3FFF; + if (clock_seq == 0) clock_seq++; + } + + memcpy(mData+10, node_id, 6); /* Flawfinder: ignore */ + U32 tmp; + tmp = timestamp.low; + mData[3] = (unsigned char) tmp; + tmp >>= 8; + mData[2] = (unsigned char) tmp; + tmp >>= 8; + mData[1] = (unsigned char) tmp; + tmp >>= 8; + mData[0] = (unsigned char) tmp; + + tmp = (U16) timestamp.high; + mData[5] = (unsigned char) tmp; + tmp >>= 8; + mData[4] = (unsigned char) tmp; + + tmp = (timestamp.high >> 16) | 0x1000; + mData[7] = (unsigned char) tmp; + tmp >>= 8; + mData[6] = (unsigned char) tmp; + + tmp = clock_seq; + mData[9] = (unsigned char) tmp; + tmp >>= 8; + mData[8] = (unsigned char) tmp; + + LLMD5 md5_uuid; + + md5_uuid.update(mData,16); + md5_uuid.finalize(); + md5_uuid.raw_digest(mData); + + time_last = timestamp; +} + +void LLUUID::generate(const std::string& hash_string) +{ + LLMD5 md5_uuid((U8*)hash_string.c_str()); + md5_uuid.raw_digest(mData); +} + +U32 LLUUID::getRandomSeed() +{ + static unsigned char seed[16]; /* Flawfinder: ignore */ + + getNodeID(&seed[0]); + seed[6]='\0'; + seed[7]='\0'; + getSystemTime((uuid_time_t *)(&seed[8])); + + LLMD5 md5_seed; + + md5_seed.update(seed,16); + md5_seed.finalize(); + md5_seed.raw_digest(seed); + + return(*(U32 *)seed); +} + +BOOL LLUUID::parseUUID(const std::string& buf, LLUUID* value) +{ + if( buf.empty() || value == NULL) + { + return FALSE; + } + + std::string temp( buf ); + LLStringUtil::trim(temp); + if( LLUUID::validate( temp ) ) + { + value->set( temp ); + return TRUE; + } + return FALSE; +} + +LLAssetID LLTransactionID::makeAssetID(const LLUUID& session) const +{ + LLAssetID result; + if (isNull()) + { + result.setNull(); + } + else + { + combine(session, result); + } + return result; +} diff --git a/linden/indra/llcommon/lluuid.h b/linden/indra/llcommon/lluuid.h new file mode 100644 index 0000000..3b057fb --- /dev/null +++ b/linden/indra/llcommon/lluuid.h @@ -0,0 +1,331 @@ +/** + * @file lluuid.h + * + * $LicenseInfo:firstyear=2000&license=viewergpl$ + * + * Copyright (c) 2000-2008, Linden Research, Inc. + * + * Second Life Viewer Source Code + * 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://secondlifegrid.net/programs/open_source/licensing/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://secondlifegrid.net/programs/open_source/licensing/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. + * $/LicenseInfo$ + */ + +#ifndef LL_LLUUID_H +#define LL_LLUUID_H + +#include +#include +#include "stdtypes.h" + +const S32 UUID_BYTES = 16; +const S32 UUID_WORDS = 4; +const S32 UUID_STR_LENGTH = 37; // actually wrong, should be 36 and use size below +const S32 UUID_STR_SIZE = 37; +const S32 UUID_BASE85_LENGTH = 21; // including the trailing NULL. + +struct uuid_time_t { + U32 high; + U32 low; + }; + +class LLUUID +{ +public: + // + // CREATORS + // + LLUUID(); + explicit LLUUID(const char *in_string); // Convert from string. + explicit LLUUID(const std::string& in_string); // Convert from string. + LLUUID(const LLUUID &in); + LLUUID &operator=(const LLUUID &rhs); + + ~LLUUID(); + + // + // MANIPULATORS + // + void generate(); // Generate a new UUID + void generate(const std::string& stream); //Generate a new UUID based on hash of input stream + BOOL set(const char *in_string, BOOL emit = TRUE); // Convert from string, if emit is FALSE, do not emit warnings + BOOL set(const std::string& in_string, BOOL emit = TRUE); // Convert from string, if emit is FALSE, do not emit warnings + void setNull(); // Faster than setting to LLUUID::null. + + S32 cmpTime(uuid_time_t *t1, uuid_time_t *t2); + static void getSystemTime(uuid_time_t *timestamp); + void getCurrentTime(uuid_time_t *timestamp); + + // + // ACCESSORS + // + BOOL isNull() const; // Faster than comparing to LLUUID::null. + BOOL notNull() const; // Faster than comparing to LLUUID::null. + // JC: This is dangerous. It allows UUIDs to be cast automatically + // to integers, among other things. Use isNull() or notNull(). + // operator bool() const; + + // JC: These must return real bool's (not BOOLs) or else use of the STL + // will generate bool-to-int performance warnings. + bool operator==(const LLUUID &rhs) const; + bool operator!=(const LLUUID &rhs) const; + bool operator<(const LLUUID &rhs) const; + bool operator>(const LLUUID &rhs) const; + + // xor functions. Useful since any two random uuids xored together + // will yield a determinate third random unique id that can be + // used as a key in a single uuid that represents 2. + const LLUUID& operator^=(const LLUUID& rhs); + LLUUID operator^(const LLUUID& rhs) const; + + // similar to functions above, but not invertible + // yields a third random UUID that can be reproduced from the two inputs + // but which, given the result and one of the inputs can't be used to + // deduce the other input + LLUUID combine(const LLUUID& other) const; + void combine(const LLUUID& other, LLUUID& result) const; + + friend std::ostream& operator<<(std::ostream& s, const LLUUID &uuid); + friend std::istream& operator>>(std::istream& s, LLUUID &uuid); + + void toString(char *out) const; // Does not allocate memory, needs 36 characters (including \0) + void toString(std::string& out) const; + void toCompressedString(char *out) const; // Does not allocate memory, needs 17 characters (including \0) + void toCompressedString(std::string& out) const; + + std::string asString() const; + std::string getString() const; + + U16 getCRC16() const; + U32 getCRC32() const; + + static BOOL validate(const std::string& in_string); // Validate that the UUID string is legal. + + static const LLUUID null; + + static U32 getRandomSeed(); + static S32 getNodeID(unsigned char * node_id); + + static BOOL parseUUID(const std::string& buf, LLUUID* value); + + U8 mData[UUID_BYTES]; +}; + + +// Construct +inline LLUUID::LLUUID() +{ + setNull(); +} + + +// Faster than copying from memory +inline void LLUUID::setNull() +{ + U32 *word = (U32 *)mData; + word[0] = 0; + word[1] = 0; + word[2] = 0; + word[3] = 0; +} + + +// Compare +inline bool LLUUID::operator==(const LLUUID& rhs) const +{ + U32 *tmp = (U32 *)mData; + U32 *rhstmp = (U32 *)rhs.mData; + // Note: binary & to avoid branching + return + (tmp[0] == rhstmp[0]) & + (tmp[1] == rhstmp[1]) & + (tmp[2] == rhstmp[2]) & + (tmp[3] == rhstmp[3]); +} + + +inline bool LLUUID::operator!=(const LLUUID& rhs) const +{ + U32 *tmp = (U32 *)mData; + U32 *rhstmp = (U32 *)rhs.mData; + // Note: binary | to avoid branching + return + (tmp[0] != rhstmp[0]) | + (tmp[1] != rhstmp[1]) | + (tmp[2] != rhstmp[2]) | + (tmp[3] != rhstmp[3]); +} + +/* +// JC: This is dangerous. It allows UUIDs to be cast automatically +// to integers, among other things. Use isNull() or notNull(). +inline LLUUID::operator bool() const +{ + U32 *word = (U32 *)mData; + return (word[0] | word[1] | word[2] | word[3]) > 0; +} +*/ + +inline BOOL LLUUID::notNull() const +{ + U32 *word = (U32 *)mData; + return (word[0] | word[1] | word[2] | word[3]) > 0; +} + +// Faster than == LLUUID::null because doesn't require +// as much memory access. +inline BOOL LLUUID::isNull() const +{ + U32 *word = (U32 *)mData; + // If all bits are zero, return !0 == TRUE + return !(word[0] | word[1] | word[2] | word[3]); +} + +// Copy constructor +inline LLUUID::LLUUID(const LLUUID& rhs) +{ + U32 *tmp = (U32 *)mData; + U32 *rhstmp = (U32 *)rhs.mData; + tmp[0] = rhstmp[0]; + tmp[1] = rhstmp[1]; + tmp[2] = rhstmp[2]; + tmp[3] = rhstmp[3]; +} + +inline LLUUID::~LLUUID() +{ +} + +// Assignment +inline LLUUID& LLUUID::operator=(const LLUUID& rhs) +{ + // No need to check the case where this==&rhs. The branch is slower than the write. + U32 *tmp = (U32 *)mData; + U32 *rhstmp = (U32 *)rhs.mData; + tmp[0] = rhstmp[0]; + tmp[1] = rhstmp[1]; + tmp[2] = rhstmp[2]; + tmp[3] = rhstmp[3]; + + return *this; +} + + +inline LLUUID::LLUUID(const char *in_string) +{ + if (!in_string || in_string[0] == 0) + { + setNull(); + return; + } + + set(in_string); +} + +inline LLUUID::LLUUID(const std::string& in_string) +{ + if (in_string.empty()) + { + setNull(); + return; + } + + set(in_string); +} + +// IW: DON'T "optimize" these w/ U32s or you'll scoogie the sort order +// IW: this will make me very sad +inline bool LLUUID::operator<(const LLUUID &rhs) const +{ + U32 i; + for( i = 0; i < (UUID_BYTES - 1); i++ ) + { + if( mData[i] != rhs.mData[i] ) + { + return (mData[i] < rhs.mData[i]); + } + } + return (mData[UUID_BYTES - 1] < rhs.mData[UUID_BYTES - 1]); +} + +inline bool LLUUID::operator>(const LLUUID &rhs) const +{ + U32 i; + for( i = 0; i < (UUID_BYTES - 1); i++ ) + { + if( mData[i] != rhs.mData[i] ) + { + return (mData[i] > rhs.mData[i]); + } + } + return (mData[UUID_BYTES - 1] > rhs.mData[UUID_BYTES - 1]); +} + +inline U16 LLUUID::getCRC16() const +{ + // A UUID is 16 bytes, or 8 shorts. + U16 *short_data = (U16*)mData; + U16 out = 0; + out += short_data[0]; + out += short_data[1]; + out += short_data[2]; + out += short_data[3]; + out += short_data[4]; + out += short_data[5]; + out += short_data[6]; + out += short_data[7]; + return out; +} + +inline U32 LLUUID::getCRC32() const +{ + U32 *tmp = (U32*)mData; + return tmp[0] + tmp[1] + tmp[2] + tmp[3]; +} + + +// Helper structure for ordering lluuids in stl containers. +// eg: std::map widget_map; +struct lluuid_less +{ + bool operator()(const LLUUID& lhs, const LLUUID& rhs) const + { + return (lhs < rhs) ? true : false; + } +}; + +typedef std::set uuid_list_t; + +/* + * Sub-classes for keeping transaction IDs and asset IDs + * straight. + */ +typedef LLUUID LLAssetID; + +class LLTransactionID : public LLUUID +{ +public: + LLTransactionID() : LLUUID() { } + + static const LLTransactionID tnull; + LLAssetID makeAssetID(const LLUUID& session) const; +}; + +#endif diff --git a/linden/indra/llcommon/llversionserver.h b/linden/indra/llcommon/llversionserver.h index e3ceadf..0b88ce8 100644 --- a/linden/indra/llcommon/llversionserver.h +++ b/linden/indra/llcommon/llversionserver.h @@ -33,9 +33,9 @@ #define LL_LLVERSIONSERVER_H const S32 LL_VERSION_MAJOR = 1; -const S32 LL_VERSION_MINOR = 21; -const S32 LL_VERSION_PATCH = 1; -const S32 LL_VERSION_BUILD = 86526; +const S32 LL_VERSION_MINOR = 24; +const S32 LL_VERSION_PATCH = 0; +const S32 LL_VERSION_BUILD = 93453; const char * const LL_CHANNEL = "Second Life Server"; diff --git a/linden/indra/llcommon/llversionviewer.h b/linden/indra/llcommon/llversionviewer.h index 9b3cf80..4820f68 100644 --- a/linden/indra/llcommon/llversionviewer.h +++ b/linden/indra/llcommon/llversionviewer.h @@ -33,8 +33,8 @@ #define LL_LLVERSIONVIEWER_H const S32 LL_VERSION_MAJOR = 1; -const S32 LL_VERSION_MINOR = 20; -const S32 LL_VERSION_PATCH = 15; +const S32 LL_VERSION_MINOR = 21; +const S32 LL_VERSION_PATCH = 0; const S32 LL_VERSION_BUILD = 0; const char * const LL_CHANNEL = "Second Life Release"; diff --git a/linden/indra/llcommon/metapropertyt.h b/linden/indra/llcommon/metapropertyt.h index 5c25ec4..73c2a7a 100644 --- a/linden/indra/llcommon/metapropertyt.h +++ b/linden/indra/llcommon/metapropertyt.h @@ -86,13 +86,6 @@ inline const LLReflective* LLMetaPropertyT::get(const LLReflective* } template <> -inline const LLReflective* LLMetaPropertyT::get(const LLReflective* object) const -{ - checkObjectClass(object); - return NULL; -} - -template <> inline const LLReflective* LLMetaPropertyT::get(const LLReflective* object) const { checkObjectClass(object); @@ -112,12 +105,6 @@ inline LLSD LLMetaPropertyT::getLLSD(const LLReflective* object) co } template <> -inline LLSD LLMetaPropertyT::getLLSD(const LLReflective* object) const -{ - return *(getProperty(object)); -} - -template <> inline LLSD LLMetaPropertyT::getLLSD(const LLReflective* object) const { return *(getProperty(object)); diff --git a/linden/indra/llcommon/roles_constants.h b/linden/indra/llcommon/roles_constants.h index 956a9de..ee2986b 100644 --- a/linden/indra/llcommon/roles_constants.h +++ b/linden/indra/llcommon/roles_constants.h @@ -143,11 +143,18 @@ const U64 GP_NOTICES_RECEIVE = 0x1LL << 43; // Receive Notices and View Notice const U64 GP_PROPOSAL_START = 0x1LL << 44; // Start Proposal const U64 GP_PROPOSAL_VOTE = 0x1LL << 45; // Vote on Proposal +// Group chat moderation related +const U64 GP_SESSION_JOIN = 0x1LL << 16; //can join session +const U64 GP_SESSION_VOICE = 0x1LL << 27; //can hear/talk +const U64 GP_SESSION_MODERATOR = 0x1LL << 37; //can mute people's session + const U64 GP_DEFAULT_MEMBER = GP_ACCOUNTING_ACCOUNTABLE | GP_LAND_ALLOW_SET_HOME | GP_NOTICES_RECEIVE | GP_PROPOSAL_START | GP_PROPOSAL_VOTE + | GP_SESSION_JOIN + | GP_SESSION_VOICE ; const U64 GP_DEFAULT_OFFICER = GP_ACCOUNTING_ACCOUNTABLE @@ -188,5 +195,8 @@ const U64 GP_DEFAULT_OFFICER = GP_ACCOUNTING_ACCOUNTABLE | GP_PROPOSAL_VOTE | GP_ROLE_ASSIGN_MEMBER_LIMITED | GP_ROLE_PROPERTIES + | GP_SESSION_MODERATOR + | GP_SESSION_JOIN + | GP_SESSION_VOICE ; #endif diff --git a/linden/indra/llcommon/stdtypes.h b/linden/indra/llcommon/stdtypes.h index c1f5303..44f67f2 100644 --- a/linden/indra/llcommon/stdtypes.h +++ b/linden/indra/llcommon/stdtypes.h @@ -31,6 +31,8 @@ #ifndef LL_STDTYPES_H #define LL_STDTYPES_H +#include + typedef signed char S8; typedef unsigned char U8; typedef signed short S16; diff --git a/linden/indra/llcommon/u64.cpp b/linden/indra/llcommon/u64.cpp index bbeed9f..5aebdb3 100644 --- a/linden/indra/llcommon/u64.cpp +++ b/linden/indra/llcommon/u64.cpp @@ -34,10 +34,10 @@ #include "u64.h" -U64 str_to_U64(const char *str) +U64 str_to_U64(const std::string& str) { U64 result = 0; - const char *aptr = strpbrk(str,"0123456789"); + const char *aptr = strpbrk(str.c_str(),"0123456789"); if (!aptr) { @@ -54,8 +54,9 @@ U64 str_to_U64(const char *str) } -char* U64_to_str(U64 value, char* result, S32 result_size) -{ +std::string U64_to_str(U64 value) +{ + std::string res; U32 part1,part2,part3; part3 = (U32)(value % (U64)10000000); @@ -70,31 +71,26 @@ char* U64_to_str(U64 value, char* result, S32 result_size) if (part1) { - snprintf( /* Flawfinder: ignore */ - result, - result_size, - "%u%07u%07u", - part1,part2,part3); + res = llformat("%u%07u%07u",part1,part2,part3); } else if (part2) { - snprintf( /* Flawfinder: ignore */ - result, - result_size, - "%u%07u", - part2,part3); + res = llformat("%u%07u",part2,part3); } else { - snprintf( /* Flawfinder: ignore */ - result, - result_size, - "%u", - part3); + res = llformat("%u",part3); } - return (result); + return res; } +char* U64_to_str(U64 value, char* result, S32 result_size) +{ + std::string res = U64_to_str(value); + LLStringUtil::copy(result, res.c_str(), result_size); + return result; +} + F64 U64_to_F64(const U64 value) { S64 top_bits = (S64)(value >> 1); diff --git a/linden/indra/llcommon/u64.h b/linden/indra/llcommon/u64.h index ab06836..3d45fc3 100644 --- a/linden/indra/llcommon/u64.h +++ b/linden/indra/llcommon/u64.h @@ -38,7 +38,14 @@ * @param str The string to parse. * @return Returns the first U64 value found in the string or 0 on failure. */ -U64 str_to_U64(const char* str); +U64 str_to_U64(const std::string& str); + +/** + * @brief Given a U64 value, return a printable representation. + * @param value The U64 to turn into a printable character array. + * @return Returns the result string. + */ +std::string U64_to_str(U64 value); /** * @brief Given a U64 value, return a printable representation. diff --git a/linden/indra/llcrashlogger/CMakeLists.txt b/linden/indra/llcrashlogger/CMakeLists.txt new file mode 100644 index 0000000..b2639ae --- /dev/null +++ b/linden/indra/llcrashlogger/CMakeLists.txt @@ -0,0 +1,35 @@ +# -*- cmake -*- + +project(llcrashlogger) + +include(00-Common) +include(LLCommon) +include(LLMath) +include(LLMessage) +include(LLVFS) +include(LLXML) + +include_directories( + ${LLCOMMON_INCLUDE_DIRS} + ${LLMATH_INCLUDE_DIRS} + ${LLMESSAGE_INCLUDE_DIRS} + ${LLVFS_INCLUDE_DIRS} + ${LLXML_INCLUDE_DIRS} + ) + +set(llcrashlogger_SOURCE_FILES + llcrashlogger.cpp + ) + +set(llcrashlogger_HEADER_FILES + CMakeLists.txt + + llcrashlogger.h + ) + +set_source_files_properties(${llcrashlogger_HEADER_FILES} + PROPERTIES HEADER_FILE_ONLY TRUE) + +list(APPEND llcrashlogger_SOURCE_FILES ${llcrashlogger_HEADER_FILES}) + +add_library(llcrashlogger ${llcrashlogger_SOURCE_FILES}) diff --git a/linden/indra/llcrashlogger/files.lst b/linden/indra/llcrashlogger/files.lst deleted file mode 100644 index d976a60..0000000 --- a/linden/indra/llcrashlogger/files.lst +++ /dev/null @@ -1 +0,0 @@ -llcrashlogger/llcrashlogger.cpp \ No newline at end of file diff --git a/linden/indra/llcrashlogger/llcrashlogger.cpp b/linden/indra/llcrashlogger/llcrashlogger.cpp index 306046a..57fa33b 100755 --- a/linden/indra/llcrashlogger/llcrashlogger.cpp +++ b/linden/indra/llcrashlogger/llcrashlogger.cpp @@ -76,7 +76,7 @@ bool LLCrashLoggerText::mainLoop() return true; } -void LLCrashLoggerText::updateApplication(LLString message) +void LLCrashLoggerText::updateApplication(const std::string& message) { LLCrashLogger::updateApplication(message); std::cout << message << std::endl; @@ -147,10 +147,8 @@ void LLCrashLogger::gatherFiles() updateApplication("Gathering logs..."); // Figure out the filename of the debug log - std::string db_file_name = gDirUtilp->getExpandedFilename( - LL_PATH_LOGS, - "debug_info.log"); - llifstream debug_log_file(db_file_name.c_str()); + std::string db_file_name = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,"debug_info.log"); + std::ifstream debug_log_file(db_file_name.c_str()); // Look for it in the debug_info.log file if (debug_log_file.is_open()) @@ -191,7 +189,7 @@ void LLCrashLogger::gatherFiles() { // This is a 'little' hacky, but its the best simple solution. std::string grid_host = mDebugLog["GridName"].asString(); - LLString::toLower(grid_host); + LLStringUtil::toLower(grid_host); mCrashHost = "https://login."; mCrashHost += grid_host; @@ -207,12 +205,12 @@ void LLCrashLogger::gatherFiles() updateApplication("Encoding files..."); - for(std::map::iterator itr = mFileMap.begin(); itr != mFileMap.end(); ++itr) + for(std::map::iterator itr = mFileMap.begin(); itr != mFileMap.end(); ++itr) { std::ifstream f((*itr).second.c_str()); if(!f.is_open()) { - std::cout << "Can't find file " << (*itr).second.c_str() << std::endl; + std::cout << "Can't find file " << (*itr).second << std::endl; continue; } std::stringstream s; @@ -265,10 +263,10 @@ bool LLCrashLogger::saveCrashBehaviorSetting(S32 crash_behavior) return true; } -bool LLCrashLogger::runCrashLogPost(LLString host, LLSD data, LLString msg, int retries, int timeout) +bool LLCrashLogger::runCrashLogPost(std::string host, LLSD data, std::string msg, int retries, int timeout) { gBreak = false; - LLString status_message; + std::string status_message; for(int i = 0; i < retries; ++i) { status_message = llformat("%s, try %d...", msg.c_str(), i+1); @@ -304,14 +302,15 @@ bool LLCrashLogger::sendCrashLogs() bool sent = false; + //*TODO: Translate if(mCrashHost != "") { - sent = runCrashLogPost(mCrashHost, post_data, "Sending to server", 3, 5); + sent = runCrashLogPost(mCrashHost, post_data, std::string("Sending to server"), 3, 5); } if(!sent) { - sent = runCrashLogPost(mAltCrashHost, post_data, "Sending to alternate server", 3, 5); + sent = runCrashLogPost(mAltCrashHost, post_data, std::string("Sending to alternate server"), 3, 5); } mSentCrashLogs = sent; @@ -319,7 +318,7 @@ bool LLCrashLogger::sendCrashLogs() return true; } -void LLCrashLogger::updateApplication(LLString message) +void LLCrashLogger::updateApplication(const std::string& message) { gServicePump->pump(); gServicePump->callback(); @@ -372,7 +371,7 @@ bool LLCrashLogger::init() //If we've opened the crash logger, assume we can delete the marker file if it exists if( gDirUtilp ) { - LLString marker_file = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,"SecondLife.exec_marker"); + std::string marker_file = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,"SecondLife.exec_marker"); ll_apr_file_remove( marker_file ); } diff --git a/linden/indra/llcrashlogger/llcrashlogger.h b/linden/indra/llcrashlogger/llcrashlogger.h index bf51e71..f8f7de7 100755 --- a/linden/indra/llcrashlogger/llcrashlogger.h +++ b/linden/indra/llcrashlogger/llcrashlogger.h @@ -50,23 +50,23 @@ public: bool saveCrashBehaviorSetting(S32 crash_behavior); bool sendCrashLogs(); LLSD constructPostData(); - virtual void updateApplication(LLString message = ""); + virtual void updateApplication(const std::string& message = LLStringUtil::null); virtual bool init(); virtual bool mainLoop() = 0; virtual bool cleanup() { return true; } - void setUserText(LLString& text) { mCrashInfo["UserNotes"] = text; } + void setUserText(const std::string& text) { mCrashInfo["UserNotes"] = text; } S32 getCrashBehavior() { return mCrashBehavior; } - bool runCrashLogPost(LLString host, LLSD data, LLString msg, int retries, int timeout); + bool runCrashLogPost(std::string host, LLSD data, std::string msg, int retries, int timeout); protected: S32 mCrashBehavior; BOOL mCrashInPreviousExec; - std::map mFileMap; - LLString mGridName; + std::map mFileMap; + std::string mGridName; LLControlGroup mCrashSettings; - LLString mProductName; + std::string mProductName; LLSD mCrashInfo; - LLString mCrashHost; - LLString mAltCrashHost; + std::string mCrashHost; + std::string mAltCrashHost; LLSD mDebugLog; bool mSentCrashLogs; }; @@ -78,7 +78,7 @@ public: ~LLCrashLoggerText(void) {} virtual bool mainLoop(); - virtual void updateApplication(LLString message = ""); + virtual void updateApplication(const std::string& message = LLStringUtil::null); }; diff --git a/linden/indra/llimage/CMakeLists.txt b/linden/indra/llimage/CMakeLists.txt new file mode 100644 index 0000000..5593b4a --- /dev/null +++ b/linden/indra/llimage/CMakeLists.txt @@ -0,0 +1,50 @@ +# -*- cmake -*- + +project(llimage) + +include(00-Common) +include(LLCommon) +include(LLImage) +include(LLMath) +include(LLVFS) + +include_directories( + ${LLCOMMON_INCLUDE_DIRS} + ${LLMATH_INCLUDE_DIRS} + ${LLVFS_INCLUDE_DIRS} + ${PNG_INCLUDE_DIRS} + ) + +set(llimage_SOURCE_FILES + llimagebmp.cpp + llimage.cpp + llimagedxt.cpp + llimagej2c.cpp + llimagejpeg.cpp + llimagepng.cpp + llimagetga.cpp + llimageworker.cpp + llpngwrapper.cpp + ) + +set(llimage_HEADER_FILES + CMakeLists.txt + + llimage.h + llimagebmp.h + llimagedxt.h + llimagej2c.h + llimagejpeg.h + llimagepng.h + llimagetga.h + llimageworker.h + llmapimagetype.h + llpngwrapper.h + ) + +set_source_files_properties(${llimage_HEADER_FILES} + PROPERTIES HEADER_FILE_ONLY TRUE) + +list(APPEND llimage_SOURCE_FILES ${llimage_HEADER_FILES}) + +add_library (llimage ${llimage_SOURCE_FILES}) diff --git a/linden/indra/llimage/files.lst b/linden/indra/llimage/files.lst deleted file mode 100644 index a6ac342..0000000 --- a/linden/indra/llimage/files.lst +++ /dev/null @@ -1,9 +0,0 @@ -llimage/llimagebmp.cpp -llimage/llimage.cpp -llimage/llimagedxt.cpp -llimage/llimagej2c.cpp -llimage/llimagejpeg.cpp -llimage/llimagepng.cpp -llimage/llimagetga.cpp -llimage/llimageworker.cpp -llimage/llpngwrapper.cpp diff --git a/linden/indra/llimage/llimage.cpp b/linden/indra/llimage/llimage.cpp index 52a210f..814e82f 100644 --- a/linden/indra/llimage/llimage.cpp +++ b/linden/indra/llimage/llimage.cpp @@ -40,9 +40,7 @@ #include "llimagebmp.h" #include "llimagetga.h" #include "llimagej2c.h" -#if JPEG_SUPPORT #include "llimagejpeg.h" -#endif #include "llimagepng.h" #include "llimagedxt.h" @@ -97,15 +95,15 @@ void LLImageBase::sanityCheck() } } -LLString LLImageBase::sLastErrorMessage; +std::string LLImageBase::sLastErrorMessage; BOOL LLImageBase::sSizeOverride = FALSE; -BOOL LLImageBase::setLastError(const LLString& message, const LLString& filename) +BOOL LLImageBase::setLastError(const std::string& message, const std::string& filename) { sLastErrorMessage = message; - if (filename != "") + if (!filename.empty()) { - sLastErrorMessage += LLString(" FILE:"); + sLastErrorMessage += " FILE:"; sLastErrorMessage += filename; } llwarns << sLastErrorMessage << llendl; @@ -251,7 +249,7 @@ LLImageRaw::LLImageRaw(U8 *data, U16 width, U16 height, S8 components) ++sRawImageCount; } -LLImageRaw::LLImageRaw(const LLString &filename, bool j2c_lowest_mip_only) +LLImageRaw::LLImageRaw(const std::string& filename, bool j2c_lowest_mip_only) : LLImageBase() { createFromFile(filename, j2c_lowest_mip_only); @@ -1112,25 +1110,25 @@ file_extensions[] = }; #define NUM_FILE_EXTENSIONS sizeof(file_extensions)/sizeof(file_extensions[0]) -static LLString find_file(LLString &name, S8 *codec) +static std::string find_file(std::string &name, S8 *codec) { - LLString tname; + std::string tname; for (int i=0; i<(int)(NUM_FILE_EXTENSIONS); i++) { - tname = name + "." + LLString(file_extensions[i].exten); - llifstream ifs(tname.c_str(), llifstream::binary); + tname = name + "." + std::string(file_extensions[i].exten); + llifstream ifs(tname, llifstream::binary); if (ifs.is_open()) { ifs.close(); if (codec) *codec = file_extensions[i].codec; - return LLString(file_extensions[i].exten); + return std::string(file_extensions[i].exten); } } - return LLString(""); + return std::string(""); } -EImageCodec LLImageBase::getCodecFromExtension(const LLString& exten) +EImageCodec LLImageBase::getCodecFromExtension(const std::string& exten) { for (int i=0; i<(int)(NUM_FILE_EXTENSIONS); i++) { @@ -1140,19 +1138,19 @@ EImageCodec LLImageBase::getCodecFromExtension(const LLString& exten) return IMG_CODEC_INVALID; } -bool LLImageRaw::createFromFile(const LLString &filename, bool j2c_lowest_mip_only) +bool LLImageRaw::createFromFile(const std::string &filename, bool j2c_lowest_mip_only) { - LLString name = filename; + std::string name = filename; size_t dotidx = name.rfind('.'); S8 codec = IMG_CODEC_INVALID; - LLString exten; + std::string exten; deleteData(); // delete any existing data - if (dotidx != LLString::npos) + if (dotidx != std::string::npos) { exten = name.substr(dotidx+1); - LLString::toLower(exten); + LLStringUtil::toLower(exten); codec = getCodecFromExtension(exten); } else @@ -1165,7 +1163,7 @@ bool LLImageRaw::createFromFile(const LLString &filename, bool j2c_lowest_mip_on return false; // format not recognized } - llifstream ifs(name.c_str(), llifstream::binary); + llifstream ifs(name, llifstream::binary); if (!ifs.is_open()) { // SJB: changed from llinfos to lldebugs to reduce spam @@ -1197,11 +1195,9 @@ bool LLImageRaw::createFromFile(const LLString &filename, bool j2c_lowest_mip_on case IMG_CODEC_TGA: image = new LLImageTGA(); break; -#if JPEG_SUPPORT case IMG_CODEC_JPEG: image = new LLImageJPEG(); break; -#endif case IMG_CODEC_J2C: image = new LLImageJ2C(); break; @@ -1285,20 +1281,18 @@ LLImageFormatted* LLImageFormatted::createFromType(S8 codec) case IMG_CODEC_TGA: image = new LLImageTGA(); break; -#if JPEG_SUPPORT case IMG_CODEC_JPEG: image = new LLImageJPEG(); break; -#endif + case IMG_CODEC_PNG: + image = new LLImagePNG(); + break; case IMG_CODEC_J2C: image = new LLImageJ2C(); break; case IMG_CODEC_DXT: image = new LLImageDXT(); break; - case IMG_CODEC_PNG: - image = new LLImagePNG(); - break; default: image = NULL; break; @@ -1307,11 +1301,11 @@ LLImageFormatted* LLImageFormatted::createFromType(S8 codec) } // static -LLImageFormatted* LLImageFormatted::createFromExtension(const LLString& instring) +LLImageFormatted* LLImageFormatted::createFromExtension(const std::string& instring) { - LLString exten; + std::string exten; size_t dotidx = instring.rfind('.'); - if (dotidx != LLString::npos) + if (dotidx != std::string::npos) { exten = instring.substr(dotidx+1); } @@ -1468,7 +1462,7 @@ void LLImageFormatted::appendData(U8 *data, S32 size) //---------------------------------------------------------------------------- -BOOL LLImageFormatted::load(const LLString &filename) +BOOL LLImageFormatted::load(const std::string &filename) { resetLastError(); @@ -1505,14 +1499,14 @@ BOOL LLImageFormatted::load(const LLString &filename) return res; } -BOOL LLImageFormatted::save(const LLString &filename) +BOOL LLImageFormatted::save(const std::string &filename) { resetLastError(); apr_file_t* apr_file = ll_apr_file_open(filename, LL_APR_WB); if (!apr_file) { - setLastError("Unable to open file for reading", filename); + setLastError("Unable to open file for writing", filename); return FALSE; } diff --git a/linden/indra/llimage/llimage.h b/linden/indra/llimage/llimage.h index 0d97595..98a98c2 100644 --- a/linden/indra/llimage/llimage.h +++ b/linden/indra/llimage/llimage.h @@ -113,9 +113,9 @@ protected: void setDataAndSize(U8 *data, S32 size) { mData = data; mDataSize = size; }; public: - static const LLString& getLastError() {return sLastErrorMessage;}; - static void resetLastError() {sLastErrorMessage = LLString("No Error"); }; - static BOOL setLastError(const LLString& message, const LLString& filename = LLString()); // returns FALSE + static const std::string& getLastError() {return sLastErrorMessage;}; + static void resetLastError() {sLastErrorMessage = "No Error"; }; + static BOOL setLastError(const std::string& message, const std::string& filename = std::string()); // returns FALSE static void generateMip(const U8 *indata, U8* mipdata, int width, int height, S32 nchannels); @@ -125,7 +125,7 @@ public: static void setSizeOverride(BOOL enabled) { sSizeOverride = enabled; } - static EImageCodec getCodecFromExtension(const LLString& exten); + static EImageCodec getCodecFromExtension(const std::string& exten); private: U8 *mData; @@ -141,7 +141,7 @@ private: public: S16 mMemType; // debug - static LLString sLastErrorMessage; + static std::string sLastErrorMessage; static BOOL sSizeOverride; }; @@ -157,7 +157,7 @@ public: LLImageRaw(U16 width, U16 height, S8 components); LLImageRaw(U8 *data, U16 width, U16 height, S8 components); // Construct using createFromFile (used by tools) - LLImageRaw(const LLString& filename, bool j2c_lowest_mip_only = false); + LLImageRaw(const std::string& filename, bool j2c_lowest_mip_only = false); /*virtual*/ void deleteData(); /*virtual*/ U8* allocateData(S32 size = -1); @@ -218,7 +218,7 @@ public: protected: // Create an image from a local file (generally used in tools) - bool createFromFile(const LLString& filename, bool j2c_lowest_mip_only = false); + bool createFromFile(const std::string& filename, bool j2c_lowest_mip_only = false); void copyLineScaled( U8* in, U8* out, S32 in_pixel_len, S32 out_pixel_len, S32 in_pixel_step, S32 out_pixel_step ); void compositeRowScaled4onto3( U8* in, U8* out, S32 in_pixel_len, S32 out_pixel_len ); @@ -236,7 +236,7 @@ class LLImageFormatted : public LLImageBase { public: static LLImageFormatted* createFromType(S8 codec); - static LLImageFormatted* createFromExtension(const LLString& instring); + static LLImageFormatted* createFromExtension(const std::string& instring); protected: /*virtual*/ ~LLImageFormatted(); @@ -255,6 +255,8 @@ public: // New methods public: + // subclasses must return a prefered file extension (lowercase without a leading dot) + virtual std::string getExtension() = 0; // calcHeaderSize() returns the maximum size of header; // 0 indicates we don't know have a header and have to lead the entire file virtual S32 calcHeaderSize() { return 0; }; @@ -265,8 +267,8 @@ public: // getRawDiscardLevel()by default returns mDiscardLevel, but may be overridden (LLImageJ2C) virtual S8 getRawDiscardLevel() { return mDiscardLevel; } - BOOL load(const LLString& filename); - BOOL save(const LLString& filename); + BOOL load(const std::string& filename); + BOOL save(const std::string& filename); virtual BOOL updateData() = 0; // pure virtual void setData(U8 *data, S32 size); diff --git a/linden/indra/llimage/llimage.vcproj b/linden/indra/llimage/llimage.vcproj deleted file mode 100644 index d6689ae..0000000 --- a/linden/indra/llimage/llimage.vcproj +++ /dev/null @@ -1,229 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/linden/indra/llimage/llimage_vc8.vcproj b/linden/indra/llimage/llimage_vc8.vcproj deleted file mode 100644 index 4265ea4..0000000 --- a/linden/indra/llimage/llimage_vc8.vcproj +++ /dev/null @@ -1,325 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/linden/indra/llimage/llimage_vc9.vcproj b/linden/indra/llimage/llimage_vc9.vcproj deleted file mode 100644 index 244bc78..0000000 --- a/linden/indra/llimage/llimage_vc9.vcproj +++ /dev/null @@ -1,326 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/linden/indra/llimage/llimagebmp.cpp b/linden/indra/llimage/llimagebmp.cpp index 8764dff..c72eb24 100644 --- a/linden/indra/llimage/llimagebmp.cpp +++ b/linden/indra/llimage/llimagebmp.cpp @@ -647,10 +647,10 @@ BOOL LLImageBMP::encode(const LLImageRaw* raw_image, F32 encode_time) break; } - for( S32 i = 0; i < alignment_bytes; i++ ) - { - *dst++ = 0; - } + } + for( S32 i = 0; i < alignment_bytes; i++ ) + { + *dst++ = 0; } } diff --git a/linden/indra/llimage/llimagebmp.h b/linden/indra/llimage/llimagebmp.h index 2b25c43..4a0d6fb 100644 --- a/linden/indra/llimage/llimagebmp.h +++ b/linden/indra/llimage/llimagebmp.h @@ -44,6 +44,7 @@ protected: public: LLImageBMP(); + /*virtual*/ std::string getExtension() { return std::string("bmp"); } /*virtual*/ BOOL updateData(); /*virtual*/ BOOL decode(LLImageRaw* raw_image, F32 decode_time); /*virtual*/ BOOL encode(const LLImageRaw* raw_image, F32 encode_time); diff --git a/linden/indra/llimage/llimagedxt.h b/linden/indra/llimage/llimagedxt.h index f144c21..a3cb4c7 100644 --- a/linden/indra/llimage/llimagedxt.h +++ b/linden/indra/llimage/llimagedxt.h @@ -102,6 +102,7 @@ private: public: LLImageDXT(); + /*virtual*/ std::string getExtension() { return std::string("dxt"); } /*virtual*/ BOOL updateData(); /*virtual*/ BOOL decode(LLImageRaw* raw_image, F32 decode_time); diff --git a/linden/indra/llimage/llimagej2c.cpp b/linden/indra/llimage/llimagej2c.cpp index 9de4d5f..510b303 100644 --- a/linden/indra/llimage/llimagej2c.cpp +++ b/linden/indra/llimage/llimagej2c.cpp @@ -29,8 +29,8 @@ */ #include "linden_common.h" -#include -#include +#include "apr_pools.h" +#include "apr_dso.h" #include "lldir.h" #include "llimagej2c.h" @@ -374,7 +374,7 @@ void LLImageJ2C::setReversible(const BOOL reversible) } -BOOL LLImageJ2C::loadAndValidate(const LLString &filename) +BOOL LLImageJ2C::loadAndValidate(const std::string &filename) { resetLastError(); diff --git a/linden/indra/llimage/llimagej2c.h b/linden/indra/llimage/llimagej2c.h index 7e02c98..2b4a3ec 100644 --- a/linden/indra/llimage/llimagej2c.h +++ b/linden/indra/llimage/llimagej2c.h @@ -45,6 +45,7 @@ public: LLImageJ2C(); // Base class overrides + /*virtual*/ std::string getExtension() { return std::string("j2c"); } /*virtual*/ BOOL updateData(); /*virtual*/ BOOL decode(LLImageRaw *raw_imagep, F32 decode_time); /*virtual*/ BOOL decodeChannels(LLImageRaw *raw_imagep, F32 decode_time, S32 first_channel, S32 max_channel_count); @@ -58,7 +59,7 @@ public: BOOL encode(const LLImageRaw *raw_imagep, const char* comment_text, F32 encode_time=0.0); BOOL validate(U8 *data, U32 file_size); - BOOL loadAndValidate(const LLString &filename); + BOOL loadAndValidate(const std::string &filename); // Encode accessors void setReversible(const BOOL reversible); // Use non-lossy? diff --git a/linden/indra/llimage/llimagejpeg.cpp b/linden/indra/llimage/llimagejpeg.cpp index 0ffa838..68529b6 100644 --- a/linden/indra/llimage/llimagejpeg.cpp +++ b/linden/indra/llimage/llimagejpeg.cpp @@ -35,12 +35,13 @@ #include "llerror.h" -LLImageJPEG::LLImageJPEG() +jmp_buf LLImageJPEG::sSetjmpBuffer ; +LLImageJPEG::LLImageJPEG(S32 quality) : LLImageFormatted(IMG_CODEC_JPEG), mOutputBuffer( NULL ), mOutputBufferSize( 0 ), - mEncodeQuality( 75 ) // on a scale from 1 to 100 + mEncodeQuality( quality ) // on a scale from 1 to 100 { } @@ -76,7 +77,16 @@ BOOL LLImageJPEG::updateData() jerr.error_exit = &LLImageJPEG::errorExit; // Error exit handler: does not return to caller jerr.emit_message = &LLImageJPEG::errorEmitMessage; // Conditionally emit a trace or warning message jerr.output_message = &LLImageJPEG::errorOutputMessage; // Routine that actually outputs a trace or error message - + + // + //try/catch will crash on Mac and Linux if LLImageJPEG::errorExit throws an error + //so as instead, we use setjmp/longjmp to avoid this crash, which is the best we can get. --bao + // + if(setjmp(sSetjmpBuffer)) + { + jpeg_destroy_decompress(&cinfo); + return FALSE; + } try { // Now we can initialize the JPEG decompression object. @@ -208,7 +218,15 @@ BOOL LLImageJPEG::decode(LLImageRaw* raw_image, F32 decode_time) jerr.emit_message = &LLImageJPEG::errorEmitMessage; // Conditionally emit a trace or warning message jerr.output_message = &LLImageJPEG::errorOutputMessage; // Routine that actually outputs a trace or error message - + // + //try/catch will crash on Mac and Linux if LLImageJPEG::errorExit throws an error + //so as instead, we use setjmp/longjmp to avoid this crash, which is the best we can get. --bao + // + if(setjmp(sSetjmpBuffer)) + { + jpeg_destroy_decompress(&cinfo); + return FALSE; + } try { // Now we can initialize the JPEG decompression object. @@ -402,7 +420,7 @@ void LLImageJPEG::errorExit( j_common_ptr cinfo ) jpeg_destroy(cinfo); // Return control to the setjmp point - throw 1; + longjmp(sSetjmpBuffer, 1) ; } // Decide whether to emit a trace or warning message. @@ -500,8 +518,11 @@ BOOL LLImageJPEG::encode( const LLImageRaw* raw_image, F32 encode_time ) jerr.emit_message = &LLImageJPEG::errorEmitMessage; // Conditionally emit a trace or warning message jerr.output_message = &LLImageJPEG::errorOutputMessage; // Routine that actually outputs a trace or error message - // Establish the setjmp return context mSetjmpBuffer. Used by library to abort. - if( setjmp(mSetjmpBuffer) ) + // + //try/catch will crash on Mac and Linux if LLImageJPEG::errorExit throws an error + //so as instead, we use setjmp/longjmp to avoid this crash, which is the best we can get. --bao + // + if( setjmp(sSetjmpBuffer) ) { // If we get here, the JPEG code has signaled an error. // We need to clean up the JPEG object, close the input file, and return. diff --git a/linden/indra/llimage/llimagejpeg.h b/linden/indra/llimage/llimagejpeg.h index a890bf4..79dc1a3 100644 --- a/linden/indra/llimage/llimagejpeg.h +++ b/linden/indra/llimage/llimagejpeg.h @@ -32,7 +32,7 @@ #ifndef LL_LLIMAGEJPEG_H #define LL_LLIMAGEJPEG_H -#include +#include #include "llimage.h" @@ -52,8 +52,9 @@ protected: virtual ~LLImageJPEG(); public: - LLImageJPEG(); + LLImageJPEG(S32 quality = 75); + /*virtual*/ std::string getExtension() { return std::string("jpg"); } /*virtual*/ BOOL updateData(); /*virtual*/ BOOL decode(LLImageRaw* raw_image, F32 decode_time); /*virtual*/ BOOL encode(const LLImageRaw* raw_image, F32 encode_time); @@ -83,8 +84,8 @@ protected: S32 mOutputBufferSize; // bytes in mOuputBuffer S32 mEncodeQuality; // on a scale from 1 to 100 - - jmp_buf mSetjmpBuffer; // To allow the library to abort. +private: + static jmp_buf sSetjmpBuffer; // To allow the library to abort. }; #endif // LL_LLIMAGEJPEG_H diff --git a/linden/indra/llimage/llimagepng.h b/linden/indra/llimage/llimagepng.h index 7ca59cf..9d45fb0 100644 --- a/linden/indra/llimage/llimagepng.h +++ b/linden/indra/llimage/llimagepng.h @@ -42,9 +42,10 @@ protected: public: LLImagePNG(); - BOOL updateData(); - BOOL decode(LLImageRaw* raw_image, F32 decode_time); - BOOL encode(const LLImageRaw* raw_image, F32 encode_time); + /*virtual*/ std::string getExtension() { return std::string("png"); } + /*virtual*/ BOOL updateData(); + /*virtual*/ BOOL decode(LLImageRaw* raw_image, F32 decode_time); + /*virtual*/ BOOL encode(const LLImageRaw* raw_image, F32 encode_time); private: U8* mTmpWriteBuffer; diff --git a/linden/indra/llimage/llimagetga.cpp b/linden/indra/llimage/llimagetga.cpp index bd03abb..32c2111 100644 --- a/linden/indra/llimage/llimagetga.cpp +++ b/linden/indra/llimage/llimagetga.cpp @@ -30,6 +30,7 @@ #include "linden_common.h" +#include "lldir.h" #include "llimagetga.h" #include "llerror.h" #include "llmath.h" @@ -63,11 +64,34 @@ LLImageTGA::LLImageTGA() mColorMapStart( 0 ), mColorMapLength( 0 ), mColorMapBytesPerEntry( 0 ), - mIs15Bit( FALSE ) + mIs15Bit( FALSE ), + + mAttributeBits(0), + mColorMapDepth(0), + mColorMapIndexHi(0), + mColorMapIndexLo(0), + mColorMapLengthHi(0), + mColorMapLengthLo(0), + mColorMapType(0), + mDataOffset(0), + mHeightHi(0), + mHeightLo(0), + mIDLength(0), + mImageType(0), + mInterleave(0), + mOriginRightBit(0), + mOriginTopBit(0), + mPixelSize(0), + mWidthHi(0), + mWidthLo(0), + mXOffsetHi(0), + mXOffsetLo(0), + mYOffsetHi(0), + mYOffsetLo(0) { } -LLImageTGA::LLImageTGA(const LLString& file_name) +LLImageTGA::LLImageTGA(const std::string& file_name) : LLImageFormatted(IMG_CODEC_TGA), mColorMap( NULL ), mColorMapStart( 0 ), @@ -1113,7 +1137,7 @@ BOOL LLImageTGA::decodeAndProcess( LLImageRaw* raw_image, F32 domain, F32 weight } // Reads a .tga file and creates an LLImageTGA with its data. -bool LLImageTGA::loadFile( const LLString& path ) +bool LLImageTGA::loadFile( const std::string& path ) { S32 len = path.size(); if( len < 5 ) @@ -1121,14 +1145,13 @@ bool LLImageTGA::loadFile( const LLString& path ) return false; } - LLString extension = path.substr( len - 4, 4 ); - LLString::toLower(extension); - if( ".tga" != extension ) + std::string extension = gDirUtilp->getExtension(path); + if( "tga" != extension ) { return false; } - LLFILE* file = LLFile::fopen(path.c_str(), "rb"); /* Flawfinder: ignore */ + LLFILE* file = LLFile::fopen(path, "rb"); /* Flawfinder: ignore */ if( !file ) { llwarns << "Couldn't open file " << path << llendl; diff --git a/linden/indra/llimage/llimagetga.h b/linden/indra/llimage/llimagetga.h index 475ffed..385e086 100644 --- a/linden/indra/llimage/llimagetga.h +++ b/linden/indra/llimage/llimagetga.h @@ -43,8 +43,9 @@ protected: public: LLImageTGA(); - LLImageTGA(const LLString& file_name); + LLImageTGA(const std::string& file_name); + /*virtual*/ std::string getExtension() { return std::string("tga"); } /*virtual*/ BOOL updateData(); /*virtual*/ BOOL decode(LLImageRaw* raw_image, F32 decode_time=0.0); /*virtual*/ BOOL encode(const LLImageRaw* raw_image, F32 encode_time=0.0); @@ -70,7 +71,7 @@ private: void decodeColorMapPixel24(U8* dst, const U8* src); void decodeColorMapPixel32(U8* dst, const U8* src); - bool loadFile(const LLString& file_name); + bool loadFile(const std::string& file_name); private: // Class specific data diff --git a/linden/indra/llimage/llpngwrapper.cpp b/linden/indra/llimage/llpngwrapper.cpp index 0054adf..35b4ec3 100644 --- a/linden/indra/llimage/llpngwrapper.cpp +++ b/linden/indra/llimage/llpngwrapper.cpp @@ -42,17 +42,22 @@ LLPngWrapper::LLPngWrapper() : mReadPngPtr( NULL ), - mReadInfoPtr( NULL ), + mReadInfoPtr( NULL ), mWritePngPtr( NULL ), mWriteInfoPtr( NULL ), mRowPointers( NULL ), + mWidth( 0 ), + mHeight( 0 ), mBitDepth( 0 ), mColorType( 0 ), mChannels( 0 ), mInterlaceType( 0 ), mCompressionType( 0 ), mFilterMethod( 0 ), - mFinalSize( 0 ) + mFinalSize( 0 ), + mHasBKGD(false), + mBackgroundColor(), + mGamma(0.f) { } @@ -384,7 +389,7 @@ U32 LLPngWrapper::getFinalSize() } // Get last error message, if any -LLString LLPngWrapper::getErrorMessage() +const std::string& LLPngWrapper::getErrorMessage() { return mErrorMessage; } diff --git a/linden/indra/llimage/llpngwrapper.h b/linden/indra/llimage/llpngwrapper.h index b773b72..bd603c3 100644 --- a/linden/indra/llimage/llpngwrapper.h +++ b/linden/indra/llimage/llpngwrapper.h @@ -52,7 +52,7 @@ public: BOOL readPng(U8* src, LLImageRaw* rawImage, ImageInfo *infop = NULL); BOOL writePng(const LLImageRaw* rawImage, U8* dst); U32 getFinalSize(); - LLString getErrorMessage(); + const std::string& getErrorMessage(); protected: void normalizeImage(); @@ -93,12 +93,12 @@ private: U32 mFinalSize; - BOOL mHasBKGD; + bool mHasBKGD; png_color_16p mBackgroundColor; F64 mGamma; - LLString mErrorMessage; + std::string mErrorMessage; }; #endif diff --git a/linden/indra/llimagej2coj/CMakeLists.txt b/linden/indra/llimagej2coj/CMakeLists.txt new file mode 100644 index 0000000..ed3ff3c --- /dev/null +++ b/linden/indra/llimagej2coj/CMakeLists.txt @@ -0,0 +1,31 @@ +# -*- cmake -*- + +project(llimagej2coj) + +include(00-Common) +include(LLCommon) +include(LLImage) +include(OpenJPEG) + +include_directories( + ${LLCOMMON_INCLUDE_DIRS} + ${LLIMAGE_INCLUDE_DIRS} + ${OPENJPEG_INCLUDE_DIR} + ) + +set(llimagej2coj_SOURCE_FILES + llimagej2coj.cpp + ) + +set(llimagej2coj_HEADER_FILES + CMakeLists.txt + + llimagej2coj.h + ) + +set_source_files_properties(${llimagej2coj_HEADER_FILES} + PROPERTIES HEADER_FILE_ONLY TRUE) + +list(APPEND llimagej2coj_SOURCE_FILES ${llimagej2coj_HEADER_FILES}) + +add_library (llimagej2coj ${llimagej2coj_SOURCE_FILES}) diff --git a/linden/indra/llimagej2coj/files.lst b/linden/indra/llimagej2coj/files.lst deleted file mode 100644 index bbf359c..0000000 --- a/linden/indra/llimagej2coj/files.lst +++ /dev/null @@ -1 +0,0 @@ -llimagej2coj/llimagej2coj.cpp diff --git a/linden/indra/llimagej2coj/llimagej2coj.cpp b/linden/indra/llimagej2coj/llimagej2coj.cpp index 478cc84..983241c 100644 --- a/linden/indra/llimagej2coj/llimagej2coj.cpp +++ b/linden/indra/llimagej2coj/llimagej2coj.cpp @@ -33,7 +33,7 @@ #include "llimagej2coj.h" // this is defined so that we get static linking. -#include "openjpeg/openjpeg.h" +#include "openjpeg.h" #include "lltimer.h" #include "llmemory.h" @@ -268,12 +268,12 @@ BOOL LLImageJ2COJ::encodeImpl(LLImageJ2C &base, const LLImageRaw &raw_image, con if (!comment_text) { - parameters.cp_comment = ""; + parameters.cp_comment = (char *) ""; } else { // Awful hacky cast, too lazy to copy right now. - parameters.cp_comment = (char *)comment_text; + parameters.cp_comment = (char *) comment_text; } // diff --git a/linden/indra/llimagej2coj/llimagej2coj.vcproj b/linden/indra/llimagej2coj/llimagej2coj.vcproj deleted file mode 100755 index 637c81f..0000000 --- a/linden/indra/llimagej2coj/llimagej2coj.vcproj +++ /dev/null @@ -1,161 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/linden/indra/llinventory/CMakeLists.txt b/linden/indra/llinventory/CMakeLists.txt new file mode 100644 index 0000000..b70548a --- /dev/null +++ b/linden/indra/llinventory/CMakeLists.txt @@ -0,0 +1,56 @@ +# -*- cmake -*- + +project(llinventory) + +include(00-Common) +include(LLCommon) +include(LLMath) +include(LLMessage) +include(LLXML) + +include_directories( + ${LLCOMMON_INCLUDE_DIRS} + ${LLMATH_INCLUDE_DIRS} + ${LLMESSAGE_INCLUDE_DIRS} + ${LLXML_INCLUDE_DIRS} + ) + +set(llinventory_SOURCE_FILES + llcategory.cpp + lleconomy.cpp + llinventory.cpp + llinventorytype.cpp + lllandmark.cpp + llnotecard.cpp + llparcel.cpp + llpermissions.cpp + llsaleinfo.cpp + lltransactionflags.cpp + lluserrelations.cpp + ) + +set(llinventory_HEADER_FILES + CMakeLists.txt + + llcategory.h + lleconomy.h + llinventory.h + llinventorytype.h + lllandmark.h + llnotecard.h + llparcel.h + llparcelflags.h + llpermissions.h + llpermissionsflags.h + llsaleinfo.h + lltransactionflags.h + lltransactiontypes.h + lluserrelations.h + ) + +set_source_files_properties(${llinventory_HEADER_FILES} + PROPERTIES HEADER_FILE_ONLY TRUE) + +list(APPEND llinventory_SOURCE_FILES ${llinventory_HEADER_FILES}) + +add_library (llinventory ${llinventory_SOURCE_FILES}) diff --git a/linden/indra/llinventory/files.lst b/linden/indra/llinventory/files.lst deleted file mode 100644 index b918b06..0000000 --- a/linden/indra/llinventory/files.lst +++ /dev/null @@ -1,11 +0,0 @@ -llinventory/llcategory.cpp -llinventory/lleconomy.cpp -llinventory/llinventory.cpp -llinventory/llinventorytype.cpp -llinventory/lllandmark.cpp -llinventory/llnotecard.cpp -llinventory/llparcel.cpp -llinventory/llpermissions.cpp -llinventory/llsaleinfo.cpp -llinventory/lltransactionflags.cpp -llinventory/lluserrelations.cpp diff --git a/linden/indra/llinventory/llinventory.cpp b/linden/indra/llinventory/llinventory.cpp index 8cd0700..457a0cb 100644 --- a/linden/indra/llinventory/llinventory.cpp +++ b/linden/indra/llinventory/llinventory.cpp @@ -78,16 +78,16 @@ LLInventoryObject::LLInventoryObject( const LLUUID& uuid, const LLUUID& parent_uuid, LLAssetType::EType type, - const LLString& name) : + const std::string& name) : mUUID(uuid), mParentUUID(parent_uuid), mType(type), mName(name) { - LLString::replaceNonstandardASCII(mName, ' '); - LLString::replaceChar(mName, '|', ' '); - LLString::trim(mName); - LLString::truncate(mName, DB_INV_ITEM_NAME_STR_LEN); + LLStringUtil::replaceNonstandardASCII(mName, ' '); + LLStringUtil::replaceChar(mName, '|', ' '); + LLStringUtil::trim(mName); + LLStringUtil::truncate(mName, DB_INV_ITEM_NAME_STR_LEN); } LLInventoryObject::LLInventoryObject() : @@ -117,7 +117,7 @@ const LLUUID& LLInventoryObject::getParentUUID() const return mParentUUID; } -const LLString& LLInventoryObject::getName() const +const std::string& LLInventoryObject::getName() const { return mName; } @@ -132,13 +132,13 @@ void LLInventoryObject::setUUID(const LLUUID& new_uuid) mUUID = new_uuid; } -void LLInventoryObject::rename(const LLString& n) +void LLInventoryObject::rename(const std::string& n) { - LLString new_name(n); - LLString::replaceNonstandardASCII(new_name, ' '); - LLString::replaceChar(new_name, '|', ' '); - LLString::trim(new_name); - LLString::truncate(new_name, DB_INV_ITEM_NAME_STR_LEN); + std::string new_name(n); + LLStringUtil::replaceNonstandardASCII(new_name, ' '); + LLStringUtil::replaceChar(new_name, '|', ' '); + LLStringUtil::trim(new_name); + LLStringUtil::truncate(new_name, DB_INV_ITEM_NAME_STR_LEN); if( new_name != mName ) { @@ -201,10 +201,10 @@ BOOL LLInventoryObject::importLegacyStream(std::istream& input_stream) " %254s %254[^|]", keyword, valuestr); mName.assign(valuestr); - LLString::replaceNonstandardASCII(mName, ' '); - LLString::replaceChar(mName, '|', ' '); - LLString::trim(mName); - LLString::truncate(mName, DB_INV_ITEM_NAME_STR_LEN); + LLStringUtil::replaceNonstandardASCII(mName, ' '); + LLStringUtil::replaceChar(mName, '|', ' '); + LLStringUtil::trim(mName); + LLStringUtil::truncate(mName, DB_INV_ITEM_NAME_STR_LEN); } else { @@ -219,12 +219,12 @@ BOOL LLInventoryObject::importLegacyStream(std::istream& input_stream) // not sure whether exportLegacyStream(llofstream(fp)) would work, fp may need to get icramented... BOOL LLInventoryObject::exportFile(LLFILE* fp, BOOL) const { - char uuid_str[UUID_STR_LENGTH]; /* Flawfinder: ignore */ + std::string uuid_str; fprintf(fp, "\tinv_object\t0\n\t{\n"); mUUID.toString(uuid_str); - fprintf(fp, "\t\tobj_id\t%s\n", uuid_str); + fprintf(fp, "\t\tobj_id\t%s\n", uuid_str.c_str()); mParentUUID.toString(uuid_str); - fprintf(fp, "\t\tparent_id\t%s\n", uuid_str); + fprintf(fp, "\t\tparent_id\t%s\n", uuid_str.c_str()); fprintf(fp, "\t\ttype\t%s\n", LLAssetType::lookup(mType)); fprintf(fp, "\t\tname\t%s|\n", mName.c_str()); fprintf(fp,"\t}\n"); @@ -233,7 +233,7 @@ BOOL LLInventoryObject::exportFile(LLFILE* fp, BOOL) const BOOL LLInventoryObject::exportLegacyStream(std::ostream& output_stream, BOOL) const { - char uuid_str[UUID_STR_LENGTH]; /* Flawfinder: ignore */ + std::string uuid_str; output_stream << "\tinv_object\t0\n\t{\n"; mUUID.toString(uuid_str); output_stream << "\t\tobj_id\t" << uuid_str << "\n"; @@ -276,8 +276,8 @@ LLInventoryItem::LLInventoryItem( const LLUUID& asset_uuid, LLAssetType::EType type, LLInventoryType::EType inv_type, - const LLString& name, - const LLString& desc, + const std::string& name, + const std::string& desc, const LLSaleInfo& sale_info, U32 flags, S32 creation_date_utc) : @@ -290,8 +290,8 @@ LLInventoryItem::LLInventoryItem( mFlags(flags), mCreationDate(creation_date_utc) { - LLString::replaceNonstandardASCII(mDescription, ' '); - LLString::replaceChar(mDescription, '|', ' '); + LLStringUtil::replaceNonstandardASCII(mDescription, ' '); + LLStringUtil::replaceChar(mDescription, '|', ' '); } LLInventoryItem::LLInventoryItem() : @@ -359,12 +359,12 @@ void LLInventoryItem::setAssetUUID(const LLUUID& asset_id) } -const LLString& LLInventoryItem::getDescription() const +const std::string& LLInventoryItem::getDescription() const { return mDescription; } -S32 LLInventoryItem::getCreationDate() const +time_t LLInventoryItem::getCreationDate() const { return mCreationDate; } @@ -396,11 +396,11 @@ U32 LLInventoryItem::getCRC32() const } -void LLInventoryItem::setDescription(const LLString& d) +void LLInventoryItem::setDescription(const std::string& d) { - LLString new_desc(d); - LLString::replaceNonstandardASCII(new_desc, ' '); - LLString::replaceChar(new_desc, '|', ' '); + std::string new_desc(d); + LLStringUtil::replaceNonstandardASCII(new_desc, ' '); + LLStringUtil::replaceChar(new_desc, '|', ' '); if( new_desc != mDescription ) { mDescription = new_desc; @@ -422,7 +422,7 @@ void LLInventoryItem::setFlags(U32 flags) mFlags = flags; } -void LLInventoryItem::setCreationDate(S32 creation_date_utc) +void LLInventoryItem::setCreationDate(time_t creation_date_utc) { mCreationDate = creation_date_utc; } @@ -486,17 +486,15 @@ BOOL LLInventoryItem::unpackMessage(LLMessageSystem* msg, const char* block, S32 mSaleInfo.unpackMultiMessage(msg, block, block_num); - char name[DB_INV_ITEM_NAME_BUF_SIZE]; /* Flawfinder: ignore */ - msg->getStringFast(block, _PREHASH_Name, DB_INV_ITEM_NAME_BUF_SIZE, name, block_num); - mName.assign(name); - LLString::replaceNonstandardASCII(mName, ' '); + msg->getStringFast(block, _PREHASH_Name, mName, block_num); + LLStringUtil::replaceNonstandardASCII(mName, ' '); - char desc[DB_INV_ITEM_DESC_BUF_SIZE]; /* Flawfinder: ignore */ - msg->getStringFast(block, _PREHASH_Description, DB_INV_ITEM_DESC_BUF_SIZE, desc, block_num); - mDescription.assign(desc); - LLString::replaceNonstandardASCII(mDescription, ' '); + msg->getStringFast(block, _PREHASH_Description, mDescription, block_num); + LLStringUtil::replaceNonstandardASCII(mDescription, ' '); - msg->getS32(block, "CreationDate", mCreationDate, block_num); + S32 date; + msg->getS32(block, "CreationDate", date, block_num); + mCreationDate = date; U32 local_crc = getCRC32(); U32 remote_crc = 0; @@ -602,7 +600,7 @@ BOOL LLInventoryItem::importFile(LLFILE* fp) } else if(0 == strcmp("inv_type", keyword)) { - mInventoryType = LLInventoryType::lookup(valuestr); + mInventoryType = LLInventoryType::lookup(std::string(valuestr)); } else if(0 == strcmp("flags", keyword)) { @@ -624,8 +622,8 @@ BOOL LLInventoryItem::importFile(LLFILE* fp) } mName.assign(valuestr); - LLString::replaceNonstandardASCII(mName, ' '); - LLString::replaceChar(mName, '|', ' '); + LLStringUtil::replaceNonstandardASCII(mName, ' '); + LLStringUtil::replaceChar(mName, '|', ' '); } else if(0 == strcmp("desc", keyword)) { @@ -642,7 +640,7 @@ BOOL LLInventoryItem::importFile(LLFILE* fp) } mDescription.assign(valuestr); - LLString::replaceNonstandardASCII(mDescription, ' '); + LLStringUtil::replaceNonstandardASCII(mDescription, ' '); /* TODO -- ask Ian about this code const char *donkey = mDescription.c_str(); if (donkey[0] == '|') @@ -653,7 +651,9 @@ BOOL LLInventoryItem::importFile(LLFILE* fp) } else if(0 == strcmp("creation_date", keyword)) { - sscanf(valuestr, "%d", &mCreationDate); + S32 date; + sscanf(valuestr, "%d", &date); + mCreationDate = date; } else { @@ -676,12 +676,12 @@ BOOL LLInventoryItem::importFile(LLFILE* fp) BOOL LLInventoryItem::exportFile(LLFILE* fp, BOOL include_asset_key) const { - char uuid_str[UUID_STR_LENGTH]; /* Flawfinder: ignore */ + std::string uuid_str; fprintf(fp, "\tinv_item\t0\n\t{\n"); mUUID.toString(uuid_str); - fprintf(fp, "\t\titem_id\t%s\n", uuid_str); + fprintf(fp, "\t\titem_id\t%s\n", uuid_str.c_str()); mParentUUID.toString(uuid_str); - fprintf(fp, "\t\tparent_id\t%s\n", uuid_str); + fprintf(fp, "\t\tparent_id\t%s\n", uuid_str.c_str()); mPermissions.exportFile(fp); // Check for permissions to see the asset id, and if so write it @@ -693,7 +693,7 @@ BOOL LLInventoryItem::exportFile(LLFILE* fp, BOOL include_asset_key) const || (mAssetUUID.isNull())) { mAssetUUID.toString(uuid_str); - fprintf(fp, "\t\tasset_id\t%s\n", uuid_str); + fprintf(fp, "\t\tasset_id\t%s\n", uuid_str.c_str()); } else { @@ -701,13 +701,13 @@ BOOL LLInventoryItem::exportFile(LLFILE* fp, BOOL include_asset_key) const LLXORCipher cipher(MAGIC_ID.mData, UUID_BYTES); cipher.encrypt(shadow_id.mData, UUID_BYTES); shadow_id.toString(uuid_str); - fprintf(fp, "\t\tshadow_id\t%s\n", uuid_str); + fprintf(fp, "\t\tshadow_id\t%s\n", uuid_str.c_str()); } } else { LLUUID::null.toString(uuid_str); - fprintf(fp, "\t\tasset_id\t%s\n", uuid_str); + fprintf(fp, "\t\tasset_id\t%s\n", uuid_str.c_str()); } fprintf(fp, "\t\ttype\t%s\n", LLAssetType::lookup(mType)); const char* inv_type_str = LLInventoryType::lookup(mInventoryType); @@ -716,7 +716,7 @@ BOOL LLInventoryItem::exportFile(LLFILE* fp, BOOL include_asset_key) const mSaleInfo.exportFile(fp); fprintf(fp, "\t\tname\t%s|\n", mName.c_str()); fprintf(fp, "\t\tdesc\t%s|\n", mDescription.c_str()); - fprintf(fp, "\t\tcreation_date\t%d\n", mCreationDate); + fprintf(fp, "\t\tcreation_date\t%d\n", (S32) mCreationDate); fprintf(fp,"\t}\n"); return TRUE; } @@ -803,7 +803,7 @@ BOOL LLInventoryItem::importLegacyStream(std::istream& input_stream) } else if(0 == strcmp("inv_type", keyword)) { - mInventoryType = LLInventoryType::lookup(valuestr); + mInventoryType = LLInventoryType::lookup(std::string(valuestr)); } else if(0 == strcmp("flags", keyword)) { @@ -825,8 +825,8 @@ BOOL LLInventoryItem::importLegacyStream(std::istream& input_stream) } mName.assign(valuestr); - LLString::replaceNonstandardASCII(mName, ' '); - LLString::replaceChar(mName, '|', ' '); + LLStringUtil::replaceNonstandardASCII(mName, ' '); + LLStringUtil::replaceChar(mName, '|', ' '); } else if(0 == strcmp("desc", keyword)) { @@ -843,7 +843,7 @@ BOOL LLInventoryItem::importLegacyStream(std::istream& input_stream) } mDescription.assign(valuestr); - LLString::replaceNonstandardASCII(mDescription, ' '); + LLStringUtil::replaceNonstandardASCII(mDescription, ' '); /* TODO -- ask Ian about this code const char *donkey = mDescription.c_str(); if (donkey[0] == '|') @@ -854,7 +854,9 @@ BOOL LLInventoryItem::importLegacyStream(std::istream& input_stream) } else if(0 == strcmp("creation_date", keyword)) { - sscanf(valuestr, "%d", &mCreationDate); + S32 date; + sscanf(valuestr, "%d", &date); + mCreationDate = date; } else { @@ -877,7 +879,7 @@ BOOL LLInventoryItem::importLegacyStream(std::istream& input_stream) BOOL LLInventoryItem::exportLegacyStream(std::ostream& output_stream, BOOL include_asset_key) const { - char uuid_str[UUID_STR_LENGTH]; /* Flawfinder: ignore */ + std::string uuid_str; output_stream << "\tinv_item\t0\n\t{\n"; mUUID.toString(uuid_str); output_stream << "\t\titem_id\t" << uuid_str << "\n"; @@ -914,8 +916,8 @@ BOOL LLInventoryItem::exportLegacyStream(std::ostream& output_stream, BOOL inclu const char* inv_type_str = LLInventoryType::lookup(mInventoryType); if(inv_type_str) output_stream << "\t\tinv_type\t" << inv_type_str << "\n"; - char buffer[32]; /* Flawfinder: ignore */ - snprintf(buffer, sizeof(buffer), "\t\tflags\t%08x\n", mFlags); /* Flawfinder: ignore */ + std::string buffer; + buffer = llformat( "\t\tflags\t%08x\n", mFlags); output_stream << buffer; mSaleInfo.exportLegacyStream(output_stream); output_stream << "\t\tname\t" << mName.c_str() << "|\n"; @@ -956,7 +958,7 @@ LLSD LLInventoryItem::asLLSD() const sd[INV_SALE_INFO_LABEL] = mSaleInfo; sd[INV_NAME_LABEL] = mName; sd[INV_DESC_LABEL] = mDescription; - sd[INV_CREATION_DATE_LABEL] = mCreationDate; + sd[INV_CREATION_DATE_LABEL] = (S32) mCreationDate; return sd; } @@ -1024,12 +1026,12 @@ bool LLInventoryItem::fromLLSD(LLSD& sd) w = INV_ASSET_TYPE_LABEL; if (sd.has(w)) { - mType = LLAssetType::lookup(sd[w].asString().c_str()); + mType = LLAssetType::lookup(sd[w].asString()); } w = INV_INVENTORY_TYPE_LABEL; if (sd.has(w)) { - mInventoryType = LLInventoryType::lookup(sd[w].asString().c_str()); + mInventoryType = LLInventoryType::lookup(sd[w].asString()); } w = INV_FLAGS_LABEL; if (sd.has(w)) @@ -1040,19 +1042,19 @@ bool LLInventoryItem::fromLLSD(LLSD& sd) if (sd.has(w)) { mName = sd[w].asString(); - LLString::replaceNonstandardASCII(mName, ' '); - LLString::replaceChar(mName, '|', ' '); + LLStringUtil::replaceNonstandardASCII(mName, ' '); + LLStringUtil::replaceChar(mName, '|', ' '); } w = INV_DESC_LABEL; if (sd.has(w)) { mDescription = sd[w].asString(); - LLString::replaceNonstandardASCII(mDescription, ' '); + LLStringUtil::replaceNonstandardASCII(mDescription, ' '); } w = INV_CREATION_DATE_LABEL; if (sd.has(w)) { - mCreationDate = sd[w]; + mCreationDate = sd[w].asInteger(); } // Need to convert 1.0 simstate files to a useful inventory type @@ -1101,22 +1103,23 @@ LLXMLNode *LLInventoryItem::exportFileXML(BOOL include_asset_key) const } } - LLString type_str = LLAssetType::lookup(mType); - LLString inv_type_str = LLInventoryType::lookup(mInventoryType); + std::string type_str = LLAssetType::lookup(mType); + std::string inv_type_str = LLInventoryType::lookup(mInventoryType); - ret->createChild("asset_type", FALSE)->setStringValue(1, &type_str); - ret->createChild("inventory_type", FALSE)->setStringValue(1, &inv_type_str); + ret->createChild("asset_type", FALSE)->setStringValue(type_str); + ret->createChild("inventory_type", FALSE)->setStringValue(inv_type_str); S32 tmp_flags = (S32) mFlags; ret->createChild("flags", FALSE)->setByteValue(4, (U8*)(&tmp_flags), LLXMLNode::ENCODING_HEX); mSaleInfo.exportFileXML()->setParent(ret); - LLString temp; + std::string temp; temp.assign(mName); - ret->createChild("name", FALSE)->setStringValue(1, &temp); + ret->createChild("name", FALSE)->setStringValue(temp); temp.assign(mDescription); - ret->createChild("description", FALSE)->setStringValue(1, &temp); - ret->createChild("creation_date", FALSE)->setIntValue(1, &mCreationDate); + ret->createChild("description", FALSE)->setStringValue(temp); + S32 date = mCreationDate; + ret->createChild("creation_date", FALSE)->setIntValue(1, &date); return ret; } @@ -1143,9 +1146,9 @@ BOOL LLInventoryItem::importXML(LLXMLNode* node) cipher.decrypt(mAssetUUID.mData, UUID_BYTES); } if (node->getChild("asset_type", sub_node)) - mType = LLAssetType::lookup(sub_node->getValue().c_str()); + mType = LLAssetType::lookup(sub_node->getValue()); if (node->getChild("inventory_type", sub_node)) - mInventoryType = LLInventoryType::lookup(sub_node->getValue().c_str()); + mInventoryType = LLInventoryType::lookup(sub_node->getValue()); if (node->getChild("flags", sub_node)) { S32 tmp_flags = 0; @@ -1159,7 +1162,12 @@ BOOL LLInventoryItem::importXML(LLXMLNode* node) if (node->getChild("description", sub_node)) mDescription = sub_node->getValue(); if (node->getChild("creation_date", sub_node)) - success = success && (1 == sub_node->getIntValue(1, &mCreationDate)); + { + S32 date = 0; + success = success && (1 == sub_node->getIntValue(1, &date)); + mCreationDate = date; + } + if (!success) { lldebugs << "LLInventory::importXML() failed for node named '" @@ -1186,32 +1194,32 @@ S32 LLInventoryItem::packBinaryBucket(U8* bin_bucket, LLPermissions* perm_overri // describe the inventory item char* buffer = (char*) bin_bucket; - char creator_id_str[UUID_STR_LENGTH]; /* Flawfinder: ignore */ + std::string creator_id_str; perm.getCreator().toString(creator_id_str); - char owner_id_str[UUID_STR_LENGTH]; /* Flawfinder: ignore */ + std::string owner_id_str; perm.getOwner().toString(owner_id_str); - char last_owner_id_str[UUID_STR_LENGTH]; /* Flawfinder: ignore */ + std::string last_owner_id_str; perm.getLastOwner().toString(last_owner_id_str); - char group_id_str[UUID_STR_LENGTH]; /* Flawfinder: ignore */ + std::string group_id_str; perm.getGroup().toString(group_id_str); - char asset_id_str[UUID_STR_LENGTH]; /* Flawfinder: ignore */ + std::string asset_id_str; getAssetUUID().toString(asset_id_str); S32 size = sprintf(buffer, /* Flawfinder: ignore */ "%d|%d|%s|%s|%s|%s|%s|%x|%x|%x|%x|%x|%s|%s|%d|%d|%x", getType(), getInventoryType(), getName().c_str(), - creator_id_str, - owner_id_str, - last_owner_id_str, - group_id_str, + creator_id_str.c_str(), + owner_id_str.c_str(), + last_owner_id_str.c_str(), + group_id_str.c_str(), perm.getMaskBase(), perm.getMaskOwner(), perm.getMaskGroup(), perm.getMaskEveryone(), perm.getMaskNextOwner(), - asset_id_str, + asset_id_str.c_str(), getDescription().c_str(), getSaleInfo().getSaleType(), getSaleInfo().getSalePrice(), @@ -1262,7 +1270,7 @@ void LLInventoryItem::unpackBinaryBucket(U8* bin_bucket, S32 bin_bucket_size) inv_type = (LLInventoryType::EType)(atoi((*(iter++)).c_str())); setInventoryType( inv_type ); - LLString name((*(iter++)).c_str()); + std::string name((*(iter++)).c_str()); rename( name ); LLUUID creator_id((*(iter++)).c_str()); @@ -1283,7 +1291,7 @@ void LLInventoryItem::unpackBinaryBucket(U8* bin_bucket, S32 bin_bucket_size) LLUUID asset_id((*(iter++)).c_str()); setAssetUUID(asset_id); - LLString desc((*(iter++)).c_str()); + std::string desc((*(iter++)).c_str()); setDescription(desc); LLSaleInfo::EForSale sale_type; @@ -1302,7 +1310,7 @@ void LLInventoryItem::unpackBinaryBucket(U8* bin_bucket, S32 bin_bucket_size) // returns TRUE if a should appear before b BOOL item_dictionary_sort( LLInventoryItem* a, LLInventoryItem* b ) { - return (LLString::compareDict( a->getName().c_str(), b->getName().c_str() ) < 0); + return (LLStringUtil::compareDict( a->getName().c_str(), b->getName().c_str() ) < 0); } // returns TRUE if a should appear before b @@ -1320,7 +1328,7 @@ LLInventoryCategory::LLInventoryCategory( const LLUUID& uuid, const LLUUID& parent_uuid, LLAssetType::EType preferred_type, - const LLString& name) : + const std::string& name) : LLInventoryObject(uuid, parent_uuid, LLAssetType::AT_CATEGORY, name), mPreferredType(preferred_type) { @@ -1406,8 +1414,8 @@ bool LLInventoryCategory::fromLLSD(LLSD& sd) if (sd.has(w)) { mName = sd[w].asString(); - LLString::replaceNonstandardASCII(mName, ' '); - LLString::replaceChar(mName, '|', ' '); + LLStringUtil::replaceNonstandardASCII(mName, ' '); + LLStringUtil::replaceChar(mName, '|', ' '); } return true; } @@ -1422,10 +1430,8 @@ void LLInventoryCategory::unpackMessage(LLMessageSystem* msg, S8 type; msg->getS8Fast(block, _PREHASH_Type, type, block_num); mPreferredType = static_cast(type); - char name[DB_INV_ITEM_NAME_BUF_SIZE]; /* Flawfinder: ignore */ - msg->getStringFast(block, _PREHASH_Name, DB_INV_ITEM_NAME_BUF_SIZE, name, block_num); - mName.assign(name); - LLString::replaceNonstandardASCII(mName, ' '); + msg->getStringFast(block, _PREHASH_Name, mName, block_num); + LLStringUtil::replaceNonstandardASCII(mName, ' '); } // virtual @@ -1483,8 +1489,8 @@ BOOL LLInventoryCategory::importFile(LLFILE* fp) " %254s %254[^|]", keyword, valuestr); mName.assign(valuestr); - LLString::replaceNonstandardASCII(mName, ' '); - LLString::replaceChar(mName, '|', ' '); + LLStringUtil::replaceNonstandardASCII(mName, ' '); + LLStringUtil::replaceChar(mName, '|', ' '); } else { @@ -1497,12 +1503,12 @@ BOOL LLInventoryCategory::importFile(LLFILE* fp) BOOL LLInventoryCategory::exportFile(LLFILE* fp, BOOL) const { - char uuid_str[UUID_STR_LENGTH]; /* Flawfinder: ignore */ + std::string uuid_str; fprintf(fp, "\tinv_category\t0\n\t{\n"); mUUID.toString(uuid_str); - fprintf(fp, "\t\tcat_id\t%s\n", uuid_str); + fprintf(fp, "\t\tcat_id\t%s\n", uuid_str.c_str()); mParentUUID.toString(uuid_str); - fprintf(fp, "\t\tparent_id\t%s\n", uuid_str); + fprintf(fp, "\t\tparent_id\t%s\n", uuid_str.c_str()); fprintf(fp, "\t\ttype\t%s\n", LLAssetType::lookup(mType)); fprintf(fp, "\t\tpref_type\t%s\n", LLAssetType::lookup(mPreferredType)); fprintf(fp, "\t\tname\t%s|\n", mName.c_str()); @@ -1562,8 +1568,8 @@ BOOL LLInventoryCategory::importLegacyStream(std::istream& input_stream) " %254s %254[^|]", keyword, valuestr); mName.assign(valuestr); - LLString::replaceNonstandardASCII(mName, ' '); - LLString::replaceChar(mName, '|', ' '); + LLStringUtil::replaceNonstandardASCII(mName, ' '); + LLStringUtil::replaceChar(mName, '|', ' '); } else { @@ -1576,7 +1582,7 @@ BOOL LLInventoryCategory::importLegacyStream(std::istream& input_stream) BOOL LLInventoryCategory::exportLegacyStream(std::ostream& output_stream, BOOL) const { - char uuid_str[UUID_STR_LENGTH]; /* Flawfinder: ignore */ + std::string uuid_str; output_stream << "\tinv_category\t0\n\t{\n"; mUUID.toString(uuid_str); output_stream << "\t\tcat_id\t" << uuid_str << "\n"; @@ -1615,7 +1621,7 @@ LLSD ll_create_sd_from_inventory_item(LLPointer item) rv[INV_INVENTORY_TYPE_LABEL] = LLInventoryType::lookup(item->getInventoryType()); rv[INV_FLAGS_LABEL] = (S32)item->getFlags(); - rv[INV_CREATION_DATE_LABEL] = item->getCreationDate(); + rv[INV_CREATION_DATE_LABEL] = (S32)item->getCreationDate(); return rv; } @@ -1626,7 +1632,7 @@ LLPointer ll_create_item_from_sd(const LLSD& sd_item) rv->setParent(sd_item[INV_PARENT_ID_LABEL].asUUID()); rv->rename(sd_item[INV_NAME_LABEL].asString()); rv->setType( - LLAssetType::lookup(sd_item[INV_ASSET_TYPE_LABEL].asString().c_str())); + LLAssetType::lookup(sd_item[INV_ASSET_TYPE_LABEL].asString())); if (sd_item.has("shadow_id")) { LLUUID asset_id = sd_item["shadow_id"]; @@ -1643,7 +1649,7 @@ LLPointer ll_create_item_from_sd(const LLSD& sd_item) rv->setPermissions(ll_permissions_from_sd(sd_item[INV_PERMISSIONS_LABEL])); rv->setInventoryType( LLInventoryType::lookup( - sd_item[INV_INVENTORY_TYPE_LABEL].asString().c_str())); + sd_item[INV_INVENTORY_TYPE_LABEL].asString())); rv->setFlags((U32)(sd_item[INV_FLAGS_LABEL].asInteger())); rv->setCreationDate(sd_item[INV_CREATION_DATE_LABEL].asInteger()); return rv; @@ -1678,9 +1684,9 @@ LLPointer ll_create_category_from_sd(const LLSD& sd_cat) rv->setParent(sd_cat[INV_PARENT_ID_LABEL].asUUID()); rv->rename(sd_cat[INV_NAME_LABEL].asString()); rv->setType( - LLAssetType::lookup(sd_cat[INV_ASSET_TYPE_LABEL].asString().c_str())); + LLAssetType::lookup(sd_cat[INV_ASSET_TYPE_LABEL].asString())); rv->setPreferredType( LLAssetType::lookup( - sd_cat[INV_PREFERRED_TYPE_LABEL].asString().c_str())); + sd_cat[INV_PREFERRED_TYPE_LABEL].asString())); return rv; } diff --git a/linden/indra/llinventory/llinventory.h b/linden/indra/llinventory/llinventory.h index 1bb6b85..d3cce6b 100644 --- a/linden/indra/llinventory/llinventory.h +++ b/linden/indra/llinventory/llinventory.h @@ -75,7 +75,7 @@ protected: LLUUID mUUID; LLUUID mParentUUID; LLAssetType::EType mType; - LLString mName; + std::string mName; protected: virtual ~LLInventoryObject( void ); @@ -83,19 +83,19 @@ protected: public: MEM_TYPE_NEW(LLMemType::MTYPE_INVENTORY); LLInventoryObject(const LLUUID& uuid, const LLUUID& parent_uuid, - LLAssetType::EType type, const LLString& name); + LLAssetType::EType type, const std::string& name); LLInventoryObject(); void copyObject(const LLInventoryObject* other); // LLRefCount requires custom copy // accessors const LLUUID& getUUID() const; const LLUUID& getParentUUID() const; - const LLString& getName() const; + const std::string& getName() const; LLAssetType::EType getType() const; // mutators - will not call updateServer(); void setUUID(const LLUUID& new_uuid); - void rename(const LLString& new_name); + void rename(const std::string& new_name); void setParent(const LLUUID& new_parent); void setType(LLAssetType::EType type); @@ -128,11 +128,11 @@ public: protected: LLPermissions mPermissions; LLUUID mAssetUUID; - LLString mDescription; + std::string mDescription; LLSaleInfo mSaleInfo; LLInventoryType::EType mInventoryType; U32 mFlags; - S32 mCreationDate; // seconds from 1/1/1970, UTC + time_t mCreationDate; // seconds from 1/1/1970, UTC public: @@ -212,8 +212,8 @@ public: const LLUUID& asset_uuid, LLAssetType::EType type, LLInventoryType::EType inv_type, - const LLString& name, - const LLString& desc, + const std::string& name, + const std::string& desc, const LLSaleInfo& sale_info, U32 flags, S32 creation_date_utc); @@ -233,22 +233,22 @@ public: const LLPermissions& getPermissions() const; const LLUUID& getCreatorUUID() const; const LLUUID& getAssetUUID() const; - const LLString& getDescription() const; + const std::string& getDescription() const; const LLSaleInfo& getSaleInfo() const; LLInventoryType::EType getInventoryType() const; U32 getFlags() const; - S32 getCreationDate() const; + time_t getCreationDate() const; U32 getCRC32() const; // really more of a checksum. // mutators - will not call updateServer(), and will never fail // (though it may correct to sane values) void setAssetUUID(const LLUUID& asset_id); - void setDescription(const LLString& new_desc); + void setDescription(const std::string& new_desc); void setSaleInfo(const LLSaleInfo& sale_info); void setPermissions(const LLPermissions& perm); void setInventoryType(LLInventoryType::EType inv_type); void setFlags(U32 flags); - void setCreationDate(S32 creation_date_utc); + void setCreationDate(time_t creation_date_utc); // Put this inventory item onto the current outgoing mesage. It // assumes you have already called nextBlock(). @@ -303,7 +303,7 @@ public: MEM_TYPE_NEW(LLMemType::MTYPE_INVENTORY); LLInventoryCategory(const LLUUID& uuid, const LLUUID& parent_uuid, LLAssetType::EType preferred_type, - const LLString& name); + const std::string& name); LLInventoryCategory(); LLInventoryCategory(const LLInventoryCategory* other); void copyCategory(const LLInventoryCategory* other); // LLRefCount requires custom copy diff --git a/linden/indra/llinventory/llinventory.vcproj b/linden/indra/llinventory/llinventory.vcproj deleted file mode 100644 index 7155d29..0000000 --- a/linden/indra/llinventory/llinventory.vcproj +++ /dev/null @@ -1,245 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/linden/indra/llinventory/llinventory_vc8.vcproj b/linden/indra/llinventory/llinventory_vc8.vcproj deleted file mode 100644 index 34dadc9..0000000 --- a/linden/indra/llinventory/llinventory_vc8.vcproj +++ /dev/null @@ -1,347 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/linden/indra/llinventory/llinventory_vc9.vcproj b/linden/indra/llinventory/llinventory_vc9.vcproj deleted file mode 100644 index cdc6c43..0000000 --- a/linden/indra/llinventory/llinventory_vc9.vcproj +++ /dev/null @@ -1,348 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/linden/indra/llinventory/llinventorytype.cpp b/linden/indra/llinventory/llinventorytype.cpp index 9212947..6287db2 100644 --- a/linden/indra/llinventory/llinventorytype.cpp +++ b/linden/indra/llinventory/llinventorytype.cpp @@ -162,12 +162,12 @@ const char* LLInventoryType::lookup(EType type) } // static -LLInventoryType::EType LLInventoryType::lookup(const char* name) +LLInventoryType::EType LLInventoryType::lookup(const std::string& name) { for(S32 i = 0; i < IT_COUNT; ++i) { if((INVENTORY_TYPE_NAMES[i]) - && (0 == strcmp(name, INVENTORY_TYPE_NAMES[i]))) + && (name == INVENTORY_TYPE_NAMES[i])) { // match return (EType)i; diff --git a/linden/indra/llinventory/llinventorytype.h b/linden/indra/llinventory/llinventorytype.h index 3c9abe9..00a4d28 100644 --- a/linden/indra/llinventory/llinventorytype.h +++ b/linden/indra/llinventory/llinventorytype.h @@ -72,7 +72,7 @@ public: }; // machine transation between type and strings - static EType lookup(const char* name); + static EType lookup(const std::string& name); static const char* lookup(EType type); // translation from a type to a human readable form. diff --git a/linden/indra/llinventory/llnotecard.cpp b/linden/indra/llinventory/llnotecard.cpp index 6d565e8..acd2e76 100644 --- a/linden/indra/llinventory/llnotecard.cpp +++ b/linden/indra/llinventory/llnotecard.cpp @@ -222,7 +222,7 @@ bool LLNotecard::importStream(std::istream& str) if(success) { // Actually set the text - mText = text; + mText = std::string(text); } delete[] text; @@ -281,22 +281,12 @@ bool LLNotecard::exportStream( std::ostream& out_stream ) //////////////////////////////////////////////////////////////////////////// -const std::vector >& LLNotecard::getItems() const -{ - return mItems; -} - -LLString& LLNotecard::getText() -{ - return mText; -} - void LLNotecard::setItems(const std::vector >& items) { mItems = items; } -void LLNotecard::setText(const LLString& text) +void LLNotecard::setText(const std::string& text) { mText = text; } diff --git a/linden/indra/llinventory/llnotecard.h b/linden/indra/llinventory/llnotecard.h index 2b36ae2..a510ba3 100644 --- a/linden/indra/llinventory/llnotecard.h +++ b/linden/indra/llinventory/llnotecard.h @@ -52,11 +52,12 @@ public: bool importStream(std::istream& str); bool exportStream(std::ostream& str); - const std::vector >& getItems() const; - LLString& getText(); + const std::vector >& getItems() const { return mItems; } + const std::string& getText() const { return mText; } + std::string& getText() { return mText; } void setItems(const std::vector >& items); - void setText(const LLString& text); + void setText(const std::string& text); S32 getVersion() { return mVersion; } S32 getEmbeddedVersion() { return mEmbeddedVersion; } @@ -64,7 +65,7 @@ private: bool importEmbeddedItemsStream(std::istream& str); bool exportEmbeddedItemsStream(std::ostream& str); std::vector > mItems; - LLString mText; + std::string mText; S32 mMaxText; S32 mVersion; S32 mEmbeddedVersion; diff --git a/linden/indra/llinventory/llparcel.cpp b/linden/indra/llinventory/llparcel.cpp index 1390f72..2b9c201 100644 --- a/linden/indra/llinventory/llparcel.cpp +++ b/linden/indra/llinventory/llparcel.cpp @@ -1,33 +1,33 @@ /** -* @file llparcel.cpp -* @brief A land parcel. -* -* $LicenseInfo:firstyear=2002&license=viewergpl$ -* -* Copyright (c) 2002-2008, Linden Research, Inc. -* -* Second Life Viewer Source Code -* 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://secondlifegrid.net/programs/open_source/licensing/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://secondlifegrid.net/programs/open_source/licensing/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. -* $/LicenseInfo$ -*/ + * @file llparcel.cpp + * @brief A land parcel. + * + * $LicenseInfo:firstyear=2002&license=viewergpl$ + * + * Copyright (c) 2002-2008, Linden Research, Inc. + * + * Second Life Viewer Source Code + * 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://secondlifegrid.net/programs/open_source/licensing/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://secondlifegrid.net/programs/open_source/licensing/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. + * $/LicenseInfo$ + */ #include "linden_common.h" @@ -48,17 +48,18 @@ static const F32 SOME_BIG_NUMBER = 1000.0f; static const F32 SOME_BIG_NEG_NUMBER = -1000.0f; -static const char* PARCEL_OWNERSHIP_STATUS_STRING[LLParcel::OS_COUNT] = +static const std::string PARCEL_OWNERSHIP_STATUS_STRING[LLParcel::OS_COUNT+1] = { "leased", "lease_pending", - "abandoned" + "abandoned", + "none" }; // NOTE: Adding parcel categories also requires updating: // * newview/app_settings/floater_directory.xml category combobox // * Web site "create event" tools -static const char* PARCEL_CATEGORY_STRING[LLParcel::C_COUNT] = +static const std::string PARCEL_CATEGORY_STRING[LLParcel::C_COUNT] = { "none", "linden", @@ -75,7 +76,7 @@ static const char* PARCEL_CATEGORY_STRING[LLParcel::C_COUNT] = "stage", "other", }; -static const char* PARCEL_CATEGORY_UI_STRING[LLParcel::C_COUNT + 1] = +static const std::string PARCEL_CATEGORY_UI_STRING[LLParcel::C_COUNT + 1] = { "None", "Linden Location", @@ -94,7 +95,7 @@ static const char* PARCEL_CATEGORY_UI_STRING[LLParcel::C_COUNT + 1] = "Any", // valid string for parcel searches }; -static const char* PARCEL_ACTION_STRING[LLParcel::A_COUNT + 1] = +static const std::string PARCEL_ACTION_STRING[LLParcel::A_COUNT + 1] = { "create", "release", @@ -132,14 +133,14 @@ const U64 SEVEN_DAYS_IN_USEC = U64L(604800000000); const S32 EXTEND_GRACE_IF_MORE_THAN_SEC = 100000; -const char* ownership_status_to_string(LLParcel::EOwnershipStatus status); -LLParcel::EOwnershipStatus ownership_string_to_status(const char* s); +const std::string& ownership_status_to_string(LLParcel::EOwnershipStatus status); +LLParcel::EOwnershipStatus ownership_string_to_status(const std::string& s); //const char* revert_action_to_string(LLParcel::ESaleTimerExpireAction action); //LLParcel::ESaleTimerExpireAction revert_string_to_action(const char* s); -const char* category_to_string(LLParcel::ECategory category); -const char* category_to_ui_string(LLParcel::ECategory category); -LLParcel::ECategory category_string_to_category(const char* s); -LLParcel::ECategory category_ui_string_to_category(const char* s); +const std::string& category_to_string(LLParcel::ECategory category); +const std::string& category_to_ui_string(LLParcel::ECategory category); +LLParcel::ECategory category_string_to_category(const std::string& s); +LLParcel::ECategory category_ui_string_to_category(const std::string& s); LLParcel::LLParcel() { @@ -207,12 +208,12 @@ void LLParcel::init(const LLUUID &owner_id, setParcelFlag(PF_ALLOW_DAMAGE, damage); mSalePrice = 10000; - setName(NULL); - setDesc(NULL); - setMusicURL(NULL); - setMediaURL(NULL); - setMediaDesc(NULL); - setMediaType(NULL); + setName(LLStringUtil::null); + setDesc(LLStringUtil::null); + setMusicURL(LLStringUtil::null); + setMediaURL(LLStringUtil::null); + setMediaDesc(LLStringUtil::null); + setMediaType(LLStringUtil::null); mMediaID.setNull(); mMediaAutoScale = 0; mMediaLoop = TRUE; @@ -241,6 +242,9 @@ void LLParcel::init(const LLUUID &owner_id, setSelectedPrimCount(0); setTempPrimCount(0); setCleanOtherTime(0); + setRegionPushOverride(FALSE); + setRegionDenyAnonymousOverride(FALSE); + setRegionDenyAgeUnverifiedOverride(FALSE); setParcelPrimBonus(parcel_object_bonus); setPreviousOwnerID(LLUUID::null); @@ -268,22 +272,7 @@ void LLParcel::overrideParcelFlags(U32 flags) { mParcelFlags = flags; } -void set_std_string(const char* src, std::string& dest) -{ - if(src) - { - dest.assign(src); - } - else - { -#if (LL_LINUX && __GNUC__ < 3) - dest.assign(std::string("")); -#else - dest.clear(); -#endif - } -} -void LLParcel::setName(const LLString& name) +void LLParcel::setName(const std::string& name) { // The escaping here must match the escaping in the database // abstraction layer. @@ -291,7 +280,7 @@ void LLParcel::setName(const LLString& name) LLStringFn::replace_nonprintable(mName, LL_UNKNOWN_CHAR); } -void LLParcel::setDesc(const LLString& desc) +void LLParcel::setDesc(const std::string& desc) { // The escaping here must match the escaping in the database // abstraction layer. @@ -299,7 +288,7 @@ void LLParcel::setDesc(const LLString& desc) mDesc = rawstr_to_utf8(mDesc); } -void LLParcel::setMusicURL(const LLString& url) +void LLParcel::setMusicURL(const std::string& url) { mMusicURL = url; // The escaping here must match the escaping in the database @@ -309,7 +298,7 @@ void LLParcel::setMusicURL(const LLString& url) LLStringFn::replace_nonprintable(mMusicURL, LL_UNKNOWN_CHAR); } -void LLParcel::setMediaURL(const LLString& url) +void LLParcel::setMediaURL(const std::string& url) { mMediaURL = url; // The escaping here must match the escaping in the database @@ -319,24 +308,24 @@ void LLParcel::setMediaURL(const LLString& url) LLStringFn::replace_nonprintable(mMediaURL, LL_UNKNOWN_CHAR); } -void LLParcel::setMediaDesc(const char* desc) +void LLParcel::setMediaDesc(const std::string& desc) { // The escaping here must match the escaping in the database // abstraction layer. - set_std_string(desc, mMediaDesc); + mMediaDesc = desc; mMediaDesc = rawstr_to_utf8(mMediaDesc); } -void LLParcel::setMediaType(const char* type) +void LLParcel::setMediaType(const std::string& type) { // The escaping here must match the escaping in the database // abstraction layer. - set_std_string(type, mMediaType); + mMediaType = type; mMediaType = rawstr_to_utf8(mMediaType); // This code attempts to preserve legacy movie functioning if(mMediaType.empty() && ! mMediaURL.empty()) { - setMediaType("video/vnd.secondlife.qt.legacy"); + setMediaType(std::string("video/vnd.secondlife.qt.legacy")); } } void LLParcel::setMediaWidth(S32 width) @@ -575,7 +564,7 @@ BOOL LLParcel::importStream(std::istream& input_stream) while (input_stream.good()) { skip_comments_and_emptyspace(input_stream); - LLString line, keyword, value; + std::string line, keyword, value; get_line(line, input_stream, MAX_STRING); get_keyword_and_value(keyword, value, line); @@ -585,19 +574,19 @@ BOOL LLParcel::importStream(std::istream& input_stream) } else if ("parcel_id" == keyword) { - mID.set(value.c_str()); + mID.set(value); } else if ("status" == keyword) { - mStatus = ownership_string_to_status(value.c_str()); + mStatus = ownership_string_to_status(value); } else if ("category" == keyword) { - mCategory = category_string_to_category(value.c_str()); + mCategory = category_string_to_category(value); } else if ("local_id" == keyword) { - LLString::convertToS32(value, mLocalID); + LLStringUtil::convertToS32(value, mLocalID); } else if ("name" == keyword) { @@ -617,65 +606,65 @@ BOOL LLParcel::importStream(std::istream& input_stream) } else if ("media_desc" == keyword) { - setMediaDesc( value.c_str() ); + setMediaDesc( value ); } else if ("media_type" == keyword) { - setMediaType( value.c_str() ); + setMediaType( value ); } else if ("media_width" == keyword) { S32 width; - LLString::convertToS32(value, width); + LLStringUtil::convertToS32(value, width); setMediaWidth( width ); } else if ("media_height" == keyword) { S32 height; - LLString::convertToS32(value, height); + LLStringUtil::convertToS32(value, height); setMediaHeight( height ); } else if ("media_id" == keyword) { - mMediaID.set( value.c_str() ); + mMediaID.set( value ); } else if ("media_auto_scale" == keyword) { - LLString::convertToU8(value, mMediaAutoScale); + LLStringUtil::convertToU8(value, mMediaAutoScale); } else if ("media_loop" == keyword) { - LLString::convertToU8(value, mMediaLoop); + LLStringUtil::convertToU8(value, mMediaLoop); } else if ("obscure_media" == keyword) { - LLString::convertToU8(value, mObscureMedia); + LLStringUtil::convertToU8(value, mObscureMedia); } else if ("obscure_music" == keyword) { - LLString::convertToU8(value, mObscureMusic); + LLStringUtil::convertToU8(value, mObscureMusic); } else if ("owner_id" == keyword) { - mOwnerID.set( value.c_str() ); + mOwnerID.set( value ); } else if ("group_owned" == keyword) { - LLString::convertToBOOL(value, mGroupOwned); + LLStringUtil::convertToBOOL(value, mGroupOwned); } else if ("clean_other_time" == keyword) { S32 time; - LLString::convertToS32(value, time); + LLStringUtil::convertToS32(value, time); setCleanOtherTime(time); } else if ("auth_buyer_id" == keyword) { - mAuthBuyerID.set(value.c_str()); + mAuthBuyerID.set(value); } else if ("snapshot_id" == keyword) { - mSnapshotID.set(value.c_str()); + mSnapshotID.set(value); } else if ("user_location" == keyword) { @@ -694,7 +683,7 @@ BOOL LLParcel::importStream(std::istream& input_stream) else if ("landing_type" == keyword) { S32 landing_type = 0; - LLString::convertToS32(value, landing_type); + LLStringUtil::convertToS32(value, landing_type); mLandingType = (ELandingType) landing_type; } else if ("join_neighbors" == keyword) @@ -703,7 +692,7 @@ BOOL LLParcel::importStream(std::istream& input_stream) } else if ("revert_sale" == keyword) { - LLString::convertToS32(value, secs_until_revert); + LLStringUtil::convertToS32(value, secs_until_revert); if (secs_until_revert > 0) { mSaleTimerExpires.start(); @@ -712,7 +701,7 @@ BOOL LLParcel::importStream(std::istream& input_stream) } else if("extended_grace" == keyword) { - LLString::convertToS32(value, mGraceExtension); + LLStringUtil::convertToS32(value, mGraceExtension); } else if ("user_list_type" == keyword) { @@ -720,147 +709,147 @@ BOOL LLParcel::importStream(std::istream& input_stream) } else if("auction_id" == keyword) { - LLString::convertToU32(value, mAuctionID); + LLStringUtil::convertToU32(value, mAuctionID); } else if ("allow_modify" == keyword) { - LLString::convertToU32(value, setting); + LLStringUtil::convertToU32(value, setting); setParcelFlag(PF_CREATE_OBJECTS, setting); } else if ("allow_group_modify" == keyword) { - LLString::convertToU32(value, setting); + LLStringUtil::convertToU32(value, setting); setParcelFlag(PF_CREATE_GROUP_OBJECTS, setting); } else if ("allow_all_object_entry" == keyword) { - LLString::convertToU32(value, setting); + LLStringUtil::convertToU32(value, setting); setParcelFlag(PF_ALLOW_ALL_OBJECT_ENTRY, setting); } else if ("allow_group_object_entry" == keyword) { - LLString::convertToU32(value, setting); + LLStringUtil::convertToU32(value, setting); setParcelFlag(PF_ALLOW_GROUP_OBJECT_ENTRY, setting); } else if ("allow_deed_to_group" == keyword) { - LLString::convertToU32(value, setting); + LLStringUtil::convertToU32(value, setting); setParcelFlag(PF_ALLOW_DEED_TO_GROUP, setting); } else if("contribute_with_deed" == keyword) { - LLString::convertToU32(value, setting); + LLStringUtil::convertToU32(value, setting); setParcelFlag(PF_CONTRIBUTE_WITH_DEED, setting); } else if ("allow_terraform" == keyword) { - LLString::convertToU32(value, setting); + LLStringUtil::convertToU32(value, setting); setParcelFlag(PF_ALLOW_TERRAFORM, setting); } else if ("allow_damage" == keyword) { - LLString::convertToU32(value, setting); + LLStringUtil::convertToU32(value, setting); setParcelFlag(PF_ALLOW_DAMAGE, setting); } else if ("allow_fly" == keyword) { - LLString::convertToU32(value, setting); + LLStringUtil::convertToU32(value, setting); setParcelFlag(PF_ALLOW_FLY, setting); } else if ("allow_landmark" == keyword) { - LLString::convertToU32(value, setting); + LLStringUtil::convertToU32(value, setting); setParcelFlag(PF_ALLOW_LANDMARK, setting); } else if ("sound_local" == keyword) { - LLString::convertToU32(value, setting); + LLStringUtil::convertToU32(value, setting); setParcelFlag(PF_SOUND_LOCAL, setting); } else if ("allow_group_scripts" == keyword) { - LLString::convertToU32(value, setting); + LLStringUtil::convertToU32(value, setting); setParcelFlag(PF_ALLOW_GROUP_SCRIPTS, setting); } else if ("allow_voice_chat" == keyword) { - LLString::convertToU32(value, setting); + LLStringUtil::convertToU32(value, setting); setParcelFlag(PF_ALLOW_VOICE_CHAT, setting); } else if ("use_estate_voice_chan" == keyword) { - LLString::convertToU32(value, setting); + LLStringUtil::convertToU32(value, setting); setParcelFlag(PF_USE_ESTATE_VOICE_CHAN, setting); } else if ("allow_scripts" == keyword) { - LLString::convertToU32(value, setting); + LLStringUtil::convertToU32(value, setting); setParcelFlag(PF_ALLOW_OTHER_SCRIPTS, setting); } else if ("for_sale" == keyword) { - LLString::convertToU32(value, setting); + LLStringUtil::convertToU32(value, setting); setParcelFlag(PF_FOR_SALE, setting); } else if ("sell_w_objects" == keyword) { - LLString::convertToU32(value, setting); + LLStringUtil::convertToU32(value, setting); setParcelFlag(PF_SELL_PARCEL_OBJECTS, setting); } else if ("use_pass_list" == keyword) { - LLString::convertToU32(value, setting); + LLStringUtil::convertToU32(value, setting); setParcelFlag(PF_USE_PASS_LIST, setting); } else if ("show_directory" == keyword) { - LLString::convertToU32(value, setting); + LLStringUtil::convertToU32(value, setting); setParcelFlag(PF_SHOW_DIRECTORY, setting); } else if ("allow_publish" == keyword) { - LLString::convertToU32(value, setting); + LLStringUtil::convertToU32(value, setting); setParcelFlag(PF_ALLOW_PUBLISH, setting); } else if ("mature_publish" == keyword) { - LLString::convertToU32(value, setting); + LLStringUtil::convertToU32(value, setting); setParcelFlag(PF_MATURE_PUBLISH, setting); } else if ("claim_date" == keyword) { // BUG: This will fail when time rolls over in 2038. S32 time; - LLString::convertToS32(value, time); + LLStringUtil::convertToS32(value, time); mClaimDate = time; } else if ("claim_price" == keyword) { - LLString::convertToS32(value, mClaimPricePerMeter); + LLStringUtil::convertToS32(value, mClaimPricePerMeter); } else if ("rent_price" == keyword) { - LLString::convertToS32(value, mRentPricePerMeter); + LLStringUtil::convertToS32(value, mRentPricePerMeter); } else if ("discount_rate" == keyword) { - LLString::convertToF32(value, mDiscountRate); + LLStringUtil::convertToF32(value, mDiscountRate); } else if ("draw_distance" == keyword) { - LLString::convertToF32(value, mDrawDistance); + LLStringUtil::convertToF32(value, mDrawDistance); } else if ("sale_price" == keyword) { - LLString::convertToS32(value, mSalePrice); + LLStringUtil::convertToS32(value, mSalePrice); } else if ("pass_price" == keyword) { - LLString::convertToS32(value, mPassPrice); + LLStringUtil::convertToS32(value, mPassPrice); } else if ("pass_hours" == keyword) { - LLString::convertToF32(value, mPassHours); + LLStringUtil::convertToF32(value, mPassHours); } else if ("box" == keyword) { @@ -873,17 +862,17 @@ BOOL LLParcel::importStream(std::istream& input_stream) } else if ("use_access_group" == keyword) { - LLString::convertToU32(value, setting); + LLStringUtil::convertToU32(value, setting); setParcelFlag(PF_USE_ACCESS_GROUP, setting); } else if ("use_access_list" == keyword) { - LLString::convertToU32(value, setting); + LLStringUtil::convertToU32(value, setting); setParcelFlag(PF_USE_ACCESS_LIST, setting); } else if ("use_ban_list" == keyword) { - LLString::convertToU32(value, setting); + LLStringUtil::convertToU32(value, setting); setParcelFlag(PF_USE_BAN_LIST, setting); } else if ("group_name" == keyword) @@ -892,7 +881,7 @@ BOOL LLParcel::importStream(std::istream& input_stream) } else if ("group_id" == keyword) { - mGroupID.set( value.c_str() ); + mGroupID.set( value ); } // TODO: DEPRECATED FLAG // Flag removed from simstate files in 1.11.1 @@ -900,7 +889,7 @@ BOOL LLParcel::importStream(std::istream& input_stream) // no longer exists anywhere in simstate files. else if ("require_identified" == keyword) { - // LLString::convertToU32(value, setting); + // LLStringUtil::convertToU32(value, setting); // setParcelFlag(PF_DENY_ANONYMOUS, setting); } // TODO: DEPRECATED FLAG @@ -909,39 +898,39 @@ BOOL LLParcel::importStream(std::istream& input_stream) // no longer exists anywhere in simstate files. else if ("require_transacted" == keyword) { - // LLString::convertToU32(value, setting); + // LLStringUtil::convertToU32(value, setting); // setParcelFlag(PF_DENY_ANONYMOUS, setting); // setParcelFlag(PF_DENY_IDENTIFIED, setting); } else if ("restrict_pushobject" == keyword) { - LLString::convertToU32(value, setting); + LLStringUtil::convertToU32(value, setting); setParcelFlag(PF_RESTRICT_PUSHOBJECT, setting); } else if ("deny_anonymous" == keyword) { - LLString::convertToU32(value, setting); + LLStringUtil::convertToU32(value, setting); setParcelFlag(PF_DENY_ANONYMOUS, setting); } else if ("deny_identified" == keyword) { -// LLString::convertToU32(value, setting); +// LLStringUtil::convertToU32(value, setting); // setParcelFlag(PF_DENY_IDENTIFIED, setting); } else if ("deny_transacted" == keyword) { -// LLString::convertToU32(value, setting); +// LLStringUtil::convertToU32(value, setting); // setParcelFlag(PF_DENY_TRANSACTED, setting); } else if ("deny_age_unverified" == keyword) { - LLString::convertToU32(value, setting); + LLStringUtil::convertToU32(value, setting); setParcelFlag(PF_DENY_AGEUNVERIFIED, setting); } else if ("access_list" == keyword) { S32 entry_count = 0; - LLString::convertToS32(value, entry_count); + LLStringUtil::convertToS32(value, entry_count); for (S32 i = 0; i < entry_count; i++) { LLAccessEntry entry; @@ -954,7 +943,7 @@ BOOL LLParcel::importStream(std::istream& input_stream) else if ("ban_list" == keyword) { S32 entry_count = 0; - LLString::convertToS32(value, entry_count); + LLStringUtil::convertToS32(value, entry_count); for (S32 i = 0; i < entry_count; i++) { LLAccessEntry entry; @@ -968,7 +957,7 @@ BOOL LLParcel::importStream(std::istream& input_stream) { /* S32 entry_count = 0; - LLString::convertToS32(value, entry_count); + LLStringUtil::convertToS32(value, entry_count); for (S32 i = 0; i < entry_count; i++) { LLAccessEntry entry; @@ -982,7 +971,7 @@ BOOL LLParcel::importStream(std::istream& input_stream) { // legacy - put into access list S32 entry_count = 0; - LLString::convertToS32(value, entry_count); + LLStringUtil::convertToS32(value, entry_count); for (S32 i = 0; i < entry_count; i++) { LLAccessEntry entry; @@ -1058,7 +1047,7 @@ BOOL LLParcel::importAccessEntry(std::istream& input_stream, LLAccessEntry* entr while (input_stream.good()) { skip_comments_and_emptyspace(input_stream); - LLString line, keyword, value; + std::string line, keyword, value; get_line(line, input_stream, MAX_STRING); get_keyword_and_value(keyword, value, line); @@ -1068,7 +1057,7 @@ BOOL LLParcel::importAccessEntry(std::istream& input_stream, LLAccessEntry* entr } else if ("id" == keyword) { - entry->mID.set( value.c_str() ); + entry->mID.set( value ); } else if ("name" == keyword) { @@ -1077,13 +1066,13 @@ BOOL LLParcel::importAccessEntry(std::istream& input_stream, LLAccessEntry* entr else if ("time" == keyword) { S32 when; - LLString::convertToS32(value, when); + LLStringUtil::convertToS32(value, when); entry->mTime = when; } else if ("flags" == keyword) { U32 setting; - LLString::convertToU32(value, setting); + LLStringUtil::convertToU32(value, setting); entry->mFlags = setting; } else @@ -1098,7 +1087,7 @@ BOOL LLParcel::importAccessEntry(std::istream& input_stream, LLAccessEntry* entr BOOL LLParcel::exportStream(std::ostream& output_stream) { S32 setting; - char id_string[MAX_STRING]; /* Flawfinder: ignore */ + std::string id_string; std::ios::fmtflags old_flags = output_stream.flags(); output_stream.setf(std::ios::showpoint); @@ -1201,8 +1190,10 @@ BOOL LLParcel::exportStream(std::ostream& output_stream) output_stream << "\t\t sound_local " << (getSoundLocal() ? 1 : 0) << "\n"; output_stream << "\t\t allow_scripts " << (getAllowOtherScripts() ? 1 : 0) << "\n"; output_stream << "\t\t allow_group_scripts " << (getAllowGroupScripts() ? 1 : 0) << "\n"; - output_stream << "\t\t allow_voice_chat " << (getVoiceEnabled() ? 1 : 0) << "\n"; - output_stream << "\t\t use_estate_voice_chan " << (getVoiceUseEstateChannel() ? 1 : 0) << "\n"; + output_stream << "\t\t use_estate_voice_chan " << (getParcelFlagUseEstateVoiceChannel() ? 1 : 0) << "\n"; + + output_stream << "\t\t allow_voice_chat " << (getParcelFlagAllowVoice() ? 1 : 0) << "\n"; + output_stream << "\t\t use_estate_voice_chan " << (getParcelFlagUseEstateVoiceChannel() ? 1 : 0) << "\n"; output_stream << "\t\t for_sale " << (getForSale() ? 1 : 0) << "\n"; output_stream << "\t\t sell_w_objects " << (getSellWithObjects() ? 1 : 0) << "\n"; output_stream << "\t\t draw_distance " << mDrawDistance << "\n"; @@ -1374,17 +1365,17 @@ void LLParcel::packMessage(LLSD& msg) void LLParcel::unpackMessage(LLMessageSystem* msg) { - char buffer[256]; /* Flawfinder: ignore */ + std::string buffer; msg->getU32Fast( _PREHASH_ParcelData,_PREHASH_ParcelFlags, mParcelFlags ); msg->getS32Fast( _PREHASH_ParcelData,_PREHASH_SalePrice, mSalePrice ); - msg->getStringFast( _PREHASH_ParcelData,_PREHASH_Name, 256, buffer ); + msg->getStringFast( _PREHASH_ParcelData,_PREHASH_Name, buffer ); setName(buffer); - msg->getStringFast( _PREHASH_ParcelData,_PREHASH_Desc, 256, buffer ); + msg->getStringFast( _PREHASH_ParcelData,_PREHASH_Desc, buffer ); setDesc(buffer); - msg->getStringFast( _PREHASH_ParcelData,_PREHASH_MusicURL, 256, buffer ); + msg->getStringFast( _PREHASH_ParcelData,_PREHASH_MusicURL, buffer ); setMusicURL(buffer); - msg->getStringFast( _PREHASH_ParcelData,_PREHASH_MediaURL, 256, buffer ); + msg->getStringFast( _PREHASH_ParcelData,_PREHASH_MediaURL, buffer ); setMediaURL(buffer); // non-optimized version @@ -1409,9 +1400,9 @@ void LLParcel::unpackMessage(LLMessageSystem* msg) // Note: the message has been converted to TCP if(msg->getNumberOfBlocks("MediaData") > 0) { - msg->getString("MediaData", "MediaDesc", 256, buffer); + msg->getString("MediaData", "MediaDesc", buffer); setMediaDesc(buffer); - msg->getString("MediaData", "MediaType", 256, buffer); + msg->getString("MediaData", "MediaType", buffer); setMediaType(buffer); msg->getS32("MediaData", "MediaWidth", mMediaWidth); msg->getS32("MediaData", "MediaHeight", mMediaHeight); @@ -1421,8 +1412,8 @@ void LLParcel::unpackMessage(LLMessageSystem* msg) } else { - setMediaType("video/vnd.secondlife.qt.legacy"); - setMediaDesc("No Description available without Server Upgrade"); + setMediaType(std::string("video/vnd.secondlife.qt.legacy")); + setMediaDesc(std::string("No Description available without Server Upgrade")); mMediaLoop = true; mObscureMedia = true; mObscureMusic = true; @@ -1685,37 +1676,37 @@ BOOL LLParcel::removeFromBanList(const LLUUID& agent_id) } // static -const char* LLParcel::getOwnershipStatusString(EOwnershipStatus status) +const std::string& LLParcel::getOwnershipStatusString(EOwnershipStatus status) { return ownership_status_to_string(status); } // static -const char* LLParcel::getCategoryString(ECategory category) +const std::string& LLParcel::getCategoryString(ECategory category) { return category_to_string(category); } // static -const char* LLParcel::getCategoryUIString(ECategory category) +const std::string& LLParcel::getCategoryUIString(ECategory category) { return category_to_ui_string(category); } // static -LLParcel::ECategory LLParcel::getCategoryFromString(const char* string) +LLParcel::ECategory LLParcel::getCategoryFromString(const std::string& string) { return category_string_to_category(string); } // static -LLParcel::ECategory LLParcel::getCategoryFromUIString(const char* string) +LLParcel::ECategory LLParcel::getCategoryFromUIString(const std::string& string) { return category_ui_string_to_category(string); } // static -const char* LLParcel::getActionString(LLParcel::EAction action) +const std::string& LLParcel::getActionString(LLParcel::EAction action) { S32 index = 0; if((action >= 0) && (action < LLParcel::A_COUNT)) @@ -1848,19 +1839,19 @@ BOOL LLParcel::isBuyerAuthorized(const LLUUID& buyer_id) const void LLParcel::clearParcel() { overrideParcelFlags(PF_DEFAULT); - setName(NULL); - setDesc(NULL); - setMediaURL(NULL); - setMediaType(NULL); + setName(LLStringUtil::null); + setDesc(LLStringUtil::null); + setMediaURL(LLStringUtil::null); + setMediaType(LLStringUtil::null); setMediaID(LLUUID::null); - setMediaDesc(NULL); + setMediaDesc(LLStringUtil::null); setMediaAutoScale(0); setMediaLoop(TRUE); mObscureMedia = 1; mObscureMusic = 1; mMediaWidth = 0; mMediaHeight = 0; - setMusicURL(NULL); + setMusicURL(LLStringUtil::null); setInEscrow(FALSE); setAuthorizedBuyerID(LLUUID::null); setCategory(C_NONE); @@ -1884,20 +1875,20 @@ void LLParcel::dump() llinfos << " desc <" << mDesc << ">" << llendl; } -const char* ownership_status_to_string(LLParcel::EOwnershipStatus status) +const std::string& ownership_status_to_string(LLParcel::EOwnershipStatus status) { if(status >= 0 && status < LLParcel::OS_COUNT) { return PARCEL_OWNERSHIP_STATUS_STRING[status]; } - return "none"; + return PARCEL_OWNERSHIP_STATUS_STRING[LLParcel::OS_COUNT]; } -LLParcel::EOwnershipStatus ownership_string_to_status(const char* s) +LLParcel::EOwnershipStatus ownership_string_to_status(const std::string& s) { for(S32 i = 0; i < LLParcel::OS_COUNT; ++i) { - if(0 == strcmp(s, PARCEL_OWNERSHIP_STATUS_STRING[i])) + if(s == PARCEL_OWNERSHIP_STATUS_STRING[i]) { return (LLParcel::EOwnershipStatus)i; } @@ -1927,7 +1918,7 @@ LLParcel::EOwnershipStatus ownership_string_to_status(const char* s) // return LLParcel::STEA_REVERT; //} -const char* category_to_string(LLParcel::ECategory category) +const std::string& category_to_string(LLParcel::ECategory category) { S32 index = 0; if((category >= 0) && (category < LLParcel::C_COUNT)) @@ -1937,7 +1928,7 @@ const char* category_to_string(LLParcel::ECategory category) return PARCEL_CATEGORY_STRING[index]; } -const char* category_to_ui_string(LLParcel::ECategory category) +const std::string& category_to_ui_string(LLParcel::ECategory category) { S32 index = 0; if((category >= 0) && (category < LLParcel::C_COUNT)) @@ -1952,11 +1943,11 @@ const char* category_to_ui_string(LLParcel::ECategory category) return PARCEL_CATEGORY_UI_STRING[index]; } -LLParcel::ECategory category_string_to_category(const char* s) +LLParcel::ECategory category_string_to_category(const std::string& s) { for(S32 i = 0; i < LLParcel::C_COUNT; ++i) { - if(0 == strcmp(s, PARCEL_CATEGORY_STRING[i])) + if(s == PARCEL_CATEGORY_STRING[i]) { return (LLParcel::ECategory)i; } @@ -1965,11 +1956,11 @@ LLParcel::ECategory category_string_to_category(const char* s) return LLParcel::C_NONE; } -LLParcel::ECategory category_ui_string_to_category(const char* s) +LLParcel::ECategory category_ui_string_to_category(const std::string& s) { for(S32 i = 0; i < LLParcel::C_COUNT; ++i) { - if(0 == strcmp(s, PARCEL_CATEGORY_UI_STRING[i])) + if(s == PARCEL_CATEGORY_UI_STRING[i]) { return (LLParcel::ECategory)i; } diff --git a/linden/indra/llinventory/llparcel.h b/linden/indra/llinventory/llparcel.h index 9c91d94..e8f18f2 100644 --- a/linden/indra/llinventory/llparcel.h +++ b/linden/indra/llinventory/llparcel.h @@ -207,12 +207,12 @@ public: // MANIPULATORS void generateNewID() { mID.generate(); } - void setName(const LLString& name); - void setDesc(const LLString& desc); - void setMusicURL(const LLString& url); - void setMediaURL(const LLString& url); - void setMediaType(const char* type); - void setMediaDesc(const char* desc); + void setName(const std::string& name); + void setDesc(const std::string& desc); + void setMusicURL(const std::string& url); + void setMediaURL(const std::string& url); + void setMediaType(const std::string& type); + void setMediaDesc(const std::string& desc); void setMediaID(const LLUUID& id) { mMediaID = id; } void setMediaAutoScale ( U8 flagIn ) { mMediaAutoScale = flagIn; } void setMediaLoop (U8 loop) { mMediaLoop = loop; } @@ -266,7 +266,7 @@ public: void setDrawDistance(F32 dist) { mDrawDistance = dist; } void setSalePrice(S32 price) { mSalePrice = price; } void setGroupID(const LLUUID& id) { mGroupID = id; } - //void setGroupName(const LLString& s) { mGroupName.assign(s); } + //void setGroupName(const std::string& s) { mGroupName.assign(s); } void setPassPrice(S32 price) { mPassPrice = price; } void setPassHours(F32 hours) { mPassHours = hours; } @@ -303,12 +303,12 @@ public: // ACCESSORS const LLUUID& getID() const { return mID; } - const LLString& getName() const { return mName; } - const LLString& getDesc() const { return mDesc; } - const LLString& getMusicURL() const { return mMusicURL; } - const LLString& getMediaURL() const { return mMediaURL; } - const char* getMediaDesc() const { return mMediaDesc.c_str(); } - const char* getMediaType() const { return mMediaType.c_str(); } + const std::string& getName() const { return mName; } + const std::string& getDesc() const { return mDesc; } + const std::string& getMusicURL() const { return mMusicURL; } + const std::string& getMediaURL() const { return mMediaURL; } + const std::string& getMediaDesc() const { return mMediaDesc; } + const std::string& getMediaType() const { return mMediaType; } const LLUUID& getMediaID() const { return mMediaID; } S32 getMediaWidth() const { return mMediaWidth; } S32 getMediaHeight() const { return mMediaHeight; } @@ -351,18 +351,18 @@ public: // functions to deal with ownership status. EOwnershipStatus getOwnershipStatus() const { return mStatus; } - static const char* getOwnershipStatusString(EOwnershipStatus status); + static const std::string& getOwnershipStatusString(EOwnershipStatus status); void setOwnershipStatus(EOwnershipStatus status) { mStatus = status; } // dealing with parcel category information ECategory getCategory() const {return mCategory; } - static const char* getCategoryString(ECategory category); - static const char* getCategoryUIString(ECategory category); - static ECategory getCategoryFromString(const char* string); - static ECategory getCategoryFromUIString(const char* string); + static const std::string& getCategoryString(ECategory category); + static const std::string& getCategoryUIString(ECategory category); + static ECategory getCategoryFromString(const std::string& string); + static ECategory getCategoryFromUIString(const std::string& string); // functions for parcel action (used for logging) - static const char* getActionString(EAction action); + static const std::string& getActionString(EAction action); // dealing with sales and parcel conversion. // @@ -444,9 +444,9 @@ public: { return (mParcelFlags & PF_FOR_SALE) ? TRUE : FALSE; } BOOL getSoundLocal() const { return (mParcelFlags & PF_SOUND_LOCAL) ? TRUE : FALSE; } - BOOL getVoiceEnabled() const + BOOL getParcelFlagAllowVoice() const { return (mParcelFlags & PF_ALLOW_VOICE_CHAT) ? TRUE : FALSE; } - BOOL getVoiceUseEstateChannel() const + BOOL getParcelFlagUseEstateVoiceChannel() const { return (mParcelFlags & PF_USE_ESTATE_VOICE_CHAN) ? TRUE : FALSE; } BOOL getAllowPublish() const { return (mParcelFlags & PF_ALLOW_PUBLISH) ? TRUE : FALSE; } @@ -514,7 +514,7 @@ public: S32 getSimWidePrimCount() const { return mSimWidePrimCount; } // this parcel only (not simwide) - S32 getMaxPrimCapacity() const { return mMaxPrimCapacity; } + S32 getMaxPrimCapacity() const { return mMaxPrimCapacity; } // Does not include prim bonus S32 getPrimCount() const { return mOwnerPrimCount + mGroupPrimCount + mOtherPrimCount + mSelectedPrimCount; } S32 getOwnerPrimCount() const { return mOwnerPrimCount; } S32 getGroupPrimCount() const { return mGroupPrimCount; } @@ -525,7 +525,7 @@ public: S32 getCleanOtherTime() const { return mCleanOtherTime; } - void setMaxPrimCapacity(S32 max) { mMaxPrimCapacity = max; } + void setMaxPrimCapacity(S32 max) { mMaxPrimCapacity = max; } // Does not include prim bonus // simwide void setSimWideMaxPrimCapacity(S32 current) { mSimWideMaxPrimCapacity = current; } void setSimWidePrimCount(S32 current) { mSimWidePrimCount = current; } @@ -587,12 +587,12 @@ protected: F32 mDrawDistance; U32 mParcelFlags; S32 mSalePrice; // linden dollars - LLString mName; - LLString mDesc; - LLString mMusicURL; - LLString mMediaURL; - std::string mMediaDesc; - std::string mMediaType; + std::string mName; + std::string mDesc; + std::string mMusicURL; + std::string mMediaURL; + std::string mMediaDesc; + std::string mMediaType; S32 mMediaWidth; S32 mMediaHeight; U8 mMediaAutoScale; @@ -604,7 +604,7 @@ protected: F32 mPassHours; LLVector3 mAABBMin; LLVector3 mAABBMax; - S32 mMaxPrimCapacity; + S32 mMaxPrimCapacity; // Prims allowed on parcel, does not include prim bonus S32 mSimWidePrimCount; S32 mSimWideMaxPrimCapacity; //S32 mSimWidePrimCorrection; diff --git a/linden/indra/llinventory/llpermissions.cpp b/linden/indra/llinventory/llpermissions.cpp index afa2772..b25faa8 100644 --- a/linden/indra/llinventory/llpermissions.cpp +++ b/linden/indra/llinventory/llpermissions.cpp @@ -650,7 +650,7 @@ BOOL LLPermissions::importFile(LLFILE* fp) BOOL LLPermissions::exportFile(LLFILE* fp) const { - char uuid_str[256]; /* Flawfinder: ignore */ + std::string uuid_str; fprintf(fp, "\tpermissions 0\n"); fprintf(fp, "\t{\n"); @@ -662,16 +662,16 @@ BOOL LLPermissions::exportFile(LLFILE* fp) const fprintf(fp, "\t\tnext_owner_mask\t%08x\n", mMaskNextOwner); mCreator.toString(uuid_str); - fprintf(fp, "\t\tcreator_id\t%s\n", uuid_str); + fprintf(fp, "\t\tcreator_id\t%s\n", uuid_str.c_str()); mOwner.toString(uuid_str); - fprintf(fp, "\t\towner_id\t%s\n", uuid_str); + fprintf(fp, "\t\towner_id\t%s\n", uuid_str.c_str()); mLastOwner.toString(uuid_str); - fprintf(fp, "\t\tlast_owner_id\t%s\n", uuid_str); + fprintf(fp, "\t\tlast_owner_id\t%s\n", uuid_str.c_str()); mGroup.toString(uuid_str); - fprintf(fp, "\t\tgroup_id\t%s\n", uuid_str); + fprintf(fp, "\t\tgroup_id\t%s\n", uuid_str.c_str()); if(mIsGroupOwned) { @@ -784,21 +784,21 @@ BOOL LLPermissions::importLegacyStream(std::istream& input_stream) BOOL LLPermissions::exportLegacyStream(std::ostream& output_stream) const { - char uuid_str[256]; /* Flawfinder: ignore */ + std::string uuid_str; output_stream << "\tpermissions 0\n"; output_stream << "\t{\n"; - char buffer[256]; /* Flawfinder: ignore */ - snprintf(buffer, sizeof(buffer), "\t\tbase_mask\t%08x\n", mMaskBase); /* Flawfinder: ignore */ + std::string buffer; + buffer = llformat( "\t\tbase_mask\t%08x\n", mMaskBase); output_stream << buffer; - snprintf(buffer, sizeof(buffer), "\t\towner_mask\t%08x\n", mMaskOwner); /* Flawfinder: ignore */ + buffer = llformat( "\t\towner_mask\t%08x\n", mMaskOwner); output_stream << buffer; - snprintf(buffer, sizeof(buffer), "\t\tgroup_mask\t%08x\n", mMaskGroup); /* Flawfinder: ignore */ + buffer = llformat( "\t\tgroup_mask\t%08x\n", mMaskGroup); output_stream << buffer; - snprintf(buffer, sizeof(buffer), "\t\teveryone_mask\t%08x\n", mMaskEveryone); /* Flawfinder: ignore */ + buffer = llformat( "\t\teveryone_mask\t%08x\n", mMaskEveryone); output_stream << buffer; - snprintf(buffer, sizeof(buffer), "\t\tnext_owner_mask\t%08x\n", mMaskNextOwner); /* Flawfinder: ignore */ + buffer = llformat( "\t\tnext_owner_mask\t%08x\n", mMaskNextOwner); output_stream << buffer; mCreator.toString(uuid_str); @@ -826,7 +826,7 @@ LLXMLNode *LLPermissions::exportFileXML() const { LLXMLNode *ret = new LLXMLNode("permissions", FALSE); - ret->createChild("group_owned", TRUE)->setBoolValue(1, (const BOOL*)&mIsGroupOwned); + ret->createChild("group_owned", TRUE)->setBoolValue(mIsGroupOwned); ret->createChild("base_mask", FALSE)->setByteValue(4, (U8*)&mMaskBase, LLXMLNode::ENCODING_HEX); ret->createChild("owner_mask", FALSE)->setByteValue(4, (U8*)&mMaskOwner, LLXMLNode::ENCODING_HEX); @@ -869,7 +869,11 @@ bool LLPermissions::importXML(LLXMLNode* node) if (node->getChild("group_id", sub_node)) success = success && (1 == sub_node->getUUIDValue(1, &mGroup)); if (node->getChild("group_owned", sub_node)) - success = success && (1 == sub_node->getBoolValue(1, (BOOL*)&mIsGroupOwned)); + { + BOOL tmpbool = FALSE; + success = success && (1 == sub_node->getBoolValue(1, &tmpbool)); + mIsGroupOwned = (bool)tmpbool; + } if (!success) { lldebugs << "LLPermissions::importXML() failed for node named '" @@ -1114,12 +1118,12 @@ void LLAggregatePermissions::unpackMessage(LLMessageSystem* msg, const char* blo mBits[PI_TRANSFER] = bits & TWO_BITS; } -const LLString AGGREGATE_VALUES[4] = +const std::string AGGREGATE_VALUES[4] = { - LLString( "Empty" ), - LLString( "None" ), - LLString( "Some" ), - LLString( "All" ) + std::string( "Empty" ), + std::string( "None" ), + std::string( "Some" ), + std::string( "All" ) }; std::ostream& operator<<(std::ostream &s, const LLAggregatePermissions &perm) diff --git a/linden/indra/llinventory/llsaleinfo.cpp b/linden/indra/llinventory/llsaleinfo.cpp index 7aabdda..4895378 100644 --- a/linden/indra/llinventory/llsaleinfo.cpp +++ b/linden/indra/llinventory/llsaleinfo.cpp @@ -128,7 +128,7 @@ bool LLSaleInfo::fromLLSD(LLSD& sd, BOOL& has_perm_mask, U32& perm_mask) LLXMLNode *LLSaleInfo::exportFileXML() const { LLXMLNode *ret = new LLXMLNode("sale_info", FALSE); - LLString type_str = lookup(mSaleType); + std::string type_str = ll_safe_string( lookup(mSaleType)); ret->createChild("type", TRUE)->setStringValue(1, &type_str); ret->createChild("price", TRUE)->setIntValue(1, &mSalePrice); return ret; diff --git a/linden/indra/llinventory/lltransactionflags.cpp b/linden/indra/llinventory/lltransactionflags.cpp index a45cdba..175cd99 100644 --- a/linden/indra/llinventory/lltransactionflags.cpp +++ b/linden/indra/llinventory/lltransactionflags.cpp @@ -32,9 +32,9 @@ #include "linden_common.h" +#include "lluuid.h" #include "lltransactionflags.h" #include "lltransactiontypes.h" -#include "lluuid.h" const U8 TRANSACTION_FLAGS_NONE = 0; const U8 TRANSACTION_FLAG_SOURCE_GROUP = 1; @@ -69,12 +69,12 @@ BOOL is_tf_owner_group(TransactionFlags flags) void append_reason( std::ostream& ostr, S32 transaction_type, - const char* description) + const std::string& description) { switch( transaction_type ) { case TRANS_OBJECT_SALE: - ostr << " for " << (description ? description : ""); + ostr << " for " << (description.length() > 0 ? description : std::string("")); break; case TRANS_LAND_SALE: ostr << " for a parcel of land"; @@ -95,12 +95,21 @@ std::string build_transfer_message_to_source( const LLUUID& dest_id, const std::string& dest_name, S32 transaction_type, - const char* description) + const std::string& description) { lldebugs << "build_transfer_message_to_source: " << amount << " " << source_id << " " << dest_id << " " << dest_name << " " - << (description?description:"(no desc)") << llendl; - if((0 == amount) || source_id.isNull()) return ll_safe_string(description); + << transaction_type << " " + << (description.empty() ? "(no desc)" : description) + << llendl; + if(source_id.isNull()) + { + return description; + } + if((0 == amount) && description.empty()) + { + return description; + } std::ostringstream ostr; if(dest_id.isNull()) { @@ -135,13 +144,20 @@ std::string build_transfer_message_to_destination( const LLUUID& source_id, const std::string& source_name, S32 transaction_type, - const char* description) + const std::string& description) { lldebugs << "build_transfer_message_to_dest: " << amount << " " << dest_id << " " << source_id << " " << source_name << " " - << (description?description:"(no desc)") << llendl; - if(0 == amount) return std::string(); - if(dest_id.isNull()) return ll_safe_string(description); + << transaction_type << " " << (description.empty() ? "(no desc)" : description) + << llendl; + if(0 == amount) + { + return std::string(); + } + if(dest_id.isNull()) + { + return description; + } std::ostringstream ostr; ostr << source_name << " paid you L$" << amount; append_reason(ostr, transaction_type, description); diff --git a/linden/indra/llinventory/lltransactionflags.h b/linden/indra/llinventory/lltransactionflags.h index 9a27c3f..ffb17cb 100644 --- a/linden/indra/llinventory/lltransactionflags.h +++ b/linden/indra/llinventory/lltransactionflags.h @@ -31,6 +31,8 @@ #ifndef LL_LLTRANSACTIONFLAGS_H #define LL_LLTRANSACTIONFLAGS_H +class LLUUID; + typedef U8 TransactionFlags; // defined in common/llinventory/lltransactionflags.cpp @@ -55,7 +57,7 @@ std::string build_transfer_message_to_source( const LLUUID& dest_id, const std::string& dest_name, S32 transaction_type, - const char* description); + const std::string& description); std::string build_transfer_message_to_destination( S32 amount, @@ -63,6 +65,6 @@ std::string build_transfer_message_to_destination( const LLUUID& source_id, const std::string& source_name, S32 transaction_type, - const char* description); + const std::string& description); #endif // LL_LLTRANSACTIONFLAGS_H diff --git a/linden/indra/llmath/CMakeLists.txt b/linden/indra/llmath/CMakeLists.txt new file mode 100644 index 0000000..6a329fa --- /dev/null +++ b/linden/indra/llmath/CMakeLists.txt @@ -0,0 +1,81 @@ +# -*- cmake -*- + +project(llmath) + +include(00-Common) +include(LLCommon) + +include_directories( + ${LLCOMMON_INCLUDE_DIRS} + ) + +set(llmath_SOURCE_FILES + llbboxlocal.cpp + llcamera.cpp + llcoordframe.cpp + llline.cpp + llperlin.cpp + llquaternion.cpp + llrect.cpp + llsphere.cpp + llvolume.cpp + llvolumemgr.cpp + llsdutil_math.cpp + m3math.cpp + m4math.cpp + raytrace.cpp + v2math.cpp + v3color.cpp + v3dmath.cpp + v3math.cpp + v4color.cpp + v4coloru.cpp + v4math.cpp + xform.cpp + ) + +set(llmath_HEADER_FILES + CMakeLists.txt + + camera.h + coordframe.h + llbboxlocal.h + llcamera.h + llcoord.h + llcoordframe.h + llinterp.h + llline.h + llmath.h + lloctree.h + llperlin.h + llplane.h + llquantize.h + llquaternion.h + llrect.h + llsphere.h + lltreenode.h + llv4math.h + llv4matrix3.h + llv4matrix4.h + llv4vector3.h + llvolume.h + llvolumemgr.h + m3math.h + m4math.h + raytrace.h + v2math.h + v3color.h + v3dmath.h + v3math.h + v4color.h + v4coloru.h + v4math.h + xform.h + ) + +set_source_files_properties(${llmath_HEADER_FILES} + PROPERTIES HEADER_FILE_ONLY TRUE) + +list(APPEND llmath_SOURCE_FILES ${llmath_HEADER_FILES}) + +add_library (llmath ${llmath_SOURCE_FILES}) diff --git a/linden/indra/llmath/files.lst b/linden/indra/llmath/files.lst deleted file mode 100644 index 1001a6d..0000000 --- a/linden/indra/llmath/files.lst +++ /dev/null @@ -1,25 +0,0 @@ -llmath/llbboxlocal.cpp -llmath/llcamera.cpp -llmath/llcoordframe.cpp -llmath/llcrc.cpp -llmath/llline.cpp -llmath/llmd5.cpp -llmath/llperlin.cpp -llmath/llquaternion.cpp -llmath/llrand.cpp -llmath/llrect.cpp -llmath/llsphere.cpp -llmath/lluuid.cpp -llmath/llvolume.cpp -llmath/llvolumemgr.cpp -llmath/m3math.cpp -llmath/m4math.cpp -llmath/raytrace.cpp -llmath/v2math.cpp -llmath/v3color.cpp -llmath/v3dmath.cpp -llmath/v3math.cpp -llmath/v4color.cpp -llmath/v4coloru.cpp -llmath/v4math.cpp -llmath/xform.cpp diff --git a/linden/indra/llmath/llcamera.h b/linden/indra/llmath/llcamera.h index 7066b9f..2884338 100644 --- a/linden/indra/llmath/llcamera.h +++ b/linden/indra/llmath/llcamera.h @@ -115,11 +115,12 @@ protected: LLPlane mWorldPlanes[PLANE_NUM]; LLPlane mHorizPlanes[HORIZ_PLANE_NUM]; - typedef struct + struct frustum_plane { + frustum_plane() : mask(0) {} LLPlane p; U8 mask; - } frustum_plane; + }; frustum_plane mAgentPlanes[7]; //frustum planes in agent space a la gluUnproject (I'm a bastard, I know) - DaveP U32 mPlaneCount; //defaults to 6, if setUserClipPlane is called, uses user supplied clip plane in diff --git a/linden/indra/llmath/llcrc.cpp b/linden/indra/llmath/llcrc.cpp deleted file mode 100644 index 447521a..0000000 --- a/linden/indra/llmath/llcrc.cpp +++ /dev/null @@ -1,224 +0,0 @@ -/** - * @file llcrc.cpp - * @brief implementation of the crc class. - * - * $LicenseInfo:firstyear=2002&license=viewergpl$ - * - * Copyright (c) 2002-2008, Linden Research, Inc. - * - * Second Life Viewer Source Code - * 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://secondlifegrid.net/programs/open_source/licensing/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://secondlifegrid.net/programs/open_source/licensing/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. - * $/LicenseInfo$ - */ - -#include "linden_common.h" - -#include "llcrc.h" -#include "llerror.h" - -/* Copyright (C) 1986 Gary S. Brown. You may use this program, or - code or tables extracted from it, as desired without restriction.*/ - -/* First, the polynomial itself and its table of feedback terms. The */ -/* polynomial is */ -/* X^32+X^26+X^23+X^22+X^16+X^12+X^11+X^10+X^8+X^7+X^5+X^4+X^2+X^1+X^0 */ -/* Note that we take it "backwards" and put the highest-order term in */ -/* the lowest-order bit. The X^32 term is "implied"; the LSB is the */ -/* X^31 term, etc. The X^0 term (usually shown as "+1") results in */ -/* the MSB being 1. */ - -/* Note that the usual hardware shift register implementation, which */ -/* is what we're using (we're merely optimizing it by doing eight-bit */ -/* chunks at a time) shifts bits into the lowest-order term. In our */ -/* implementation, that means shifting towards the right. Why do we */ -/* do it this way? Because the calculated CRC must be transmitted in */ -/* order from highest-order term to lowest-order term. UARTs transmit */ -/* characters in order from LSB to MSB. By storing the CRC this way, */ -/* we hand it to the UART in the order low-byte to high-byte; the UART */ -/* sends each low-bit to hight-bit; and the result is transmission bit */ -/* by bit from highest- to lowest-order term without requiring any bit */ -/* shuffling on our part. Reception works similarly. */ - -/* The feedback terms table consists of 256, 32-bit entries. Notes: */ -/* */ -/* 1. The table can be generated at runtime if desired; code to do so */ -/* is shown later. It might not be obvious, but the feedback */ -/* terms simply represent the results of eight shift/xor opera- */ -/* tions for all combinations of data and CRC register values. */ -/* */ -/* 2. The CRC accumulation logic is the same for all CRC polynomials, */ -/* be they sixteen or thirty-two bits wide. You simply choose the */ -/* appropriate table. Alternatively, because the table can be */ -/* generated at runtime, you can start by generating the table for */ -/* the polynomial in question and use exactly the same "updcrc", */ -/* if your application needn't simultaneously handle two CRC */ -/* polynomials. (Note, however, that XMODEM is strange.) */ -/* */ -/* 3. For 16-bit CRCs, the table entries need be only 16 bits wide; */ -/* of course, 32-bit entries work OK if the high 16 bits are zero. */ -/* */ -/* 4. The values must be right-shifted by eight bits by the "updcrc" */ -/* logic; the shift must be unsigned (bring in zeroes). On some */ -/* hardware you could probably optimize the shift in assembler by */ -/* using byte-swap instructions. */ - -///---------------------------------------------------------------------------- -/// Local function declarations, constants, enums, and typedefs -///---------------------------------------------------------------------------- - -#define UPDC32(octet,crc) (crc_32_tab[((crc) \ - ^ ((U8)octet)) & 0xff] ^ ((crc) >> 8)) - - -static U32 crc_32_tab[] = { /* CRC polynomial 0xedb88320 */ -0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, -0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, -0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2, -0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, -0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, -0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, -0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa, 0x42b2986c, -0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59, -0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, -0xcfba9599, 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, -0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, 0x01db7106, -0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433, -0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, -0x91646c97, 0xe6635c01, 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, -0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950, -0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65, -0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7, -0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, -0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, -0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, -0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81, -0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, -0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, 0xe3630b12, 0x94643b84, -0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, -0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, -0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, -0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, 0xd6d6a3e8, 0xa1d1937e, -0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b, -0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, -0x316e8eef, 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, -0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, 0xb2bd0b28, -0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d, -0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f, -0x72076785, 0x05005713, 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, -0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242, -0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777, -0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69, -0x616bffd3, 0x166ccf45, 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, -0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, -0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, -0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693, -0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, -0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d -}; - - -///---------------------------------------------------------------------------- -/// Class llcrc -///---------------------------------------------------------------------------- - -// Default constructor -LLCRC::LLCRC() : mCurrent(0xffffffff) -{ -} - - -U32 LLCRC::getCRC() const -{ - return ~mCurrent; -} - -void LLCRC::update(U8 next_byte) -{ - mCurrent = UPDC32(next_byte, mCurrent); -} - -void LLCRC::update(const U8* buffer, size_t buffer_size) -{ - for (size_t i = 0; i < buffer_size; i++) - { - mCurrent = UPDC32(buffer[i], mCurrent); - } -} - -void LLCRC::update(const char* filename) -{ - if (!filename) - { - llerrs << "No filename specified" << llendl; - return; - } - - LLFILE* fp = LLFile::fopen(filename, "rb"); /* Flawfinder: ignore */ - - if (fp) - { - fseek(fp, 0, SEEK_END); - long size = ftell(fp); - - fseek(fp, 0, SEEK_SET); - - if (size > 0) - { - U8* data = new U8[size]; - size_t nread; - - nread = fread(data, 1, size, fp); - fclose(fp); - - if (nread < (size_t) size) - { - llwarns << "Short read on " << filename << llendl; - } - - update(data, nread); - delete[] data; - } - } -} - - -#ifdef _DEBUG -BOOL LLCRC::testHarness() -{ - const S32 TEST_BUFFER_SIZE = 16; - const char TEST_BUFFER[TEST_BUFFER_SIZE] = "hello &#$)$&Nd0"; /* Flawfinder: ignore */ - LLCRC c1, c2; - c1.update((U8*)TEST_BUFFER, TEST_BUFFER_SIZE - 1); - char* rh = (char*)TEST_BUFFER; - while(*rh != '\0') - { - c2.update(*rh); - ++rh; - } - return(c1.getCRC() == c2.getCRC()); -} -#endif - - - -///---------------------------------------------------------------------------- -/// Local function definitions -///---------------------------------------------------------------------------- diff --git a/linden/indra/llmath/llcrc.h b/linden/indra/llmath/llcrc.h deleted file mode 100644 index 59f58ce..0000000 --- a/linden/indra/llmath/llcrc.h +++ /dev/null @@ -1,73 +0,0 @@ -/** - * @file llcrc.h - * @brief LLCRC class header file. - * - * $LicenseInfo:firstyear=2002&license=viewergpl$ - * - * Copyright (c) 2002-2008, Linden Research, Inc. - * - * Second Life Viewer Source Code - * 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://secondlifegrid.net/programs/open_source/licensing/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://secondlifegrid.net/programs/open_source/licensing/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. - * $/LicenseInfo$ - */ - -#ifndef LL_LLCRC_H -#define LL_LLCRC_H - -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// Class llcrc -// -// Simple 32 bit crc. To use, instantiate an LLCRC instance and feed -// it the bytes you want to check. It will update the internal crc as -// you go, and you can qery it at the end. As a horribly inefficient -// example (don't try this at work kids): -// -// LLCRC crc; -// LLFILE* fp = LLFile::fopen(filename,"rb"); -// while(!feof(fp)) { -// crc.update(fgetc(fp)); -// } -// fclose(fp); -// llinfos << "File crc: " << crc.getCRC() << llendl; -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -class LLCRC -{ -protected: - U32 mCurrent; - -public: - LLCRC(); - - U32 getCRC() const; - void update(U8 next_byte); - void update(const U8* buffer, size_t buffer_size); - void update(const char *filename); - -#ifdef _DEBUG - // This function runs tests to make sure the crc is - // working. Returns TRUE if it is. - static BOOL testHarness(); -#endif -}; - - -#endif // LL_LLCRC_H diff --git a/linden/indra/llmath/llline.cpp b/linden/indra/llmath/llline.cpp index 9c41efb..cfd3f56 100644 --- a/linden/indra/llmath/llline.cpp +++ b/linden/indra/llmath/llline.cpp @@ -20,6 +20,8 @@ * $/LicenseInfo$ */ +#include "linden_common.h" + #include "llline.h" #include "llrand.h" diff --git a/linden/indra/llmath/llmath.h b/linden/indra/llmath/llmath.h index 4a6358d..82ab197 100644 --- a/linden/indra/llmath/llmath.h +++ b/linden/indra/llmath/llmath.h @@ -33,9 +33,10 @@ #define LLMATH_H #include -//#include -//#include +#include #include "lldefs.h" +#include "llstl.h" // *TODO: Remove when LLString is gone +#include "llstring.h" // *TODO: Remove when LLString is gone // work around for Windows & older gcc non-standard function names. #if LL_WINDOWS @@ -93,6 +94,9 @@ const F32 F_APPROXIMATELY_ZERO = 0.00001f; const F32 F_LN2 = 0.69314718056f; const F32 OO_LN2 = 1.4426950408889634073599246810019f; +const F32 F_ALMOST_ZERO = 0.0001f; +const F32 F_ALMOST_ONE = 1.0f - F_ALMOST_ZERO; + // BUG: Eliminate in favor of F_APPROXIMATELY_ZERO above? const F32 FP_MAG_THRESHOLD = 0.0000001f; @@ -102,13 +106,13 @@ inline BOOL is_approx_zero( F32 f ) { return (-F_APPROXIMATELY_ZERO < f) && (f < inline BOOL is_approx_equal(F32 x, F32 y) { const S32 COMPARE_MANTISSA_UP_TO_BIT = 0x02; - return (abs((S32) ((U32&)x - (U32&)y) ) < COMPARE_MANTISSA_UP_TO_BIT); + return (std::abs((S32) ((U32&)x - (U32&)y) ) < COMPARE_MANTISSA_UP_TO_BIT); } inline BOOL is_approx_equal(F64 x, F64 y) { const S64 COMPARE_MANTISSA_UP_TO_BIT = 0x02; - return (abs((S32) ((U64&)x - (U64&)y) ) < COMPARE_MANTISSA_UP_TO_BIT); + return (std::abs((S32) ((U64&)x - (U64&)y) ) < COMPARE_MANTISSA_UP_TO_BIT); } inline BOOL is_approx_equal_fraction(F32 x, F32 y, U32 frac_bits) @@ -155,17 +159,17 @@ inline BOOL is_approx_equal_fraction(F64 x, F64 y, U32 frac_bits) inline S32 llabs(const S32 a) { - return S32(labs(a)); + return S32(std::labs(a)); } inline F32 llabs(const F32 a) { - return F32(fabs(a)); + return F32(std::fabs(a)); } inline F64 llabs(const F64 a) { - return F64(fabs(a)); + return F64(std::fabs(a)); } inline S32 lltrunc( F32 f ) @@ -473,8 +477,8 @@ inline F32 llsimple_angle(F32 angle) return angle; } -//calculate the nearesr power of two number for val, bounded by max_power_two -inline U32 get_nearest_power_two(U32 val, U32 max_power_two) +//SDK - Renamed this to get_lower_power_two, since this is what this actually does. +inline U32 get_lower_power_two(U32 val, U32 max_power_two) { if(!max_power_two) { @@ -489,4 +493,34 @@ inline U32 get_nearest_power_two(U32 val, U32 max_power_two) return max_power_two ; } + +// calculate next highest power of two, limited by max_power_two +// This is taken from a brilliant little code snipped on http://acius2.blogspot.com/2007/11/calculating-next-power-of-2.html +// Basically we convert the binary to a solid string of 1's with the same +// number of digits, then add one. We subtract 1 initially to handle +// the case where the number passed in is actually a power of two. +// WARNING: this only works with 32 bit ints. +inline U32 get_next_power_two(U32 val, U32 max_power_two) +{ + if(!max_power_two) + { + max_power_two = 1 << 31 ; + } + + if(val >= max_power_two) + { + return max_power_two; + } + + val--; + val = (val >> 1) | val; + val = (val >> 2) | val; + val = (val >> 4) | val; + val = (val >> 8) | val; + val = (val >> 16) | val; + val++; + + return val; +} + #endif diff --git a/linden/indra/llmath/llmath.vcproj b/linden/indra/llmath/llmath.vcproj deleted file mode 100644 index d05505e..0000000 --- a/linden/indra/llmath/llmath.vcproj +++ /dev/null @@ -1,348 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/linden/indra/llmath/llmath_vc8.vcproj b/linden/indra/llmath/llmath_vc8.vcproj deleted file mode 100644 index 3b4413a..0000000 --- a/linden/indra/llmath/llmath_vc8.vcproj +++ /dev/null @@ -1,488 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/linden/indra/llmath/llmath_vc9.vcproj b/linden/indra/llmath/llmath_vc9.vcproj deleted file mode 100644 index 03bc780..0000000 --- a/linden/indra/llmath/llmath_vc9.vcproj +++ /dev/null @@ -1,489 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/linden/indra/llmath/llmd5.cpp b/linden/indra/llmath/llmd5.cpp deleted file mode 100644 index ea69002..0000000 --- a/linden/indra/llmath/llmd5.cpp +++ /dev/null @@ -1,531 +0,0 @@ -/** - * @file llmd5.cpp - * - * $LicenseInfo:firstyear=2001&license=viewergpl$ - * - * Copyright (c) 2001-2008, Linden Research, Inc. - * - * Second Life Viewer Source Code - * 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://secondlifegrid.net/programs/open_source/licensing/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://secondlifegrid.net/programs/open_source/licensing/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. - * $/LicenseInfo$ - */ - -// llMD5.CC - source code for the C++/object oriented translation and -// modification of MD5. -// -// Adapted to Linden Lab by Frank Filipanits, 6/25/2002 -// Fixed potential memory leak, James Cook, 6/27/2002 - -// Translation and modification (c) 1995 by Mordechai T. Abzug - -// This translation/ modification is provided "as is," without express or -// implied warranty of any kind. - -// The translator/ modifier does not claim (1) that MD5 will do what you think -// it does; (2) that this translation/ modification is accurate; or (3) that -// this software is "merchantible." (Language for this disclaimer partially -// copied from the disclaimer below). - -/* based on: - - MD5C.C - RSA Data Security, Inc., MD5 message-digest algorithm - MDDRIVER.C - test driver for MD2, MD4 and MD5 - - - Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All -rights reserved. - -License to copy and use this software is granted provided that it -is identified as the "RSA Data Security, Inc. MD5 Message-Digest -Algorithm" in all material mentioning or referencing this software -or this function. - -License is also granted to make and use derivative works provided -that such works are identified as "derived from the RSA Data -Security, Inc. MD5 Message-Digest Algorithm" in all material -mentioning or referencing the derived work. - -RSA Data Security, Inc. makes no representations concerning either -the merchantability of this software or the suitability of this -software for any particular purpose. It is provided "as is" -without express or implied warranty of any kind. - -These notices must be retained in any copies of any part of this -documentation and/or software. - - */ - - - - - -#include "linden_common.h" - -#include "llmd5.h" - -#include - -// how many bytes to grab at a time when checking files -const int LLMD5::BLOCK_LEN = 4096; - - -// LLMD5 simple initialization method - -LLMD5::LLMD5() -{ - init(); -} - - - - -// MD5 block update operation. Continues an MD5 message-digest -// operation, processing another message block, and updating the -// context. - -void LLMD5::update (const uint1 *input, const uint4 input_length) { - - uint4 input_index, buffer_index; - uint4 buffer_space; // how much space is left in buffer - - if (finalized){ // so we can't update! - std::cerr << "LLMD5::update: Can't update a finalized digest!" << std::endl; - return; - } - - // Compute number of bytes mod 64 - buffer_index = (unsigned int)((count[0] >> 3) & 0x3F); - - // Update number of bits - if ( (count[0] += ((uint4) input_length << 3))<((uint4) input_length << 3) ) - count[1]++; - - count[1] += ((uint4)input_length >> 29); - - - buffer_space = 64 - buffer_index; // how much space is left in buffer - - // Transform as many times as possible. - if (input_length >= buffer_space) { // ie. we have enough to fill the buffer - // fill the rest of the buffer and transform - memcpy( /* Flawfinder: ignore */ - buffer + buffer_index, - input, - buffer_space); - transform (buffer); - - // now, transform each 64-byte piece of the input, bypassing the buffer - if (input == NULL || input_length == 0){ - std::cerr << "LLMD5::update: Invalid input!" << std::endl; - return; - } - - for (input_index = buffer_space; input_index + 63 < input_length; - input_index += 64) - transform (input+input_index); - - buffer_index = 0; // so we can buffer remaining - } - else - input_index=0; // so we can buffer the whole input - - - // and here we do the buffering: - memcpy(buffer+buffer_index, input+input_index, input_length-input_index); /* Flawfinder: ignore */ -} - - - -// MD5 update for files. -// Like above, except that it works on files (and uses above as a primitive.) - -void LLMD5::update(LLFILE* file){ - - unsigned char buffer[BLOCK_LEN]; /* Flawfinder: ignore */ - int len; - - while ( (len=(int)fread(buffer, 1, BLOCK_LEN, file)) ) - update(buffer, len); - - fclose (file); - -} - - - - - - -// MD5 update for istreams. -// Like update for files; see above. - -void LLMD5::update(std::istream& stream){ - - unsigned char buffer[BLOCK_LEN]; /* Flawfinder: ignore */ - int len; - - while (stream.good()){ - stream.read( (char*)buffer, BLOCK_LEN); /* Flawfinder: ignore */ // note that return value of read is unusable. - len=stream.gcount(); - update(buffer, len); - } - -} - - - - - -// MD5 finalization. Ends an MD5 message-digest operation, writing the -// the message digest and zeroizing the context. - - -void LLMD5::finalize (){ - - unsigned char bits[8]; /* Flawfinder: ignore */ - unsigned int index, padLen; - static uint1 PADDING[64]={ - 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }; - - if (finalized){ - std::cerr << "LLMD5::finalize: Already finalized this digest!" << std::endl; - return; - } - - // Save number of bits - encode (bits, count, 8); - - // Pad out to 56 mod 64. - index = (uint4) ((count[0] >> 3) & 0x3f); - padLen = (index < 56) ? (56 - index) : (120 - index); - update (PADDING, padLen); - - // Append length (before padding) - update (bits, 8); - - // Store state in digest - encode (digest, state, 16); - - // Zeroize sensitive information - memset (buffer, 0, sizeof(*buffer)); - - finalized=1; - -} - - - - -LLMD5::LLMD5(LLFILE *file){ - - init(); // must be called be all constructors - update(file); - finalize (); -} - - - - -LLMD5::LLMD5(std::istream& stream){ - - init(); // must called by all constructors - update (stream); - finalize(); -} - -// Digest a string of the format ("%s:%i" % (s, number)) -LLMD5::LLMD5(const unsigned char *string, const unsigned int number) -{ - const char *colon = ":"; - char tbuf[16]; /* Flawfinder: ignore */ - init(); - update(string, (U32)strlen((const char *) string)); /* Flawfinder: ignore */ - update((const unsigned char *) colon, (U32)strlen(colon)); /* Flawfinder: ignore */ - snprintf(tbuf, sizeof(tbuf), "%i", number); /* Flawfinder: ignore */ - update((const unsigned char *) tbuf, (U32)strlen(tbuf)); /* Flawfinder: ignore */ - finalize(); -} - -// Digest a string -LLMD5::LLMD5(const unsigned char *s) -{ - init(); - update(s, (U32)strlen((const char *) s)); /* Flawfinder: ignore */ - finalize(); -} - -void LLMD5::raw_digest(unsigned char *s) -{ - if (!finalized) - { - std::cerr << "LLMD5::raw_digest: Can't get digest if you haven't "<< - "finalized the digest!" << std::endl; - s[0] = '\0'; - return; - } - - memcpy(s, digest, 16); /* Flawfinder: ignore */ - return; -} - - - -void LLMD5::hex_digest(char *s) -{ - int i; - - if (!finalized) - { - std::cerr << "LLMD5::hex_digest: Can't get digest if you haven't "<< - "finalized the digest!" <> (32-(n)))) - -/* FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4. -Rotation is separate from addition to prevent recomputation. - */ -#define FF(a, b, c, d, x, s, ac) { \ - (a) += F ((b), (c), (d)) + (x) + (U32)(ac); \ - (a) = ROTATE_LEFT ((a), (s)); \ - (a) += (b); \ - } -#define GG(a, b, c, d, x, s, ac) { \ - (a) += G ((b), (c), (d)) + (x) + (U32)(ac); \ - (a) = ROTATE_LEFT ((a), (s)); \ - (a) += (b); \ - } -#define HH(a, b, c, d, x, s, ac) { \ - (a) += H ((b), (c), (d)) + (x) + (U32)(ac); \ - (a) = ROTATE_LEFT ((a), (s)); \ - (a) += (b); \ - } -#define II(a, b, c, d, x, s, ac) { \ - (a) += I ((b), (c), (d)) + (x) + (U32)(ac); \ - (a) = ROTATE_LEFT ((a), (s)); \ - (a) += (b); \ - } - - - -// LLMD5 basic transformation. Transforms state based on block. -void LLMD5::transform (const U8 block[64]){ - - uint4 a = state[0], b = state[1], c = state[2], d = state[3], x[16]; - - decode (x, block, 64); - - assert(!finalized); // not just a user error, since the method is private - - /* Round 1 */ - FF (a, b, c, d, x[ 0], S11, 0xd76aa478); /* 1 */ - FF (d, a, b, c, x[ 1], S12, 0xe8c7b756); /* 2 */ - FF (c, d, a, b, x[ 2], S13, 0x242070db); /* 3 */ - FF (b, c, d, a, x[ 3], S14, 0xc1bdceee); /* 4 */ - FF (a, b, c, d, x[ 4], S11, 0xf57c0faf); /* 5 */ - FF (d, a, b, c, x[ 5], S12, 0x4787c62a); /* 6 */ - FF (c, d, a, b, x[ 6], S13, 0xa8304613); /* 7 */ - FF (b, c, d, a, x[ 7], S14, 0xfd469501); /* 8 */ - FF (a, b, c, d, x[ 8], S11, 0x698098d8); /* 9 */ - FF (d, a, b, c, x[ 9], S12, 0x8b44f7af); /* 10 */ - FF (c, d, a, b, x[10], S13, 0xffff5bb1); /* 11 */ - FF (b, c, d, a, x[11], S14, 0x895cd7be); /* 12 */ - FF (a, b, c, d, x[12], S11, 0x6b901122); /* 13 */ - FF (d, a, b, c, x[13], S12, 0xfd987193); /* 14 */ - FF (c, d, a, b, x[14], S13, 0xa679438e); /* 15 */ - FF (b, c, d, a, x[15], S14, 0x49b40821); /* 16 */ - - /* Round 2 */ - GG (a, b, c, d, x[ 1], S21, 0xf61e2562); /* 17 */ - GG (d, a, b, c, x[ 6], S22, 0xc040b340); /* 18 */ - GG (c, d, a, b, x[11], S23, 0x265e5a51); /* 19 */ - GG (b, c, d, a, x[ 0], S24, 0xe9b6c7aa); /* 20 */ - GG (a, b, c, d, x[ 5], S21, 0xd62f105d); /* 21 */ - GG (d, a, b, c, x[10], S22, 0x2441453); /* 22 */ - GG (c, d, a, b, x[15], S23, 0xd8a1e681); /* 23 */ - GG (b, c, d, a, x[ 4], S24, 0xe7d3fbc8); /* 24 */ - GG (a, b, c, d, x[ 9], S21, 0x21e1cde6); /* 25 */ - GG (d, a, b, c, x[14], S22, 0xc33707d6); /* 26 */ - GG (c, d, a, b, x[ 3], S23, 0xf4d50d87); /* 27 */ - GG (b, c, d, a, x[ 8], S24, 0x455a14ed); /* 28 */ - GG (a, b, c, d, x[13], S21, 0xa9e3e905); /* 29 */ - GG (d, a, b, c, x[ 2], S22, 0xfcefa3f8); /* 30 */ - GG (c, d, a, b, x[ 7], S23, 0x676f02d9); /* 31 */ - GG (b, c, d, a, x[12], S24, 0x8d2a4c8a); /* 32 */ - - /* Round 3 */ - HH (a, b, c, d, x[ 5], S31, 0xfffa3942); /* 33 */ - HH (d, a, b, c, x[ 8], S32, 0x8771f681); /* 34 */ - HH (c, d, a, b, x[11], S33, 0x6d9d6122); /* 35 */ - HH (b, c, d, a, x[14], S34, 0xfde5380c); /* 36 */ - HH (a, b, c, d, x[ 1], S31, 0xa4beea44); /* 37 */ - HH (d, a, b, c, x[ 4], S32, 0x4bdecfa9); /* 38 */ - HH (c, d, a, b, x[ 7], S33, 0xf6bb4b60); /* 39 */ - HH (b, c, d, a, x[10], S34, 0xbebfbc70); /* 40 */ - HH (a, b, c, d, x[13], S31, 0x289b7ec6); /* 41 */ - HH (d, a, b, c, x[ 0], S32, 0xeaa127fa); /* 42 */ - HH (c, d, a, b, x[ 3], S33, 0xd4ef3085); /* 43 */ - HH (b, c, d, a, x[ 6], S34, 0x4881d05); /* 44 */ - HH (a, b, c, d, x[ 9], S31, 0xd9d4d039); /* 45 */ - HH (d, a, b, c, x[12], S32, 0xe6db99e5); /* 46 */ - HH (c, d, a, b, x[15], S33, 0x1fa27cf8); /* 47 */ - HH (b, c, d, a, x[ 2], S34, 0xc4ac5665); /* 48 */ - - /* Round 4 */ - II (a, b, c, d, x[ 0], S41, 0xf4292244); /* 49 */ - II (d, a, b, c, x[ 7], S42, 0x432aff97); /* 50 */ - II (c, d, a, b, x[14], S43, 0xab9423a7); /* 51 */ - II (b, c, d, a, x[ 5], S44, 0xfc93a039); /* 52 */ - II (a, b, c, d, x[12], S41, 0x655b59c3); /* 53 */ - II (d, a, b, c, x[ 3], S42, 0x8f0ccc92); /* 54 */ - II (c, d, a, b, x[10], S43, 0xffeff47d); /* 55 */ - II (b, c, d, a, x[ 1], S44, 0x85845dd1); /* 56 */ - II (a, b, c, d, x[ 8], S41, 0x6fa87e4f); /* 57 */ - II (d, a, b, c, x[15], S42, 0xfe2ce6e0); /* 58 */ - II (c, d, a, b, x[ 6], S43, 0xa3014314); /* 59 */ - II (b, c, d, a, x[13], S44, 0x4e0811a1); /* 60 */ - II (a, b, c, d, x[ 4], S41, 0xf7537e82); /* 61 */ - II (d, a, b, c, x[11], S42, 0xbd3af235); /* 62 */ - II (c, d, a, b, x[ 2], S43, 0x2ad7d2bb); /* 63 */ - II (b, c, d, a, x[ 9], S44, 0xeb86d391); /* 64 */ - - state[0] += a; - state[1] += b; - state[2] += c; - state[3] += d; - - // Zeroize sensitive information. - memset ( (uint1 *) x, 0, sizeof(x)); - -} - - - -// Encodes input (UINT4) into output (unsigned char). Assumes len is -// a multiple of 4. -void LLMD5::encode (uint1 *output, const uint4 *input, const uint4 len) { - - unsigned int i, j; - - for (i = 0, j = 0; j < len; i++, j += 4) { - output[j] = (uint1) (input[i] & 0xff); - output[j+1] = (uint1) ((input[i] >> 8) & 0xff); - output[j+2] = (uint1) ((input[i] >> 16) & 0xff); - output[j+3] = (uint1) ((input[i] >> 24) & 0xff); - } -} - - - - -// Decodes input (unsigned char) into output (UINT4). Assumes len is -// a multiple of 4. -void LLMD5::decode (uint4 *output, const uint1 *input, const uint4 len){ - - unsigned int i, j; - - for (i = 0, j = 0; j < len; i++, j += 4) - output[i] = ((uint4)input[j]) | (((uint4)input[j+1]) << 8) | - (((uint4)input[j+2]) << 16) | (((uint4)input[j+3]) << 24); -} diff --git a/linden/indra/llmath/llmd5.h b/linden/indra/llmath/llmd5.h deleted file mode 100644 index 9ba0a9f..0000000 --- a/linden/indra/llmath/llmd5.h +++ /dev/null @@ -1,133 +0,0 @@ -/** - * @file llmd5.h - * - * $LicenseInfo:firstyear=2001&license=viewergpl$ - * - * Copyright (c) 2001-2008, Linden Research, Inc. - * - * Second Life Viewer Source Code - * 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://secondlifegrid.net/programs/open_source/licensing/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://secondlifegrid.net/programs/open_source/licensing/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. - * $/LicenseInfo$ - */ - -#ifndef LL_LLMD5_H -#define LL_LLMD5_H - -// LLMD5.CC - source code for the C++/object oriented translation and -// modification of MD5. - -// Translation and modification (c) 1995 by Mordechai T. Abzug - -// This translation/ modification is provided "as is," without express or -// implied warranty of any kind. - -// The translator/ modifier does not claim (1) that MD5 will do what you think -// it does; (2) that this translation/ modification is accurate; or (3) that -// this software is "merchantible." (Language for this disclaimer partially -// copied from the disclaimer below). - -/* based on: - - MD5.H - header file for MD5C.C - MDDRIVER.C - test driver for MD2, MD4 and MD5 - - Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All -rights reserved. - -License to copy and use this software is granted provided that it -is identified as the "RSA Data Security, Inc. MD5 Message-Digest -Algorithm" in all material mentioning or referencing this software -or this function. - -License is also granted to make and use derivative works provided -that such works are identified as "derived from the RSA Data -Security, Inc. MD5 Message-Digest Algorithm" in all material -mentioning or referencing the derived work. - -RSA Data Security, Inc. makes no representations concerning either -the merchantability of this software or the suitability of this -software for any particular purpose. It is provided "as is" -without express or implied warranty of any kind. - -These notices must be retained in any copies of any part of this -documentation and/or software. - -*/ - -// use for the raw digest output -const int MD5RAW_BYTES = 16; - -// use for outputting hex digests -const int MD5HEX_STR_SIZE = 33; // char hex[MD5HEX_STR_SIZE]; with null -const int MD5HEX_STR_BYTES = 32; // message system fixed size - -class LLMD5 { -// first, some types: - typedef unsigned int uint4; // assumes integer is 4 words long - typedef unsigned short int uint2; // assumes short integer is 2 words long - typedef unsigned char uint1; // assumes char is 1 word long - -// how many bytes to grab at a time when checking files - static const int BLOCK_LEN; - -public: -// methods for controlled operation: - LLMD5 (); // simple initializer - void update (const uint1 *input, const uint4 input_length); - void update (std::istream& stream); - void update (LLFILE *file); - void finalize (); - -// constructors for special circumstances. All these constructors finalize -// the MD5 context. - LLMD5 (const unsigned char *string); // digest string, finalize - LLMD5 (std::istream& stream); // digest stream, finalize - LLMD5 (LLFILE *file); // digest file, close, finalize - LLMD5 (const unsigned char *string, const unsigned int number); - -// methods to acquire finalized result - void raw_digest(unsigned char *array); // provide 16-byte array for binary data - void hex_digest(char *string); // provide 33-byte array for ascii-hex string - friend std::ostream& operator<< (std::ostream&, LLMD5 context); - - - -private: - - -// next, the private data: - uint4 state[4]; - uint4 count[2]; // number of *bits*, mod 2^64 - uint1 buffer[64]; // input buffer - uint1 digest[16]; - uint1 finalized; - -// last, the private methods, mostly static: - void init (); // called by all constructors - void transform (const uint1 *buffer); // does the real update work. Note - // that length is implied to be 64. - - static void encode (uint1 *dest, const uint4 *src, const uint4 length); - static void decode (uint4 *dest, const uint1 *src, const uint4 length); - -}; - -#endif // LL_LLMD5_H diff --git a/linden/indra/llmath/lloctree.h b/linden/indra/llmath/lloctree.h index e26bae5..57b359f 100644 --- a/linden/indra/llmath/lloctree.h +++ b/linden/indra/llmath/lloctree.h @@ -37,7 +37,7 @@ #include #include -#ifdef LL_RELEASE_FOR_DOWNLOAD +#if LL_RELEASE_WITH_DEBUG_INFO || LL_DEBUG #define OCT_ERRS LL_WARNS("OctreeErrors") #else #define OCT_ERRS LL_ERRS("OctreeErrors") diff --git a/linden/indra/llmath/llquaternion.cpp b/linden/indra/llmath/llquaternion.cpp index ab4855b..9eab8ed 100644 --- a/linden/indra/llmath/llquaternion.cpp +++ b/linden/indra/llmath/llquaternion.cpp @@ -791,7 +791,7 @@ LLQuaternion mayaQ(F32 xRot, F32 yRot, F32 zRot, LLQuaternion::Order order) const char *OrderToString( const LLQuaternion::Order order ) { - char *p = NULL; + const char *p = NULL; switch( order ) { default: @@ -937,15 +937,15 @@ void LLQuaternion::unpackFromVector3( const LLVector3& vec ) } } -BOOL LLQuaternion::parseQuat(const char* buf, LLQuaternion* value) +BOOL LLQuaternion::parseQuat(const std::string& buf, LLQuaternion* value) { - if( buf == NULL || buf[0] == '\0' || value == NULL) + if( buf.empty() || value == NULL) { return FALSE; } LLQuaternion quat; - S32 count = sscanf( buf, "%f %f %f %f", quat.mQ + 0, quat.mQ + 1, quat.mQ + 2, quat.mQ + 3 ); + S32 count = sscanf( buf.c_str(), "%f %f %f %f", quat.mQ + 0, quat.mQ + 1, quat.mQ + 2, quat.mQ + 3 ); if( 4 == count ) { value->set( quat ); diff --git a/linden/indra/llmath/llquaternion.h b/linden/indra/llmath/llquaternion.h index 048db2d..1eb982e 100644 --- a/linden/indra/llmath/llquaternion.h +++ b/linden/indra/llmath/llquaternion.h @@ -158,7 +158,7 @@ public: friend const char *OrderToString( const Order order ); friend Order StringToOrder( const char *str ); - static BOOL parseQuat(const char* buf, LLQuaternion* value); + static BOOL parseQuat(const std::string& buf, LLQuaternion* value); // For debugging, only //static U32 mMultCount; diff --git a/linden/indra/llmath/llrand.cpp b/linden/indra/llmath/llrand.cpp deleted file mode 100644 index bc8c867..0000000 --- a/linden/indra/llmath/llrand.cpp +++ /dev/null @@ -1,176 +0,0 @@ -/** - * @file llrand.cpp - * @brief Global random generator. - * - * $LicenseInfo:firstyear=2000&license=viewergpl$ - * - * Copyright (c) 2000-2008, Linden Research, Inc. - * - * Second Life Viewer Source Code - * 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://secondlifegrid.net/programs/open_source/licensing/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://secondlifegrid.net/programs/open_source/licensing/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. - * $/LicenseInfo$ - */ - -#include "linden_common.h" - -#include "llrand.h" -#include "lluuid.h" - -/** - * Through analysis, we have decided that we want to take values which - * are close enough to 1.0 to map back to 0.0. We came to this - * conclusion from noting that: - * - * [0.0, 1.0) - * - * when scaled to the integer set: - * - * [0, 4) - * - * there is some value close enough to 1.0 that when multiplying by 4, - * gets truncated to 4. Therefore: - * - * [0,1-eps] => 0 - * [1,2-eps] => 1 - * [2,3-eps] => 2 - * [3,4-eps] => 3 - * - * So 0 gets uneven distribution if we simply clamp. The actual - * clamp utilized in this file is to map values out of range back - * to 0 to restore uniform distribution. - * - * Also, for clamping floats when asking for a distribution from - * [0.0,g) we have determined that for values of g < 0.5, then - * rand*g=g, which is not the desired result. As above, we clamp to 0 - * to restore uniform distribution. - */ - -// *NOTE: The system rand implementation is probably not correct. -#define LL_USE_SYSTEM_RAND 0 - -#if LL_USE_SYSTEM_RAND -#include -#endif - -#if LL_USE_SYSTEM_RAND -class LLSeedRand -{ -public: - LLSeedRand() - { -#if LL_WINDOWS - srand(LLUUID::getRandomSeed()); -#else - srand48(LLUUID::getRandomSeed()); -#endif - } -}; -static LLSeedRand sRandomSeeder; -inline F64 ll_internal_random_double() -{ -#if LL_WINDOWS - return (F64)rand() / (F64)RAND_MAX; -#else - return drand48(); -#endif -} -inline F32 ll_internal_random_float() -{ -#if LL_WINDOWS - return (F32)rand() / (F32)RAND_MAX; -#else - return (F32)drand48(); -#endif -} -#else -static LLRandLagFib2281 gRandomGenerator(LLUUID::getRandomSeed()); -inline F64 ll_internal_random_double() -{ - // *HACK: Through experimentation, we have found that dual core - // CPUs (or at least multi-threaded processes) seem to - // occasionally give an obviously incorrect random number -- like - // 5^15 or something. Sooooo, clamp it as described above. - F64 rv = gRandomGenerator(); - if(!((rv >= 0.0) && (rv < 1.0))) return fmod(rv, 1.0); - return rv; -} - -inline F32 ll_internal_random_float() -{ - // The clamping rules are described above. - F32 rv = (F32)gRandomGenerator(); - if(!((rv >= 0.0f) && (rv < 1.0f))) return fmod(rv, 1.f); - return rv; -} -#endif - -S32 ll_rand() -{ - return ll_rand(RAND_MAX); -} - -S32 ll_rand(S32 val) -{ - // The clamping rules are described above. - S32 rv = (S32)(ll_internal_random_double() * val); - if(rv == val) return 0; - return rv; -} - -F32 ll_frand() -{ - return ll_internal_random_float(); -} - -F32 ll_frand(F32 val) -{ - // The clamping rules are described above. - F32 rv = ll_internal_random_float() * val; - if(val > 0) - { - if(rv >= val) return 0.0f; - } - else - { - if(rv <= val) return 0.0f; - } - return rv; -} - -F64 ll_drand() -{ - return ll_internal_random_double(); -} - -F64 ll_drand(F64 val) -{ - // The clamping rules are described above. - F64 rv = ll_internal_random_double() * val; - if(val > 0) - { - if(rv >= val) return 0.0; - } - else - { - if(rv <= val) return 0.0; - } - return rv; -} diff --git a/linden/indra/llmath/llrand.h b/linden/indra/llmath/llrand.h deleted file mode 100644 index 0a28213..0000000 --- a/linden/indra/llmath/llrand.h +++ /dev/null @@ -1,132 +0,0 @@ -/** - * @file llrand.h - * @brief Information, functions, and typedefs for randomness. - * - * $LicenseInfo:firstyear=2000&license=viewergpl$ - * - * Copyright (c) 2000-2008, Linden Research, Inc. - * - * Second Life Viewer Source Code - * 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://secondlifegrid.net/programs/open_source/licensing/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://secondlifegrid.net/programs/open_source/licensing/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. - * $/LicenseInfo$ - */ - -#ifndef LL_LLRAND_H -#define LL_LLRAND_H - -#include -#include - -/** - * 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 - */ - -/** - *@brief Generate a float from [0, RAND_MAX). - */ -S32 ll_rand(); - -/** - *@brief Generate a float from [0, val) or (val, 0]. - */ -S32 ll_rand(S32 val); - -/** - *@brief Generate a float from [0, 1.0). - */ -F32 ll_frand(); - -/** - *@brief Generate a float from [0, val) or (val, 0]. - */ -F32 ll_frand(F32 val); - -/** - *@brief Generate a double from [0, 1.0). - */ -F64 ll_drand(); - -/** - *@brief Generate a double from [0, val) or (val, 0]. - */ -F64 ll_drand(F64 val); - -/** - * @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(); - */ - -typedef boost::lagged_fibonacci607 LLRandLagFib607; -/**< - * lengh of cycle: 2^32,000 - * memory: 607*sizeof(double) (about 5K) - */ - -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/llrect.h b/linden/indra/llmath/llrect.h index f2a5d75..ebe5d83 100644 --- a/linden/indra/llmath/llrect.h +++ b/linden/indra/llmath/llrect.h @@ -183,10 +183,11 @@ public: LLRectBase& setCenterAndSize(Type x, Type y, Type width, Type height) { + // width and height could be odd, so favor top, right with extra pixel mLeft = x - width/2; - mTop = y + height/2; - mRight = x + width/2; mBottom = y - height/2; + mTop = mBottom + height; + mRight = mLeft + width; return *this; } diff --git a/linden/indra/llmath/llsdutil_math.cpp b/linden/indra/llmath/llsdutil_math.cpp new file mode 100644 index 0000000..5b72875 --- /dev/null +++ b/linden/indra/llmath/llsdutil_math.cpp @@ -0,0 +1,172 @@ +/** + * @file llsdutil_math.cpp + * @author Phoenix + * @date 2006-05-24 + * @brief Implementation of classes, functions, etc, for using structured data. + * + * $LicenseInfo:firstyear=2006&license=viewergpl$ + * + * Copyright (c) 2006-2008, Linden Research, Inc. + * + * Second Life Viewer Source Code + * 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://secondlifegrid.net/programs/open_source/licensing/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://secondlifegrid.net/programs/open_source/licensing/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. + * $/LicenseInfo$ + */ + +#include "linden_common.h" + +#include "llsdutil.h" + +#include "v3math.h" +#include "v4math.h" +#include "v3dmath.h" +#include "v2math.h" +#include "llquaternion.h" +#include "v4color.h" + +#if LL_WINDOWS +# define WIN32_LEAN_AND_MEAN +# include // for htonl +#elif LL_LINUX || LL_SOLARIS +# include +#elif LL_DARWIN +# include +#endif + +#include "llsdserialize.h" + +// vector3 +LLSD ll_sd_from_vector3(const LLVector3& vec) +{ + LLSD rv; + rv.append((F64)vec.mV[VX]); + rv.append((F64)vec.mV[VY]); + rv.append((F64)vec.mV[VZ]); + return rv; +} + +LLVector3 ll_vector3_from_sd(const LLSD& sd, S32 start_index) +{ + LLVector3 rv; + rv.mV[VX] = (F32)sd[start_index].asReal(); + rv.mV[VY] = (F32)sd[++start_index].asReal(); + rv.mV[VZ] = (F32)sd[++start_index].asReal(); + return rv; +} + +// vector4 +LLSD ll_sd_from_vector4(const LLVector4& vec) +{ + LLSD rv; + rv.append((F64)vec.mV[VX]); + rv.append((F64)vec.mV[VY]); + rv.append((F64)vec.mV[VZ]); + rv.append((F64)vec.mV[VW]); + return rv; +} + +LLVector4 ll_vector4_from_sd(const LLSD& sd, S32 start_index) +{ + LLVector4 rv; + rv.mV[VX] = (F32)sd[start_index].asReal(); + rv.mV[VY] = (F32)sd[++start_index].asReal(); + rv.mV[VZ] = (F32)sd[++start_index].asReal(); + rv.mV[VW] = (F32)sd[++start_index].asReal(); + return rv; +} + +// vector3d +LLSD ll_sd_from_vector3d(const LLVector3d& vec) +{ + LLSD rv; + rv.append(vec.mdV[VX]); + rv.append(vec.mdV[VY]); + rv.append(vec.mdV[VZ]); + return rv; +} + +LLVector3d ll_vector3d_from_sd(const LLSD& sd, S32 start_index) +{ + LLVector3d rv; + rv.mdV[VX] = sd[start_index].asReal(); + rv.mdV[VY] = sd[++start_index].asReal(); + rv.mdV[VZ] = sd[++start_index].asReal(); + return rv; +} + +//vector2 +LLSD ll_sd_from_vector2(const LLVector2& vec) +{ + LLSD rv; + rv.append((F64)vec.mV[VX]); + rv.append((F64)vec.mV[VY]); + return rv; +} + +LLVector2 ll_vector2_from_sd(const LLSD& sd) +{ + LLVector2 rv; + rv.mV[VX] = (F32)sd[0].asReal(); + rv.mV[VY] = (F32)sd[1].asReal(); + return rv; +} + +// Quaternion +LLSD ll_sd_from_quaternion(const LLQuaternion& quat) +{ + LLSD rv; + rv.append((F64)quat.mQ[VX]); + rv.append((F64)quat.mQ[VY]); + rv.append((F64)quat.mQ[VZ]); + rv.append((F64)quat.mQ[VW]); + return rv; +} + +LLQuaternion ll_quaternion_from_sd(const LLSD& sd) +{ + LLQuaternion quat; + quat.mQ[VX] = (F32)sd[0].asReal(); + quat.mQ[VY] = (F32)sd[1].asReal(); + quat.mQ[VZ] = (F32)sd[2].asReal(); + quat.mQ[VW] = (F32)sd[3].asReal(); + return quat; +} + +// color4 +LLSD ll_sd_from_color4(const LLColor4& c) +{ + LLSD rv; + rv.append(c.mV[0]); + rv.append(c.mV[1]); + rv.append(c.mV[2]); + rv.append(c.mV[3]); + return rv; +} + +LLColor4 ll_color4_from_sd(const LLSD& sd) +{ + LLColor4 c; + c.mV[0] = (F32)sd[0].asReal(); + c.mV[1] = (F32)sd[1].asReal(); + c.mV[2] = (F32)sd[2].asReal(); + c.mV[3] = (F32)sd[3].asReal(); + return c; +} diff --git a/linden/indra/llmath/llsphere.cpp b/linden/indra/llmath/llsphere.cpp index 62f6e27..f253b6c 100644 --- a/linden/indra/llmath/llsphere.cpp +++ b/linden/indra/llmath/llsphere.cpp @@ -20,6 +20,8 @@ * $/LicenseInfo$ */ +#include "linden_common.h" + #include "llsphere.h" LLSphere::LLSphere() diff --git a/linden/indra/llmath/lluuid.cpp b/linden/indra/llmath/lluuid.cpp deleted file mode 100644 index d835cbc..0000000 --- a/linden/indra/llmath/lluuid.cpp +++ /dev/null @@ -1,923 +0,0 @@ -/** - * @file lluuid.cpp - * - * $LicenseInfo:firstyear=2000&license=viewergpl$ - * - * Copyright (c) 2000-2008, Linden Research, Inc. - * - * Second Life Viewer Source Code - * 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://secondlifegrid.net/programs/open_source/licensing/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://secondlifegrid.net/programs/open_source/licensing/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. - * $/LicenseInfo$ - */ - -#include "linden_common.h" - -// We can't use WIN32_LEAN_AND_MEAN here, needs lots of includes. -#if LL_WINDOWS -# undef WIN32_LEAN_AND_MEAN -# include -# include -#endif - -#include "lldefs.h" -#include "llerror.h" - -#include "lluuid.h" -#include "llerror.h" -#include "llrand.h" -#include "llmd5.h" -#include "llstring.h" -#include "lltimer.h" - -const LLUUID LLUUID::null; -const LLTransactionID LLTransactionID::tnull; - -/* - -NOT DONE YET!!! - -static char BASE85_TABLE[] = { - '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', - 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', - 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', - 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', - 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', - 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', - 'y', 'z', '!', '#', '$', '%', '&', '(', ')', '*', - '+', '-', ';', '[', '=', '>', '?', '@', '^', '_', - '`', '{', '|', '}', '~', '\0' -}; - - -void encode( char * fiveChars, unsigned int word ) throw( ) -{ -for( int ix = 0; ix < 5; ++ix ) { -fiveChars[4-ix] = encodeTable[ word % 85]; -word /= 85; -} -} - -To decode: -unsigned int decode( char const * fiveChars ) throw( bad_input_data ) -{ -unsigned int ret = 0; -for( int ix = 0; ix < 5; ++ix ) { -char * s = strchr( encodeTable, fiveChars[ ix ] ); -if( s == 0 ) throw bad_input_data(); -ret = ret * 85 + (s-encodeTable); -} -return ret; -} - -void LLUUID::toBase85(char* out) -{ - U32* me = (U32*)&(mData[0]); - for(S32 i = 0; i < 4; ++i) - { - char* o = &out[i*i]; - for(S32 j = 0; j < 5; ++j) - { - o[4-j] = BASE85_TABLE[ me[i] % 85]; - word /= 85; - } - } -} - -unsigned int decode( char const * fiveChars ) throw( bad_input_data ) -{ - unsigned int ret = 0; - for( S32 ix = 0; ix < 5; ++ix ) - { - char * s = strchr( encodeTable, fiveChars[ ix ] ); - ret = ret * 85 + (s-encodeTable); - } - return ret; -} -*/ - -#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 -{ - sprintf(out, - "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x", - (U8)(mData[0]), - (U8)(mData[1]), - (U8)(mData[2]), - (U8)(mData[3]), - (U8)(mData[4]), - (U8)(mData[5]), - (U8)(mData[6]), - (U8)(mData[7]), - (U8)(mData[8]), - (U8)(mData[9]), - (U8)(mData[10]), - (U8)(mData[11]), - (U8)(mData[12]), - (U8)(mData[13]), - (U8)(mData[14]), - (U8)(mData[15])); -} - -void LLUUID::toCompressedString(char *out) const -{ - memcpy(out, mData, UUID_BYTES); /* Flawfinder: ignore */ - out[UUID_BYTES] = '\0'; -} - -std::string LLUUID::getString() const -{ - return asString(); -} - -std::string LLUUID::asString() const -{ - char str[UUID_STR_SIZE]; /* Flawfinder: ignore */ - toString(str); - return std::string(str); -} - -BOOL LLUUID::set(const std::string& in_string, BOOL emit) -{ - return set(in_string.c_str(), emit); -} - -BOOL LLUUID::set(const char *in_string, BOOL emit) -{ - BOOL broken_format = FALSE; - if (!in_string) - { - llerrs << "No string pointer in LLUUID::set!" << llendl; - setNull(); - return FALSE; - } - - // empty strings should make NULL uuid - if (!in_string[0]) - { - setNull(); - return TRUE; - } - - if (strlen(in_string) != (UUID_STR_LENGTH - 1)) /* Flawfinder: ignore */ - { - // I'm a moron. First implementation didn't have the right UUID format. - // Shouldn't see any of these any more - if (strlen(in_string) == (UUID_STR_LENGTH - 2)) /* Flawfinder: ignore */ - { - if(emit) - { - llinfos << "Warning! Using broken UUID string format" << llendl; - } - broken_format = TRUE; - } - else - { - // Bad UUID string. Spam as INFO, as most cases we don't care. - if(emit) - { - llinfos << "Bad UUID string: " << in_string << llendl; - } - setNull(); - return FALSE; - } - } - - U8 cur_pos = 0; - S32 i; - for (i = 0; i < UUID_BYTES; i++) - { - if ((i == 4) || (i == 6) || (i == 8) || (i == 10)) - { - cur_pos++; - if (broken_format && (i==10)) - { - // Missing - in the broken format - cur_pos--; - } - } - - mData[i] = 0; - - if ((*(in_string + cur_pos) >= '0') && (*(in_string+cur_pos) <= '9')) - { - mData[i] += (U8)(*(in_string + cur_pos) - '0'); - } - else if ((*(in_string + cur_pos) >= 'a') && (*(in_string+cur_pos) <='f')) - { - mData[i] += (U8)(10 + *(in_string + cur_pos) - 'a'); - } - else if ((*(in_string + cur_pos) >= 'A') && (*(in_string+cur_pos) <='F')) - { - mData[i] += (U8)(10 + *(in_string + cur_pos) - 'A'); - } - else - { - if(emit) - { - llwarns << "Invalid UUID string character" << llendl; - } - setNull(); - return FALSE; - } - - mData[i] = mData[i] << 4; - cur_pos++; - - if ((*(in_string + cur_pos) >= '0') && (*(in_string+cur_pos) <= '9')) - { - mData[i] += (U8)(*(in_string + cur_pos) - '0'); - } - else if ((*(in_string + cur_pos) >= 'a') && (*(in_string+cur_pos) <='f')) - { - mData[i] += (U8)(10 + *(in_string + cur_pos) - 'a'); - } - else if ((*(in_string + cur_pos) >= 'A') && (*(in_string+cur_pos) <='F')) - { - mData[i] += (U8)(10 + *(in_string + cur_pos) - 'A'); - } - else - { - if(emit) - { - llwarns << "Invalid UUID string character" << llendl; - } - setNull(); - return FALSE; - } - cur_pos++; - } - - return TRUE; -} - -BOOL LLUUID::validate(const std::string& in_string) -{ - return validate(in_string.c_str()); -} - -BOOL LLUUID::validate(const char *in_string) -{ - BOOL broken_format = FALSE; - if (!in_string) - { - return FALSE; - } - if (strlen(in_string) != (UUID_STR_LENGTH - 1)) /* Flawfinder: ignore */ - { - // I'm a moron. First implementation didn't have the right UUID format. - if (strlen(in_string) == (UUID_STR_LENGTH - 2)) /* Flawfinder: ignore */ - { - broken_format = TRUE; - } - else - { - return FALSE; - } - } - - U8 cur_pos = 0; - U32 i; - for (i = 0; i < 16; i++) - { - if ((i == 4) || (i == 6) || (i == 8) || (i == 10)) - { - cur_pos++; - if (broken_format && (i==10)) - { - // Missing - in the broken format - cur_pos--; - } - } - - if ((*(in_string + cur_pos) >= '0') && (*(in_string+cur_pos) <= '9')) - { - } - else if ((*(in_string + cur_pos) >= 'a') && (*(in_string+cur_pos) <='f')) - { - } - else if ((*(in_string + cur_pos) >= 'A') && (*(in_string+cur_pos) <='F')) - { - } - else - { - return FALSE; - } - - cur_pos++; - - if ((*(in_string + cur_pos) >= '0') && (*(in_string+cur_pos) <= '9')) - { - } - else if ((*(in_string + cur_pos) >= 'a') && (*(in_string+cur_pos) <='f')) - { - } - else if ((*(in_string + cur_pos) >= 'A') && (*(in_string+cur_pos) <='F')) - { - } - else - { - return FALSE; - } - cur_pos++; - } - return TRUE; -} - -const LLUUID& LLUUID::operator^=(const LLUUID& rhs) -{ - U32* me = (U32*)&(mData[0]); - const U32* other = (U32*)&(rhs.mData[0]); - for(S32 i = 0; i < 4; ++i) - { - me[i] = me[i] ^ other[i]; - } - return *this; -} - -LLUUID LLUUID::operator^(const LLUUID& rhs) const -{ - LLUUID id(*this); - id ^= rhs; - return id; -} - -void LLUUID::combine(const LLUUID& other, LLUUID& result) const -{ - LLMD5 md5_uuid; - md5_uuid.update((unsigned char*)mData, 16); - md5_uuid.update((unsigned char*)other.mData, 16); - md5_uuid.finalize(); - md5_uuid.raw_digest(result.mData); -} - -LLUUID LLUUID::combine(const LLUUID &other) const -{ - LLUUID combination; - combine(other, combination); - return combination; -} - -std::ostream& operator<<(std::ostream& s, const LLUUID &uuid) -{ - char uuid_str[UUID_STR_LENGTH]; - - uuid.toString(uuid_str); - s << uuid_str; - return s; -} - -std::istream& operator>>(std::istream &s, LLUUID &uuid) -{ - U32 i; - char uuid_str[UUID_STR_LENGTH]; /* Flawfinder: ignore */ - for (i = 0; i < UUID_STR_LENGTH-1; i++) - { - s >> uuid_str[i]; - } - uuid_str[i] = '\0'; - uuid.set(uuid_str); - return s; -} - -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++) -#if LL_USE_JANKY_RANDOM_NUMBER_GENERATOR - *cp++ = janky_fast_random_bytes() & 0xFF; -#else - *cp++ = ll_rand() & 0xFF; -#endif - return; -} - -#if LL_WINDOWS -typedef struct _ASTAT_ -{ - ADAPTER_STATUS adapt; - NAME_BUFFER NameBuff [30]; -}ASTAT, * PASTAT; - -// static -S32 LLUUID::getNodeID(unsigned char * node_id) -{ - ASTAT Adapter; - NCB Ncb; - UCHAR uRetCode; - LANA_ENUM lenum; - int i; - int retval = 0; - - memset( &Ncb, 0, sizeof(Ncb) ); - Ncb.ncb_command = NCBENUM; - Ncb.ncb_buffer = (UCHAR *)&lenum; - Ncb.ncb_length = sizeof(lenum); - uRetCode = Netbios( &Ncb ); - // printf( "The NCBENUM return code is: 0x%x \n", uRetCode ); - - for(i=0; i < lenum.length ;i++) - { - memset( &Ncb, 0, sizeof(Ncb) ); - Ncb.ncb_command = NCBRESET; - Ncb.ncb_lana_num = lenum.lana[i]; - - uRetCode = Netbios( &Ncb ); - // printf( "The NCBRESET on LANA %d return code is: 0x%x \n", - // lenum.lana[i], uRetCode ); - - memset( &Ncb, 0, sizeof (Ncb) ); - Ncb.ncb_command = NCBASTAT; - Ncb.ncb_lana_num = lenum.lana[i]; - - strcpy( (char *)Ncb.ncb_callname, "* " ); /* Flawfinder: ignore */ - Ncb.ncb_buffer = (unsigned char *)&Adapter; - Ncb.ncb_length = sizeof(Adapter); - - uRetCode = Netbios( &Ncb ); -// printf( "The NCBASTAT on LANA %d return code is: 0x%x \n", -// lenum.lana[i], uRetCode ); - if ( uRetCode == 0 ) - { -// printf( "The Ethernet Number on LANA %d is: %02x%02x%02x%02x%02x%02x\n", -// lenum.lana[i], -// Adapter.adapt.adapter_address[0], -// Adapter.adapt.adapter_address[1], -// Adapter.adapt.adapter_address[2], -// Adapter.adapt.adapter_address[3], -// Adapter.adapt.adapter_address[4], -// Adapter.adapt.adapter_address[5] ); - memcpy(node_id,Adapter.adapt.adapter_address,6); /* Flawfinder: ignore */ - retval = 1; - - } - } - return retval; -} - -#elif LL_DARWIN -// Mac OS X version of the UUID generation code... -/* - * Get an ethernet hardware address, if we can find it... - */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// static -S32 LLUUID::getNodeID(unsigned char *node_id) -{ - int i; - unsigned char *a = NULL; - struct ifaddrs *ifap, *ifa; - int rv; - S32 result = 0; - - if ((rv=getifaddrs(&ifap))==-1) - { - return -1; - } - if (ifap == NULL) - { - return -1; - } - - for (ifa = ifap; ifa != NULL; ifa = ifa->ifa_next) - { -// printf("Interface %s, address family %d, ", ifa->ifa_name, ifa->ifa_addr->sa_family); - for(i=0; i< ifa->ifa_addr->sa_len; i++) - { -// printf("%02X ", (unsigned char)ifa->ifa_addr->sa_data[i]); - } -// printf("\n"); - - if(ifa->ifa_addr->sa_family == AF_LINK) - { - // This is a link-level address - struct sockaddr_dl *lla = (struct sockaddr_dl *)ifa->ifa_addr; - -// printf("\tLink level address, type %02X\n", lla->sdl_type); - - if(lla->sdl_type == IFT_ETHER) - { - // Use the first ethernet MAC in the list. - // For some reason, the macro LLADDR() defined in net/if_dl.h doesn't expand correctly. This is what it would do. - a = (unsigned char *)&((lla)->sdl_data); - a += (lla)->sdl_nlen; - - if (!a[0] && !a[1] && !a[2] && !a[3] && !a[4] && !a[5]) - { - continue; - } - - if (node_id) - { - memcpy(node_id, a, 6); - result = 1; - } - - // We found one. - break; - } - } - } - freeifaddrs(ifap); - - return result; -} - -#else - -// Linux version of the UUID generation code... -/* - * Get the ethernet hardware address, if we can find it... - */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#define HAVE_NETINET_IN_H -#ifdef HAVE_NETINET_IN_H -#include -#if LL_SOLARIS -#include -#elif !LL_DARWIN -#include -#endif -#endif - -// static -S32 LLUUID::getNodeID(unsigned char *node_id) -{ - int sd; - struct ifreq ifr, *ifrp; - struct ifconf ifc; - char buf[1024]; - int n, i; - unsigned char *a; - -/* - * BSD 4.4 defines the size of an ifreq to be - * max(sizeof(ifreq), sizeof(ifreq.ifr_name)+ifreq.ifr_addr.sa_len - * However, under earlier systems, sa_len isn't present, so the size is - * just sizeof(struct ifreq) - */ -#ifdef HAVE_SA_LEN -#ifndef max -#define max(a,b) ((a) > (b) ? (a) : (b)) -#endif -#define ifreq_size(i) max(sizeof(struct ifreq),\ - sizeof((i).ifr_name)+(i).ifr_addr.sa_len) -#else -#define ifreq_size(i) sizeof(struct ifreq) -#endif /* HAVE_SA_LEN*/ - - sd = socket(AF_INET, SOCK_DGRAM, IPPROTO_IP); - if (sd < 0) { - return -1; - } - memset(buf, 0, sizeof(buf)); - ifc.ifc_len = sizeof(buf); - ifc.ifc_buf = buf; - if (ioctl (sd, SIOCGIFCONF, (char *)&ifc) < 0) { - close(sd); - return -1; - } - n = ifc.ifc_len; - for (i = 0; i < n; i+= ifreq_size(*ifr) ) { - ifrp = (struct ifreq *)((char *) ifc.ifc_buf+i); - strncpy(ifr.ifr_name, ifrp->ifr_name, IFNAMSIZ); /* Flawfinder: ignore */ -#ifdef SIOCGIFHWADDR - if (ioctl(sd, SIOCGIFHWADDR, &ifr) < 0) - continue; - a = (unsigned char *) &ifr.ifr_hwaddr.sa_data; -#else -#ifdef SIOCGENADDR - if (ioctl(sd, SIOCGENADDR, &ifr) < 0) - continue; - a = (unsigned char *) ifr.ifr_enaddr; -#else - /* - * XXX we don't have a way of getting the hardware - * address - */ - close(sd); - return 0; -#endif /* SIOCGENADDR */ -#endif /* SIOCGIFHWADDR */ - if (!a[0] && !a[1] && !a[2] && !a[3] && !a[4] && !a[5]) - continue; - if (node_id) { - memcpy(node_id, a, 6); /* Flawfinder: ignore */ - close(sd); - return 1; - } - } - close(sd); - return 0; -} - -#endif - -S32 LLUUID::cmpTime(uuid_time_t *t1, uuid_time_t *t2) -{ - // Compare two time values. - - if (t1->high < t2->high) return -1; - if (t1->high > t2->high) return 1; - if (t1->low < t2->low) return -1; - if (t1->low > t2->low) return 1; - return 0; -} - -void LLUUID::getSystemTime(uuid_time_t *timestamp) -{ - // Get system time with 100ns precision. Time is since Oct 15, 1582. -#if LL_WINDOWS - ULARGE_INTEGER time; - GetSystemTimeAsFileTime((FILETIME *)&time); - // NT keeps time in FILETIME format which is 100ns ticks since - // Jan 1, 1601. UUIDs use time in 100ns ticks since Oct 15, 1582. - // The difference is 17 Days in Oct + 30 (Nov) + 31 (Dec) - // + 18 years and 5 leap days. - time.QuadPart += - (unsigned __int64) (1000*1000*10) // seconds - * (unsigned __int64) (60 * 60 * 24) // days - * (unsigned __int64) (17+30+31+365*18+5); // # of days - - timestamp->high = time.HighPart; - timestamp->low = time.LowPart; -#else - struct timeval tp; - gettimeofday(&tp, 0); - - // Offset between UUID formatted times and Unix formatted times. - // UUID UTC base time is October 15, 1582. - // Unix base time is January 1, 1970. - U64 uuid_time = ((U64)tp.tv_sec * 10000000) + (tp.tv_usec * 10) + - U64L(0x01B21DD213814000); - timestamp->high = (U32) (uuid_time >> 32); - timestamp->low = (U32) (uuid_time & 0xFFFFFFFF); -#endif -} - -void LLUUID::getCurrentTime(uuid_time_t *timestamp) -{ - // Get current time as 60 bit 100ns ticks since whenever. - // Compensate for the fact that real clock resolution is less - // than 100ns. - - const U32 uuids_per_tick = 1024; - - static uuid_time_t time_last; - static U32 uuids_this_tick; - static BOOL init = FALSE; - - if (!init) { - getSystemTime(&time_last); - uuids_this_tick = uuids_per_tick; - init = TRUE; - } - - uuid_time_t time_now = {0,0}; - - while (1) { - getSystemTime(&time_now); - - // if clock reading changed since last UUID generated - if (cmpTime(&time_last, &time_now)) { - // reset count of uuid's generated with this clock reading - uuids_this_tick = 0; - break; - } - if (uuids_this_tick < uuids_per_tick) { - uuids_this_tick++; - break; - } - // going too fast for our clock; spin - } - - time_last = time_now; - - if (uuids_this_tick != 0) { - if (time_now.low & 0x80000000) { - time_now.low += uuids_this_tick; - if (!(time_now.low & 0x80000000)) - time_now.high++; - } else - time_now.low += uuids_this_tick; - } - - timestamp->high = time_now.high; - timestamp->low = time_now.low; -} - -void LLUUID::generate() -{ - // Create a UUID. - uuid_time_t timestamp; - - static unsigned char node_id[6]; /* Flawfinder: ignore */ - static int has_init = 0; - - // 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) - { - get_random_bytes(node_id, 6); - /* - * Set multicast bit, to prevent conflicts - * with IEEE 802 addresses obtained from - * network cards - */ - node_id[0] |= 0x80; - } - - getCurrentTime(&time_last); -#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; - } - - // get current time - getCurrentTime(×tamp); - - // if clock went backward change clockseq - if (cmpTime(×tamp, &time_last) == -1) { - clock_seq = (clock_seq + 1) & 0x3FFF; - if (clock_seq == 0) clock_seq++; - } - - memcpy(mData+10, node_id, 6); /* Flawfinder: ignore */ - U32 tmp; - tmp = timestamp.low; - mData[3] = (unsigned char) tmp; - tmp >>= 8; - mData[2] = (unsigned char) tmp; - tmp >>= 8; - mData[1] = (unsigned char) tmp; - tmp >>= 8; - mData[0] = (unsigned char) tmp; - - tmp = (U16) timestamp.high; - mData[5] = (unsigned char) tmp; - tmp >>= 8; - mData[4] = (unsigned char) tmp; - - tmp = (timestamp.high >> 16) | 0x1000; - mData[7] = (unsigned char) tmp; - tmp >>= 8; - mData[6] = (unsigned char) tmp; - - tmp = clock_seq; - mData[9] = (unsigned char) tmp; - tmp >>= 8; - mData[8] = (unsigned char) tmp; - - LLMD5 md5_uuid; - - md5_uuid.update(mData,16); - md5_uuid.finalize(); - md5_uuid.raw_digest(mData); - - time_last = timestamp; -} - -void LLUUID::generate(std::string hash_string) -{ - LLMD5 md5_uuid((U8*)hash_string.c_str()); - md5_uuid.raw_digest(mData); -} - -U32 LLUUID::getRandomSeed() -{ - static unsigned char seed[16]; /* Flawfinder: ignore */ - - getNodeID(&seed[0]); - seed[6]='\0'; - seed[7]='\0'; - getSystemTime((uuid_time_t *)(&seed[8])); - - LLMD5 md5_seed; - - md5_seed.update(seed,16); - md5_seed.finalize(); - md5_seed.raw_digest(seed); - - return(*(U32 *)seed); -} - -BOOL LLUUID::parseUUID(const char* buf, LLUUID* value) -{ - if( buf == NULL || buf[0] == '\0' || value == NULL) - { - return FALSE; - } - - LLString temp( buf ); - LLString::trim(temp); - if( LLUUID::validate( temp ) ) - { - value->set( temp ); - return TRUE; - } - return FALSE; -} - -LLAssetID LLTransactionID::makeAssetID(const LLUUID& session) const -{ - LLAssetID result; - if (isNull()) - { - result.setNull(); - } - else - { - combine(session, result); - } - return result; -} diff --git a/linden/indra/llmath/lluuid.h b/linden/indra/llmath/lluuid.h deleted file mode 100644 index 48308f2..0000000 --- a/linden/indra/llmath/lluuid.h +++ /dev/null @@ -1,330 +0,0 @@ -/** - * @file lluuid.h - * - * $LicenseInfo:firstyear=2000&license=viewergpl$ - * - * Copyright (c) 2000-2008, Linden Research, Inc. - * - * Second Life Viewer Source Code - * 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://secondlifegrid.net/programs/open_source/licensing/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://secondlifegrid.net/programs/open_source/licensing/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. - * $/LicenseInfo$ - */ - -#ifndef LL_LLUUID_H -#define LL_LLUUID_H - -#include -#include -#include "stdtypes.h" - -const S32 UUID_BYTES = 16; -const S32 UUID_WORDS = 4; -const S32 UUID_STR_LENGTH = 37; // actually wrong, should be 36 and use size below -const S32 UUID_STR_SIZE = 37; -const S32 UUID_BASE85_LENGTH = 21; // including the trailing NULL. - -struct uuid_time_t { - U32 high; - U32 low; - }; - -class LLUUID -{ -public: - // - // CREATORS - // - LLUUID(); - explicit LLUUID(const char *in_string); // Convert from string. - explicit LLUUID(const std::string& in_string); // Convert from string. - LLUUID(const LLUUID &in); - LLUUID &operator=(const LLUUID &rhs); - - ~LLUUID(); - - // - // MANIPULATORS - // - void generate(); // Generate a new UUID - void generate(std::string stream); //Generate a new UUID based on hash of input stream - BOOL set(const char *in_string, BOOL emit = TRUE); // Convert from string, if emit is FALSE, do not emit warnings - BOOL set(const std::string& in_string, BOOL emit = TRUE); // Convert from string, if emit is FALSE, do not emit warnings - void setNull(); // Faster than setting to LLUUID::null. - - S32 cmpTime(uuid_time_t *t1, uuid_time_t *t2); - static void getSystemTime(uuid_time_t *timestamp); - void getCurrentTime(uuid_time_t *timestamp); - - // - // ACCESSORS - // - BOOL isNull() const; // Faster than comparing to LLUUID::null. - BOOL notNull() const; // Faster than comparing to LLUUID::null. - // JC: This is dangerous. It allows UUIDs to be cast automatically - // to integers, among other things. Use isNull() or notNull(). - // operator bool() const; - - // JC: These must return real bool's (not BOOLs) or else use of the STL - // will generate bool-to-int performance warnings. - bool operator==(const LLUUID &rhs) const; - bool operator!=(const LLUUID &rhs) const; - bool operator<(const LLUUID &rhs) const; - bool operator>(const LLUUID &rhs) const; - - // xor functions. Useful since any two random uuids xored together - // will yield a determinate third random unique id that can be - // used as a key in a single uuid that represents 2. - const LLUUID& operator^=(const LLUUID& rhs); - LLUUID operator^(const LLUUID& rhs) const; - - // similar to functions above, but not invertible - // yields a third random UUID that can be reproduced from the two inputs - // but which, given the result and one of the inputs can't be used to - // deduce the other input - LLUUID combine(const LLUUID& other) const; - void combine(const LLUUID& other, LLUUID& result) const; - - friend std::ostream& operator<<(std::ostream& s, const LLUUID &uuid); - friend std::istream& operator>>(std::istream& s, LLUUID &uuid); - - void toString(char *out) const; // Does not allocate memory, needs 36 characters (including \0) - void toCompressedString(char *out) const; // Does not allocate memory, needs 17 characters (including \0) - - std::string asString() const; - std::string getString() const; - - U16 getCRC16() const; - U32 getCRC32() const; - - static BOOL validate(const std::string& in_string); // Validate that the UUID string is legal. - static BOOL validate(const char *in_string); // Validate that the UUID string is legal. - - static const LLUUID null; - - static U32 getRandomSeed(); - static S32 getNodeID(unsigned char * node_id); - - static BOOL parseUUID(const char* buf, LLUUID* value); - - U8 mData[UUID_BYTES]; -}; - - -// Construct -inline LLUUID::LLUUID() -{ - setNull(); -} - - -// Faster than copying from memory -inline void LLUUID::setNull() -{ - U32 *word = (U32 *)mData; - word[0] = 0; - word[1] = 0; - word[2] = 0; - word[3] = 0; -} - - -// Compare -inline bool LLUUID::operator==(const LLUUID& rhs) const -{ - U32 *tmp = (U32 *)mData; - U32 *rhstmp = (U32 *)rhs.mData; - // Note: binary & to avoid branching - return - (tmp[0] == rhstmp[0]) & - (tmp[1] == rhstmp[1]) & - (tmp[2] == rhstmp[2]) & - (tmp[3] == rhstmp[3]); -} - - -inline bool LLUUID::operator!=(const LLUUID& rhs) const -{ - U32 *tmp = (U32 *)mData; - U32 *rhstmp = (U32 *)rhs.mData; - // Note: binary | to avoid branching - return - (tmp[0] != rhstmp[0]) | - (tmp[1] != rhstmp[1]) | - (tmp[2] != rhstmp[2]) | - (tmp[3] != rhstmp[3]); -} - -/* -// JC: This is dangerous. It allows UUIDs to be cast automatically -// to integers, among other things. Use isNull() or notNull(). -inline LLUUID::operator bool() const -{ - U32 *word = (U32 *)mData; - return (word[0] | word[1] | word[2] | word[3]) > 0; -} -*/ - -inline BOOL LLUUID::notNull() const -{ - U32 *word = (U32 *)mData; - return (word[0] | word[1] | word[2] | word[3]) > 0; -} - -// Faster than == LLUUID::null because doesn't require -// as much memory access. -inline BOOL LLUUID::isNull() const -{ - U32 *word = (U32 *)mData; - // If all bits are zero, return !0 == TRUE - return !(word[0] | word[1] | word[2] | word[3]); -} - -// Copy constructor -inline LLUUID::LLUUID(const LLUUID& rhs) -{ - U32 *tmp = (U32 *)mData; - U32 *rhstmp = (U32 *)rhs.mData; - tmp[0] = rhstmp[0]; - tmp[1] = rhstmp[1]; - tmp[2] = rhstmp[2]; - tmp[3] = rhstmp[3]; -} - -inline LLUUID::~LLUUID() -{ -} - -// Assignment -inline LLUUID& LLUUID::operator=(const LLUUID& rhs) -{ - // No need to check the case where this==&rhs. The branch is slower than the write. - U32 *tmp = (U32 *)mData; - U32 *rhstmp = (U32 *)rhs.mData; - tmp[0] = rhstmp[0]; - tmp[1] = rhstmp[1]; - tmp[2] = rhstmp[2]; - tmp[3] = rhstmp[3]; - - return *this; -} - - -inline LLUUID::LLUUID(const char *in_string) -{ - if (!in_string || in_string[0] == 0) - { - setNull(); - return; - } - - set(in_string); -} - -inline LLUUID::LLUUID(const std::string& in_string) -{ - if (in_string.empty()) - { - setNull(); - return; - } - - set(in_string); -} - -// IW: DON'T "optimize" these w/ U32s or you'll scoogie the sort order -// IW: this will make me very sad -inline bool LLUUID::operator<(const LLUUID &rhs) const -{ - U32 i; - for( i = 0; i < (UUID_BYTES - 1); i++ ) - { - if( mData[i] != rhs.mData[i] ) - { - return (mData[i] < rhs.mData[i]); - } - } - return (mData[UUID_BYTES - 1] < rhs.mData[UUID_BYTES - 1]); -} - -inline bool LLUUID::operator>(const LLUUID &rhs) const -{ - U32 i; - for( i = 0; i < (UUID_BYTES - 1); i++ ) - { - if( mData[i] != rhs.mData[i] ) - { - return (mData[i] > rhs.mData[i]); - } - } - return (mData[UUID_BYTES - 1] > rhs.mData[UUID_BYTES - 1]); -} - -inline U16 LLUUID::getCRC16() const -{ - // A UUID is 16 bytes, or 8 shorts. - U16 *short_data = (U16*)mData; - U16 out = 0; - out += short_data[0]; - out += short_data[1]; - out += short_data[2]; - out += short_data[3]; - out += short_data[4]; - out += short_data[5]; - out += short_data[6]; - out += short_data[7]; - return out; -} - -inline U32 LLUUID::getCRC32() const -{ - U32 *tmp = (U32*)mData; - return tmp[0] + tmp[1] + tmp[2] + tmp[3]; -} - - -// Helper structure for ordering lluuids in stl containers. -// eg: std::map widget_map; -struct lluuid_less -{ - bool operator()(const LLUUID& lhs, const LLUUID& rhs) const - { - return (lhs < rhs) ? true : false; - } -}; - -typedef std::set uuid_list_t; - -/* - * Sub-classes for keeping transaction IDs and asset IDs - * straight. - */ -typedef LLUUID LLAssetID; - -class LLTransactionID : public LLUUID -{ -public: - LLTransactionID() : LLUUID() { } - - static const LLTransactionID tnull; - LLAssetID makeAssetID(const LLUUID& session) const; -}; - -#endif diff --git a/linden/indra/llmath/llvolume.cpp b/linden/indra/llmath/llvolume.cpp index f7c9286..7b6c6a9 100644 --- a/linden/indra/llmath/llvolume.cpp +++ b/linden/indra/llmath/llvolume.cpp @@ -82,11 +82,6 @@ const F32 TAPER_MAX = 1.f; const F32 SKEW_MIN = -0.95f; const F32 SKEW_MAX = 0.95f; -const S32 SCULPT_REZ_1 = 6; // changed from 4 to 6 - 6 looks round whereas 4 looks square -const S32 SCULPT_REZ_2 = 8; -const S32 SCULPT_REZ_3 = 16; -const S32 SCULPT_REZ_4 = 32; - const F32 SCULPT_MIN_AREA = 0.002f; BOOL check_same_clock_dir( const LLVector3& pt1, const LLVector3& pt2, const LLVector3& pt3, const LLVector3& norm) @@ -104,46 +99,128 @@ BOOL check_same_clock_dir( const LLVector3& pt1, const LLVector3& pt2, const LLV } } -// intersect test between triangle pt1,pt2,pt3 and line from linept to linept+vect -//returns TRUE if intersecting and moves linept to the point of intersection -BOOL LLTriangleLineSegmentIntersect( const LLVector3& pt1, const LLVector3& pt2, const LLVector3& pt3, LLVector3& linept, const LLVector3& vect) +BOOL LLLineSegmentBoxIntersect(const LLVector3& start, const LLVector3& end, const LLVector3& center, const LLVector3& size) +{ + float fAWdU[3]; + LLVector3 dir; + LLVector3 diff; + + for (U32 i = 0; i < 3; i++) + { + dir.mV[i] = 0.5f * (end.mV[i] - start.mV[i]); + diff.mV[i] = (0.5f * (end.mV[i] + start.mV[i])) - center.mV[i]; + fAWdU[i] = fabsf(dir.mV[i]); + if(fabsf(diff.mV[i])>size.mV[i] + fAWdU[i]) return false; + } + + float f; + f = dir.mV[1] * diff.mV[2] - dir.mV[2] * diff.mV[1]; if(fabsf(f)>size.mV[1]*fAWdU[2] + size.mV[2]*fAWdU[1]) return false; + f = dir.mV[2] * diff.mV[0] - dir.mV[0] * diff.mV[2]; if(fabsf(f)>size.mV[0]*fAWdU[2] + size.mV[2]*fAWdU[0]) return false; + f = dir.mV[0] * diff.mV[1] - dir.mV[1] * diff.mV[0]; if(fabsf(f)>size.mV[0]*fAWdU[1] + size.mV[1]*fAWdU[0]) return false; + + return true; +} + + +// intersect test between triangle vert0, vert1, vert2 and a ray from orig in direction dir. +// returns TRUE if intersecting and returns barycentric coordinates in intersection_a, intersection_b, +// and returns the intersection point along dir in intersection_t. + +// Moller-Trumbore algorithm +BOOL LLTriangleRayIntersect(const LLVector3& vert0, const LLVector3& vert1, const LLVector3& vert2, const LLVector3& orig, const LLVector3& dir, + F32* intersection_a, F32* intersection_b, F32* intersection_t, BOOL two_sided) { - LLVector3 V1 = pt2-pt1; - LLVector3 V2 = pt3-pt2; + F32 u, v, t; - LLVector3 norm = V1 % V2; + /* find vectors for two edges sharing vert0 */ + LLVector3 edge1 = vert1 - vert0; - F32 dotprod = norm * vect; + LLVector3 edge2 = vert2 - vert0;; - if(dotprod < 0) + /* begin calculating determinant - also used to calculate U parameter */ + LLVector3 pvec = dir % edge2; + + /* if determinant is near zero, ray lies in plane of triangle */ + F32 det = edge1 * pvec; + + if (!two_sided) { - //Find point of intersect to triangle plane. - //find t to intersect point - F32 t = -(norm * (linept-pt1))/dotprod; + if (det < F_APPROXIMATELY_ZERO) + { + return FALSE; + } + + /* calculate distance from vert0 to ray origin */ + LLVector3 tvec = orig - vert0; - // if ds is neg line started past triangle so can't hit triangle. - if (t > 0) + /* calculate U parameter and test bounds */ + u = tvec * pvec; + + if (u < 0.f || u > det) { return FALSE; } - LLVector3 pt_int = linept + (vect*t); + /* prepare to test V parameter */ + LLVector3 qvec = tvec % edge1; - if(check_same_clock_dir(pt1, pt2, pt_int, norm)) + /* calculate V parameter and test bounds */ + v = dir * qvec; + if (v < 0.f || u + v > det) { - if(check_same_clock_dir(pt2, pt3, pt_int, norm)) + return FALSE; + } + + /* calculate t, scale parameters, ray intersects triangle */ + t = edge2 * qvec; + F32 inv_det = 1.0 / det; + t *= inv_det; + u *= inv_det; + v *= inv_det; + } + + else // two sided { - if(check_same_clock_dir(pt3, pt1, pt_int, norm)) + if (det > -F_APPROXIMATELY_ZERO && det < F_APPROXIMATELY_ZERO) { - // answer in pt_int is insde triangle - linept.setVec(pt_int); - return TRUE; + return FALSE; } + F32 inv_det = 1.0 / det; + + /* calculate distance from vert0 to ray origin */ + LLVector3 tvec = orig - vert0; + + /* calculate U parameter and test bounds */ + u = (tvec * pvec) * inv_det; + if (u < 0.f || u > 1.f) + { + return FALSE; } + + /* prepare to test V parameter */ + LLVector3 qvec = tvec - edge1; + + /* calculate V parameter and test bounds */ + v = (dir * qvec) * inv_det; + + if (v < 0.f || u + v > 1.f) + { + return FALSE; } + + /* calculate t, ray intersects triangle */ + t = (edge2 * qvec) * inv_det; } - return FALSE; + if (intersection_a != NULL) + *intersection_a = u; + if (intersection_b != NULL) + *intersection_b = v; + if (intersection_t != NULL) + *intersection_t = t; + + + return TRUE; } @@ -198,9 +275,6 @@ void LLProfile::genNGon(const LLProfileParams& params, S32 sides, F32 offset, F3 F32 t, t_step, t_first, t_fraction, ang, ang_step; LLVector3 pt1,pt2; - mMaxX = 0.f; - mMinX = 0.f; - F32 begin = params.getBegin(); F32 end = params.getEnd(); @@ -236,15 +310,6 @@ void LLProfile::genNGon(const LLProfileParams& params, S32 sides, F32 offset, F3 if (t_fraction < 0.9999f) { LLVector3 new_pt = lerp(pt1, pt2, t_fraction); - F32 pt_x = new_pt.mV[VX]; - if (pt_x < mMinX) - { - mMinX = pt_x; - } - else if (pt_x > mMaxX) - { - mMaxX = pt_x; - } mProfile.push_back(new_pt); } @@ -254,16 +319,6 @@ void LLProfile::genNGon(const LLProfileParams& params, S32 sides, F32 offset, F3 // Iterate through all the integer steps of t. pt1.setVec(cos(ang)*scale,sin(ang)*scale,t); - F32 pt_x = pt1.mV[VX]; - if (pt_x < mMinX) - { - mMinX = pt_x; - } - else if (pt_x > mMaxX) - { - mMaxX = pt_x; - } - if (mProfile.size() > 0) { LLVector3 p = mProfile[mProfile.size()-1]; for (S32 i = 0; i < split && mProfile.size() > 0; i++) { @@ -287,15 +342,6 @@ void LLProfile::genNGon(const LLProfileParams& params, S32 sides, F32 offset, F3 if (t_fraction > 0.0001f) { LLVector3 new_pt = lerp(pt1, pt2, t_fraction); - F32 pt_x = new_pt.mV[VX]; - if (pt_x < mMinX) - { - mMinX = pt_x; - } - else if (pt_x > mMaxX) - { - mMaxX = pt_x; - } if (mProfile.size() > 0) { LLVector3 p = mProfile[mProfile.size()-1]; @@ -472,31 +518,9 @@ LLProfile::Face* LLProfile::addHole(const LLProfileParams& params, BOOL flat, F3 } -S32 sculpt_sides(F32 detail) -{ - - // detail is usually one of: 1, 1.5, 2.5, 4.0. - - if (detail <= 1.0) - { - return SCULPT_REZ_1; - } - if (detail <= 2.0) - { - return SCULPT_REZ_2; - } - if (detail <= 3.0) - { - return SCULPT_REZ_3; - } - else - { - return SCULPT_REZ_4; - } -} - -BOOL LLProfile::generate(const LLProfileParams& params, BOOL path_open,F32 detail, S32 split, BOOL is_sculpted) +BOOL LLProfile::generate(const LLProfileParams& params, BOOL path_open,F32 detail, S32 split, + BOOL is_sculpted, S32 sculpt_size) { LLMemType m1(LLMemType::MTYPE_VOLUME); @@ -640,7 +664,7 @@ BOOL LLProfile::generate(const LLProfileParams& params, BOOL path_open,F32 detai S32 sides = (S32)circle_detail; if (is_sculpted) - sides = sculpt_sides(detail); + sides = sculpt_size; genNGon(params, sides); @@ -1131,7 +1155,8 @@ const LLVector2 LLPathParams::getEndScale() const return end_scale; } -BOOL LLPath::generate(const LLPathParams& params, F32 detail, S32 split, BOOL is_sculpted) +BOOL LLPath::generate(const LLPathParams& params, F32 detail, S32 split, + BOOL is_sculpted, S32 sculpt_size) { LLMemType m1(LLMemType::MTYPE_VOLUME); @@ -1194,7 +1219,7 @@ BOOL LLPath::generate(const LLPathParams& params, F32 detail, S32 split, BOOL is S32 sides = (S32)llfloor(llfloor((MIN_DETAIL_FACES * detail + twist_mag * 3.5f * (detail-0.5f))) * params.getRevolutions()); if (is_sculpted) - sides = sculpt_sides(detail); + sides = sculpt_size; genNGon(params, sides); } @@ -1259,7 +1284,8 @@ BOOL LLPath::generate(const LLPathParams& params, F32 detail, S32 split, BOOL is return TRUE; } -BOOL LLDynamicPath::generate(const LLPathParams& params, F32 detail, S32 split, BOOL is_sculpted) +BOOL LLDynamicPath::generate(const LLPathParams& params, F32 detail, S32 split, + BOOL is_sculpted, S32 sculpt_size) { LLMemType m1(LLMemType::MTYPE_VOLUME); @@ -1979,6 +2005,12 @@ void LLVolume::sculptGeneratePlaceholder() // create the vertices from the map void LLVolume::sculptGenerateMapVertices(U16 sculpt_width, U16 sculpt_height, S8 sculpt_components, const U8* sculpt_data, U8 sculpt_type) { + U8 sculpt_stitching = sculpt_type & LL_SCULPT_TYPE_MASK; + BOOL sculpt_invert = sculpt_type & LL_SCULPT_FLAG_INVERT; + BOOL sculpt_mirror = sculpt_type & LL_SCULPT_FLAG_MIRROR; + BOOL reverse_horizontal = (sculpt_invert ? !sculpt_mirror : sculpt_mirror); // XOR + + LLMemType m1(LLMemType::MTYPE_VOLUME); S32 sizeS = mPathp->mPath.size(); @@ -1993,13 +2025,21 @@ void LLVolume::sculptGenerateMapVertices(U16 sculpt_width, U16 sculpt_height, S8 S32 i = t + line; Point& pt = mMesh[i]; - U32 x = (U32) ((F32)t/(sizeT-1) * (F32) sculpt_width); + S32 reversed_t = t; + + if (reverse_horizontal) + { + reversed_t = sizeT - t - 1; + } + + U32 x = (U32) ((F32)reversed_t/(sizeT-1) * (F32) sculpt_width); U32 y = (U32) ((F32)s/(sizeS-1) * (F32) sculpt_height); + if (y == 0) // top row stitching { // pinch? - if (sculpt_type == LL_SCULPT_TYPE_SPHERE) + if (sculpt_stitching == LL_SCULPT_TYPE_SPHERE) { x = sculpt_width / 2; } @@ -2008,7 +2048,7 @@ void LLVolume::sculptGenerateMapVertices(U16 sculpt_width, U16 sculpt_height, S8 if (y == sculpt_height) // bottom row stitching { // wrap? - if (sculpt_type == LL_SCULPT_TYPE_TORUS) + if (sculpt_stitching == LL_SCULPT_TYPE_TORUS) { y = 0; } @@ -2018,7 +2058,7 @@ void LLVolume::sculptGenerateMapVertices(U16 sculpt_width, U16 sculpt_height, S8 } // pinch? - if (sculpt_type == LL_SCULPT_TYPE_SPHERE) + if (sculpt_stitching == LL_SCULPT_TYPE_SPHERE) { x = sculpt_width / 2; } @@ -2027,9 +2067,9 @@ void LLVolume::sculptGenerateMapVertices(U16 sculpt_width, U16 sculpt_height, S8 if (x == sculpt_width) // side stitching { // wrap? - if ((sculpt_type == LL_SCULPT_TYPE_SPHERE) || - (sculpt_type == LL_SCULPT_TYPE_TORUS) || - (sculpt_type == LL_SCULPT_TYPE_CYLINDER)) + if ((sculpt_stitching == LL_SCULPT_TYPE_SPHERE) || + (sculpt_stitching == LL_SCULPT_TYPE_TORUS) || + (sculpt_stitching == LL_SCULPT_TYPE_CYLINDER)) { x = 0; } @@ -2041,12 +2081,69 @@ void LLVolume::sculptGenerateMapVertices(U16 sculpt_width, U16 sculpt_height, S8 } pt.mPos = sculpt_xy_to_vector(x, y, sculpt_width, sculpt_height, sculpt_components, sculpt_data); + + if (sculpt_mirror) + { + pt.mPos.mV[VX] *= -1.f; + } } + line += sizeT; } } +const S32 SCULPT_REZ_1 = 6; // changed from 4 to 6 - 6 looks round whereas 4 looks square +const S32 SCULPT_REZ_2 = 8; +const S32 SCULPT_REZ_3 = 16; +const S32 SCULPT_REZ_4 = 32; + +S32 sculpt_sides(F32 detail) +{ + + // detail is usually one of: 1, 1.5, 2.5, 4.0. + + if (detail <= 1.0) + { + return SCULPT_REZ_1; + } + if (detail <= 2.0) + { + return SCULPT_REZ_2; + } + if (detail <= 3.0) + { + return SCULPT_REZ_3; + } + else + { + return SCULPT_REZ_4; + } +} + + + +// determine the number of vertices in both s and t direction for this sculpt +void sculpt_calc_mesh_resolution(U16 width, U16 height, U8 type, F32 detail, S32& s, S32& t) +{ + S32 vertices = sculpt_sides(detail); + + F32 ratio; + if ((width == 0) || (height == 0)) + ratio = 1.f; + else + ratio = (F32) width / (F32) height; + + + s = (S32)(vertices / fsqrtf(ratio)); + + s = llmax(s, 3); // no degenerate sizes, please + t = vertices * vertices / s; + + t = llmax(t, 3); // no degenerate sizes, please + s = vertices * vertices / t; +} + // sculpt replaces generate() for sculpted surfaces void LLVolume::sculpt(U16 sculpt_width, U16 sculpt_height, S8 sculpt_components, const U8* sculpt_data, S32 sculpt_level) { @@ -2061,11 +2158,16 @@ void LLVolume::sculpt(U16 sculpt_width, U16 sculpt_height, S8 sculpt_components, data_is_empty = TRUE; } - mPathp->generate(mParams.getPathParams(), mDetail, 0, TRUE); - mProfilep->generate(mParams.getProfileParams(), mPathp->isOpen(), mDetail, 0, TRUE); + S32 requested_sizeS = 0; + S32 requested_sizeT = 0; - S32 sizeS = mPathp->mPath.size(); - S32 sizeT = mProfilep->mProfile.size(); + sculpt_calc_mesh_resolution(sculpt_width, sculpt_height, sculpt_type, mDetail, requested_sizeS, requested_sizeT); + + mPathp->generate(mParams.getPathParams(), mDetail, 0, TRUE, requested_sizeS); + mProfilep->generate(mParams.getProfileParams(), mPathp->isOpen(), mDetail, 0, TRUE, requested_sizeT); + + S32 sizeS = mPathp->mPath.size(); // we requested a specific size, now see what we really got + S32 sizeT = mProfilep->mProfile.size(); // we requested a specific size, now see what we really got // weird crash bug - DEV-11158 - trying to collect more data: if ((sizeS == 0) || (sizeT == 0)) @@ -3405,47 +3507,99 @@ void LLVolume::generateSilhouetteVertices(std::vector &vertices, } } -S32 LLVolume::lineSegmentIntersect(const LLVector3& start, LLVector3& end) const +S32 LLVolume::lineSegmentIntersect(const LLVector3& start, const LLVector3& end, + S32 face, + LLVector3* intersection,LLVector2* tex_coord, LLVector3* normal, LLVector3* bi_normal) { - S32 ret = -1; + S32 hit_face = -1; - LLVector3 vec = end - start; + S32 start_face; + S32 end_face; - for (S32 i = 0; i < getNumFaces(); i++) + if (face == -1) // ALL_SIDES { - const LLVolumeFace& face = getVolumeFace(i); + start_face = 0; + end_face = getNumFaces() - 1; + } + else + { + start_face = face; + end_face = face; + } + + LLVector3 dir = end - start; + + F32 closest_t = 2.f; // must be larger than 1 + + for (S32 i = start_face; i <= end_face; i++) + { + const LLVolumeFace &face = getVolumeFace((U32)i); + + LLVector3 box_center = (face.mExtents[0] + face.mExtents[1]) / 2.f; + LLVector3 box_size = face.mExtents[1] - face.mExtents[0]; + + if (LLLineSegmentBoxIntersect(start, end, box_center, box_size)) + { + if (bi_normal != NULL) // if the caller wants binormals, we may need to generate them + { + genBinormals(i); + } + + for (U32 tri = 0; tri < face.mIndices.size()/3; tri++) + { + S32 index1 = face.mIndices[tri*3+0]; + S32 index2 = face.mIndices[tri*3+1]; + S32 index3 = face.mIndices[tri*3+2]; - for (U32 j = 0; j < face.mIndices.size()/3; j++) + F32 a, b, t; + + if (LLTriangleRayIntersect(face.mVertices[index1].mPosition, + face.mVertices[index2].mPosition, + face.mVertices[index3].mPosition, + start, dir, &a, &b, &t, FALSE)) + { + if ((t >= 0.f) && // if hit is after start + (t <= 1.f) && // and before end + (t < closest_t)) // and this hit is closer { - //approximate normal - S32 v1 = face.mIndices[j*3+0]; - S32 v2 = face.mIndices[j*3+1]; - S32 v3 = face.mIndices[j*3+2]; + closest_t = t; + hit_face = i; - LLVector3 norm = (face.mVertices[v2].mPosition - face.mVertices[v1].mPosition) % - (face.mVertices[v3].mPosition - face.mVertices[v2].mPosition); + if (intersection != NULL) + { + *intersection = start + dir * closest_t; + } - if (norm.magVecSquared() >= 0.00000001f) + if (tex_coord != NULL) { - //get view vector - //LLVector3 view = (start-face.mVertices[v1].mPosition); - //if (view * norm < 0.0f) + *tex_coord = ((1.f - a - b) * face.mVertices[index1].mTexCoord + + a * face.mVertices[index2].mTexCoord + + b * face.mVertices[index3].mTexCoord); + + } + + if (normal != NULL) { - if (LLTriangleLineSegmentIntersect( face.mVertices[v1].mPosition, - face.mVertices[v2].mPosition, - face.mVertices[v3].mPosition, - end, - vec)) + *normal = ((1.f - a - b) * face.mVertices[index1].mNormal + + a * face.mVertices[index2].mNormal + + b * face.mVertices[index3].mNormal); + } + + if (bi_normal != NULL) { - vec = end-start; - ret = (S32) i; + *bi_normal = ((1.f - a - b) * face.mVertices[index1].mBinormal + + a * face.mVertices[index2].mBinormal + + b * face.mVertices[index3].mBinormal); + } + } } } } } - return ret; + + return hit_face; } class LLVertexIndexPair @@ -4768,6 +4922,13 @@ BOOL LLVolumeFace::createSide(LLVolume* volume, BOOL partial_build) LLMemType m1(LLMemType::MTYPE_VOLUME); BOOL flat = mTypeMask & FLAT_MASK; + + U8 sculpt_type = volume->getParams().getSculptType(); + U8 sculpt_stitching = sculpt_type & LL_SCULPT_TYPE_MASK; + BOOL sculpt_invert = sculpt_type & LL_SCULPT_FLAG_INVERT; + BOOL sculpt_mirror = sculpt_type & LL_SCULPT_FLAG_MIRROR; + BOOL sculpt_reverse_horizontal = (sculpt_invert ? !sculpt_mirror : sculpt_mirror); // XOR + S32 num_vertices, num_indices; const std::vector& mesh = volume->getMesh(); @@ -4834,6 +4995,11 @@ BOOL LLVolumeFace::createSide(LLVolume* volume, BOOL partial_build) } } + if (sculpt_reverse_horizontal) + { + ss = 1.f - ss; + } + // Check to see if this triangle wraps around the array. if (mBeginS + s >= max_s) { @@ -4995,9 +5161,7 @@ BOOL LLVolumeFace::createSide(LLVolume* volume, BOOL partial_build) BOOL s_bottom_converges = ((mVertices[0].mPosition - mVertices[mNumS*(mNumT-2)].mPosition).magVecSquared() < 0.000001f); BOOL s_top_converges = ((mVertices[mNumS-1].mPosition - mVertices[mNumS*(mNumT-2)+mNumS-1].mPosition).magVecSquared() < 0.000001f); - U8 sculpt_type = volume->getParams().getSculptType(); - - if (sculpt_type == LL_SCULPT_TYPE_NONE) // logic for non-sculpt volumes + if (sculpt_stitching == LL_SCULPT_TYPE_NONE) // logic for non-sculpt volumes { if (volume->getPath().isOpen() == FALSE) { //wrap normals on T @@ -5046,15 +5210,15 @@ BOOL LLVolumeFace::createSide(LLVolume* volume, BOOL partial_build) BOOL wrap_s = FALSE; BOOL wrap_t = FALSE; - if (sculpt_type == LL_SCULPT_TYPE_SPHERE) + if (sculpt_stitching == LL_SCULPT_TYPE_SPHERE) average_poles = TRUE; - if ((sculpt_type == LL_SCULPT_TYPE_SPHERE) || - (sculpt_type == LL_SCULPT_TYPE_TORUS) || - (sculpt_type == LL_SCULPT_TYPE_CYLINDER)) + if ((sculpt_stitching == LL_SCULPT_TYPE_SPHERE) || + (sculpt_stitching == LL_SCULPT_TYPE_TORUS) || + (sculpt_stitching == LL_SCULPT_TYPE_CYLINDER)) wrap_s = TRUE; - if (sculpt_type == LL_SCULPT_TYPE_TORUS) + if (sculpt_stitching == LL_SCULPT_TYPE_TORUS) wrap_t = TRUE; diff --git a/linden/indra/llmath/llvolume.h b/linden/indra/llmath/llvolume.h index 5b48cfc..8ac0e71 100644 --- a/linden/indra/llmath/llvolume.h +++ b/linden/indra/llmath/llvolume.h @@ -175,7 +175,7 @@ const LLFaceID LL_FACE_OUTER_SIDE_3 = 0x1 << 8; //============================================================================ -// sculpt types +// sculpt types + flags const U8 LL_SCULPT_TYPE_NONE = 0; const U8 LL_SCULPT_TYPE_SPHERE = 1; @@ -183,21 +183,30 @@ const U8 LL_SCULPT_TYPE_TORUS = 2; const U8 LL_SCULPT_TYPE_PLANE = 3; const U8 LL_SCULPT_TYPE_CYLINDER = 4; +const U8 LL_SCULPT_TYPE_MASK = LL_SCULPT_TYPE_SPHERE | LL_SCULPT_TYPE_TORUS | LL_SCULPT_TYPE_PLANE | LL_SCULPT_TYPE_CYLINDER; + +const U8 LL_SCULPT_FLAG_INVERT = 64; +const U8 LL_SCULPT_FLAG_MIRROR = 128; class LLProfileParams { public: LLProfileParams() + : mCurveType(LL_PCODE_PROFILE_SQUARE), + mBegin(0.f), + mEnd(1.f), + mHollow(0.f), + mCRC(0) { - mCurveType = LL_PCODE_PROFILE_SQUARE; - mBegin = 0.f; - mEnd = 1.f; - mHollow = 0.f; } LLProfileParams(U8 curve, F32 begin, F32 end, F32 hollow) - : mCurveType(curve), mBegin(begin), mEnd(end), mHollow(hollow) + : mCurveType(curve), + mBegin(begin), + mEnd(end), + mHollow(hollow), + mCRC(0) { } @@ -222,6 +231,7 @@ public: temp_f32 = 1.f; } mHollow = temp_f32; + mCRC = 0; } bool operator==(const LLProfileParams ¶ms) const; @@ -309,27 +319,36 @@ class LLPathParams { public: LLPathParams() + : + mCurveType(LL_PCODE_PATH_LINE), + mBegin(0.f), + mEnd(1.f), + mScale(1.f,1.f), + mShear(0.f,0.f), + mTwistBegin(0.f), + mTwistEnd(0.f), + mRadiusOffset(0.f), + mTaper(0.f,0.f), + mRevolutions(1.f), + mSkew(0.f), + mCRC(0) { - mBegin = 0.f; - mEnd = 1.f; - mScale.setVec(1.f,1.f); - mShear.setVec(0.f,0.f); - mCurveType = LL_PCODE_PATH_LINE; - mTwistBegin = 0.f; - mTwistEnd = 0.f; - mRadiusOffset = 0.f; - mTaper.setVec(0.f,0.f); - mRevolutions = 1.f; - mSkew = 0.f; } LLPathParams(U8 curve, F32 begin, F32 end, F32 scx, F32 scy, F32 shx, F32 shy, F32 twistend, F32 twistbegin, F32 radiusoffset, F32 tx, F32 ty, F32 revolutions, F32 skew) - : mCurveType(curve), mBegin(begin), mEnd(end), mTwistBegin(twistbegin), mTwistEnd(twistend), - mRadiusOffset(radiusoffset), mRevolutions(revolutions), mSkew(skew) + : mCurveType(curve), + mBegin(begin), + mEnd(end), + mScale(scx,scy), + mShear(shx,shy), + mTwistBegin(twistbegin), + mTwistEnd(twistend), + mRadiusOffset(radiusoffset), + mTaper(tx,ty), + mRevolutions(revolutions), + mSkew(skew), + mCRC(0) { - mScale.setVec(scx,scy); - mShear.setVec(shx,shy); - mTaper.setVec(tx,ty); } LLPathParams(U8 curve, U16 begin, U16 end, U8 scx, U8 scy, U8 shx, U8 shy, U8 twistend, U8 twistbegin, U8 radiusoffset, U8 tx, U8 ty, U8 revolutions, U8 skew) @@ -347,6 +366,8 @@ public: mTaper.setVec(U8_TO_F32(tx) * TAPER_QUANTA,U8_TO_F32(ty) * TAPER_QUANTA); mRevolutions = ((F32)revolutions) * REV_QUANTA + 1.0f; mSkew = U8_TO_F32(skew) * SCALE_QUANTA; + + mCRC = 0; } bool operator==(const LLPathParams ¶ms) const; @@ -525,6 +546,7 @@ class LLVolumeParams { public: LLVolumeParams() + : mSculptType(LL_SCULPT_TYPE_NONE) { } @@ -649,7 +671,9 @@ public: mConcave(FALSE), mDirty(TRUE), mTotalOut(0), - mTotal(2) + mTotal(2), + mMinX(0.f), + mMaxX(0.f) { } @@ -660,7 +684,8 @@ public: BOOL isFlat(S32 face) const { return (mFaces[face].mCount == 2); } BOOL isOpen() const { return mOpen; } void setDirty() { mDirty = TRUE; } - BOOL generate(const LLProfileParams& params, BOOL path_open, F32 detail = 1.0f, S32 split = 0, BOOL is_sculpted = FALSE); + BOOL generate(const LLProfileParams& params, BOOL path_open, F32 detail = 1.0f, S32 split = 0, + BOOL is_sculpted = FALSE, S32 sculpt_size = 0); BOOL isConcave() const { return mConcave; } public: struct Face @@ -678,8 +703,6 @@ public: std::vector mFaces; std::vector mEdgeNormals; std::vector mEdgeCenters; - F32 mMaxX; - F32 mMinX; friend std::ostream& operator<<(std::ostream &s, const LLProfile &profile); @@ -698,6 +721,9 @@ protected: S32 mTotalOut; S32 mTotal; + + F32 mMaxX; + F32 mMinX; }; //------------------------------------------------------------------- @@ -728,7 +754,8 @@ public: virtual ~LLPath(); void genNGon(const LLPathParams& params, S32 sides, F32 offset=0.0f, F32 end_scale = 1.f, F32 twist_scale = 1.f); - virtual BOOL generate(const LLPathParams& params, F32 detail=1.0f, S32 split = 0, BOOL is_sculpted = FALSE); + virtual BOOL generate(const LLPathParams& params, F32 detail=1.0f, S32 split = 0, + BOOL is_sculpted = FALSE, S32 sculpt_size = 0); BOOL isOpen() const { return mOpen; } F32 getStep() const { return mStep; } @@ -754,7 +781,8 @@ class LLDynamicPath : public LLPath { public: LLDynamicPath() : LLPath() { } - /*virtual*/ BOOL generate(const LLPathParams& params, F32 detail=1.0f, S32 split = 0, BOOL is_sculpted = FALSE); + /*virtual*/ BOOL generate(const LLPathParams& params, F32 detail=1.0f, S32 split = 0, + BOOL is_sculpted = FALSE, S32 sculpt_size = 0); }; // Yet another "face" class - caches volume-specific, but not instance-specific data for faces) @@ -885,7 +913,13 @@ public: //get the face index of the face that intersects with the given line segment at the point //closest to start. Moves end to the point of intersection. Returns -1 if no intersection. //Line segment must be in volume space. - S32 lineSegmentIntersect(const LLVector3& start, LLVector3& end) const; + S32 lineSegmentIntersect(const LLVector3& start, const LLVector3& end, + S32 face = -1, // which face to check, -1 = ALL_SIDES + LLVector3* intersection = NULL, // return the intersection point + LLVector2* tex_coord = NULL, // return the texture coordinates of the intersection point + LLVector3* normal = NULL, // return the surface normal at the intersection point + LLVector3* bi_normal = NULL // return the surface bi-normal at the intersection point + ); // The following cleans up vertices and triangles, // getting rid of degenerate triangles and duplicate vertices, @@ -916,6 +950,8 @@ private: F32 sculptGetSurfaceArea(U16 sculpt_width, U16 sculpt_height, S8 sculpt_components, const U8* sculpt_data); void sculptGenerateMapVertices(U16 sculpt_width, U16 sculpt_height, S8 sculpt_components, const U8* sculpt_data, U8 sculpt_type); void sculptGeneratePlaceholder(); + void sculptCalcMeshResolution(U16 width, U16 height, U8 type, S32& s, S32& t); + protected: BOOL generate(); @@ -946,4 +982,10 @@ LLVector3 calc_binormal_from_triangle( const LLVector3& pos2, const LLVector2& tex2); +BOOL LLLineSegmentBoxIntersect(const LLVector3& start, const LLVector3& end, const LLVector3& center, const LLVector3& size); +BOOL LLTriangleRayIntersect(const LLVector3& vert0, const LLVector3& vert1, const LLVector3& vert2, const LLVector3& orig, const LLVector3& dir, + F32* intersection_a, F32* intersection_b, F32* intersection_t, BOOL two_sided); + + + #endif diff --git a/linden/indra/llmath/llvolumemgr.cpp b/linden/indra/llmath/llvolumemgr.cpp index 0b5464c..a3cd6b5 100644 --- a/linden/indra/llmath/llvolumemgr.cpp +++ b/linden/indra/llmath/llvolumemgr.cpp @@ -115,7 +115,7 @@ LLVolume* LLVolumeMgr::refVolume(const LLVolumeParams &volume_params, const S32 { mDataMutex->unlock(); } - return volgroupp->getLODVolume(detail); + return volgroupp->refLOD(detail); } // virtual @@ -294,7 +294,7 @@ bool LLVolumeLODGroup::cleanupRefs() return res; } -LLVolume* LLVolumeLODGroup::getLODVolume(const S32 detail) +LLVolume* LLVolumeLODGroup::refLOD(const S32 detail) { llassert(detail >=0 && detail < NUM_LODS); mAccessCount[detail]++; @@ -376,7 +376,6 @@ F32 LLVolumeLODGroup::getVolumeScaleFromDetail(const S32 detail) F32 LLVolumeLODGroup::dump() { - char dump_str[255]; /* Flawfinder: ignore */ F32 usage = 0.f; for (S32 i = 0; i < NUM_LODS; i++) { @@ -387,7 +386,7 @@ F32 LLVolumeLODGroup::dump() } usage = usage / (F32)NUM_LODS; - snprintf(dump_str, sizeof(dump_str), "%.3f %d %d %d %d", usage, mAccessCount[0], mAccessCount[1], mAccessCount[2], mAccessCount[3]); /* Flawfinder: ignore */ + std::string dump_str = llformat("%.3f %d %d %d %d", usage, mAccessCount[0], mAccessCount[1], mAccessCount[2], mAccessCount[3]); llinfos << dump_str << llendl; return usage; diff --git a/linden/indra/llmath/llvolumemgr.h b/linden/indra/llmath/llvolumemgr.h index dcaca01..d579fed 100644 --- a/linden/indra/llmath/llvolumemgr.h +++ b/linden/indra/llmath/llvolumemgr.h @@ -59,7 +59,7 @@ public: static void getDetailProximity(const F32 tan_angle, F32 &to_lower, F32& to_higher); static F32 getVolumeScaleFromDetail(const S32 detail); - LLVolume* getLODVolume(const S32 detail); + LLVolume* refLOD(const S32 detail); BOOL derefLOD(LLVolume *volumep); S32 getNumRefs() const { return mRefs; } diff --git a/linden/indra/llmath/v2math.cpp b/linden/indra/llmath/v2math.cpp index 76fa60f..c3bb093 100644 --- a/linden/indra/llmath/v2math.cpp +++ b/linden/indra/llmath/v2math.cpp @@ -33,6 +33,7 @@ //#include "vmath.h" #include "v2math.h" +#include "v3math.h" #include "v4math.h" #include "m4math.h" #include "m3math.h" diff --git a/linden/indra/llmath/v2math.h b/linden/indra/llmath/v2math.h index 5a520d2..350079d 100644 --- a/linden/indra/llmath/v2math.h +++ b/linden/indra/llmath/v2math.h @@ -33,6 +33,7 @@ #define LL_V2MATH_H #include "llmath.h" +#include "v3math.h" class LLVector4; class LLMatrix3; @@ -49,9 +50,10 @@ class LLVector2 static LLVector2 zero; - LLVector2(); // Initializes LLVector2 to (0, 0) - LLVector2(F32 x, F32 y); // Initializes LLVector2 to (x. y) - LLVector2(const F32 *vec); // Initializes LLVector2 to (vec[0]. vec[1]) + LLVector2(); // Initializes LLVector2 to (0, 0) + LLVector2(F32 x, F32 y); // Initializes LLVector2 to (x. y) + LLVector2(const F32 *vec); // Initializes LLVector2 to (vec[0]. vec[1]) + explicit LLVector2(const LLVector3 &vec); // Initializes LLVector2 to (vec[0]. vec[1]) // Clears LLVector2 to (0, 0). DEPRECATED - prefer zeroVec. void clear(); @@ -137,6 +139,12 @@ inline LLVector2::LLVector2(const F32 *vec) mV[VY] = vec[VY]; } +inline LLVector2::LLVector2(const LLVector3 &vec) +{ + mV[VX] = vec.mV[VX]; + mV[VY] = vec.mV[VY]; +} + // Clear and Assignment Functions diff --git a/linden/indra/llmath/v3color.h b/linden/indra/llmath/v3color.h index a3bf385..b9bc641 100644 --- a/linden/indra/llmath/v3color.h +++ b/linden/indra/llmath/v3color.h @@ -174,6 +174,10 @@ inline LLColor3::LLColor3(const F32 *vec) mV[VZ] = vec[VZ]; } +#if LL_WINDOWS +# pragma warning( disable : 4996 ) // strncpy teh sux0r +#endif + inline LLColor3::LLColor3(char* color_string) // takes a string of format "RRGGBB" where RR is hex 00..FF { if (strlen(color_string) < 6) /* Flawfinder: ignore */ diff --git a/linden/indra/llmath/v3dmath.cpp b/linden/indra/llmath/v3dmath.cpp index b59f519..5a3246c 100644 --- a/linden/indra/llmath/v3dmath.cpp +++ b/linden/indra/llmath/v3dmath.cpp @@ -132,15 +132,15 @@ const LLVector3d& LLVector3d::rotVec(F64 angle, F64 x, F64 y, F64 z) } -BOOL LLVector3d::parseVector3d(const char* buf, LLVector3d* value) +BOOL LLVector3d::parseVector3d(const std::string& buf, LLVector3d* value) { - if( buf == NULL || buf[0] == '\0' || value == NULL) + if( buf.empty() || value == NULL) { return FALSE; } LLVector3d v; - S32 count = sscanf( buf, "%lf %lf %lf", v.mdV + 0, v.mdV + 1, v.mdV + 2 ); + S32 count = sscanf( buf.c_str(), "%lf %lf %lf", v.mdV + 0, v.mdV + 1, v.mdV + 2 ); if( 3 == count ) { value->setVec( v ); diff --git a/linden/indra/llmath/v3dmath.h b/linden/indra/llmath/v3dmath.h index 9bd80b8..ecb333a 100644 --- a/linden/indra/llmath/v3dmath.h +++ b/linden/indra/llmath/v3dmath.h @@ -95,6 +95,10 @@ class LLVector3d F64 magVecSquared() const; // Returns magnitude squared of LLVector3d inline F64 normVec(); // Normalizes and returns the magnitude of LLVector3d + F64 length() const; // Returns magnitude of LLVector3d + F64 lengthSquared() const; // Returns magnitude squared of LLVector3d + inline F64 normalize(); // Normalizes and returns the magnitude of LLVector3d + const LLVector3d& rotVec(const F64 angle, const LLVector3d &vec); // Rotates about vec by angle radians const LLVector3d& rotVec(const F64 angle, const F64 x, const F64 y, const F64 z); // Rotates about x,y,z by angle radians const LLVector3d& rotVec(const LLMatrix3 &mat); // Rotates by LLMatrix4 mat @@ -128,7 +132,7 @@ class LLVector3d friend std::ostream& operator<<(std::ostream& s, const LLVector3d &a); // Stream a - static BOOL parseVector3d(const char* buf, LLVector3d* value); + static BOOL parseVector3d(const std::string& buf, LLVector3d* value); }; @@ -261,6 +265,28 @@ inline F64 LLVector3d::normVec(void) return (mag); } +inline F64 LLVector3d::normalize(void) +{ + F64 mag = fsqrtf(mdV[0]*mdV[0] + mdV[1]*mdV[1] + mdV[2]*mdV[2]); + F64 oomag; + + if (mag > FP_MAG_THRESHOLD) + { + oomag = 1.f/mag; + mdV[0] *= oomag; + mdV[1] *= oomag; + mdV[2] *= oomag; + } + else + { + mdV[0] = 0.f; + mdV[1] = 0.f; + mdV[2] = 0.f; + mag = 0; + } + return (mag); +} + // LLVector3d Magnitude and Normalization Functions inline F64 LLVector3d::magVec(void) const @@ -273,6 +299,16 @@ inline F64 LLVector3d::magVecSquared(void) const return mdV[0]*mdV[0] + mdV[1]*mdV[1] + mdV[2]*mdV[2]; } +inline F64 LLVector3d::length(void) const +{ + return fsqrtf(mdV[0]*mdV[0] + mdV[1]*mdV[1] + mdV[2]*mdV[2]); +} + +inline F64 LLVector3d::lengthSquared(void) const +{ + return mdV[0]*mdV[0] + mdV[1]*mdV[1] + mdV[2]*mdV[2]; +} + inline LLVector3d operator+(const LLVector3d &a, const LLVector3d &b) { LLVector3d c(a); @@ -416,8 +452,8 @@ inline F64 angle_between(const LLVector3d& a, const LLVector3d& b) { LLVector3d an = a; LLVector3d bn = b; - an.normVec(); - bn.normVec(); + an.normalize(); + bn.normalize(); F64 cosine = an * bn; F64 angle = (cosine >= 1.0f) ? 0.0f : (cosine <= -1.0f) ? F_PI : @@ -429,8 +465,8 @@ inline BOOL are_parallel(const LLVector3d &a, const LLVector3d &b, const F64 eps { LLVector3d an = a; LLVector3d bn = b; - an.normVec(); - bn.normVec(); + an.normalize(); + bn.normalize(); F64 dot = an * bn; if ( (1.0f - fabs(dot)) < epsilon) { @@ -443,7 +479,7 @@ inline BOOL are_parallel(const LLVector3d &a, const LLVector3d &b, const F64 eps inline LLVector3d projected_vec(const LLVector3d &a, const LLVector3d &b) { LLVector3d project_axis = b; - project_axis.normVec(); + project_axis.normalize(); return project_axis * (a * project_axis); } diff --git a/linden/indra/llmath/v3math.cpp b/linden/indra/llmath/v3math.cpp index bbe460f..cb87836 100644 --- a/linden/indra/llmath/v3math.cpp +++ b/linden/indra/llmath/v3math.cpp @@ -34,6 +34,7 @@ #include "v3math.h" //#include "vmath.h" +#include "v2math.h" #include "v4math.h" #include "m4math.h" #include "m3math.h" @@ -73,6 +74,72 @@ BOOL LLVector3::clamp(F32 min, F32 max) return ret; } +// Clamps length to an upper limit. +// Returns TRUE if the data changed +BOOL LLVector3::clampLength( F32 length_limit ) +{ + BOOL changed = FALSE; + + F32 len = length(); + if (llfinite(len)) + { + if ( len > length_limit) + { + normalize(); + if (length_limit < 0.f) + { + length_limit = 0.f; + } + mV[0] *= length_limit; + mV[1] *= length_limit; + mV[2] *= length_limit; + changed = TRUE; + } + } + else + { // this vector may still be salvagable + F32 max_abs_component = 0.f; + for (S32 i = 0; i < 3; ++i) + { + F32 abs_component = fabs(mV[i]); + if (llfinite(abs_component)) + { + if (abs_component > max_abs_component) + { + max_abs_component = abs_component; + } + } + else + { + // no it can't be salvaged --> clear it + clear(); + changed = TRUE; + break; + } + } + if (!changed) + { + // yes it can be salvaged --> + // bring the components down before we normalize + mV[0] /= max_abs_component; + mV[1] /= max_abs_component; + mV[2] /= max_abs_component; + normalize(); + + if (length_limit < 0.f) + { + length_limit = 0.f; + } + mV[0] *= length_limit; + mV[1] *= length_limit; + mV[2] *= length_limit; + } + } + + return changed; +} + + // Sets all values to absolute value of their original values // Returns TRUE if data changed BOOL LLVector3::abs() @@ -204,6 +271,13 @@ const LLVector3& LLVector3::setVec(const LLVector4 &vec) return (*this); } +LLVector3::LLVector3(const LLVector2 &vec) +{ + mV[VX] = (F32)vec.mV[VX]; + mV[VY] = (F32)vec.mV[VY]; + mV[VZ] = 0; +} + LLVector3::LLVector3(const LLVector3d &vec) { mV[VX] = (F32)vec.mdV[VX]; @@ -260,15 +334,15 @@ const LLVector3& operator*=(LLVector3 &a, const LLQuaternion &rot) } // static -BOOL LLVector3::parseVector3(const char* buf, LLVector3* value) +BOOL LLVector3::parseVector3(const std::string& buf, LLVector3* value) { - if( buf == NULL || buf[0] == '\0' || value == NULL) + if( buf.empty() || value == NULL) { return FALSE; } LLVector3 v; - S32 count = sscanf( buf, "%f %f %f", v.mV + 0, v.mV + 1, v.mV + 2 ); + S32 count = sscanf( buf.c_str(), "%f %f %f", v.mV + 0, v.mV + 1, v.mV + 2 ); if( 3 == count ) { value->setVec( v ); diff --git a/linden/indra/llmath/v3math.h b/linden/indra/llmath/v3math.h index ddb5e1f..65932cd 100644 --- a/linden/indra/llmath/v3math.h +++ b/linden/indra/llmath/v3math.h @@ -36,6 +36,7 @@ #include "llmath.h" #include "llsd.h" +class LLVector2; class LLVector4; class LLMatrix3; class LLVector3d; @@ -62,6 +63,7 @@ class LLVector3 inline LLVector3(); // Initializes LLVector3 to (0, 0, 0) inline LLVector3(const F32 x, const F32 y, const F32 z); // Initializes LLVector3 to (x. y, z) inline explicit LLVector3(const F32 *vec); // Initializes LLVector3 to (vec[0]. vec[1], vec[2]) + explicit LLVector3(const LLVector2 &vec); // Initializes LLVector3 to (vec[0]. vec[1], 0) explicit LLVector3(const LLVector3d &vec); // Initializes LLVector3 to (vec[0]. vec[1], vec[2]) explicit LLVector3(const LLVector4 &vec); // Initializes LLVector4 to (vec[0]. vec[1], vec[2]) LLVector3(const LLSD& sd); @@ -74,6 +76,7 @@ class LLVector3 inline BOOL isFinite() const; // checks to see if all values of LLVector3 are finite BOOL clamp(F32 min, F32 max); // Clamps all values to (min,max), returns TRUE if data changed + BOOL clampLength( F32 length_limit ); // Scales vector to limit length to a value void quantize16(F32 lowerxy, F32 upperxy, F32 lowerz, F32 upperz); // changes the vector to reflect quatization void quantize8(F32 lowerxy, F32 upperxy, F32 lowerz, F32 upperz); // changes the vector to reflect quatization @@ -147,7 +150,7 @@ class LLVector3 friend std::ostream& operator<<(std::ostream& s, const LLVector3 &a); // Stream a - static BOOL parseVector3(const char* buf, LLVector3* value); + static BOOL parseVector3(const std::string& buf, LLVector3* value); }; typedef LLVector3 LLSimLocalVec; diff --git a/linden/indra/llmath/v4color.cpp b/linden/indra/llmath/v4color.cpp index 8e6907e..88237a0 100644 --- a/linden/indra/llmath/v4color.cpp +++ b/linden/indra/llmath/v4color.cpp @@ -286,16 +286,14 @@ void LLColor4::calcHSL(F32* hue, F32* saturation, F32* luminance) const } // static -BOOL LLColor4::parseColor(const char* buf, LLColor4* color) +BOOL LLColor4::parseColor(const std::string& buf, LLColor4* color) { - if( buf == NULL || buf[0] == '\0' || color == NULL) + if( buf.empty() || color == NULL) { return FALSE; } - LLString full_string(buf); - - boost_tokenizer tokens(full_string, boost::char_separator(", ")); + boost_tokenizer tokens(buf, boost::char_separator(", ")); boost_tokenizer::iterator token_iter = tokens.begin(); if (token_iter == tokens.end()) { @@ -304,15 +302,15 @@ BOOL LLColor4::parseColor(const char* buf, LLColor4* color) // Grab the first token into a string, since we don't know // if this is a float or a color name. - LLString color_name( (*token_iter) ); + std::string color_name( (*token_iter) ); ++token_iter; if (token_iter != tokens.end()) { // There are more tokens to read. This must be a vector. LLColor4 v; - LLString::convertToF32( color_name, v.mV[VX] ); - LLString::convertToF32( *token_iter, v.mV[VY] ); + LLStringUtil::convertToF32( color_name, v.mV[VX] ); + LLStringUtil::convertToF32( *token_iter, v.mV[VY] ); v.mV[VZ] = 0.0f; v.mV[VW] = 1.0f; @@ -320,18 +318,18 @@ BOOL LLColor4::parseColor(const char* buf, LLColor4* color) if (token_iter == tokens.end()) { // This is a malformed vector. - llwarns << "LLColor4::parseColor() malformed color " << full_string << llendl; + llwarns << "LLColor4::parseColor() malformed color " << buf << llendl; } else { // There is a z-component. - LLString::convertToF32( *token_iter, v.mV[VZ] ); + LLStringUtil::convertToF32( *token_iter, v.mV[VZ] ); ++token_iter; if (token_iter != tokens.end()) { // There is an alpha component. - LLString::convertToF32( *token_iter, v.mV[VW] ); + LLStringUtil::convertToF32( *token_iter, v.mV[VW] ); } } @@ -615,19 +613,19 @@ BOOL LLColor4::parseColor(const char* buf, LLColor4* color) } // static -BOOL LLColor4::parseColor4(const char* buf, LLColor4* value) +BOOL LLColor4::parseColor4(const std::string& buf, LLColor4* value) { - if( buf == NULL || buf[0] == '\0' || value == NULL) + if( buf.empty() || value == NULL) { return FALSE; } LLColor4 v; - S32 count = sscanf( buf, "%f, %f, %f, %f", v.mV + 0, v.mV + 1, v.mV + 2, v.mV + 3 ); + S32 count = sscanf( buf.c_str(), "%f, %f, %f, %f", v.mV + 0, v.mV + 1, v.mV + 2, v.mV + 3 ); if (1 == count ) { // try this format - count = sscanf( buf, "%f %f %f %f", v.mV + 0, v.mV + 1, v.mV + 2, v.mV + 3 ); + count = sscanf( buf.c_str(), "%f %f %f %f", v.mV + 0, v.mV + 1, v.mV + 2, v.mV + 3 ); } if( 4 == count ) { diff --git a/linden/indra/llmath/v4color.h b/linden/indra/llmath/v4color.h index a2c0fb6..53e4407 100644 --- a/linden/indra/llmath/v4color.h +++ b/linden/indra/llmath/v4color.h @@ -211,8 +211,8 @@ class LLColor4 static LLColor4 cyan5; static LLColor4 cyan6; - static BOOL parseColor(const char* buf, LLColor4* color); - static BOOL parseColor4(const char* buf, LLColor4* color); + static BOOL parseColor(const std::string& buf, LLColor4* color); + static BOOL parseColor4(const std::string& buf, LLColor4* color); inline void clamp(); }; diff --git a/linden/indra/llmath/v4coloru.cpp b/linden/indra/llmath/v4coloru.cpp index 56a8413..7ad7eb2 100644 --- a/linden/indra/llmath/v4coloru.cpp +++ b/linden/indra/llmath/v4coloru.cpp @@ -93,19 +93,19 @@ std::ostream& operator<<(std::ostream& s, const LLColor4U &a) } // static -BOOL LLColor4U::parseColor4U(const char* buf, LLColor4U* value) +BOOL LLColor4U::parseColor4U(const std::string& buf, LLColor4U* value) { - if( buf == NULL || buf[0] == '\0' || value == NULL) + if( buf.empty() || value == NULL) { return FALSE; } U32 v[4]; - S32 count = sscanf( buf, "%u, %u, %u, %u", v + 0, v + 1, v + 2, v + 3 ); + S32 count = sscanf( buf.c_str(), "%u, %u, %u, %u", v + 0, v + 1, v + 2, v + 3 ); if (1 == count ) { // try this format - count = sscanf( buf, "%u %u %u %u", v + 0, v + 1, v + 2, v + 3 ); + count = sscanf( buf.c_str(), "%u %u %u %u", v + 0, v + 1, v + 2, v + 3 ); } if( 4 != count ) { diff --git a/linden/indra/llmath/v4coloru.h b/linden/indra/llmath/v4coloru.h index c9c5418..910a081 100644 --- a/linden/indra/llmath/v4coloru.h +++ b/linden/indra/llmath/v4coloru.h @@ -127,7 +127,7 @@ public: inline void setVecScaleClamp(const LLColor3 &color); inline void setVecScaleClamp(const LLColor4 &color); - static BOOL parseColor4U(const char* buf, LLColor4U* value); + static BOOL parseColor4U(const std::string& buf, LLColor4U* value); static LLColor4U white; static LLColor4U black; diff --git a/linden/indra/llmedia/CMakeLists.txt b/linden/indra/llmedia/CMakeLists.txt new file mode 100644 index 0000000..8ef8006 --- /dev/null +++ b/linden/indra/llmedia/CMakeLists.txt @@ -0,0 +1,94 @@ +# -*- cmake -*- + +project(llmedia) + +include(00-Common) +include(LLAudio) +include(LLCommon) +include(LLImage) +include(LLMath) +include(LLMedia) +include(LLMessage) +include(LLWindow) +include(Mozlib) + +include_directories( + ${GSTREAMER_INCLUDE_DIRS} + ${GSTREAMER_PLUGINS_BASE_INCLUDE_DIRS} + ${LLAUDIO_INCLUDE_DIRS} + ${LLCOMMON_INCLUDE_DIRS} + ${LLIMAGE_INCLUDE_DIRS} + ${LLMATH_INCLUDE_DIRS} + ${LLMESSAGE_INCLUDE_DIRS} + ${LLWINDOW_INCLUDE_DIRS} + ) + +set(llmedia_SOURCE_FILES + llmediaimplcommon.cpp + llmediaimplexample1.cpp + llmediaimplexample2.cpp + llmediaimplfactory.cpp + llmediamanager.cpp + ) + +set(llmedia_HEADER_FILES + CMakeLists.txt + + llmediabase.h + llmediaemitter.h + llmediaimplcommon.h + llmediaimplexample1.h + llmediaimplexample2.h + llmediaimplfactory.h + llmediaimplregister.h + llmediamanager.h + llmediaobserver.h + ) + +if (GSTREAMER) + list(APPEND llmedia_SOURCE_FILES + llmediaimplgstreamer.cpp + llmediaimplgstreamer_syms.cpp + llmediaimplgstreamervidplug.cpp + ) + + list(APPEND llmedia_HEADER_FILES + llmediaimplgstreamer.h + llmediaimplgstreamervidplug.h + llmediaimplgstreamer_syms.h + ) + + # Work around a bad interaction between broken gstreamer headers and + # g++ 4.3's increased strictness. + + if (${CXX_VERSION} MATCHES "4.[23]") + set_source_files_properties(llmediaimplgstreamervidplug.cpp PROPERTIES + COMPILE_FLAGS -Wno-error=write-strings) + endif (${CXX_VERSION} MATCHES "4.[23]") +endif (GSTREAMER) + +if (MOZLIB) + list(APPEND llmedia_SOURCE_FILES llmediaimplllmozlib.cpp) + + list(APPEND llmedia_HEADER_FILES llmediaimplllmozlib.h) +endif (MOZLIB) + +if (QUICKTIME) + list(APPEND llmedia_SOURCE_FILES llmediaimplquicktime.cpp) + list(APPEND llmedia_HEADER_FILES llmediaimplquicktime.h) + + # We use a bunch of deprecated system APIs. + if (DARWIN) + set_source_files_properties( + llmediaimplquicktime.cpp PROPERTIES + COMPILE_FLAGS -Wno-deprecated-declarations + ) + endif (DARWIN) +endif (QUICKTIME) + +set_source_files_properties(${llmedia_HEADER_FILES} + PROPERTIES HEADER_FILE_ONLY TRUE) + +list(APPEND llmedia_SOURCE_FILES ${llmedia_HEADER_FILES}) + +add_library (llmedia ${llmedia_SOURCE_FILES}) diff --git a/linden/indra/llmedia/files.lst b/linden/indra/llmedia/files.lst deleted file mode 100644 index 3ce18e5..0000000 --- a/linden/indra/llmedia/files.lst +++ /dev/null @@ -1,11 +0,0 @@ -llmedia/llmediaimplcommon.cpp -llmedia/llmediaimplexample1.cpp -llmedia/llmediaimplexample2.cpp -llmedia/llmediaimplfactory.cpp -llmedia/llmediaimplgstreamer.cpp -llmedia/llmediaimplgstreamer_syms.cpp -llmedia/llmediaimplgstreamervidplug.cpp -llmedia/llmediaimplllmozlib.cpp -llmedia/llmediaimplquicktime.cpp -llmedia/llmediamanager.cpp - diff --git a/linden/indra/llmedia/llmedia.vcproj b/linden/indra/llmedia/llmedia.vcproj deleted file mode 100644 index 38c53f0..0000000 --- a/linden/indra/llmedia/llmedia.vcproj +++ /dev/null @@ -1,245 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/linden/indra/llmedia/llmedia_vc8.vcproj b/linden/indra/llmedia/llmedia_vc8.vcproj deleted file mode 100644 index 4681a6c..0000000 --- a/linden/indra/llmedia/llmedia_vc8.vcproj +++ /dev/null @@ -1,323 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/linden/indra/llmedia/llmedia_vc9.vcproj b/linden/indra/llmedia/llmedia_vc9.vcproj deleted file mode 100644 index d032711..0000000 --- a/linden/indra/llmedia/llmedia_vc9.vcproj +++ /dev/null @@ -1,326 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/linden/indra/llmedia/llmediabase.h b/linden/indra/llmedia/llmediabase.h index 49c6d69..dad02ca 100644 --- a/linden/indra/llmedia/llmediabase.h +++ b/linden/indra/llmedia/llmediabase.h @@ -34,25 +34,6 @@ #ifndef LLMEDIABASE_H #define LLMEDIABASE_H -// Per-OS feature switches. -#if LL_DARWIN - #define LL_QUICKTIME_ENABLED 1 - #define LL_LLMOZLIB_ENABLED 1 -#elif LL_WINDOWS - #define LL_QUICKTIME_ENABLED 1 - #define LL_LLMOZLIB_ENABLED 1 -#elif LL_LINUX - #define LL_QUICKTIME_ENABLED 0 - #ifndef LL_LLMOZLIB_ENABLED - #define LL_LLMOZLIB_ENABLED 1 - #endif // def LL_LLMOZLIB_ENABLED -#elif LL_SOLARIS - #define LL_QUICKTIME_ENABLED 0 - #ifndef LL_LLMOZLIB_ENABLED - #define LL_LLMOZLIB_ENABLED 0 - #endif // def LL_LLMOZLIB_ENABLED -#endif - #if LL_LLMOZLIB_ENABLED && !defined ( MOZILLA_INTERNAL_API ) // Without this, nsTAString.h errors out with: // "Cannot use internal string classes without MOZILLA_INTERNAL_API defined. Use the frozen header nsStringAPI.h instead." diff --git a/linden/indra/llmedia/llmediaimplexample1.cpp b/linden/indra/llmedia/llmediaimplexample1.cpp index 03e8291..977d508 100644 --- a/linden/indra/llmedia/llmediaimplexample1.cpp +++ b/linden/indra/llmedia/llmediaimplexample1.cpp @@ -32,6 +32,8 @@ #include "llmediaimplexample1.h" #include "llmediaimplregister.h" +#include + // register this impl with media manager factory static LLMediaImplRegister sLLMediaImplExample1Reg( "LLMediaImplExample1", new LLMediaImplExample1Maker() ); diff --git a/linden/indra/llmedia/llmediaimplexample2.cpp b/linden/indra/llmedia/llmediaimplexample2.cpp index dc20e03..13036f9 100644 --- a/linden/indra/llmedia/llmediaimplexample2.cpp +++ b/linden/indra/llmedia/llmediaimplexample2.cpp @@ -32,6 +32,8 @@ #include "llmediaimplexample2.h" #include "llmediaimplregister.h" +#include + // register this impl with media manager factory static LLMediaImplRegister sLLMediaImplExample2Reg( "LLMediaImplExample2", new LLMediaImplExample2Maker() ); diff --git a/linden/indra/llmedia/llmediaimplgstreamer.cpp b/linden/indra/llmedia/llmediaimplgstreamer.cpp index 5bf30d9..51a5bca 100644 --- a/linden/indra/llmedia/llmediaimplgstreamer.cpp +++ b/linden/indra/llmedia/llmediaimplgstreamer.cpp @@ -235,10 +235,11 @@ static char* get_gst_state_name(GstState state) } #endif // LL_GST_REPORT_STATE_CHANGES -static gboolean -bus_callback (GstBus *bus, - GstMessage *message, - gpointer data) +//static +gboolean +LLMediaImplGStreamer::bus_callback (GstBus *bus, + GstMessage *message, + gpointer data) { if (GST_MESSAGE_TYPE(message) != GST_MESSAGE_STATE_CHANGED && GST_MESSAGE_TYPE(message) != GST_MESSAGE_BUFFERING) @@ -612,6 +613,27 @@ getMediaData () // virtual bool LLMediaImplGStreamer:: +seek( double time ) +{ + bool success = false; + if (mPlaybin) + { + success = llgst_element_seek(mPlaybin, 1.0F, GST_FORMAT_TIME, + GstSeekFlags(GST_SEEK_FLAG_FLUSH | + GST_SEEK_FLAG_KEY_UNIT), + GST_SEEK_TYPE_SET, gint64(time*1000000000.0F), + GST_SEEK_TYPE_NONE, GST_CLOCK_TIME_NONE); + } + DEBUGMSG("MEDIA SEEK REQUEST to %fsec result was %d", + float(time), int(success)); + return success; +} + + +/////////////////////////////////////////////////////////////////////////////// +// virtual +bool +LLMediaImplGStreamer:: setVolume(float volume) { mVolume = volume; diff --git a/linden/indra/llmedia/llmediaimplgstreamer.h b/linden/indra/llmedia/llmediaimplgstreamer.h index 944db59..247b0ce 100644 --- a/linden/indra/llmedia/llmediaimplgstreamer.h +++ b/linden/indra/llmedia/llmediaimplgstreamer.h @@ -43,8 +43,8 @@ extern "C" { #include #include -#include -#include +#include "apr_pools.h" +#include "apr_dso.h" } #include "llmediaimplgstreamervidplug.h" @@ -76,16 +76,20 @@ class LLMediaImplGStreamer: /* virtual */ int getTextureFormatPrimary() const; /* virtual */ int getTextureFormatType() const; /* virtual */ int getTextureFormatInternal() const; + /* virtual */ bool seek( double time ); /* virtual */ bool setVolume( float volume ); - bool stop(); - bool play(); LLMediaEmitter< LLMediaObserver > getEventEmitter() const {return mEventEmitter;}; private: // misc bool unload(); bool pause(); + bool stop(); + bool play(); + static gboolean bus_callback (GstBus *bus, + GstMessage *message, + gpointer data); unsigned char* mediaData; int mMediaRowbytes; diff --git a/linden/indra/llmedia/llmediaimplgstreamer_syms.cpp b/linden/indra/llmedia/llmediaimplgstreamer_syms.cpp index c5e3c7b..e81d886 100644 --- a/linden/indra/llmedia/llmediaimplgstreamer_syms.cpp +++ b/linden/indra/llmedia/llmediaimplgstreamer_syms.cpp @@ -34,8 +34,8 @@ extern "C" { #include -#include -#include +#include "apr_pools.h" +#include "apr_dso.h" } #include "llmediaimplgstreamer.h" diff --git a/linden/indra/llmedia/llmediaimplgstreamer_syms_raw.inc b/linden/indra/llmedia/llmediaimplgstreamer_syms_raw.inc index 26cefc0..08ba6df 100644 --- a/linden/indra/llmedia/llmediaimplgstreamer_syms_raw.inc +++ b/linden/indra/llmedia/llmediaimplgstreamer_syms_raw.inc @@ -34,6 +34,7 @@ LL_GST_SYM(true, gst_structure_get_value, G_CONST_RETURN GValue *, const GstStru LL_GST_SYM(true, gst_value_get_fraction_numerator, gint, const GValue *value); LL_GST_SYM(true, gst_value_get_fraction_denominator, gint, const GValue *value); LL_GST_SYM(true, gst_structure_get_name, G_CONST_RETURN gchar *, const GstStructure *structure); +LL_GST_SYM(true, gst_element_seek, bool, GstElement *, gdouble, GstFormat, GstSeekFlags, GstSeekType, gint64, GstSeekType, gint64); // optional symbols to grab LL_GST_SYM(false, gst_segtrap_set_enabled, void, gboolean enabled); diff --git a/linden/indra/llmedia/llmediamanager.cpp b/linden/indra/llmedia/llmediamanager.cpp index 8d637c0..f72e63c 100644 --- a/linden/indra/llmedia/llmediamanager.cpp +++ b/linden/indra/llmedia/llmediamanager.cpp @@ -36,10 +36,13 @@ #include "llmediaimplexample2.h" #include "llmediaimplquicktime.h" #include "llmediaimplgstreamer.h" -#include "llmediaimplllmozlib.h" +#if LL_LLMOZLIB_ENABLED +# include "llmediaimplllmozlib.h" +#endif LLMediaManager* LLMediaManager::sInstance = 0; + //////////////////////////////////////////////////////////////////////////////// // (private) LLMediaManager::LLMediaManager() @@ -52,6 +55,20 @@ LLMediaManager::~LLMediaManager() } //////////////////////////////////////////////////////////////////////////////// +// Early initialization for web browser for the viewer, so we can show +// the login screen and defer initialization of QuickTime, etc. JC +// (static) +void LLMediaManager::initBrowser( LLMediaManagerData* init_data ) +{ + if ( ! sInstance ) + sInstance = new LLMediaManager(); + +#if LL_LLMOZLIB_ENABLED + LLMediaImplLLMozLib::startup( init_data ); +#endif // LL_LLMOZLIB_ENABLED +} + +//////////////////////////////////////////////////////////////////////////////// // (static) void LLMediaManager::initClass( LLMediaManagerData* init_data ) { @@ -73,10 +90,6 @@ void LLMediaManager::initClass( LLMediaManagerData* init_data ) #if LL_GSTREAMER_ENABLED LLMediaImplGStreamer::startup( init_data ); #endif // LL_GSTREAMER_ENABLED - -#if LL_LLMOZLIB_ENABLED - LLMediaImplLLMozLib::startup( init_data ); -#endif // LL_LLMOZLIB_ENABLED } //////////////////////////////////////////////////////////////////////////////// diff --git a/linden/indra/llmedia/llmediamanager.h b/linden/indra/llmedia/llmediamanager.h index 0dbcc4a..ef721b2 100644 --- a/linden/indra/llmedia/llmediamanager.h +++ b/linden/indra/llmedia/llmediamanager.h @@ -78,6 +78,10 @@ class LLMediaManager public: virtual ~LLMediaManager(); + // Special case early init for just web browser component + // so we can show login screen. See .cpp file for details. JC + static void initBrowser( LLMediaManagerData* init_data ); + static void initClass( LLMediaManagerData* init_data ); static void cleanupClass(); static LLMediaManager* getInstance(); diff --git a/linden/indra/llmessage/CMakeLists.txt b/linden/indra/llmessage/CMakeLists.txt new file mode 100644 index 0000000..ba17265 --- /dev/null +++ b/linden/indra/llmessage/CMakeLists.txt @@ -0,0 +1,191 @@ +# -*- cmake -*- + +project(llmessage) + +include(00-Common) +include(LLCommon) +include(LLMath) +include(LLMessage) +include(LLVFS) + +include_directories (${CMAKE_CURRENT_SOURCE_DIR}) + +include_directories( + ${LLCOMMON_INCLUDE_DIRS} + ${LLMATH_INCLUDE_DIRS} + ${LLMESSAGE_INCLUDE_DIRS} + ${LLVFS_INCLUDE_DIRS} + ) + +set(llmessage_SOURCE_FILES + llares.cpp + llassetstorage.cpp + llblowfishcipher.cpp + llbuffer.cpp + llbufferstream.cpp + llcachename.cpp + llchainio.cpp + llcircuit.cpp + llclassifiedflags.cpp + llcurl.cpp + lldatapacker.cpp + lldispatcher.cpp + llfiltersd2xmlrpc.cpp + llhost.cpp + llhttpassetstorage.cpp + llhttpclient.cpp + llhttpnode.cpp + llhttpsender.cpp + llinstantmessage.cpp + lliobuffer.cpp + lliohttpserver.cpp + lliopipe.cpp + lliosocket.cpp + llioutil.cpp + llmail.cpp + llmessagebuilder.cpp + llmessageconfig.cpp + llmessagereader.cpp + llmessagetemplate.cpp + llmessagetemplateparser.cpp + llmessagethrottle.cpp + llmime.cpp + llnamevalue.cpp + llnullcipher.cpp + llpacketack.cpp + llpacketbuffer.cpp + llpacketring.cpp + llpartdata.cpp + llpumpio.cpp + llsdappservices.cpp + llsdhttpserver.cpp + llsdmessagebuilder.cpp + llsdmessagereader.cpp + llsdrpcclient.cpp + llsdrpcserver.cpp + llservicebuilder.cpp + llservice.cpp + lltemplatemessagebuilder.cpp + lltemplatemessagereader.cpp + llthrottle.cpp + lltransfermanager.cpp + lltransfersourceasset.cpp + lltransfersourcefile.cpp + lltransfertargetfile.cpp + lltransfertargetvfile.cpp + llurlrequest.cpp + lluseroperation.cpp + llxfer.cpp + llxfer_file.cpp + llxfermanager.cpp + llxfer_mem.cpp + llxfer_vfile.cpp + llxorcipher.cpp + message.cpp + message_prehash.cpp + message_string_table.cpp + net.cpp + network.cpp + partsyspacket.cpp + patch_code.cpp + patch_dct.cpp + patch_idct.cpp + ) + +set(llmessage_HEADER_FILES + CMakeLists.txt + + llares.h + llassetstorage.h + llblowfishcipher.h + llbuffer.h + llbufferstream.h + llcachename.h + llchainio.h + llcipher.h + llcircuit.h + llclassifiedflags.h + llcurl.h + lldatapacker.h + lldbstrings.h + lldispatcher.h + lleventflags.h + llfiltersd2xmlrpc.h + llfollowcamparams.h + llhost.h + llhttpassetstorage.h + llhttpclient.h + llhttpnode.h + llhttpsender.h + llinstantmessage.h + llinvite.h + lliobuffer.h + lliohttpserver.h + lliopipe.h + lliosocket.h + llioutil.h + llloginflags.h + llmail.h + llmessagebuilder.h + llmessageconfig.h + llmessagereader.h + llmessagetemplate.h + llmessagetemplateparser.h + llmessagethrottle.h + llmime.h + llmsgvariabletype.h + llnamevalue.h + llnullcipher.h + llpacketack.h + llpacketbuffer.h + llpacketring.h + llpartdata.h + llpumpio.h + llqueryflags.h + llregionflags.h + llregionhandle.h + llsdappservices.h + llsdhttpserver.h + llsdmessagebuilder.h + llsdmessagereader.h + llsdrpcclient.h + llsdrpcserver.h + llservice.h + llservicebuilder.h + lltaskname.h + llteleportflags.h + lltemplatemessagebuilder.h + lltemplatemessagereader.h + llthrottle.h + lltransfermanager.h + lltransfersourceasset.h + lltransfersourcefile.h + lltransfertargetfile.h + lltransfertargetvfile.h + llurlrequest.h + lluseroperation.h + llvehicleparams.h + llxfer.h + llxfermanager.h + llxfer_file.h + llxfer_mem.h + llxfer_vfile.h + llxorcipher.h + machine.h + mean_collision_data.h + message.h + message_prehash.h + net.h + network.h + partsyspacket.h + patch_code.h + patch_dct.h + sound_ids.h + ) + +set_source_files_properties(${llmessage_HEADER_FILES} + PROPERTIES HEADER_FILE_ONLY TRUE) + +list(APPEND llmessage_SOURCE_FILES ${llmessage_HEADER_FILES}) + +add_library (llmessage ${llmessage_SOURCE_FILES}) diff --git a/linden/indra/llmessage/files.lst b/linden/indra/llmessage/files.lst deleted file mode 100644 index 690cc37..0000000 --- a/linden/indra/llmessage/files.lst +++ /dev/null @@ -1,71 +0,0 @@ -llmessage/llassetstorage.cpp -llmessage/llblowfishcipher.cpp -llmessage/llbuffer.cpp -llmessage/llbufferstream.cpp -llmessage/llcachename.cpp -llmessage/llchainio.cpp -llmessage/llcircuit.cpp -llmessage/llclassifiedflags.cpp -llmessage/llcurl.cpp -llmessage/lldatapacker.cpp -llmessage/lldispatcher.cpp -llmessage/llfiltersd2xmlrpc.cpp -llmessage/llhost.cpp -llmessage/llhttpassetstorage.cpp -llmessage/llhttpclient.cpp -llmessage/llhttpnode.cpp -llmessage/llhttpsender.cpp -llmessage/llinstantmessage.cpp -llmessage/lliobuffer.cpp -llmessage/lliohttpserver.cpp -llmessage/lliopipe.cpp -llmessage/lliosocket.cpp -llmessage/llioutil.cpp -llmessage/llmail.cpp -llmessage/llmessagebuilder.cpp -llmessage/llmessageconfig.cpp -llmessage/llmessagereader.cpp -llmessage/llmessagetemplate.cpp -llmessage/llmessagetemplateparser.cpp -llmessage/llmessagethrottle.cpp -llmessage/llmime.cpp -llmessage/llnamevalue.cpp -llmessage/llnullcipher.cpp -llmessage/llpacketack.cpp -llmessage/llpacketbuffer.cpp -llmessage/llpacketring.cpp -llmessage/llpartdata.cpp -llmessage/llpumpio.cpp -llmessage/llsdappservices.cpp -llmessage/llsdhttpserver.cpp -llmessage/llsdmessagereader.cpp -llmessage/llsdmessagebuilder.cpp -llmessage/llsdrpcclient.cpp -llmessage/llsdrpcserver.cpp -llmessage/llservice.cpp -llmessage/llservicebuilder.cpp -llmessage/lltemplatemessagebuilder.cpp -llmessage/lltemplatemessagereader.cpp -llmessage/llthrottle.cpp -llmessage/lltransfermanager.cpp -llmessage/lltransfersourceasset.cpp -llmessage/lltransfersourcefile.cpp -llmessage/lltransfertargetfile.cpp -llmessage/lltransfertargetvfile.cpp -llmessage/llurlrequest.cpp -llmessage/lluseroperation.cpp -llmessage/llxfer.cpp -llmessage/llxfer_file.cpp -llmessage/llxfermanager.cpp -llmessage/llxfer_mem.cpp -llmessage/llxfer_vfile.cpp -llmessage/llxorcipher.cpp -llmessage/message.cpp -llmessage/message_prehash.cpp -llmessage/message_string_table.cpp -llmessage/net.cpp -llmessage/network.cpp -llmessage/partsyspacket.cpp -llmessage/patch_code.cpp -llmessage/patch_dct.cpp -llmessage/patch_idct.cpp diff --git a/linden/indra/llmessage/llares.cpp b/linden/indra/llmessage/llares.cpp new file mode 100644 index 0000000..5a310b3 --- /dev/null +++ b/linden/indra/llmessage/llares.cpp @@ -0,0 +1,804 @@ +/** + * @file llares.cpp + * @author Bryan O'Sullivan + * @date 2007-08-15 + * @brief Wrapper for asynchronous DNS lookups. + * + * $LicenseInfo:firstyear=2007&license=viewergpl$ + * + * Copyright (c) 2007-2008, Linden Research, Inc. + * + * Second Life Viewer Source Code + * 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://secondlifegrid.net/programs/open_source/licensing/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://secondlifegrid.net/programs/open_source/licensing/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. + * $/LicenseInfo$ + */ + +#include "linden_common.h" + +#include +#include + +#include "apr_portable.h" +#include "apr_network_io.h" +#include "apr_poll.h" + +#include "llapr.h" +#include "llares.h" + +#if defined(LL_WINDOWS) +# define ns_c_in 1 +# define NS_HFIXEDSZ 12 /* #/bytes of fixed data in header */ +# define NS_QFIXEDSZ 4 /* #/bytes of fixed data in query */ +# define NS_RRFIXEDSZ 10 /* #/bytes of fixed data in r record */ +#else +# include +#endif + +LLAres::HostResponder::~HostResponder() +{ +} + +void LLAres::HostResponder::hostResult(const hostent *ent) +{ + llinfos << "LLAres::HostResponder::hostResult not implemented" << llendl; +} + +void LLAres::HostResponder::hostError(int code) +{ + llinfos << "LLAres::HostResponder::hostError " << code << ": " + << LLAres::strerror(code) << llendl; +} + +LLAres::NameInfoResponder::~NameInfoResponder() +{ +} + +void LLAres::NameInfoResponder::nameInfoResult(const char *node, + const char *service) +{ + llinfos << "LLAres::NameInfoResponder::nameInfoResult not implemented" + << llendl; +} + +void LLAres::NameInfoResponder::nameInfoError(int code) +{ + llinfos << "LLAres::NameInfoResponder::nameInfoError " << code << ": " + << LLAres::strerror(code) << llendl; +} + +LLAres::QueryResponder::~QueryResponder() +{ +} + +void LLAres::QueryResponder::queryResult(const char *buf, size_t len) +{ + llinfos << "LLAres::QueryResponder::queryResult not implemented" + << llendl; +} + +void LLAres::QueryResponder::queryError(int code) +{ + llinfos << "LLAres::QueryResponder::queryError " << code << ": " + << LLAres::strerror(code) << llendl; +} + +LLAres::LLAres() +{ + ares_init(&chan_); +} + +LLAres::~LLAres() +{ + ares_destroy(chan_); +} + +void LLAres::cancel() +{ + ares_cancel(chan_); +} + +static void host_callback_1_5(void *arg, int status, int timeouts, + struct hostent *ent) +{ + LLPointer *resp = + (LLPointer *) arg; + + if (status == ARES_SUCCESS) + { + (*resp)->hostResult(ent); + } else { + (*resp)->hostError(status); + } + + delete resp; +} + +#if ARES_VERSION_MAJOR == 1 && ARES_VERSION_MINOR == 4 +static void host_callback(void *arg, int status, struct hostent *ent) +{ + host_callback_1_5(arg, status, 0, ent); +} +#else +# define host_callback host_callback_1_5 +#endif + +void LLAres::getHostByName(const char *name, HostResponder *resp, + int family) +{ + ares_gethostbyname(chan_, name, family, host_callback, + new LLPointer(resp)); +} + +void LLAres::getSrvRecords(const std::string &name, SrvResponder *resp) +{ + search(name, RES_SRV, resp); +} + +void LLAres::rewriteURI(const std::string &uri, UriRewriteResponder *resp) +{ + llinfos << "Rewriting " << uri << llendl; + + resp->mUri = LLURI(uri); + search("_" + resp->mUri.scheme() + "._tcp." + resp->mUri.hostName(), + RES_SRV, resp); +} + +LLQueryResponder::LLQueryResponder() + : LLAres::QueryResponder(), + mResult(ARES_ENODATA) +{ +} + +int LLQueryResponder::parseRR(const char *buf, size_t len, const char *&pos, + LLPointer &r) +{ + std::string rrname; + size_t enclen; + int ret; + + // RR name. + + ret = LLAres::expandName(pos, buf, len, rrname, enclen); + if (ret != ARES_SUCCESS) + { + return ret; + } + + pos += enclen; + + if (pos + NS_RRFIXEDSZ > buf + len) + { + return ARES_EBADRESP; + } + + int rrtype = DNS_RR_TYPE(pos); + int rrclass = DNS_RR_CLASS(pos); + int rrttl = DNS_RR_TTL(pos); + int rrlen = DNS_RR_LEN(pos); + + if (rrclass != ns_c_in) + { + return ARES_EBADRESP; + } + + pos += NS_RRFIXEDSZ; + + if (pos + rrlen > buf + len) + { + return ARES_EBADRESP; + } + + switch (rrtype) + { + case RES_A: + r = new LLARecord(rrname, rrttl); + break; + case RES_NS: + r = new LLNsRecord(rrname, rrttl); + break; + case RES_CNAME: + r = new LLCnameRecord(rrname, rrttl); + break; + case RES_PTR: + r = new LLPtrRecord(rrname, rrttl); + break; + case RES_AAAA: + r = new LLAaaaRecord(rrname, rrttl); + break; + case RES_SRV: + r = new LLSrvRecord(rrname, rrttl); + break; + default: + llinfos << "LLQueryResponder::parseRR got unknown RR type " << rrtype + << llendl; + return ARES_EBADRESP; + } + + ret = r->parse(buf, len, pos, rrlen); + + if (ret == ARES_SUCCESS) + { + pos += rrlen; + } else { + r = NULL; + } + + return ret; +} + +int LLQueryResponder::parseSection(const char *buf, size_t len, + size_t count, const char *&pos, + dns_rrs_t &rrs) +{ + int ret = ARES_SUCCESS; + + for (size_t i = 0; i < count; i++) + { + LLPointer r; + ret = parseRR(buf, len, pos, r); + if (ret != ARES_SUCCESS) + { + break; + } + rrs.push_back(r); + } + + return ret; +} + +void LLQueryResponder::queryResult(const char *buf, size_t len) +{ + const char *pos = buf; + int qdcount = DNS_HEADER_QDCOUNT(pos); + int ancount = DNS_HEADER_ANCOUNT(pos); + int nscount = DNS_HEADER_NSCOUNT(pos); + int arcount = DNS_HEADER_ARCOUNT(pos); + int ret; + + if (qdcount == 0 || ancount + nscount + arcount == 0) + { + ret = ARES_ENODATA; + goto bail; + } + + pos += NS_HFIXEDSZ; + + for (int i = 0; i < qdcount; i++) + { + std::string ignore; + size_t enclen; + + ret = LLAres::expandName(pos, buf, len, i == 0 ? mQuery : ignore, + enclen); + if (ret != ARES_SUCCESS) + { + goto bail; + } + + pos += enclen; + + if (i == 0) + { + int t = DNS_QUESTION_TYPE(pos); + switch (t) + { + case RES_A: + case RES_NS: + case RES_CNAME: + case RES_PTR: + case RES_AAAA: + case RES_SRV: + mType = (LLResType) t; + break; + default: + llinfos << "Cannot grok query type " << t << llendl; + ret = ARES_EBADQUERY; + goto bail; + } + } + + pos += NS_QFIXEDSZ; + if (pos > buf + len) + { + ret = ARES_EBADRESP; + goto bail; + } + } + + ret = parseSection(buf, len, ancount, pos, mAnswers); + if (ret != ARES_SUCCESS) + { + goto bail; + } + + ret = parseSection(buf, len, nscount, pos, mAuthorities); + if (ret != ARES_SUCCESS) + { + goto bail; + } + + ret = parseSection(buf, len, arcount, pos, mAdditional); + +bail: + mResult = ret; + if (mResult == ARES_SUCCESS) + { + querySuccess(); + } else { + queryError(mResult); + } +} + +void LLQueryResponder::querySuccess() +{ + llinfos << "LLQueryResponder::queryResult not implemented" << llendl; +} + +void LLAres::SrvResponder::querySuccess() +{ + if (mType == RES_SRV) + { + srvResult(mAnswers); + } else { + srvError(ARES_EBADRESP); + } +} + +void LLAres::SrvResponder::queryError(int code) +{ + srvError(code); +} + +void LLAres::SrvResponder::srvResult(const dns_rrs_t &ents) +{ + llinfos << "LLAres::SrvResponder::srvResult not implemented" << llendl; + + for (size_t i = 0; i < ents.size(); i++) + { + const LLSrvRecord *s = (const LLSrvRecord *) ents[i].get(); + + llinfos << "[" << i << "] " << s->host() << ":" << s->port() + << " priority " << s->priority() + << " weight " << s->weight() + << llendl; + } +} + +void LLAres::SrvResponder::srvError(int code) +{ + llinfos << "LLAres::SrvResponder::srvError " << code << ": " + << LLAres::strerror(code) << llendl; +} + +static void nameinfo_callback_1_5(void *arg, int status, int timeouts, + char *node, char *service) +{ + LLPointer *resp = + (LLPointer *) arg; + + if (status == ARES_SUCCESS) + { + (*resp)->nameInfoResult(node, service); + } else { + (*resp)->nameInfoError(status); + } + + delete resp; +} + +#if ARES_VERSION_MAJOR == 1 && ARES_VERSION_MINOR == 4 +static void nameinfo_callback(void *arg, int status, char *node, char *service) +{ + nameinfo_callback_1_5(arg, status, 0, node, service); +} +#else +# define nameinfo_callback nameinfo_callback_1_5 +#endif + +void LLAres::getNameInfo(const struct sockaddr &sa, socklen_t salen, int flags, + NameInfoResponder *resp) +{ + ares_getnameinfo(chan_, &sa, salen, flags, nameinfo_callback, + new LLPointer(resp)); +} + +static void search_callback_1_5(void *arg, int status, int timeouts, + unsigned char *abuf, int alen) +{ + LLPointer *resp = + (LLPointer *) arg; + + if (status == ARES_SUCCESS) + { + (*resp)->queryResult((const char *) abuf, alen); + } else { + (*resp)->queryError(status); + } + + delete resp; +} + +#if ARES_VERSION_MAJOR == 1 && ARES_VERSION_MINOR == 4 +static void search_callback(void *arg, int status, unsigned char *abuf, + int alen) +{ + search_callback_1_5(arg, status, 0, abuf, alen); +} +#else +# define search_callback search_callback_1_5 +#endif + +void LLAres::search(const std::string &query, LLResType type, + QueryResponder *resp) +{ + ares_search(chan_, query.c_str(), ns_c_in, type, search_callback, + new LLPointer(resp)); +} + +bool LLAres::process(U64 timeout) +{ + if (!gAPRPoolp) + { + ll_init_apr(); + } + + int socks[ARES_GETSOCK_MAXNUM]; + apr_pollfd_t aprFds[ARES_GETSOCK_MAXNUM]; + apr_int32_t nsds = 0; + apr_status_t status; + apr_pool_t *pool; + int nactive = 0; + int bitmask; + + bitmask = ares_getsock(chan_, socks, ARES_GETSOCK_MAXNUM); + + if (bitmask == 0) + { + goto bail; + } + + status = apr_pool_create(&pool, gAPRPoolp); + ll_apr_assert_status(status); + + for (int i = 0; i < ARES_GETSOCK_MAXNUM; i++) + { + if (ARES_GETSOCK_READABLE(bitmask, i)) + { + aprFds[nactive].reqevents = APR_POLLIN | APR_POLLERR; + } + else if (ARES_GETSOCK_WRITABLE(bitmask, i)) + { + aprFds[nactive].reqevents = APR_POLLOUT | APR_POLLERR; + } else { + continue; + } + + apr_socket_t *aprSock = NULL; + + status = apr_os_sock_put(&aprSock, (apr_os_sock_t *) &socks[i], pool); + if (status != APR_SUCCESS) + { + ll_apr_warn_status(status); + goto bail_pool; + } + + aprFds[nactive].desc.s = aprSock; + aprFds[nactive].desc_type = APR_POLL_SOCKET; + aprFds[nactive].p = pool; + aprFds[nactive].rtnevents = 0; + aprFds[nactive].client_data = &socks[i]; + + nactive++; + } + + if (nactive > 0) + { + status = apr_poll(aprFds, nactive, &nsds, timeout); + + if (status != APR_SUCCESS && status != APR_TIMEUP) + { + ll_apr_warn_status(status); + } + + for (int i = 0; i < nactive; i++) + { + int evts = aprFds[i].rtnevents; + int ifd = (evts & (APR_POLLIN | APR_POLLERR)) + ? *((int *) aprFds[i].client_data) : ARES_SOCKET_BAD; + int ofd = (evts & (APR_POLLOUT | APR_POLLERR)) + ? *((int *) aprFds[i].client_data) : ARES_SOCKET_BAD; + + ares_process_fd(chan_, ifd, ofd); + } + } + +bail_pool: + apr_pool_destroy(pool); + +bail: + return nsds > 0; +} + +bool LLAres::processAll() +{ + bool anyProcessed = false, ret; + + do { + timeval tv; + + ret = ares_timeout(chan_, NULL, &tv) != NULL; + + if (ret) + { + ret = process(tv.tv_sec * 1000000LL + tv.tv_usec); + anyProcessed |= ret; + } + } while (ret); + + return anyProcessed; +} + +int LLAres::expandName(const char *encoded, const char *abuf, size_t alen, + std::string &s, size_t &enclen) +{ + char *t; + int ret; + long e; + + ret = ares_expand_name((const unsigned char *) encoded, + (const unsigned char *) abuf, alen, &t, &e); + if (ret == ARES_SUCCESS) + { + s.assign(t); + enclen = e; + ares_free_string(t); + } + return ret; +} + +const char *LLAres::strerror(int code) +{ + return ares_strerror(code); +} + +LLAres *gAres; + +LLAres *ll_init_ares() +{ + if (gAres == NULL) + { + gAres = new LLAres(); + } + return gAres; +} + +LLDnsRecord::LLDnsRecord(LLResType type, const std::string &name, + unsigned ttl) + : LLRefCount(), + mType(type), + mName(name), + mTTL(ttl) +{ +} + +LLHostRecord::LLHostRecord(LLResType type, const std::string &name, + unsigned ttl) + : LLDnsRecord(type, name, ttl) +{ +} + +int LLHostRecord::parse(const char *buf, size_t len, const char *pos, + size_t rrlen) +{ + int ret; + + ret = LLAres::expandName(pos, buf, len, mHost); + if (ret != ARES_SUCCESS) + { + goto bail; + } + + ret = ARES_SUCCESS; + +bail: + return ret; +} + +LLCnameRecord::LLCnameRecord(const std::string &name, unsigned ttl) + : LLHostRecord(RES_CNAME, name, ttl) +{ +} + +LLPtrRecord::LLPtrRecord(const std::string &name, unsigned ttl) + : LLHostRecord(RES_PTR, name, ttl) +{ +} + +LLAddrRecord::LLAddrRecord(LLResType type, const std::string &name, + unsigned ttl) + : LLDnsRecord(type, name, ttl) +{ +} + +LLARecord::LLARecord(const std::string &name, unsigned ttl) + : LLAddrRecord(RES_A, name, ttl) +{ +} + +int LLARecord::parse(const char *buf, size_t len, const char *pos, + size_t rrlen) +{ + int ret; + + if (rrlen != sizeof(mSA.sin.sin_addr.s_addr)) + { + ret = ARES_EBADRESP; + goto bail; + } + + memset(&mSA, 0, sizeof(mSA)); + memcpy(&mSA.sin.sin_addr.s_addr, pos, rrlen); + mSA.sin.sin_family = AF_INET6; + mSize = sizeof(mSA.sin); + + ret = ARES_SUCCESS; + +bail: + return ret; +} + +LLAaaaRecord::LLAaaaRecord(const std::string &name, unsigned ttl) + : LLAddrRecord(RES_AAAA, name, ttl) +{ +} + +int LLAaaaRecord::parse(const char *buf, size_t len, const char *pos, + size_t rrlen) +{ + int ret; + + if (rrlen != sizeof(mSA.sin6.sin6_addr)) + { + ret = ARES_EBADRESP; + goto bail; + } + + memset(&mSA, 0, sizeof(mSA)); + memcpy(&mSA.sin6.sin6_addr.s6_addr, pos, rrlen); + mSA.sin6.sin6_family = AF_INET6; + mSize = sizeof(mSA.sin6); + + ret = ARES_SUCCESS; + +bail: + return ret; +} + +LLSrvRecord::LLSrvRecord(const std::string &name, unsigned ttl) + : LLHostRecord(RES_SRV, name, ttl) +{ +} + +int LLSrvRecord::parse(const char *buf, size_t len, const char *pos, + size_t rrlen) +{ + int ret; + + if (rrlen < 6) + { + ret = ARES_EBADRESP; + goto bail; + } + + memcpy(&mPriority, pos, 2); + memcpy(&mWeight, pos + 2, 2); + memcpy(&mPort, pos + 4, 2); + + mPriority = ntohs(mPriority); + mWeight = ntohs(mWeight); + mPort = ntohs(mPort); + + ret = LLHostRecord::parse(buf, len, pos + 6, rrlen - 6); + +bail: + return ret; +} + +LLNsRecord::LLNsRecord(const std::string &name, unsigned ttl) + : LLHostRecord(RES_NS, name, ttl) +{ +} + +void LLAres::UriRewriteResponder::queryError(int code) +{ + std::vector uris; + uris.push_back(mUri.asString()); + rewriteResult(uris); +} + +void LLAres::UriRewriteResponder::querySuccess() +{ + std::vector uris; + + if (mType != RES_SRV) + { + goto bail; + } + + for (size_t i = 0; i < mAnswers.size(); i++) + { + const LLSrvRecord *r = (const LLSrvRecord *) mAnswers[i].get(); + + if (r->type() == RES_SRV) + { + // Check the domain in the response to ensure that it's + // the same as the domain in the request, so that bad guys + // can't forge responses that point to their own login + // servers with their own certificates. + + // Hard-coding the domain to check here is a bit of a + // hack. Hoist it to an outer caller if anyone ever needs + // this functionality on other domains. + + static const std::string domain(".lindenlab.com"); + const std::string &host = r->host(); + + std::string::size_type s = host.find(domain) + domain.length(); + + if (s != host.length() && s != host.length() - 1) + { + continue; + } + + LLURI uri(mUri.scheme(), + mUri.userName(), + mUri.password(), + r->host(), + mUri.defaultPort() ? r->port() : mUri.hostPort(), + mUri.escapedPath(), + mUri.escapedQuery()); + uris.push_back(uri.asString()); + } + } + + if (!uris.empty()) + { + goto done; + } + +bail: + uris.push_back(mUri.asString()); + +done: + rewriteResult(uris); +} + +void LLAres::UriRewriteResponder::rewriteResult( + const std::vector &uris) +{ + llinfos << "LLAres::UriRewriteResponder::rewriteResult not implemented" + << llendl; + + for (size_t i = 0; i < uris.size(); i++) + { + llinfos << "[" << i << "] " << uris[i] << llendl; + } +} diff --git a/linden/indra/llmessage/llares.h b/linden/indra/llmessage/llares.h new file mode 100644 index 0000000..5d72170 --- /dev/null +++ b/linden/indra/llmessage/llares.h @@ -0,0 +1,572 @@ +/** + * @file llares.h + * @author Bryan O'Sullivan + * @date 2007-08-15 + * @brief Wrapper for asynchronous DNS lookups. + * + * $LicenseInfo:firstyear=2007&license=viewergpl$ + * + * Copyright (c) 2007-2008, Linden Research, Inc. + * + * Second Life Viewer Source Code + * 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://secondlifegrid.net/programs/open_source/licensing/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://secondlifegrid.net/programs/open_source/licensing/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. + * $/LicenseInfo$ + */ + +#ifndef LL_LLARES_H +#define LL_LLARES_H + +#ifdef LL_WINDOWS +# include +#endif + +#ifdef LL_STANDALONE +# include +#else +# include +#endif + +#include "llmemory.h" +#include "lluri.h" + +class LLQueryResponder; + +/** + * @brief Supported DNS RR types. + */ +enum LLResType +{ + RES_INVALID = 0, /**< Cookie. */ + RES_A = 1, /**< "A" record. IPv4 address. */ + RES_NS = 2, /**< "NS" record. Authoritative server. */ + RES_CNAME = 5, /**< "CNAME" record. Canonical name. */ + RES_PTR = 12, /**< "PTR" record. Domain name pointer. */ + RES_AAAA = 28, /**< "AAAA" record. IPv6 Address. */ + RES_SRV = 33, /**< "SRV" record. Server Selection. */ + RES_MAX = 65536 /**< Sentinel; RR types are 16 bits wide. */ +}; + +/** + * @class LLDnsRecord + * @brief Base class for all DNS RR types. + */ +class LLDnsRecord : public LLRefCount +{ +protected: + friend class LLQueryResponder; + + LLResType mType; + std::string mName; + unsigned mTTL; + + virtual int parse(const char *buf, size_t len, const char *pos, + size_t rrlen) = 0; + + LLDnsRecord(LLResType type, const std::string &name, unsigned ttl); + +public: + /** + * @brief Record name. + */ + const std::string &name() const { return mName; } + + /** + * @brief Time-to-live value, in seconds. + */ + unsigned ttl() const { return mTTL; } + + /** + * @brief RR type. + */ + LLResType type() const { return mType; } +}; + +/** + * @class LLAddrRecord + * @brief Base class for address-related RRs. + */ +class LLAddrRecord : public LLDnsRecord +{ +protected: + friend class LLQueryResponder; + + LLAddrRecord(LLResType type, const std::string &name, unsigned ttl); + + union + { + sockaddr sa; + sockaddr_in sin; + sockaddr_in6 sin6; + } mSA; + + socklen_t mSize; + +public: + /** + * @brief Generic socket address. + */ + const sockaddr &addr() const { return mSA.sa; } + + /** + * @brief Size of the socket structure. + */ + socklen_t size() const { return mSize; } +}; + +/** + * @class LLARecord + * @brief A RR, for IPv4 addresses. + */ +class LLARecord : public LLAddrRecord +{ +protected: + friend class LLQueryResponder; + + LLARecord(const std::string &name, unsigned ttl); + + int parse(const char *buf, size_t len, const char *pos, size_t rrlen); + +public: + /** + * @brief Socket address. + */ + const sockaddr_in &addr_in() const { return mSA.sin; } +}; + +/** + * @class LLAaaaRecord + * @brief AAAA RR, for IPv6 addresses. + */ +class LLAaaaRecord : public LLAddrRecord +{ +protected: + friend class LLQueryResponder; + + LLAaaaRecord(const std::string &name, unsigned ttl); + + int parse(const char *buf, size_t len, const char *pos, size_t rrlen); + +public: + /** + * @brief Socket address. + */ + const sockaddr_in6 &addr_in6() const { return mSA.sin6; } +}; + +/** + * @class LLHostRecord + * @brief Base class for host-related RRs. + */ +class LLHostRecord : public LLDnsRecord +{ +protected: + LLHostRecord(LLResType type, const std::string &name, unsigned ttl); + + int parse(const char *buf, size_t len, const char *pos, size_t rrlen); + + std::string mHost; + +public: + /** + * @brief Host name. + */ + const std::string &host() const { return mHost; } +}; + +/** + * @class LLCnameRecord + * @brief CNAME RR. + */ +class LLCnameRecord : public LLHostRecord +{ +protected: + friend class LLQueryResponder; + + LLCnameRecord(const std::string &name, unsigned ttl); +}; + +/** + * @class LLPtrRecord + * @brief PTR RR. + */ +class LLPtrRecord : public LLHostRecord +{ +protected: + friend class LLQueryResponder; + + LLPtrRecord(const std::string &name, unsigned ttl); +}; + +/** + * @class LLSrvRecord + * @brief SRV RR. + */ +class LLSrvRecord : public LLHostRecord +{ +protected: + U16 mPriority; + U16 mWeight; + U16 mPort; + + int parse(const char *buf, size_t len, const char *pos, size_t rrlen); + +public: + LLSrvRecord(const std::string &name, unsigned ttl); + + /** + * @brief Service priority. + */ + U16 priority() const { return mPriority; } + + /** + * @brief Service weight. + */ + U16 weight() const { return mWeight; } + + /** + * @brief Port number of service. + */ + U16 port() const { return mPort; } + + /** + * @brief Functor for sorting SRV records by priority. + */ + struct ComparePriorityLowest + { + bool operator()(const LLSrvRecord& lhs, const LLSrvRecord& rhs) + { + return lhs.mPriority < rhs.mPriority; + } + }; +}; + +/** + * @class LLNsRecord + * @brief NS RR. + */ +class LLNsRecord : public LLHostRecord +{ +public: + LLNsRecord(const std::string &name, unsigned ttl); +}; + +class LLQueryResponder; + +/** + * @class LLAres + * @brief Asynchronous address resolver. + */ +class LLAres +{ +public: + /** + * @class HostResponder + * @brief Base class for responding to hostname lookups. + * @see LLAres::getHostByName + */ + class HostResponder : public LLRefCount + { + public: + virtual ~HostResponder(); + + virtual void hostResult(const hostent *ent); + virtual void hostError(int code); + }; + + /** + * @class NameInfoResponder + * @brief Base class for responding to address lookups. + * @see LLAres::getNameInfo + */ + class NameInfoResponder : public LLRefCount + { + public: + virtual ~NameInfoResponder(); + + virtual void nameInfoResult(const char *node, const char *service); + virtual void nameInfoError(int code); + }; + + /** + * @class QueryResponder + * @brief Base class for responding to custom searches. + * @see LLAres::search + */ + class QueryResponder : public LLRefCount + { + public: + virtual ~QueryResponder(); + + virtual void queryResult(const char *buf, size_t len); + virtual void queryError(int code); + }; + + class SrvResponder; + class UriRewriteResponder; + + LLAres(); + + ~LLAres(); + + /** + * Cancel all outstanding requests. The error methods of the + * corresponding responders will be called, with ARES_ETIMEOUT. + */ + void cancel(); + + /** + * Look up the address of a host. + * + * @param name name of host to look up + * @param resp responder to call with result + * @param family AF_INET for IPv4 addresses, AF_INET6 for IPv6 + */ + void getHostByName(const std::string &name, HostResponder *resp, + int family = AF_INET) { + getHostByName(name.c_str(), resp, family); + } + + /** + * Look up the address of a host. + * + * @param name name of host to look up + * @param resp responder to call with result + * @param family AF_INET for IPv4 addresses, AF_INET6 for IPv6 + */ + void getHostByName(const char *name, HostResponder *resp, + int family = PF_INET); + + /** + * Look up the name associated with a socket address. + * + * @param sa socket address to look up + * @param salen size of socket address + * @param flags flags to use + * @param resp responder to call with result + */ + void getNameInfo(const struct sockaddr &sa, socklen_t salen, int flags, + NameInfoResponder *resp); + + /** + * Look up SRV (service location) records for a service name. + * + * @param name service name (e.g. "_https._tcp.login.agni.lindenlab.com") + * @param resp responder to call with result + */ + void getSrvRecords(const std::string &name, SrvResponder *resp); + + /** + * Rewrite a URI, using SRV (service location) records for its + * protocol if available. If no SRV records are published, the + * existing URI is handed to the responder. + * + * @param uri URI to rewrite + * @param resp responder to call with result + */ + void rewriteURI(const std::string &uri, + UriRewriteResponder *resp); + + /** + * Start a custom search. + * + * @param query query to make + * @param type type of query to perform + * @param resp responder to call with result + */ + void search(const std::string &query, LLResType type, + QueryResponder *resp); + + /** + * Process any outstanding queries. This method takes an optional + * timeout parameter (specified in microseconds). If provided, it + * will block the calling thread for that length of time to await + * possible responses. A timeout of zero will return immediately + * if there are no responses or timeouts to process. + * + * @param timeoutUsecs number of microseconds to block before timing out + * @return whether any responses were processed + */ + bool process(U64 timeoutUsecs = 0); + + /** + * Process all outstanding queries, blocking the calling thread + * until all have either been responded to or timed out. + * + * @return whether any responses were processed + */ + bool processAll(); + + /** + * Expand a DNS-encoded compressed string into a normal string. + * + * @param encoded the encoded name (null-terminated) + * @param abuf the response buffer in which the string is embedded + * @param alen the length of the response buffer + * @param s the string into which to place the result + * @return ARES_SUCCESS on success, otherwise an error indicator + */ + static int expandName(const char *encoded, const char *abuf, size_t alen, + std::string &s) { + size_t ignore; + return expandName(encoded, abuf, alen, s, ignore); + } + + static int expandName(const char *encoded, const char *abuf, size_t alen, + std::string &s, size_t &enclen); + + /** + * Return a string describing an error code. + */ + static const char *strerror(int code); + +protected: + ares_channel chan_; + +}; + +/** + * An ordered collection of DNS resource records. + */ +typedef std::vector > dns_rrs_t; + +/** + * @class LLQueryResponder + * @brief Base class for friendly handling of DNS query responses. + * + * This class parses a DNS response and represents it in a friendly + * manner. + * + * @see LLDnsRecord + * @see LLARecord + * @see LLNsRecord + * @see LLCnameRecord + * @see LLPtrRecord + * @see LLAaaaRecord + * @see LLSrvRecord + */ +class LLQueryResponder : public LLAres::QueryResponder +{ +protected: + int mResult; + std::string mQuery; + LLResType mType; + + dns_rrs_t mAnswers; + dns_rrs_t mAuthorities; + dns_rrs_t mAdditional; + + /** + * Parse a single RR. + */ + int parseRR(const char *buf, size_t len, const char *&pos, + LLPointer &r); + /** + * Parse one section of a response. + */ + int parseSection(const char *buf, size_t len, + size_t count, const char *& pos, dns_rrs_t &rrs); + + void queryResult(const char *buf, size_t len); + virtual void querySuccess(); + +public: + LLQueryResponder(); + + /** + * Indicate whether the response could be parsed successfully. + */ + bool valid() const { return mResult == ARES_SUCCESS; } + + /** + * The more detailed result of parsing the response. + */ + int result() const { return mResult; } + + /** + * Return the query embedded in the response. + */ + const std::string &query() const { return mQuery; } + + /** + * Return the contents of the "answers" section of the response. + */ + const dns_rrs_t &answers() const { return mAnswers; } + + /** + * Return the contents of the "authorities" section of the + * response. + */ + const dns_rrs_t &authorities() const { return mAuthorities; } + + /** + * Return the contents of the "additional records" section of the + * response. + */ + const dns_rrs_t &additional() const { return mAdditional; } +}; + +/** + * @class LLAres::SrvResponder + * @brief Class for handling SRV query responses. + */ +class LLAres::SrvResponder : public LLQueryResponder +{ +public: + friend void LLAres::getSrvRecords(const std::string &name, + SrvResponder *resp); + void querySuccess(); + void queryError(int code); + + virtual void srvResult(const dns_rrs_t &ents); + virtual void srvError(int code); +}; + +/** + * @class LLAres::UriRewriteResponder + * @brief Class for handling URI rewrites based on SRV records. + */ +class LLAres::UriRewriteResponder : public LLQueryResponder +{ +protected: + LLURI mUri; + +public: + friend void LLAres::rewriteURI(const std::string &uri, + UriRewriteResponder *resp); + void querySuccess(); + void queryError(int code); + + virtual void rewriteResult(const std::vector &uris); +}; + +/** + * Singleton responder. + */ +extern LLAres *gAres; + +/** + * Set up the singleton responder. It's safe to call this more than + * once from within a single thread, but this function is not + * thread safe. + */ +extern LLAres *ll_init_ares(); + +#endif // LL_LLARES_H diff --git a/linden/indra/llmessage/llassetstorage.cpp b/linden/indra/llmessage/llassetstorage.cpp index a6077e5..fa14a2b 100644 --- a/linden/indra/llmessage/llassetstorage.cpp +++ b/linden/indra/llmessage/llassetstorage.cpp @@ -42,6 +42,7 @@ #include "llstring.h" #include "lldir.h" #include "llsd.h" +#include "llframetimer.h" // this library includes #include "message.h" @@ -58,7 +59,10 @@ LLAssetStorage *gAssetStorage = NULL; LLMetrics *LLAssetStorage::metric_recipient = NULL; -const LLUUID CATEGORIZE_LOST_AND_FOUND_ID("00000000-0000-0000-0000-000000000010"); +const LLUUID CATEGORIZE_LOST_AND_FOUND_ID(std::string("00000000-0000-0000-0000-000000000010")); + +const U64 TOXIC_ASSET_LIFETIME = (120 * 1000000); // microseconds + ///---------------------------------------------------------------------------- /// LLAssetInfo @@ -133,20 +137,20 @@ void LLAssetInfo::setFromNameValue( const LLNameValue& nv ) str.assign( nv.mName ); pos1 = str.find('|'); buf.assign( str, 0, pos1++ ); - mType = LLAssetType::lookup( buf.c_str() ); + mType = LLAssetType::lookup( buf ); buf.assign( str, pos1, std::string::npos ); - mUuid.set( buf.c_str() ); + mUuid.set( buf ); // convert the value to useful information str.assign( nv.getAsset() ); pos1 = str.find('|'); buf.assign( str, 0, pos1++ ); - mCreatorID.set( buf.c_str() ); + mCreatorID.set( buf ); pos2 = str.find( '|', pos1 ); buf.assign( str, pos1, (pos2++) - pos1 ); - setName( buf.c_str() ); + setName( buf ); buf.assign( str, pos2, std::string::npos ); - setDescription( buf.c_str() ); + setDescription( buf ); llinfos << "uuid: " << mUuid << llendl; llinfos << "creator: " << mCreatorID << llendl; } @@ -314,6 +318,9 @@ LLAssetStorage::~LLAssetStorage() // unregister our callbacks with the message system gMessageSystem->setHandlerFuncFast(_PREHASH_AssetUploadComplete, NULL, NULL); } + + // Clear the toxic asset map + mToxicAssetMap.clear(); } void LLAssetStorage::setUpstream(const LLHost &upstream_host) @@ -1231,16 +1238,20 @@ void LLAssetStorage::getAssetData(const LLUUID uuid, LLAssetType::EType type, vo void LLAssetStorage::legacyGetDataCallback(LLVFS *vfs, const LLUUID &uuid, LLAssetType::EType type, void *user_data, S32 status, LLExtStat ext_status) { LLLegacyAssetRequest *legacy = (LLLegacyAssetRequest *)user_data; - char filename[LL_MAX_PATH] = ""; /* Flawfinder: ignore */ + std::string filename; + + // Check if the asset is marked toxic, and don't load bad stuff + BOOL toxic = gAssetStorage->isAssetToxic( uuid ); - if (! status) + if ( !status + && !toxic ) { LLVFile file(vfs, uuid, type); - char uuid_str[UUID_STR_LENGTH]; /* Flawfinder: ignore */ + std::string uuid_str; uuid.toString(uuid_str); - snprintf(filename,sizeof(filename),"%s.%s",gDirUtilp->getExpandedFilename(LL_PATH_CACHE,uuid_str).c_str(),LLAssetType::lookup(type)); /* Flawfinder: ignore */ + filename = llformat("%s.%s",gDirUtilp->getExpandedFilename(LL_PATH_CACHE,uuid_str).c_str(),LLAssetType::lookup(type)); LLFILE* fp = LLFile::fopen(filename, "wb"); /* Flawfinder: ignore */ if (fp) @@ -1264,7 +1275,7 @@ void LLAssetStorage::legacyGetDataCallback(LLVFS *vfs, const LLUUID &uuid, LLAss } } - legacy->mDownCallback(filename, uuid, legacy->mUserData, status, ext_status); + legacy->mDownCallback(filename.c_str(), uuid, legacy->mUserData, status, ext_status); delete legacy; } @@ -1283,7 +1294,7 @@ void LLAssetStorage::storeAssetData( { llwarns << "storeAssetData: wrong version called" << llendl; // LLAssetStorage metric: Virtual base call - reportMetric( LLUUID::null, asset_type, NULL, LLUUID::null, 0, MR_BAD_FUNCTION, __FILE__, __LINE__, "Illegal call to base: LLAssetStorage::storeAssetData 1" ); + reportMetric( LLUUID::null, asset_type, LLStringUtil::null, LLUUID::null, 0, MR_BAD_FUNCTION, __FILE__, __LINE__, "Illegal call to base: LLAssetStorage::storeAssetData 1" ); } // virtual @@ -1302,13 +1313,13 @@ void LLAssetStorage::storeAssetData( { llwarns << "storeAssetData: wrong version called" << llendl; // LLAssetStorage metric: Virtual base call - reportMetric( asset_id, asset_type, NULL, requesting_agent_id, 0, MR_BAD_FUNCTION, __FILE__, __LINE__, "Illegal call to base: LLAssetStorage::storeAssetData 2" ); + reportMetric( asset_id, asset_type, LLStringUtil::null, requesting_agent_id, 0, MR_BAD_FUNCTION, __FILE__, __LINE__, "Illegal call to base: LLAssetStorage::storeAssetData 2" ); } // virtual // this does nothing, viewer and sim both override this. void LLAssetStorage::storeAssetData( - const char* filename, + const std::string& filename, const LLUUID& asset_id, LLAssetType::EType asset_type, LLStoreAssetCallback callback, @@ -1320,13 +1331,13 @@ void LLAssetStorage::storeAssetData( { llwarns << "storeAssetData: wrong version called" << llendl; // LLAssetStorage metric: Virtual base call - reportMetric( asset_id, asset_type, NULL, LLUUID::null, 0, MR_BAD_FUNCTION, __FILE__, __LINE__, "Illegal call to base: LLAssetStorage::storeAssetData 3" ); + reportMetric( asset_id, asset_type, LLStringUtil::null, LLUUID::null, 0, MR_BAD_FUNCTION, __FILE__, __LINE__, "Illegal call to base: LLAssetStorage::storeAssetData 3" ); } // virtual // this does nothing, viewer and sim both override this. void LLAssetStorage::storeAssetData( - const char* filename, + const std::string& filename, const LLTransactionID &transactoin_id, LLAssetType::EType asset_type, LLStoreAssetCallback callback, @@ -1338,7 +1349,7 @@ void LLAssetStorage::storeAssetData( { llwarns << "storeAssetData: wrong version called" << llendl; // LLAssetStorage metric: Virtual base call - reportMetric( LLUUID::null, asset_type, NULL, LLUUID::null, 0, MR_BAD_FUNCTION, __FILE__, __LINE__, "Illegal call to base: LLAssetStorage::storeAssetData 4" ); + reportMetric( LLUUID::null, asset_type, LLStringUtil::null, LLUUID::null, 0, MR_BAD_FUNCTION, __FILE__, __LINE__, "Illegal call to base: LLAssetStorage::storeAssetData 4" ); } // static @@ -1385,9 +1396,9 @@ void LLAssetStorage::clearTempAssetData() { } // static -void LLAssetStorage::reportMetric( const LLUUID& asset_id, const LLAssetType::EType asset_type, const char *filename, +void LLAssetStorage::reportMetric( const LLUUID& asset_id, const LLAssetType::EType asset_type, const std::string& in_filename, const LLUUID& agent_id, S32 asset_size, EMetricResult result, - const char *file, const S32 line, const char *message ) + const char *file, const S32 line, const std::string& in_message ) { if( !metric_recipient ) { @@ -1395,18 +1406,13 @@ void LLAssetStorage::reportMetric( const LLUUID& asset_id, const LLAssetType::ET return; } - filename = filename ? filename : ""; - file = file ? file : ""; - - // Create revised message - message = "message :: file:line" - std::string new_message; //( message ); - new_message = message; // << " " << file << " " << line; - new_message += " :: "; - new_message += filename; - char line_string[16]; - sprintf( line_string, ":%d", line ); - new_message += line_string; - message = new_message.c_str(); + std::string filename(in_filename); + if (filename.empty()) + filename = ll_safe_string(file); + + // Create revised message - new_message = "in_message :: file:line" + std::stringstream new_message; + new_message << in_message << " :: " << filename << ":" << line; // Change always_report to true if debugging... do not check it in this way static bool always_report = false; @@ -1419,15 +1425,68 @@ void LLAssetStorage::reportMetric( const LLUUID& asset_id, const LLAssetType::ET LLSD stats; stats["asset_id"] = asset_id; stats["asset_type"] = asset_type; - stats["filename"] = filename? filename : ""; + stats["filename"] = filename; stats["agent_id"] = agent_id; stats["asset_size"] = (S32)asset_size; stats["result"] = (S32)result; - metric_recipient->recordEventDetails( metric_name, message, success, stats); + metric_recipient->recordEventDetails( metric_name, new_message.str(), success, stats); } else { - metric_recipient->recordEvent(metric_name, message, success); + metric_recipient->recordEvent(metric_name, new_message.str(), success); + } +} + + +// Check if an asset is in the toxic map. If it is, the entry is updated +BOOL LLAssetStorage::isAssetToxic( const LLUUID& uuid ) +{ + BOOL is_toxic = FALSE; + + if ( !uuid.isNull() ) + { + toxic_asset_map_t::iterator iter = mToxicAssetMap.find( uuid ); + if ( iter != mToxicAssetMap.end() ) + { // Found toxic asset + (*iter).second = LLFrameTimer::getTotalTime() + TOXIC_ASSET_LIFETIME; + is_toxic = TRUE; + } } + return is_toxic; } + + + + +// Clean the toxic asset list, remove old entries +void LLAssetStorage::flushOldToxicAssets( BOOL force_it ) +{ + // Scan and look for old entries + U64 now = LLFrameTimer::getTotalTime(); + toxic_asset_map_t::iterator iter = mToxicAssetMap.begin(); + while ( iter != mToxicAssetMap.end() ) + { + if ( force_it + || (*iter).second < now ) + { // Too old - remove it + mToxicAssetMap.erase( iter++ ); + } + else + { + iter++; + } + } +} + + +// Add an item to the toxic asset map +void LLAssetStorage::markAssetToxic( const LLUUID& uuid ) +{ + if ( !uuid.isNull() ) + { + // Set the value to the current time. Creates a new entry if needed + mToxicAssetMap[ uuid ] = LLFrameTimer::getTotalTime() + TOXIC_ASSET_LIFETIME; + } +} + diff --git a/linden/indra/llmessage/llassetstorage.h b/linden/indra/llmessage/llassetstorage.h index 739242a..86bf66a 100644 --- a/linden/indra/llmessage/llassetstorage.h +++ b/linden/indra/llmessage/llassetstorage.h @@ -197,7 +197,8 @@ public: }; - +// Map of known bad assets +typedef std::map toxic_asset_map_t; typedef void (*LLGetAssetCallback)(LLVFS *vfs, const LLUUID &asset_id, LLAssetType::EType asset_type, void *user_data, S32 status, LLExtStat ext_status); @@ -231,6 +232,9 @@ protected: request_list_t mPendingUploads; request_list_t mPendingLocalUploads; + // Map of toxic assets - these caused problems when recently rezzed, so avoid them + toxic_asset_map_t mToxicAssetMap; // Objects in this list are known to cause problems and are not loaded + public: LLAssetStorage(LLMessageSystem *msg, LLXferManager *xfer, LLVFS *vfs, const LLHost &upstream_host); @@ -291,6 +295,15 @@ public: const LLUUID &asset_id, LLAssetType::EType atype, LLGetAssetCallback cb, void *user_data, BOOL is_priority = FALSE); // Get a particular inventory item. + // Check if an asset is in the toxic map. If it is, the entry is updated + BOOL isAssetToxic( const LLUUID& uuid ); + + // Clean the toxic asset list, remove old entries + void flushOldToxicAssets( BOOL force_it ); + + // Add an item to the toxic asset map + void markAssetToxic( const LLUUID& uuid ); + protected: virtual LLSD getPendingDetails(const request_list_t* requests, LLAssetType::EType asset_type, @@ -365,7 +378,7 @@ public: * AssetID version. */ virtual void storeAssetData( - const char* filename, + const std::string& filename, const LLUUID& asset_id, LLAssetType::EType type, LLStoreAssetCallback callback, @@ -379,7 +392,7 @@ public: * TransactionID version */ virtual void storeAssetData( - const char * filename, + const std::string& filename, const LLTransactionID &transaction_id, LLAssetType::EType type, LLStoreAssetCallback callback, @@ -438,9 +451,9 @@ protected: static class LLMetrics *metric_recipient; - static void reportMetric( const LLUUID& asset_id, const LLAssetType::EType asset_type, const char *filename, - const LLUUID& agent_id, S32 asset_size, EMetricResult result, - const char *file, const S32 line, const char *message ); + static void reportMetric( const LLUUID& asset_id, const LLAssetType::EType asset_type, const std::string& filename, + const LLUUID& agent_id, S32 asset_size, EMetricResult result, + const char* file, const S32 line, const std::string& message ); public: static void setMetricRecipient( LLMetrics *recip ) { diff --git a/linden/indra/llmessage/llcachename.cpp b/linden/indra/llmessage/llcachename.cpp index 9adf10d..70e1ccf 100644 --- a/linden/indra/llmessage/llcachename.cpp +++ b/linden/indra/llmessage/llcachename.cpp @@ -43,10 +43,9 @@ #include "message.h" // Constants -// probably need a setUIString() call in the interface -const char* const CN_WAITING = "(Loading...)"; // *TODO: translate -const char* const CN_NOBODY = "(nobody)"; // *TODO: translate -const char* const CN_NONE = "(none)"; // *TODO: translate +static const std::string CN_WAITING("(Loading...)"); // *TODO: translate +static const std::string CN_NOBODY("(nobody)"); // *TODO: translate +static const std::string CN_NONE("(none)"); // *TODO: translate // llsd serialization constants static const std::string AGENTS("agents"); @@ -78,16 +77,13 @@ public: public: bool mIsGroup; U32 mCreateTime; // unix time_t - char mFirstName[DB_FIRST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/ - char mLastName[DB_LAST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/ - char mGroupName[DB_GROUP_NAME_BUF_SIZE]; /*Flawfinder: ignore*/ + std::string mFirstName; + std::string mLastName; + std::string mGroupName; }; LLCacheNameEntry::LLCacheNameEntry() { - mFirstName[0] = '\0'; - mLastName[0] = '\0'; - mGroupName[0] = '\0'; } @@ -235,7 +231,7 @@ public: static void handleUUIDGroupNameRequest(LLMessageSystem* msg, void** userdata); static void handleUUIDGroupNameReply(LLMessageSystem* msg, void** userdata); - void notifyObservers(const LLUUID& id, const char* first, const char* last, BOOL group); + void notifyObservers(const LLUUID& id, const std::string& first, const std::string& last, BOOL group); }; @@ -390,8 +386,8 @@ void LLCacheName::importFile(LLFILE* fp) LLCacheNameEntry* entry = new LLCacheNameEntry(); entry->mIsGroup = false; entry->mCreateTime = create_time; - LLString::copy(entry->mFirstName, firstname, DB_FIRST_NAME_BUF_SIZE); - LLString::copy(entry->mLastName, lastname, DB_LAST_NAME_BUF_SIZE); + entry->mFirstName = firstname; + entry->mLastName = lastname; impl.mCache[id] = entry; count++; @@ -426,12 +422,8 @@ bool LLCacheName::importFile(std::istream& istr) LLCacheNameEntry* entry = new LLCacheNameEntry(); entry->mIsGroup = false; entry->mCreateTime = ctime; - std::string first = agent[FIRST].asString(); - first.copy(entry->mFirstName, DB_FIRST_NAME_BUF_SIZE, 0); - entry->mFirstName[llmin(first.size(),(std::string::size_type)DB_FIRST_NAME_BUF_SIZE-1)] = '\0'; - std::string last = agent[LAST].asString(); - last.copy(entry->mLastName, DB_LAST_NAME_BUF_SIZE, 0); - entry->mLastName[llmin(last.size(),(std::string::size_type)DB_LAST_NAME_BUF_SIZE-1)] = '\0'; + entry->mFirstName = agent[FIRST].asString(); + entry->mLastName = agent[LAST].asString(); impl.mCache[id] = entry; ++count; } @@ -451,9 +443,7 @@ bool LLCacheName::importFile(std::istream& istr) LLCacheNameEntry* entry = new LLCacheNameEntry(); entry->mIsGroup = true; entry->mCreateTime = ctime; - std::string name = group[NAME].asString(); - name.copy(entry->mGroupName, DB_GROUP_NAME_BUF_SIZE, 0); - entry->mGroupName[llmin(name.size(), (std::string::size_type)DB_GROUP_NAME_BUF_SIZE-1)] = '\0'; + entry->mGroupName = group[NAME].asString(); impl.mCache[id] = entry; ++count; } @@ -471,8 +461,8 @@ void LLCacheName::exportFile(std::ostream& ostr) // Only write entries for which we have valid data. LLCacheNameEntry* entry = iter->second; if(!entry - || (NULL != strchr(entry->mFirstName, '?')) - || (NULL != strchr(entry->mGroupName, '?'))) + || (std::string::npos != entry->mFirstName.find('?')) + || (std::string::npos != entry->mGroupName.find('?'))) { continue; } @@ -480,13 +470,13 @@ void LLCacheName::exportFile(std::ostream& ostr) // store it LLUUID id = iter->first; std::string id_str = id.asString(); - if(entry->mFirstName[0] && entry->mLastName[0]) + if(!entry->mFirstName.empty() && !entry->mLastName.empty()) { data[AGENTS][id_str][FIRST] = entry->mFirstName; data[AGENTS][id_str][LAST] = entry->mLastName; data[AGENTS][id_str][CTIME] = (S32)entry->mCreateTime; } - else if(entry->mIsGroup && entry->mGroupName[0]) + else if(entry->mIsGroup && !entry->mGroupName.empty()) { data[GROUPS][id_str][NAME] = entry->mGroupName; data[GROUPS][id_str][CTIME] = (S32)entry->mCreateTime; @@ -534,16 +524,6 @@ BOOL LLCacheName::getFullName(const LLUUID& id, std::string& fullname) return res; } -// *TODO: Deprecate -BOOL LLCacheName::getName(const LLUUID& id, char* first, char* last) -{ - std::string first_name, last_name; - BOOL res = getName(id, first_name, last_name); - strcpy(first, first_name.c_str()); - strcpy(last, last_name.c_str()); - return res; -} - BOOL LLCacheName::getGroupName(const LLUUID& id, std::string& group) { if(id.isNull()) @@ -553,7 +533,7 @@ BOOL LLCacheName::getGroupName(const LLUUID& id, std::string& group) } LLCacheNameEntry* entry = get_ptr_in_map(impl.mCache,id); - if (entry && !entry->mGroupName[0]) + if (entry && entry->mGroupName.empty()) { // COUNTER-HACK to combat James' HACK in exportFile()... // this group name was loaded from a name cache that did not @@ -578,16 +558,6 @@ BOOL LLCacheName::getGroupName(const LLUUID& id, std::string& group) } } -// *TODO: Deprecate -BOOL LLCacheName::getGroupName(const LLUUID& id, char* group) -{ - std::string group_name; - BOOL res = getGroupName(id, group_name); - strcpy(group, group_name.c_str()); - return res; -} - - // TODO: Make the cache name callback take a SINGLE std::string, // not a separate first and last name. void LLCacheName::get(const LLUUID& id, BOOL is_group, LLCacheNameCallback callback, void* user_data) @@ -716,9 +686,9 @@ void LLCacheName::dumpStats() } //static -LLString LLCacheName::getDefaultName() +std::string LLCacheName::getDefaultName() { - return LLString(CN_WAITING); + return CN_WAITING; } void LLCacheName::Impl::processPendingAsks() @@ -813,7 +783,7 @@ void LLCacheName::Impl::sendRequest( } void LLCacheName::Impl::notifyObservers(const LLUUID& id, - const char* first, const char* last, BOOL is_group) + const std::string& first, const std::string& last, BOOL is_group) { for (Observers::const_iterator i = mObservers.begin(), end = mObservers.end(); @@ -917,19 +887,17 @@ void LLCacheName::Impl::processUUIDReply(LLMessageSystem* msg, bool isGroup) entry->mCreateTime = (U32)time(NULL); if (!isGroup) { - msg->getStringFast(_PREHASH_UUIDNameBlock, _PREHASH_FirstName, DB_FIRST_NAME_BUF_SIZE, entry->mFirstName, i); - msg->getStringFast(_PREHASH_UUIDNameBlock, _PREHASH_LastName, DB_LAST_NAME_BUF_SIZE, entry->mLastName, i); + msg->getStringFast(_PREHASH_UUIDNameBlock, _PREHASH_FirstName, entry->mFirstName, i); + msg->getStringFast(_PREHASH_UUIDNameBlock, _PREHASH_LastName, entry->mLastName, i); } else { - msg->getStringFast(_PREHASH_UUIDNameBlock, _PREHASH_GroupName, DB_GROUP_NAME_BUF_SIZE, entry->mGroupName, i); + msg->getStringFast(_PREHASH_UUIDNameBlock, _PREHASH_GroupName, entry->mGroupName, i); } if (!isGroup) { - notifyObservers(id, - entry->mFirstName, entry->mLastName, - FALSE); + notifyObservers(id, entry->mFirstName, entry->mLastName, FALSE); } else { diff --git a/linden/indra/llmessage/llcachename.h b/linden/indra/llmessage/llcachename.h index e7d5a44..965b4ba 100644 --- a/linden/indra/llmessage/llcachename.h +++ b/linden/indra/llmessage/llcachename.h @@ -37,7 +37,7 @@ class LLHost; class LLUUID; // agent_id/group_id, first_name, last_name, is_group, user_data -typedef void (*LLCacheNameCallback)(const LLUUID&, const char*, const char*, BOOL, void*); +typedef void (*LLCacheNameCallback)(const LLUUID&, const std::string&, const std::string&, BOOL, void*); // Here's the theory: // If you request a name that isn't in the cache, it returns "waiting" @@ -75,7 +75,6 @@ public: // last must be at least DB_LAST_NAME_BUF_SIZE characters. // If not available, copies the string "waiting". // Returns TRUE iff available. - BOOL getName(const LLUUID& id, char* first, char* last); BOOL getName(const LLUUID& id, std::string& first, std::string& last); BOOL getFullName(const LLUUID& id, std::string& fullname); @@ -83,7 +82,6 @@ public: // provided. The caller must allocate at least // DB_GROUP_NAME_BUF_SIZE characters. If not available, this // method copies the string "waiting". Returns TRUE iff available. - BOOL getGroupName(const LLUUID& id, char* group); BOOL getGroupName(const LLUUID& id, std::string& group); // Call the callback with the group or avatar name. @@ -107,7 +105,7 @@ public: void dump(); // Dumps the contents of the cache void dumpStats(); // Dumps the sizes of the cache and associated queues. - static LLString getDefaultName(); + static std::string getDefaultName(); private: diff --git a/linden/indra/llmessage/llcircuit.cpp b/linden/indra/llmessage/llcircuit.cpp index 7b369cb..12a1520 100644 --- a/linden/indra/llmessage/llcircuit.cpp +++ b/linden/indra/llmessage/llcircuit.cpp @@ -184,7 +184,7 @@ LLCircuitData::~LLCircuitData() std::ostream_iterator append(str, " "); str << "MSG: -> " << mHost << "\tABORTING RELIABLE:\t"; std::copy(doomed.begin(), doomed.end(), append); - llinfos << str.str().c_str() << llendl; + llinfos << str.str() << llendl; } } @@ -204,7 +204,7 @@ void LLCircuitData::ackReliablePacket(TPACKETID packet_num) std::ostringstream str; str << "MSG: <- " << packetp->mHost << "\tRELIABLE ACKED:\t" << packetp->mPacketID; - llinfos << str.str().c_str() << llendl; + llinfos << str.str() << llendl; } if (packetp->mCallback) { @@ -238,7 +238,7 @@ void LLCircuitData::ackReliablePacket(TPACKETID packet_num) std::ostringstream str; str << "MSG: <- " << packetp->mHost << "\tRELIABLE ACKED:\t" << packetp->mPacketID; - llinfos << str.str().c_str() << llendl; + llinfos << str.str() << llendl; } if (packetp->mCallback) { @@ -342,7 +342,7 @@ S32 LLCircuitData::resendUnackedPackets(const F64 now) std::ostringstream str; str << "MSG: -> " << packetp->mHost << "\tRESENDING RELIABLE:\t" << packetp->mPacketID; - llinfos << str.str().c_str() << llendl; + llinfos << str.str() << llendl; } packetp->mBuffer[0] |= LL_RESENT_FLAG; // tag packet id as being a resend @@ -403,7 +403,7 @@ S32 LLCircuitData::resendUnackedPackets(const F64 now) std::ostringstream str; str << "MSG: -> " << packetp->mHost << "\tABORTING RELIABLE:\t" << packetp->mPacketID; - llinfos << str.str().c_str() << llendl; + llinfos << str.str() << llendl; } if (packetp->mCallback) @@ -710,7 +710,7 @@ void LLCircuitData::checkPacketInID(TPACKETID id, BOOL receive_resent) { std::ostringstream str; str << "MSG: <- " << mHost << "\tRECOVERING LOST:\t" << id; - llinfos << str.str().c_str() << llendl; + llinfos << str.str() << llendl; } // llinfos << "removing potential lost: " << id << llendl; mPotentialLostPackets.erase(id); @@ -729,7 +729,7 @@ void LLCircuitData::checkPacketInID(TPACKETID id, BOOL receive_resent) std::ostringstream str; str << "MSG: <- " << mHost << "\tPACKET GAP:\t" << index; - llinfos << str.str().c_str() << llendl; + llinfos << str.str() << llendl; } // llinfos << "adding potential lost: " << index << llendl; @@ -747,7 +747,7 @@ void LLCircuitData::checkPacketInID(TPACKETID id, BOOL receive_resent) std::ostringstream str; str << "MSG: <- " << mHost << "\tPACKET GAP:\t" << id << " expected " << index; - llinfos << str.str().c_str() << llendl; + llinfos << str.str() << llendl; } } @@ -969,7 +969,7 @@ BOOL LLCircuitData::updateWatchDogTimers(LLMessageSystem *msgsys) std::ostringstream str; str << "MSG: <- " << mHost << "\tLOST PACKET:\t" << (*it).first; - llinfos << str.str().c_str() << llendl; + llinfos << str.str() << llendl; } mPotentialLostPackets.erase(it++); } @@ -1114,7 +1114,7 @@ void LLCircuit::sendAcks() str << "MSG: -> " << cd->mHost << "\tPACKET ACKS:\t"; std::ostream_iterator append(str, " "); std::copy(cd->mAcks.begin(), cd->mAcks.end(), append); - llinfos << str.str().c_str() << llendl; + llinfos << str.str() << llendl; } // empty out the acks list diff --git a/linden/indra/llmessage/llcurl.cpp b/linden/indra/llmessage/llcurl.cpp index f03cebc..834ec4b 100644 --- a/linden/indra/llmessage/llcurl.cpp +++ b/linden/indra/llmessage/llcurl.cpp @@ -101,6 +101,12 @@ void LLCurl::setCAFile(const std::string& file) sCAFile = file; } +//static +std::string LLCurl::getVersionString() +{ + return std::string(curl_version()); +} + ////////////////////////////////////////////////////////////////////////////// LLCurl::Responder::Responder() @@ -113,6 +119,15 @@ LLCurl::Responder::~Responder() } // virtual +void LLCurl::Responder::error( + U32 status, + const std::string& reason, + const LLSD&) +{ + error(status, reason); +} + +// virtual void LLCurl::Responder::error(U32 status, const std::string& reason) { llinfos << status << ": " << reason << llendl; @@ -124,38 +139,16 @@ void LLCurl::Responder::result(const LLSD& content) } // virtual -void LLCurl::Responder::completedRaw(U32 status, const std::string& reason, - const LLChannelDescriptors& channels, - const LLIOPipe::buffer_ptr_t& buffer) +void LLCurl::Responder::completedRaw( + U32 status, + const std::string& reason, + const LLChannelDescriptors& channels, + const LLIOPipe::buffer_ptr_t& buffer) { - if (isGoodStatus(status)) - { - LLSD content; - LLBufferStream istr(channels, buffer.get()); - LLSDSerialize::fromXML(content, istr); -/* - const S32 parseError = -1; - if(LLSDSerialize::fromXML(content, istr) == parseError) - { - mStatus = 498; - mReason = "Client Parse Error"; - } -*/ - completed(status, reason, content); - } - else if (status == 400) - { - // Get reason from buffer - char tbuf[4096]; - S32 len = 4096; - buffer->readAfter(channels.in(), NULL, (U8*)tbuf, len); - tbuf[len] = 0; - completed(status, std::string(tbuf), LLSD()); - } - else - { - completed(status, reason, LLSD()); - } + LLSD content; + LLBufferStream istr(channels, buffer.get()); + LLSDSerialize::fromXML(content, istr); + completed(status, reason, content); } // virtual @@ -167,7 +160,7 @@ void LLCurl::Responder::completed(U32 status, const std::string& reason, const L } else { - error(status, reason); + error(status, reason, content); } } @@ -281,7 +274,7 @@ LLCurl::Easy::~Easy() curl_easy_cleanup(mCurlEasyHandle); --gCurlEasyCount; curl_slist_free_all(mHeaders); - for_each(mStrings.begin(), mStrings.end(), DeletePointer()); + for_each(mStrings.begin(), mStrings.end(), DeletePointerArray()); } void LLCurl::Easy::resetState() @@ -882,6 +875,7 @@ void LLCurlEasyRequest::sendRequest(const std::string& url) { llassert_always(!mRequestSent); mRequestSent = true; + lldebugs << url << llendl; if (mEasy) { mEasy->setHeaders(); diff --git a/linden/indra/llmessage/llcurl.h b/linden/indra/llmessage/llcurl.h index 2737f6e..0c2caad 100644 --- a/linden/indra/llmessage/llcurl.h +++ b/linden/indra/llmessage/llcurl.h @@ -84,17 +84,31 @@ public: return((200 <= status) && (status < 300)); } + virtual void error( + U32 status, + const std::string& reason, + const LLSD& content); + //< called by completed() on bad status + virtual void error(U32 status, const std::string& reason); - // called with non-200 status codes + //< called by default error(status, reason, content) virtual void result(const LLSD& content); - - // Override point for clients that may want to use this class when the response is some other format besides LLSD - virtual void completedRaw(U32 status, const std::string& reason, - const LLChannelDescriptors& channels, - const LLIOPipe::buffer_ptr_t& buffer); + //< called by completed for good status codes. + + virtual void completedRaw( + U32 status, + const std::string& reason, + const LLChannelDescriptors& channels, + const LLIOPipe::buffer_ptr_t& buffer); + /**< Override point for clients that may want to use this + class when the response is some other format besides LLSD + */ - virtual void completed(U32 status, const std::string& reason, const LLSD& content); + virtual void completed( + U32 status, + const std::string& reason, + const LLSD& content); /**< The default implemetnation calls either: * result(), or @@ -120,6 +134,11 @@ public: * @ brief Set certificate authority path used to verify HTTPS certs. */ static void setCAPath(const std::string& path); + + /** + * @ brief Return human-readable string describing libcurl version. + */ + static std::string getVersionString(); /** * @ brief Get certificate authority file used to verify HTTPS certs. diff --git a/linden/indra/llmessage/lldatapacker.cpp b/linden/indra/llmessage/lldatapacker.cpp index ec198f7..2c7c036 100644 --- a/linden/indra/llmessage/lldatapacker.cpp +++ b/linden/indra/llmessage/lldatapacker.cpp @@ -170,16 +170,16 @@ BOOL LLDataPacker::unpackFixed(F32 &value, const char *name, // LLDataPackerBinaryBuffer implementation //--------------------------------------------------------------------------- -BOOL LLDataPackerBinaryBuffer::packString(const char *value, const char *name) +BOOL LLDataPackerBinaryBuffer::packString(const std::string& value, const char *name) { BOOL success = TRUE; - S32 length = (S32)strlen(value) + 1; /*Flawfinder: ignore*/ + S32 length = value.length()+1; success &= verifyLength(length, name); if (mWriteEnabled) { - htonmemcpy(mCurBufferp, value, MVT_VARIABLE, length); + htonmemcpy(mCurBufferp, value.c_str(), MVT_VARIABLE, length); } mCurBufferp += length; return success; @@ -577,18 +577,18 @@ void LLDataPackerBinaryBuffer::dumpBufferToLog() //--------------------------------------------------------------------------- // LLDataPackerAsciiBuffer implementation //--------------------------------------------------------------------------- -BOOL LLDataPackerAsciiBuffer::packString(const char *value, const char *name) +BOOL LLDataPackerAsciiBuffer::packString(const std::string& value, const char *name) { BOOL success = TRUE; writeIndentedName(name); int numCopied = 0; if (mWriteEnabled) { - numCopied = snprintf(mCurBufferp,getBufferSize()-getCurrentSize(),"%s\n", value); /* Flawfinder: ignore */ + numCopied = snprintf(mCurBufferp,getBufferSize()-getCurrentSize(),"%s\n", value.c_str()); /* Flawfinder: ignore */ } else { - numCopied = (S32)strlen(value) + 1; /*Flawfinder: ignore*/ + numCopied = value.length() + 1; /*Flawfinder: ignore*/ } // snprintf returns number of bytes that would have been written @@ -1242,9 +1242,9 @@ BOOL LLDataPackerAsciiBuffer::packUUID(const LLUUID &value, const char *name) int numCopied = 0; if (mWriteEnabled) { - char tmp_str[64]; /* Flawfinder: ignore */ + std::string tmp_str; value.toString(tmp_str); - numCopied = snprintf(mCurBufferp,getBufferSize()-getCurrentSize(),"%s\n", tmp_str); /* Flawfinder: ignore */ + numCopied = snprintf(mCurBufferp,getBufferSize()-getCurrentSize(),"%s\n", tmp_str.c_str()); /* Flawfinder: ignore */ } else { @@ -1376,13 +1376,13 @@ std::string convertF32ToString(F32 val) //--------------------------------------------------------------------------- // LLDataPackerAsciiFile implementation //--------------------------------------------------------------------------- -BOOL LLDataPackerAsciiFile::packString(const char *value, const char *name) +BOOL LLDataPackerAsciiFile::packString(const std::string& value, const char *name) { BOOL success = TRUE; writeIndentedName(name); if (mFP) { - fprintf(mFP,"%s\n", value); + fprintf(mFP,"%s\n", value.c_str()); } else if (mOutputStream) { @@ -1829,11 +1829,11 @@ BOOL LLDataPackerAsciiFile::packUUID(const LLUUID &value, const char *name) { BOOL success = TRUE; writeIndentedName(name); - char tmp_str[64]; /*Flawfinder: ignore */ + std::string tmp_str; value.toString(tmp_str); if (mFP) { - fprintf(mFP,"%s\n", tmp_str); + fprintf(mFP,"%s\n", tmp_str.c_str()); } else if (mOutputStream) { @@ -1877,7 +1877,7 @@ void LLDataPackerAsciiFile::writeIndentedName(const char *name) } else if (mOutputStream) { - *mOutputStream << indent_buf.c_str() << name << "\t"; + *mOutputStream << indent_buf << name << "\t"; } } diff --git a/linden/indra/llmessage/lldatapacker.h b/linden/indra/llmessage/lldatapacker.h index b1aa8fe..47dee99 100644 --- a/linden/indra/llmessage/lldatapacker.h +++ b/linden/indra/llmessage/lldatapacker.h @@ -49,7 +49,7 @@ public: virtual BOOL hasNext() const = 0; - virtual BOOL packString(const char *value, const char *name) = 0; + virtual BOOL packString(const std::string& value, const char *name) = 0; virtual BOOL unpackString(std::string& value, const char *name) = 0; virtual BOOL packBinaryData(const U8 *value, S32 size, const char *name) = 0; @@ -127,7 +127,7 @@ public: { } - /*virtual*/ BOOL packString(const char *value, const char *name); + /*virtual*/ BOOL packString(const std::string& value, const char *name); /*virtual*/ BOOL unpackString(std::string& value, const char *name); /*virtual*/ BOOL packBinaryData(const U8 *value, S32 size, const char *name); @@ -229,7 +229,7 @@ public: mWriteEnabled = FALSE; } - /*virtual*/ BOOL packString(const char *value, const char *name); + /*virtual*/ BOOL packString(const std::string& value, const char *name); /*virtual*/ BOOL unpackString(std::string& value, const char *name); /*virtual*/ BOOL packBinaryData(const U8 *value, S32 size, const char *name); @@ -358,7 +358,7 @@ public: { } - /*virtual*/ BOOL packString(const char *value, const char *name); + /*virtual*/ BOOL packString(const std::string& value, const char *name); /*virtual*/ BOOL unpackString(std::string& value, const char *name); /*virtual*/ BOOL packBinaryData(const U8 *value, S32 size, const char *name); diff --git a/linden/indra/llmessage/lldispatcher.cpp b/linden/indra/llmessage/lldispatcher.cpp index 0270721..541da42 100644 --- a/linden/indra/llmessage/lldispatcher.cpp +++ b/linden/indra/llmessage/lldispatcher.cpp @@ -111,8 +111,7 @@ bool LLDispatcher::unpackMessage( LLDispatcher::sparam_t& parameters) { char buf[MAX_STRING]; /*Flawfinder: ignore*/ - msg->getStringFast(_PREHASH_MethodData, _PREHASH_Method, MAX_STRING, buf); - method.assign(buf); + msg->getStringFast(_PREHASH_MethodData, _PREHASH_Method, method); msg->getUUIDFast(_PREHASH_MethodData, _PREHASH_Invoice, invoice); S32 size; S32 count = msg->getNumberOfBlocksFast(_PREHASH_ParamList); diff --git a/linden/indra/llmessage/llfiltersd2xmlrpc.cpp b/linden/indra/llmessage/llfiltersd2xmlrpc.cpp index b3ebd0b..a3c33dd 100644 --- a/linden/indra/llmessage/llfiltersd2xmlrpc.cpp +++ b/linden/indra/llmessage/llfiltersd2xmlrpc.cpp @@ -81,7 +81,7 @@ #include #include #include -#include "apr-1/apr_base64.h" +#include "apr_base64.h" #include "llbuffer.h" #include "llbufferstream.h" diff --git a/linden/indra/llmessage/llhost.cpp b/linden/indra/llmessage/llhost.cpp index e139f6d..34a0f92 100644 --- a/linden/indra/llmessage/llhost.cpp +++ b/linden/indra/llmessage/llhost.cpp @@ -66,34 +66,15 @@ LLHost::LLHost(const std::string& ip_and_port) } } -void LLHost::getString(char* buffer, S32 length) const +std::string LLHost::getString() const { - if (((U32) length) < MAXADDRSTR + 1 + 5) - { - llerrs << "LLHost::getString - string too short" << llendl; - return; - } - - snprintf(buffer, length, "%s:%u", u32_to_ip_string(mIP), mPort); /* Flawfinder: ignore */ -} - -void LLHost::getIPString(char* buffer, S32 length) const -{ - if ( ((U32) length) < MAXADDRSTR) - { - llerrs << "LLHost::getIPString - string too short" << llendl; - return; - } - - snprintf(buffer, length, "%s", u32_to_ip_string(mIP)); /* Flawfinder: ignore */ + return llformat("%s:%u", u32_to_ip_string(mIP), mPort); } std::string LLHost::getIPandPort() const { - char buffer[MAXADDRSTR + 1 + 5]; /*Flawfinder: ignore*/ - getString(buffer, sizeof(buffer)); - return buffer; + return getString(); } @@ -103,35 +84,6 @@ std::string LLHost::getIPString() const } -void LLHost::getHostName(char *buf, S32 len) const -{ - hostent *he; - - if (INVALID_HOST_IP_ADDRESS == mIP) - { - llwarns << "LLHost::getHostName() : Invalid IP address" << llendl; - buf[0] = '\0'; - return; - } - he = gethostbyaddr((char *)&mIP, sizeof(mIP), AF_INET); - if (!he) - { -#if LL_WINDOWS - llwarns << "LLHost::getHostName() : Couldn't find host name for address " << mIP << ", Error: " - << WSAGetLastError() << llendl; -#else - llwarns << "LLHost::getHostName() : Couldn't find host name for address " << mIP << ", Error: " - << h_errno << llendl; -#endif - buf[0] = '\0'; - } - else - { - strncpy(buf, he->h_name, len); /*Flawfinder: ignore*/ - buf[len-1] = '\0'; - } -} - std::string LLHost::getHostName() const { hostent* he; @@ -158,28 +110,20 @@ std::string LLHost::getHostName() const } } -BOOL LLHost::setHostByName(const char *string) +BOOL LLHost::setHostByName(const std::string& hostname) { hostent *he; - char local_name[MAX_STRING]; /*Flawfinder: ignore*/ - - if (strlen(string)+1 > MAX_STRING) /*Flawfinder: ignore*/ - { - llerrs << "LLHost::setHostByName() : Address string is too long: " - << string << llendl; - } + std::string local_name(hostname); - strncpy(local_name, string,MAX_STRING); /*Flawfinder: ignore*/ - local_name[MAX_STRING-1] = '\0'; #if LL_WINDOWS // We may need an equivalent for Linux, but not sure - djs - _strupr(local_name); + LLStringUtil::toUpper(local_name); #endif - he = gethostbyname(local_name); + he = gethostbyname(local_name.c_str()); if(!he) { - U32 ip_address = inet_addr(string); + U32 ip_address = inet_addr(hostname.c_str()); he = gethostbyaddr((char *)&ip_address, sizeof(ip_address), AF_INET); } diff --git a/linden/indra/llmessage/llhost.h b/linden/indra/llmessage/llhost.h index 0b3afe8..819e7ca 100644 --- a/linden/indra/llmessage/llhost.h +++ b/linden/indra/llmessage/llhost.h @@ -61,10 +61,10 @@ public: mIP = ipv4_addr; } - LLHost( const char *ipv4_addr, U32 port ) + LLHost( const std::string& ipv4_addr, U32 port ) : mPort( port ) { - mIP = ip_string_to_u32(ipv4_addr); + mIP = ip_string_to_u32(ipv4_addr.c_str()); } explicit LLHost(const U64 ip_port) @@ -82,11 +82,11 @@ public: // MANIPULATORS void set( U32 ip, U32 port ) { mIP = ip; mPort = port; } - void set( const char* ipstr, U32 port ) { mIP = ip_string_to_u32(ipstr); mPort = port; } - void setAddress( const char* ipstr ) { mIP = ip_string_to_u32(ipstr); } + void set( const std::string& ipstr, U32 port ) { mIP = ip_string_to_u32(ipstr.c_str()); mPort = port; } + void setAddress( const std::string& ipstr ) { mIP = ip_string_to_u32(ipstr.c_str()); } void setAddress( U32 ip ) { mIP = ip; } void setPort( U32 port ) { mPort = port; } - BOOL setHostByName(const char *hname); + BOOL setHostByName(const std::string& hname); LLHost& operator=(const LLHost &rhs); void invalidate() { mIP = INVALID_HOST_IP_ADDRESS; mPort = INVALID_PORT;}; @@ -96,10 +96,8 @@ public: U32 getPort() const { return mPort; } BOOL isOk() const { return (mIP != INVALID_HOST_IP_ADDRESS) && (mPort != INVALID_PORT); } size_t hash() const { return (mIP << 16) | (mPort & 0xffff); } - void getString(char* buffer, S32 length) const; // writes IP:port into buffer - void getIPString(char* buffer, S32 length) const; // writes IP into buffer + std::string getString() const; std::string getIPString() const; - void getHostName(char *buf, S32 len) const; std::string getHostName() const; std::string getIPandPort() const; diff --git a/linden/indra/llmessage/llhttpassetstorage.cpp b/linden/indra/llmessage/llhttpassetstorage.cpp index 49896c6..fdd521f 100644 --- a/linden/indra/llmessage/llhttpassetstorage.cpp +++ b/linden/indra/llmessage/llhttpassetstorage.cpp @@ -81,8 +81,8 @@ class LLHTTPAssetRequest : public LLAssetRequest { public: LLHTTPAssetRequest(LLHTTPAssetStorage *asp, const LLUUID &uuid, - LLAssetType::EType type, LLAssetStorage::ERequestType rt, - const char *url, CURLM *curl_multi); + LLAssetType::EType type, LLAssetStorage::ERequestType rt, + const std::string& url, CURLM *curl_multi); virtual ~LLHTTPAssetRequest(); void setupCurlHandle(); @@ -103,7 +103,7 @@ public: CURL *mCurlHandle; CURLM *mCurlMultiHandle; - char *mURLBuffer; + std::string mURLBuffer; struct curl_slist *mHTTPHeaders; LLVFile *mVFile; LLUUID mTmpUUID; @@ -122,7 +122,7 @@ LLHTTPAssetRequest::LLHTTPAssetRequest(LLHTTPAssetStorage *asp, const LLUUID &uuid, LLAssetType::EType type, LLAssetStorage::ERequestType rt, - const char *url, + const std::string& url, CURLM *curl_multi) : LLAssetRequest(uuid, type), mZInitialized(false) @@ -137,11 +137,7 @@ LLHTTPAssetRequest::LLHTTPAssetRequest(LLHTTPAssetStorage *asp, mZInputBuffer = NULL; mZInputExhausted = false; - mURLBuffer = new char[strlen(url) + 1]; /*Flawfinder: ignore*/ - if (mURLBuffer) - { - strcpy(mURLBuffer, url); /*Flawfinder: ignore*/ - } + mURLBuffer = url; } LLHTTPAssetRequest::~LLHTTPAssetRequest() @@ -156,7 +152,6 @@ LLHTTPAssetRequest::~LLHTTPAssetRequest() { curl_slist_free_all(mHTTPHeaders); } - delete[] mURLBuffer; delete mVFile; finishCompressedUpload(); } @@ -242,7 +237,7 @@ void LLHTTPAssetRequest::setupCurlHandle() mCurlHandle = curl_easy_init(); curl_easy_setopt(mCurlHandle, CURLOPT_NOSIGNAL, 1); curl_easy_setopt(mCurlHandle, CURLOPT_NOPROGRESS, 1); - curl_easy_setopt(mCurlHandle, CURLOPT_URL, mURLBuffer); + curl_easy_setopt(mCurlHandle, CURLOPT_URL, mURLBuffer.c_str()); curl_easy_setopt(mCurlHandle, CURLOPT_PRIVATE, this); if (LLAssetStorage::RT_DOWNLOAD == mRequestType) { @@ -400,9 +395,9 @@ size_t LLHTTPAssetRequest::curlCompressedUploadCallback( LLHTTPAssetStorage::LLHTTPAssetStorage(LLMessageSystem *msg, LLXferManager *xfer, LLVFS *vfs, const LLHost &upstream_host, - const char *web_host, - const char *local_web_host, - const char *host_name) + const std::string& web_host, + const std::string& local_web_host, + const std::string& host_name) : LLAssetStorage(msg, xfer, vfs, upstream_host) { _init(web_host, local_web_host, host_name); @@ -410,15 +405,15 @@ LLHTTPAssetStorage::LLHTTPAssetStorage(LLMessageSystem *msg, LLXferManager *xfer LLHTTPAssetStorage::LLHTTPAssetStorage(LLMessageSystem *msg, LLXferManager *xfer, LLVFS *vfs, - const char *web_host, - const char *local_web_host, - const char *host_name) + const std::string& web_host, + const std::string& local_web_host, + const std::string& host_name) : LLAssetStorage(msg, xfer, vfs) { _init(web_host, local_web_host, host_name); } -void LLHTTPAssetStorage::_init(const char *web_host, const char *local_web_host, const char* host_name) +void LLHTTPAssetStorage::_init(const std::string& web_host, const std::string& local_web_host, const std::string& host_name) { mBaseURL = web_host; mLocalBaseURL = local_web_host; @@ -470,7 +465,7 @@ void LLHTTPAssetStorage::storeAssetData( { message = "Added to upload queue"; } - reportMetric( uuid, type, NULL, requesting_agent_id, size, MR_OKAY, __FILE__, __LINE__, message ); + reportMetric( uuid, type, LLStringUtil::null, requesting_agent_id, size, MR_OKAY, __FILE__, __LINE__, message ); // this will get picked up and transmitted in checkForTimeouts if(store_local) @@ -492,7 +487,7 @@ void LLHTTPAssetStorage::storeAssetData( if (callback) { // LLAssetStorage metric: Zero size VFS - reportMetric( uuid, type, NULL, requesting_agent_id, 0, MR_ZERO_SIZE, __FILE__, __LINE__, "The file didn't exist or was zero length (VFS - can't tell which)" ); + reportMetric( uuid, type, LLStringUtil::null, requesting_agent_id, 0, MR_ZERO_SIZE, __FILE__, __LINE__, "The file didn't exist or was zero length (VFS - can't tell which)" ); callback(uuid, user_data, LL_ERR_ASSET_REQUEST_NONEXISTENT_FILE, LL_EXSTAT_NONEXISTENT_FILE); } } @@ -500,7 +495,7 @@ void LLHTTPAssetStorage::storeAssetData( // virtual void LLHTTPAssetStorage::storeAssetData( - const char* filename, + const std::string& filename, const LLUUID& asset_id, LLAssetType::EType asset_type, LLStoreAssetCallback callback, @@ -597,7 +592,7 @@ LLSD LLHTTPAssetStorage::getPendingDetails(LLAssetStorage::ERequestType rt, LLSD& pending = sd["requests"][i]; // See if this pending request is running. const LLAssetRequest* req = findRequest(running, - LLAssetType::lookup(pending["type"].asString().c_str()), + LLAssetType::lookup(pending["type"].asString()), pending["asset_id"]); if (req) { @@ -768,11 +763,11 @@ void LLHTTPAssetStorage::checkForTimeouts() // Setup this curl download request // We need to generate a new request here // since the one in the list could go away - char tmp_url[MAX_STRING]; /*Flawfinder: ignore*/ - char uuid_str[UUID_STR_LENGTH]; /*Flawfinder: ignore*/ + std::string tmp_url; + std::string uuid_str; req->getUUID().toString(uuid_str); std::string base_url = getBaseURL(req->getUUID(), req->getType()); - snprintf(tmp_url, sizeof(tmp_url), "%s/%36s.%s", base_url.c_str() , uuid_str, LLAssetType::lookup(req->getType())); /* Flawfinder: ignore */ + tmp_url = llformat("%s/%36s.%s", base_url.c_str() , uuid_str.c_str(), LLAssetType::lookup(req->getType())); LLHTTPAssetRequest *new_req = new LLHTTPAssetRequest(this, req->getUUID(), req->getType(), RT_DOWNLOAD, tmp_url, mCurlMultiHandle); @@ -805,12 +800,11 @@ void LLHTTPAssetStorage::checkForTimeouts() bool do_compress = req->getType() == LLAssetType::AT_OBJECT; - char tmp_url[MAX_STRING];/*Flawfinder: ignore*/ - char uuid_str[UUID_STR_LENGTH];/*Flawfinder: ignore*/ + std::string tmp_url; + std::string uuid_str; req->getUUID().toString(uuid_str); - snprintf(tmp_url, sizeof(tmp_url), /* Flawfinder: ignore */ - do_compress ? "%s/%s.%s.gz" : "%s/%s.%s", - mBaseURL.c_str(), uuid_str, LLAssetType::lookup(req->getType())); + tmp_url = mBaseURL + "/" + uuid_str + "." + LLAssetType::lookup(req->getType()); + if (do_compress) tmp_url += ".gz"; LLHTTPAssetRequest *new_req = new LLHTTPAssetRequest(this, req->getUUID(), req->getType(), RT_UPLOAD, tmp_url, mCurlMultiHandle); @@ -876,12 +870,12 @@ void LLHTTPAssetStorage::checkForTimeouts() // setup this curl upload request LLVFile file(mVFS, req->getUUID(), req->getType()); - char tmp_url[MAX_STRING]; /*Flawfinder: ignore*/ - char uuid_str[UUID_STR_LENGTH]; /*Flawfinder: ignore*/ + std::string tmp_url; + std::string uuid_str; req->getUUID().toString(uuid_str); // KLW - All temporary uploads are saved locally "http://localhost:12041/asset" - snprintf(tmp_url, sizeof(tmp_url), "%s/%36s.%s", mLocalBaseURL.c_str(), uuid_str, LLAssetType::lookup(req->getType())); /* Flawfinder: ignore */ + tmp_url = llformat("%s/%36s.%s", mLocalBaseURL.c_str(), uuid_str.c_str(), LLAssetType::lookup(req->getType())); LLHTTPAssetRequest *new_req = new LLHTTPAssetRequest(this, req->getUUID(), req->getType(), RT_LOCALUPLOAD, tmp_url, mCurlMultiHandle); @@ -1160,7 +1154,7 @@ size_t LLHTTPAssetStorage::nullOutputCallback(void *data, size_t size, size_t nm // blocking asset fetch which bypasses the VFS // this is a very limited function for use by the simstate loader and other one-offs -S32 LLHTTPAssetStorage::getURLToFile(const LLUUID& uuid, LLAssetType::EType asset_type, const LLString &url, const char *filename, progress_callback callback, void *userdata) +S32 LLHTTPAssetStorage::getURLToFile(const LLUUID& uuid, LLAssetType::EType asset_type, const std::string &url, const std::string& filename, progress_callback callback, void *userdata) { // *NOTE: There is no guarantee that the uuid and the asset_type match // - not that it matters. - Doug @@ -1174,7 +1168,7 @@ S32 LLHTTPAssetStorage::getURLToFile(const LLUUID& uuid, LLAssetType::EType asse } // make sure we use the normal curl setup, even though we don't really need a request object - LLHTTPAssetRequest req(this, uuid, asset_type, RT_DOWNLOAD, url.c_str(), mCurlMultiHandle); + LLHTTPAssetRequest req(this, uuid, asset_type, RT_DOWNLOAD, url, mCurlMultiHandle); req.mFP = fp; req.setupCurlHandle(); diff --git a/linden/indra/llmessage/llhttpassetstorage.h b/linden/indra/llmessage/llhttpassetstorage.h index 71e973a..585b281 100644 --- a/linden/indra/llmessage/llhttpassetstorage.h +++ b/linden/indra/llmessage/llhttpassetstorage.h @@ -48,15 +48,15 @@ class LLHTTPAssetStorage : public LLAssetStorage public: LLHTTPAssetStorage(LLMessageSystem *msg, LLXferManager *xfer, LLVFS *vfs, const LLHost &upstream_host, - const char *web_host, - const char *local_web_host, - const char *host_name); + const std::string& web_host, + const std::string& local_web_host, + const std::string& host_name); LLHTTPAssetStorage(LLMessageSystem *msg, LLXferManager *xfer, LLVFS *vfs, - const char *web_host, - const char *local_web_host, - const char *host_name); + const std::string& web_host, + const std::string& local_web_host, + const std::string& host_name); virtual ~LLHTTPAssetStorage(); @@ -74,7 +74,7 @@ public: F64 timeout=LL_ASSET_STORAGE_TIMEOUT); virtual void storeAssetData( - const char* filename, + const std::string& filename, const LLUUID& asset_id, LLAssetType::EType atype, LLStoreAssetCallback callback, @@ -99,7 +99,7 @@ public: // Hack. One off curl download an URL to a file. Probably should be elsewhere. // Only used by lldynamicstate. The API is broken, and should be replaced with // a generic HTTP file fetch - Doug 9/25/06 - S32 getURLToFile(const LLUUID& uuid, LLAssetType::EType asset_type, const LLString &url, const char *filename, progress_callback callback, void *userdata); + S32 getURLToFile(const LLUUID& uuid, LLAssetType::EType asset_type, const std::string &url, const std::string& filename, progress_callback callback, void *userdata); LLAssetRequest* findNextRequest(request_list_t& pending, request_list_t& running); @@ -135,7 +135,7 @@ protected: void *user_data, BOOL duplicate, BOOL is_priority); private: - void _init(const char *web_host, const char *local_web_host, const char* host_name); + void _init(const std::string& web_host, const std::string& local_web_host, const std::string& host_name); // This will return the correct base URI for any http asset request std::string getBaseURL(const LLUUID& asset_id, LLAssetType::EType asset_type); diff --git a/linden/indra/llmessage/llhttpclient.cpp b/linden/indra/llmessage/llhttpclient.cpp index 22c0c68..caeaee1 100644 --- a/linden/indra/llmessage/llhttpclient.cpp +++ b/linden/indra/llmessage/llhttpclient.cpp @@ -122,7 +122,7 @@ namespace { public: RawInjector(const U8* data, S32 size) : mData(data), mSize(size) {} - virtual ~RawInjector() {} + virtual ~RawInjector() {delete mData;} const char* contentType() { return "application/octet-stream"; } @@ -152,17 +152,22 @@ namespace { LLBufferStream ostream(channels, buffer.get()); - llifstream fstream(mFilename.c_str(), std::iostream::binary | std::iostream::out); - fstream.seekg(0, std::ios::end); - U32 fileSize = fstream.tellg(); - fstream.seekg(0, std::ios::beg); - char* fileBuffer; - fileBuffer = new char [fileSize]; - fstream.read(fileBuffer, fileSize); - ostream.write(fileBuffer, fileSize); - fstream.close(); - eos = true; - return STATUS_DONE; + llifstream fstream(mFilename, std::iostream::binary | std::iostream::out); + if(fstream.is_open()) + { + fstream.seekg(0, std::ios::end); + U32 fileSize = fstream.tellg(); + fstream.seekg(0, std::ios::beg); + char* fileBuffer; + fileBuffer = new char [fileSize]; + fstream.read(fileBuffer, fileSize); + ostream.write(fileBuffer, fileSize); + fstream.close(); + eos = true; + return STATUS_DONE; + } + + return STATUS_ERROR; } const std::string mFilename; @@ -199,14 +204,13 @@ namespace LLPumpIO* theClientPump = NULL; } -static void request(const std::string& url, - LLURLRequest::ERequestAction method, - Injector* body_injector, - LLCurl::ResponderPtr responder, - const LLSD& headers = LLSD(), - const F32 timeout = HTTP_REQUEST_EXPIRY_SECS, - S32 offset = 0, - S32 bytes = 0) +static void request( + const std::string& url, + LLURLRequest::ERequestAction method, + Injector* body_injector, + LLCurl::ResponderPtr responder, + const F32 timeout = HTTP_REQUEST_EXPIRY_SECS, + const LLSD& headers = LLSD()) { if (!LLHTTPClient::hasPump()) { @@ -215,7 +219,7 @@ static void request(const std::string& url, } LLPumpIO::chain_t chain; - LLURLRequest *req = new LLURLRequest(method, url); + LLURLRequest* req = new LLURLRequest(method, url); req->checkRootCertificate(true); // Insert custom headers is the caller sent any @@ -234,10 +238,10 @@ static void request(const std::string& url, //to not use the proxy (read: llurlrequest.cpp) if ((iter->first == "Pragma") && (iter->second.asString() == "")) { - req->useProxy(FALSE); + req->useProxy(false); } header << iter->first << ": " << iter->second.asString() ; - llinfos << "header = " << header.str() << llendl; + lldebugs << "header = " << header.str() << llendl; req->addHeader(header.str().c_str()); } } @@ -257,25 +261,27 @@ static void request(const std::string& url, chain.push_back(LLIOPipe::ptr_t(body_injector)); } - if (method == LLURLRequest::HTTP_GET && (offset > 0 || bytes > 0)) - { - std::string range = llformat("Range: bytes=%d-%d", offset,offset+bytes-1); - req->addHeader(range.c_str()); - } - chain.push_back(LLIOPipe::ptr_t(req)); theClientPump->addChain(chain, timeout); } -void LLHTTPClient::getByteRange(const std::string& url, - S32 offset, S32 bytes, - ResponderPtr responder, - const LLSD& headers, - const F32 timeout) +void LLHTTPClient::getByteRange( + const std::string& url, + S32 offset, + S32 bytes, + ResponderPtr responder, + const LLSD& hdrs, + const F32 timeout) { - request(url, LLURLRequest::HTTP_GET, NULL, responder, LLSD(), timeout, offset, bytes); + LLSD headers = hdrs; + if(offset > 0 || bytes > 0) + { + std::string range = llformat("bytes=%d-%d", offset, offset+bytes-1); + headers["Range"] = range; + } + request(url,LLURLRequest::HTTP_GET, NULL, responder, timeout, headers); } void LLHTTPClient::head(const std::string& url, ResponderPtr responder, const F32 timeout) @@ -285,11 +291,11 @@ void LLHTTPClient::head(const std::string& url, ResponderPtr responder, const F3 void LLHTTPClient::get(const std::string& url, ResponderPtr responder, const LLSD& headers, const F32 timeout) { - request(url, LLURLRequest::HTTP_GET, NULL, responder, headers, timeout); + request(url, LLURLRequest::HTTP_GET, NULL, responder, timeout, headers); } void LLHTTPClient::getHeaderOnly(const std::string& url, ResponderPtr responder, const LLSD& headers, const F32 timeout) { - request(url, LLURLRequest::HTTP_HEAD, NULL, responder, headers, timeout); + request(url, LLURLRequest::HTTP_HEAD, NULL, responder, timeout, headers); } void LLHTTPClient::getHeaderOnly(const std::string& url, ResponderPtr responder, const F32 timeout) { @@ -401,17 +407,11 @@ void LLHTTPClient::post(const std::string& url, const LLSD& body, ResponderPtr r request(url, LLURLRequest::HTTP_POST, new LLSDInjector(body), responder, timeout); } -void LLHTTPClient::post(const std::string& url, const U8* data, S32 size, ResponderPtr responder, const F32 timeout) +void LLHTTPClient::postRaw(const std::string& url, const U8* data, S32 size, ResponderPtr responder, const F32 timeout) { request(url, LLURLRequest::HTTP_POST, new RawInjector(data, size), responder, timeout); } -void LLHTTPClient::del(const std::string& url, ResponderPtr responder, const F32 timeout) -{ - request(url, LLURLRequest::HTTP_DELETE, NULL, responder, timeout); -} - -#if 1 void LLHTTPClient::postFile(const std::string& url, const std::string& filename, ResponderPtr responder, const F32 timeout) { request(url, LLURLRequest::HTTP_POST, new FileInjector(filename), responder, timeout); @@ -422,7 +422,28 @@ void LLHTTPClient::postFile(const std::string& url, const LLUUID& uuid, { request(url, LLURLRequest::HTTP_POST, new VFileInjector(uuid, asset_type), responder, timeout); } -#endif + +// static +void LLHTTPClient::del( + const std::string& url, + ResponderPtr responder, + const F32 timeout) +{ + request(url, LLURLRequest::HTTP_DELETE, NULL, responder, timeout); +} + +// static +void LLHTTPClient::move( + const std::string& url, + const std::string& destination, + ResponderPtr responder, + const F32 timeout) +{ + LLSD headers; + headers["Destination"] = destination; + request(url, LLURLRequest::HTTP_MOVE, NULL, responder, timeout, headers); +} + void LLHTTPClient::setPump(LLPumpIO& pump) { diff --git a/linden/indra/llmessage/llhttpclient.h b/linden/indra/llmessage/llhttpclient.h index df31b44..50c6f7a 100644 --- a/linden/indra/llmessage/llhttpclient.h +++ b/linden/indra/llmessage/llhttpclient.h @@ -60,7 +60,8 @@ public: typedef LLCurl::Responder Responder; typedef LLCurl::ResponderPtr ResponderPtr; - // non-blocking + /** @name non-blocking API */ + //@{ static void head(const std::string& url, ResponderPtr, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); static void getByteRange(const std::string& url, S32 offset, S32 bytes, ResponderPtr, const LLSD& headers=LLSD(), const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); static void get(const std::string& url, ResponderPtr, const LLSD& headers = LLSD(), const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); @@ -70,13 +71,38 @@ public: static void getHeaderOnly(const std::string& url, ResponderPtr, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); static void getHeaderOnly(const std::string& url, ResponderPtr, const LLSD& headers, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); - ///< non-blocking static void post(const std::string& url, const LLSD& body, ResponderPtr, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); - static void post(const std::string& url, const U8* data, S32 size, ResponderPtr responder, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); + + /** Takes ownership of data and deletes it when sent */ + static void postRaw(const std::string& url, const U8* data, S32 size, ResponderPtr responder, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); + static void postFile(const std::string& url, const std::string& filename, ResponderPtr, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); + # static void postFile(const std::string& url, const LLUUID& uuid, LLAssetType::EType asset_type, ResponderPtr responder, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); + static void del( + const std::string& url, + ResponderPtr responder, + const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); + ///< sends a DELETE method, but we can't call it delete in c++ + + /** + * @brief Send a MOVE webdav method + * + * @param url The complete serialized (and escaped) url to get. + * @param destination The complete serialized destination url. + * @param responder The responder that will handle the result. + * @param timeout The number of seconds to give the server to respond. + */ + static void move( + const std::string& url, + const std::string& destination, + ResponderPtr responder, + const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); + + //@} + /** * @brief Blocking HTTP get that returns an LLSD map of status and body. * @@ -85,9 +111,7 @@ public: */ static LLSD blockingGet(const std::string& url); - static void del(const std::string& url, ResponderPtr, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); - ///< sends a DELETE method, but we can't call it delete in c++ - + static void setPump(LLPumpIO& pump); ///< must be called before any of the above calls are made diff --git a/linden/indra/llmessage/llhttpnode.cpp b/linden/indra/llmessage/llhttpnode.cpp index 46f2061..772fb17 100644 --- a/linden/indra/llmessage/llhttpnode.cpp +++ b/linden/indra/llmessage/llhttpnode.cpp @@ -174,6 +174,26 @@ LLSD LLHTTPNode::del(const LLSD&) const throw NotImplemented(); } +// virtual +void LLHTTPNode::options(ResponsePtr response, const LLSD& context) const +{ + //llinfos << "options context: " << context << llendl; + + // default implementation constructs an url to the documentation. + std::string host = context[CONTEXT_REQUEST]["headers"]["host"].asString(); + if(host.empty()) + { + response->status(400, "Bad Request -- need Host header"); + return; + } + std::ostringstream ostr; + ostr << "http://" << host << "/web/server/api"; + ostr << context[CONTEXT_REQUEST]["path"].asString(); + static const std::string DOC_HEADER("X-Documentation-URL"); + response->addHeader(DOC_HEADER, ostr.str()); + response->status(200, "OK"); +} + // virtual LLHTTPNode* LLHTTPNode::getChild(const std::string& name, LLSD& context) const @@ -386,6 +406,13 @@ void LLHTTPNode::Response::methodNotAllowed() status(405, "Method Not Allowed"); } +void LLHTTPNode::Response::addHeader( + const std::string& name, + const std::string& value) +{ + mHeaders[name] = value; +} + void LLHTTPNode::describe(Description& desc) const { desc.shortInfo("unknown service (missing describe() method)"); diff --git a/linden/indra/llmessage/llhttpnode.h b/linden/indra/llmessage/llhttpnode.h index 02e8ceb..4339e5c 100644 --- a/linden/indra/llmessage/llhttpnode.h +++ b/linden/indra/llmessage/llhttpnode.h @@ -82,33 +82,79 @@ public: */ //@{ public: - virtual LLSD get() const; - virtual LLSD put(const LLSD& input) const; - virtual LLSD post(const LLSD& input) const; - virtual LLSD del(const LLSD& context) const; + virtual LLSD get() const; + virtual LLSD put(const LLSD& input) const; + virtual LLSD post(const LLSD& input) const; + virtual LLSD del(const LLSD& context) const; - class Response : public LLRefCount - { - protected: - virtual ~Response(); + class Response : public LLRefCount + { + protected: + virtual ~Response(); - public: - virtual void result(const LLSD&) = 0; - virtual void status(S32 code, const std::string& message) = 0; + public: + /** + * @brief Return the LLSD content and a 200 OK. + */ + virtual void result(const LLSD&) = 0; + + /** + * @brief return status code and reason string on http header, + * but do not return a payload. + */ + virtual void status(S32 code, const std::string& message) = 0; + + /** + * @brief Return no body, just status code and 'UNKNOWN ERROR'. + */ + void status(S32 code); + + void notFound(const std::string& message); + void notFound(); + void methodNotAllowed(); + + /** + * @breif Add a name: value http header. + * + * No effort is made to ensure the response is a valid http + * header. + * The headers are stored as a map of header name : value. + * Though HTTP allows the same header name to be transmitted + * more than once, this implementation only stores a header + * name once. + * @param name The name of the header, eg, "Content-Encoding" + * @param value The value of the header, eg, "gzip" + */ + void addHeader(const std::string& name, const std::string& value); + + protected: + /** + * @brief Headers to be sent back with the HTTP response. + * + * Protected class membership since derived classes are + * expected to use it and there is no use case yet for other + * uses. If such a use case arises, I suggest making a + * headers() public method, and moving this member data into + * private. + */ + LLSD mHeaders; + }; - void status(S32 code); - void notFound(const std::string& message); - void notFound(); - void methodNotAllowed(); - }; - typedef LLPointer ResponsePtr; + typedef LLPointer ResponsePtr; - virtual void get(ResponsePtr, const LLSD& context) const; - virtual void put(ResponsePtr, const LLSD& context, const LLSD& input) const; - virtual void post(ResponsePtr, const LLSD& context, const LLSD& input) const; - virtual void del(ResponsePtr, const LLSD& context) const; + virtual void get(ResponsePtr, const LLSD& context) const; + virtual void put( + ResponsePtr, + const LLSD& context, + const LLSD& input) const; + virtual void post( + ResponsePtr, + const LLSD& context, + const LLSD& input) const; + virtual void del(ResponsePtr, const LLSD& context) const; + virtual void options(ResponsePtr, const LLSD& context) const; //@} diff --git a/linden/indra/llmessage/llhttpsender.cpp b/linden/indra/llmessage/llhttpsender.cpp index f0b453d..f72a7be 100644 --- a/linden/indra/llmessage/llhttpsender.cpp +++ b/linden/indra/llmessage/llhttpsender.cpp @@ -52,7 +52,7 @@ LLHTTPSender::~LLHTTPSender() } //virtual -void LLHTTPSender::send(const LLHost& host, const char* name, +void LLHTTPSender::send(const LLHost& host, const std::string& name, const LLSD& body, LLHTTPClient::ResponderPtr response) const { diff --git a/linden/indra/llmessage/llhttpsender.h b/linden/indra/llmessage/llhttpsender.h index 86dd754..9073f48 100644 --- a/linden/indra/llmessage/llhttpsender.h +++ b/linden/indra/llmessage/llhttpsender.h @@ -45,7 +45,7 @@ class LLHTTPSender /** @brief Send message to host with body, call response when done */ virtual void send(const LLHost& host, - const char* message, const LLSD& body, + const std::string& message, const LLSD& body, LLHTTPClient::ResponderPtr response) const; /** @brief Set sender for host, takes ownership of sender. */ diff --git a/linden/indra/llmessage/llinstantmessage.cpp b/linden/indra/llmessage/llinstantmessage.cpp index 390a6fa..5012741 100644 --- a/linden/indra/llmessage/llinstantmessage.cpp +++ b/linden/indra/llmessage/llinstantmessage.cpp @@ -59,7 +59,7 @@ const S32 VOTE_UNANIMOUS = 2; const char EMPTY_BINARY_BUCKET[] = ""; const S32 EMPTY_BINARY_BUCKET_SIZE = 1; const U32 NO_TIMESTAMP = 0; -const char SYSTEM_FROM[] = "Second Life"; +const std::string SYSTEM_FROM("Second Life"); const S32 IM_TTL = 1; @@ -144,8 +144,8 @@ void LLIMInfo::packMessageBlock(LLMessageSystem* msg) const mFromGroup, LLUUID::null, mToID, - mName.c_str(), - mMessage.c_str(), + mName, + mMessage, mOffline, mIMType, mID, @@ -163,8 +163,8 @@ void pack_instant_message( BOOL from_group, const LLUUID& session_id, const LLUUID& to_id, - const char* name, - const char* message, + const std::string& name, + const std::string& message, U8 offline, EInstantMessage dialog, const LLUUID& id, @@ -202,8 +202,8 @@ void pack_instant_message_block( BOOL from_group, const LLUUID& session_id, const LLUUID& to_id, - const char* name, - const char* message, + const std::string& name, + const std::string& message, U8 offline, EInstantMessage dialog, const LLUUID& id, @@ -229,10 +229,10 @@ void pack_instant_message_block( msg->addU32Fast(_PREHASH_Timestamp, timestamp); msg->addStringFast(_PREHASH_FromAgentName, name); S32 bytes_left = MTUBYTES; - if(message) + if(!message.empty()) { char buffer[MTUBYTES]; - int num_written = snprintf(buffer, MTUBYTES, "%s", message); /* Flawfinder: ignore */ + int num_written = snprintf(buffer, MTUBYTES, "%s", message.c_str()); /* Flawfinder: ignore */ // snprintf returns number of bytes that would have been written // had the output not being truncated. In that case, it will // return either -1 or value >= passed in size value . So a check needs to be added @@ -281,13 +281,9 @@ void LLIMInfo::unpackMessageBlock(LLMessageSystem* msg) mIMType = (EInstantMessage) dialog; msg->getUUIDFast(_PREHASH_MessageBlock, _PREHASH_ID, mID); msg->getU32Fast(_PREHASH_MessageBlock, _PREHASH_Timestamp, mTimeStamp); - char name[DB_FULL_NAME_BUF_SIZE]; /*Flawfinder: ignore*/ - msg->getStringFast(_PREHASH_MessageBlock, _PREHASH_FromAgentName, DB_FULL_NAME_BUF_SIZE, name); - mName.assign(name); + msg->getStringFast(_PREHASH_MessageBlock, _PREHASH_FromAgentName, mName); - char message[DB_IM_MSG_BUF_SIZE]; /*Flawfinder: ignore*/ - msg->getStringFast(_PREHASH_MessageBlock, _PREHASH_Message, DB_IM_MSG_BUF_SIZE, message); - mMessage.assign(message); + msg->getStringFast(_PREHASH_MessageBlock, _PREHASH_Message, mMessage); S32 binary_bucket_size = llmin( MTUBYTES, diff --git a/linden/indra/llmessage/llinstantmessage.h b/linden/indra/llmessage/llinstantmessage.h index 35127c3..d95b551 100644 --- a/linden/indra/llmessage/llinstantmessage.h +++ b/linden/indra/llmessage/llinstantmessage.h @@ -222,7 +222,7 @@ extern const char EMPTY_BINARY_BUCKET[]; extern const S32 EMPTY_BINARY_BUCKET_SIZE; extern const U32 NO_TIMESTAMP; -extern const char SYSTEM_FROM[]; +extern const std::string SYSTEM_FROM; // Number of retry attempts on sending the im. extern const S32 IM_TTL; @@ -289,8 +289,8 @@ void pack_instant_message( BOOL from_group, const LLUUID& session_id, const LLUUID& to_id, - const char* name, - const char* message, + const std::string& name, + const std::string& message, U8 offline = IM_ONLINE, EInstantMessage dialog = IM_NOTHING_SPECIAL, const LLUUID& id = LLUUID::null, @@ -307,8 +307,8 @@ void pack_instant_message_block( BOOL from_group, const LLUUID& session_id, const LLUUID& to_id, - const char* name, - const char* message, + const std::string& name, + const std::string& message, U8 offline = IM_ONLINE, EInstantMessage dialog = IM_NOTHING_SPECIAL, const LLUUID& id = LLUUID::null, diff --git a/linden/indra/llmessage/lliohttpserver.cpp b/linden/indra/llmessage/lliohttpserver.cpp index 2ebf117..d4155f6 100644 --- a/linden/indra/llmessage/lliohttpserver.cpp +++ b/linden/indra/llmessage/lliohttpserver.cpp @@ -57,10 +57,13 @@ static const char HTTP_VERSION_STR[] = "HTTP/1.0"; static const std::string CONTEXT_REQUEST("request"); static const std::string CONTEXT_RESPONSE("response"); +static const std::string CONTEXT_VERB("verb"); +static const std::string CONTEXT_HEADERS("headers"); static const std::string HTTP_VERB_GET("GET"); static const std::string HTTP_VERB_PUT("PUT"); static const std::string HTTP_VERB_POST("POST"); static const std::string HTTP_VERB_DELETE("DELETE"); +static const std::string HTTP_VERB_OPTIONS("OPTIONS"); static LLIOHTTPServer::timing_callback_t sTimingCallback = NULL; static void* sTimingCallbackData = NULL; @@ -130,6 +133,7 @@ private: LLSD mGoodResult; S32 mStatusCode; std::string mStatusMessage; + LLSD mHeaders; }; LLIOPipe::EStatus LLHTTPPipe::process_impl( @@ -164,7 +168,7 @@ LLIOPipe::EStatus LLHTTPPipe::process_impl( static LLTimer timer; timer.reset(); - std::string verb = context[CONTEXT_REQUEST]["verb"]; + std::string verb = context[CONTEXT_REQUEST][CONTEXT_VERB]; if(verb == HTTP_VERB_GET) { mNode.get(LLHTTPNode::ResponsePtr(mResponse), context); @@ -185,6 +189,10 @@ LLIOPipe::EStatus LLHTTPPipe::process_impl( { mNode.del(LLHTTPNode::ResponsePtr(mResponse), context); } + else if(verb == HTTP_VERB_OPTIONS) + { + mNode.options(LLHTTPNode::ResponsePtr(mResponse), context); + } else { mResponse->methodNotAllowed(); @@ -231,7 +239,9 @@ LLIOPipe::EStatus LLHTTPPipe::process_impl( case STATE_GOOD_RESULT: { - context[CONTEXT_RESPONSE]["contentType"] = "application/xml"; + LLSD headers = mHeaders; + headers["Content-Type"] = "application/xml"; + context[CONTEXT_RESPONSE][CONTEXT_HEADERS] = headers; LLBufferStream ostr(channels, buffer.get()); LLSDSerialize::toXML(mGoodResult, ostr); @@ -240,7 +250,9 @@ LLIOPipe::EStatus LLHTTPPipe::process_impl( case STATE_STATUS_RESULT: { - context[CONTEXT_RESPONSE]["contentType"] = "text/plain"; + LLSD headers = mHeaders; + headers["Content-Type"] = "text/plain"; + context[CONTEXT_RESPONSE][CONTEXT_HEADERS] = headers; context[CONTEXT_RESPONSE]["statusCode"] = mStatusCode; context[CONTEXT_RESPONSE]["statusMessage"] = mStatusMessage; LLBufferStream ostr(channels, buffer.get()); @@ -287,6 +299,7 @@ void LLHTTPPipe::Response::result(const LLSD& r) mPipe->mStatusMessage = "OK"; mPipe->mGoodResult = r; mPipe->mState = STATE_GOOD_RESULT; + mPipe->mHeaders = mHeaders; mPipe->unlockChain(); } @@ -302,6 +315,7 @@ void LLHTTPPipe::Response::status(S32 code, const std::string& message) mPipe->mStatusCode = code; mPipe->mStatusMessage = message; mPipe->mState = STATE_STATUS_RESULT; + mPipe->mHeaders = mHeaders; mPipe->unlockChain(); } @@ -389,17 +403,24 @@ LLIOPipe::EStatus LLHTTPResponseHeader::process_impl( } ostr << HTTP_VERSION_STR << " " << code << " " << message << "\r\n"; - - std::string type = context[CONTEXT_RESPONSE]["contentType"].asString(); - if (!type.empty()) - { - ostr << "Content-Type: " << type << "\r\n"; - } S32 content_length = buffer->countAfter(channels.in(), NULL); if(0 < content_length) { ostr << "Content-Length: " << content_length << "\r\n"; } + // *NOTE: This guard can go away once the LLSD static map + // iterator is available. Phoenix. 2008-05-09 + LLSD headers = context[CONTEXT_RESPONSE][CONTEXT_HEADERS]; + if(headers.isDefined()) + { + LLSD::map_iterator iter = headers.beginMap(); + LLSD::map_iterator end = headers.endMap(); + for(; iter != end; ++iter) + { + ostr << (*iter).first << ": " << (*iter).second.asString() + << "\r\n"; + } + } ostr << "\r\n"; LLChangeChannel change(channels.in(), channels.out()); @@ -606,11 +627,12 @@ LLIOPipe::EStatus LLHTTPResponder::process_impl( read_next_line = true; LLMemoryStream header((U8*)buf, len); header >> mVerb; - + if((HTTP_VERB_GET == mVerb) || (HTTP_VERB_POST == mVerb) || (HTTP_VERB_PUT == mVerb) - || (HTTP_VERB_DELETE == mVerb)) + || (HTTP_VERB_DELETE == mVerb) + || (HTTP_VERB_OPTIONS == mVerb)) { header >> mAbsPathAndQuery; header >> mVersion; @@ -685,7 +707,7 @@ LLIOPipe::EStatus LLHTTPResponder::process_impl( read_next_line = true; std::string name(buf, pos_colon - buf); std::string value(pos_colon + 2); - LLString::toLower(name); + LLStringUtil::toLower(name); if("content-length" == name) { lldebugs << "Content-Length: " << value << llendl; @@ -693,7 +715,7 @@ LLIOPipe::EStatus LLHTTPResponder::process_impl( } else { - LLString::trimTail(value); + LLStringUtil::trimTail(value); mHeaders[name] = value; } } @@ -721,7 +743,7 @@ LLIOPipe::EStatus LLHTTPResponder::process_impl( { // hey, hey, we should have everything now, so we pass it to // a content handler. - context[CONTEXT_REQUEST]["verb"] = mVerb; + context[CONTEXT_REQUEST][CONTEXT_VERB] = mVerb; const LLHTTPNode* node = mRootNode.traverse(mPath, context); if(node) { @@ -765,7 +787,7 @@ LLIOPipe::EStatus LLHTTPResponder::process_impl( = mBuildContext["remote-host"]; context[CONTEXT_REQUEST]["remote-port"] = mBuildContext["remote-port"]; - context[CONTEXT_REQUEST]["headers"] = mHeaders; + context[CONTEXT_REQUEST][CONTEXT_HEADERS] = mHeaders; const LLChainIOFactory* protocolHandler = node->getProtocolHandler(); diff --git a/linden/indra/llmessage/lliopipe.cpp b/linden/indra/llmessage/lliopipe.cpp index 3b52fae..1e40940 100644 --- a/linden/indra/llmessage/lliopipe.cpp +++ b/linden/indra/llmessage/lliopipe.cpp @@ -55,6 +55,7 @@ static const std::string STATUS_ERROR_NAMES[LLIOPipe::STATUS_ERROR_COUNT] = std::string("STATUS_EXPIRED"), }; +#ifdef LL_DEBUG_PUMPS // Debugging schmutz for deadlock const char *gPumpFile = ""; S32 gPumpLine = 0; @@ -64,6 +65,7 @@ void pump_debug(const char *file, S32 line) gPumpFile = file; gPumpLine = line; } +#endif /* LL_DEBUG_PUMPS */ /** * LLIOPipe diff --git a/linden/indra/llmessage/lliopipe.h b/linden/indra/llmessage/lliopipe.h index 97c6246..a451dd7 100644 --- a/linden/indra/llmessage/lliopipe.h +++ b/linden/indra/llmessage/lliopipe.h @@ -36,7 +36,7 @@ #include #include -#include "apr-1/apr_poll.h" +#include "apr_poll.h" #include "llsd.h" @@ -46,11 +46,14 @@ class LLBufferArray; class LLChannelDescriptors; // Debugging schmutz for deadlocks -#define LL_DEBUG_PUMPS +//#define LL_DEBUG_PUMPS #ifdef LL_DEBUG_PUMPS void pump_debug(const char *file, S32 line); #define PUMP_DEBUG pump_debug(__FILE__, __LINE__); #define END_PUMP_DEBUG pump_debug("none", 0); +#else /* LL_DEBUG_PUMPS */ +#define PUMP_DEBUG +#define END_PUMP_DEBUG #endif diff --git a/linden/indra/llmessage/lliosocket.cpp b/linden/indra/llmessage/lliosocket.cpp index 26fd0b2..dec83b0 100644 --- a/linden/indra/llmessage/lliosocket.cpp +++ b/linden/indra/llmessage/lliosocket.cpp @@ -68,7 +68,7 @@ bool is_addr_in_use(apr_status_t status) // Define this to see the actual file descriptors being tossed around. //#define LL_DEBUG_SOCKET_FILE_DESCRIPTORS 1 #if LL_DEBUG_SOCKET_FILE_DESCRIPTORS -#include "apr-1/apr_portable.h" +#include "apr_portable.h" #endif #endif @@ -220,11 +220,11 @@ bool LLSocket::blockingConnect(const LLHost& host) { if(!mSocket) return false; apr_sockaddr_t* sa = NULL; - char ip_address[MAXADDRSTR]; /*Flawfinder: ignore*/ - host.getIPString(ip_address, MAXADDRSTR); + std::string ip_address; + ip_address = host.getIPString(); if(ll_apr_warn_status(apr_sockaddr_info_get( &sa, - ip_address, + ip_address.c_str(), APR_UNSPEC, host.getPort(), 0, diff --git a/linden/indra/llmessage/lliosocket.h b/linden/indra/llmessage/lliosocket.h index f0b788e..5b6c11f 100644 --- a/linden/indra/llmessage/lliosocket.h +++ b/linden/indra/llmessage/lliosocket.h @@ -43,8 +43,8 @@ */ #include "lliopipe.h" -#include "apr-1/apr_pools.h" -#include "apr-1/apr_network_io.h" +#include "apr_pools.h" +#include "apr_network_io.h" #include "llchainio.h" class LLHost; diff --git a/linden/indra/llmessage/llmail.cpp b/linden/indra/llmessage/llmail.cpp index 659803a..8ae7206 100644 --- a/linden/indra/llmessage/llmail.cpp +++ b/linden/indra/llmessage/llmail.cpp @@ -42,10 +42,9 @@ #include #include -#include -#include "apr-1/apr_pools.h" -#include "apr-1/apr_network_io.h" +#include "apr_pools.h" +#include "apr_network_io.h" #include "llapr.h" #include "llbase32.h" // IM-to-email address @@ -66,8 +65,6 @@ static apr_pool_t* gMailPool; static apr_sockaddr_t* gSockAddr; static apr_socket_t* gMailSocket; -// According to RFC2822 -static const boost::regex valid_subject_chars("[\\x1-\\x9\\xb\\xc\\xe-\\x7f]*"); bool connect_smtp(); void disconnect_smtp(); @@ -173,6 +170,22 @@ void LLMail::enable(bool mail_enabled) gMailEnabled = mail_enabled; } +// Test a subject line for RFC2822 compliance. +static bool valid_subject_chars(const char *subject) +{ + for (; *subject != '\0'; subject++) + { + unsigned char c = *subject; + + if (c == '\xa' || c == '\xd' || c > '\x7f') + { + return false; + } + } + + return true; +} + // static std::string LLMail::buildSMTPTransaction( const char* from_name, @@ -187,7 +200,7 @@ std::string LLMail::buildSMTPTransaction( << " from address." << llendl; return std::string(); } - if(! boost::regex_match(subject, valid_subject_chars)) + if(!valid_subject_chars(subject)) { llinfos << "send_mail build_smtp_transaction reject: bad subject header: " << "to=<" << to_address @@ -352,7 +365,7 @@ std::string LLMail::encryptIMEmailAddress(const LLUUID& from_agent_id, std::string address = LLBase32::encode(encrypted, encrypted_size); // Make it more pretty for humans. - LLString::toLower(address); + LLStringUtil::toLower(address); delete [] encrypted; diff --git a/linden/indra/llmessage/llmessage.vcproj b/linden/indra/llmessage/llmessage.vcproj deleted file mode 100644 index b011c24..0000000 --- a/linden/indra/llmessage/llmessage.vcproj +++ /dev/null @@ -1,675 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/linden/indra/llmessage/llmessage_vc8.vcproj b/linden/indra/llmessage/llmessage_vc8.vcproj deleted file mode 100644 index 96f81f7..0000000 --- a/linden/indra/llmessage/llmessage_vc8.vcproj +++ /dev/null @@ -1,921 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/linden/indra/llmessage/llmessage_vc9.vcproj b/linden/indra/llmessage/llmessage_vc9.vcproj deleted file mode 100644 index e9f4889..0000000 --- a/linden/indra/llmessage/llmessage_vc9.vcproj +++ /dev/null @@ -1,922 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/linden/indra/llmessage/llmessageconfig.cpp b/linden/indra/llmessage/llmessageconfig.cpp index e23ed07..498cfff 100644 --- a/linden/indra/llmessage/llmessageconfig.cpp +++ b/linden/indra/llmessage/llmessageconfig.cpp @@ -52,13 +52,14 @@ static LLSD sMessages; class LLMessageConfigFile : public LLLiveFile { public: - LLMessageConfigFile() - : LLLiveFile(filename(), messageConfigRefreshRate) + LLMessageConfigFile() : + LLLiveFile(filename(), messageConfigRefreshRate), + mMaxQueuedEvents(0) { } - static std::string filename(); + static std::string filename(); - LLSD mMessages; + LLSD mMessages; std::string mServerDefault; static LLMessageConfigFile& instance(); @@ -66,7 +67,7 @@ public: /* virtual */ void loadFile(); void loadServerDefaults(const LLSD& data); - void loadMaxQueuedEvents(const LLSD& data); + void loadMaxQueuedEvents(const LLSD& data); void loadMessages(const LLSD& data); void loadCapBans(const LLSD& blacklist); void loadMessageBans(const LLSD& blacklist); @@ -74,7 +75,10 @@ public: public: LLSD mCapBans; - S32 mMaxQueuedEvents; + S32 mMaxQueuedEvents; + +private: + static const S32 DEFAULT_MAX_QUEUED_EVENTS = 100; }; std::string LLMessageConfigFile::filename() @@ -97,7 +101,7 @@ void LLMessageConfigFile::loadFile() { LLSD data; { - llifstream file(filename().c_str()); + llifstream file(filename()); if (file.is_open()) { @@ -125,7 +129,6 @@ void LLMessageConfigFile::loadServerDefaults(const LLSD& data) mServerDefault = data["serverDefaults"][sServerName].asString(); } -const S32 DEFAULT_MAX_QUEUED_EVENTS = 100; void LLMessageConfigFile::loadMaxQueuedEvents(const LLSD& data) { if (data.has("maxQueuedEvents")) diff --git a/linden/indra/llmessage/llmessagereader.h b/linden/indra/llmessage/llmessagereader.h index 1e74da9..9fae682 100644 --- a/linden/indra/llmessage/llmessagereader.h +++ b/linden/indra/llmessage/llmessagereader.h @@ -69,6 +69,7 @@ class LLMessageReader virtual void getIPAddr(const char *block, const char *var, U32 &ip, S32 blocknum = 0) = 0; virtual void getIPPort(const char *block, const char *var, U16 &port, S32 blocknum = 0) = 0; virtual void getString(const char *block, const char *var, S32 buffer_size, char *buffer, S32 blocknum = 0) = 0; + virtual void getString(const char *block, const char *var, std::string& outstr, S32 blocknum = 0) = 0; virtual S32 getNumberOfBlocks(const char *blockname) = 0; virtual S32 getSize(const char *blockname, const char *varname) = 0; diff --git a/linden/indra/llmessage/llmessagetemplateparser.cpp b/linden/indra/llmessage/llmessagetemplateparser.cpp index 969a0d9..d6adba8 100644 --- a/linden/indra/llmessage/llmessagetemplateparser.cpp +++ b/linden/indra/llmessage/llmessagetemplateparser.cpp @@ -161,7 +161,7 @@ S32 get_checker_number(char checker) } // check token based on passed simplified regular expression -BOOL b_check_token(const char *token, char *regexp) +BOOL b_check_token(const char *token, const char *regexp) { S32 tptr, rptr = 0; S32 current_checker, next_checker = 0; diff --git a/linden/indra/llmessage/llmessagethrottle.cpp b/linden/indra/llmessage/llmessagethrottle.cpp index 84733ba..ad9df26 100644 --- a/linden/indra/llmessage/llmessagethrottle.cpp +++ b/linden/indra/llmessage/llmessagethrottle.cpp @@ -110,7 +110,7 @@ void LLMessageThrottle::pruneEntries() } } -BOOL LLMessageThrottle::addViewerAlert(const LLUUID& to, const char* mesg) +BOOL LLMessageThrottle::addViewerAlert(const LLUUID& to, const std::string& mesg) { message_list_t* message_list = &(mMessageList[MTC_VIEWER_ALERT]); @@ -144,7 +144,7 @@ BOOL LLMessageThrottle::addViewerAlert(const LLUUID& to, const char* mesg) } } -BOOL LLMessageThrottle::addAgentAlert(const LLUUID& agent, const LLUUID& task, const char* mesg) +BOOL LLMessageThrottle::addAgentAlert(const LLUUID& agent, const LLUUID& task, const std::string& mesg) { message_list_t* message_list = &(mMessageList[MTC_AGENT_ALERT]); diff --git a/linden/indra/llmessage/llmessagethrottle.h b/linden/indra/llmessage/llmessagethrottle.h index 8be08b3..2f27f13 100644 --- a/linden/indra/llmessage/llmessagethrottle.h +++ b/linden/indra/llmessage/llmessagethrottle.h @@ -64,8 +64,8 @@ public: LLMessageThrottle(); ~LLMessageThrottle(); - BOOL addViewerAlert (const LLUUID& to, const char* mesg); - BOOL addAgentAlert (const LLUUID& agent, const LLUUID& task, const char* mesg); + BOOL addViewerAlert (const LLUUID& to, const std::string& mesg); + BOOL addAgentAlert (const LLUUID& agent, const LLUUID& task, const std::string& mesg); void pruneEntries(); diff --git a/linden/indra/llmessage/llmime.cpp b/linden/indra/llmessage/llmime.cpp index 48e73fb..2093255 100644 --- a/linden/indra/llmessage/llmime.cpp +++ b/linden/indra/llmessage/llmime.cpp @@ -439,9 +439,7 @@ bool LLMimeParser::Impl::parseHeaders( std::string value(colon); for(S32 ii = 0; ii < KNOWN_HEADER_COUNT; ++ii) { - if(0 == LLString::compareInsensitive( - name.c_str(), - KNOWN_HEADER[ii].c_str())) + if(0 == LLStringUtil::compareInsensitive(name, KNOWN_HEADER[ii])) { name = KNOWN_HEADER[ii]; break; @@ -525,7 +523,7 @@ void LLMimeParser::Impl::scanPastSeparator( { mContinue = false; } - if(0 == LLString::compareStrings(mBuffer, separator.c_str())) + if(0 == LLStringUtil::compareStrings(std::string(mBuffer), separator)) { found_separator = true; } diff --git a/linden/indra/llmessage/llnamevalue.cpp b/linden/indra/llmessage/llnamevalue.cpp index 18bd5ac..c44f6ce 100644 --- a/linden/indra/llmessage/llnamevalue.cpp +++ b/linden/indra/llmessage/llnamevalue.cpp @@ -155,7 +155,7 @@ void LLNameValue::init(const char *name, const char *data, const char *type, con else if (!strcmp(mStringType, "U64")) { mType = NVT_U64; - mNameValueReference.u64 = new U64(str_to_U64(data)); + mNameValueReference.u64 = new U64(str_to_U64(ll_safe_string(data))); } else if (!strcmp(mStringType, "VEC3")) { diff --git a/linden/indra/llmessage/llpumpio.cpp b/linden/indra/llmessage/llpumpio.cpp index f60ee2b..c92612f 100644 --- a/linden/indra/llmessage/llpumpio.cpp +++ b/linden/indra/llmessage/llpumpio.cpp @@ -36,7 +36,7 @@ #include #include -#include "apr-1/apr_poll.h" +#include "apr_poll.h" #include "llapr.h" #include "llmemtype.h" @@ -49,7 +49,7 @@ //#define LL_DEBUG_PIPE_TYPE_IN_PUMP 1 //#define LL_DEBUG_POLL_FILE_DESCRIPTORS 1 #if LL_DEBUG_POLL_FILE_DESCRIPTORS -#include "apr-1/apr_portable.h" +#include "apr_portable.h" #endif #endif @@ -261,7 +261,7 @@ bool LLPumpIO::addChain( bool LLPumpIO::setTimeoutSeconds(F32 timeout) { // If no chain is running, return failure. - if(current_chain_t() == mCurrentChain) + if(mRunningChains.end() == mCurrentChain) { return false; } @@ -365,7 +365,7 @@ S32 LLPumpIO::setLock() // lock the runner at the same time. // If no chain is running, return failure. - if(current_chain_t() == mCurrentChain) + if(mRunningChains.end() == mCurrentChain) { return 0; } @@ -414,7 +414,7 @@ bool LLPumpIO::sleepChain(F64 seconds) bool LLPumpIO::copyCurrentLinkInfo(links_t& links) const { LLMemType m1(LLMemType::MTYPE_IO_PUMP); - if(current_chain_t() == mCurrentChain) + if(mRunningChains.end() == mCurrentChain) { return false; } @@ -584,6 +584,7 @@ void LLPumpIO::pump(const S32& poll_timeout) } PUMP_DEBUG; mCurrentChain = run_chain; + if((*run_chain).mDescriptors.empty()) { // if there are no conditionals, just process this chain. @@ -702,7 +703,7 @@ void LLPumpIO::pump(const S32& poll_timeout) PUMP_DEBUG; // null out the chain - mCurrentChain = current_chain_t(); + mCurrentChain = mRunningChains.end(); END_PUMP_DEBUG; } diff --git a/linden/indra/llmessage/llpumpio.h b/linden/indra/llmessage/llpumpio.h index 68db329..d2392a3 100644 --- a/linden/indra/llmessage/llpumpio.h +++ b/linden/indra/llmessage/llpumpio.h @@ -39,7 +39,7 @@ #include #endif -#include "apr-1/apr_pools.h" +#include "apr_pools.h" #include "llbuffer.h" #include "llframetimer.h" #include "lliopipe.h" diff --git a/linden/indra/llmessage/llregionflags.h b/linden/indra/llmessage/llregionflags.h index 1675478..af010ae 100644 --- a/linden/indra/llmessage/llregionflags.h +++ b/linden/indra/llmessage/llregionflags.h @@ -94,8 +94,8 @@ const U32 REGION_FLAGS_ABUSE_EMAIL_TO_ESTATE_OWNER = (1 << 27); const U32 REGION_FLAGS_ALLOW_VOICE = (1 << 28); const U32 REGION_FLAGS_BLOCK_PARCEL_SEARCH = (1 << 29); -const U32 REGION_FLAGS_DENY_AGEUNVERIFIED = (1 << 30); - +const U32 REGION_FLAGS_DENY_AGEUNVERIFIED = (1 << 30); +const U32 REGION_FLAGS_SKIP_MONO_SCRIPTS = (1 << 31); const U32 REGION_FLAGS_DEFAULT = REGION_FLAGS_ALLOW_LANDMARK | REGION_FLAGS_ALLOW_SET_HOME | diff --git a/linden/indra/llmessage/llsdmessagereader.cpp b/linden/indra/llmessage/llsdmessagereader.cpp index 70cc455..1f0effa 100755 --- a/linden/indra/llmessage/llsdmessagereader.cpp +++ b/linden/indra/llmessage/llsdmessagereader.cpp @@ -37,7 +37,15 @@ #include "llsdmessagebuilder.h" #include "llsdutil.h" -LLSDMessageReader::LLSDMessageReader() +#include "v3math.h" +#include "v4math.h" +#include "v3dmath.h" +#include "v2math.h" +#include "llquaternion.h" +#include "v4color.h" + +LLSDMessageReader::LLSDMessageReader() : + mMessageName(NULL) { } @@ -63,14 +71,20 @@ LLSD getLLSD(const LLSD& input, const char* block, const char* var, S32 blocknum } if(! input[block].isArray()) { - llerrs << "block " << block << " not found" << llendl; + // NOTE: babbage: need to return default for missing blocks to allow + // backwards/forwards compatibility - handlers must cope with default + // values. + llwarns << "block " << block << " not found" << llendl; return LLSD(); } LLSD result = input[block][blocknum][var]; if(result.isUndefined()) { - llerrs << "var " << var << " not found" << llendl; + // NOTE: babbage: need to return default for missing vars to allow + // backwards/forwards compatibility - handlers must cope with default + // values. + llwarns << "var " << var << " not found" << llendl; } return result; } @@ -235,6 +249,12 @@ void LLSDMessageReader::getString(const char *block, const char *var, buffer[data_size] = '\0'; } +//virtual +void LLSDMessageReader::getString(const char *block, const char *var, + std::string& outstr, S32 blocknum) +{ + outstr = getLLSD(mMessage, block, var, blocknum).asString(); +} //virtual S32 LLSDMessageReader::getNumberOfBlocks(const char *blockname) diff --git a/linden/indra/llmessage/llsdmessagereader.h b/linden/indra/llmessage/llsdmessagereader.h index 698f751..9afa4a2 100755 --- a/linden/indra/llmessage/llsdmessagereader.h +++ b/linden/indra/llmessage/llsdmessagereader.h @@ -87,6 +87,8 @@ public: S32 blocknum = 0); virtual void getString(const char *block, const char *var, S32 buffer_size, char *buffer, S32 blocknum = 0); + virtual void getString(const char *block, const char *var, std::string& outstr, + S32 blocknum = 0); virtual S32 getNumberOfBlocks(const char *blockname); virtual S32 getSize(const char *blockname, const char *varname); diff --git a/linden/indra/llmessage/llservicebuilder.cpp b/linden/indra/llmessage/llservicebuilder.cpp index 138ab2d..96f49ab 100644 --- a/linden/indra/llmessage/llservicebuilder.cpp +++ b/linden/indra/llmessage/llservicebuilder.cpp @@ -39,7 +39,7 @@ void LLServiceBuilder::loadServiceDefinitionsFromFile( const std::string& service_filename) { - llifstream service_file(service_filename.c_str(), std::ios::binary); + llifstream service_file(service_filename, std::ios::binary); if(service_file.is_open()) { LLSD service_data; @@ -111,10 +111,13 @@ std::string LLServiceBuilder::buildServiceURI( const std::string& service_name, const LLSD& option_map) { - std::string service_url = buildServiceURI(service_name); - - // Find the Service Name - if(!service_url.empty() && option_map.isMap()) + return russ_format(buildServiceURI(service_name), option_map); +} + +std::string russ_format(const std::string& format_str, const LLSD& context) +{ + std::string service_url(format_str); + if(!service_url.empty() && context.isMap()) { // throw in a ridiculously large limiter to make sure we don't // loop forever with bad input. @@ -134,9 +137,9 @@ std::string LLServiceBuilder::buildServiceURI( std::string::iterator end(service_url.end()); std::string::iterator deepest_node(service_url.end()); std::string::iterator deepest_node_end(service_url.end()); - //parse out the variables to replace by going through {}s one at a time, - // starting with the "deepest" in series {{}}, - // and otherwise replacing right-to-left + // parse out the variables to replace by going through {}s + // one at a time, starting with the "deepest" in series + // {{}}, and otherwise replacing right-to-left for(; iter != end; ++iter) { switch(*iter) @@ -171,7 +174,7 @@ std::string LLServiceBuilder::buildServiceURI( // params and straight string substitution, so it's a // known distance of 2 to skip the directive. std::string key(deepest_node + 2, deepest_node_end); - LLSD value = option_map[key]; + LLSD value = context[key]; switch(*(deepest_node + 1)) { case '$': @@ -184,7 +187,9 @@ std::string LLServiceBuilder::buildServiceURI( } else { - llwarns << "Unknown key: " << key << " in option map: " << LLSDOStreamer(option_map) << llendl; + llwarns << "Unknown key: " << key << " in option map: " + << LLSDOStreamer(context) + << llendl; keep_looping = false; } break; @@ -212,50 +217,3 @@ std::string LLServiceBuilder::buildServiceURI( } return service_url; } - - - -// Old, not as good implementation. Phoenix 2007-10-15 -#if 0 - // Do brace replacements - NOT CURRENTLY RECURSIVE - for(LLSD::map_const_iterator option_itr = option_map.beginMap(); - option_itr != option_map.endMap(); - ++option_itr) - { - std::string variable_name = "{$"; - variable_name.append((*option_itr).first); - variable_name.append("}"); - std::string::size_type find_pos = service_url.find(variable_name); - if(find_pos != std::string::npos) - { - service_url.replace( - find_pos, - variable_name.length(), - (*option_itr).second.asString()); - continue; - } - variable_name.assign("{%"); - variable_name.append((*option_itr).first); - variable_name.append("}"); - find_pos = service_url.find(variable_name); - if(find_pos != std::string::npos) - { - std::string query_str = LLURI::mapToQueryString( - (*option_itr).second); - service_url.replace( - find_pos, - variable_name.length(), - query_str); - } - } - } - - if (service_url.find('{') != std::string::npos) - { - llwarns << "Constructed a likely bogus service URL: " << service_url - << llendl; - } - - return service_url; -} -#endif diff --git a/linden/indra/llmessage/llservicebuilder.h b/linden/indra/llmessage/llservicebuilder.h index f19ba9a..ce95488 100644 --- a/linden/indra/llmessage/llservicebuilder.h +++ b/linden/indra/llmessage/llservicebuilder.h @@ -38,11 +38,24 @@ class LLSD; +/** + * @brief Format format string according to rules for RUSS. + * + * This function appears alongside the service builder since the + * algorithm was originally implemented there. This can eventually be + * moved when someone wants to take the time. + * @see https://osiris.lindenlab.com/mediawiki/index.php/Recursive_URL_Substitution_Syntax + * @param format_str The input string to format. + * @param context A map used for string substitutions. + * @return Returns the formatted string. If no match is found for a + * substitution target, the braces remain intact. + */ +std::string russ_format(const std::string& format_str, const LLSD& context); + /** * @class LLServiceBuilder * @brief This class builds urls for us to use when making web service calls. */ - class LLServiceBuilder { LOG_CLASS(LLServiceBuilder); diff --git a/linden/indra/llmessage/lltemplatemessagereader.cpp b/linden/indra/llmessage/lltemplatemessagereader.cpp index 0d81383..f5da14b 100644 --- a/linden/indra/llmessage/lltemplatemessagereader.cpp +++ b/linden/indra/llmessage/lltemplatemessagereader.cpp @@ -171,9 +171,6 @@ S32 LLTemplateMessageReader::getNumberOfBlocks(const char *blockname) if (iter == mCurrentRMessageData->mMemberBlocks.end()) { -// sprintf(errmsg, "Block %s not in message %s", bnamep, mCurrentRMessageData->mName); -// llerrs << errmsg << llendl; -// return -1; return 0; } @@ -433,6 +430,15 @@ inline void LLTemplateMessageReader::getString(const char *block, const char *va s[buffer_size - 1] = '\0'; } +inline void LLTemplateMessageReader::getString(const char *block, const char *var, std::string& outstr, S32 blocknum ) +{ + char s[MTUBYTES]; + s[0] = '\0'; + getData(block, var, s, 0, blocknum, MTUBYTES); + s[MTUBYTES - 1] = '\0'; + outstr = s; +} + //virtual S32 LLTemplateMessageReader::getMessageSize() const { @@ -568,7 +574,9 @@ BOOL LLTemplateMessageReader::decodeData(const U8* buffer, const LLHost& sender // repeat number is a single byte if (decode_pos >= mReceiveSize) { - logRanOffEndOfPacket(sender, decode_pos, 1); + // commented out - hetgrid says that missing variable blocks + // at end of message are legal + // logRanOffEndOfPacket(sender, decode_pos, 1); // default to 0 repeats repeat_number = 0; diff --git a/linden/indra/llmessage/lltemplatemessagereader.h b/linden/indra/llmessage/lltemplatemessagereader.h index 1448c2d..98f41ae 100644 --- a/linden/indra/llmessage/lltemplatemessagereader.h +++ b/linden/indra/llmessage/lltemplatemessagereader.h @@ -88,6 +88,8 @@ public: S32 blocknum = 0); virtual void getString(const char *block, const char *var, S32 buffer_size, char *buffer, S32 blocknum = 0); + virtual void getString(const char *block, const char *var, std::string& outstr, + S32 blocknum = 0); virtual S32 getNumberOfBlocks(const char *blockname); virtual S32 getSize(const char *blockname, const char *varname); diff --git a/linden/indra/llmessage/lltransfersourcefile.cpp b/linden/indra/llmessage/lltransfersourcefile.cpp index 4b60cf3..a372f66 100644 --- a/linden/indra/llmessage/lltransfersourcefile.cpp +++ b/linden/indra/llmessage/lltransfersourcefile.cpp @@ -67,7 +67,7 @@ void LLTransferSourceFile::initTransfer() return; } // Look for the file. - mFP = LLFile::fopen(mParams.getFilename().c_str(), "rb"); /* Flawfinder: ignore */ + mFP = LLFile::fopen(mParams.getFilename(), "rb"); /* Flawfinder: ignore */ if (!mFP) { sendTransferStatus(LLTS_ERROR); @@ -134,9 +134,9 @@ void LLTransferSourceFile::completionCallback(const LLTSCode status) } // Delete the file iff the filename begins with "TEMP" - if (mParams.getDeleteOnCompletion() && memcmp(mParams.getFilename().c_str(), "TEMP", 4) == 0) + if (mParams.getDeleteOnCompletion() && mParams.getFilename().substr(0, 4) == "TEMP") { - LLFile::remove(mParams.getFilename().c_str()); + LLFile::remove(mParams.getFilename()); } } @@ -162,7 +162,7 @@ LLTransferSourceParamsFile::LLTransferSourceParamsFile() : void LLTransferSourceParamsFile::packParams(LLDataPacker &dp) const { - dp.packString(mFilename.c_str(), "Filename"); + dp.packString(mFilename, "Filename"); dp.packU8((U8)mDeleteOnCompletion, "Delete"); } diff --git a/linden/indra/llmessage/lltransfersourcefile.h b/linden/indra/llmessage/lltransfersourcefile.h index 030f80e..3137e1c 100644 --- a/linden/indra/llmessage/lltransfersourcefile.h +++ b/linden/indra/llmessage/lltransfersourcefile.h @@ -42,7 +42,7 @@ public: /*virtual*/ void packParams(LLDataPacker &dp) const; /*virtual*/ BOOL unpackParams(LLDataPacker &dp); - void setFilename(const LLString &filename) { mFilename = filename; } + void setFilename(const std::string &filename) { mFilename = filename; } std::string getFilename() const { return mFilename; } void setDeleteOnCompletion(BOOL enabled) { mDeleteOnCompletion = enabled; } diff --git a/linden/indra/llmessage/lltransfertargetfile.cpp b/linden/indra/llmessage/lltransfertargetfile.cpp index f1f602d..2723cb7 100644 --- a/linden/indra/llmessage/lltransfertargetfile.cpp +++ b/linden/indra/llmessage/lltransfertargetfile.cpp @@ -80,7 +80,7 @@ LLTSCode LLTransferTargetFile::dataCallback(const S32 packet_id, U8 *in_datap, c if (!mFP) { - mFP = LLFile::fopen(mParams.mFilename.c_str(), "wb"); /* Flawfinder: ignore */ + mFP = LLFile::fopen(mParams.mFilename, "wb"); /* Flawfinder: ignore */ if (!mFP) { @@ -122,7 +122,7 @@ void LLTransferTargetFile::completionCallback(const LLTSCode status) if (mFP) { // Only need to remove file if we successfully opened it. - LLFile::remove(mParams.mFilename.c_str()); + LLFile::remove(mParams.mFilename); } default: break; diff --git a/linden/indra/llmessage/lltransfertargetfile.h b/linden/indra/llmessage/lltransfertargetfile.h index 02c0c11..4d92ec1 100644 --- a/linden/indra/llmessage/lltransfertargetfile.h +++ b/linden/indra/llmessage/lltransfertargetfile.h @@ -40,12 +40,12 @@ class LLTransferTargetParamsFile : public LLTransferTargetParams { public: LLTransferTargetParamsFile() : LLTransferTargetParams(LLTTT_FILE) {} - void setFilename(const LLString& filename) { mFilename = filename; } + void setFilename(const std::string& filename) { mFilename = filename; } void setCallback(LLTTFCompleteCallback cb, void *user_data) { mCompleteCallback = cb; mUserData = user_data; } friend class LLTransferTargetFile; protected: - LLString mFilename; + std::string mFilename; LLTTFCompleteCallback mCompleteCallback; void * mUserData; }; diff --git a/linden/indra/llmessage/llurlrequest.cpp b/linden/indra/llmessage/llurlrequest.cpp index 5760197..42f3f04 100644 --- a/linden/indra/llmessage/llurlrequest.cpp +++ b/linden/indra/llmessage/llurlrequest.cpp @@ -42,7 +42,7 @@ #include "llpumpio.h" #include "llsd.h" #include "llstring.h" -#include "apr-1/apr_env.h" +#include "apr_env.h" static const U32 HTTP_STATUS_PIPE_ERROR = 499; @@ -385,6 +385,13 @@ bool LLURLRequest::configure() rv = true; break; + case HTTP_MOVE: + // Set the handle for an http post + mDetail->mCurlRequest->setoptString(CURLOPT_CUSTOMREQUEST, "MOVE"); + // *NOTE: should we check for the Destination header? + rv = true; + break; + default: llwarns << "Unhandled URLRequest action: " << mAction << llendl; break; @@ -535,7 +542,7 @@ LLIOPipe::EStatus LLContextURLExtractor::process_impl( // find the context url if(context.has(CONTEXT_DEST_URI_SD_LABEL)) { - mRequest->setURL(context[CONTEXT_DEST_URI_SD_LABEL]); + mRequest->setURL(context[CONTEXT_DEST_URI_SD_LABEL].asString()); return STATUS_DONE; } return STATUS_ERROR; diff --git a/linden/indra/llmessage/llurlrequest.h b/linden/indra/llmessage/llurlrequest.h index b6da56b..888b962 100644 --- a/linden/indra/llmessage/llurlrequest.h +++ b/linden/indra/llmessage/llurlrequest.h @@ -76,6 +76,7 @@ public: HTTP_PUT, HTTP_POST, HTTP_DELETE, + HTTP_MOVE, // Caller will need to set 'Destination' header REQUEST_ACTION_COUNT }; diff --git a/linden/indra/llmessage/llxfer.cpp b/linden/indra/llmessage/llxfer.cpp index 5430213..ab7b1ee 100644 --- a/linden/indra/llmessage/llxfer.cpp +++ b/linden/indra/llmessage/llxfer.cpp @@ -103,7 +103,7 @@ void LLXfer::free () S32 LLXfer::startSend (U64 xfer_id, const LLHost &remote_host) { - llwarns << "undifferentiated LLXfer::startSend for " << getName() << llendl; + llwarns << "undifferentiated LLXfer::startSend for " << getFileName() << llendl; return (-1); } @@ -119,7 +119,7 @@ void LLXfer::setXferSize (S32 xfer_size) S32 LLXfer::startDownload() { - llwarns << "undifferentiated LLXfer::startDownload for " << getName() + llwarns << "undifferentiated LLXfer::startDownload for " << getFileName() << llendl; return (-1); } @@ -293,13 +293,13 @@ S32 LLXfer::processEOF() if (LL_ERR_NOERR == mCallbackResult) { - llinfos << "xfer from " << mRemoteHost << " complete: " << getName() + llinfos << "xfer from " << mRemoteHost << " complete: " << getFileName() << llendl; } else { llinfos << "xfer from " << mRemoteHost << " failed, code " - << mCallbackResult << ": " << getName() << llendl; + << mCallbackResult << ": " << getFileName() << llendl; } if (mCallback) @@ -327,7 +327,7 @@ void LLXfer::abort (S32 result_code) { mCallbackResult = result_code; - llinfos << "Aborting xfer from " << mRemoteHost << " named " << getName() + llinfos << "Aborting xfer from " << mRemoteHost << " named " << getFileName() << " - error: " << result_code << llendl; gMessageSystem->newMessageFast(_PREHASH_AbortXfer); @@ -343,11 +343,9 @@ void LLXfer::abort (S32 result_code) /////////////////////////////////////////////////////////// -const char * LLXfer::getName() +std::string LLXfer::getFileName() { - static char tmp_str[256]; /* Flawfinder: ignore */ - - return (U64_to_str(mID, tmp_str, sizeof(tmp_str))); + return U64_to_str(mID); } /////////////////////////////////////////////////////////// @@ -367,7 +365,7 @@ S32 LLXfer::getMaxBufferSize () std::ostream& operator<< (std::ostream& os, LLXfer &hh) { - os << hh.getName() ; + os << hh.getFileName() ; return os; } diff --git a/linden/indra/llmessage/llxfer.h b/linden/indra/llmessage/llxfer.h index 603b4d7..259f1ac 100644 --- a/linden/indra/llmessage/llxfer.h +++ b/linden/indra/llmessage/llxfer.h @@ -106,7 +106,7 @@ class LLXfer virtual void setXferSize (S32 data_size); virtual S32 getMaxBufferSize(); - virtual const char *getName(); + virtual std::string getFileName(); virtual U32 getXferTypeTag(); diff --git a/linden/indra/llmessage/llxfer_file.cpp b/linden/indra/llmessage/llxfer_file.cpp index 840d84c..da12d54 100644 --- a/linden/indra/llmessage/llxfer_file.cpp +++ b/linden/indra/llmessage/llxfer_file.cpp @@ -47,17 +47,17 @@ const U32 LL_MAX_XFER_FILE_BUFFER = 65536; // local function to copy a file -S32 copy_file(const char* from, const char* to); +S32 copy_file(const std::string& from, const std::string& to); /////////////////////////////////////////////////////////// LLXfer_File::LLXfer_File (S32 chunk_size) : LLXfer(chunk_size) { - init(LLString::null, FALSE, chunk_size); + init(LLStringUtil::null, FALSE, chunk_size); } -LLXfer_File::LLXfer_File (const LLString& local_filename, BOOL delete_local_on_completion, S32 chunk_size) +LLXfer_File::LLXfer_File (const std::string& local_filename, BOOL delete_local_on_completion, S32 chunk_size) : LLXfer(chunk_size) { init(local_filename, delete_local_on_completion, chunk_size); @@ -72,24 +72,24 @@ LLXfer_File::~LLXfer_File () /////////////////////////////////////////////////////////// -void LLXfer_File::init (const LLString& local_filename, BOOL delete_local_on_completion, S32 chunk_size) +void LLXfer_File::init (const std::string& local_filename, BOOL delete_local_on_completion, S32 chunk_size) { mFp = NULL; - mLocalFilename[0] = 0; - mRemoteFilename[0] = 0; + mLocalFilename.clear(); + mRemoteFilename.clear(); mRemotePath = LL_PATH_NONE; - mTempFilename[0] = 0; + mTempFilename.clear(); mDeleteLocalOnCompletion = FALSE; mDeleteRemoteOnCompletion = FALSE; if (!local_filename.empty()) { - strncpy(mLocalFilename, local_filename.c_str(), LL_MAX_PATH-1); - mLocalFilename[LL_MAX_PATH-1] = '\0'; // stupid strncpy. + mLocalFilename = local_filename.substr(0,LL_MAX_PATH-1); // You can only automatically delete .tmp file as a safeguard against nasty messages. - mDeleteLocalOnCompletion = (delete_local_on_completion && (strstr(mLocalFilename,".tmp") == &mLocalFilename[strlen(mLocalFilename)-4])); /* Flawfinder : ignore */ + std::string exten = mLocalFilename.substr(mLocalFilename.length()-4, 4); + mDeleteLocalOnCompletion = (delete_local_on_completion && exten == ".tmp"); } } @@ -121,8 +121,8 @@ void LLXfer_File::free () /////////////////////////////////////////////////////////// S32 LLXfer_File::initializeRequest(U64 xfer_id, - const LLString& local_filename, - const LLString& remote_filename, + const std::string& local_filename, + const std::string& remote_filename, ELLPath remote_path, const LLHost& remote_host, BOOL delete_remote_on_completion, @@ -132,15 +132,13 @@ S32 LLXfer_File::initializeRequest(U64 xfer_id, S32 retval = 0; // presume success mID = xfer_id; - strncpy(mLocalFilename, local_filename.c_str(), LL_MAX_PATH-1); - mLocalFilename[LL_MAX_PATH-1] = '\0'; // stupid strncpy. - strncpy(mRemoteFilename,remote_filename.c_str(), LL_MAX_PATH-1); - mRemoteFilename[LL_MAX_PATH-1] = '\0'; // stupid strncpy. + mLocalFilename = local_filename; + mRemoteFilename = remote_filename; mRemotePath = remote_path; mRemoteHost = remote_host; mDeleteRemoteOnCompletion = delete_remote_on_completion; - snprintf(mTempFilename, sizeof(mTempFilename), "%s",gDirUtilp->getTempFilename().c_str()); /* Flawfinder: ignore */ + mTempFilename = gDirUtilp->getTempFilename(); mCallback = callback; mCallbackDataHandle = user_data; @@ -343,7 +341,7 @@ S32 LLXfer_File::processEOF() if(copy_file(mTempFilename, mLocalFilename) == 0) { llinfos << "Rename across mounts; copying+unlinking the file instead." << llendl; - unlink(mTempFilename); + unlink(mTempFilename.c_str()); } else { @@ -384,14 +382,14 @@ S32 LLXfer_File::processEOF() /////////////////////////////////////////////////////////// -BOOL LLXfer_File::matchesLocalFilename(const LLString& filename) +BOOL LLXfer_File::matchesLocalFilename(const std::string& filename) { return (filename == mLocalFilename); } /////////////////////////////////////////////////////////// -BOOL LLXfer_File::matchesRemoteFilename(const LLString& filename, ELLPath remote_path) +BOOL LLXfer_File::matchesRemoteFilename(const std::string& filename, ELLPath remote_path) { return ((filename == mRemoteFilename) && (remote_path == mRemotePath)); } @@ -399,9 +397,9 @@ BOOL LLXfer_File::matchesRemoteFilename(const LLString& filename, ELLPath remote /////////////////////////////////////////////////////////// -const char * LLXfer_File::getName() +std::string LLXfer_File::getFileName() { - return (mLocalFilename); + return mLocalFilename; } /////////////////////////////////////////////////////////// @@ -421,7 +419,7 @@ U32 LLXfer_File::getXferTypeTag() // function. It does not really spam enough information, but is useful // for this cpp file, because this should never be called in a // production environment. -S32 copy_file(const char* from, const char* to) +S32 copy_file(const std::string& from, const std::string& to) { S32 rv = 0; LLFILE* in = LLFile::fopen(from, "rb"); /*Flawfinder: ignore*/ diff --git a/linden/indra/llmessage/llxfer_file.h b/linden/indra/llmessage/llxfer_file.h index b5294ad..78f77a8 100644 --- a/linden/indra/llmessage/llxfer_file.h +++ b/linden/indra/llmessage/llxfer_file.h @@ -39,25 +39,25 @@ class LLXfer_File : public LLXfer { protected: LLFILE *mFp; - char mLocalFilename[LL_MAX_PATH]; /* Flawfinder : ignore */ - char mRemoteFilename[LL_MAX_PATH]; /* Flawfinder : ignore */ + std::string mLocalFilename; + std::string mRemoteFilename; ELLPath mRemotePath; - char mTempFilename[LL_MAX_PATH]; /* Flawfinder : ignore */ + std::string mTempFilename; BOOL mDeleteLocalOnCompletion; BOOL mDeleteRemoteOnCompletion; public: LLXfer_File (S32 chunk_size); - LLXfer_File (const LLString& local_filename, BOOL delete_local_on_completion, S32 chunk_size); + LLXfer_File (const std::string& local_filename, BOOL delete_local_on_completion, S32 chunk_size); virtual ~LLXfer_File(); - virtual void init(const LLString& local_filename, BOOL delete_local_on_completion, S32 chunk_size); + virtual void init(const std::string& local_filename, BOOL delete_local_on_completion, S32 chunk_size); virtual void free(); virtual S32 initializeRequest(U64 xfer_id, - const LLString& local_filename, - const LLString& remote_filename, + const std::string& local_filename, + const std::string& remote_filename, ELLPath remote_path, const LLHost& remote_host, BOOL delete_remote_on_completion, @@ -72,14 +72,14 @@ class LLXfer_File : public LLXfer virtual S32 suck(S32 start_position); virtual S32 flush(); - virtual BOOL matchesLocalFilename(const LLString& filename); - virtual BOOL matchesRemoteFilename(const LLString& filename, ELLPath remote_path); + virtual BOOL matchesLocalFilename(const std::string& filename); + virtual BOOL matchesRemoteFilename(const std::string& filename, ELLPath remote_path); virtual S32 getMaxBufferSize(); virtual U32 getXferTypeTag(); - virtual const char *getName(); + virtual std::string getFileName(); }; #endif diff --git a/linden/indra/llmessage/llxfer_mem.cpp b/linden/indra/llmessage/llxfer_mem.cpp index 614f027..3404520 100644 --- a/linden/indra/llmessage/llxfer_mem.cpp +++ b/linden/indra/llmessage/llxfer_mem.cpp @@ -55,7 +55,7 @@ LLXfer_Mem::~LLXfer_Mem () void LLXfer_Mem::init () { - mRemoteFilename[0] = '\0'; + mRemoteFilename.clear(); mRemotePath = LL_PATH_NONE; mDeleteRemoteOnCompletion = FALSE; } @@ -120,7 +120,7 @@ S32 LLXfer_Mem::startSend (U64 xfer_id, const LLHost &remote_host) mID = xfer_id; mPacketNum = -1; -// cout << "Sending file: " << getName() << endl; +// cout << "Sending file: " << getFileName() << endl; mStatus = e_LL_XFER_PENDING; @@ -135,7 +135,7 @@ S32 LLXfer_Mem::processEOF() mStatus = e_LL_XFER_COMPLETE; - llinfos << "xfer complete: " << getName() << llendl; + llinfos << "xfer complete: " << getFileName() << llendl; if (mCallback) { @@ -165,8 +165,7 @@ S32 LLXfer_Mem::initializeRequest(U64 xfer_id, mCallbackDataHandle = user_data; mCallbackResult = LL_ERR_NOERR; - strncpy(mRemoteFilename, remote_filename.c_str(), LL_MAX_PATH-1); - mRemoteFilename[LL_MAX_PATH-1] = '\0'; // stupid strncpy. + mRemoteFilename = remote_filename; mRemotePath = remote_path; mDeleteRemoteOnCompletion = delete_remote_on_completion; diff --git a/linden/indra/llmessage/llxfer_mem.h b/linden/indra/llmessage/llxfer_mem.h index a3d6ca5..0e67a06 100644 --- a/linden/indra/llmessage/llxfer_mem.h +++ b/linden/indra/llmessage/llxfer_mem.h @@ -42,7 +42,7 @@ class LLXfer_Mem : public LLXfer private: protected: void (*mCallback)(void *, S32, void **, S32, LLExtStat); - char mRemoteFilename[LL_MAX_PATH]; /* Flawfinder : ignore */ + std::string mRemoteFilename; ELLPath mRemotePath; BOOL mDeleteRemoteOnCompletion; diff --git a/linden/indra/llmessage/llxfer_vfile.cpp b/linden/indra/llmessage/llxfer_vfile.cpp index 69d580a..aede763 100644 --- a/linden/indra/llmessage/llxfer_vfile.cpp +++ b/linden/indra/llmessage/llxfer_vfile.cpp @@ -74,10 +74,10 @@ void LLXfer_VFile::init (LLVFS *vfs, const LLUUID &local_id, LLAssetType::EType mVFile = NULL; - char id_string[UUID_STR_LENGTH]; /* Flawfinder : ignore */ + std::string id_string; mLocalID.toString(id_string); - snprintf(mName, sizeof(mName), "VFile %s:%s", id_string, LLAssetType::lookup(mType)); /* Flawfinder : ignore */ + mName = llformat("VFile %s:%s", id_string.c_str(), LLAssetType::lookup(mType)); } /////////////////////////////////////////////////////////// @@ -118,10 +118,10 @@ S32 LLXfer_VFile::initializeRequest(U64 xfer_id, mCallbackDataHandle = user_data; mCallbackResult = LL_ERR_NOERR; - char id_string[UUID_STR_LENGTH]; /* Flawfinder : ignore */ + std::string id_string; mLocalID.toString(id_string); - snprintf(mName, sizeof(mName), "VFile %s:%s", id_string, LLAssetType::lookup(mType)); /* Flawfinder : ignore */ + mName = llformat("VFile %s:%s", id_string.c_str(), LLAssetType::lookup(mType)); llinfos << "Requesting " << mName << llendl; @@ -328,7 +328,7 @@ BOOL LLXfer_VFile::matchesRemoteFile(const LLUUID &id, LLAssetType::EType type) ////////////////////////////////////////////////////////// -const char * LLXfer_VFile::getName() +std::string LLXfer_VFile::getFileName() { return mName; } diff --git a/linden/indra/llmessage/llxfer_vfile.h b/linden/indra/llmessage/llxfer_vfile.h index 8c0bebb..12d38ba 100644 --- a/linden/indra/llmessage/llxfer_vfile.h +++ b/linden/indra/llmessage/llxfer_vfile.h @@ -50,7 +50,7 @@ class LLXfer_VFile : public LLXfer LLVFS *mVFS; - char mName[MAX_STRING]; /* Flawfinder : ignore */ + std::string mName; public: LLXfer_VFile (); @@ -85,7 +85,7 @@ class LLXfer_VFile : public LLXfer virtual U32 getXferTypeTag(); - virtual const char *getName(); + virtual std::string getFileName(); }; #endif diff --git a/linden/indra/llmessage/llxfermanager.cpp b/linden/indra/llmessage/llxfermanager.cpp index 8bf9813..90188b6 100644 --- a/linden/indra/llmessage/llxfermanager.cpp +++ b/linden/indra/llmessage/llxfermanager.cpp @@ -406,8 +406,8 @@ U64 LLXferManager::registerXfer(const void *datap, const S32 length) /////////////////////////////////////////////////////////// -void LLXferManager::requestFile(const char* local_filename, - const char* remote_filename, +void LLXferManager::requestFile(const std::string& local_filename, + const std::string& remote_filename, ELLPath remote_path, const LLHost& remote_host, BOOL delete_remote_on_completion, @@ -444,7 +444,7 @@ void LLXferManager::requestFile(const char* local_filename, // Note: according to AaronB, this is here to deal with locks on files that were // in transit during a crash, if(delete_remote_on_completion && - (strstr(remote_filename,".tmp") == &remote_filename[strlen(remote_filename)-4])) /* Flawfinder : ignore */ + (remote_filename.substr(remote_filename.length()-4) == ".tmp")) { LLFile::remove(local_filename); } @@ -464,7 +464,7 @@ void LLXferManager::requestFile(const char* local_filename, } } -void LLXferManager::requestFile(const char* remote_filename, +void LLXferManager::requestFile(const std::string& remote_filename, ELLPath remote_path, const LLHost& remote_host, BOOL delete_remote_on_completion, @@ -540,7 +540,7 @@ void LLXferManager::requestVFile(const LLUUID& local_id, /* void LLXferManager::requestXfer( - const char *local_filename, + const std::string& local_filename, BOOL delete_remote_on_completion, U64 xfer_id, const LLHost &remote_host, @@ -634,11 +634,11 @@ void LLXferManager::processReceiveData (LLMessageSystem *mesgsys, void ** /*user // confirm it if it was a resend of the last one, since the confirmation might have gotten dropped if (decodePacketNum(packetnum) == (xferp->mPacketNum - 1)) { - llinfos << "Reconfirming xfer " << xferp->mRemoteHost << ":" << xferp->getName() << " packet " << packetnum << llendl; sendConfirmPacket(mesgsys, id, decodePacketNum(packetnum), mesgsys->getSender()); + llinfos << "Reconfirming xfer " << xferp->mRemoteHost << ":" << xferp->getFileName() << " packet " << packetnum << llendl; sendConfirmPacket(mesgsys, id, decodePacketNum(packetnum), mesgsys->getSender()); } else { - llinfos << "Ignoring xfer " << xferp->mRemoteHost << ":" << xferp->getName() << " recv'd packet " << packetnum << "; expecting " << xferp->mPacketNum << llendl; + llinfos << "Ignoring xfer " << xferp->mRemoteHost << ":" << xferp->getFileName() << " recv'd packet " << packetnum << "; expecting " << xferp->mPacketNum << llendl; } return; } @@ -717,7 +717,7 @@ void LLXferManager::processFileRequest (LLMessageSystem *mesgsys, void ** /*user { U64 id; - char local_filename[MAX_STRING]; /* Flawfinder : ignore */ + std::string local_filename; ELLPath local_path = LL_PATH_NONE; S32 result = LL_ERR_NOERR; LLUUID uuid; @@ -732,7 +732,7 @@ void LLXferManager::processFileRequest (LLMessageSystem *mesgsys, void ** /*user llinfos << "xfer request id: " << U64_to_str(id, U64_BUF, sizeof(U64_BUF)) << " to " << mesgsys->getSender() << llendl; - mesgsys->getStringFast(_PREHASH_XferID, _PREHASH_Filename, MAX_STRING, local_filename); + mesgsys->getStringFast(_PREHASH_XferID, _PREHASH_Filename, local_filename); U8 local_path_u8; mesgsys->getU8("XferID", "FilePath", local_path_u8); @@ -780,7 +780,7 @@ void LLXferManager::processFileRequest (LLMessageSystem *mesgsys, void ** /*user llerrs << "Xfer allcoation error" << llendl; } } - else if (strlen(local_filename)) /* Flawfinder : ignore */ + else if (!local_filename.empty()) { std::string expanded_filename = gDirUtilp->getExpandedFilename( local_path, local_filename ); llinfos << "starting file transfer: " << expanded_filename << " to " << mesgsys->getSender() << llendl; @@ -923,7 +923,7 @@ void LLXferManager::retransmitUnackedPackets () { if (xferp->mRetries > LL_PACKET_RETRY_LIMIT) { - llinfos << "dropping xfer " << xferp->mRemoteHost << ":" << xferp->getName() << " packet retransmit limit exceeded, xfer dropped" << llendl; + llinfos << "dropping xfer " << xferp->mRemoteHost << ":" << xferp->getFileName() << " packet retransmit limit exceeded, xfer dropped" << llendl; xferp->abort(LL_ERR_TCP_TIMEOUT); delp = xferp; xferp = xferp->mNext; @@ -931,7 +931,7 @@ void LLXferManager::retransmitUnackedPackets () } else { - llinfos << "resending xfer " << xferp->mRemoteHost << ":" << xferp->getName() << " packet unconfirmed after: "<< et << " sec, packet " << xferp->mPacketNum << llendl; + llinfos << "resending xfer " << xferp->mRemoteHost << ":" << xferp->getFileName() << " packet unconfirmed after: "<< et << " sec, packet " << xferp->mPacketNum << llendl; xferp->resendLastPacket(); xferp = xferp->mNext; } @@ -946,7 +946,7 @@ void LLXferManager::retransmitUnackedPackets () } else if (xferp->mStatus == e_LL_XFER_ABORTED) { - llwarns << "Removing aborted xfer " << xferp->mRemoteHost << ":" << xferp->getName() << llendl; + llwarns << "Removing aborted xfer " << xferp->mRemoteHost << ":" << xferp->getFileName() << llendl; delp = xferp; xferp = xferp->mNext; removeXfer(delp,&mSendList); diff --git a/linden/indra/llmessage/llxfermanager.h b/linden/indra/llmessage/llxfermanager.h index 82cd8e9..12b3ec0 100644 --- a/linden/indra/llmessage/llxfermanager.h +++ b/linden/indra/llmessage/llxfermanager.h @@ -143,8 +143,8 @@ class LLXferManager // file requesting routines // .. to file - virtual void requestFile(const char* local_filename, - const char* remote_filename, + virtual void requestFile(const std::string& local_filename, + const std::string& remote_filename, ELLPath remote_path, const LLHost& remote_host, BOOL delete_remote_on_completion, @@ -153,7 +153,7 @@ class LLXferManager BOOL use_big_packets = FALSE); // .. to memory - virtual void requestFile(const char* remote_filename, + virtual void requestFile(const std::string& remote_filename, ELLPath remote_path, const LLHost &remote_host, BOOL delete_remote_on_completion, diff --git a/linden/indra/llmessage/mean_collision_data.h b/linden/indra/llmessage/mean_collision_data.h index 1f245f9..0f09c3e 100644 --- a/linden/indra/llmessage/mean_collision_data.h +++ b/linden/indra/llmessage/mean_collision_data.h @@ -55,15 +55,13 @@ class LLMeanCollisionData public: LLMeanCollisionData(const LLUUID &victim, const LLUUID &perp, time_t time, EMeanCollisionType type, F32 mag) : mVictim(victim), mPerp(perp), mTime(time), mType(type), mMag(mag) - { mFirstName[0] = 0; mLastName[0] = 0; } + { + } LLMeanCollisionData(LLMeanCollisionData *mcd) - : mVictim(mcd->mVictim), mPerp(mcd->mPerp), mTime(mcd->mTime), mType(mcd->mType), mMag(mcd->mMag) - { - strncpy(mFirstName, mcd->mFirstName, sizeof(mFirstName) -1); /* Flawfinder: Ignore */ - mFirstName[sizeof(mFirstName) -1] = '\0'; - strncpy(mLastName, mcd->mLastName, sizeof(mLastName) -1); /* Flawfinder: Ignore */ - mLastName[sizeof(mLastName) -1] = '\0'; + : mVictim(mcd->mVictim), mPerp(mcd->mPerp), mTime(mcd->mTime), mType(mcd->mType), mMag(mcd->mMag), + mFirstName(mcd->mFirstName), mLastName(mcd->mLastName) + { } friend std::ostream& operator<<(std::ostream& s, const LLMeanCollisionData &a) @@ -96,8 +94,8 @@ public: time_t mTime; EMeanCollisionType mType; F32 mMag; - char mFirstName[DB_FIRST_NAME_BUF_SIZE]; /* Flawfinder: Ignore */ - char mLastName[DB_LAST_NAME_BUF_SIZE]; /* Flawfinder: Ignore */ + std::string mFirstName; + std::string mLastName; }; diff --git a/linden/indra/llmessage/message.cpp b/linden/indra/llmessage/message.cpp index f3aac29..27f9d12 100644 --- a/linden/indra/llmessage/message.cpp +++ b/linden/indra/llmessage/message.cpp @@ -46,9 +46,9 @@ #include #include "llapr.h" -#include "apr-1/apr_portable.h" -#include "apr-1/apr_network_io.h" -#include "apr-1/apr_poll.h" +#include "apr_portable.h" +#include "apr_network_io.h" +#include "apr_poll.h" // linden library headers #include "indra_constants.h" @@ -286,10 +286,11 @@ void LLMessageSystem::init() } // Read file and build message templates -LLMessageSystem::LLMessageSystem(const char *filename, U32 port, +LLMessageSystem::LLMessageSystem(const std::string& filename, U32 port, S32 version_major, S32 version_minor, - S32 version_patch) + S32 version_patch, + bool failure_is_fatal) { init(); @@ -306,7 +307,7 @@ LLMessageSystem::LLMessageSystem(const char *filename, U32 port, mCircuitPrintFreq = 60.f; // seconds - loadTemplateFile(filename); + loadTemplateFile(filename, failure_is_fatal); mTemplateMessageBuilder = new LLTemplateMessageBuilder(mMessageTemplates); mLLSDMessageBuilder = new LLSDMessageBuilder(); @@ -365,9 +366,9 @@ LLMessageSystem::LLMessageSystem(const char *filename, U32 port, // Read file and build message templates -void LLMessageSystem::loadTemplateFile(const char* filename) +void LLMessageSystem::loadTemplateFile(const std::string& filename, bool failure_is_fatal) { - if(!filename) + if(filename.empty()) { LL_ERRS("Messaging") << "No template filename specified" << llendl; mbError = TRUE; @@ -377,7 +378,11 @@ void LLMessageSystem::loadTemplateFile(const char* filename) std::string template_body; if(!_read_file_into_string(template_body, filename)) { - LL_WARNS("Messaging") << "Failed to open template: " << filename << llendl; + if (failure_is_fatal) { + LL_ERRS("Messaging") << "Failed to open template: " << filename << llendl; + } else { + LL_WARNS("Messaging") << "Failed to open template: " << filename << llendl; + } mbError = TRUE; return; } @@ -686,9 +691,9 @@ BOOL LLMessageSystem::checkMessages( S64 frame_count ) { std::ostringstream str; str << "MSG: <- " << host; - char buffer[MAX_STRING]; /* Flawfinder: ignore*/ - snprintf(buffer, MAX_STRING, "\t%6d\t%6d\t%6d ", receive_size, (mIncomingCompressedSize ? mIncomingCompressedSize : receive_size), mCurrentRecvPacketID); /* Flawfinder: ignore */ - str << buffer << "(unknown)" + std::string tbuf; + tbuf = llformat( "\t%6d\t%6d\t%6d ", receive_size, (mIncomingCompressedSize ? mIncomingCompressedSize : receive_size), mCurrentRecvPacketID); + str << tbuf << "(unknown)" << (recv_reliable ? " reliable" : "") << " resent " << ((acks > 0) ? "acks" : "") @@ -816,10 +821,9 @@ BOOL LLMessageSystem::checkMessages( S64 frame_count ) LLMsgBlkData *msg_block_data = mCurrentRMessageData->mMemberBlocks[bnamep]; - char errmsg[1024]; if (!msg_block_data) { - sprintf(errmsg, "Block %s #%d not in message %s", block_name, blocknum, mCurrentRMessageData->mName); + std::string errmsg = llformat("Block %s #%d not in message %s", block_name, blocknum, mCurrentRMessageData->mName); LL_ERRS("Messaging") << errmsg << llendl; } @@ -827,7 +831,7 @@ BOOL LLMessageSystem::checkMessages( S64 frame_count ) if (!vardata.getName()) { - sprintf(errmsg, "Variable %s not in message %s block %s", vnamep, mCurrentRMessageData->mName, bnamep); + std::string errmsg = llformat("Variable %s not in message %s block %s", vnamep, mCurrentRMessageData->mName, bnamep); LL_ERRS("Messaging") << errmsg << llendl; } @@ -1378,8 +1382,8 @@ S32 LLMessageSystem::sendMessage(const LLHost &host) { std::ostringstream str; str << "MSG: -> " << host; - char buffer[MAX_STRING]; /* Flawfinder: ignore */ - snprintf(buffer, MAX_STRING, "\t%6d\t%6d\t%6d ", mSendSize, buffer_length, cdp->getPacketOutID()); /* Flawfinder: ignore */ + std::string buffer; + buffer = llformat( "\t%6d\t%6d\t%6d ", mSendSize, buffer_length, cdp->getPacketOutID()); str << buffer << mMessageBuilder->getMessageName() << (mSendReliable ? " reliable " : ""); @@ -1407,8 +1411,8 @@ void LLMessageSystem::logMsgFromInvalidCircuit( const LLHost& host, BOOL recv_re { std::ostringstream str; str << "MSG: <- " << host; - char buffer[MAX_STRING]; /* Flawfinder: ignore */ - snprintf(buffer, MAX_STRING, "\t%6d\t%6d\t%6d ", mMessageReader->getMessageSize(), (mIncomingCompressedSize ? mIncomingCompressedSize: mMessageReader->getMessageSize()), mCurrentRecvPacketID); /* Flawfinder: ignore */ + std::string buffer; + buffer = llformat( "\t%6d\t%6d\t%6d ", mMessageReader->getMessageSize(), (mIncomingCompressedSize ? mIncomingCompressedSize: mMessageReader->getMessageSize()), mCurrentRecvPacketID); str << buffer << nullToEmpty(mMessageReader->getMessageName()) << (recv_reliable ? " reliable" : "") @@ -1512,8 +1516,8 @@ void LLMessageSystem::logValidMsg(LLCircuitData *cdp, const LLHost& host, BOOL r { std::ostringstream str; str << "MSG: <- " << host; - char buffer[MAX_STRING]; /* Flawfinder: ignore */ - snprintf(buffer, MAX_STRING, "\t%6d\t%6d\t%6d ", mMessageReader->getMessageSize(), (mIncomingCompressedSize ? mIncomingCompressedSize : mMessageReader->getMessageSize()), mCurrentRecvPacketID); /* Flawfinder: ignore */ + std::string buffer; + buffer = llformat( "\t%6d\t%6d\t%6d ", mMessageReader->getMessageSize(), (mIncomingCompressedSize ? mIncomingCompressedSize : mMessageReader->getMessageSize()), mCurrentRecvPacketID); str << buffer << nullToEmpty(mMessageReader->getMessageName()) << (recv_reliable ? " reliable" : "") @@ -2086,20 +2090,18 @@ void LLMessageSystem::processUseCircuitCode(LLMessageSystem* msg, // static void LLMessageSystem::processError(LLMessageSystem* msg, void**) { - char buffer[MTUBYTES]; S32 error_code = 0; msg->getS32("Data", "Code", error_code); std::string error_token; - msg->getString("Data", "Token", MTUBYTES, buffer); - error_token.assign(buffer); + msg->getString("Data", "Token", error_token); + LLUUID error_id; msg->getUUID("Data", "ID", error_id); std::string error_system; - msg->getString("Data", "System", MTUBYTES, buffer); - error_system.assign(buffer); + msg->getString("Data", "System", error_system); + std::string error_message; - msg->getString("Data", "Message", MTUBYTES, buffer); - error_message.assign(buffer); + msg->getString("Data", "Message", error_message); LL_WARNS("Messaging") << "Message error from " << msg->getSender() << " - " << error_code << " " << error_token << " " << error_id << " \"" @@ -2415,7 +2417,8 @@ void process_deny_trusted_circuit(LLMessageSystem *msg, void **) void dump_prehash_files() { U32 i; - LLFILE* fp = LLFile::fopen("../../indra/llmessage/message_prehash.h", "w"); /* Flawfinder: ignore */ + std::string filename("../../indra/llmessage/message_prehash.h"); + LLFILE* fp = LLFile::fopen(filename, "w"); /* Flawfinder: ignore */ if (fp) { fprintf( @@ -2445,7 +2448,8 @@ void dump_prehash_files() fprintf(fp, "\n\n#endif\n"); fclose(fp); } - fp = LLFile::fopen("../../indra/llmessage/message_prehash.cpp", "w"); /* Flawfinder: ignore */ + filename = std::string("../../indra/llmessage/message_prehash.cpp"); + fp = LLFile::fopen(filename, "w"); /* Flawfinder: ignore */ if (fp) { fprintf( @@ -2475,22 +2479,24 @@ void dump_prehash_files() } } -BOOL start_messaging_system( +bool start_messaging_system( const std::string& template_name, U32 port, S32 version_major, S32 version_minor, S32 version_patch, - BOOL b_dump_prehash_file, + bool b_dump_prehash_file, const std::string& secret, - const LLUseCircuitCodeResponder* responder) + const LLUseCircuitCodeResponder* responder, + bool failure_is_fatal) { gMessageSystem = new LLMessageSystem( - template_name.c_str(), + template_name, port, version_major, version_minor, - version_patch); + version_patch, + failure_is_fatal); g_shared_secret.assign(secret); if (!gMessageSystem) @@ -2579,79 +2585,79 @@ void LLMessageSystem::stopLogging() void LLMessageSystem::summarizeLogs(std::ostream& str) { - char buffer[MAX_STRING]; /* Flawfinder: ignore */ - char tmp_str[MAX_STRING]; /* Flawfinder: ignore */ + std::string buffer; + std::string tmp_str; F32 run_time = mMessageSystemTimer.getElapsedTimeF32(); str << "START MESSAGE LOG SUMMARY" << std::endl; - snprintf(buffer, MAX_STRING, "Run time: %12.3f seconds", run_time); /* Flawfinder: ignore */ + buffer = llformat( "Run time: %12.3f seconds", run_time); // Incoming str << buffer << std::endl << "Incoming:" << std::endl; - U64_to_str(mTotalBytesIn, tmp_str, sizeof(tmp_str)); - snprintf(buffer, MAX_STRING, "Total bytes received: %20s (%5.2f kbits per second)", tmp_str, ((F32)mTotalBytesIn * 0.008f) / run_time); /* Flawfinder: ignore */ + tmp_str = U64_to_str(mTotalBytesIn); + buffer = llformat( "Total bytes received: %20s (%5.2f kbits per second)", tmp_str.c_str(), ((F32)mTotalBytesIn * 0.008f) / run_time); str << buffer << std::endl; - U64_to_str(mPacketsIn, tmp_str, sizeof(tmp_str)); - snprintf(buffer, MAX_STRING, "Total packets received: %20s (%5.2f packets per second)", tmp_str, ((F32) mPacketsIn / run_time)); /* Flawfinder: ignore */ + tmp_str = U64_to_str(mPacketsIn); + buffer = llformat( "Total packets received: %20s (%5.2f packets per second)", tmp_str.c_str(), ((F32) mPacketsIn / run_time)); str << buffer << std::endl; - snprintf(buffer, MAX_STRING, "Average packet size: %20.0f bytes", (F32)mTotalBytesIn / (F32)mPacketsIn); /* Flawfinder: ignore */ + buffer = llformat( "Average packet size: %20.0f bytes", (F32)mTotalBytesIn / (F32)mPacketsIn); str << buffer << std::endl; - U64_to_str(mReliablePacketsIn, tmp_str, sizeof(tmp_str)); - snprintf(buffer, MAX_STRING, "Total reliable packets: %20s (%5.2f%%)", tmp_str, 100.f * ((F32) mReliablePacketsIn)/((F32) mPacketsIn + 1)); /* Flawfinder: ignore */ + tmp_str = U64_to_str(mReliablePacketsIn); + buffer = llformat( "Total reliable packets: %20s (%5.2f%%)", tmp_str.c_str(), 100.f * ((F32) mReliablePacketsIn)/((F32) mPacketsIn + 1)); str << buffer << std::endl; - U64_to_str(mCompressedPacketsIn, tmp_str, sizeof(tmp_str)); - snprintf(buffer, MAX_STRING, "Total compressed packets: %20s (%5.2f%%)", tmp_str, 100.f * ((F32) mCompressedPacketsIn)/((F32) mPacketsIn + 1)); /* Flawfinder: ignore */ + tmp_str = U64_to_str(mCompressedPacketsIn); + buffer = llformat( "Total compressed packets: %20s (%5.2f%%)", tmp_str.c_str(), 100.f * ((F32) mCompressedPacketsIn)/((F32) mPacketsIn + 1)); str << buffer << std::endl; S64 savings = mUncompressedBytesIn - mCompressedBytesIn; - U64_to_str(savings, tmp_str, sizeof(tmp_str)); - snprintf(buffer, MAX_STRING, "Total compression savings: %20s bytes", tmp_str); /* Flawfinder: ignore */ + tmp_str = U64_to_str(savings); + buffer = llformat( "Total compression savings: %20s bytes", tmp_str.c_str()); str << buffer << std::endl; - U64_to_str(savings/(mCompressedPacketsIn +1), tmp_str, sizeof(tmp_str)); - snprintf(buffer, MAX_STRING, "Avg comp packet savings: %20s (%5.2f : 1)", tmp_str, ((F32) mUncompressedBytesIn)/((F32) mCompressedBytesIn+1)); /* Flawfinder: ignore */ + tmp_str = U64_to_str(savings/(mCompressedPacketsIn +1)); + buffer = llformat( "Avg comp packet savings: %20s (%5.2f : 1)", tmp_str.c_str(), ((F32) mUncompressedBytesIn)/((F32) mCompressedBytesIn+1)); str << buffer << std::endl; - U64_to_str(savings/(mPacketsIn+1), tmp_str, sizeof(tmp_str)); - snprintf(buffer, MAX_STRING, "Avg overall comp savings: %20s (%5.2f : 1)", tmp_str, ((F32) mTotalBytesIn + (F32) savings)/((F32) mTotalBytesIn + 1.f)); /* Flawfinder: ignore */ + tmp_str = U64_to_str(savings/(mPacketsIn+1)); + buffer = llformat( "Avg overall comp savings: %20s (%5.2f : 1)", tmp_str.c_str(), ((F32) mTotalBytesIn + (F32) savings)/((F32) mTotalBytesIn + 1.f)); // Outgoing str << buffer << std::endl << std::endl << "Outgoing:" << std::endl; - U64_to_str(mTotalBytesOut, tmp_str, sizeof(tmp_str)); - snprintf(buffer, MAX_STRING, "Total bytes sent: %20s (%5.2f kbits per second)", tmp_str, ((F32)mTotalBytesOut * 0.008f) / run_time ); /* Flawfinder: ignore */ + tmp_str = U64_to_str(mTotalBytesOut); + buffer = llformat( "Total bytes sent: %20s (%5.2f kbits per second)", tmp_str.c_str(), ((F32)mTotalBytesOut * 0.008f) / run_time ); str << buffer << std::endl; - U64_to_str(mPacketsOut, tmp_str, sizeof(tmp_str)); - snprintf(buffer, MAX_STRING, "Total packets sent: %20s (%5.2f packets per second)", tmp_str, ((F32)mPacketsOut / run_time)); /* Flawfinder: ignore */ + tmp_str = U64_to_str(mPacketsOut); + buffer = llformat( "Total packets sent: %20s (%5.2f packets per second)", tmp_str.c_str(), ((F32)mPacketsOut / run_time)); str << buffer << std::endl; - snprintf(buffer, MAX_STRING, "Average packet size: %20.0f bytes", (F32)mTotalBytesOut / (F32)mPacketsOut); /* Flawfinder: ignore */ + buffer = llformat( "Average packet size: %20.0f bytes", (F32)mTotalBytesOut / (F32)mPacketsOut); str << buffer << std::endl; - U64_to_str(mReliablePacketsOut, tmp_str, sizeof(tmp_str)); - snprintf(buffer, MAX_STRING, "Total reliable packets: %20s (%5.2f%%)", tmp_str, 100.f * ((F32) mReliablePacketsOut)/((F32) mPacketsOut + 1)); /* Flawfinder: ignore */ + tmp_str = U64_to_str(mReliablePacketsOut); + buffer = llformat( "Total reliable packets: %20s (%5.2f%%)", tmp_str.c_str(), 100.f * ((F32) mReliablePacketsOut)/((F32) mPacketsOut + 1)); str << buffer << std::endl; - U64_to_str(mCompressedPacketsOut, tmp_str, sizeof(tmp_str)); - snprintf(buffer, MAX_STRING, "Total compressed packets: %20s (%5.2f%%)", tmp_str, 100.f * ((F32) mCompressedPacketsOut)/((F32) mPacketsOut + 1)); /* Flawfinder: ignore */ + tmp_str = U64_to_str(mCompressedPacketsOut); + buffer = llformat( "Total compressed packets: %20s (%5.2f%%)", tmp_str.c_str(), 100.f * ((F32) mCompressedPacketsOut)/((F32) mPacketsOut + 1)); str << buffer << std::endl; savings = mUncompressedBytesOut - mCompressedBytesOut; - U64_to_str(savings, tmp_str, sizeof(tmp_str)); - snprintf(buffer, MAX_STRING, "Total compression savings: %20s bytes", tmp_str); /* Flawfinder: ignore */ + tmp_str = U64_to_str(savings); + buffer = llformat( "Total compression savings: %20s bytes", tmp_str.c_str()); str << buffer << std::endl; - U64_to_str(savings/(mCompressedPacketsOut +1), tmp_str, sizeof(tmp_str)); - snprintf(buffer, MAX_STRING, "Avg comp packet savings: %20s (%5.2f : 1)", tmp_str, ((F32) mUncompressedBytesOut)/((F32) mCompressedBytesOut+1)); /* Flawfinder: ignore */ + tmp_str = U64_to_str(savings/(mCompressedPacketsOut +1)); + buffer = llformat( "Avg comp packet savings: %20s (%5.2f : 1)", tmp_str.c_str(), ((F32) mUncompressedBytesOut)/((F32) mCompressedBytesOut+1)); str << buffer << std::endl; - U64_to_str(savings/(mPacketsOut+1), tmp_str, sizeof(tmp_str)); - snprintf(buffer, MAX_STRING, "Avg overall comp savings: %20s (%5.2f : 1)", tmp_str, ((F32) mTotalBytesOut + (F32) savings)/((F32) mTotalBytesOut + 1.f)); /* Flawfinder: ignore */ + tmp_str = U64_to_str(savings/(mPacketsOut+1)); + buffer = llformat( "Avg overall comp savings: %20s (%5.2f : 1)", tmp_str.c_str(), ((F32) mTotalBytesOut + (F32) savings)/((F32) mTotalBytesOut + 1.f)); str << buffer << std::endl << std::endl; - snprintf(buffer, MAX_STRING, "SendPacket failures: %20d", mSendPacketFailureCount); /* Flawfinder: ignore */ + buffer = llformat( "SendPacket failures: %20d", mSendPacketFailureCount); str << buffer << std::endl; - snprintf(buffer, MAX_STRING, "Dropped packets: %20d", mDroppedPackets); /* Flawfinder: ignore */ + buffer = llformat( "Dropped packets: %20d", mDroppedPackets); str << buffer << std::endl; - snprintf(buffer, MAX_STRING, "Resent packets: %20d", mResentPackets); /* Flawfinder: ignore */ + buffer = llformat( "Resent packets: %20d", mResentPackets); str << buffer << std::endl; - snprintf(buffer, MAX_STRING, "Failed reliable resends: %20d", mFailedResendPackets); /* Flawfinder: ignore */ + buffer = llformat( "Failed reliable resends: %20d", mFailedResendPackets); str << buffer << std::endl; - snprintf(buffer, MAX_STRING, "Off-circuit rejected packets: %17d", mOffCircuitPackets); /* Flawfinder: ignore */ + buffer = llformat( "Off-circuit rejected packets: %17d", mOffCircuitPackets); str << buffer << std::endl; - snprintf(buffer, MAX_STRING, "On-circuit invalid packets: %17d", mInvalidOnCircuitPackets); /* Flawfinder: ignore */ + buffer = llformat( "On-circuit invalid packets: %17d", mInvalidOnCircuitPackets); str << buffer << std::endl << std::endl; str << "Decoding: " << std::endl; - snprintf(buffer, MAX_STRING, "%35s%10s%10s%10s%10s", "Message", "Count", "Time", "Max", "Avg"); /* Flawfinder: ignore */ + buffer = llformat( "%35s%10s%10s%10s%10s", "Message", "Count", "Time", "Max", "Avg"); str << buffer << std:: endl; F32 avg; for (message_template_name_map_t::const_iterator iter = mMessageTemplates.begin(), @@ -2662,7 +2668,7 @@ void LLMessageSystem::summarizeLogs(std::ostream& str) if(mt->mTotalDecoded > 0) { avg = mt->mTotalDecodeTime / (F32)mt->mTotalDecoded; - snprintf(buffer, MAX_STRING, "%35s%10u%10f%10f%10f", mt->mName, mt->mTotalDecoded, mt->mTotalDecodeTime, mt->mMaxDecodeTimePerMsg, avg); /* Flawfinder: ignore */ + buffer = llformat( "%35s%10u%10f%10f%10f", mt->mName, mt->mTotalDecoded, mt->mTotalDecodeTime, mt->mMaxDecodeTimePerMsg, avg); str << buffer << std::endl; } } @@ -3928,6 +3934,20 @@ void LLMessageSystem::getString(const char *block, const char *var, blocknum); } +void LLMessageSystem::getStringFast(const char *block, const char *var, + std::string& outstr, S32 blocknum) +{ + mMessageReader->getString(block, var, outstr, blocknum); +} + +void LLMessageSystem::getString(const char *block, const char *var, + std::string& outstr, S32 blocknum ) +{ + getStringFast(LLMessageStringTable::getInstance()->getString(block), + LLMessageStringTable::getInstance()->getString(var), outstr, + blocknum); +} + S32 LLMessageSystem::getNumberOfBlocksFast(const char *blockname) { return mMessageReader->getNumberOfBlocks(blockname); diff --git a/linden/indra/llmessage/message.h b/linden/indra/llmessage/message.h index 00abff4..8807521 100644 --- a/linden/indra/llmessage/message.h +++ b/linden/indra/llmessage/message.h @@ -283,8 +283,9 @@ public: public: // Read file and build message templates - LLMessageSystem(const char *filename, U32 port, S32 version_major, - S32 version_minor, S32 version_patch); + LLMessageSystem(const std::string& filename, U32 port, S32 version_major, + S32 version_minor, S32 version_patch, + bool failure_is_fatal = true); ~LLMessageSystem(); @@ -294,7 +295,7 @@ public: // Read file and build message templates filename must point to a // valid string which specifies the path of a valid linden // template. - void loadTemplateFile(const char* filename); + void loadTemplateFile(const std::string& filename, bool failure_is_fatal); // methods for building, sending, receiving, and handling messages @@ -515,6 +516,8 @@ public: void getIPPort( const char *block, const char *var, U16 &port, S32 blocknum = 0); void getStringFast( const char *block, const char *var, S32 buffer_size, char *buffer, S32 blocknum = 0); void getString( const char *block, const char *var, S32 buffer_size, char *buffer, S32 blocknum = 0); + void getStringFast( const char *block, const char *var, std::string& outstr, S32 blocknum = 0); + void getString( const char *block, const char *var, std::string& outstr, S32 blocknum = 0); // Utility functions to generate a replay-resistant digest check @@ -764,16 +767,17 @@ extern LLMessageSystem *gMessageSystem; // Must specific overall system version, which is used to determine // if a patch is available in the message template checksum verification. -// Return TRUE if able to initialize system. -BOOL start_messaging_system( +// Return true if able to initialize system. +bool start_messaging_system( const std::string& template_name, U32 port, S32 version_major, S32 version_minor, S32 version_patch, - BOOL b_dump_prehash_file, + bool b_dump_prehash_file, const std::string& secret, - const LLUseCircuitCodeResponder* responder = NULL); + const LLUseCircuitCodeResponder* responder = NULL, + bool failure_is_fatal = true); void end_messaging_system(); diff --git a/linden/indra/llmessage/message_prehash.cpp b/linden/indra/llmessage/message_prehash.cpp index 745271f..2ac1319 100644 --- a/linden/indra/llmessage/message_prehash.cpp +++ b/linden/indra/llmessage/message_prehash.cpp @@ -1371,4 +1371,7 @@ char* _PREHASH_OwnerMask = LLMessageStringTable::getInstance()->getString("Owner char* _PREHASH_TransferInventoryAck = LLMessageStringTable::getInstance()->getString("TransferInventoryAck"); char* _PREHASH_RegionDenyAgeUnverified = LLMessageStringTable::getInstance()->getString("RegionDenyAgeUnverified"); char* _PREHASH_AgeVerificationBlock = LLMessageStringTable::getInstance()->getString("AgeVerificationBlock"); +char* _PREHASH_UCoord = LLMessageStringTable::getInstance()->getString("UCoord"); +char* _PREHASH_VCoord = LLMessageStringTable::getInstance()->getString("VCoord"); +char* _PREHASH_FaceIndex = LLMessageStringTable::getInstance()->getString("FaceIndex"); diff --git a/linden/indra/llmessage/message_prehash.h b/linden/indra/llmessage/message_prehash.h index e65d539..0ee02be 100644 --- a/linden/indra/llmessage/message_prehash.h +++ b/linden/indra/llmessage/message_prehash.h @@ -1371,6 +1371,8 @@ extern char * _PREHASH_OwnerMask; extern char * _PREHASH_TransferInventoryAck; extern char * _PREHASH_RegionDenyAgeUnverified; extern char * _PREHASH_AgeVerificationBlock; - +extern char * _PREHASH_UCoord; +extern char * _PREHASH_VCoord; +extern char * _PREHASH_FaceIndex; #endif diff --git a/linden/indra/llprimitive/CMakeLists.txt b/linden/indra/llprimitive/CMakeLists.txt new file mode 100644 index 0000000..5dc4c70 --- /dev/null +++ b/linden/indra/llprimitive/CMakeLists.txt @@ -0,0 +1,49 @@ +# -*- cmake -*- + +project(llprimitive) + +include(00-Common) +include(LLCommon) +include(LLMath) +include(LLMessage) +include(LLXML) + +include_directories( + ${LLCOMMON_INCLUDE_DIRS} + ${LLMATH_INCLUDE_DIRS} + ${LLMESSAGE_INCLUDE_DIRS} + ${LLXML_INCLUDE_DIRS} + ) + +set(llprimitive_SOURCE_FILES + llmaterialtable.cpp + llprimitive.cpp + lltextureanim.cpp + lltextureentry.cpp + lltreeparams.cpp + llvolumemessage.cpp + llvolumexml.cpp + ) + +set(llprimitive_HEADER_FILES + CMakeLists.txt + + legacy_object_types.h + llmaterialtable.h + llprimitive.h + lltextureanim.h + lltextureentry.h + lltreeparams.h + lltree_common.h + llvolumemessage.h + llvolumexml.h + material_codes.h + object_flags.h + ) + +set_source_files_properties(${llprimitive_HEADER_FILES} + PROPERTIES HEADER_FILE_ONLY TRUE) + +list(APPEND llprimitive_SOURCE_FILES ${llprimitive_HEADER_FILES}) + +add_library (llprimitive ${llprimitive_SOURCE_FILES}) diff --git a/linden/indra/llprimitive/files.lst b/linden/indra/llprimitive/files.lst deleted file mode 100644 index b9f5dbc..0000000 --- a/linden/indra/llprimitive/files.lst +++ /dev/null @@ -1,7 +0,0 @@ -llprimitive/llmaterialtable.cpp -llprimitive/llprimitive.cpp -llprimitive/lltextureanim.cpp -llprimitive/lltextureentry.cpp -llprimitive/lltreeparams.cpp -llprimitive/llvolumemessage.cpp -llprimitive/llvolumexml.cpp diff --git a/linden/indra/llprimitive/llmaterialtable.cpp b/linden/indra/llprimitive/llmaterialtable.cpp index 5e45e44..4fb6904 100644 --- a/linden/indra/llprimitive/llmaterialtable.cpp +++ b/linden/indra/llprimitive/llmaterialtable.cpp @@ -125,14 +125,15 @@ LLMaterialTable::~LLMaterialTable() void LLMaterialTable::initBasicTable() { - add(LL_MCODE_STONE,"Stone", LL_DEFAULT_STONE_UUID); - add(LL_MCODE_METAL,"Metal", LL_DEFAULT_METAL_UUID); - add(LL_MCODE_GLASS,"Glass", LL_DEFAULT_GLASS_UUID); - add(LL_MCODE_WOOD,"Wood", LL_DEFAULT_WOOD_UUID); - add(LL_MCODE_FLESH,"Flesh", LL_DEFAULT_FLESH_UUID); - add(LL_MCODE_PLASTIC,"Plastic", LL_DEFAULT_PLASTIC_UUID); - add(LL_MCODE_RUBBER,"Rubber", LL_DEFAULT_RUBBER_UUID); - add(LL_MCODE_LIGHT,"Light", LL_DEFAULT_LIGHT_UUID); + // *TODO: Translate + add(LL_MCODE_STONE,std::string("Stone"), LL_DEFAULT_STONE_UUID); + add(LL_MCODE_METAL,std::string("Metal"), LL_DEFAULT_METAL_UUID); + add(LL_MCODE_GLASS,std::string("Glass"), LL_DEFAULT_GLASS_UUID); + add(LL_MCODE_WOOD,std::string("Wood"), LL_DEFAULT_WOOD_UUID); + add(LL_MCODE_FLESH,std::string("Flesh"), LL_DEFAULT_FLESH_UUID); + add(LL_MCODE_PLASTIC,std::string("Plastic"), LL_DEFAULT_PLASTIC_UUID); + add(LL_MCODE_RUBBER,std::string("Rubber"), LL_DEFAULT_RUBBER_UUID); + add(LL_MCODE_LIGHT,std::string("Light"), LL_DEFAULT_LIGHT_UUID); // specify densities for these materials. . . // these were taken from http://www.mcelwee.net/html/densities_of_various_materials.html @@ -331,7 +332,7 @@ void LLMaterialTable::initBasicTable() } } -BOOL LLMaterialTable::add(U8 mcode, char* name, const LLUUID &uuid) +BOOL LLMaterialTable::add(U8 mcode, const std::string& name, const LLUUID &uuid) { LLMaterialInfo *infop; @@ -466,13 +467,13 @@ BOOL LLMaterialTable::addDamageAndEnergy(U8 mcode, const F32 &hp_mod, const F32 return FALSE; } -LLUUID LLMaterialTable::getDefaultTextureID(char* name) +LLUUID LLMaterialTable::getDefaultTextureID(const std::string& name) { for (info_list_t::iterator iter = mMaterialInfoList.begin(); iter != mMaterialInfoList.end(); ++iter) { LLMaterialInfo *infop = *iter; - if (!strcmp(name, infop->mName)) + if (name == infop->mName) { return infop->mDefaultTextureID; } @@ -499,13 +500,13 @@ LLUUID LLMaterialTable::getDefaultTextureID(U8 mcode) } -U8 LLMaterialTable::getMCode(const char* name) +U8 LLMaterialTable::getMCode(const std::string& name) { for (info_list_t::iterator iter = mMaterialInfoList.begin(); iter != mMaterialInfoList.end(); ++iter) { LLMaterialInfo *infop = *iter; - if (!strcmp(name, infop->mName)) + if (name == infop->mName) { return infop->mMCode; } @@ -515,7 +516,7 @@ U8 LLMaterialTable::getMCode(const char* name) } -char* LLMaterialTable::getName(U8 mcode) +std::string LLMaterialTable::getName(U8 mcode) { mcode &= LL_MCODE_MASK; for (info_list_t::iterator iter = mMaterialInfoList.begin(); diff --git a/linden/indra/llprimitive/llmaterialtable.h b/linden/indra/llprimitive/llmaterialtable.h index 863fb25..8290195 100644 --- a/linden/indra/llprimitive/llmaterialtable.h +++ b/linden/indra/llprimitive/llmaterialtable.h @@ -67,7 +67,7 @@ class LLMaterialInfo { public: U8 mMCode; - char mName[LLMATERIAL_INFO_NAME_LENGTH]; /* Flawfinder: ignore */ + std::string mName; LLUUID mDefaultTextureID; LLUUID mShatterSoundID; F32 mDensity; // kg/m^3 @@ -79,24 +79,20 @@ public: F32 mDamageModifier; // modifier on KE based damage F32 mEPModifier; // modifier on mass based EP total - LLMaterialInfo(U8 mcode, char* name, const LLUUID &uuid) + LLMaterialInfo(U8 mcode, const std::string& name, const LLUUID &uuid) { init(mcode,name,uuid); }; - void init(U8 mcode, char* name, const LLUUID &uuid) + void init(U8 mcode, const std::string& name, const LLUUID &uuid) { - mName[0] = 0; mDensity = 1000.f; // default to 1000.0 (water) mHPModifier = 1.f; mDamageModifier = 1.f; mEPModifier = 1.f; mMCode = mcode; - if (name) - { - LLString::copy(mName,name,LLMATERIAL_INFO_NAME_LENGTH); - } + mName = name; mDefaultTextureID = uuid; }; @@ -150,7 +146,7 @@ public: void initBasicTable(); - BOOL add(U8 mcode, char* name, const LLUUID &uuid); + BOOL add(U8 mcode, const std::string& name, const LLUUID &uuid); BOOL addCollisionSound(U8 mcode, U8 mcode2, const LLUUID &uuid); BOOL addSlidingSound(U8 mcode, U8 mcode2, const LLUUID &uuid); BOOL addRollingSound(U8 mcode, U8 mcode2, const LLUUID &uuid); @@ -160,10 +156,10 @@ public: BOOL addRestitution(U8 mcode, const F32 &restitution); BOOL addDamageAndEnergy(U8 mcode, const F32 &hp_mod, const F32 &damage_mod, const F32 &ep_mod); - LLUUID getDefaultTextureID(char* name); // LLUUID::null if not found + LLUUID getDefaultTextureID(const std::string& name); // LLUUID::null if not found LLUUID getDefaultTextureID(U8 mcode); // LLUUID::null if not found - U8 getMCode(const char* name); // 0 if not found - char* getName(U8 mcode); + U8 getMCode(const std::string& name); // 0 if not found + std::string getName(U8 mcode); F32 getDensity(U8 mcode); // kg/m^3, 0 if not found F32 getFriction(U8 mcode); // physics values diff --git a/linden/indra/llprimitive/llprimitive.cpp b/linden/indra/llprimitive/llprimitive.cpp index 3ddf92e..bbfa53e 100644 --- a/linden/indra/llprimitive/llprimitive.cpp +++ b/linden/indra/llprimitive/llprimitive.cpp @@ -760,15 +760,14 @@ U8 LLPrimitive::pCodeToLegacy(const LLPCode pcode) // static // Don't crash or llerrs here! This function is used for debug strings. -const char * LLPrimitive::pCodeToString(const LLPCode pcode) +std::string LLPrimitive::pCodeToString(const LLPCode pcode) { - static char pcode_string[255]; /* Flawfinder: ignore */ + std::string pcode_string; U8 base_code = pcode & LL_PCODE_BASE_MASK; - pcode_string[0] = 0; if (!pcode) { - snprintf(pcode_string, sizeof(pcode_string), "null"); /* Flawfinder: ignore */ + pcode_string = "null"; } else if ((base_code) == LL_PCODE_LEGACY) { @@ -776,66 +775,66 @@ const char * LLPrimitive::pCodeToString(const LLPCode pcode) switch (pcode) { case LL_PCODE_LEGACY_GRASS: - snprintf(pcode_string, sizeof(pcode_string), "grass"); /* Flawfinder: ignore */ + pcode_string = "grass"; break; case LL_PCODE_LEGACY_PART_SYS: - snprintf(pcode_string, sizeof(pcode_string), "particle system"); /* Flawfinder: ignore */ + pcode_string = "particle system"; break; case LL_PCODE_LEGACY_AVATAR: - snprintf(pcode_string, sizeof(pcode_string), "avatar"); /* Flawfinder: ignore */ + pcode_string = "avatar"; break; case LL_PCODE_LEGACY_TEXT_BUBBLE: - snprintf(pcode_string, sizeof(pcode_string), "text bubble"); /* Flawfinder: ignore */ + pcode_string = "text bubble"; break; case LL_PCODE_LEGACY_TREE: - snprintf(pcode_string, sizeof(pcode_string), "tree"); /* Flawfinder: ignore */ + pcode_string = "tree"; break; case LL_PCODE_TREE_NEW: - snprintf(pcode_string, sizeof(pcode_string), "tree_new"); /* Flawfinder: ignore */ + pcode_string = "tree_new"; break; default: - snprintf(pcode_string, sizeof(pcode_string), "unknown legacy pcode %i",(U32)pcode); /* Flawfinder: ignore */ + pcode_string = llformat( "unknown legacy pcode %i",(U32)pcode); } } else { - char shape[32]; /* Flawfinder: ignore */ - char mask[32]; /* Flawfinder: ignore */ + std::string shape; + std::string mask; if (base_code == LL_PCODE_CUBE) { - snprintf(shape, sizeof(shape), "cube"); /* Flawfinder: ignore */ + shape = "cube"; } else if (base_code == LL_PCODE_CYLINDER) { - snprintf(shape, sizeof(shape), "cylinder"); /* Flawfinder: ignore */ + shape = "cylinder"; } else if (base_code == LL_PCODE_CONE) { - snprintf(shape, sizeof(shape), "cone"); /* Flawfinder: ignore */ + shape = "cone"; } else if (base_code == LL_PCODE_PRISM) { - snprintf(shape, sizeof(shape), "prism"); /* Flawfinder: ignore */ + shape = "prism"; } else if (base_code == LL_PCODE_PYRAMID) { - snprintf(shape, sizeof(shape), "pyramid"); /* Flawfinder: ignore */ + shape = "pyramid"; } else if (base_code == LL_PCODE_SPHERE) { - snprintf(shape, sizeof(shape), "sphere"); /* Flawfinder: ignore */ + shape = "sphere"; } else if (base_code == LL_PCODE_TETRAHEDRON) { - snprintf(shape, sizeof(shape), "tetrahedron"); /* Flawfinder: ignore */ + shape = "tetrahedron"; } else if (base_code == LL_PCODE_VOLUME) { - snprintf(shape, sizeof(shape), "volume"); /* Flawfinder: ignore */ + shape = "volume"; } else if (base_code == LL_PCODE_APP) { - snprintf(shape, sizeof(shape), "app"); /* Flawfinder: ignore */ + shape = "app"; } else { @@ -845,35 +844,27 @@ const char * LLPrimitive::pCodeToString(const LLPCode pcode) U8 mask_code = pcode & (~LL_PCODE_BASE_MASK); if (base_code == LL_PCODE_APP) { - snprintf(mask, sizeof(mask), "%x", mask_code); /* Flawfinder: ignore */ + mask = llformat( "%x", mask_code); } else if (mask_code & LL_PCODE_HEMI_MASK) { - snprintf(mask, sizeof(mask), "hemi"); /* Flawfinder: ignore */ + mask = "hemi"; } else { - snprintf(mask, sizeof(mask), "%x", mask_code); /* Flawfinder: ignore */ + mask = llformat( "%x", mask_code); } - // extra sanity against snprintf() being naturally crap - mask[sizeof(mask)-1] = '\0'; - shape[sizeof(shape)-1] = '\0'; - if (mask[0]) { - snprintf(pcode_string, sizeof(pcode_string), "%s-%s", shape, mask); /* Flawfinder: ignore */ + pcode_string = llformat( "%s-%s", shape.c_str(), mask.c_str()); } else { - snprintf(pcode_string, sizeof(pcode_string), "%s", shape); /* Flawfinder: ignore */ + pcode_string = llformat( "%s", shape.c_str()); } } - // Be really sure that pcode_string is nul-terminated after we've - // been using crappy snprintf() to build it. - pcode_string[sizeof(pcode_string)-1] = '\0'; - return pcode_string; } @@ -993,7 +984,7 @@ BOOL LLPrimitive::setVolume(const LLVolumeParams &volume_params, const S32 detai S32 i; /* - LLString old_mask_string; + std::string old_mask_string; for (i = 0; i < 9; i++) { if (old_face_mask & (1 << i)) @@ -1005,7 +996,7 @@ BOOL LLPrimitive::setVolume(const LLVolumeParams &volume_params, const S32 detai old_mask_string.append("0"); } } - LLString new_mask_string; + std::string new_mask_string; for (i = 0; i < 9; i++) { if (new_face_mask & (1 << i)) diff --git a/linden/indra/llprimitive/llprimitive.h b/linden/indra/llprimitive/llprimitive.h index e698a31..82df35c 100644 --- a/linden/indra/llprimitive/llprimitive.h +++ b/linden/indra/llprimitive/llprimitive.h @@ -378,7 +378,7 @@ public: #endif LLPCode getPCode() const { return mPrimitiveCode; } - const char * getPCodeString() const { return pCodeToString(mPrimitiveCode); } + std::string getPCodeString() const { return pCodeToString(mPrimitiveCode); } const LLVector3& getAngularVelocity() const { return mAngularVelocity; } const LLVector3& getVelocity() const { return mVelocity; } const LLVector3& getAcceleration() const { return mAcceleration; } @@ -400,7 +400,7 @@ public: void removeFlags(U32 flags) { mMiscFlags &= ~flags; } U32 getFlags() const { return mMiscFlags; } - static const char *pCodeToString(const LLPCode pcode); + static std::string pCodeToString(const LLPCode pcode); static LLPCode legacyToPCode(const U8 legacy); static U8 pCodeToLegacy(const LLPCode pcode); static bool getTESTAxes(const U8 face, U32* s_axis, U32* t_axis); diff --git a/linden/indra/llprimitive/llprimitive.vcproj b/linden/indra/llprimitive/llprimitive.vcproj deleted file mode 100644 index 620ace4..0000000 --- a/linden/indra/llprimitive/llprimitive.vcproj +++ /dev/null @@ -1,224 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/linden/indra/llprimitive/llprimitive_vc8.vcproj b/linden/indra/llprimitive/llprimitive_vc8.vcproj deleted file mode 100644 index 860f88a..0000000 --- a/linden/indra/llprimitive/llprimitive_vc8.vcproj +++ /dev/null @@ -1,319 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/linden/indra/llprimitive/llprimitive_vc9.vcproj b/linden/indra/llprimitive/llprimitive_vc9.vcproj deleted file mode 100644 index 1e04970..0000000 --- a/linden/indra/llprimitive/llprimitive_vc9.vcproj +++ /dev/null @@ -1,320 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/linden/indra/llrender/CMakeLists.txt b/linden/indra/llrender/CMakeLists.txt new file mode 100644 index 0000000..76858d9 --- /dev/null +++ b/linden/indra/llrender/CMakeLists.txt @@ -0,0 +1,83 @@ +# -*- cmake -*- + +project(llrender) + +include(00-Common) +include(FreeType) +include(LLCommon) +include(LLImage) +include(LLMath) +include(LLRender) +include(LLWindow) + +include_directories( + ${FREETYPE_INCLUDE_DIRS} + ${LLCOMMON_INCLUDE_DIRS} + ${LLIMAGE_INCLUDE_DIRS} + ${LLMATH_INCLUDE_DIRS} + ${LLRENDER_INCLUDE_DIRS} + ${LLWINDOW_INCLUDE_DIRS} + ) + +set(llrender_SOURCE_FILES + llcubemap.cpp + llfont.cpp + llfontgl.cpp + llgldbg.cpp + llglslshader.cpp + llimagegl.cpp + llpostprocess.cpp + llrender.cpp + llrendersphere.cpp + llrendertarget.cpp + llshadermgr.cpp + llvertexbuffer.cpp + ) + +set(llrender_HEADER_FILES + CMakeLists.txt + + llcubemap.h + llfontgl.h + llfont.h + llgl.h + llgldbg.h + llglheaders.h + llglslshader.h + llglstates.h + llgltypes.h + llimagegl.h + llpostprocess.h + llrender.h + llrendersphere.h + llrendertarget.h + llshadermgr.h + llvertexbuffer.h + ) + +set_source_files_properties(${llrender_HEADER_FILES} + PROPERTIES HEADER_FILE_ONLY TRUE) + +list(APPEND llrender_SOURCE_FILES ${llrender_HEADER_FILES}) + +if (SERVER AND NOT WINDOWS AND NOT DARWIN) + copy_server_sources( + llgl + ) + + + set_source_files_properties( + ${server_SOURCE_FILES} + PROPERTIES + COMPILE_FLAGS "-DLL_MESA=1 -DLL_MESA_HEADLESS=1" + ) + add_library (llrenderheadless + ${llrender_SOURCE_FILES} + ${server_SOURCE_FILES} + ) +else (SERVER AND NOT WINDOWS AND NOT DARWIN) + list(APPEND llrender_SOURCE_FILES + llgl.cpp + ) +endif (SERVER AND NOT WINDOWS AND NOT DARWIN) +add_library (llrender ${llrender_SOURCE_FILES}) diff --git a/linden/indra/llrender/files.darwin.lst b/linden/indra/llrender/files.darwin.lst deleted file mode 100644 index 2d27570..0000000 --- a/linden/indra/llrender/files.darwin.lst +++ /dev/null @@ -1 +0,0 @@ -llrender/llagpmempoolapple.cpp diff --git a/linden/indra/llrender/files.lst b/linden/indra/llrender/files.lst deleted file mode 100644 index 5dc9579..0000000 --- a/linden/indra/llrender/files.lst +++ /dev/null @@ -1,7 +0,0 @@ -llrender/llfont.cpp -llrender/llfontgl.cpp -llrender/llgldbg.cpp -llrender/llrender.cpp -llrender/llimagegl.cpp -llrender/llrendertarget.cpp -llrender/llvertexbuffer.cpp diff --git a/linden/indra/llrender/llcubemap.cpp b/linden/indra/llrender/llcubemap.cpp new file mode 100644 index 0000000..563d616 --- /dev/null +++ b/linden/indra/llrender/llcubemap.cpp @@ -0,0 +1,532 @@ +/** + * @file llcubemap.cpp + * @brief LLCubeMap class implementation + * + * $LicenseInfo:firstyear=2002&license=viewergpl$ + * + * Copyright (c) 2002-2008, Linden Research, Inc. + * + * Second Life Viewer Source Code + * 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://secondlifegrid.net/programs/open_source/licensing/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://secondlifegrid.net/programs/open_source/licensing/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. + * $/LicenseInfo$ + */ +#include "linden_common.h" + +#include "llworkerthread.h" + +#include "llcubemap.h" + +#include "v4coloru.h" +#include "v3math.h" +#include "v3dmath.h" +#include "m3math.h" +#include "m4math.h" +#include "llcamera.h" + +#include "llrender.h" + +#include "llglheaders.h" + +const F32 epsilon = 1e-7f; +const U16 RESOLUTION = 64; + +#if LL_DARWIN +// mipmap generation on cubemap textures seems to be broken on the Mac for at least some cards. +// Since the cubemap is small (64x64 per face) and doesn't have any fine detail, turning off mipmaps is a usable workaround. +const BOOL use_cube_mipmaps = FALSE; +#else +const BOOL use_cube_mipmaps = FALSE; //current build works best without cube mipmaps +#endif + +bool LLCubeMap::sUseCubeMaps = true; + +LLCubeMap::LLCubeMap() + : mTextureStage(0), + mTextureCoordStage(0), + mMatrixStage(0) +{ +} + +LLCubeMap::~LLCubeMap() +{ +} + +void LLCubeMap::initGL() +{ + llassert(gGLManager.mInited); + + if (gGLManager.mHasCubeMap && LLCubeMap::sUseCubeMaps) + { + mTargets[0] = GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB; + mTargets[1] = GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB; + mTargets[2] = GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB; + mTargets[3] = GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB; + mTargets[4] = GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB; + mTargets[5] = GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB; + + // Not initialized, do stuff. + if (mImages[0].isNull()) + { + GLuint texname = 0; + + glGenTextures(1, &texname); + + for (int i = 0; i < 6; i++) + { + mImages[i] = new LLImageGL(64, 64, 4, (use_cube_mipmaps? TRUE : FALSE)); + mImages[i]->setTarget(mTargets[i], GL_TEXTURE_CUBE_MAP_ARB); + mRawImages[i] = new LLImageRaw(64, 64, 4); + mImages[i]->createGLTexture(0, mRawImages[i], texname); + + glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, texname); + mImages[i]->setClampCubemap (TRUE, TRUE, TRUE); + stop_glerror(); + } + } + disable(); + } + else + { + llwarns << "Using cube map without extension!" << llendl + } +} + +void LLCubeMap::initRawData(const std::vector >& rawimages) +{ + bool flip_x[6] = { false, true, false, false, true, false }; + bool flip_y[6] = { true, true, true, false, true, true }; + bool transpose[6] = { false, false, false, false, true, true }; + + // Yes, I know that this is inefficient! - djs 08/08/02 + for (int i = 0; i < 6; i++) + { + const U8 *sd = rawimages[i]->getData(); + U8 *td = mRawImages[i]->getData(); + + S32 offset = 0; + S32 sx, sy, so; + for (int y = 0; y < 64; y++) + { + for (int x = 0; x < 64; x++) + { + sx = x; + sy = y; + if (flip_y[i]) + { + sy = 63 - y; + } + if (flip_x[i]) + { + sx = 63 - x; + } + if (transpose[i]) + { + S32 temp = sx; + sx = sy; + sy = temp; + } + + so = 64*sy + sx; + so *= 4; + *(td + offset++) = *(sd + so++); + *(td + offset++) = *(sd + so++); + *(td + offset++) = *(sd + so++); + *(td + offset++) = *(sd + so++); + } + } + } +} + +void LLCubeMap::initGLData() +{ + for (int i = 0; i < 6; i++) + { + mImages[i]->setSubImage(mRawImages[i], 0, 0, 64, 64); + } +} + +void LLCubeMap::init(const std::vector >& rawimages) +{ + if (!gGLManager.mIsDisabled) + { + initGL(); + initRawData(rawimages); + initGLData(); + } +} + +GLuint LLCubeMap::getGLName() +{ + return mImages[0]->getTexName(); +} + +void LLCubeMap::bind() +{ + if (gGLManager.mHasCubeMap && LLCubeMap::sUseCubeMaps) + { + // We assume that if they have cube mapping, they have multitexturing. + if (mTextureStage > 0) + { + gGL.getTexUnit(mTextureStage)->activate(); + } + glEnable(GL_TEXTURE_CUBE_MAP_ARB); + glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, mImages[0]->getTexName()); + + mImages[0]->setMipFilterNearest (FALSE, FALSE); + if (mTextureStage > 0) + { + gGL.getTexUnit(0)->activate(); + } + } + else + { + llwarns << "Using cube map without extension!" << llendl + } +} + +void LLCubeMap::enable(S32 stage) +{ + enableTexture(stage); + enableTextureCoords(stage); +} + +void LLCubeMap::enableTexture(S32 stage) +{ + mTextureStage = stage; + if (gGLManager.mHasCubeMap && stage >= 0 && LLCubeMap::sUseCubeMaps) + { + if (stage > 0) + { + gGL.getTexUnit(stage)->activate(); + } + + glEnable(GL_TEXTURE_CUBE_MAP_ARB); + + if (stage > 0) + { + gGL.getTexUnit(0)->activate(); + } + } +} + +void LLCubeMap::enableTextureCoords(S32 stage) +{ + mTextureCoordStage = stage; + if (gGLManager.mHasCubeMap && stage >= 0 && LLCubeMap::sUseCubeMaps) + { + if (stage > 0) + { + gGL.getTexUnit(stage)->activate(); + } + + glEnable(GL_TEXTURE_GEN_R); + glEnable(GL_TEXTURE_GEN_S); + glEnable(GL_TEXTURE_GEN_T); + + glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP); + glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP); + glTexGeni(GL_R, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP); + + if (stage > 0) + { + gGL.getTexUnit(0)->activate(); + } + } +} + +void LLCubeMap::disable(void) +{ + disableTexture(); + disableTextureCoords(); +} + +void LLCubeMap::disableTexture(void) +{ + if (gGLManager.mHasCubeMap && mTextureStage >= 0 && LLCubeMap::sUseCubeMaps) + { + if (mTextureStage > 0) + { + gGL.getTexUnit(mTextureStage)->activate(); + } + glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, 0); + glDisable(GL_TEXTURE_CUBE_MAP_ARB); + if (mTextureStage > 0) + { + gGL.getTexUnit(0)->activate(); + } + } +} + +void LLCubeMap::disableTextureCoords(void) +{ + if (gGLManager.mHasCubeMap && mTextureCoordStage >= 0 && LLCubeMap::sUseCubeMaps) + { + if (mTextureCoordStage > 0) + { + gGL.getTexUnit(mTextureCoordStage)->activate(); + } + glDisable(GL_TEXTURE_GEN_S); + glDisable(GL_TEXTURE_GEN_T); + glDisable(GL_TEXTURE_GEN_R); + if (mTextureCoordStage > 0) + { + gGL.getTexUnit(0)->activate(); + } + } +} + +void LLCubeMap::setMatrix(S32 stage) +{ + mMatrixStage = stage; + + if (stage > 0) + { + gGL.getTexUnit(stage)->activate(); + } + + LLVector3 x(LLVector3d(gGLModelView+0)); + LLVector3 y(LLVector3d(gGLModelView+4)); + LLVector3 z(LLVector3d(gGLModelView+8)); + + LLMatrix3 mat3; + mat3.setRows(x,y,z); + LLMatrix4 trans(mat3); + trans.transpose(); + + glMatrixMode(GL_TEXTURE); + glPushMatrix(); + glLoadMatrixf((F32 *)trans.mMatrix); + glMatrixMode(GL_MODELVIEW); + + if (stage > 0) + { + gGL.getTexUnit(0)->activate(); + } +} + +void LLCubeMap::restoreMatrix() +{ + if (mMatrixStage > 0) + { + gGL.getTexUnit(mMatrixStage)->activate(); + } + glMatrixMode(GL_TEXTURE); + glPopMatrix(); + glMatrixMode(GL_MODELVIEW); + + if (mMatrixStage > 0) + { + gGL.getTexUnit(0)->activate(); + } +} + +void LLCubeMap::setReflection (void) +{ + glBindTexture (GL_TEXTURE_CUBE_MAP_ARB, getGLName()); + mImages[0]->setMipFilterNearest (FALSE, FALSE); + mImages[0]->setClampCubemap (TRUE, TRUE); +} + +LLVector3 LLCubeMap::map(U8 side, U16 v_val, U16 h_val) const +{ + LLVector3 dir; + + const U8 curr_coef = side >> 1; // 0/1 = X axis, 2/3 = Y, 4/5 = Z + const S8 side_dir = (((side & 1) << 1) - 1); // even = -1, odd = 1 + const U8 i_coef = (curr_coef + 1) % 3; + const U8 j_coef = (i_coef + 1) % 3; + + dir.mV[curr_coef] = side_dir; + + switch (side) + { + case 0: // negative X + dir.mV[i_coef] = -F32((v_val<<1) + 1) / RESOLUTION + 1; + dir.mV[j_coef] = F32((h_val<<1) + 1) / RESOLUTION - 1; + break; + case 1: // positive X + dir.mV[i_coef] = -F32((v_val<<1) + 1) / RESOLUTION + 1; + dir.mV[j_coef] = -F32((h_val<<1) + 1) / RESOLUTION + 1; + break; + case 2: // negative Y + dir.mV[i_coef] = -F32((v_val<<1) + 1) / RESOLUTION + 1; + dir.mV[j_coef] = F32((h_val<<1) + 1) / RESOLUTION - 1; + break; + case 3: // positive Y + dir.mV[i_coef] = F32((v_val<<1) + 1) / RESOLUTION - 1; + dir.mV[j_coef] = F32((h_val<<1) + 1) / RESOLUTION - 1; + break; + case 4: // negative Z + dir.mV[i_coef] = -F32((h_val<<1) + 1) / RESOLUTION + 1; + dir.mV[j_coef] = -F32((v_val<<1) + 1) / RESOLUTION + 1; + break; + case 5: // positive Z + dir.mV[i_coef] = -F32((h_val<<1) + 1) / RESOLUTION + 1; + dir.mV[j_coef] = F32((v_val<<1) + 1) / RESOLUTION - 1; + break; + default: + dir.mV[i_coef] = F32((v_val<<1) + 1) / RESOLUTION - 1; + dir.mV[j_coef] = F32((h_val<<1) + 1) / RESOLUTION - 1; + } + + dir.normVec(); + return dir; +} + + +BOOL LLCubeMap::project(F32& v_val, F32& h_val, BOOL& outside, + U8 side, const LLVector3& dir) const +{ + const U8 curr_coef = side >> 1; // 0/1 = X axis, 2/3 = Y, 4/5 = Z + const S8 side_dir = (((side & 1) << 1) - 1); // even = -1, odd = 1 + const U8 i_coef = (curr_coef + 1) % 3; + const U8 j_coef = (i_coef + 1) % 3; + + outside = TRUE; + if (side_dir * dir.mV[curr_coef] < 0) + return FALSE; + + LLVector3 ray; + + F32 norm_val = fabs(dir.mV[curr_coef]); + + if (norm_val < epsilon) + norm_val = 1e-5f; + + ray.mV[curr_coef] = side_dir; + ray.mV[i_coef] = dir.mV[i_coef] / norm_val; + ray.mV[j_coef] = dir.mV[j_coef] / norm_val; + + + const F32 i_val = (ray.mV[i_coef] + 1) * 0.5f * RESOLUTION; + const F32 j_val = (ray.mV[j_coef] + 1) * 0.5f * RESOLUTION; + + switch (side) + { + case 0: // negative X + v_val = RESOLUTION - i_val; + h_val = j_val; + break; + case 1: // positive X + v_val = RESOLUTION - i_val; + h_val = RESOLUTION - j_val; + break; + case 2: // negative Y + v_val = RESOLUTION - i_val; + h_val = j_val; + break; + case 3: // positive Y + v_val = i_val; + h_val = j_val; + break; + case 4: // negative Z + v_val = RESOLUTION - j_val; + h_val = RESOLUTION - i_val; + break; + case 5: // positive Z + v_val = RESOLUTION - j_val; + h_val = i_val; + break; + default: + v_val = i_val; + h_val = j_val; + } + + outside = ((v_val < 0) || (v_val > RESOLUTION) || + (h_val < 0) || (h_val > RESOLUTION)); + + return TRUE; +} + +BOOL LLCubeMap::project(F32& v_min, F32& v_max, F32& h_min, F32& h_max, + U8 side, LLVector3 dir[4]) const +{ + v_min = h_min = RESOLUTION; + v_max = h_max = 0; + + BOOL fully_outside = TRUE; + for (U8 vtx = 0; vtx < 4; ++vtx) + { + F32 v_val, h_val; + BOOL outside; + BOOL consider = project(v_val, h_val, outside, side, dir[vtx]); + if (!outside) + fully_outside = FALSE; + if (consider) + { + if (v_val < v_min) v_min = v_val; + if (v_val > v_max) v_max = v_val; + if (h_val < h_min) h_min = h_val; + if (h_val > h_max) h_max = h_val; + } + } + + v_min = llmax(0.0f, v_min); + v_max = llmin(RESOLUTION - epsilon, v_max); + h_min = llmax(0.0f, h_min); + h_max = llmin(RESOLUTION - epsilon, h_max); + + return !fully_outside; +} + + +void LLCubeMap::paintIn(LLVector3 dir[4], const LLColor4U& col) +{ + F32 v_min, v_max, h_min, h_max; + LLVector3 center = dir[0] + dir[1] + dir[2] + dir[3]; + center.normVec(); + + for (U8 side = 0; side < 6; ++side) + { + if (!project(v_min, v_max, h_min, h_max, side, dir)) + continue; + + U8 *td = mRawImages[side]->getData(); + + U16 v_minu = (U16) v_min; + U16 v_maxu = (U16) (ceil(v_max) + 0.5); + U16 h_minu = (U16) h_min; + U16 h_maxu = (U16) (ceil(h_max) + 0.5); + + for (U16 v = v_minu; v < v_maxu; ++v) + for (U16 h = h_minu; h < h_maxu; ++h) + //for (U16 v = 0; v < RESOLUTION; ++v) + // for (U16 h = 0; h < RESOLUTION; ++h) + { + const LLVector3 ray = map(side, v, h); + if (ray * center > 0.999) + { + const U32 offset = (RESOLUTION * v + h) * 4; + for (U8 cc = 0; cc < 3; ++cc) + td[offset + cc] = U8((td[offset + cc] + col.mV[cc]) * 0.5); + } + } + mImages[side]->setSubImage(mRawImages[side], 0, 0, 64, 64); + } +} + +void LLCubeMap::destroyGL() +{ + for (S32 i = 0; i < 6; i++) + { + mImages[i] = NULL; + } +} diff --git a/linden/indra/llrender/llcubemap.h b/linden/indra/llrender/llcubemap.h new file mode 100644 index 0000000..45bfa16 --- /dev/null +++ b/linden/indra/llrender/llcubemap.h @@ -0,0 +1,89 @@ +/** + * @file llcubemap.h + * @brief LLCubeMap class definition + * + * $LicenseInfo:firstyear=2002&license=viewergpl$ + * + * Copyright (c) 2002-2008, Linden Research, Inc. + * + * Second Life Viewer Source Code + * 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://secondlifegrid.net/programs/open_source/licensing/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://secondlifegrid.net/programs/open_source/licensing/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. + * $/LicenseInfo$ + */ + +#ifndef LL_LLCUBEMAP_H +#define LL_LLCUBEMAP_H + +#include "llgl.h" + +#include + +class LLVector3; + +// Environment map hack! +class LLCubeMap : public LLRefCount +{ +public: + LLCubeMap(); + void init(const std::vector >& rawimages); + void initGL(); + void initRawData(const std::vector >& rawimages); + void initGLData(); + + void bind(); + void enable(S32 stage); + + void enableTexture(S32 stage); + void enableTextureCoords(S32 stage); + + void disable(void); + void disableTexture(void); + void disableTextureCoords(void); + void setMatrix(S32 stage); + void restoreMatrix(); + void setReflection (void); + + void finishPaint(); + + GLuint getGLName(); + + LLVector3 map(U8 side, U16 v_val, U16 h_val) const; + BOOL project(F32& v_val, F32& h_val, BOOL& outside, + U8 side, const LLVector3& dir) const; + BOOL project(F32& v_min, F32& v_max, F32& h_min, F32& h_max, + U8 side, LLVector3 dir[4]) const; + void paintIn(LLVector3 dir[4], const LLColor4U& col); + void destroyGL(); + +public: + static bool sUseCubeMaps; + +protected: + ~LLCubeMap(); + LLGLenum mTargets[6]; + LLPointer mImages[6]; + LLPointer mRawImages[6]; + S32 mTextureStage; + S32 mTextureCoordStage; + S32 mMatrixStage; +}; + +#endif diff --git a/linden/indra/llrender/llfont.h b/linden/indra/llrender/llfont.h index 071e508..d937dfd 100644 --- a/linden/indra/llrender/llfont.h +++ b/linden/indra/llrender/llfont.h @@ -121,11 +121,11 @@ public: // ^ ^ // | | // xxx x |Ascender -// x x | | +// x x v | // --------- xxxx-------------- Baseline -// ^ x | | -// | descender x | | -// v xxxx v |LineHeight +// ^ x | +// | Descender x | +// v xxxx |LineHeight // ----------------------- | // v // ------------------------------ diff --git a/linden/indra/llrender/llfontgl.cpp b/linden/indra/llrender/llfontgl.cpp index 253bf50..a328196 100644 --- a/linden/indra/llrender/llfontgl.cpp +++ b/linden/indra/llrender/llfontgl.cpp @@ -48,7 +48,7 @@ F32 LLFontGL::sHorizDPI = 96.f; F32 LLFontGL::sScaleX = 1.f; F32 LLFontGL::sScaleY = 1.f; BOOL LLFontGL::sDisplayFont = TRUE ; -LLString LLFontGL::sAppDir; +std::string LLFontGL::sAppDir; LLFontGL* LLFontGL::sMonospace = NULL; LLFontGL* LLFontGL::sSansSerifSmall = NULL; @@ -93,7 +93,7 @@ F32 llfont_round_y(F32 y) } // static -U8 LLFontGL::getStyleFromString(const LLString &style) +U8 LLFontGL::getStyleFromString(const std::string &style) { S32 ret = 0; if (style.find("NORMAL") != style.npos) @@ -166,9 +166,9 @@ void LLFontGL::reset() } // static -LLString LLFontGL::getFontPathSystem() +std::string LLFontGL::getFontPathSystem() { - LLString system_path; + std::string system_path; // Try to figure out where the system's font files are stored. char *system_root = NULL; @@ -199,9 +199,9 @@ LLString LLFontGL::getFontPathSystem() // static -LLString LLFontGL::getFontPathLocal() +std::string LLFontGL::getFontPathLocal() { - LLString local_path; + std::string local_path; // Backup files if we can't load from system fonts directory. // We could store this in an end-user writable directory to allow @@ -220,10 +220,10 @@ LLString LLFontGL::getFontPathLocal() } //static -bool LLFontGL::loadFaceFallback(LLFontList *fontlistp, const LLString& fontname, const F32 point_size) +bool LLFontGL::loadFaceFallback(LLFontList *fontlistp, const std::string& fontname, const F32 point_size) { - LLString local_path = getFontPathLocal(); - LLString sys_path = getFontPathSystem(); + std::string local_path = getFontPathLocal(); + std::string sys_path = getFontPathSystem(); // The fontname string may contain multiple font file names separated by semicolons. // Break it apart and try loading each one, in order. @@ -235,7 +235,7 @@ bool LLFontGL::loadFaceFallback(LLFontList *fontlistp, const LLString& fontname, for(token_iter = tokens.begin(); token_iter != tokens.end(); ++token_iter) { LLFont *fontp = new LLFont(); - LLString font_path = local_path + *token_iter; + std::string font_path = local_path + *token_iter; if (!fontp->loadFace(font_path, point_size, sVertDPI, sHorizDPI, 2, TRUE)) { font_path = sys_path + *token_iter; @@ -258,13 +258,13 @@ bool LLFontGL::loadFaceFallback(LLFontList *fontlistp, const LLString& fontname, } //static -bool LLFontGL::loadFace(LLFontGL *fontp, const LLString& fontname, const F32 point_size, LLFontList *fallback_fontp) +bool LLFontGL::loadFace(LLFontGL *fontp, const std::string& fontname, const F32 point_size, LLFontList *fallback_fontp) { - LLString local_path = getFontPathLocal(); - LLString font_path = local_path + fontname; + std::string local_path = getFontPathLocal(); + std::string font_path = local_path + fontname; if (!fontp->loadFace(font_path, point_size, sVertDPI, sHorizDPI, 2, FALSE)) { - LLString sys_path = getFontPathSystem(); + std::string sys_path = getFontPathSystem(); font_path = sys_path + fontname; if (!fontp->loadFace(font_path, point_size, sVertDPI, sHorizDPI, 2, FALSE)) { @@ -280,12 +280,12 @@ bool LLFontGL::loadFace(LLFontGL *fontp, const LLString& fontname, const F32 poi // static BOOL LLFontGL::initDefaultFonts(F32 screen_dpi, F32 x_scale, F32 y_scale, - const LLString& monospace_file, F32 monospace_size, - const LLString& sansserif_file, - const LLString& sanserif_fallback_file, F32 ss_fallback_scale, + const std::string& monospace_file, F32 monospace_size, + const std::string& sansserif_file, + const std::string& sanserif_fallback_file, F32 ss_fallback_scale, F32 small_size, F32 medium_size, F32 big_size, F32 huge_size, - const LLString& sansserif_bold_file, F32 bold_size, - const LLString& app_dir) + const std::string& sansserif_bold_file, F32 bold_size, + const std::string& app_dir) { BOOL failed = FALSE; sVertDPI = (F32)llfloor(screen_dpi * y_scale); @@ -554,7 +554,7 @@ BOOL LLFontGL::addChar(const llwchar wch) } -S32 LLFontGL::renderUTF8(const LLString &text, const S32 offset, +S32 LLFontGL::renderUTF8(const std::string &text, const S32 offset, const F32 x, const F32 y, const LLColor4 &color, const HAlign halign, const VAlign valign, @@ -726,7 +726,7 @@ S32 LLFontGL::render(const LLWString &wstr, if (getWidthF32(wstr.c_str(), 0, max_chars) * sScaleX > scaled_max_pixels) { // use four dots for ellipsis width to generate padding - const LLWString dots(utf8str_to_wstring(LLString("...."))); + const LLWString dots(utf8str_to_wstring(std::string("...."))); scaled_max_pixels = llmax(0, scaled_max_pixels - llround(getWidthF32(dots.c_str()))); draw_ellipses = TRUE; } @@ -879,7 +879,7 @@ S32 LLFontGL::render(const LLWString &wstr, //glLoadIdentity(); //gGL.translatef(sCurOrigin.mX, sCurOrigin.mY, 0.0f); //glScalef(sScaleX, sScaleY, 1.f); - renderUTF8("...", + renderUTF8(std::string("..."), 0, cur_x / sScaleX, (F32)y, color, @@ -902,7 +902,7 @@ LLImageGL *LLFontGL::getImageGL() const return mImageGLp; } -S32 LLFontGL::getWidth(const LLString& utf8text) const +S32 LLFontGL::getWidth(const std::string& utf8text) const { LLWString wtext = utf8str_to_wstring(utf8text); return getWidth(wtext.c_str(), 0, S32_MAX); @@ -913,7 +913,7 @@ S32 LLFontGL::getWidth(const llwchar* wchars) const return getWidth(wchars, 0, S32_MAX); } -S32 LLFontGL::getWidth(const LLString& utf8text, const S32 begin_offset, const S32 max_chars) const +S32 LLFontGL::getWidth(const std::string& utf8text, const S32 begin_offset, const S32 max_chars) const { LLWString wtext = utf8str_to_wstring(utf8text); return getWidth(wtext.c_str(), begin_offset, max_chars); @@ -925,7 +925,7 @@ S32 LLFontGL::getWidth(const llwchar* wchars, const S32 begin_offset, const S32 return llround(width); } -F32 LLFontGL::getWidthF32(const LLString& utf8text) const +F32 LLFontGL::getWidthF32(const std::string& utf8text) const { LLWString wtext = utf8str_to_wstring(utf8text); return getWidthF32(wtext.c_str(), 0, S32_MAX); @@ -936,7 +936,7 @@ F32 LLFontGL::getWidthF32(const llwchar* wchars) const return getWidthF32(wchars, 0, S32_MAX); } -F32 LLFontGL::getWidthF32(const LLString& utf8text, const S32 begin_offset, const S32 max_chars ) const +F32 LLFontGL::getWidthF32(const std::string& utf8text, const S32 begin_offset, const S32 max_chars ) const { LLWString wtext = utf8str_to_wstring(utf8text); return getWidthF32(wtext.c_str(), begin_offset, max_chars); @@ -1312,7 +1312,7 @@ void LLFontGL::clearEmbeddedChars() mEmbeddedChars.clear(); } -void LLFontGL::addEmbeddedChar( llwchar wc, LLImageGL* image, const LLString& label ) +void LLFontGL::addEmbeddedChar( llwchar wc, LLImageGL* image, const std::string& label ) { LLWString wlabel = utf8str_to_wstring(label); addEmbeddedChar(wc, image, wlabel); @@ -1429,40 +1429,40 @@ void LLFontGL::drawGlyph(const LLRectf& screen_rect, const LLRectf& uv_rect, con } // static -LLString LLFontGL::nameFromFont(const LLFontGL* fontp) +std::string LLFontGL::nameFromFont(const LLFontGL* fontp) { if (fontp == sSansSerifHuge) { - return LLString("SansSerifHuge"); + return std::string("SansSerifHuge"); } else if (fontp == sSansSerifSmall) { - return LLString("SansSerifSmall"); + return std::string("SansSerifSmall"); } else if (fontp == sSansSerif) { - return LLString("SansSerif"); + return std::string("SansSerif"); } else if (fontp == sSansSerifBig) { - return LLString("SansSerifBig"); + return std::string("SansSerifBig"); } else if (fontp == sSansSerifBold) { - return LLString("SansSerifBold"); + return std::string("SansSerifBold"); } else if (fontp == sMonospace) { - return LLString("Monospace"); + return std::string("Monospace"); } else { - return LLString(); + return std::string(); } } // static -LLFontGL* LLFontGL::fontFromName(const LLString& font_name) +LLFontGL* LLFontGL::fontFromName(const std::string& font_name) { LLFontGL* gl_font = NULL; if (font_name == "SansSerifHuge") @@ -1493,16 +1493,16 @@ LLFontGL* LLFontGL::fontFromName(const LLString& font_name) } // static -LLString LLFontGL::nameFromHAlign(LLFontGL::HAlign align) +std::string LLFontGL::nameFromHAlign(LLFontGL::HAlign align) { - if (align == LEFT) return LLString("left"); - else if (align == RIGHT) return LLString("right"); - else if (align == HCENTER) return LLString("center"); - else return LLString(); + if (align == LEFT) return std::string("left"); + else if (align == RIGHT) return std::string("right"); + else if (align == HCENTER) return std::string("center"); + else return std::string(); } // static -LLFontGL::HAlign LLFontGL::hAlignFromName(const LLString& name) +LLFontGL::HAlign LLFontGL::hAlignFromName(const std::string& name) { LLFontGL::HAlign gl_hfont_align = LLFontGL::LEFT; if (name == "left") @@ -1522,17 +1522,17 @@ LLFontGL::HAlign LLFontGL::hAlignFromName(const LLString& name) } // static -LLString LLFontGL::nameFromVAlign(LLFontGL::VAlign align) +std::string LLFontGL::nameFromVAlign(LLFontGL::VAlign align) { - if (align == TOP) return LLString("top"); - else if (align == VCENTER) return LLString("center"); - else if (align == BASELINE) return LLString("baseline"); - else if (align == BOTTOM) return LLString("bottom"); - else return LLString(); + if (align == TOP) return std::string("top"); + else if (align == VCENTER) return std::string("center"); + else if (align == BASELINE) return std::string("baseline"); + else if (align == BOTTOM) return std::string("bottom"); + else return std::string(); } // static -LLFontGL::VAlign LLFontGL::vAlignFromName(const LLString& name) +LLFontGL::VAlign LLFontGL::vAlignFromName(const std::string& name) { LLFontGL::VAlign gl_vfont_align = LLFontGL::BASELINE; if (name == "top") diff --git a/linden/indra/llrender/llfontgl.h b/linden/indra/llrender/llfontgl.h index 01046af..3f88e62 100644 --- a/linden/indra/llrender/llfontgl.h +++ b/linden/indra/llrender/llfontgl.h @@ -73,7 +73,7 @@ public: }; // Takes a string with potentially several flags, i.e. "NORMAL|BOLD|ITALIC" - static U8 getStyleFromString(const LLString &style); + static U8 getStyleFromString(const std::string &style); LLFontGL(); LLFontGL(const LLFontGL &source); @@ -85,24 +85,24 @@ public: LLFontGL &operator=(const LLFontGL &source); static BOOL initDefaultFonts(F32 screen_dpi, F32 x_scale, F32 y_scale, - const LLString& monospace_file, F32 monospace_size, - const LLString& sansserif_file, - const LLString& sansserif_fallback_file, F32 ss_fallback_scale, + const std::string& monospace_file, F32 monospace_size, + const std::string& sansserif_file, + const std::string& sansserif_fallback_file, F32 ss_fallback_scale, F32 small_size, F32 medium_size, F32 large_size, F32 huge_size, - const LLString& sansserif_bold_file, F32 bold_size, - const LLString& app_dir = LLString::null); + const std::string& sansserif_bold_file, F32 bold_size, + const std::string& app_dir = LLStringUtil::null); static void destroyDefaultFonts(); static void destroyGL(); - static bool loadFaceFallback(LLFontList *fontp, const LLString& fontname, const F32 point_size); - static bool loadFace(LLFontGL *fontp, const LLString& fontname, const F32 point_size, LLFontList *fallback_fontp); + static bool loadFaceFallback(LLFontList *fontp, const std::string& fontname, const F32 point_size); + static bool loadFace(LLFontGL *fontp, const std::string& fontname, const F32 point_size, LLFontList *fallback_fontp); /* virtual*/ BOOL loadFace(const std::string& filename, const F32 point_size, const F32 vert_dpi, const F32 horz_dpi, const S32 components, BOOL is_fallback); - S32 renderUTF8(const LLString &text, const S32 begin_offset, + S32 renderUTF8(const std::string &text, const S32 begin_offset, S32 x, S32 y, const LLColor4 &color) const { @@ -111,7 +111,7 @@ public: S32_MAX, S32_MAX, NULL, FALSE); } - S32 renderUTF8(const LLString &text, const S32 begin_offset, + S32 renderUTF8(const std::string &text, const S32 begin_offset, S32 x, S32 y, const LLColor4 &color, HAlign halign, VAlign valign, U8 style = NORMAL) const @@ -122,7 +122,7 @@ public: } // renderUTF8 does a conversion, so is slower! - S32 renderUTF8(const LLString &text, + S32 renderUTF8(const std::string &text, S32 begin_offset, F32 x, F32 y, const LLColor4 &color, @@ -162,14 +162,14 @@ public: /*virtual*/ F32 getAscenderHeight() const { return (F32)llround(mAscender / sScaleY); } /*virtual*/ F32 getDescenderHeight() const { return (F32)llround(mDescender / sScaleY); } - virtual S32 getWidth(const LLString& utf8text) const; + virtual S32 getWidth(const std::string& utf8text) const; virtual S32 getWidth(const llwchar* wchars) const; - virtual S32 getWidth(const LLString& utf8text, const S32 offset, const S32 max_chars ) const; + virtual S32 getWidth(const std::string& utf8text, const S32 offset, const S32 max_chars ) const; virtual S32 getWidth(const llwchar* wchars, const S32 offset, const S32 max_chars, BOOL use_embedded = FALSE) const; - virtual F32 getWidthF32(const LLString& utf8text) const; + virtual F32 getWidthF32(const std::string& utf8text) const; virtual F32 getWidthF32(const llwchar* wchars) const; - virtual F32 getWidthF32(const LLString& text, const S32 offset, const S32 max_chars ) const; + virtual F32 getWidthF32(const std::string& text, const S32 offset, const S32 max_chars ) const; virtual F32 getWidthF32(const llwchar* wchars, const S32 offset, const S32 max_chars, BOOL use_embedded = FALSE ) const; // The following are called often, frequently with large buffers, so do not use a string interface @@ -191,18 +191,18 @@ public: LLImageGL *getImageGL() const; - void addEmbeddedChar( llwchar wc, LLImageGL* image, const LLString& label); + void addEmbeddedChar( llwchar wc, LLImageGL* image, const std::string& label); void addEmbeddedChar( llwchar wc, LLImageGL* image, const LLWString& label); void removeEmbeddedChar( llwchar wc ); - static LLString nameFromFont(const LLFontGL* fontp); - static LLFontGL* fontFromName(const LLString& name); + static std::string nameFromFont(const LLFontGL* fontp); + static LLFontGL* fontFromName(const std::string& name); - static LLString nameFromHAlign(LLFontGL::HAlign align); - static LLFontGL::HAlign hAlignFromName(const LLString& name); + static std::string nameFromHAlign(LLFontGL::HAlign align); + static LLFontGL::HAlign hAlignFromName(const std::string& name); - static LLString nameFromVAlign(LLFontGL::VAlign align); - static LLFontGL::VAlign vAlignFromName(const LLString& name); + static std::string nameFromVAlign(LLFontGL::VAlign align); + static LLFontGL::VAlign vAlignFromName(const std::string& name); static void setFontDisplay(BOOL flag) { sDisplayFont = flag ; } @@ -225,7 +225,7 @@ public: static F32 sScaleX; static F32 sScaleY; static BOOL sDisplayFont ; - static LLString sAppDir; // For loading fonts + static std::string sAppDir; // For loading fonts static LLFontGL* sMonospace; // medium static LLFontList* sMonospaceFallback; @@ -249,8 +249,8 @@ public: protected: /*virtual*/ BOOL addChar(const llwchar wch); - static LLString getFontPathLocal(); - static LLString getFontPathSystem(); + static std::string getFontPathLocal(); + static std::string getFontPathSystem(); protected: LLPointer mRawImageGLp; diff --git a/linden/indra/llrender/llgl.cpp b/linden/indra/llrender/llgl.cpp new file mode 100644 index 0000000..843bc79 --- /dev/null +++ b/linden/indra/llrender/llgl.cpp @@ -0,0 +1,1763 @@ +/** + * @file llgl.cpp + * @brief LLGL implementation + * + * $LicenseInfo:firstyear=2001&license=viewergpl$ + * + * Copyright (c) 2001-2008, Linden Research, Inc. + * + * Second Life Viewer Source Code + * 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://secondlifegrid.net/programs/open_source/licensing/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://secondlifegrid.net/programs/open_source/licensing/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. + * $/LicenseInfo$ + */ + +// This file sets some global GL parameters, and implements some +// useful functions for GL operations. + +#define GLH_EXT_SINGLE_FILE + +#include "linden_common.h" + +#include "boost/tokenizer.hpp" + +#include "llsys.h" + +#include "llgl.h" +#include "llrender.h" + +#include "llerror.h" +#include "llquaternion.h" +#include "llmath.h" +#include "m4math.h" +#include "llstring.h" + +#include "llglheaders.h" + +#ifdef _DEBUG +//#define GL_STATE_VERIFY +#endif + +BOOL gDebugGL = FALSE; +BOOL gClothRipple = FALSE; +BOOL gNoRender = FALSE; +LLMatrix4 gGLObliqueProjectionInverse; + +#define LL_GL_NAME_POOLING 0 + +LLGLNamePool::pool_list_t LLGLNamePool::sInstances; + +#if (LL_WINDOWS || LL_LINUX) && !LL_MESA_HEADLESS +// ATI prototypes +// vertex blending prototypes +PFNGLWEIGHTPOINTERARBPROC glWeightPointerARB = NULL; +PFNGLVERTEXBLENDARBPROC glVertexBlendARB = NULL; +PFNGLWEIGHTFVARBPROC glWeightfvARB = NULL; + +// Vertex buffer object prototypes +PFNGLBINDBUFFERARBPROC glBindBufferARB = NULL; +PFNGLDELETEBUFFERSARBPROC glDeleteBuffersARB = NULL; +PFNGLGENBUFFERSARBPROC glGenBuffersARB = NULL; +PFNGLISBUFFERARBPROC glIsBufferARB = NULL; +PFNGLBUFFERDATAARBPROC glBufferDataARB = NULL; +PFNGLBUFFERSUBDATAARBPROC glBufferSubDataARB = NULL; +PFNGLGETBUFFERSUBDATAARBPROC glGetBufferSubDataARB = NULL; +PFNGLMAPBUFFERARBPROC glMapBufferARB = NULL; +PFNGLUNMAPBUFFERARBPROC glUnmapBufferARB = NULL; +PFNGLGETBUFFERPARAMETERIVARBPROC glGetBufferParameterivARB = NULL; +PFNGLGETBUFFERPOINTERVARBPROC glGetBufferPointervARB = NULL; + +// vertex object prototypes +PFNGLNEWOBJECTBUFFERATIPROC glNewObjectBufferATI = NULL; +PFNGLISOBJECTBUFFERATIPROC glIsObjectBufferATI = NULL; +PFNGLUPDATEOBJECTBUFFERATIPROC glUpdateObjectBufferATI = NULL; +PFNGLGETOBJECTBUFFERFVATIPROC glGetObjectBufferfvATI = NULL; +PFNGLGETOBJECTBUFFERIVATIPROC glGetObjectBufferivATI = NULL; +PFNGLFREEOBJECTBUFFERATIPROC glFreeObjectBufferATI = NULL; +PFNGLARRAYOBJECTATIPROC glArrayObjectATI = NULL; +PFNGLVERTEXATTRIBARRAYOBJECTATIPROC glVertexAttribArrayObjectATI = NULL; +PFNGLGETARRAYOBJECTFVATIPROC glGetArrayObjectfvATI = NULL; +PFNGLGETARRAYOBJECTIVATIPROC glGetArrayObjectivATI = NULL; +PFNGLVARIANTARRAYOBJECTATIPROC glVariantObjectArrayATI = NULL; +PFNGLGETVARIANTARRAYOBJECTFVATIPROC glGetVariantArrayObjectfvATI = NULL; +PFNGLGETVARIANTARRAYOBJECTIVATIPROC glGetVariantArrayObjectivATI = NULL; + +// GL_ARB_occlusion_query +PFNGLGENQUERIESARBPROC glGenQueriesARB = NULL; +PFNGLDELETEQUERIESARBPROC glDeleteQueriesARB = NULL; +PFNGLISQUERYARBPROC glIsQueryARB = NULL; +PFNGLBEGINQUERYARBPROC glBeginQueryARB = NULL; +PFNGLENDQUERYARBPROC glEndQueryARB = NULL; +PFNGLGETQUERYIVARBPROC glGetQueryivARB = NULL; +PFNGLGETQUERYOBJECTIVARBPROC glGetQueryObjectivARB = NULL; +PFNGLGETQUERYOBJECTUIVARBPROC glGetQueryObjectuivARB = NULL; + +// GL_ARB_point_parameters +PFNGLPOINTPARAMETERFARBPROC glPointParameterfARB = NULL; +PFNGLPOINTPARAMETERFVARBPROC glPointParameterfvARB = NULL; + +// GL_EXT_framebuffer_object +PFNGLISRENDERBUFFEREXTPROC glIsRenderbufferEXT = NULL; +PFNGLBINDRENDERBUFFEREXTPROC glBindRenderbufferEXT = NULL; +PFNGLDELETERENDERBUFFERSEXTPROC glDeleteRenderbuffersEXT = NULL; +PFNGLGENRENDERBUFFERSEXTPROC glGenRenderbuffersEXT = NULL; +PFNGLRENDERBUFFERSTORAGEEXTPROC glRenderbufferStorageEXT = NULL; +PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC glGetRenderbufferParameterivEXT = NULL; +PFNGLISFRAMEBUFFEREXTPROC glIsFramebufferEXT = NULL; +PFNGLBINDFRAMEBUFFEREXTPROC glBindFramebufferEXT = NULL; +PFNGLDELETEFRAMEBUFFERSEXTPROC glDeleteFramebuffersEXT = NULL; +PFNGLGENFRAMEBUFFERSEXTPROC glGenFramebuffersEXT = NULL; +PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC glCheckFramebufferStatusEXT = NULL; +PFNGLFRAMEBUFFERTEXTURE1DEXTPROC glFramebufferTexture1DEXT = NULL; +PFNGLFRAMEBUFFERTEXTURE2DEXTPROC glFramebufferTexture2DEXT = NULL; +PFNGLFRAMEBUFFERTEXTURE3DEXTPROC glFramebufferTexture3DEXT = NULL; +PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC glFramebufferRenderbufferEXT = NULL; +PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC glGetFramebufferAttachmentParameterivEXT = NULL; +PFNGLGENERATEMIPMAPEXTPROC glGenerateMipmapEXT = NULL; + +//shader object prototypes +PFNGLDELETEOBJECTARBPROC glDeleteObjectARB = NULL; +PFNGLGETHANDLEARBPROC glGetHandleARB = NULL; +PFNGLDETACHOBJECTARBPROC glDetachObjectARB = NULL; +PFNGLCREATESHADEROBJECTARBPROC glCreateShaderObjectARB = NULL; +PFNGLSHADERSOURCEARBPROC glShaderSourceARB = NULL; +PFNGLCOMPILESHADERARBPROC glCompileShaderARB = NULL; +PFNGLCREATEPROGRAMOBJECTARBPROC glCreateProgramObjectARB = NULL; +PFNGLATTACHOBJECTARBPROC glAttachObjectARB = NULL; +PFNGLLINKPROGRAMARBPROC glLinkProgramARB = NULL; +PFNGLUSEPROGRAMOBJECTARBPROC glUseProgramObjectARB = NULL; +PFNGLVALIDATEPROGRAMARBPROC glValidateProgramARB = NULL; +PFNGLUNIFORM1FARBPROC glUniform1fARB = NULL; +PFNGLUNIFORM2FARBPROC glUniform2fARB = NULL; +PFNGLUNIFORM3FARBPROC glUniform3fARB = NULL; +PFNGLUNIFORM4FARBPROC glUniform4fARB = NULL; +PFNGLUNIFORM1IARBPROC glUniform1iARB = NULL; +PFNGLUNIFORM2IARBPROC glUniform2iARB = NULL; +PFNGLUNIFORM3IARBPROC glUniform3iARB = NULL; +PFNGLUNIFORM4IARBPROC glUniform4iARB = NULL; +PFNGLUNIFORM1FVARBPROC glUniform1fvARB = NULL; +PFNGLUNIFORM2FVARBPROC glUniform2fvARB = NULL; +PFNGLUNIFORM3FVARBPROC glUniform3fvARB = NULL; +PFNGLUNIFORM4FVARBPROC glUniform4fvARB = NULL; +PFNGLUNIFORM1IVARBPROC glUniform1ivARB = NULL; +PFNGLUNIFORM2IVARBPROC glUniform2ivARB = NULL; +PFNGLUNIFORM3IVARBPROC glUniform3ivARB = NULL; +PFNGLUNIFORM4IVARBPROC glUniform4ivARB = NULL; +PFNGLUNIFORMMATRIX2FVARBPROC glUniformMatrix2fvARB = NULL; +PFNGLUNIFORMMATRIX3FVARBPROC glUniformMatrix3fvARB = NULL; +PFNGLUNIFORMMATRIX4FVARBPROC glUniformMatrix4fvARB = NULL; +PFNGLGETOBJECTPARAMETERFVARBPROC glGetObjectParameterfvARB = NULL; +PFNGLGETOBJECTPARAMETERIVARBPROC glGetObjectParameterivARB = NULL; +PFNGLGETINFOLOGARBPROC glGetInfoLogARB = NULL; +PFNGLGETATTACHEDOBJECTSARBPROC glGetAttachedObjectsARB = NULL; +PFNGLGETUNIFORMLOCATIONARBPROC glGetUniformLocationARB = NULL; +PFNGLGETACTIVEUNIFORMARBPROC glGetActiveUniformARB = NULL; +PFNGLGETUNIFORMFVARBPROC glGetUniformfvARB = NULL; +PFNGLGETUNIFORMIVARBPROC glGetUniformivARB = NULL; +PFNGLGETSHADERSOURCEARBPROC glGetShaderSourceARB = NULL; + +// vertex shader prototypes +#if LL_LINUX +PFNGLVERTEXATTRIB1DARBPROC glVertexAttrib1dARB = NULL; +PFNGLVERTEXATTRIB1DVARBPROC glVertexAttrib1dvARB = NULL; +PFNGLVERTEXATTRIB1FARBPROC glVertexAttrib1fARB = NULL; +PFNGLVERTEXATTRIB1FVARBPROC glVertexAttrib1fvARB = NULL; +PFNGLVERTEXATTRIB1SARBPROC glVertexAttrib1sARB = NULL; +PFNGLVERTEXATTRIB1SVARBPROC glVertexAttrib1svARB = NULL; +PFNGLVERTEXATTRIB2DARBPROC glVertexAttrib2dARB = NULL; +PFNGLVERTEXATTRIB2DVARBPROC glVertexAttrib2dvARB = NULL; +PFNGLVERTEXATTRIB2FARBPROC glVertexAttrib2fARB = NULL; +PFNGLVERTEXATTRIB2FVARBPROC glVertexAttrib2fvARB = NULL; +PFNGLVERTEXATTRIB2SARBPROC glVertexAttrib2sARB = NULL; +PFNGLVERTEXATTRIB2SVARBPROC glVertexAttrib2svARB = NULL; +PFNGLVERTEXATTRIB3DARBPROC glVertexAttrib3dARB = NULL; +PFNGLVERTEXATTRIB3DVARBPROC glVertexAttrib3dvARB = NULL; +PFNGLVERTEXATTRIB3FARBPROC glVertexAttrib3fARB = NULL; +PFNGLVERTEXATTRIB3FVARBPROC glVertexAttrib3fvARB = NULL; +PFNGLVERTEXATTRIB3SARBPROC glVertexAttrib3sARB = NULL; +PFNGLVERTEXATTRIB3SVARBPROC glVertexAttrib3svARB = NULL; +#endif // LL_LINUX +PFNGLVERTEXATTRIB4NBVARBPROC glVertexAttrib4nbvARB = NULL; +PFNGLVERTEXATTRIB4NIVARBPROC glVertexAttrib4nivARB = NULL; +PFNGLVERTEXATTRIB4NSVARBPROC glVertexAttrib4nsvARB = NULL; +PFNGLVERTEXATTRIB4NUBARBPROC glVertexAttrib4nubARB = NULL; +PFNGLVERTEXATTRIB4NUBVARBPROC glVertexAttrib4nubvARB = NULL; +PFNGLVERTEXATTRIB4NUIVARBPROC glVertexAttrib4nuivARB = NULL; +PFNGLVERTEXATTRIB4NUSVARBPROC glVertexAttrib4nusvARB = NULL; +#if LL_LINUX +PFNGLVERTEXATTRIB4BVARBPROC glVertexAttrib4bvARB = NULL; +PFNGLVERTEXATTRIB4DARBPROC glVertexAttrib4dARB = NULL; +PFNGLVERTEXATTRIB4DVARBPROC glVertexAttrib4dvARB = NULL; +PFNGLVERTEXATTRIB4FARBPROC glVertexAttrib4fARB = NULL; +PFNGLVERTEXATTRIB4FVARBPROC glVertexAttrib4fvARB = NULL; +PFNGLVERTEXATTRIB4IVARBPROC glVertexAttrib4ivARB = NULL; +PFNGLVERTEXATTRIB4SARBPROC glVertexAttrib4sARB = NULL; +PFNGLVERTEXATTRIB4SVARBPROC glVertexAttrib4svARB = NULL; +PFNGLVERTEXATTRIB4UBVARBPROC glVertexAttrib4ubvARB = NULL; +PFNGLVERTEXATTRIB4UIVARBPROC glVertexAttrib4uivARB = NULL; +PFNGLVERTEXATTRIB4USVARBPROC glVertexAttrib4usvARB = NULL; +PFNGLVERTEXATTRIBPOINTERARBPROC glVertexAttribPointerARB = NULL; +PFNGLENABLEVERTEXATTRIBARRAYARBPROC glEnableVertexAttribArrayARB = NULL; +PFNGLDISABLEVERTEXATTRIBARRAYARBPROC glDisableVertexAttribArrayARB = NULL; +PFNGLPROGRAMSTRINGARBPROC glProgramStringARB = NULL; +PFNGLBINDPROGRAMARBPROC glBindProgramARB = NULL; +PFNGLDELETEPROGRAMSARBPROC glDeleteProgramsARB = NULL; +PFNGLGENPROGRAMSARBPROC glGenProgramsARB = NULL; +PFNGLPROGRAMENVPARAMETER4DARBPROC glProgramEnvParameter4dARB = NULL; +PFNGLPROGRAMENVPARAMETER4DVARBPROC glProgramEnvParameter4dvARB = NULL; +PFNGLPROGRAMENVPARAMETER4FARBPROC glProgramEnvParameter4fARB = NULL; +PFNGLPROGRAMENVPARAMETER4FVARBPROC glProgramEnvParameter4fvARB = NULL; +PFNGLPROGRAMLOCALPARAMETER4DARBPROC glProgramLocalParameter4dARB = NULL; +PFNGLPROGRAMLOCALPARAMETER4DVARBPROC glProgramLocalParameter4dvARB = NULL; +PFNGLPROGRAMLOCALPARAMETER4FARBPROC glProgramLocalParameter4fARB = NULL; +PFNGLPROGRAMLOCALPARAMETER4FVARBPROC glProgramLocalParameter4fvARB = NULL; +PFNGLGETPROGRAMENVPARAMETERDVARBPROC glGetProgramEnvParameterdvARB = NULL; +PFNGLGETPROGRAMENVPARAMETERFVARBPROC glGetProgramEnvParameterfvARB = NULL; +PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC glGetProgramLocalParameterdvARB = NULL; +PFNGLGETPROGRAMLOCALPARAMETERFVARBPROC glGetProgramLocalParameterfvARB = NULL; +PFNGLGETPROGRAMIVARBPROC glGetProgramivARB = NULL; +PFNGLGETPROGRAMSTRINGARBPROC glGetProgramStringARB = NULL; +PFNGLGETVERTEXATTRIBDVARBPROC glGetVertexAttribdvARB = NULL; +PFNGLGETVERTEXATTRIBFVARBPROC glGetVertexAttribfvARB = NULL; +PFNGLGETVERTEXATTRIBIVARBPROC glGetVertexAttribivARB = NULL; +PFNGLGETVERTEXATTRIBPOINTERVARBPROC glGetVertexAttribPointervARB = NULL; +PFNGLISPROGRAMARBPROC glIsProgramARB = NULL; +#endif // LL_LINUX +PFNGLBINDATTRIBLOCATIONARBPROC glBindAttribLocationARB = NULL; +PFNGLGETACTIVEATTRIBARBPROC glGetActiveAttribARB = NULL; +PFNGLGETATTRIBLOCATIONARBPROC glGetAttribLocationARB = NULL; + +#if LL_WINDOWS +PFNWGLSWAPINTERVALEXTPROC wglSwapIntervalEXT = NULL; +#endif + +#if LL_LINUX +PFNGLCOLORTABLEEXTPROC glColorTableEXT = NULL; +#endif // LL_LINUX + +#endif + +LLGLManager gGLManager; + +LLGLManager::LLGLManager() : + mInited(FALSE), + mIsDisabled(FALSE), + + mHasMultitexture(FALSE), + mNumTextureUnits(1), + mHasMipMapGeneration(FALSE), + mHasPalettedTextures(FALSE), + mHasCompressedTextures(FALSE), + mHasFramebufferObject(FALSE), + + mHasVertexBufferObject(FALSE), + mHasPBuffer(FALSE), + mHasShaderObjects(FALSE), + mHasVertexShader(FALSE), + mHasFragmentShader(FALSE), + mHasOcclusionQuery(FALSE), + mHasPointParameters(FALSE), + + mHasAnisotropic(FALSE), + mHasARBEnvCombine(FALSE), + mHasCubeMap(FALSE), + + mIsATI(FALSE), + mIsNVIDIA(FALSE), + mIsIntel(FALSE), + mIsGF2or4MX(FALSE), + mIsGF3(FALSE), + mIsGFFX(FALSE), + mATIOffsetVerticalLines(FALSE), + mATIOldDriver(FALSE), + + mHasRequirements(TRUE), + + mHasSeparateSpecularColor(FALSE), + + mDriverVersionMajor(1), + mDriverVersionMinor(0), + mDriverVersionRelease(0), + mGLVersion(1.0f), + + mVRAM(0), + mGLMaxVertexRange(0), + mGLMaxIndexRange(0) +{ +} + +//--------------------------------------------------------------------- +// Global initialization for GL +//--------------------------------------------------------------------- +void LLGLManager::initWGL() +{ + mHasPBuffer = FALSE; +#if LL_WINDOWS && !LL_MESA_HEADLESS + if (!glh_init_extensions("WGL_ARB_pixel_format")) + { + LL_WARNS("RenderInit") << "No ARB pixel format extensions" << LL_ENDL; + } + + if (ExtensionExists("WGL_EXT_swap_control", gGLHExts.mSysExts)) + { + GLH_EXT_NAME(wglSwapIntervalEXT) = (PFNWGLSWAPINTERVALEXTPROC)GLH_EXT_GET_PROC_ADDRESS("wglSwapIntervalEXT"); + } + + if( !glh_init_extensions("WGL_ARB_pbuffer") ) + { + LL_WARNS("RenderInit") << "No ARB WGL PBuffer extensions" << LL_ENDL; + } + + if( !glh_init_extensions("WGL_ARB_render_texture") ) + { + LL_WARNS("RenderInit") << "No ARB WGL render texture extensions" << LL_ENDL; + } + + mHasPBuffer = ExtensionExists("WGL_ARB_pbuffer", gGLHExts.mSysExts) && + ExtensionExists("WGL_ARB_render_texture", gGLHExts.mSysExts) && + ExtensionExists("WGL_ARB_pixel_format", gGLHExts.mSysExts); +#endif +} + +// return false if unable (or unwilling due to old drivers) to init GL +bool LLGLManager::initGL() +{ + if (mInited) + { + LL_ERRS("RenderInit") << "Calling init on LLGLManager after already initialized!" << LL_ENDL; + } + + GLint alpha_bits; + glGetIntegerv( GL_ALPHA_BITS, &alpha_bits ); + if( 8 != alpha_bits ) + { + LL_WARNS("RenderInit") << "Frame buffer has less than 8 bits of alpha. Avatar texture compositing will fail." << LL_ENDL; + } + + // Extract video card strings and convert to upper case to + // work around driver-to-driver variation in capitalization. + mGLVendor = std::string((const char *)glGetString(GL_VENDOR)); + LLStringUtil::toUpper(mGLVendor); + + mGLRenderer = std::string((const char *)glGetString(GL_RENDERER)); + LLStringUtil::toUpper(mGLRenderer); + + parse_gl_version( &mDriverVersionMajor, + &mDriverVersionMinor, + &mDriverVersionRelease, + &mDriverVersionVendorString ); + + mGLVersion = mDriverVersionMajor + mDriverVersionMinor * .1f; + + // Trailing space necessary to keep "nVidia Corpor_ati_on" cards + // from being recognized as ATI. + if (mGLVendor.substr(0,4) == "ATI ") + { + mGLVendorShort = "ATI"; + BOOL mobile = FALSE; + if (mGLRenderer.find("MOBILITY") != std::string::npos) + { + mobile = TRUE; + } + mIsATI = TRUE; + +#if LL_WINDOWS && !LL_MESA_HEADLESS + if (mDriverVersionRelease < 3842) + { + mATIOffsetVerticalLines = TRUE; + } +#endif // LL_WINDOWS + +#if (LL_WINDOWS || LL_LINUX) && !LL_MESA_HEADLESS + // release 7277 is a point at which we verify that ATI OpenGL + // drivers get pretty stable with SL, ~Catalyst 8.2, + // for both Win32 and Linux. + if (mDriverVersionRelease < 7277 && + mDriverVersionRelease != 0) // 0 == Undetectable driver version - these get to pretend to be new ATI drivers, though that decision may be revisited. + { + mATIOldDriver = TRUE; + } +#endif // (LL_WINDOWS || LL_LINUX) && !LL_MESA_HEADLESS + } + else if (mGLVendor.find("NVIDIA ") != std::string::npos) + { + mGLVendorShort = "NVIDIA"; + mIsNVIDIA = TRUE; + if ( mGLRenderer.find("GEFORCE4 MX") != std::string::npos + || mGLRenderer.find("GEFORCE2") != std::string::npos + || mGLRenderer.find("GEFORCE 2") != std::string::npos + || mGLRenderer.find("GEFORCE4 460 GO") != std::string::npos + || mGLRenderer.find("GEFORCE4 440 GO") != std::string::npos + || mGLRenderer.find("GEFORCE4 420 GO") != std::string::npos) + { + mIsGF2or4MX = TRUE; + } + else if (mGLRenderer.find("GEFORCE FX") != std::string::npos + || mGLRenderer.find("QUADRO FX") != std::string::npos + || mGLRenderer.find("NV34") != std::string::npos) + { + mIsGFFX = TRUE; + } + else if(mGLRenderer.find("GEFORCE3") != std::string::npos) + { + mIsGF3 = TRUE; + } + + } + else if (mGLVendor.find("INTEL") != std::string::npos +#if LL_LINUX + // The Mesa-based drivers put this in the Renderer string, + // not the Vendor string. + || mGLRenderer.find("INTEL") != std::string::npos +#endif //LL_LINUX + ) + { + mGLVendorShort = "INTEL"; + mIsIntel = TRUE; + } + else + { + mGLVendorShort = "MISC"; + } + + // This is called here because it depends on the setting of mIsGF2or4MX, and sets up mHasMultitexture. + initExtensions(); + + if (mHasMultitexture) + { + GLint num_tex_units; + glGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB, &num_tex_units); + mNumTextureUnits = llmin(num_tex_units, (GLint)MAX_GL_TEXTURE_UNITS); + if (mIsIntel) + { + mNumTextureUnits = llmin(mNumTextureUnits, 2); + } + } + else + { + mHasRequirements = FALSE; + + // We don't support cards that don't support the GL_ARB_multitexture extension + LL_WARNS("RenderInit") << "GL Drivers do not support GL_ARB_multitexture" << LL_ENDL; + return false; + } + + + initGLStates(); + return true; +} + +void LLGLManager::getGLInfo(LLSD& info) +{ + info["GLInfo"]["GLVendor"] = std::string((const char *)glGetString(GL_VENDOR)); + info["GLInfo"]["GLRenderer"] = std::string((const char *)glGetString(GL_RENDERER)); + info["GLInfo"]["GLVersion"] = std::string((const char *)glGetString(GL_VERSION)); + +#if !LL_MESA_HEADLESS + std::string all_exts = ll_safe_string((const char *)gGLHExts.mSysExts); + boost::char_separator sep(" "); + boost::tokenizer > tok(all_exts, sep); + for(boost::tokenizer >::iterator i = tok.begin(); i != tok.end(); ++i) + { + info["GLInfo"]["GLExtensions"].append(*i); + } +#endif +} + +std::string LLGLManager::getGLInfoString() +{ + std::string info_str; + std::string all_exts, line; + + info_str += std::string("GL_VENDOR ") + ll_safe_string((const char *)glGetString(GL_VENDOR)) + std::string("\n"); + info_str += std::string("GL_RENDERER ") + ll_safe_string((const char *)glGetString(GL_RENDERER)) + std::string("\n"); + info_str += std::string("GL_VERSION ") + ll_safe_string((const char *)glGetString(GL_VERSION)) + std::string("\n"); + +#if !LL_MESA_HEADLESS + all_exts = (const char *)gGLHExts.mSysExts; + LLStringUtil::replaceChar(all_exts, ' ', '\n'); + info_str += std::string("GL_EXTENSIONS:\n") + all_exts + std::string("\n"); +#endif + + return info_str; +} + +void LLGLManager::printGLInfoString() +{ + std::string info_str; + std::string all_exts, line; + + LL_INFOS("RenderInit") << "GL_VENDOR: " << ((const char *)glGetString(GL_VENDOR)) << LL_ENDL; + LL_INFOS("RenderInit") << "GL_RENDERER: " << ((const char *)glGetString(GL_RENDERER)) << LL_ENDL; + LL_INFOS("RenderInit") << "GL_VERSION: " << ((const char *)glGetString(GL_VERSION)) << LL_ENDL; + +#if !LL_MESA_HEADLESS + all_exts = std::string(gGLHExts.mSysExts); + LLStringUtil::replaceChar(all_exts, ' ', '\n'); + LL_DEBUGS("RenderInit") << "GL_EXTENSIONS:\n" << all_exts << LL_ENDL; +#endif +} + +std::string LLGLManager::getRawGLString() +{ + std::string gl_string; + gl_string = ll_safe_string((char*)glGetString(GL_VENDOR)) + " " + ll_safe_string((char*)glGetString(GL_RENDERER)); + return gl_string; +} + +void LLGLManager::shutdownGL() +{ + if (mInited) + { + glFinish(); + stop_glerror(); + mInited = FALSE; + } +} + +// these are used to turn software blending on. They appear in the Debug/Avatar menu +// presence of vertex skinning/blending or vertex programs will set these to FALSE by default. + +extern LLCPUInfo gSysCPU; + +void LLGLManager::initExtensions() +{ +#if LL_MESA_HEADLESS +# if GL_ARB_multitexture + mHasMultitexture = TRUE; +# else + mHasMultitexture = FALSE; +# endif +# if GL_ARB_texture_env_combine + mHasARBEnvCombine = TRUE; +# else + mHasARBEnvCombine = FALSE; +# endif +# if GL_ARB_texture_compression + mHasCompressedTextures = TRUE; +# else + mHasCompressedTextures = FALSE; +# endif +# if GL_ARB_vertex_buffer_object + mHasVertexBufferObject = TRUE; +# else + mHasVertexBufferObject = FALSE; +# endif +# if GL_EXT_framebuffer_object + mHasFramebufferObject = TRUE; +# else + mHasFramebufferObject = FALSE; +# endif + mHasMipMapGeneration = FALSE; + mHasPalettedTextures = FALSE; + mHasSeparateSpecularColor = FALSE; + mHasAnisotropic = FALSE; + mHasCubeMap = FALSE; + mHasOcclusionQuery = FALSE; + mHasPointParameters = FALSE; + mHasShaderObjects = FALSE; + mHasVertexShader = FALSE; + mHasFragmentShader = FALSE; +#else // LL_MESA_HEADLESS + mHasMultitexture = glh_init_extensions("GL_ARB_multitexture"); + mHasMipMapGeneration = glh_init_extensions("GL_SGIS_generate_mipmap"); + mHasPalettedTextures = glh_init_extension("GL_EXT_paletted_texture"); + mHasSeparateSpecularColor = glh_init_extensions("GL_EXT_separate_specular_color"); + mHasAnisotropic = glh_init_extensions("GL_EXT_texture_filter_anisotropic"); + glh_init_extensions("GL_ARB_texture_cube_map"); + mHasCubeMap = ExtensionExists("GL_ARB_texture_cube_map", gGLHExts.mSysExts); + mHasARBEnvCombine = ExtensionExists("GL_ARB_texture_env_combine", gGLHExts.mSysExts); + mHasCompressedTextures = glh_init_extensions("GL_ARB_texture_compression"); + mHasOcclusionQuery = ExtensionExists("GL_ARB_occlusion_query", gGLHExts.mSysExts); + mHasVertexBufferObject = ExtensionExists("GL_ARB_vertex_buffer_object", gGLHExts.mSysExts); + // mask out FBO support when packed_depth_stencil isn't there 'cause we need it for LLRenderTarget -Brad + mHasFramebufferObject = ExtensionExists("GL_EXT_framebuffer_object", gGLHExts.mSysExts) + && ExtensionExists("GL_EXT_packed_depth_stencil", gGLHExts.mSysExts); +#if !LL_DARWIN + mHasPointParameters = !mIsATI && ExtensionExists("GL_ARB_point_parameters", gGLHExts.mSysExts); +#endif + mHasShaderObjects = ExtensionExists("GL_ARB_shader_objects", gGLHExts.mSysExts) && ExtensionExists("GL_ARB_shading_language_100", gGLHExts.mSysExts); + mHasVertexShader = ExtensionExists("GL_ARB_vertex_program", gGLHExts.mSysExts) && ExtensionExists("GL_ARB_vertex_shader", gGLHExts.mSysExts) + && ExtensionExists("GL_ARB_shading_language_100", gGLHExts.mSysExts); + mHasFragmentShader = ExtensionExists("GL_ARB_fragment_shader", gGLHExts.mSysExts) && ExtensionExists("GL_ARB_shading_language_100", gGLHExts.mSysExts); +#endif + +#if LL_LINUX + // Our extension support for the Linux Client is very young with some + // potential driver gotchas, so offer a semi-secret way to turn it off. + if (getenv("LL_GL_NOEXT")) /* Flawfinder: ignore */ + { + //mHasMultitexture = FALSE; // NEEDED! + mHasARBEnvCombine = FALSE; + mHasCompressedTextures = FALSE; + mHasVertexBufferObject = FALSE; + mHasFramebufferObject = FALSE; + mHasMipMapGeneration = FALSE; + mHasPalettedTextures = FALSE; + mHasSeparateSpecularColor = FALSE; + mHasAnisotropic = FALSE; + mHasCubeMap = FALSE; + mHasOcclusionQuery = FALSE; + mHasPointParameters = FALSE; + mHasShaderObjects = FALSE; + mHasVertexShader = FALSE; + mHasFragmentShader = FALSE; + LL_WARNS("RenderInit") << "GL extension support DISABLED via LL_GL_NOEXT" << LL_ENDL; + } + else if (getenv("LL_GL_BASICEXT")) /* Flawfinder: ignore */ + { + // This switch attempts to turn off all support for exotic + // extensions which I believe correspond to fatal driver + // bug reports. This should be the default until we get a + // proper blacklist/whitelist on Linux. + mHasMipMapGeneration = FALSE; + mHasPalettedTextures = FALSE; + mHasAnisotropic = FALSE; + //mHasCubeMap = FALSE; // apparently fatal on Intel 915 & similar + //mHasOcclusionQuery = FALSE; // source of many ATI system hangs + mHasShaderObjects = FALSE; + mHasVertexShader = FALSE; + mHasFragmentShader = FALSE; + LL_WARNS("RenderInit") << "GL extension support forced to SIMPLE level via LL_GL_BASICEXT" << LL_ENDL; + } + if (getenv("LL_GL_BLACKLIST")) /* Flawfinder: ignore */ + { + // This lets advanced troubleshooters disable specific + // GL extensions to isolate problems with their hardware. + // SL-28126 + const char *const blacklist = getenv("LL_GL_BLACKLIST"); /* Flawfinder: ignore */ + LL_WARNS("RenderInit") << "GL extension support partially disabled via LL_GL_BLACKLIST: " << blacklist << LL_ENDL; + if (strchr(blacklist,'a')) mHasARBEnvCombine = FALSE; + if (strchr(blacklist,'b')) mHasCompressedTextures = FALSE; + if (strchr(blacklist,'c')) mHasVertexBufferObject = FALSE; + if (strchr(blacklist,'d')) mHasMipMapGeneration = FALSE;//S + if (strchr(blacklist,'e')) mHasPalettedTextures = FALSE;//S +// if (strchr(blacklist,'f')) mHasNVVertexArrayRange = FALSE;//S +// if (strchr(blacklist,'g')) mHasNVFence = FALSE;//S + if (strchr(blacklist,'h')) mHasSeparateSpecularColor = FALSE; + if (strchr(blacklist,'i')) mHasAnisotropic = FALSE;//S + if (strchr(blacklist,'j')) mHasCubeMap = FALSE;//S +// if (strchr(blacklist,'k')) mHasATIVAO = FALSE;//S + if (strchr(blacklist,'l')) mHasOcclusionQuery = FALSE; + if (strchr(blacklist,'m')) mHasShaderObjects = FALSE;//S + if (strchr(blacklist,'n')) mHasVertexShader = FALSE;//S + if (strchr(blacklist,'o')) mHasFragmentShader = FALSE;//S + if (strchr(blacklist,'p')) mHasPointParameters = FALSE;//S + if (strchr(blacklist,'q')) mHasFramebufferObject = FALSE;//S + } +#endif // LL_LINUX + +#if LL_DARWIN || LL_LINUX + // MBW -- 12/4/2003 -- Using paletted textures causes a bunch of avatar rendering problems on the Mac. + // Not sure if this is due to driver problems or incorrect use of the extension, but I'm disabling it for now. + // Tofu - 2006-10-03 -- Same problem on Linux. + mHasPalettedTextures = false; +#endif + + if (!mHasMultitexture) + { + LL_INFOS("RenderInit") << "Couldn't initialize multitexturing" << LL_ENDL; + } + if (!mHasMipMapGeneration) + { + LL_INFOS("RenderInit") << "Couldn't initialize mipmap generation" << LL_ENDL; + } + if (!mHasARBEnvCombine) + { + LL_INFOS("RenderInit") << "Couldn't initialize GL_ARB_texture_env_combine" << LL_ENDL; + } + if (!mHasPalettedTextures) + { + LL_INFOS("RenderInit") << "Couldn't initialize GL_EXT_paletted_texture" << LL_ENDL; + } + if (!mHasSeparateSpecularColor) + { + LL_INFOS("RenderInit") << "Couldn't initialize separate specular color" << LL_ENDL; + } + if (!mHasAnisotropic) + { + LL_INFOS("RenderInit") << "Couldn't initialize anisotropic filtering" << LL_ENDL; + } + if (!mHasCompressedTextures) + { + LL_INFOS("RenderInit") << "Couldn't initialize GL_ARB_texture_compression" << LL_ENDL; + } + if (!mHasOcclusionQuery) + { + LL_INFOS("RenderInit") << "Couldn't initialize GL_ARB_occlusion_query" << LL_ENDL; + } + if (!mHasPointParameters) + { + LL_INFOS("RenderInit") << "Couldn't initialize GL_ARB_point_parameters" << LL_ENDL; + } + if (!mHasShaderObjects) + { + LL_INFOS("RenderInit") << "Couldn't initialize GL_ARB_shader_objects" << LL_ENDL; + } + if (!mHasVertexShader) + { + LL_INFOS("RenderInit") << "Couldn't initialize GL_ARB_vertex_shader" << LL_ENDL; + } + if (!mHasFragmentShader) + { + LL_INFOS("RenderInit") << "Couldn't initialize GL_ARB_fragment_shader" << LL_ENDL; + } + + // Disable certain things due to known bugs + if (mIsIntel && mHasMipMapGeneration) + { + LL_INFOS("RenderInit") << "Disabling mip-map generation for Intel GPUs" << LL_ENDL; + mHasMipMapGeneration = FALSE; + } + if (mIsATI && mHasMipMapGeneration) + { + LL_INFOS("RenderInit") << "Disabling mip-map generation for ATI GPUs (performance opt)" << LL_ENDL; + mHasMipMapGeneration = FALSE; + } + + // Misc + glGetIntegerv(GL_MAX_ELEMENTS_VERTICES, (GLint*) &mGLMaxVertexRange); + glGetIntegerv(GL_MAX_ELEMENTS_INDICES, (GLint*) &mGLMaxIndexRange); + +#if (LL_WINDOWS || LL_LINUX) && !LL_MESA_HEADLESS + LL_DEBUGS("RenderInit") << "GL Probe: Getting symbols" << LL_ENDL; + if (mHasVertexBufferObject) + { + glBindBufferARB = (PFNGLBINDBUFFERARBPROC)GLH_EXT_GET_PROC_ADDRESS("glBindBufferARB"); + if (glBindBufferARB) + { + glDeleteBuffersARB = (PFNGLDELETEBUFFERSARBPROC)GLH_EXT_GET_PROC_ADDRESS("glDeleteBuffersARB"); + glGenBuffersARB = (PFNGLGENBUFFERSARBPROC)GLH_EXT_GET_PROC_ADDRESS("glGenBuffersARB"); + glIsBufferARB = (PFNGLISBUFFERARBPROC)GLH_EXT_GET_PROC_ADDRESS("glIsBufferARB"); + glBufferDataARB = (PFNGLBUFFERDATAARBPROC)GLH_EXT_GET_PROC_ADDRESS("glBufferDataARB"); + glBufferSubDataARB = (PFNGLBUFFERSUBDATAARBPROC)GLH_EXT_GET_PROC_ADDRESS("glBufferSubDataARB"); + glGetBufferSubDataARB = (PFNGLGETBUFFERSUBDATAARBPROC)GLH_EXT_GET_PROC_ADDRESS("glGetBufferSubDataARB"); + glMapBufferARB = (PFNGLMAPBUFFERARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMapBufferARB"); + glUnmapBufferARB = (PFNGLUNMAPBUFFERARBPROC)GLH_EXT_GET_PROC_ADDRESS("glUnmapBufferARB"); + glGetBufferParameterivARB = (PFNGLGETBUFFERPARAMETERIVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glGetBufferParameterivARB"); + glGetBufferPointervARB = (PFNGLGETBUFFERPOINTERVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glGetBufferPointervARB"); + } + else + { + mHasVertexBufferObject = FALSE; + } + } + if (mHasFramebufferObject) + { + glIsRenderbufferEXT = (PFNGLISRENDERBUFFEREXTPROC) GLH_EXT_GET_PROC_ADDRESS("glIsRenderbufferEXT"); + glBindRenderbufferEXT = (PFNGLBINDRENDERBUFFEREXTPROC) GLH_EXT_GET_PROC_ADDRESS("glBindRenderbufferEXT"); + glDeleteRenderbuffersEXT = (PFNGLDELETERENDERBUFFERSEXTPROC) GLH_EXT_GET_PROC_ADDRESS("glDeleteRenderbuffersEXT"); + glGenRenderbuffersEXT = (PFNGLGENRENDERBUFFERSEXTPROC) GLH_EXT_GET_PROC_ADDRESS("glGenRenderbuffersEXT"); + glRenderbufferStorageEXT = (PFNGLRENDERBUFFERSTORAGEEXTPROC) GLH_EXT_GET_PROC_ADDRESS("glRenderbufferStorageEXT"); + glGetRenderbufferParameterivEXT = (PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC) GLH_EXT_GET_PROC_ADDRESS("glGetRenderbufferParameterivEXT"); + glIsFramebufferEXT = (PFNGLISFRAMEBUFFEREXTPROC) GLH_EXT_GET_PROC_ADDRESS("glIsFramebufferEXT"); + glBindFramebufferEXT = (PFNGLBINDFRAMEBUFFEREXTPROC) GLH_EXT_GET_PROC_ADDRESS("glBindFramebufferEXT"); + glDeleteFramebuffersEXT = (PFNGLDELETEFRAMEBUFFERSEXTPROC) GLH_EXT_GET_PROC_ADDRESS("glDeleteFramebuffersEXT"); + glGenFramebuffersEXT = (PFNGLGENFRAMEBUFFERSEXTPROC) GLH_EXT_GET_PROC_ADDRESS("glGenFramebuffersEXT"); + glCheckFramebufferStatusEXT = (PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC) GLH_EXT_GET_PROC_ADDRESS("glCheckFramebufferStatusEXT"); + glFramebufferTexture1DEXT = (PFNGLFRAMEBUFFERTEXTURE1DEXTPROC) GLH_EXT_GET_PROC_ADDRESS("glFramebufferTexture1DEXT"); + glFramebufferTexture2DEXT = (PFNGLFRAMEBUFFERTEXTURE2DEXTPROC) GLH_EXT_GET_PROC_ADDRESS("glFramebufferTexture2DEXT"); + glFramebufferTexture3DEXT = (PFNGLFRAMEBUFFERTEXTURE3DEXTPROC) GLH_EXT_GET_PROC_ADDRESS("glFramebufferTexture3DEXT"); + glFramebufferRenderbufferEXT = (PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC) GLH_EXT_GET_PROC_ADDRESS("glFramebufferRenderbufferEXT"); + glGetFramebufferAttachmentParameterivEXT = (PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC) GLH_EXT_GET_PROC_ADDRESS("glGetFramebufferAttachmentParameterivEXT"); + glGenerateMipmapEXT = (PFNGLGENERATEMIPMAPEXTPROC) GLH_EXT_GET_PROC_ADDRESS("glGenerateMipmapEXT"); + } +#if !LL_LINUX + // This is expected to be a static symbol on Linux GL implementations + glDrawRangeElements = (PFNGLDRAWRANGEELEMENTSPROC)GLH_EXT_GET_PROC_ADDRESS("glDrawRangeElements"); + if (!glDrawRangeElements) + { + mGLMaxVertexRange = 0; + mGLMaxIndexRange = 0; + } +#endif // !LL_LINUX +#if LL_LINUX + // On Linux we need to get glColorTableEXT dynamically. + if (mHasPalettedTextures) + { + glColorTableEXT = (PFNGLCOLORTABLEEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glColorTableEXT"); + } +#endif // LL_LINUX + if (mHasOcclusionQuery) + { + glGenQueriesARB = (PFNGLGENQUERIESARBPROC)GLH_EXT_GET_PROC_ADDRESS("glGenQueriesARB"); + glDeleteQueriesARB = (PFNGLDELETEQUERIESARBPROC)GLH_EXT_GET_PROC_ADDRESS("glDeleteQueriesARB"); + glIsQueryARB = (PFNGLISQUERYARBPROC)GLH_EXT_GET_PROC_ADDRESS("glIsQueryARB"); + glBeginQueryARB = (PFNGLBEGINQUERYARBPROC)GLH_EXT_GET_PROC_ADDRESS("glBeginQueryARB"); + glEndQueryARB = (PFNGLENDQUERYARBPROC)GLH_EXT_GET_PROC_ADDRESS("glEndQueryARB"); + glGetQueryivARB = (PFNGLGETQUERYIVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glGetQueryivARB"); + glGetQueryObjectivARB = (PFNGLGETQUERYOBJECTIVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glGetQueryObjectivARB"); + glGetQueryObjectuivARB = (PFNGLGETQUERYOBJECTUIVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glGetQueryObjectuivARB"); + } + if (mHasPointParameters) + { + glPointParameterfARB = (PFNGLPOINTPARAMETERFARBPROC)GLH_EXT_GET_PROC_ADDRESS("glPointParameterfARB"); + glPointParameterfvARB = (PFNGLPOINTPARAMETERFVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glPointParameterfvARB"); + } + if (mHasShaderObjects) + { + glDeleteObjectARB = (PFNGLDELETEOBJECTARBPROC) GLH_EXT_GET_PROC_ADDRESS("glDeleteObjectARB"); + glGetHandleARB = (PFNGLGETHANDLEARBPROC) GLH_EXT_GET_PROC_ADDRESS("glGetHandleARB"); + glDetachObjectARB = (PFNGLDETACHOBJECTARBPROC) GLH_EXT_GET_PROC_ADDRESS("glDetachObjectARB"); + glCreateShaderObjectARB = (PFNGLCREATESHADEROBJECTARBPROC) GLH_EXT_GET_PROC_ADDRESS("glCreateShaderObjectARB"); + glShaderSourceARB = (PFNGLSHADERSOURCEARBPROC) GLH_EXT_GET_PROC_ADDRESS("glShaderSourceARB"); + glCompileShaderARB = (PFNGLCOMPILESHADERARBPROC) GLH_EXT_GET_PROC_ADDRESS("glCompileShaderARB"); + glCreateProgramObjectARB = (PFNGLCREATEPROGRAMOBJECTARBPROC) GLH_EXT_GET_PROC_ADDRESS("glCreateProgramObjectARB"); + glAttachObjectARB = (PFNGLATTACHOBJECTARBPROC) GLH_EXT_GET_PROC_ADDRESS("glAttachObjectARB"); + glLinkProgramARB = (PFNGLLINKPROGRAMARBPROC) GLH_EXT_GET_PROC_ADDRESS("glLinkProgramARB"); + glUseProgramObjectARB = (PFNGLUSEPROGRAMOBJECTARBPROC) GLH_EXT_GET_PROC_ADDRESS("glUseProgramObjectARB"); + glValidateProgramARB = (PFNGLVALIDATEPROGRAMARBPROC) GLH_EXT_GET_PROC_ADDRESS("glValidateProgramARB"); + glUniform1fARB = (PFNGLUNIFORM1FARBPROC) GLH_EXT_GET_PROC_ADDRESS("glUniform1fARB"); + glUniform2fARB = (PFNGLUNIFORM2FARBPROC) GLH_EXT_GET_PROC_ADDRESS("glUniform2fARB"); + glUniform3fARB = (PFNGLUNIFORM3FARBPROC) GLH_EXT_GET_PROC_ADDRESS("glUniform3fARB"); + glUniform4fARB = (PFNGLUNIFORM4FARBPROC) GLH_EXT_GET_PROC_ADDRESS("glUniform4fARB"); + glUniform1iARB = (PFNGLUNIFORM1IARBPROC) GLH_EXT_GET_PROC_ADDRESS("glUniform1iARB"); + glUniform2iARB = (PFNGLUNIFORM2IARBPROC) GLH_EXT_GET_PROC_ADDRESS("glUniform2iARB"); + glUniform3iARB = (PFNGLUNIFORM3IARBPROC) GLH_EXT_GET_PROC_ADDRESS("glUniform3iARB"); + glUniform4iARB = (PFNGLUNIFORM4IARBPROC) GLH_EXT_GET_PROC_ADDRESS("glUniform4iARB"); + glUniform1fvARB = (PFNGLUNIFORM1FVARBPROC) GLH_EXT_GET_PROC_ADDRESS("glUniform1fvARB"); + glUniform2fvARB = (PFNGLUNIFORM2FVARBPROC) GLH_EXT_GET_PROC_ADDRESS("glUniform2fvARB"); + glUniform3fvARB = (PFNGLUNIFORM3FVARBPROC) GLH_EXT_GET_PROC_ADDRESS("glUniform3fvARB"); + glUniform4fvARB = (PFNGLUNIFORM4FVARBPROC) GLH_EXT_GET_PROC_ADDRESS("glUniform4fvARB"); + glUniform1ivARB = (PFNGLUNIFORM1IVARBPROC) GLH_EXT_GET_PROC_ADDRESS("glUniform1ivARB"); + glUniform2ivARB = (PFNGLUNIFORM2IVARBPROC) GLH_EXT_GET_PROC_ADDRESS("glUniform2ivARB"); + glUniform3ivARB = (PFNGLUNIFORM3IVARBPROC) GLH_EXT_GET_PROC_ADDRESS("glUniform3ivARB"); + glUniform4ivARB = (PFNGLUNIFORM4IVARBPROC) GLH_EXT_GET_PROC_ADDRESS("glUniform4ivARB"); + glUniformMatrix2fvARB = (PFNGLUNIFORMMATRIX2FVARBPROC) GLH_EXT_GET_PROC_ADDRESS("glUniformMatrix2fvARB"); + glUniformMatrix3fvARB = (PFNGLUNIFORMMATRIX3FVARBPROC) GLH_EXT_GET_PROC_ADDRESS("glUniformMatrix3fvARB"); + glUniformMatrix4fvARB = (PFNGLUNIFORMMATRIX4FVARBPROC) GLH_EXT_GET_PROC_ADDRESS("glUniformMatrix4fvARB"); + glGetObjectParameterfvARB = (PFNGLGETOBJECTPARAMETERFVARBPROC) GLH_EXT_GET_PROC_ADDRESS("glGetObjectParameterfvARB"); + glGetObjectParameterivARB = (PFNGLGETOBJECTPARAMETERIVARBPROC) GLH_EXT_GET_PROC_ADDRESS("glGetObjectParameterivARB"); + glGetInfoLogARB = (PFNGLGETINFOLOGARBPROC) GLH_EXT_GET_PROC_ADDRESS("glGetInfoLogARB"); + glGetAttachedObjectsARB = (PFNGLGETATTACHEDOBJECTSARBPROC) GLH_EXT_GET_PROC_ADDRESS("glGetAttachedObjectsARB"); + glGetUniformLocationARB = (PFNGLGETUNIFORMLOCATIONARBPROC) GLH_EXT_GET_PROC_ADDRESS("glGetUniformLocationARB"); + glGetActiveUniformARB = (PFNGLGETACTIVEUNIFORMARBPROC) GLH_EXT_GET_PROC_ADDRESS("glGetActiveUniformARB"); + glGetUniformfvARB = (PFNGLGETUNIFORMFVARBPROC) GLH_EXT_GET_PROC_ADDRESS("glGetUniformfvARB"); + glGetUniformivARB = (PFNGLGETUNIFORMIVARBPROC) GLH_EXT_GET_PROC_ADDRESS("glGetUniformivARB"); + glGetShaderSourceARB = (PFNGLGETSHADERSOURCEARBPROC) GLH_EXT_GET_PROC_ADDRESS("glGetShaderSourceARB"); + } + if (mHasVertexShader) + { + glGetAttribLocationARB = (PFNGLGETATTRIBLOCATIONARBPROC) GLH_EXT_GET_PROC_ADDRESS("glGetAttribLocationARB"); + glBindAttribLocationARB = (PFNGLBINDATTRIBLOCATIONARBPROC) GLH_EXT_GET_PROC_ADDRESS("glBindAttribLocationARB"); + glGetActiveAttribARB = (PFNGLGETACTIVEATTRIBARBPROC) GLH_EXT_GET_PROC_ADDRESS("glGetActiveAttribARB"); + glVertexAttrib1dARB = (PFNGLVERTEXATTRIB1DARBPROC) GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib1dARB"); + glVertexAttrib1dvARB = (PFNGLVERTEXATTRIB1DVARBPROC) GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib1dvARB"); + glVertexAttrib1fARB = (PFNGLVERTEXATTRIB1FARBPROC) GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib1fARB"); + glVertexAttrib1fvARB = (PFNGLVERTEXATTRIB1FVARBPROC) GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib1fvARB"); + glVertexAttrib1sARB = (PFNGLVERTEXATTRIB1SARBPROC) GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib1sARB"); + glVertexAttrib1svARB = (PFNGLVERTEXATTRIB1SVARBPROC) GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib1svARB"); + glVertexAttrib2dARB = (PFNGLVERTEXATTRIB2DARBPROC) GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib2dARB"); + glVertexAttrib2dvARB = (PFNGLVERTEXATTRIB2DVARBPROC) GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib2dvARB"); + glVertexAttrib2fARB = (PFNGLVERTEXATTRIB2FARBPROC) GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib2fARB"); + glVertexAttrib2fvARB = (PFNGLVERTEXATTRIB2FVARBPROC) GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib2fvARB"); + glVertexAttrib2sARB = (PFNGLVERTEXATTRIB2SARBPROC) GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib2sARB"); + glVertexAttrib2svARB = (PFNGLVERTEXATTRIB2SVARBPROC) GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib2svARB"); + glVertexAttrib3dARB = (PFNGLVERTEXATTRIB3DARBPROC) GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib3dARB"); + glVertexAttrib3dvARB = (PFNGLVERTEXATTRIB3DVARBPROC) GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib3dvARB"); + glVertexAttrib3fARB = (PFNGLVERTEXATTRIB3FARBPROC) GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib3fARB"); + glVertexAttrib3fvARB = (PFNGLVERTEXATTRIB3FVARBPROC) GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib3fvARB"); + glVertexAttrib3sARB = (PFNGLVERTEXATTRIB3SARBPROC) GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib3sARB"); + glVertexAttrib3svARB = (PFNGLVERTEXATTRIB3SVARBPROC) GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib3svARB"); + glVertexAttrib4nbvARB = (PFNGLVERTEXATTRIB4NBVARBPROC) GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib4nbvARB"); + glVertexAttrib4nivARB = (PFNGLVERTEXATTRIB4NIVARBPROC) GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib4nivARB"); + glVertexAttrib4nsvARB = (PFNGLVERTEXATTRIB4NSVARBPROC) GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib4nsvARB"); + glVertexAttrib4nubARB = (PFNGLVERTEXATTRIB4NUBARBPROC) GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib4nubARB"); + glVertexAttrib4nubvARB = (PFNGLVERTEXATTRIB4NUBVARBPROC) GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib4nubvARB"); + glVertexAttrib4nuivARB = (PFNGLVERTEXATTRIB4NUIVARBPROC) GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib4nuivARB"); + glVertexAttrib4nusvARB = (PFNGLVERTEXATTRIB4NUSVARBPROC) GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib4nusvARB"); + glVertexAttrib4bvARB = (PFNGLVERTEXATTRIB4BVARBPROC) GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib4bvARB"); + glVertexAttrib4dARB = (PFNGLVERTEXATTRIB4DARBPROC) GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib4dARB"); + glVertexAttrib4dvARB = (PFNGLVERTEXATTRIB4DVARBPROC) GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib4dvARB"); + glVertexAttrib4fARB = (PFNGLVERTEXATTRIB4FARBPROC) GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib4fARB"); + glVertexAttrib4fvARB = (PFNGLVERTEXATTRIB4FVARBPROC) GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib4fvARB"); + glVertexAttrib4ivARB = (PFNGLVERTEXATTRIB4IVARBPROC) GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib4ivARB"); + glVertexAttrib4sARB = (PFNGLVERTEXATTRIB4SARBPROC) GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib4sARB"); + glVertexAttrib4svARB = (PFNGLVERTEXATTRIB4SVARBPROC) GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib4svARB"); + glVertexAttrib4ubvARB = (PFNGLVERTEXATTRIB4UBVARBPROC) GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib4ubvARB"); + glVertexAttrib4uivARB = (PFNGLVERTEXATTRIB4UIVARBPROC) GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib4uivARB"); + glVertexAttrib4usvARB = (PFNGLVERTEXATTRIB4USVARBPROC) GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib4usvARB"); + glVertexAttribPointerARB = (PFNGLVERTEXATTRIBPOINTERARBPROC) GLH_EXT_GET_PROC_ADDRESS("glVertexAttribPointerARB"); + glEnableVertexAttribArrayARB = (PFNGLENABLEVERTEXATTRIBARRAYARBPROC) GLH_EXT_GET_PROC_ADDRESS("glEnableVertexAttribArrayARB"); + glDisableVertexAttribArrayARB = (PFNGLDISABLEVERTEXATTRIBARRAYARBPROC) GLH_EXT_GET_PROC_ADDRESS("glDisableVertexAttribArrayARB"); + glProgramStringARB = (PFNGLPROGRAMSTRINGARBPROC) GLH_EXT_GET_PROC_ADDRESS("glProgramStringARB"); + glBindProgramARB = (PFNGLBINDPROGRAMARBPROC) GLH_EXT_GET_PROC_ADDRESS("glBindProgramARB"); + glDeleteProgramsARB = (PFNGLDELETEPROGRAMSARBPROC) GLH_EXT_GET_PROC_ADDRESS("glDeleteProgramsARB"); + glGenProgramsARB = (PFNGLGENPROGRAMSARBPROC) GLH_EXT_GET_PROC_ADDRESS("glGenProgramsARB"); + glProgramEnvParameter4dARB = (PFNGLPROGRAMENVPARAMETER4DARBPROC) GLH_EXT_GET_PROC_ADDRESS("glProgramEnvParameter4dARB"); + glProgramEnvParameter4dvARB = (PFNGLPROGRAMENVPARAMETER4DVARBPROC) GLH_EXT_GET_PROC_ADDRESS("glProgramEnvParameter4dvARB"); + glProgramEnvParameter4fARB = (PFNGLPROGRAMENVPARAMETER4FARBPROC) GLH_EXT_GET_PROC_ADDRESS("glProgramEnvParameter4fARB"); + glProgramEnvParameter4fvARB = (PFNGLPROGRAMENVPARAMETER4FVARBPROC) GLH_EXT_GET_PROC_ADDRESS("glProgramEnvParameter4fvARB"); + glProgramLocalParameter4dARB = (PFNGLPROGRAMLOCALPARAMETER4DARBPROC) GLH_EXT_GET_PROC_ADDRESS("glProgramLocalParameter4dARB"); + glProgramLocalParameter4dvARB = (PFNGLPROGRAMLOCALPARAMETER4DVARBPROC) GLH_EXT_GET_PROC_ADDRESS("glProgramLocalParameter4dvARB"); + glProgramLocalParameter4fARB = (PFNGLPROGRAMLOCALPARAMETER4FARBPROC) GLH_EXT_GET_PROC_ADDRESS("glProgramLocalParameter4fARB"); + glProgramLocalParameter4fvARB = (PFNGLPROGRAMLOCALPARAMETER4FVARBPROC) GLH_EXT_GET_PROC_ADDRESS("glProgramLocalParameter4fvARB"); + glGetProgramEnvParameterdvARB = (PFNGLGETPROGRAMENVPARAMETERDVARBPROC) GLH_EXT_GET_PROC_ADDRESS("glGetProgramEnvParameterdvARB"); + glGetProgramEnvParameterfvARB = (PFNGLGETPROGRAMENVPARAMETERFVARBPROC) GLH_EXT_GET_PROC_ADDRESS("glGetProgramEnvParameterfvARB"); + glGetProgramLocalParameterdvARB = (PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC) GLH_EXT_GET_PROC_ADDRESS("glGetProgramLocalParameterdvARB"); + glGetProgramLocalParameterfvARB = (PFNGLGETPROGRAMLOCALPARAMETERFVARBPROC) GLH_EXT_GET_PROC_ADDRESS("glGetProgramLocalParameterfvARB"); + glGetProgramivARB = (PFNGLGETPROGRAMIVARBPROC) GLH_EXT_GET_PROC_ADDRESS("glGetProgramivARB"); + glGetProgramStringARB = (PFNGLGETPROGRAMSTRINGARBPROC) GLH_EXT_GET_PROC_ADDRESS("glGetProgramStringARB"); + glGetVertexAttribdvARB = (PFNGLGETVERTEXATTRIBDVARBPROC) GLH_EXT_GET_PROC_ADDRESS("glGetVertexAttribdvARB"); + glGetVertexAttribfvARB = (PFNGLGETVERTEXATTRIBFVARBPROC) GLH_EXT_GET_PROC_ADDRESS("glGetVertexAttribfvARB"); + glGetVertexAttribivARB = (PFNGLGETVERTEXATTRIBIVARBPROC) GLH_EXT_GET_PROC_ADDRESS("glGetVertexAttribivARB"); + glGetVertexAttribPointervARB = (PFNGLGETVERTEXATTRIBPOINTERVARBPROC) GLH_EXT_GET_PROC_ADDRESS("glgetVertexAttribPointervARB"); + glIsProgramARB = (PFNGLISPROGRAMARBPROC) GLH_EXT_GET_PROC_ADDRESS("glIsProgramARB"); + } + LL_DEBUGS("RenderInit") << "GL Probe: Got symbols" << LL_ENDL; +#endif + + mInited = TRUE; +} + +void rotate_quat(LLQuaternion& rotation) +{ + F32 angle_radians, x, y, z; + rotation.getAngleAxis(&angle_radians, &x, &y, &z); + glRotatef(angle_radians * RAD_TO_DEG, x, y, z); +} + +void flush_glerror() +{ + glGetError(); +} + +void assert_glerror() +{ + if (gNoRender || !gDebugGL) + { + return; + } + if (!gGLManager.mInited) + { + LL_ERRS("RenderInit") << "GL not initialized" << LL_ENDL; + } + // Create or update texture to be used with this data + GLenum error; + error = glGetError(); + BOOL quit = FALSE; + while (error) + { + quit = TRUE; +#ifndef LL_LINUX // *FIX: ! This should be an error for linux as well. + GLubyte const * gl_error_msg = gluErrorString(error); + if (NULL != gl_error_msg) + { + LL_WARNS("RenderState") << "GL Error:" << gl_error_msg << LL_ENDL; + } + else + { + // gluErrorString returns NULL for some extensions' error codes. + // you'll probably have to grep for the number in glext.h. + LL_WARNS("RenderState") << "GL Error: UNKNOWN 0x" << std::hex << error << LL_ENDL; + } + error = glGetError(); +#endif + } + + if (quit) + { + llerrs << "One or more unhandled GL errors." << llendl; + } +} + +void clear_glerror() +{ + // Create or update texture to be used with this data + GLenum error; + error = glGetError(); +} + +/////////////////////////////////////////////////////////////// +// +// LLGLState +// + +// Static members +std::map LLGLState::sStateMap; + +GLboolean LLGLDepthTest::sDepthEnabled = GL_FALSE; // OpenGL default +GLenum LLGLDepthTest::sDepthFunc = GL_LESS; // OpenGL default +GLboolean LLGLDepthTest::sWriteEnabled = GL_TRUE; // OpenGL default + +//static +void LLGLState::initClass() +{ + sStateMap[GL_DITHER] = GL_TRUE; + sStateMap[GL_TEXTURE_2D] = GL_TRUE; + + //make sure multisample defaults to disabled + sStateMap[GL_MULTISAMPLE_ARB] = GL_FALSE; + glDisable(GL_MULTISAMPLE_ARB); + + //default vertex arrays to enabled. + glEnableClientState(GL_VERTEX_ARRAY); +} + +//static +void LLGLState::restoreGL() +{ + sStateMap.clear(); + initClass(); +} + +//static +// Really shouldn't be needed, but seems we sometimes do. +void LLGLState::resetTextureStates() +{ + gGL.flush(); + GLint maxTextureUnits; + + glGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB, &maxTextureUnits); + for (S32 j = maxTextureUnits-1; j >=0; j--) + { + gGL.getTexUnit(j)->activate(); + glClientActiveTextureARB(GL_TEXTURE0_ARB+j); + j == 0 ? glEnable(GL_TEXTURE_2D) : glDisable(GL_TEXTURE_2D); + } +} + +void LLGLState::dumpStates() +{ + LL_INFOS("RenderState") << "GL States:" << LL_ENDL; + for (std::map::iterator iter = sStateMap.begin(); + iter != sStateMap.end(); ++iter) + { + LL_INFOS("RenderState") << llformat(" 0x%04x : %s",(S32)iter->first,iter->second?"TRUE":"FALSE") << LL_ENDL; + } +} + +void LLGLState::checkStates(const std::string& msg) +{ + if (!gDebugGL) + { + return; + } + + stop_glerror(); + + GLint activeTexture; + glGetIntegerv(GL_ACTIVE_TEXTURE_ARB, &activeTexture); + + if (activeTexture != GL_TEXTURE0_ARB) + { + LL_GL_ERRS << "Texture channel corrupted. " << LL_ENDL; + } + + GLint src; + GLint dst; + glGetIntegerv(GL_BLEND_SRC, &src); + glGetIntegerv(GL_BLEND_DST, &dst); + + if (src != GL_SRC_ALPHA || dst != GL_ONE_MINUS_SRC_ALPHA) + { + LL_GL_ERRS << "Blend function corrupted: " << std::hex << src << " " << std::hex << dst << " " << msg << LL_ENDL; + } + + for (std::map::iterator iter = sStateMap.begin(); + iter != sStateMap.end(); ++iter) + { + LLGLenum state = iter->first; + LLGLboolean cur_state = iter->second; + LLGLboolean gl_state = glIsEnabled(state); + if(cur_state != gl_state) + { + dumpStates(); + LL_GL_ERRS << llformat("LLGLState error. State: 0x%04x",state) << LL_ENDL; + } + } + + stop_glerror(); +} + +void LLGLState::checkTextureChannels(const std::string& msg) +{ + if (!gDebugGL) + { + return; + } + + GLint activeTexture; + glGetIntegerv(GL_ACTIVE_TEXTURE_ARB, &activeTexture); + + BOOL error = FALSE; + + if (activeTexture != GL_TEXTURE0_ARB) + { + error = TRUE; + LL_WARNS("RenderState") << "Active texture channel corrupted. " << LL_ENDL; + } + else if (!glIsEnabled(GL_TEXTURE_2D)) + { + error = TRUE; + LL_WARNS("RenderState") << "GL_TEXTURE_2D not enabled on texture channel 0." << LL_ENDL; + } + else + { + GLint tex_env_mode = 0; + + glGetTexEnviv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, &tex_env_mode); + if (tex_env_mode != GL_MODULATE) + { + error = TRUE; + LL_WARNS("RenderState") << "GL_TEXTURE_ENV_MODE invalid: " << std::hex << tex_env_mode << LL_ENDL; + } + } + + GLint maxTextureUnits; + glGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB, &maxTextureUnits); + + static const char* label[] = + { + "GL_TEXTURE_2D", + "GL_TEXTURE_COORD_ARRAY", + "GL_TEXTURE_1D", + "GL_TEXTURE_CUBE_MAP_ARB", + "GL_TEXTURE_GEN_S", + "GL_TEXTURE_GEN_T", + "GL_TEXTURE_GEN_Q", + "GL_TEXTURE_GEN_R" + }; + + static GLint value[] = + { + GL_TEXTURE_2D, + GL_TEXTURE_COORD_ARRAY, + GL_TEXTURE_1D, + GL_TEXTURE_CUBE_MAP_ARB, + GL_TEXTURE_GEN_S, + GL_TEXTURE_GEN_T, + GL_TEXTURE_GEN_Q, + GL_TEXTURE_GEN_R + }; + + GLint stackDepth = 0; + LLMatrix4 identity; + LLMatrix4 matrix; + + for (GLint i = 0; i < maxTextureUnits; i++) + { + gGL.getTexUnit(i)->activate(); + glClientActiveTextureARB(GL_TEXTURE0_ARB+i); + + glGetIntegerv(GL_TEXTURE_STACK_DEPTH, &stackDepth); + + if (stackDepth != 1) + { + error = TRUE; + LL_WARNS("RenderState") << "Texture matrix stack corrupted." << LL_ENDL; + } + + glGetFloatv(GL_TEXTURE_MATRIX, (GLfloat*) matrix.mMatrix); + + if (matrix != identity) + { + error = TRUE; + LL_WARNS("RenderState") << "Texture matrix in channel " << i << " corrupt." << LL_ENDL; + } + + for (S32 j = (i == 0 ? 1 : 0); j < 8; j++) + { + if (glIsEnabled(value[j])) + { + error = TRUE; + LL_WARNS("RenderState") << "Texture channel " << i << " still has " << label[j] << " enabled." << LL_ENDL; + } + } + } + + gGL.getTexUnit(0)->activate(); + glClientActiveTextureARB(GL_TEXTURE0_ARB); + + if (error) + { + LL_GL_ERRS << "GL texture state corruption detected. " << msg << LL_ENDL; + } +} + +void LLGLState::checkClientArrays(const std::string& msg, U32 data_mask) +{ + if (!gDebugGL) + { + return; + } + + stop_glerror(); + BOOL error = FALSE; + + GLint active_texture; + glGetIntegerv(GL_CLIENT_ACTIVE_TEXTURE_ARB, &active_texture); + + if (active_texture != GL_TEXTURE0_ARB) + { + llwarns << "Client active texture corrupted: " << active_texture << llendl; + error = TRUE; + } + + glGetIntegerv(GL_ACTIVE_TEXTURE_ARB, &active_texture); + if (active_texture != GL_TEXTURE0_ARB) + { + llwarns << "Active texture corrupted: " << active_texture << llendl; + error = TRUE; + } + + static const char* label[] = + { + "GL_VERTEX_ARRAY", + "GL_NORMAL_ARRAY", + "GL_COLOR_ARRAY", + "GL_TEXTURE_COORD_ARRAY" + }; + + static GLint value[] = + { + GL_VERTEX_ARRAY, + GL_NORMAL_ARRAY, + GL_COLOR_ARRAY, + GL_TEXTURE_COORD_ARRAY + }; + + U32 mask[] = + { //copied from llvertexbuffer.h + 0x0001, //MAP_VERTEX, + 0x0002, //MAP_NORMAL, + 0x0010, //MAP_COLOR, + 0x0004, //MAP_TEXCOORD + }; + + + for (S32 j = 0; j < 4; j++) + { + if (glIsEnabled(value[j])) + { + if (!(mask[j] & data_mask)) + { + error = TRUE; + LL_WARNS("RenderState") << "GL still has " << label[j] << " enabled." << LL_ENDL; + } + } + else + { + if (mask[j] & data_mask) + { + error = TRUE; + LL_WARNS("RenderState") << "GL does not have " << label[j] << " enabled." << LL_ENDL; + } + } + } + + glClientActiveTextureARB(GL_TEXTURE1_ARB); + gGL.getTexUnit(1)->activate(); + if (glIsEnabled(GL_TEXTURE_COORD_ARRAY)) + { + if (!(data_mask & 0x0008)) + { + error = TRUE; + LL_WARNS("RenderState") << "GL still has GL_TEXTURE_COORD_ARRAY enabled on channel 1." << LL_ENDL; + } + } + else + { + if (data_mask & 0x0008) + { + error = TRUE; + LL_WARNS("RenderState") << "GL does not have GL_TEXTURE_COORD_ARRAY enabled on channel 1." << LL_ENDL; + } + } + + if (glIsEnabled(GL_TEXTURE_2D)) + { + if (!(data_mask & 0x0008)) + { + error = TRUE; + LL_WARNS("RenderState") << "GL still has GL_TEXTURE_2D enabled on channel 1." << LL_ENDL; + } + } + else + { + if (data_mask & 0x0008) + { + error = TRUE; + LL_WARNS("RenderState") << "GL does not have GL_TEXTURE_2D enabled on channel 1." << LL_ENDL; + } + } + + glClientActiveTextureARB(GL_TEXTURE0_ARB); + gGL.getTexUnit(0)->activate(); + + if (error) + { + LL_GL_ERRS << "GL client array corruption detected. " << msg << LL_ENDL; + } +} + +/////////////////////////////////////////////////////////////////////// + +LLGLState::LLGLState(LLGLenum state, S32 enabled) : + mState(state), mWasEnabled(FALSE), mIsEnabled(FALSE) +{ + stop_glerror(); + if (state) + { + mWasEnabled = sStateMap[state]; + llassert(mWasEnabled == glIsEnabled(state)); + setEnabled(enabled); + stop_glerror(); + } +} + +void LLGLState::setEnabled(S32 enabled) +{ + if (!mState) + { + return; + } + if (enabled == CURRENT_STATE) + { + enabled = sStateMap[mState] == GL_TRUE ? TRUE : FALSE; + } + else if (enabled == TRUE && sStateMap[mState] != GL_TRUE) + { + gGL.flush(); + glEnable(mState); + sStateMap[mState] = GL_TRUE; + } + else if (enabled == FALSE && sStateMap[mState] != GL_FALSE) + { + gGL.flush(); + glDisable(mState); + sStateMap[mState] = GL_FALSE; + } + mIsEnabled = enabled; +} + +LLGLState::~LLGLState() +{ + stop_glerror(); + if (mState) + { + if (gDebugGL) + { + llassert_always(sStateMap[mState] == glIsEnabled(mState)); + } + + if (mIsEnabled != mWasEnabled) + { + gGL.flush(); + if (mWasEnabled) + { + glEnable(mState); + sStateMap[mState] = GL_TRUE; + } + else + { + glDisable(mState); + sStateMap[mState] = GL_FALSE; + } + } + } + stop_glerror(); +} + +//////////////////////////////////////////////////////////////////////////////// + +void LLGLManager::initGLStates() +{ + //gl states moved to classes in llglstates.h + LLGLState::initClass(); +} + +//////////////////////////////////////////////////////////////////////////////// + +void enable_vertex_weighting(const S32 index) +{ +#if GL_ARB_vertex_program + if (index > 0) glEnableVertexAttribArrayARB(index); // vertex weights +#endif +} + +void disable_vertex_weighting(const S32 index) +{ +#if GL_ARB_vertex_program + if (index > 0) glDisableVertexAttribArrayARB(index); // vertex weights +#endif +} + +void enable_binormals(const S32 index) +{ +#if GL_ARB_vertex_program + if (index > 0) + { + glEnableVertexAttribArrayARB(index); // binormals + } +#endif +} + +void disable_binormals(const S32 index) +{ +#if GL_ARB_vertex_program + if (index > 0) + { + glDisableVertexAttribArrayARB(index); // binormals + } +#endif +} + + +void enable_cloth_weights(const S32 index) +{ +#if GL_ARB_vertex_program + if (index > 0) glEnableVertexAttribArrayARB(index); +#endif +} + +void disable_cloth_weights(const S32 index) +{ +#if GL_ARB_vertex_program + if (index > 0) glDisableVertexAttribArrayARB(index); +#endif +} + +void set_vertex_weights(const S32 index, const U32 stride, const F32 *weights) +{ +#if GL_ARB_vertex_program + if (index > 0) glVertexAttribPointerARB(index, 1, GL_FLOAT, FALSE, stride, weights); + stop_glerror(); +#endif +} + +void set_vertex_clothing_weights(const S32 index, const U32 stride, const LLVector4 *weights) +{ +#if GL_ARB_vertex_program + if (index > 0) glVertexAttribPointerARB(index, 4, GL_FLOAT, TRUE, stride, weights); + stop_glerror(); +#endif +} + +void set_binormals(const S32 index, const U32 stride,const LLVector3 *binormals) +{ +#if GL_ARB_vertex_program + if (index > 0) glVertexAttribPointerARB(index, 3, GL_FLOAT, FALSE, stride, binormals); + stop_glerror(); +#endif +} + + +void set_palette(U8 *palette_data) +{ + if (gGLManager.mHasPalettedTextures) + { + glColorTableEXT(GL_TEXTURE_2D, GL_RGBA8, 256, GL_RGBA, GL_UNSIGNED_BYTE, palette_data); + } +} + + +void parse_gl_version( S32* major, S32* minor, S32* release, std::string* vendor_specific ) +{ + // GL_VERSION returns a null-terminated string with the format: + // .[.] [] + + const char* version = (const char*) glGetString(GL_VERSION); + *major = 0; + *minor = 0; + *release = 0; + vendor_specific->assign(""); + + if( !version ) + { + return; + } + + std::string ver_copy( version ); + S32 len = (S32)strlen( version ); /* Flawfinder: ignore */ + S32 i = 0; + S32 start; + // Find the major version + start = i; + for( ; i < len; i++ ) + { + if( '.' == version[i] ) + { + break; + } + } + std::string major_str = ver_copy.substr(start,i-start); + LLStringUtil::convertToS32(major_str, *major); + + if( '.' == version[i] ) + { + i++; + } + + // Find the minor version + start = i; + for( ; i < len; i++ ) + { + if( ('.' == version[i]) || isspace(version[i]) ) + { + break; + } + } + std::string minor_str = ver_copy.substr(start,i-start); + LLStringUtil::convertToS32(minor_str, *minor); + + // Find the release number (optional) + if( '.' == version[i] ) + { + i++; + + start = i; + for( ; i < len; i++ ) + { + if( isspace(version[i]) ) + { + break; + } + } + + std::string release_str = ver_copy.substr(start,i-start); + LLStringUtil::convertToS32(release_str, *release); + } + + // Skip over any white space + while( version[i] && isspace( version[i] ) ) + { + i++; + } + + // Copy the vendor-specific string (optional) + if( version[i] ) + { + vendor_specific->assign( version + i ); + } +} + +LLGLUserClipPlane::LLGLUserClipPlane(const LLPlane& p, const glh::matrix4f& modelview, const glh::matrix4f& projection) +{ + mModelview = modelview; + mProjection = projection; + + setPlane(p.mV[0], p.mV[1], p.mV[2], p.mV[3]); +} + +void LLGLUserClipPlane::setPlane(F32 a, F32 b, F32 c, F32 d) +{ + glh::matrix4f& P = mProjection; + glh::matrix4f& M = mModelview; + + glh::matrix4f invtrans_MVP = (P * M).inverse().transpose(); + glh::vec4f oplane(a,b,c,d); + glh::vec4f cplane; + invtrans_MVP.mult_matrix_vec(oplane, cplane); + + cplane /= fabs(cplane[2]); // normalize such that depth is not scaled + cplane[3] -= 1; + + if(cplane[2] < 0) + cplane *= -1; + + glh::matrix4f suffix; + suffix.set_row(2, cplane); + glh::matrix4f newP = suffix * P; + glMatrixMode(GL_PROJECTION); + glPushMatrix(); + glLoadMatrixf(newP.m); + gGLObliqueProjectionInverse = LLMatrix4(newP.inverse().transpose().m); + glMatrixMode(GL_MODELVIEW); +} + +LLGLUserClipPlane::~LLGLUserClipPlane() +{ + glMatrixMode(GL_PROJECTION); + glPopMatrix(); + glMatrixMode(GL_MODELVIEW); +} + +LLGLNamePool::LLGLNamePool() +{ +} + +void LLGLNamePool::registerPool(LLGLNamePool* pool) +{ + pool_list_t::iterator iter = std::find(sInstances.begin(), sInstances.end(), pool); + if (iter == sInstances.end()) + { + sInstances.push_back(pool); + } +} + +LLGLNamePool::~LLGLNamePool() +{ + pool_list_t::iterator iter = std::find(sInstances.begin(), sInstances.end(), this); + if (iter != sInstances.end()) + { + sInstances.erase(iter); + } +} + +void LLGLNamePool::upkeep() +{ + std::sort(mNameList.begin(), mNameList.end(), CompareUsed()); +} + +void LLGLNamePool::cleanup() +{ + for (name_list_t::iterator iter = mNameList.begin(); iter != mNameList.end(); ++iter) + { + releaseName(iter->name); + } + + mNameList.clear(); +} + +GLuint LLGLNamePool::allocate() +{ +#if LL_GL_NAME_POOLING + for (name_list_t::iterator iter = mNameList.begin(); iter != mNameList.end(); ++iter) + { + if (!iter->used) + { + iter->used = TRUE; + return iter->name; + } + } + + NameEntry entry; + entry.name = allocateName(); + entry.used = TRUE; + mNameList.push_back(entry); + + return entry.name; +#else + return allocateName(); +#endif +} + +void LLGLNamePool::release(GLuint name) +{ +#if LL_GL_NAME_POOLING + for (name_list_t::iterator iter = mNameList.begin(); iter != mNameList.end(); ++iter) + { + if (iter->name == name) + { + if (iter->used) + { + iter->used = FALSE; + return; + } + else + { + llerrs << "Attempted to release a pooled name that is not in use!" << llendl; + } + } + } + llerrs << "Attempted to release a non pooled name!" << llendl; +#else + releaseName(name); +#endif +} + +//static +void LLGLNamePool::upkeepPools() +{ + for (pool_list_t::iterator iter = sInstances.begin(); iter != sInstances.end(); ++iter) + { + LLGLNamePool* pool = *iter; + pool->upkeep(); + } +} + +//static +void LLGLNamePool::cleanupPools() +{ + for (pool_list_t::iterator iter = sInstances.begin(); iter != sInstances.end(); ++iter) + { + LLGLNamePool* pool = *iter; + pool->cleanup(); + } +} + +LLGLDepthTest::LLGLDepthTest(GLboolean depth_enabled, GLboolean write_enabled, GLenum depth_func) +: mPrevDepthEnabled(sDepthEnabled), mPrevDepthFunc(sDepthFunc), mPrevWriteEnabled(sWriteEnabled) +{ + if (depth_enabled != sDepthEnabled) + { + gGL.flush(); + if (depth_enabled) glEnable(GL_DEPTH_TEST); + else glDisable(GL_DEPTH_TEST); + sDepthEnabled = depth_enabled; + } + if (depth_func != sDepthFunc) + { + gGL.flush(); + glDepthFunc(depth_func); + sDepthFunc = depth_func; + } + if (write_enabled != sWriteEnabled) + { + gGL.flush(); + glDepthMask(write_enabled); + sWriteEnabled = write_enabled; + } +} + +LLGLDepthTest::~LLGLDepthTest() +{ + if (sDepthEnabled != mPrevDepthEnabled ) + { + gGL.flush(); + if (mPrevDepthEnabled) glEnable(GL_DEPTH_TEST); + else glDisable(GL_DEPTH_TEST); + sDepthEnabled = mPrevDepthEnabled; + } + if (sDepthFunc != mPrevDepthFunc) + { + gGL.flush(); + glDepthFunc(mPrevDepthFunc); + sDepthFunc = mPrevDepthFunc; + } + if (sWriteEnabled != mPrevWriteEnabled ) + { + gGL.flush(); + glDepthMask(mPrevWriteEnabled); + sWriteEnabled = mPrevWriteEnabled; + } +} + +LLGLClampToFarClip::LLGLClampToFarClip(glh::matrix4f P) +{ + for (U32 i = 0; i < 4; i++) + { + P.element(2, i) = P.element(3, i) * 0.99999f; + } + + glMatrixMode(GL_PROJECTION); + glPushMatrix(); + glLoadMatrixf(P.m); + glMatrixMode(GL_MODELVIEW); +} + +LLGLClampToFarClip::~LLGLClampToFarClip() +{ + glMatrixMode(GL_PROJECTION); + glPopMatrix(); + glMatrixMode(GL_MODELVIEW); +} + diff --git a/linden/indra/llrender/llgl.h b/linden/indra/llrender/llgl.h new file mode 100644 index 0000000..cb368d7 --- /dev/null +++ b/linden/indra/llrender/llgl.h @@ -0,0 +1,378 @@ +/** + * @file llgl.h + * @brief LLGL definition + * + * $LicenseInfo:firstyear=2001&license=viewergpl$ + * + * Copyright (c) 2001-2008, Linden Research, Inc. + * + * Second Life Viewer Source Code + * 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://secondlifegrid.net/programs/open_source/licensing/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://secondlifegrid.net/programs/open_source/licensing/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. + * $/LicenseInfo$ + */ + +#ifndef LL_LLGL_H +#define LL_LLGL_H + +// This file contains various stuff for handling gl extensions and other gl related stuff. + +#include +#include + +#include "llerror.h" +#include "v4color.h" +#include "llstring.h" +#include "stdtypes.h" +#include "v4math.h" +#include "llplane.h" +#include "llgltypes.h" + +#include "llglheaders.h" +#include "glh/glh_linear.h" + +extern BOOL gDebugGL; + +#define LL_GL_ERRS LL_ERRS("RenderState") + +class LLSD; + +// Manage GL extensions... +class LLGLManager +{ +public: + LLGLManager(); + + bool initGL(); + void shutdownGL(); + + void initWGL(); // Initializes stupid WGL extensions + + std::string getRawGLString(); // For sending to simulator + + BOOL mInited; + BOOL mIsDisabled; + + // Extensions used by everyone + BOOL mHasMultitexture; + S32 mNumTextureUnits; + BOOL mHasMipMapGeneration; + BOOL mHasPalettedTextures; + BOOL mHasCompressedTextures; + BOOL mHasFramebufferObject; + + // ARB Extensions + BOOL mHasVertexBufferObject; + BOOL mHasPBuffer; + BOOL mHasShaderObjects; + BOOL mHasVertexShader; + BOOL mHasFragmentShader; + BOOL mHasOcclusionQuery; + BOOL mHasPointParameters; + + // Other extensions. + BOOL mHasAnisotropic; + BOOL mHasARBEnvCombine; + BOOL mHasCubeMap; + + // Vendor-specific extensions + BOOL mIsATI; + BOOL mIsNVIDIA; + BOOL mIsIntel; + BOOL mIsGF2or4MX; + BOOL mIsGF3; + BOOL mIsGFFX; + BOOL mATIOffsetVerticalLines; + BOOL mATIOldDriver; + + // Whether this version of GL is good enough for SL to use + BOOL mHasRequirements; + + // Misc extensions + BOOL mHasSeparateSpecularColor; + + S32 mDriverVersionMajor; + S32 mDriverVersionMinor; + S32 mDriverVersionRelease; + F32 mGLVersion; // e.g = 1.4 + std::string mDriverVersionVendorString; + + S32 mVRAM; // VRAM in MB + S32 mGLMaxVertexRange; + S32 mGLMaxIndexRange; + + void getPixelFormat(); // Get the best pixel format + + std::string getGLInfoString(); + void printGLInfoString(); + void getGLInfo(LLSD& info); + + // In ALL CAPS + std::string mGLVendor; + std::string mGLVendorShort; + + // In ALL CAPS + std::string mGLRenderer; + +private: + void initExtensions(); + void initGLStates(); + void initGLImages(); +}; + +extern LLGLManager gGLManager; + +class LLQuaternion; +class LLMatrix4; + +void rotate_quat(LLQuaternion& rotation); + +void flush_glerror(); // Flush GL errors when we know we're handling them correctly. + +void assert_glerror(); + +void clear_glerror(); + +//#if LL_DEBUG +# define stop_glerror() assert_glerror() +# define llglassertok() assert_glerror() +//#else +//# define stop_glerror() +//# define llglassertok() +//#endif + +#define llglassertok_always() assert_glerror() + +//////////////////////// +// +// Note: U32's are GLEnum's... +// + +// This is a class for GL state management + +/* + GL STATE MANAGEMENT DESCRIPTION + + LLGLState and its two subclasses, LLGLEnable and LLGLDisable, manage the current + enable/disable states of the GL to prevent redundant setting of state within a + render path or the accidental corruption of what state the next path expects. + + Essentially, wherever you would call glEnable set a state and then + subsequently reset it by calling glDisable (or vice versa), make an instance of + LLGLEnable with the state you want to set, and assume it will be restored to its + original state when that instance of LLGLEnable is destroyed. It is good practice + to exploit stack frame controls for optimal setting/unsetting and readability of + code. In llglstates.h, there are a collection of helper classes that define groups + of enables/disables that can cause multiple states to be set with the creation of + one instance. + + Sample usage: + + //disable lighting for rendering hud objects + //INCORRECT USAGE + LLGLEnable lighting(GL_LIGHTING); + renderHUD(); + LLGLDisable lighting(GL_LIGHTING); + + //CORRECT USAGE + { + LLGLEnable lighting(GL_LIGHTING); + renderHUD(); + } + + If a state is to be set on a conditional, the following mechanism + is useful: + + { + LLGLEnable lighting(light_hud ? GL_LIGHTING : 0); + renderHUD(); + } + + A LLGLState initialized with a parameter of 0 does nothing. + + LLGLState works by maintaining a map of the current GL states, and ignoring redundant + enables/disables. If a redundant call is attempted, it becomes a noop, otherwise, + it is set in the constructor and reset in the destructor. + + For debugging GL state corruption, running with debug enabled will trigger asserts + if the existing GL state does not match the expected GL state. + +*/ +class LLGLState +{ +public: + static void initClass(); + static void restoreGL(); + + static void resetTextureStates(); + static void dumpStates(); + static void checkStates(const std::string& msg = ""); + static void checkTextureChannels(const std::string& msg = ""); + static void checkClientArrays(const std::string& msg = "", U32 data_mask = 0x0001); + +protected: + static std::map sStateMap; + +public: + enum { CURRENT_STATE = -2 }; + LLGLState(LLGLenum state, S32 enabled = CURRENT_STATE); + ~LLGLState(); + void setEnabled(S32 enabled); + void enable() { setEnabled(TRUE); } + void disable() { setEnabled(FALSE); } +protected: + LLGLenum mState; + BOOL mWasEnabled; + BOOL mIsEnabled; +}; + +// New LLGLState class wrappers that don't depend on actual GL flags. +class LLGLEnableBlending : public LLGLState +{ +public: + LLGLEnableBlending(bool enable); +}; + +class LLGLEnableAlphaReject : public LLGLState +{ +public: + LLGLEnableAlphaReject(bool enable); +}; + +/// TODO: Being deprecated. +class LLGLEnable : public LLGLState +{ +public: + LLGLEnable(LLGLenum state) : LLGLState(state, TRUE) {} +}; + +/// TODO: Being deprecated. +class LLGLDisable : public LLGLState +{ +public: + LLGLDisable(LLGLenum state) : LLGLState(state, FALSE) {} +}; + +/* + Store and modify projection matrix to create an oblique + projection that clips to the specified plane. Oblique + projections alter values in the depth buffer, so this + class should not be used mid-renderpass. + + Restores projection matrix on destruction. + GL_MODELVIEW_MATRIX is active whenever program execution + leaves this class. + Does not stack. + Caches inverse of projection matrix used in gGLObliqueProjectionInverse +*/ +class LLGLUserClipPlane +{ +public: + + LLGLUserClipPlane(const LLPlane& plane, const glh::matrix4f& modelview, const glh::matrix4f& projection); + ~LLGLUserClipPlane(); + + void setPlane(F32 a, F32 b, F32 c, F32 d); + +private: + glh::matrix4f mProjection; + glh::matrix4f mModelview; +}; + +/* + Modify and load projection matrix to push depth values to far clip plane. + + Restores projection matrix on destruction. + GL_MODELVIEW_MATRIX is active whenever program execution + leaves this class. + Does not stack. +*/ +class LLGLClampToFarClip +{ +public: + LLGLClampToFarClip(glh::matrix4f projection); + ~LLGLClampToFarClip(); +}; + +/* + Generic pooling scheme for things which use GL names (used for occlusion queries and vertex buffer objects). + Prevents thrashing of GL name caches by avoiding calls to glGenFoo and glDeleteFoo. +*/ +class LLGLNamePool +{ +public: + typedef struct + { + GLuint name; + BOOL used; + } NameEntry; + + struct CompareUsed + { + bool operator()(const NameEntry& lhs, const NameEntry& rhs) + { + return lhs.used < rhs.used; //FALSE entries first + } + }; + + typedef std::vector name_list_t; + name_list_t mNameList; + + LLGLNamePool(); + virtual ~LLGLNamePool(); + + void upkeep(); + void cleanup(); + + GLuint allocate(); + void release(GLuint name); + + static void registerPool(LLGLNamePool* pool); + static void upkeepPools(); + static void cleanupPools(); + +protected: + typedef std::vector pool_list_t; + static pool_list_t sInstances; + + virtual GLuint allocateName() = 0; + virtual void releaseName(GLuint name) = 0; +}; + +extern LLMatrix4 gGLObliqueProjectionInverse; + +#include "llglstates.h" + +void init_glstates(); +void enable_vertex_weighting(const S32 index); +void disable_vertex_weighting(const S32 index); +void enable_binormals(const S32 index); +void disable_binormals(const S32 index); +void enable_cloth_weights(const S32 index); +void disable_cloth_weights(const S32 index); +void set_vertex_weights(const S32 index, const U32 stride, const F32 *weights); +void set_vertex_clothing_weights(const S32 index, const U32 stride, const LLVector4 *weights); +void set_binormals(const S32 index, const U32 stride, const LLVector3 *binormals); +void set_palette(U8* palette_data); +void parse_gl_version( S32* major, S32* minor, S32* release, std::string* vendor_specific ); + +extern BOOL gClothRipple; +extern BOOL gNoRender; +#endif // LL_LLGL_H diff --git a/linden/indra/llrender/llgldbg.cpp b/linden/indra/llrender/llgldbg.cpp index 953ba3a..526215b 100644 --- a/linden/indra/llrender/llgldbg.cpp +++ b/linden/indra/llrender/llgldbg.cpp @@ -43,7 +43,7 @@ //------------------------------------------------------------------------ // cmstr() //------------------------------------------------------------------------ -char *cmstr(int i) +const char *cmstr(int i) { switch( i ) { @@ -59,7 +59,7 @@ char *cmstr(int i) //------------------------------------------------------------------------ // facestr() //------------------------------------------------------------------------ -char *facestr(int i) +const char *facestr(int i) { switch( i ) { @@ -81,7 +81,7 @@ const char *boolstr(int b) //------------------------------------------------------------------------ // fv4() //------------------------------------------------------------------------ -char *fv4(F32 *f) +const char *fv4(F32 *f) { static char str[128]; sprintf(str, "%8.3f %8.3f %8.3f %8.3f", f[0], f[1], f[2], f[3]); @@ -91,7 +91,7 @@ char *fv4(F32 *f) //------------------------------------------------------------------------ // fv3() //------------------------------------------------------------------------ -char *fv3(F32 *f) +const char *fv3(F32 *f) { static char str[128]; /* Flawfinder: ignore */ snprintf(str, sizeof(str), "%8.3f, %8.3f, %8.3f", f[0], f[1], f[2]); /* Flawfinder: ignore */ @@ -101,7 +101,7 @@ char *fv3(F32 *f) //------------------------------------------------------------------------ // fv1() //------------------------------------------------------------------------ -char *fv1(F32 *f) +const char *fv1(F32 *f) { static char str[128]; /* Flawfinder: ignore */ snprintf(str, sizeof(str), "%8.3f", f[0]); /* Flawfinder: ignore */ diff --git a/linden/indra/llrender/llglheaders.h b/linden/indra/llrender/llglheaders.h new file mode 100644 index 0000000..f047262 --- /dev/null +++ b/linden/indra/llrender/llglheaders.h @@ -0,0 +1,588 @@ +/** + * @file llglheaders.h + * @brief LLGL definitions + * + * $LicenseInfo:firstyear=2001&license=viewergpl$ + * + * Copyright (c) 2001-2008, Linden Research, Inc. + * + * Second Life Viewer Source Code + * 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://secondlifegrid.net/programs/open_source/licensing/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://secondlifegrid.net/programs/open_source/licensing/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. + * $/LicenseInfo$ + */ + +#ifndef LL_LLGLHEADERS_H +#define LL_LLGLHEADERS_H + +#if LL_MESA +//---------------------------------------------------------------------------- +// MESA headers +// quotes so we get libraries/.../GL/ version +#define GL_GLEXT_PROTOTYPES +#include "GL/gl.h" +#include "GL/glext.h" +#include "GL/glu.h" + +// The __APPLE__ kludge is to make glh_extensions.h not symbol-clash horribly +# define __APPLE__ +# include "GL/glh_extensions.h" +# undef __APPLE__ + +#elif LL_LINUX +//---------------------------------------------------------------------------- +// Linux, MESA headers, but not necessarily assuming MESA runtime. +// quotes so we get libraries/.../GL/ version +#include "GL/gl.h" +#include "GL/glext.h" +#include "GL/glu.h" + + +#if LL_LINUX && !LL_MESA_HEADLESS +// The __APPLE__ kludge is to make glh_extensions.h not symbol-clash horribly +# define __APPLE__ +# include "GL/glh_extensions.h" +# undef __APPLE__ + +/* Although SDL very likely ends up calling glXGetProcAddress() itself, + if we use SDL_GL_GetProcAddress() then we get bogus addresses back on + some systems. Weird. */ +/*# include "SDL/SDL.h" + # define GLH_EXT_GET_PROC_ADDRESS(p) SDL_GL_GetProcAddress(p) */ +#define GLX_GLXEXT_PROTOTYPES 1 +# include "GL/glx.h" +# include "GL/glxext.h" +// Use glXGetProcAddressARB instead of glXGetProcAddress - the ARB symbol +// is considered 'legacy' but works on more machines. +# define GLH_EXT_GET_PROC_ADDRESS(p) glXGetProcAddressARB((const GLubyte*)(p)) +// Whee, the X headers define 'Status'. Undefine to avoid confusion. +#undef Status +#endif // LL_LINUX && !LL_MESA_HEADLESS + + +// GL_ARB_vertex_buffer_object +extern PFNGLBINDBUFFERARBPROC glBindBufferARB; +extern PFNGLDELETEBUFFERSARBPROC glDeleteBuffersARB; +extern PFNGLGENBUFFERSARBPROC glGenBuffersARB; +extern PFNGLISBUFFERARBPROC glIsBufferARB; +extern PFNGLBUFFERDATAARBPROC glBufferDataARB; +extern PFNGLBUFFERSUBDATAARBPROC glBufferSubDataARB; +extern PFNGLGETBUFFERSUBDATAARBPROC glGetBufferSubDataARB; +extern PFNGLMAPBUFFERARBPROC glMapBufferARB; +extern PFNGLUNMAPBUFFERARBPROC glUnmapBufferARB; +extern PFNGLGETBUFFERPARAMETERIVARBPROC glGetBufferParameterivARB; +extern PFNGLGETBUFFERPOINTERVARBPROC glGetBufferPointervARB; + +// GL_ATI_vertex_array_object +extern PFNGLNEWOBJECTBUFFERATIPROC glNewObjectBufferATI; +extern PFNGLISOBJECTBUFFERATIPROC glIsObjectBufferATI; +extern PFNGLUPDATEOBJECTBUFFERATIPROC glUpdateObjectBufferATI; +extern PFNGLGETOBJECTBUFFERFVATIPROC glGetObjectBufferfvATI; +extern PFNGLGETOBJECTBUFFERIVATIPROC glGetObjectBufferivATI; +extern PFNGLFREEOBJECTBUFFERATIPROC glFreeObjectBufferATI; +extern PFNGLARRAYOBJECTATIPROC glArrayObjectATI; +extern PFNGLVERTEXATTRIBARRAYOBJECTATIPROC glVertexAttribArrayObjectATI; +extern PFNGLGETARRAYOBJECTFVATIPROC glGetArrayObjectfvATI; +extern PFNGLGETARRAYOBJECTIVATIPROC glGetArrayObjectivATI; +extern PFNGLVARIANTARRAYOBJECTATIPROC glVariantObjectArrayATI; +extern PFNGLGETVARIANTARRAYOBJECTFVATIPROC glGetVariantArrayObjectfvATI; +extern PFNGLGETVARIANTARRAYOBJECTIVATIPROC glGetVariantArrayObjectivATI; + +// GL_ARB_occlusion_query +extern PFNGLGENQUERIESARBPROC glGenQueriesARB; +extern PFNGLDELETEQUERIESARBPROC glDeleteQueriesARB; +extern PFNGLISQUERYARBPROC glIsQueryARB; +extern PFNGLBEGINQUERYARBPROC glBeginQueryARB; +extern PFNGLENDQUERYARBPROC glEndQueryARB; +extern PFNGLGETQUERYIVARBPROC glGetQueryivARB; +extern PFNGLGETQUERYOBJECTIVARBPROC glGetQueryObjectivARB; +extern PFNGLGETQUERYOBJECTUIVARBPROC glGetQueryObjectuivARB; + +// GL_ARB_point_parameters +extern PFNGLPOINTPARAMETERFARBPROC glPointParameterfARB; +extern PFNGLPOINTPARAMETERFVARBPROC glPointParameterfvARB; + +// GL_ARB_shader_objects +extern PFNGLDELETEOBJECTARBPROC glDeleteObjectARB; +extern PFNGLGETHANDLEARBPROC glGetHandleARB; +extern PFNGLDETACHOBJECTARBPROC glDetachObjectARB; +extern PFNGLCREATESHADEROBJECTARBPROC glCreateShaderObjectARB; +extern PFNGLSHADERSOURCEARBPROC glShaderSourceARB; +extern PFNGLCOMPILESHADERARBPROC glCompileShaderARB; +extern PFNGLCREATEPROGRAMOBJECTARBPROC glCreateProgramObjectARB; +extern PFNGLATTACHOBJECTARBPROC glAttachObjectARB; +extern PFNGLLINKPROGRAMARBPROC glLinkProgramARB; +extern PFNGLUSEPROGRAMOBJECTARBPROC glUseProgramObjectARB; +extern PFNGLVALIDATEPROGRAMARBPROC glValidateProgramARB; +extern PFNGLUNIFORM1FARBPROC glUniform1fARB; +extern PFNGLUNIFORM2FARBPROC glUniform2fARB; +extern PFNGLUNIFORM3FARBPROC glUniform3fARB; +extern PFNGLUNIFORM4FARBPROC glUniform4fARB; +extern PFNGLUNIFORM1IARBPROC glUniform1iARB; +extern PFNGLUNIFORM2IARBPROC glUniform2iARB; +extern PFNGLUNIFORM3IARBPROC glUniform3iARB; +extern PFNGLUNIFORM4IARBPROC glUniform4iARB; +extern PFNGLUNIFORM1FVARBPROC glUniform1fvARB; +extern PFNGLUNIFORM2FVARBPROC glUniform2fvARB; +extern PFNGLUNIFORM3FVARBPROC glUniform3fvARB; +extern PFNGLUNIFORM4FVARBPROC glUniform4fvARB; +extern PFNGLUNIFORM1IVARBPROC glUniform1ivARB; +extern PFNGLUNIFORM2IVARBPROC glUniform2ivARB; +extern PFNGLUNIFORM3IVARBPROC glUniform3ivARB; +extern PFNGLUNIFORM4IVARBPROC glUniform4ivARB; +extern PFNGLUNIFORMMATRIX2FVARBPROC glUniformMatrix2fvARB; +extern PFNGLUNIFORMMATRIX3FVARBPROC glUniformMatrix3fvARB; +extern PFNGLUNIFORMMATRIX4FVARBPROC glUniformMatrix4fvARB; +extern PFNGLGETOBJECTPARAMETERFVARBPROC glGetObjectParameterfvARB; +extern PFNGLGETOBJECTPARAMETERIVARBPROC glGetObjectParameterivARB; +extern PFNGLGETINFOLOGARBPROC glGetInfoLogARB; +extern PFNGLGETATTACHEDOBJECTSARBPROC glGetAttachedObjectsARB; +extern PFNGLGETUNIFORMLOCATIONARBPROC glGetUniformLocationARB; +extern PFNGLGETACTIVEUNIFORMARBPROC glGetActiveUniformARB; +extern PFNGLGETUNIFORMFVARBPROC glGetUniformfvARB; +extern PFNGLGETUNIFORMIVARBPROC glGetUniformivARB; +extern PFNGLGETSHADERSOURCEARBPROC glGetShaderSourceARB; + +// GL_ARB_vertex_shader +extern PFNGLVERTEXATTRIB1DARBPROC glVertexAttrib1dARB; +extern PFNGLVERTEXATTRIB1DVARBPROC glVertexAttrib1dvARB; +extern PFNGLVERTEXATTRIB1FARBPROC glVertexAttrib1fARB; +extern PFNGLVERTEXATTRIB1FVARBPROC glVertexAttrib1fvARB; +extern PFNGLVERTEXATTRIB1SARBPROC glVertexAttrib1sARB; +extern PFNGLVERTEXATTRIB1SVARBPROC glVertexAttrib1svARB; +extern PFNGLVERTEXATTRIB2DARBPROC glVertexAttrib2dARB; +extern PFNGLVERTEXATTRIB2DVARBPROC glVertexAttrib2dvARB; +extern PFNGLVERTEXATTRIB2FARBPROC glVertexAttrib2fARB; +extern PFNGLVERTEXATTRIB2FVARBPROC glVertexAttrib2fvARB; +extern PFNGLVERTEXATTRIB2SARBPROC glVertexAttrib2sARB; +extern PFNGLVERTEXATTRIB2SVARBPROC glVertexAttrib2svARB; +extern PFNGLVERTEXATTRIB3DARBPROC glVertexAttrib3dARB; +extern PFNGLVERTEXATTRIB3DVARBPROC glVertexAttrib3dvARB; +extern PFNGLVERTEXATTRIB3FARBPROC glVertexAttrib3fARB; +extern PFNGLVERTEXATTRIB3FVARBPROC glVertexAttrib3fvARB; +extern PFNGLVERTEXATTRIB3SARBPROC glVertexAttrib3sARB; +extern PFNGLVERTEXATTRIB3SVARBPROC glVertexAttrib3svARB; +extern PFNGLVERTEXATTRIB4NBVARBPROC glVertexAttrib4nbvARB; +extern PFNGLVERTEXATTRIB4NIVARBPROC glVertexAttrib4nivARB; +extern PFNGLVERTEXATTRIB4NSVARBPROC glVertexAttrib4nsvARB; +extern PFNGLVERTEXATTRIB4NUBARBPROC glVertexAttrib4nubARB; +extern PFNGLVERTEXATTRIB4NUBVARBPROC glVertexAttrib4nubvARB; +extern PFNGLVERTEXATTRIB4NUIVARBPROC glVertexAttrib4nuivARB; +extern PFNGLVERTEXATTRIB4NUSVARBPROC glVertexAttrib4nusvARB; +extern PFNGLVERTEXATTRIB4BVARBPROC glVertexAttrib4bvARB; +extern PFNGLVERTEXATTRIB4DARBPROC glVertexAttrib4dARB; +extern PFNGLVERTEXATTRIB4DVARBPROC glVertexAttrib4dvARB; +extern PFNGLVERTEXATTRIB4FARBPROC glVertexAttrib4fARB; +extern PFNGLVERTEXATTRIB4FVARBPROC glVertexAttrib4fvARB; +extern PFNGLVERTEXATTRIB4IVARBPROC glVertexAttrib4ivARB; +extern PFNGLVERTEXATTRIB4SARBPROC glVertexAttrib4sARB; +extern PFNGLVERTEXATTRIB4SVARBPROC glVertexAttrib4svARB; +extern PFNGLVERTEXATTRIB4UBVARBPROC glVertexAttrib4ubvARB; +extern PFNGLVERTEXATTRIB4UIVARBPROC glVertexAttrib4uivARB; +extern PFNGLVERTEXATTRIB4USVARBPROC glVertexAttrib4usvARB; +extern PFNGLVERTEXATTRIBPOINTERARBPROC glVertexAttribPointerARB; +extern PFNGLENABLEVERTEXATTRIBARRAYARBPROC glEnableVertexAttribArrayARB; +extern PFNGLDISABLEVERTEXATTRIBARRAYARBPROC glDisableVertexAttribArrayARB; +extern PFNGLPROGRAMSTRINGARBPROC glProgramStringARB; +extern PFNGLBINDPROGRAMARBPROC glBindProgramARB; +extern PFNGLDELETEPROGRAMSARBPROC glDeleteProgramsARB; +extern PFNGLGENPROGRAMSARBPROC glGenProgramsARB; +extern PFNGLPROGRAMENVPARAMETER4DARBPROC glProgramEnvParameter4dARB; +extern PFNGLPROGRAMENVPARAMETER4DVARBPROC glProgramEnvParameter4dvARB; +extern PFNGLPROGRAMENVPARAMETER4FARBPROC glProgramEnvParameter4fARB; +extern PFNGLPROGRAMENVPARAMETER4FVARBPROC glProgramEnvParameter4fvARB; +extern PFNGLPROGRAMLOCALPARAMETER4DARBPROC glProgramLocalParameter4dARB; +extern PFNGLPROGRAMLOCALPARAMETER4DVARBPROC glProgramLocalParameter4dvARB; +extern PFNGLPROGRAMLOCALPARAMETER4FARBPROC glProgramLocalParameter4fARB; +extern PFNGLPROGRAMLOCALPARAMETER4FVARBPROC glProgramLocalParameter4fvARB; +extern PFNGLGETPROGRAMENVPARAMETERDVARBPROC glGetProgramEnvParameterdvARB; +extern PFNGLGETPROGRAMENVPARAMETERFVARBPROC glGetProgramEnvParameterfvARB; +extern PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC glGetProgramLocalParameterdvARB; +extern PFNGLGETPROGRAMLOCALPARAMETERFVARBPROC glGetProgramLocalParameterfvARB; +extern PFNGLGETPROGRAMIVARBPROC glGetProgramivARB; +extern PFNGLGETPROGRAMSTRINGARBPROC glGetProgramStringARB; +extern PFNGLGETVERTEXATTRIBDVARBPROC glGetVertexAttribdvARB; +extern PFNGLGETVERTEXATTRIBFVARBPROC glGetVertexAttribfvARB; +extern PFNGLGETVERTEXATTRIBIVARBPROC glGetVertexAttribivARB; +extern PFNGLGETVERTEXATTRIBPOINTERVARBPROC glGetVertexAttribPointervARB; +extern PFNGLISPROGRAMARBPROC glIsProgramARB; +extern PFNGLBINDATTRIBLOCATIONARBPROC glBindAttribLocationARB; +extern PFNGLGETACTIVEATTRIBARBPROC glGetActiveAttribARB; +extern PFNGLGETATTRIBLOCATIONARBPROC glGetAttribLocationARB; + +extern PFNGLCOMPRESSEDTEXIMAGE2DARBPROC glCompressedTexImage2DARB; +extern PFNGLGETCOMPRESSEDTEXIMAGEARBPROC glGetCompressedTexImageARB; + +extern PFNGLCOLORTABLEEXTPROC glColorTableEXT; + +//GL_EXT_framebuffer_object +extern PFNGLISRENDERBUFFEREXTPROC glIsRenderbufferEXT; +extern PFNGLBINDRENDERBUFFEREXTPROC glBindRenderbufferEXT; +extern PFNGLDELETERENDERBUFFERSEXTPROC glDeleteRenderbuffersEXT; +extern PFNGLGENRENDERBUFFERSEXTPROC glGenRenderbuffersEXT; +extern PFNGLRENDERBUFFERSTORAGEEXTPROC glRenderbufferStorageEXT; +extern PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC glGetRenderbufferParameterivEXT; +extern PFNGLISFRAMEBUFFEREXTPROC glIsFramebufferEXT; +extern PFNGLBINDFRAMEBUFFEREXTPROC glBindFramebufferEXT; +extern PFNGLDELETEFRAMEBUFFERSEXTPROC glDeleteFramebuffersEXT; +extern PFNGLGENFRAMEBUFFERSEXTPROC glGenFramebuffersEXT; +extern PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC glCheckFramebufferStatusEXT; +extern PFNGLFRAMEBUFFERTEXTURE1DEXTPROC glFramebufferTexture1DEXT; +extern PFNGLFRAMEBUFFERTEXTURE2DEXTPROC glFramebufferTexture2DEXT; +extern PFNGLFRAMEBUFFERTEXTURE3DEXTPROC glFramebufferTexture3DEXT; +extern PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC glFramebufferRenderbufferEXT; +extern PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC glGetFramebufferAttachmentParameterivEXT; +extern PFNGLGENERATEMIPMAPEXTPROC glGenerateMipmapEXT; + + +#elif LL_WINDOWS + +// windows gl headers depend on things like APIENTRY, so include windows. +#define WIN32_LEAN_AND_MEAN +#include +#include + +//---------------------------------------------------------------------------- +#include +#include + +// quotes so we get libraries/.../GL/ version +#include "GL/glext.h" +#include "GL/glh_extensions.h" + + +// GL_ARB_vertex_buffer_object +extern PFNGLBINDBUFFERARBPROC glBindBufferARB; +extern PFNGLDELETEBUFFERSARBPROC glDeleteBuffersARB; +extern PFNGLGENBUFFERSARBPROC glGenBuffersARB; +extern PFNGLISBUFFERARBPROC glIsBufferARB; +extern PFNGLBUFFERDATAARBPROC glBufferDataARB; +extern PFNGLBUFFERSUBDATAARBPROC glBufferSubDataARB; +extern PFNGLGETBUFFERSUBDATAARBPROC glGetBufferSubDataARB; +extern PFNGLMAPBUFFERARBPROC glMapBufferARB; +extern PFNGLUNMAPBUFFERARBPROC glUnmapBufferARB; +extern PFNGLGETBUFFERPARAMETERIVARBPROC glGetBufferParameterivARB; +extern PFNGLGETBUFFERPOINTERVARBPROC glGetBufferPointervARB; + +// GL_ATI_vertex_array_object +extern PFNGLNEWOBJECTBUFFERATIPROC glNewObjectBufferATI; +extern PFNGLISOBJECTBUFFERATIPROC glIsObjectBufferATI; +extern PFNGLUPDATEOBJECTBUFFERATIPROC glUpdateObjectBufferATI; +extern PFNGLGETOBJECTBUFFERFVATIPROC glGetObjectBufferfvATI; +extern PFNGLGETOBJECTBUFFERIVATIPROC glGetObjectBufferivATI; +extern PFNGLFREEOBJECTBUFFERATIPROC glFreeObjectBufferATI; +extern PFNGLARRAYOBJECTATIPROC glArrayObjectATI; +extern PFNGLVERTEXATTRIBARRAYOBJECTATIPROC glVertexAttribArrayObjectATI; +extern PFNGLGETARRAYOBJECTFVATIPROC glGetArrayObjectfvATI; +extern PFNGLGETARRAYOBJECTIVATIPROC glGetArrayObjectivATI; +extern PFNGLVARIANTARRAYOBJECTATIPROC glVariantObjectArrayATI; +extern PFNGLGETVARIANTARRAYOBJECTFVATIPROC glGetVariantArrayObjectfvATI; +extern PFNGLGETVARIANTARRAYOBJECTIVATIPROC glGetVariantArrayObjectivATI; + +extern PFNWGLSWAPINTERVALEXTPROC wglSwapIntervalEXT; + +// GL_ARB_occlusion_query +extern PFNGLGENQUERIESARBPROC glGenQueriesARB; +extern PFNGLDELETEQUERIESARBPROC glDeleteQueriesARB; +extern PFNGLISQUERYARBPROC glIsQueryARB; +extern PFNGLBEGINQUERYARBPROC glBeginQueryARB; +extern PFNGLENDQUERYARBPROC glEndQueryARB; +extern PFNGLGETQUERYIVARBPROC glGetQueryivARB; +extern PFNGLGETQUERYOBJECTIVARBPROC glGetQueryObjectivARB; +extern PFNGLGETQUERYOBJECTUIVARBPROC glGetQueryObjectuivARB; + +// GL_ARB_point_parameters +extern PFNGLPOINTPARAMETERFARBPROC glPointParameterfARB; +extern PFNGLPOINTPARAMETERFVARBPROC glPointParameterfvARB; + +// GL_ARB_shader_objects +extern PFNGLDELETEOBJECTARBPROC glDeleteObjectARB; +extern PFNGLGETHANDLEARBPROC glGetHandleARB; +extern PFNGLDETACHOBJECTARBPROC glDetachObjectARB; +extern PFNGLCREATESHADEROBJECTARBPROC glCreateShaderObjectARB; +extern PFNGLSHADERSOURCEARBPROC glShaderSourceARB; +extern PFNGLCOMPILESHADERARBPROC glCompileShaderARB; +extern PFNGLCREATEPROGRAMOBJECTARBPROC glCreateProgramObjectARB; +extern PFNGLATTACHOBJECTARBPROC glAttachObjectARB; +extern PFNGLLINKPROGRAMARBPROC glLinkProgramARB; +extern PFNGLUSEPROGRAMOBJECTARBPROC glUseProgramObjectARB; +extern PFNGLVALIDATEPROGRAMARBPROC glValidateProgramARB; +extern PFNGLUNIFORM1FARBPROC glUniform1fARB; +extern PFNGLUNIFORM2FARBPROC glUniform2fARB; +extern PFNGLUNIFORM3FARBPROC glUniform3fARB; +extern PFNGLUNIFORM4FARBPROC glUniform4fARB; +extern PFNGLUNIFORM1IARBPROC glUniform1iARB; +extern PFNGLUNIFORM2IARBPROC glUniform2iARB; +extern PFNGLUNIFORM3IARBPROC glUniform3iARB; +extern PFNGLUNIFORM4IARBPROC glUniform4iARB; +extern PFNGLUNIFORM1FVARBPROC glUniform1fvARB; +extern PFNGLUNIFORM2FVARBPROC glUniform2fvARB; +extern PFNGLUNIFORM3FVARBPROC glUniform3fvARB; +extern PFNGLUNIFORM4FVARBPROC glUniform4fvARB; +extern PFNGLUNIFORM1IVARBPROC glUniform1ivARB; +extern PFNGLUNIFORM2IVARBPROC glUniform2ivARB; +extern PFNGLUNIFORM3IVARBPROC glUniform3ivARB; +extern PFNGLUNIFORM4IVARBPROC glUniform4ivARB; +extern PFNGLUNIFORMMATRIX2FVARBPROC glUniformMatrix2fvARB; +extern PFNGLUNIFORMMATRIX3FVARBPROC glUniformMatrix3fvARB; +extern PFNGLUNIFORMMATRIX4FVARBPROC glUniformMatrix4fvARB; +extern PFNGLGETOBJECTPARAMETERFVARBPROC glGetObjectParameterfvARB; +extern PFNGLGETOBJECTPARAMETERIVARBPROC glGetObjectParameterivARB; +extern PFNGLGETINFOLOGARBPROC glGetInfoLogARB; +extern PFNGLGETATTACHEDOBJECTSARBPROC glGetAttachedObjectsARB; +extern PFNGLGETUNIFORMLOCATIONARBPROC glGetUniformLocationARB; +extern PFNGLGETACTIVEUNIFORMARBPROC glGetActiveUniformARB; +extern PFNGLGETUNIFORMFVARBPROC glGetUniformfvARB; +extern PFNGLGETUNIFORMIVARBPROC glGetUniformivARB; +extern PFNGLGETSHADERSOURCEARBPROC glGetShaderSourceARB; + +// GL_ARB_vertex_shader +extern PFNGLVERTEXATTRIB1DARBPROC glVertexAttrib1dARB; +extern PFNGLVERTEXATTRIB1DVARBPROC glVertexAttrib1dvARB; +extern PFNGLVERTEXATTRIB1FARBPROC glVertexAttrib1fARB; +extern PFNGLVERTEXATTRIB1FVARBPROC glVertexAttrib1fvARB; +extern PFNGLVERTEXATTRIB1SARBPROC glVertexAttrib1sARB; +extern PFNGLVERTEXATTRIB1SVARBPROC glVertexAttrib1svARB; +extern PFNGLVERTEXATTRIB2DARBPROC glVertexAttrib2dARB; +extern PFNGLVERTEXATTRIB2DVARBPROC glVertexAttrib2dvARB; +extern PFNGLVERTEXATTRIB2FARBPROC glVertexAttrib2fARB; +extern PFNGLVERTEXATTRIB2FVARBPROC glVertexAttrib2fvARB; +extern PFNGLVERTEXATTRIB2SARBPROC glVertexAttrib2sARB; +extern PFNGLVERTEXATTRIB2SVARBPROC glVertexAttrib2svARB; +extern PFNGLVERTEXATTRIB3DARBPROC glVertexAttrib3dARB; +extern PFNGLVERTEXATTRIB3DVARBPROC glVertexAttrib3dvARB; +extern PFNGLVERTEXATTRIB3FARBPROC glVertexAttrib3fARB; +extern PFNGLVERTEXATTRIB3FVARBPROC glVertexAttrib3fvARB; +extern PFNGLVERTEXATTRIB3SARBPROC glVertexAttrib3sARB; +extern PFNGLVERTEXATTRIB3SVARBPROC glVertexAttrib3svARB; +extern PFNGLVERTEXATTRIB4NBVARBPROC glVertexAttrib4nbvARB; +extern PFNGLVERTEXATTRIB4NIVARBPROC glVertexAttrib4nivARB; +extern PFNGLVERTEXATTRIB4NSVARBPROC glVertexAttrib4nsvARB; +extern PFNGLVERTEXATTRIB4NUBARBPROC glVertexAttrib4nubARB; +extern PFNGLVERTEXATTRIB4NUBVARBPROC glVertexAttrib4nubvARB; +extern PFNGLVERTEXATTRIB4NUIVARBPROC glVertexAttrib4nuivARB; +extern PFNGLVERTEXATTRIB4NUSVARBPROC glVertexAttrib4nusvARB; +extern PFNGLVERTEXATTRIB4BVARBPROC glVertexAttrib4bvARB; +extern PFNGLVERTEXATTRIB4DARBPROC glVertexAttrib4dARB; +extern PFNGLVERTEXATTRIB4DVARBPROC glVertexAttrib4dvARB; +extern PFNGLVERTEXATTRIB4FARBPROC glVertexAttrib4fARB; +extern PFNGLVERTEXATTRIB4FVARBPROC glVertexAttrib4fvARB; +extern PFNGLVERTEXATTRIB4IVARBPROC glVertexAttrib4ivARB; +extern PFNGLVERTEXATTRIB4SARBPROC glVertexAttrib4sARB; +extern PFNGLVERTEXATTRIB4SVARBPROC glVertexAttrib4svARB; +extern PFNGLVERTEXATTRIB4UBVARBPROC glVertexAttrib4ubvARB; +extern PFNGLVERTEXATTRIB4UIVARBPROC glVertexAttrib4uivARB; +extern PFNGLVERTEXATTRIB4USVARBPROC glVertexAttrib4usvARB; +extern PFNGLVERTEXATTRIBPOINTERARBPROC glVertexAttribPointerARB; +extern PFNGLENABLEVERTEXATTRIBARRAYARBPROC glEnableVertexAttribArrayARB; +extern PFNGLDISABLEVERTEXATTRIBARRAYARBPROC glDisableVertexAttribArrayARB; +extern PFNGLPROGRAMSTRINGARBPROC glProgramStringARB; +extern PFNGLBINDPROGRAMARBPROC glBindProgramARB; +extern PFNGLDELETEPROGRAMSARBPROC glDeleteProgramsARB; +extern PFNGLGENPROGRAMSARBPROC glGenProgramsARB; +extern PFNGLPROGRAMENVPARAMETER4DARBPROC glProgramEnvParameter4dARB; +extern PFNGLPROGRAMENVPARAMETER4DVARBPROC glProgramEnvParameter4dvARB; +extern PFNGLPROGRAMENVPARAMETER4FARBPROC glProgramEnvParameter4fARB; +extern PFNGLPROGRAMENVPARAMETER4FVARBPROC glProgramEnvParameter4fvARB; +extern PFNGLPROGRAMLOCALPARAMETER4DARBPROC glProgramLocalParameter4dARB; +extern PFNGLPROGRAMLOCALPARAMETER4DVARBPROC glProgramLocalParameter4dvARB; +extern PFNGLPROGRAMLOCALPARAMETER4FARBPROC glProgramLocalParameter4fARB; +extern PFNGLPROGRAMLOCALPARAMETER4FVARBPROC glProgramLocalParameter4fvARB; +extern PFNGLGETPROGRAMENVPARAMETERDVARBPROC glGetProgramEnvParameterdvARB; +extern PFNGLGETPROGRAMENVPARAMETERFVARBPROC glGetProgramEnvParameterfvARB; +extern PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC glGetProgramLocalParameterdvARB; +extern PFNGLGETPROGRAMLOCALPARAMETERFVARBPROC glGetProgramLocalParameterfvARB; +extern PFNGLGETPROGRAMIVARBPROC glGetProgramivARB; +extern PFNGLGETPROGRAMSTRINGARBPROC glGetProgramStringARB; +extern PFNGLGETVERTEXATTRIBDVARBPROC glGetVertexAttribdvARB; +extern PFNGLGETVERTEXATTRIBFVARBPROC glGetVertexAttribfvARB; +extern PFNGLGETVERTEXATTRIBIVARBPROC glGetVertexAttribivARB; +extern PFNGLGETVERTEXATTRIBPOINTERVARBPROC glGetVertexAttribPointervARB; +extern PFNGLISPROGRAMARBPROC glIsProgramARB; +extern PFNGLBINDATTRIBLOCATIONARBPROC glBindAttribLocationARB; +extern PFNGLGETACTIVEATTRIBARBPROC glGetActiveAttribARB; +extern PFNGLGETATTRIBLOCATIONARBPROC glGetAttribLocationARB; + +//GL_EXT_framebuffer_object +extern PFNGLISRENDERBUFFEREXTPROC glIsRenderbufferEXT; +extern PFNGLBINDRENDERBUFFEREXTPROC glBindRenderbufferEXT; +extern PFNGLDELETERENDERBUFFERSEXTPROC glDeleteRenderbuffersEXT; +extern PFNGLGENRENDERBUFFERSEXTPROC glGenRenderbuffersEXT; +extern PFNGLRENDERBUFFERSTORAGEEXTPROC glRenderbufferStorageEXT; +extern PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC glGetRenderbufferParameterivEXT; +extern PFNGLISFRAMEBUFFEREXTPROC glIsFramebufferEXT; +extern PFNGLBINDFRAMEBUFFEREXTPROC glBindFramebufferEXT; +extern PFNGLDELETEFRAMEBUFFERSEXTPROC glDeleteFramebuffersEXT; +extern PFNGLGENFRAMEBUFFERSEXTPROC glGenFramebuffersEXT; +extern PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC glCheckFramebufferStatusEXT; +extern PFNGLFRAMEBUFFERTEXTURE1DEXTPROC glFramebufferTexture1DEXT; +extern PFNGLFRAMEBUFFERTEXTURE2DEXTPROC glFramebufferTexture2DEXT; +extern PFNGLFRAMEBUFFERTEXTURE3DEXTPROC glFramebufferTexture3DEXT; +extern PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC glFramebufferRenderbufferEXT; +extern PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC glGetFramebufferAttachmentParameterivEXT; +extern PFNGLGENERATEMIPMAPEXTPROC glGenerateMipmapEXT; + + +#elif LL_DARWIN +//---------------------------------------------------------------------------- +// LL_DARWIN + +#include +#include + +#define GL_EXT_separate_specular_color 1 +#include + +#include "GL/glh_extensions.h" + +// These symbols don't exist on 10.3.9, so they have to be declared weak. Redeclaring them here fixes the problem. +// Note that they also must not be called on 10.3.9. This should be taken care of by a runtime check for the existence of the GL extension. +#include + +// GL_EXT_framebuffer_object +extern GLboolean glIsRenderbufferEXT(GLuint renderbuffer) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; +extern void glBindRenderbufferEXT(GLenum target, GLuint renderbuffer) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; +extern void glDeleteRenderbuffersEXT(GLsizei n, const GLuint *renderbuffers) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; +extern void glGenRenderbuffersEXT(GLsizei n, GLuint *renderbuffers) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; +extern void glRenderbufferStorageEXT(GLenum target, GLenum internalformat, GLsizei width, GLsizei height) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; +extern void glGetRenderbufferParameterivEXT(GLenum target, GLenum pname, GLint *params) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; +extern GLboolean glIsFramebufferEXT(GLuint framebuffer) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; +extern void glBindFramebufferEXT(GLenum target, GLuint framebuffer) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; +extern void glDeleteFramebuffersEXT(GLsizei n, const GLuint *framebuffers) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; +extern void glGenFramebuffersEXT(GLsizei n, GLuint *framebuffers) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; +extern GLenum glCheckFramebufferStatusEXT(GLenum target) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; +extern void glFramebufferTexture1DEXT(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; +extern void glFramebufferTexture2DEXT(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; +extern void glFramebufferTexture3DEXT(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; +extern void glFramebufferRenderbufferEXT(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; +extern void glGetFramebufferAttachmentParameterivEXT(GLenum target, GLenum attachment, GLenum pname, GLint *params) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; +extern void glGenerateMipmapEXT(GLenum target) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; + + +#ifdef __cplusplus +extern "C" { +#endif +// +// Define vertex buffer object headers on Mac +// +#ifndef GL_ARB_vertex_buffer_object +#define GL_BUFFER_SIZE_ARB 0x8764 +#define GL_BUFFER_USAGE_ARB 0x8765 +#define GL_ARRAY_BUFFER_ARB 0x8892 +#define GL_ELEMENT_ARRAY_BUFFER_ARB 0x8893 +#define GL_ARRAY_BUFFER_BINDING_ARB 0x8894 +#define GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB 0x8895 +#define GL_VERTEX_ARRAY_BUFFER_BINDING_ARB 0x8896 +#define GL_NORMAL_ARRAY_BUFFER_BINDING_ARB 0x8897 +#define GL_COLOR_ARRAY_BUFFER_BINDING_ARB 0x8898 +#define GL_INDEX_ARRAY_BUFFER_BINDING_ARB 0x8899 +#define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB 0x889A +#define GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB 0x889B +#define GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB 0x889C +#define GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB 0x889D +#define GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB 0x889E +#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB 0x889F +#define GL_READ_ONLY_ARB 0x88B8 +#define GL_WRITE_ONLY_ARB 0x88B9 +#define GL_READ_WRITE_ARB 0x88BA +#define GL_BUFFER_ACCESS_ARB 0x88BB +#define GL_BUFFER_MAPPED_ARB 0x88BC +#define GL_BUFFER_MAP_POINTER_ARB 0x88BD +#define GL_STREAM_DRAW_ARB 0x88E0 +#define GL_STREAM_READ_ARB 0x88E1 +#define GL_STREAM_COPY_ARB 0x88E2 +#define GL_STATIC_DRAW_ARB 0x88E4 +#define GL_STATIC_READ_ARB 0x88E5 +#define GL_STATIC_COPY_ARB 0x88E6 +#define GL_DYNAMIC_DRAW_ARB 0x88E8 +#define GL_DYNAMIC_READ_ARB 0x88E9 +#define GL_DYNAMIC_COPY_ARB 0x88EA +#endif + + + +#ifndef GL_ARB_vertex_buffer_object +/* GL types for handling large vertex buffer objects */ +typedef intptr_t GLintptrARB; +typedef intptr_t GLsizeiptrARB; +#endif + + +#ifndef GL_ARB_vertex_buffer_object +#define GL_ARB_vertex_buffer_object 1 +#ifdef GL_GLEXT_FUNCTION_POINTERS +typedef void (* glBindBufferARBProcPtr) (GLenum target, GLuint buffer); +typedef void (* glDeleteBufferARBProcPtr) (GLsizei n, const GLuint *buffers); +typedef void (* glGenBuffersARBProcPtr) (GLsizei n, GLuint *buffers); +typedef GLboolean (* glIsBufferARBProcPtr) (GLuint buffer); +typedef void (* glBufferDataARBProcPtr) (GLenum target, GLsizeiptrARB size, const GLvoid *data, GLenum usage); +typedef void (* glBufferSubDataARBProcPtr) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid *data); +typedef void (* glGetBufferSubDataARBProcPtr) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, GLvoid *data); +typedef GLvoid* (* glMapBufferARBProcPtr) (GLenum target, GLenum access); /* Flawfinder: ignore */ +typedef GLboolean (* glUnmapBufferARBProcPtr) (GLenum target); +typedef void (* glGetBufferParameterivARBProcPtr) (GLenum target, GLenum pname, GLint *params); +typedef void (* glGetBufferPointervARBProcPtr) (GLenum target, GLenum pname, GLvoid* *params); +#else +extern void glBindBufferARB (GLenum, GLuint); +extern void glDeleteBuffersARB (GLsizei, const GLuint *); +extern void glGenBuffersARB (GLsizei, GLuint *); +extern GLboolean glIsBufferARB (GLuint); +extern void glBufferDataARB (GLenum, GLsizeiptrARB, const GLvoid *, GLenum); +extern void glBufferSubDataARB (GLenum, GLintptrARB, GLsizeiptrARB, const GLvoid *); +extern void glGetBufferSubDataARB (GLenum, GLintptrARB, GLsizeiptrARB, GLvoid *); +extern GLvoid* glMapBufferARB (GLenum, GLenum); +extern GLboolean glUnmapBufferARB (GLenum); +extern void glGetBufferParameterivARB (GLenum, GLenum, GLint *); +extern void glGetBufferPointervARB (GLenum, GLenum, GLvoid* *); +#endif /* GL_GLEXT_FUNCTION_POINTERS */ +#endif + +// May be needed for DARWIN... +// #ifndef GL_ARB_compressed_tex_image +// #define GL_ARB_compressed_tex_image 1 +// #ifdef GL_GLEXT_FUNCTION_POINTERS +// typedef void (* glCompressedTexImage1D) (GLenum, GLint, GLenum, GLsizei, GLint, GLsizei, const GLvoid*); +// typedef void (* glCompressedTexImage2D) (GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const GLvoid*); +// typedef void (* glCompressedTexImage3D) (GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const GLvoid*); +// typedef void (* glCompressedTexSubImage1D) (GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, const GLvoid*); +// typedef void (* glCompressedTexSubImage2D) (GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid*); +// typedef void (* glCompressedTexSubImage3D) (GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid*); +// typedef void (* glGetCompressedTexImage) (GLenum, GLint, GLvoid*); +// #else +// extern void glCompressedTexImage1D (GLenum, GLint, GLenum, GLsizei, GLint, GLsizei, const GLvoid*); +// extern void glCompressedTexImage2D (GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const GLvoid*); +// extern void glCompressedTexImage3D (GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const GLvoid*); +// extern void glCompressedTexSubImage1D (GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, const GLvoid*); +// extern void glCompressedTexSubImage2D (GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid*); +// extern void glCompressedTexSubImage3D (GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid*); +// extern void glGetCompressedTexImage (GLenum, GLint, GLvoid*); +// #endif /* GL_GLEXT_FUNCTION_POINTERS */ +// #endif + +#ifdef __cplusplus +} +#endif + +#include + +#endif // LL_MESA / LL_WINDOWS / LL_DARWIN + + +#endif // LL_LLGLHEADERS_H diff --git a/linden/indra/llrender/llglimmediate.cpp b/linden/indra/llrender/llglimmediate.cpp index 17c2182..9b60e49 100644 --- a/linden/indra/llrender/llglimmediate.cpp +++ b/linden/indra/llrender/llglimmediate.cpp @@ -1 +1,265 @@ +<<<<<<< .working #error This file has been renamed llrender.cpp +======= +/** + * @file llglimmediate.cpp + * @brief LLGLImmediate implementation + * + * $LicenseInfo:firstyear=2001&license=viewergpl$ + * + * Copyright (c) 2001-2008, Linden Research, Inc. + * + * Second Life Viewer Source Code + * 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://secondlifegrid.net/programs/open_source/licensing/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://secondlifegrid.net/programs/open_source/licensing/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. + * $/LicenseInfo$ + */ + +#include "linden_common.h" + +#include "llglimmediate.h" +#include "llvertexbuffer.h" + +LLGLImmediate gGL; + +const U32 immediate_mask = LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_COLOR | LLVertexBuffer::MAP_TEXCOORD; + +LLGLImmediate::LLGLImmediate() +{ + mCount = 0; + mMode = LLVertexBuffer::TRIANGLES; + mBuffer = new LLVertexBuffer(immediate_mask, 0); + mBuffer->allocateBuffer(4096, 0, TRUE); + mBuffer->getVertexStrider(mVerticesp); + mBuffer->getTexCoordStrider(mTexcoordsp); + mBuffer->getColorStrider(mColorsp); +} + +void LLGLImmediate::translatef(const GLfloat& x, const GLfloat& y, const GLfloat& z) +{ + flush(); + glTranslatef(x,y,z); +} + +void LLGLImmediate::scalef(const GLfloat& x, const GLfloat& y, const GLfloat& z) +{ + flush(); + glScalef(x,y,z); +} + +void LLGLImmediate::pushMatrix() +{ + flush(); + glPushMatrix(); +} + +void LLGLImmediate::popMatrix() +{ + flush(); + glPopMatrix(); +} + +void LLGLImmediate::blendFunc(GLenum sfactor, GLenum dfactor) +{ + flush(); + glBlendFunc(sfactor, dfactor); +} + +void LLGLImmediate::begin(const GLuint& mode) +{ + if (mode != mMode) + { + if (mMode == LLVertexBuffer::QUADS || + mMode == LLVertexBuffer::LINES || + mMode == LLVertexBuffer::TRIANGLES || + mMode == LLVertexBuffer::POINTS) + { + flush(); + } + else if (mCount != 0) + { + llerrs << "gGL.begin() called redundantly." << llendl; + } + + mMode = mode; + } +} + +void LLGLImmediate::end() +{ + if (mCount == 0) + { + return; + //IMM_ERRS << "GL begin and end called with no vertices specified." << llendl; + } + + if ((mMode != LLVertexBuffer::QUADS && + mMode != LLVertexBuffer::LINES && + mMode != LLVertexBuffer::TRIANGLES && + mMode != LLVertexBuffer::POINTS) || + mCount > 2048) + { + flush(); + } +} + +void LLGLImmediate::flush() +{ + if (mCount > 0) + { +#if 0 + if (!glIsEnabled(GL_VERTEX_ARRAY)) + { + llerrs << "foo 1" << llendl; + } + + if (!glIsEnabled(GL_COLOR_ARRAY)) + { + llerrs << "foo 2" << llendl; + } + + if (!glIsEnabled(GL_TEXTURE_COORD_ARRAY)) + { + llerrs << "foo 3" << llendl; + } + + if (glIsEnabled(GL_NORMAL_ARRAY)) + { + llerrs << "foo 7" << llendl; + } + + GLvoid* pointer; + + glGetPointerv(GL_VERTEX_ARRAY_POINTER, &pointer); + if (pointer != &(mBuffer[0].v)) + { + llerrs << "foo 4" << llendl; + } + + glGetPointerv(GL_COLOR_ARRAY_POINTER, &pointer); + if (pointer != &(mBuffer[0].c)) + { + llerrs << "foo 5" << llendl; + } + + glGetPointerv(GL_TEXTURE_COORD_ARRAY_POINTER, &pointer); + if (pointer != &(mBuffer[0].uv)) + { + llerrs << "foo 6" << llendl; + } +#endif + + mBuffer->setBuffer(immediate_mask); + mBuffer->drawArrays(mMode, 0, mCount); + + mVerticesp[0] = mVerticesp[mCount]; + mTexcoordsp[0] = mTexcoordsp[mCount]; + mColorsp[0] = mColorsp[mCount]; + mCount = 0; + } +} + +void LLGLImmediate::vertex3f(const GLfloat& x, const GLfloat& y, const GLfloat& z) +{ + if (mCount >= 4096) + { + // llwarns << "GL immediate mode overflow. Some geometry not drawn." << llendl; + return; + } + + mVerticesp[mCount] = LLVector3(x,y,z); + mCount++; + if (mCount < 4096) + { + mVerticesp[mCount] = mVerticesp[mCount-1]; + mColorsp[mCount] = mColorsp[mCount-1]; + mTexcoordsp[mCount] = mTexcoordsp[mCount-1]; + } +} + +void LLGLImmediate::vertex2i(const GLint& x, const GLint& y) +{ + vertex3f((GLfloat) x, (GLfloat) y, 0); +} + +void LLGLImmediate::vertex2f(const GLfloat& x, const GLfloat& y) +{ + vertex3f(x,y,0); +} + +void LLGLImmediate::vertex2fv(const GLfloat* v) +{ + vertex3f(v[0], v[1], 0); +} + +void LLGLImmediate::vertex3fv(const GLfloat* v) +{ + vertex3f(v[0], v[1], v[2]); +} + +void LLGLImmediate::texCoord2f(const GLfloat& x, const GLfloat& y) +{ + mTexcoordsp[mCount] = LLVector2(x,y); +} + +void LLGLImmediate::texCoord2i(const GLint& x, const GLint& y) +{ + texCoord2f((GLfloat) x, (GLfloat) y); +} + +void LLGLImmediate::texCoord2fv(const GLfloat* tc) +{ + texCoord2f(tc[0], tc[1]); +} + +void LLGLImmediate::color4ub(const GLubyte& r, const GLubyte& g, const GLubyte& b, const GLubyte& a) +{ + mColorsp[mCount] = LLColor4U(r,g,b,a); +} + +void LLGLImmediate::color4ubv(const GLubyte* c) +{ + color4ub(c[0], c[1], c[2], c[3]); +} + +void LLGLImmediate::color4f(const GLfloat& r, const GLfloat& g, const GLfloat& b, const GLfloat& a) +{ + color4ub((GLubyte) (llclamp(r, 0.f, 1.f)*255), + (GLubyte) (llclamp(g, 0.f, 1.f)*255), + (GLubyte) (llclamp(b, 0.f, 1.f)*255), + (GLubyte) (llclamp(a, 0.f, 1.f)*255)); +} + +void LLGLImmediate::color4fv(const GLfloat* c) +{ + color4f(c[0],c[1],c[2],c[3]); +} + +void LLGLImmediate::color3f(const GLfloat& r, const GLfloat& g, const GLfloat& b) +{ + color4f(r,g,b,1); +} + +void LLGLImmediate::color3fv(const GLfloat* c) +{ + color4f(c[0],c[1],c[2],1); +} + +>>>>>>> .merge-right.r88690 diff --git a/linden/indra/llrender/llglimmediate.h b/linden/indra/llrender/llglimmediate.h index 4a7a0eb..2d7d768 100644 --- a/linden/indra/llrender/llglimmediate.h +++ b/linden/indra/llrender/llglimmediate.h @@ -1 +1,98 @@ +<<<<<<< .working #error This file has been renamed llrender.h +======= +/** + * @file llglimmediate.h + * @brief LLGLImmediate definition + * + * This class acts as a wrapper for OpenGL immediate calls concerning glBegin and glEnd. + * The goal of this class is to minimize the number of api calls due to legacy rendering + * code, and to define an interface for a multiple rendering API abstraction of the UI + * rendering. + * + * $LicenseInfo:firstyear=2001&license=viewergpl$ + * + * Copyright (c) 2001-2008, Linden Research, Inc. + * + * Second Life Viewer Source Code + * 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://secondlifegrid.net/programs/open_source/licensing/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://secondlifegrid.net/programs/open_source/licensing/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. + * $/LicenseInfo$ + */ + +#ifndef LL_LLGLIMMEDIATE_H +#define LL_LLGLIMMEDIATE_H + +#include "stdtypes.h" +#include "llgltypes.h" +#include "llglheaders.h" +#include "llvertexbuffer.h" + +class LLGLImmediate +{ +public: + LLGLImmediate(); + + void translatef(const GLfloat& x, const GLfloat& y, const GLfloat& z); + void scalef(const GLfloat& x, const GLfloat& y, const GLfloat& z); + void pushMatrix(); + void popMatrix(); + void blendFunc(GLenum sfactor, GLenum dfactor); + void flush(); + + void begin(const GLuint& mode); + void end(); + void vertex2i(const GLint& x, const GLint& y); + void vertex2f(const GLfloat& x, const GLfloat& y); + void vertex3f(const GLfloat& x, const GLfloat& y, const GLfloat& z); + void vertex2fv(const GLfloat* v); + void vertex3fv(const GLfloat* v); + + void texCoord2i(const GLint& x, const GLint& y); + void texCoord2f(const GLfloat& x, const GLfloat& y); + void texCoord2fv(const GLfloat* tc); + + void color4ub(const GLubyte& r, const GLubyte& g, const GLubyte& b, const GLubyte& a); + void color4f(const GLfloat& r, const GLfloat& g, const GLfloat& b, const GLfloat& a); + void color4fv(const GLfloat* c); + void color3f(const GLfloat& r, const GLfloat& g, const GLfloat& b); + void color3fv(const GLfloat* c); + void color4ubv(const GLubyte* c); + + typedef struct Vertex + { + GLfloat v[3]; + GLubyte c[4]; + GLfloat uv[2]; + }; + +private: + U32 mCount; + U32 mMode; + LLPointer mBuffer; + LLStrider mVerticesp; + LLStrider mTexcoordsp; + LLStrider mColorsp; +}; + +extern LLGLImmediate gGL; + +#endif +>>>>>>> .merge-right.r88690 diff --git a/linden/indra/llrender/llglslshader.cpp b/linden/indra/llrender/llglslshader.cpp new file mode 100644 index 0000000..26984e1 --- /dev/null +++ b/linden/indra/llrender/llglslshader.cpp @@ -0,0 +1,823 @@ +/** + * @file llglslshader.cpp + * @brief GLSL helper functions and state. + * + * $LicenseInfo:firstyear=2005&license=viewergpl$ + * + * Copyright (c) 2005-2008, Linden Research, Inc. + * + * Second Life Viewer Source Code + * 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://secondlifegrid.net/programs/open_source/licensing/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://secondlifegrid.net/programs/open_source/licensing/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. + * $/LicenseInfo$ + */ + +#include "linden_common.h" + +#include "llglslshader.h" + +#include "llshadermgr.h" +#include "llfile.h" +#include "llrender.h" + +#if LL_DARWIN +#include "OpenGL/OpenGL.h" +#endif + +#ifdef LL_RELEASE_FOR_DOWNLOAD +#define UNIFORM_ERRS LL_WARNS_ONCE("Shader") +#else +#define UNIFORM_ERRS LL_ERRS("Shader") +#endif + +// Lots of STL stuff in here, using namespace std to keep things more readable +using std::vector; +using std::pair; +using std::make_pair; +using std::string; + +BOOL shouldChange(const LLVector4& v1, const LLVector4& v2) +{ + return v1 != v2; +} + +LLShaderFeatures::LLShaderFeatures() +: calculatesLighting(false), isShiny(false), isFullbright(false), hasWaterFog(false), +hasTransport(false), hasSkinning(false), hasAtmospherics(false), isSpecular(false), +hasGamma(false), hasLighting(false), calculatesAtmospherics(false) +{ +} + +//=============================== +// LLGLSL Shader implementation +//=============================== +LLGLSLShader::LLGLSLShader() +: mProgramObject(0), mShaderLevel(0), mShaderGroup(SG_DEFAULT) +{ +} + +void LLGLSLShader::unload() +{ + stop_glerror(); + mAttribute.clear(); + mTexture.clear(); + mUniform.clear(); + mShaderFiles.clear(); + + if (mProgramObject) + { + GLhandleARB obj[1024]; + GLsizei count; + + glGetAttachedObjectsARB(mProgramObject, 1024, &count, obj); + for (GLsizei i = 0; i < count; i++) + { + glDeleteObjectARB(obj[i]); + } + + glDeleteObjectARB(mProgramObject); + + mProgramObject = 0; + } + + //hack to make apple not complain + glGetError(); + + stop_glerror(); +} + +BOOL LLGLSLShader::createShader(vector * attributes, + vector * uniforms) +{ + llassert_always(!mShaderFiles.empty()); + BOOL success = TRUE; + + // Create program + mProgramObject = glCreateProgramObjectARB(); + + // Attach existing objects + if (!LLShaderMgr::instance()->attachShaderFeatures(this)) + { + return FALSE; + } + + vector< pair >::iterator fileIter = mShaderFiles.begin(); + for ( ; fileIter != mShaderFiles.end(); fileIter++ ) + { + GLhandleARB shaderhandle = LLShaderMgr::instance()->loadShaderFile((*fileIter).first, mShaderLevel, (*fileIter).second); + LL_DEBUGS("ShaderLoading") << "SHADER FILE: " << (*fileIter).first << " mShaderLevel=" << mShaderLevel << LL_ENDL; + if (mShaderLevel > 0) + { + attachObject(shaderhandle); + } + else + { + success = FALSE; + } + } + + // Map attributes and uniforms + if (success) + { + success = mapAttributes(attributes); + } + if (success) + { + success = mapUniforms(uniforms); + } + if( !success ) + { + LL_WARNS("ShaderLoading") << "Failed to link shader: " << mName << LL_ENDL; + + // Try again using a lower shader level; + if (mShaderLevel > 0) + { + LL_WARNS("ShaderLoading") << "Failed to link using shader level " << mShaderLevel << " trying again using shader level " << (mShaderLevel - 1) << LL_ENDL; + mShaderLevel--; + return createShader(attributes,uniforms); + } + } + return success; +} + +BOOL LLGLSLShader::attachObject(std::string object) +{ + if (LLShaderMgr::instance()->mShaderObjects.count(object) > 0) + { + stop_glerror(); + glAttachObjectARB(mProgramObject, LLShaderMgr::instance()->mShaderObjects[object]); + stop_glerror(); + return TRUE; + } + else + { + LL_WARNS("ShaderLoading") << "Attempting to attach shader object that hasn't been compiled: " << object << LL_ENDL; + return FALSE; + } +} + +void LLGLSLShader::attachObject(GLhandleARB object) +{ + if (object != 0) + { + stop_glerror(); + glAttachObjectARB(mProgramObject, object); + stop_glerror(); + } + else + { + LL_WARNS("ShaderLoading") << "Attempting to attach non existing shader object. " << LL_ENDL; + } +} + +void LLGLSLShader::attachObjects(GLhandleARB* objects, S32 count) +{ + for (S32 i = 0; i < count; i++) + { + attachObject(objects[i]); + } +} + +BOOL LLGLSLShader::mapAttributes(const vector * attributes) +{ + //link the program + BOOL res = link(); + + mAttribute.clear(); + U32 numAttributes = (attributes == NULL) ? 0 : attributes->size(); + mAttribute.resize(LLShaderMgr::instance()->mReservedAttribs.size() + numAttributes, -1); + + if (res) + { //read back channel locations + + //read back reserved channels first + for (U32 i = 0; i < (S32) LLShaderMgr::instance()->mReservedAttribs.size(); i++) + { + const char* name = LLShaderMgr::instance()->mReservedAttribs[i].c_str(); + S32 index = glGetAttribLocationARB(mProgramObject, (const GLcharARB *)name); + if (index != -1) + { + mAttribute[i] = index; + LL_DEBUGS("ShaderLoading") << "Attribute " << name << " assigned to channel " << index << LL_ENDL; + } + } + if (attributes != NULL) + { + for (U32 i = 0; i < numAttributes; i++) + { + const char* name = (*attributes)[i].c_str(); + S32 index = glGetAttribLocationARB(mProgramObject, name); + if (index != -1) + { + mAttribute[LLShaderMgr::instance()->mReservedAttribs.size() + i] = index; + LL_DEBUGS("ShaderLoading") << "Attribute " << name << " assigned to channel " << index << LL_ENDL; + } + } + } + + return TRUE; + } + + return FALSE; +} + +void LLGLSLShader::mapUniform(GLint index, const vector * uniforms) +{ + if (index == -1) + { + return; + } + + GLenum type; + GLsizei length; + GLint size; + char name[1024]; /* Flawfinder: ignore */ + name[0] = 0; + + glGetActiveUniformARB(mProgramObject, index, 1024, &length, &size, &type, (GLcharARB *)name); + S32 location = glGetUniformLocationARB(mProgramObject, name); + if (location != -1) + { + mUniformMap[name] = location; + LL_DEBUGS("ShaderLoading") << "Uniform " << name << " is at location " << location << LL_ENDL; + + //find the index of this uniform + for (S32 i = 0; i < (S32) LLShaderMgr::instance()->mReservedUniforms.size(); i++) + { + if ( (mUniform[i] == -1) + && (LLShaderMgr::instance()->mReservedUniforms[i].compare(0, length, name, LLShaderMgr::instance()->mReservedUniforms[i].length()) == 0)) + { + //found it + mUniform[i] = location; + mTexture[i] = mapUniformTextureChannel(location, type); + return; + } + } + + if (uniforms != NULL) + { + for (U32 i = 0; i < uniforms->size(); i++) + { + if ( (mUniform[i+LLShaderMgr::instance()->mReservedUniforms.size()] == -1) + && ((*uniforms)[i].compare(0, length, name, (*uniforms)[i].length()) == 0)) + { + //found it + mUniform[i+LLShaderMgr::instance()->mReservedUniforms.size()] = location; + mTexture[i+LLShaderMgr::instance()->mReservedUniforms.size()] = mapUniformTextureChannel(location, type); + return; + } + } + } + } + } + +GLint LLGLSLShader::mapUniformTextureChannel(GLint location, GLenum type) +{ + if (type >= GL_SAMPLER_1D_ARB && type <= GL_SAMPLER_2D_RECT_SHADOW_ARB) + { //this here is a texture + glUniform1iARB(location, mActiveTextureChannels); + LL_DEBUGS("ShaderLoading") << "Assigned to texture channel " << mActiveTextureChannels << LL_ENDL; + return mActiveTextureChannels++; + } + return -1; +} + +BOOL LLGLSLShader::mapUniforms(const vector * uniforms) +{ + BOOL res = TRUE; + + mActiveTextureChannels = 0; + mUniform.clear(); + mUniformMap.clear(); + mTexture.clear(); + mValue.clear(); + //initialize arrays + U32 numUniforms = (uniforms == NULL) ? 0 : uniforms->size(); + mUniform.resize(numUniforms + LLShaderMgr::instance()->mReservedUniforms.size(), -1); + mTexture.resize(numUniforms + LLShaderMgr::instance()->mReservedUniforms.size(), -1); + + bind(); + + //get the number of active uniforms + GLint activeCount; + glGetObjectParameterivARB(mProgramObject, GL_OBJECT_ACTIVE_UNIFORMS_ARB, &activeCount); + + for (S32 i = 0; i < activeCount; i++) + { + mapUniform(i, uniforms); + } + + unbind(); + + return res; +} + +BOOL LLGLSLShader::link(BOOL suppress_errors) +{ + return LLShaderMgr::instance()->linkProgramObject(mProgramObject, suppress_errors); +} + +void LLGLSLShader::bind() +{ + if (gGLManager.mHasShaderObjects) + { + glUseProgramObjectARB(mProgramObject); + + if (mUniformsDirty) + { + LLShaderMgr::instance()->updateShaderUniforms(this); + mUniformsDirty = FALSE; + } + } +} + +void LLGLSLShader::unbind() +{ + if (gGLManager.mHasShaderObjects) + { + for (U32 i = 0; i < mAttribute.size(); ++i) + { + vertexAttrib4f(i, 0,0,0,1); + } + glUseProgramObjectARB(0); + } +} + +void LLGLSLShader::bindNoShader(void) +{ + glUseProgramObjectARB(0); +} + +S32 LLGLSLShader::enableTexture(S32 uniform, S32 mode) +{ + if (uniform < 0 || uniform >= (S32)mTexture.size()) + { + UNIFORM_ERRS << "Uniform out of range: " << uniform << LL_ENDL; + return -1; + } + S32 index = mTexture[uniform]; + if (index != -1) + { + gGL.getTexUnit(index)->activate(); + glEnable(mode); + } + return index; +} + +S32 LLGLSLShader::disableTexture(S32 uniform, S32 mode) +{ + if (uniform < 0 || uniform >= (S32)mTexture.size()) + { + UNIFORM_ERRS << "Uniform out of range: " << uniform << LL_ENDL; + return -1; + } + S32 index = mTexture[uniform]; + if (index != -1) + { + gGL.getTexUnit(index)->activate(); + glDisable(mode); + } + return index; +} + +void LLGLSLShader::uniform1f(U32 index, GLfloat x) +{ + if (mProgramObject > 0) + { + if (mUniform.size() <= index) + { + UNIFORM_ERRS << "Uniform index out of bounds." << LL_ENDL; + return; + } + + if (mUniform[index] >= 0) + { + std::map::iterator iter = mValue.find(mUniform[index]); + if (iter == mValue.end() || iter->second.mV[0] != x) + { + glUniform1fARB(mUniform[index], x); + mValue[mUniform[index]] = LLVector4(x,0.f,0.f,0.f); + } + } + } +} + +void LLGLSLShader::uniform2f(U32 index, GLfloat x, GLfloat y) +{ + if (mProgramObject > 0) + { + if (mUniform.size() <= index) + { + UNIFORM_ERRS << "Uniform index out of bounds." << LL_ENDL; + return; + } + + if (mUniform[index] >= 0) + { + std::map::iterator iter = mValue.find(mUniform[index]); + LLVector4 vec(x,y,0.f,0.f); + if (iter == mValue.end() || shouldChange(iter->second,vec)) + { + glUniform2fARB(mUniform[index], x, y); + mValue[mUniform[index]] = vec; + } + } + } +} + +void LLGLSLShader::uniform3f(U32 index, GLfloat x, GLfloat y, GLfloat z) +{ + if (mProgramObject > 0) + { + if (mUniform.size() <= index) + { + UNIFORM_ERRS << "Uniform index out of bounds." << LL_ENDL; + return; + } + + if (mUniform[index] >= 0) + { + std::map::iterator iter = mValue.find(mUniform[index]); + LLVector4 vec(x,y,z,0.f); + if (iter == mValue.end() || shouldChange(iter->second,vec)) + { + glUniform3fARB(mUniform[index], x, y, z); + mValue[mUniform[index]] = vec; + } + } + } +} + +void LLGLSLShader::uniform4f(U32 index, GLfloat x, GLfloat y, GLfloat z, GLfloat w) +{ + if (mProgramObject > 0) + { + if (mUniform.size() <= index) + { + UNIFORM_ERRS << "Uniform index out of bounds." << LL_ENDL; + return; + } + + if (mUniform[index] >= 0) + { + std::map::iterator iter = mValue.find(mUniform[index]); + LLVector4 vec(x,y,z,w); + if (iter == mValue.end() || shouldChange(iter->second,vec)) + { + glUniform4fARB(mUniform[index], x, y, z, w); + mValue[mUniform[index]] = vec; + } + } + } +} + +void LLGLSLShader::uniform1fv(U32 index, U32 count, const GLfloat* v) +{ + if (mProgramObject > 0) + { + if (mUniform.size() <= index) + { + UNIFORM_ERRS << "Uniform index out of bounds." << LL_ENDL; + return; + } + + if (mUniform[index] >= 0) + { + std::map::iterator iter = mValue.find(mUniform[index]); + LLVector4 vec(v[0],0.f,0.f,0.f); + if (iter == mValue.end() || shouldChange(iter->second,vec) || count != 1) + { + glUniform1fvARB(mUniform[index], count, v); + mValue[mUniform[index]] = vec; + } + } + } +} + +void LLGLSLShader::uniform2fv(U32 index, U32 count, const GLfloat* v) +{ + if (mProgramObject > 0) + { + if (mUniform.size() <= index) + { + UNIFORM_ERRS << "Uniform index out of bounds." << LL_ENDL; + return; + } + + if (mUniform[index] >= 0) + { + std::map::iterator iter = mValue.find(mUniform[index]); + LLVector4 vec(v[0],v[1],0.f,0.f); + if (iter == mValue.end() || shouldChange(iter->second,vec) || count != 1) + { + glUniform2fvARB(mUniform[index], count, v); + mValue[mUniform[index]] = vec; + } + } + } +} + +void LLGLSLShader::uniform3fv(U32 index, U32 count, const GLfloat* v) +{ + if (mProgramObject > 0) + { + if (mUniform.size() <= index) + { + UNIFORM_ERRS << "Uniform index out of bounds." << LL_ENDL; + return; + } + + if (mUniform[index] >= 0) + { + std::map::iterator iter = mValue.find(mUniform[index]); + LLVector4 vec(v[0],v[1],v[2],0.f); + if (iter == mValue.end() || shouldChange(iter->second,vec) || count != 1) + { + glUniform3fvARB(mUniform[index], count, v); + mValue[mUniform[index]] = vec; + } + } + } +} + +void LLGLSLShader::uniform4fv(U32 index, U32 count, const GLfloat* v) +{ + if (mProgramObject > 0) + { + if (mUniform.size() <= index) + { + UNIFORM_ERRS << "Uniform index out of bounds." << LL_ENDL; + return; + } + + if (mUniform[index] >= 0) + { + std::map::iterator iter = mValue.find(mUniform[index]); + LLVector4 vec(v[0],v[1],v[2],v[3]); + if (iter == mValue.end() || shouldChange(iter->second,vec) || count != 1) + { + glUniform4fvARB(mUniform[index], count, v); + mValue[mUniform[index]] = vec; + } + } + } +} + +void LLGLSLShader::uniformMatrix2fv(U32 index, U32 count, GLboolean transpose, const GLfloat *v) +{ + if (mProgramObject > 0) + { + if (mUniform.size() <= index) + { + UNIFORM_ERRS << "Uniform index out of bounds." << LL_ENDL; + return; + } + + if (mUniform[index] >= 0) + { + glUniformMatrix2fvARB(mUniform[index], count, transpose, v); + } + } +} + +void LLGLSLShader::uniformMatrix3fv(U32 index, U32 count, GLboolean transpose, const GLfloat *v) +{ + if (mProgramObject > 0) + { + if (mUniform.size() <= index) + { + UNIFORM_ERRS << "Uniform index out of bounds." << LL_ENDL; + return; + } + + if (mUniform[index] >= 0) + { + glUniformMatrix3fvARB(mUniform[index], count, transpose, v); + } + } +} + +void LLGLSLShader::uniformMatrix4fv(U32 index, U32 count, GLboolean transpose, const GLfloat *v) +{ + if (mProgramObject > 0) + { + if (mUniform.size() <= index) + { + UNIFORM_ERRS << "Uniform index out of bounds." << LL_ENDL; + return; + } + + if (mUniform[index] >= 0) + { + glUniformMatrix4fvARB(mUniform[index], count, transpose, v); + } + } +} + +GLint LLGLSLShader::getUniformLocation(const string& uniform) +{ + if (mProgramObject > 0) + { + std::map::iterator iter = mUniformMap.find(uniform); + if (iter != mUniformMap.end()) + { + llassert(iter->second == glGetUniformLocationARB(mProgramObject, uniform.c_str())); + return iter->second; + } + } + + return -1; +} + +void LLGLSLShader::uniform1f(const string& uniform, GLfloat v) +{ + GLint location = getUniformLocation(uniform); + + if (location >= 0) + { + std::map::iterator iter = mValue.find(location); + LLVector4 vec(v,0.f,0.f,0.f); + if (iter == mValue.end() || shouldChange(iter->second,vec)) + { + glUniform1fARB(location, v); + mValue[location] = vec; + } + } +} + +void LLGLSLShader::uniform2f(const string& uniform, GLfloat x, GLfloat y) +{ + GLint location = getUniformLocation(uniform); + + if (location >= 0) + { + std::map::iterator iter = mValue.find(location); + LLVector4 vec(x,y,0.f,0.f); + if (iter == mValue.end() || shouldChange(iter->second,vec)) + { + glUniform2fARB(location, x,y); + mValue[location] = vec; + } + } + +} + +void LLGLSLShader::uniform3f(const string& uniform, GLfloat x, GLfloat y, GLfloat z) +{ + GLint location = getUniformLocation(uniform); + + if (location >= 0) + { + std::map::iterator iter = mValue.find(location); + LLVector4 vec(x,y,z,0.f); + if (iter == mValue.end() || shouldChange(iter->second,vec)) + { + glUniform3fARB(location, x,y,z); + mValue[location] = vec; + } + } +} + +void LLGLSLShader::uniform4f(const string& uniform, GLfloat x, GLfloat y, GLfloat z, GLfloat w) +{ + GLint location = getUniformLocation(uniform); + + if (location >= 0) + { + std::map::iterator iter = mValue.find(location); + LLVector4 vec(x,y,z,w); + if (iter == mValue.end() || shouldChange(iter->second,vec)) + { + glUniform4fARB(location, x,y,z,w); + mValue[location] = vec; + } + } +} + +void LLGLSLShader::uniform1fv(const string& uniform, U32 count, const GLfloat* v) +{ + GLint location = getUniformLocation(uniform); + + if (location >= 0) + { + std::map::iterator iter = mValue.find(location); + LLVector4 vec(v[0],0.f,0.f,0.f); + if (iter == mValue.end() || shouldChange(iter->second,vec) || count != 1) + { + glUniform1fvARB(location, count, v); + mValue[location] = vec; + } + } +} + +void LLGLSLShader::uniform2fv(const string& uniform, U32 count, const GLfloat* v) +{ + GLint location = getUniformLocation(uniform); + + if (location >= 0) + { + std::map::iterator iter = mValue.find(location); + LLVector4 vec(v[0],v[1],0.f,0.f); + if (iter == mValue.end() || shouldChange(iter->second,vec) || count != 1) + { + glUniform2fvARB(location, count, v); + mValue[location] = vec; + } + } +} + +void LLGLSLShader::uniform3fv(const string& uniform, U32 count, const GLfloat* v) +{ + GLint location = getUniformLocation(uniform); + + if (location >= 0) + { + std::map::iterator iter = mValue.find(location); + LLVector4 vec(v[0],v[1],v[2],0.f); + if (iter == mValue.end() || shouldChange(iter->second,vec) || count != 1) + { + glUniform3fvARB(location, count, v); + mValue[location] = vec; + } + } +} + +void LLGLSLShader::uniform4fv(const string& uniform, U32 count, const GLfloat* v) +{ + GLint location = getUniformLocation(uniform); + + if (location >= 0) + { + LLVector4 vec(v); + std::map::iterator iter = mValue.find(location); + if (iter == mValue.end() || shouldChange(iter->second,vec) || count != 1) + { + glUniform4fvARB(location, count, v); + mValue[location] = vec; + } + } +} + +void LLGLSLShader::uniformMatrix2fv(const string& uniform, U32 count, GLboolean transpose, const GLfloat* v) +{ + GLint location = getUniformLocation(uniform); + + if (location >= 0) + { + glUniformMatrix2fvARB(location, count, transpose, v); + } +} + +void LLGLSLShader::uniformMatrix3fv(const string& uniform, U32 count, GLboolean transpose, const GLfloat* v) +{ + GLint location = getUniformLocation(uniform); + + if (location >= 0) + { + glUniformMatrix3fvARB(location, count, transpose, v); + } +} + +void LLGLSLShader::uniformMatrix4fv(const string& uniform, U32 count, GLboolean transpose, const GLfloat* v) +{ + GLint location = getUniformLocation(uniform); + + if (location >= 0) + { + glUniformMatrix4fvARB(location, count, transpose, v); + } +} + + +void LLGLSLShader::vertexAttrib4f(U32 index, GLfloat x, GLfloat y, GLfloat z, GLfloat w) +{ + if (mAttribute[index] > 0) + { + glVertexAttrib4fARB(mAttribute[index], x, y, z, w); + } +} + +void LLGLSLShader::vertexAttrib4fv(U32 index, GLfloat* v) +{ + if (mAttribute[index] > 0) + { + glVertexAttrib4fvARB(mAttribute[index], v); + } +} diff --git a/linden/indra/llrender/llglslshader.h b/linden/indra/llrender/llglslshader.h new file mode 100644 index 0000000..0fa8e41 --- /dev/null +++ b/linden/indra/llrender/llglslshader.h @@ -0,0 +1,139 @@ +/** + * @file llglslshader.h + * @brief GLSL shader wrappers + * + * $LicenseInfo:firstyear=2001&license=viewergpl$ + * + * Copyright (c) 2001-2008, Linden Research, Inc. + * + * Second Life Viewer Source Code + * 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://secondlifegrid.net/programs/open_source/licensing/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://secondlifegrid.net/programs/open_source/licensing/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. + * $/LicenseInfo$ + */ + +#ifndef LL_LLGLSLSHADER_H +#define LL_LLGLSLSHADER_H + +#include "llgl.h" + +class LLShaderFeatures +{ +public: + bool calculatesLighting; + bool calculatesAtmospherics; + bool hasLighting; // implies no transport (it's possible to have neither though) + bool isShiny; + bool isFullbright; // implies no lighting + bool isSpecular; + bool hasWaterFog; // implies no gamma + bool hasTransport; // implies no lighting (it's possible to have neither though) + bool hasSkinning; + bool hasAtmospherics; + bool hasGamma; + + // char numLights; + + LLShaderFeatures(); +}; + +class LLGLSLShader +{ +public: + + enum + { + SG_DEFAULT = 0, + SG_SKY, + SG_WATER + }; + + LLGLSLShader(); + + void unload(); + BOOL createShader(std::vector * attributes, + std::vector * uniforms); + BOOL attachObject(std::string object); + void attachObject(GLhandleARB object); + void attachObjects(GLhandleARB* objects = NULL, S32 count = 0); + BOOL mapAttributes(const std::vector * attributes); + BOOL mapUniforms(const std::vector * uniforms); + void mapUniform(GLint index, const std::vector * uniforms); + void uniform1f(U32 index, GLfloat v); + void uniform2f(U32 index, GLfloat x, GLfloat y); + void uniform3f(U32 index, GLfloat x, GLfloat y, GLfloat z); + void uniform4f(U32 index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); + void uniform1fv(U32 index, U32 count, const GLfloat* v); + void uniform2fv(U32 index, U32 count, const GLfloat* v); + void uniform3fv(U32 index, U32 count, const GLfloat* v); + void uniform4fv(U32 index, U32 count, const GLfloat* v); + void uniform1f(const std::string& uniform, GLfloat v); + void uniform2f(const std::string& uniform, GLfloat x, GLfloat y); + void uniform3f(const std::string& uniform, GLfloat x, GLfloat y, GLfloat z); + void uniform4f(const std::string& uniform, GLfloat x, GLfloat y, GLfloat z, GLfloat w); + void uniform1fv(const std::string& uniform, U32 count, const GLfloat* v); + void uniform2fv(const std::string& uniform, U32 count, const GLfloat* v); + void uniform3fv(const std::string& uniform, U32 count, const GLfloat* v); + void uniform4fv(const std::string& uniform, U32 count, const GLfloat* v); + void uniformMatrix2fv(U32 index, U32 count, GLboolean transpose, const GLfloat *v); + void uniformMatrix3fv(U32 index, U32 count, GLboolean transpose, const GLfloat *v); + void uniformMatrix4fv(U32 index, U32 count, GLboolean transpose, const GLfloat *v); + void uniformMatrix2fv(const std::string& uniform, U32 count, GLboolean transpose, const GLfloat *v); + void uniformMatrix3fv(const std::string& uniform, U32 count, GLboolean transpose, const GLfloat *v); + void uniformMatrix4fv(const std::string& uniform, U32 count, GLboolean transpose, const GLfloat *v); + + void vertexAttrib4f(U32 index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); + void vertexAttrib4fv(U32 index, GLfloat* v); + + GLint getUniformLocation(const std::string& uniform); + + GLint mapUniformTextureChannel(GLint location, GLenum type); + + + //enable/disable texture channel for specified uniform + //if given texture uniform is active in the shader, + //the corresponding channel will be active upon return + //returns channel texture is enabled in from [0-MAX) + S32 enableTexture(S32 uniform, S32 mode = GL_TEXTURE_2D); + S32 disableTexture(S32 uniform, S32 mode = GL_TEXTURE_2D); + + BOOL link(BOOL suppress_errors = FALSE); + void bind(); + void unbind(); + + // Unbinds any previously bound shader by explicitly binding no shader. + static void bindNoShader(void); + + GLhandleARB mProgramObject; + std::vector mAttribute; //lookup table of attribute enum to attribute channel + std::vector mUniform; //lookup table of uniform enum to uniform location + std::map mUniformMap; //lookup map of uniform name to uniform location + std::map mValue; //lookup map of uniform location to last known value + std::vector mTexture; + S32 mActiveTextureChannels; + S32 mShaderLevel; + S32 mShaderGroup; + BOOL mUniformsDirty; + LLShaderFeatures mFeatures; + std::vector< std::pair< std::string, GLenum > > mShaderFiles; + std::string mName; +}; + +#endif diff --git a/linden/indra/llrender/llglstates.h b/linden/indra/llrender/llglstates.h new file mode 100644 index 0000000..e53640c --- /dev/null +++ b/linden/indra/llrender/llglstates.h @@ -0,0 +1,302 @@ +/** + * @file llglstates.h + * @brief LLGL states definitions + * + * $LicenseInfo:firstyear=2001&license=viewergpl$ + * + * Copyright (c) 2001-2008, Linden Research, Inc. + * + * Second Life Viewer Source Code + * 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://secondlifegrid.net/programs/open_source/licensing/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://secondlifegrid.net/programs/open_source/licensing/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. + * $/LicenseInfo$ + */ + +//THIS HEADER SHOULD ONLY BE INCLUDED FROM llgl.h +#ifndef LL_LLGLSTATES_H +#define LL_LLGLSTATES_H + +#include "llimagegl.h" + +//---------------------------------------------------------------------------- + +class LLGLDepthTest +{ + // Enabled by default +public: + LLGLDepthTest(GLboolean depth_enabled, GLboolean write_enabled = GL_TRUE, GLenum depth_func = GL_LEQUAL); + + ~LLGLDepthTest(); + + GLboolean mPrevDepthEnabled; + GLenum mPrevDepthFunc; + GLboolean mPrevWriteEnabled; +private: + static GLboolean sDepthEnabled; // defaults to GL_FALSE + static GLenum sDepthFunc; // defaults to GL_LESS + static GLboolean sWriteEnabled; // defaults to GL_TRUE +}; + +//---------------------------------------------------------------------------- + +class LLGLSDefault +{ +protected: + LLGLEnable mColorMaterial; + LLGLDisable mAlphaTest, mBlend, mCullFace, mDither, mFog, + mLineSmooth, mLineStipple, mNormalize, mPolygonSmooth, + mTextureGenQ, mTextureGenR, mTextureGenS, mTextureGenT, + mGLMultisample; +public: + LLGLSDefault() + : + // Enable + mColorMaterial(GL_COLOR_MATERIAL), + // Disable + mAlphaTest(GL_ALPHA_TEST), + mBlend(GL_BLEND), + mCullFace(GL_CULL_FACE), + mDither(GL_DITHER), + mFog(GL_FOG), + mLineSmooth(GL_LINE_SMOOTH), + mLineStipple(GL_LINE_STIPPLE), + mNormalize(GL_NORMALIZE), + mPolygonSmooth(GL_POLYGON_SMOOTH), + mTextureGenQ(GL_TEXTURE_GEN_Q), + mTextureGenR(GL_TEXTURE_GEN_R), + mTextureGenS(GL_TEXTURE_GEN_S), + mTextureGenT(GL_TEXTURE_GEN_T), + mGLMultisample(GL_MULTISAMPLE_ARB) + { } +}; + +class LLGLSNoTexture +{ +public: + LLGLSNoTexture() + { LLImageGL::unbindTexture(0); } +}; + +class LLGLSObjectSelect +{ +protected: + LLGLDisable mBlend, mFog, mAlphaTest; + LLGLEnable mCullFace; +public: + LLGLSObjectSelect() + : mBlend(GL_BLEND), mFog(GL_FOG), + mAlphaTest(GL_ALPHA_TEST), + mCullFace(GL_CULL_FACE) + { LLImageGL::unbindTexture(0); } +}; + +class LLGLSObjectSelectAlpha +{ +protected: + LLGLEnable mAlphaTest; +public: + LLGLSObjectSelectAlpha() + : mAlphaTest(GL_ALPHA_TEST) + {} +}; + +//---------------------------------------------------------------------------- + +class LLGLSUIDefault +{ +protected: + LLGLEnable mBlend, mAlphaTest; + LLGLDisable mCullFace; + LLGLDepthTest mDepthTest; +public: + LLGLSUIDefault() + : mBlend(GL_BLEND), mAlphaTest(GL_ALPHA_TEST), + mCullFace(GL_CULL_FACE), + mDepthTest(GL_FALSE, GL_TRUE, GL_LEQUAL) + {} +}; + +class LLGLSNoAlphaTest // : public LLGLSUIDefault +{ +protected: + LLGLDisable mAlphaTest; +public: + LLGLSNoAlphaTest() + : mAlphaTest(GL_ALPHA_TEST) + {} +}; + +class LLGLSNoTextureNoAlphaTest // : public LLGLSUIDefault +{ +protected: + LLGLDisable mAlphaTest; +public: + LLGLSNoTextureNoAlphaTest() + : mAlphaTest(GL_ALPHA_TEST) + + { LLImageGL::unbindTexture(0); } +}; + +//---------------------------------------------------------------------------- + +class LLGLSFog +{ +protected: + LLGLEnable mFog; +public: + LLGLSFog() + : mFog(GL_FOG) + {} +}; + +class LLGLSNoFog +{ +protected: + LLGLDisable mFog; +public: + LLGLSNoFog() + : mFog(GL_FOG) + {} +}; + +//---------------------------------------------------------------------------- + +class LLGLSPipeline +{ +protected: + LLGLEnable mCullFace; + LLGLDepthTest mDepthTest; +public: + LLGLSPipeline() + : mCullFace(GL_CULL_FACE), + mDepthTest(GL_TRUE, GL_TRUE, GL_LEQUAL) + { } +}; + +class LLGLSPipelineAlpha // : public LLGLSPipeline +{ +protected: + LLGLEnable mBlend, mAlphaTest; +public: + LLGLSPipelineAlpha() + : mBlend(GL_BLEND), + mAlphaTest(GL_ALPHA_TEST) + { } +}; + +class LLGLSPipelineEmbossBump +{ +protected: + LLGLDisable mFog; +public: + LLGLSPipelineEmbossBump() + : mFog(GL_FOG) + { } +}; + +class LLGLSPipelineSelection +{ +protected: + LLGLDisable mCullFace; +public: + LLGLSPipelineSelection() + : mCullFace(GL_CULL_FACE) + {} +}; + +class LLGLSPipelineAvatar +{ +protected: + LLGLEnable mNormalize; +public: + LLGLSPipelineAvatar() + : mNormalize(GL_NORMALIZE) + {} +}; + +class LLGLSPipelineSkyBox +{ +protected: + LLGLDisable mAlphaTest, mCullFace, mFog; +public: + LLGLSPipelineSkyBox() + : mAlphaTest(GL_ALPHA_TEST), mCullFace(GL_CULL_FACE), mFog(GL_FOG) + { } +}; + +class LLGLSTracker +{ +protected: + LLGLEnable mCullFace, mBlend, mAlphaTest; +public: + LLGLSTracker() : + mCullFace(GL_CULL_FACE), + mBlend(GL_BLEND), + mAlphaTest(GL_ALPHA_TEST) + + { LLImageGL::unbindTexture(0); } +}; + +//---------------------------------------------------------------------------- + +class LLGLSSpecular +{ +public: + LLGLSSpecular(const LLColor4& color, F32 shininess) + { + if (shininess > 0.0f) + { + glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, color.mV); + S32 shiny = (S32)(shininess*128.f); + shiny = llclamp(shiny,0,128); + glMateriali(GL_FRONT_AND_BACK, GL_SHININESS, shiny); + } + } + ~LLGLSSpecular() + { + glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, LLColor4(0.f,0.f,0.f,0.f).mV); + glMateriali(GL_FRONT_AND_BACK, GL_SHININESS, 0); + } +}; + +//---------------------------------------------------------------------------- + + +class LLGLSBlendFunc : public LLGLSPipeline { +protected: + GLint mSavedSrc, mSavedDst; + LLGLEnable mBlend; + +public: + LLGLSBlendFunc(GLenum srcFunc, GLenum dstFunc) : + mBlend(GL_BLEND) + { + glGetIntegerv(GL_BLEND_SRC, &mSavedSrc); + glGetIntegerv(GL_BLEND_DST, &mSavedDst); + glBlendFunc(srcFunc, dstFunc); + } + + ~LLGLSBlendFunc(void) { + glBlendFunc(mSavedSrc, mSavedDst); + } +}; + + +#endif diff --git a/linden/indra/llrender/llgltypes.h b/linden/indra/llrender/llgltypes.h new file mode 100644 index 0000000..d22d5fa --- /dev/null +++ b/linden/indra/llrender/llgltypes.h @@ -0,0 +1,44 @@ +/** + * @file llgltypes.h + * @brief LLGL definition + * + * $LicenseInfo:firstyear=2006&license=viewergpl$ + * + * Copyright (c) 2006-2008, Linden Research, Inc. + * + * Second Life Viewer Source Code + * 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://secondlifegrid.net/programs/open_source/licensing/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://secondlifegrid.net/programs/open_source/licensing/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. + * $/LicenseInfo$ + */ + +#ifndef LLGLTYPES_H +#define LLGLTYPES_H + +#define MAX_GL_TEXTURE_UNITS 16 + +typedef U32 LLGLenum; +typedef U32 LLGLuint; +typedef S32 LLGLint; +typedef F32 LLGLfloat; +typedef F64 LLGLdouble; +typedef U8 LLGLboolean; + +#endif diff --git a/linden/indra/llrender/llimagegl.cpp b/linden/indra/llrender/llimagegl.cpp index a402814..a871758 100644 --- a/linden/indra/llrender/llimagegl.cpp +++ b/linden/indra/llrender/llimagegl.cpp @@ -836,7 +836,7 @@ BOOL LLImageGL::createGLTexture(S32 discard_level, const LLImageRaw* imageraw, S llwarns << "Trying to create a texture while GL is disabled!" << llendl; return FALSE; } - llassert(gGLManager.mInited || gNoRender); + llassert(gGLManager.mInited); stop_glerror(); if (discard_level < 0) diff --git a/linden/indra/llrender/llpostprocess.cpp b/linden/indra/llrender/llpostprocess.cpp new file mode 100644 index 0000000..c884951 --- /dev/null +++ b/linden/indra/llrender/llpostprocess.cpp @@ -0,0 +1,574 @@ +/** + * @file llpostprocess.cpp + * @brief LLPostProcess class implementation + * + * $LicenseInfo:firstyear=2007&license=viewergpl$ + * + * Copyright (c) 2007-2008, Linden Research, Inc. + * + * Second Life Viewer Source Code + * 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://secondlifegrid.net/programs/open_source/licensing/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://secondlifegrid.net/programs/open_source/licensing/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. + * $/LicenseInfo$ + */ + +#include "linden_common.h" + +#include "llpostprocess.h" +#include "llglslshader.h" +#include "llsdserialize.h" +#include "llrender.h" + + +LLPostProcess * gPostProcess = NULL; + + +static const unsigned int NOISE_SIZE = 512; + +/// CALCULATING LUMINANCE (Using NTSC lum weights) +/// http://en.wikipedia.org/wiki/Luma_%28video%29 +static const float LUMINANCE_R = 0.299f; +static const float LUMINANCE_G = 0.587f; +static const float LUMINANCE_B = 0.114f; + +static const char * const XML_FILENAME = "postprocesseffects.xml"; + +LLPostProcess::LLPostProcess(void) : + sceneRenderTexture(0), noiseTexture(0), + tempBloomTexture(0), + initialized(false), + mAllEffects(LLSD::emptyMap()), + screenW(1), screenH(1) +{ + /* Do nothing. Needs to be updated to use our current shader system, and to work with the move into llrender. + std::string pathName(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight", XML_FILENAME)); + LL_DEBUGS2("AppInit", "Shaders") << "Loading PostProcess Effects settings from " << pathName << LL_ENDL; + + llifstream effectsXML(pathName); + + if (effectsXML) + { + LLPointer parser = new LLSDXMLParser(); + + parser->parse(effectsXML, mAllEffects, LLSDSerialize::SIZE_UNLIMITED); + } + + if (!mAllEffects.has("default")) + { + LLSD & defaultEffect = (mAllEffects["default"] = LLSD::emptyMap()); + + defaultEffect["enable_night_vision"] = LLSD::Boolean(false); + defaultEffect["enable_bloom"] = LLSD::Boolean(false); + defaultEffect["enable_color_filter"] = LLSD::Boolean(false); + + /// NVG Defaults + defaultEffect["brightness_multiplier"] = 3.0; + defaultEffect["noise_size"] = 25.0; + defaultEffect["noise_strength"] = 0.4; + + // TODO BTest potentially add this to tweaks? + noiseTextureScale = 1.0f; + + /// Bloom Defaults + defaultEffect["extract_low"] = 0.95; + defaultEffect["extract_high"] = 1.0; + defaultEffect["bloom_width"] = 2.25; + defaultEffect["bloom_strength"] = 1.5; + + /// Color Filter Defaults + defaultEffect["brightness"] = 1.0; + defaultEffect["contrast"] = 1.0; + defaultEffect["saturation"] = 1.0; + + LLSD& contrastBase = (defaultEffect["contrast_base"] = LLSD::emptyArray()); + contrastBase.append(1.0); + contrastBase.append(1.0); + contrastBase.append(1.0); + contrastBase.append(0.5); + } + + setSelectedEffect("default"); + */ +} + +LLPostProcess::~LLPostProcess(void) +{ + glDeleteTextures(1, &sceneRenderTexture); + glDeleteTextures(1, &noiseTexture); + glDeleteTextures(1, &tempBloomTexture); +} + +// static +void LLPostProcess::initClass(void) +{ + //this will cause system to crash at second time login + //if first time login fails due to network connection --- bao + //***llassert_always(gPostProcess == NULL); + //replaced by the following line: + if(gPostProcess) + return ; + + + gPostProcess = new LLPostProcess(); +} + +// static +void LLPostProcess::cleanupClass() +{ + delete gPostProcess; + gPostProcess = NULL; +} + +void LLPostProcess::setSelectedEffect(std::string const & effectName) +{ + mSelectedEffectName = effectName; + static_cast(tweaks) = mAllEffects[effectName]; +} + +void LLPostProcess::saveEffect(std::string const & effectName) +{ + /* Do nothing. Needs to be updated to use our current shader system, and to work with the move into llrender. + mAllEffects[effectName] = tweaks; + + std::string pathName(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight", XML_FILENAME)); + //llinfos << "Saving PostProcess Effects settings to " << pathName << llendl; + + llofstream effectsXML(pathName); + + LLPointer formatter = new LLSDXMLFormatter(); + + formatter->format(mAllEffects, effectsXML); + */ +} + +void LLPostProcess::apply(unsigned int width, unsigned int height) +{ + if (!initialized || width != screenW || height != screenH){ + initialize(width, height); + } + if (shadersEnabled()){ + doEffects(); + } +} + +void LLPostProcess::initialize(unsigned int width, unsigned int height) +{ + screenW = width; + screenH = height; + createTexture(sceneRenderTexture, screenW, screenH); + initialized = true; + + checkError(); + createNightVisionShader(); + createBloomShader(); + createColorFilterShader(); + checkError(); +} + +inline bool LLPostProcess::shadersEnabled(void) +{ + return (tweaks.useColorFilter().asBoolean() || + tweaks.useNightVisionShader().asBoolean() || + tweaks.useBloomShader().asBoolean() ); + +} + +void LLPostProcess::applyShaders(void) +{ + if (tweaks.useColorFilter()){ + applyColorFilterShader(); + checkError(); + } + if (tweaks.useNightVisionShader()){ + /// If any of the above shaders have been called update the frame buffer; + if (tweaks.useColorFilter()){ + copyFrameBuffer(sceneRenderTexture, screenW, screenH); + } + applyNightVisionShader(); + checkError(); + } + if (tweaks.useBloomShader()){ + /// If any of the above shaders have been called update the frame buffer; + if (tweaks.useColorFilter().asBoolean() || tweaks.useNightVisionShader().asBoolean()){ + copyFrameBuffer(sceneRenderTexture, screenW, screenH); + } + applyBloomShader(); + checkError(); + } +} + +void LLPostProcess::applyColorFilterShader(void) +{ + /* Do nothing. Needs to be updated to use our current shader system, and to work with the move into llrender. + gPostColorFilterProgram.bind(); + + gGL.getTexUnit(0)->activate(); + glEnable(GL_TEXTURE_RECTANGLE_ARB); + + glBindTexture(GL_TEXTURE_RECTANGLE_ARB, sceneRenderTexture); + + getShaderUniforms(colorFilterUniforms, gPostColorFilterProgram.mProgramObject); + glUniform1iARB(colorFilterUniforms["RenderTexture"], 0); + glUniform1fARB(colorFilterUniforms["brightness"], tweaks.getBrightness()); + glUniform1fARB(colorFilterUniforms["contrast"], tweaks.getContrast()); + float baseI = (tweaks.getContrastBaseR() + tweaks.getContrastBaseG() + tweaks.getContrastBaseB()) / 3.0f; + baseI = tweaks.getContrastBaseIntensity() / ((baseI < 0.001f) ? 0.001f : baseI); + float baseR = tweaks.getContrastBaseR() * baseI; + float baseG = tweaks.getContrastBaseG() * baseI; + float baseB = tweaks.getContrastBaseB() * baseI; + glUniform3fARB(colorFilterUniforms["contrastBase"], baseR, baseG, baseB); + glUniform1fARB(colorFilterUniforms["saturation"], tweaks.getSaturation()); + glUniform3fARB(colorFilterUniforms["lumWeights"], LUMINANCE_R, LUMINANCE_G, LUMINANCE_B); + + LLGLEnable blend(GL_BLEND); + gGL.setSceneBlendType(LLRender::BT_REPLACE); + LLGLDepthTest depth(GL_FALSE); + + /// Draw a screen space quad + drawOrthoQuad(screenW, screenH, QUAD_NORMAL); + gPostColorFilterProgram.unbind(); + */ +} + +void LLPostProcess::createColorFilterShader(void) +{ + /// Define uniform names + colorFilterUniforms["RenderTexture"] = 0; + colorFilterUniforms["brightness"] = 0; + colorFilterUniforms["contrast"] = 0; + colorFilterUniforms["contrastBase"] = 0; + colorFilterUniforms["saturation"] = 0; + colorFilterUniforms["lumWeights"] = 0; +} + +void LLPostProcess::applyNightVisionShader(void) +{ + /* Do nothing. Needs to be updated to use our current shader system, and to work with the move into llrender. + gPostNightVisionProgram.bind(); + + gGL.getTexUnit(0)->activate(); + glEnable(GL_TEXTURE_RECTANGLE_ARB); + + getShaderUniforms(nightVisionUniforms, gPostNightVisionProgram.mProgramObject); + glBindTexture(GL_TEXTURE_RECTANGLE_ARB, sceneRenderTexture); + glUniform1iARB(nightVisionUniforms["RenderTexture"], 0); + + gGL.getTexUnit(1)->activate(); + glEnable(GL_TEXTURE_2D); + + glBindTexture(GL_TEXTURE_2D, noiseTexture); + glUniform1iARB(nightVisionUniforms["NoiseTexture"], 1); + + + glUniform1fARB(nightVisionUniforms["brightMult"], tweaks.getBrightMult()); + glUniform1fARB(nightVisionUniforms["noiseStrength"], tweaks.getNoiseStrength()); + noiseTextureScale = 0.01f + ((101.f - tweaks.getNoiseSize()) / 100.f); + noiseTextureScale *= (screenH / NOISE_SIZE); + + + glUniform3fARB(nightVisionUniforms["lumWeights"], LUMINANCE_R, LUMINANCE_G, LUMINANCE_B); + + LLGLEnable blend(GL_BLEND); + gGL.setSceneBlendType(LLRender::BT_REPLACE); + LLGLDepthTest depth(GL_FALSE); + + /// Draw a screen space quad + drawOrthoQuad(screenW, screenH, QUAD_NOISE); + gPostNightVisionProgram.unbind(); + gGL.getTexUnit(0)->activate(); + */ +} + +void LLPostProcess::createNightVisionShader(void) +{ + /// Define uniform names + nightVisionUniforms["RenderTexture"] = 0; + nightVisionUniforms["NoiseTexture"] = 0; + nightVisionUniforms["brightMult"] = 0; + nightVisionUniforms["noiseStrength"] = 0; + nightVisionUniforms["lumWeights"] = 0; + + createNoiseTexture(noiseTexture); +} + +void LLPostProcess::applyBloomShader(void) +{ + +} + +void LLPostProcess::createBloomShader(void) +{ + createTexture(tempBloomTexture, unsigned(screenW * 0.5), unsigned(screenH * 0.5)); + + /// Create Bloom Extract Shader + bloomExtractUniforms["RenderTexture"] = 0; + bloomExtractUniforms["extractLow"] = 0; + bloomExtractUniforms["extractHigh"] = 0; + bloomExtractUniforms["lumWeights"] = 0; + + /// Create Bloom Blur Shader + bloomBlurUniforms["RenderTexture"] = 0; + bloomBlurUniforms["bloomStrength"] = 0; + bloomBlurUniforms["texelSize"] = 0; + bloomBlurUniforms["blurDirection"] = 0; + bloomBlurUniforms["blurWidth"] = 0; +} + +void LLPostProcess::getShaderUniforms(glslUniforms & uniforms, GLhandleARB & prog) +{ + /// Find uniform locations and insert into map + std::map::iterator i; + for (i = uniforms.begin(); i != uniforms.end(); ++i){ + i->second = glGetUniformLocationARB(prog, i->first); + } +} + +void LLPostProcess::doEffects(void) +{ + /// Save GL State + glPushAttrib(GL_ALL_ATTRIB_BITS); + glPushClientAttrib(GL_ALL_ATTRIB_BITS); + + /// Copy the screen buffer to the render texture + copyFrameBuffer(sceneRenderTexture, screenW, screenH); + + /// Clear the frame buffer. + glClearColor(0.0f, 0.0f, 0.0f, 1.0f); + glClear(GL_COLOR_BUFFER_BIT); + + /// Change to an orthogonal view + viewOrthogonal(screenW, screenH); + + checkError(); + applyShaders(); + + LLGLSLShader::bindNoShader(); + checkError(); + + /// Change to a perspective view + viewPerspective(); + + /// Reset GL State + glPopClientAttrib(); + glPopAttrib(); + checkError(); +} + +void LLPostProcess::copyFrameBuffer(GLuint & texture, unsigned int width, unsigned int height) +{ + glBindTexture(GL_TEXTURE_RECTANGLE_ARB, texture); + glCopyTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGBA, 0, 0, width, height, 0); +} + +void LLPostProcess::drawOrthoQuad(unsigned int width, unsigned int height, QuadType type) +{ +#if 0 + float noiseX = 0.f; + float noiseY = 0.f; + float screenRatio = 1.0f; + + if (type == QUAD_NOISE){ + noiseX = ((float) rand() / (float) RAND_MAX); + noiseY = ((float) rand() / (float) RAND_MAX); + screenRatio = (float) width / (float) height; + } + + + glBegin(GL_QUADS); + if (type != QUAD_BLOOM_EXTRACT){ + glMultiTexCoord2fARB(GL_TEXTURE0_ARB, 0.f, (GLfloat) height); + } else { + glMultiTexCoord2fARB(GL_TEXTURE0_ARB, 0.f, (GLfloat) height * 2.0f); + } + if (type == QUAD_NOISE){ + glMultiTexCoord2fARB(GL_TEXTURE1_ARB, + noiseX, + noiseTextureScale + noiseY); + } else if (type == QUAD_BLOOM_COMBINE){ + glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 0.f, (GLfloat) height * 0.5f); + } + glVertex2f(0.f, (GLfloat) screenH - height); + + if (type != QUAD_BLOOM_EXTRACT){ + glMultiTexCoord2fARB(GL_TEXTURE0_ARB, 0.f, 0.f); + } else { + glMultiTexCoord2fARB(GL_TEXTURE0_ARB, 0.f, 0.f); + } + if (type == QUAD_NOISE){ + glMultiTexCoord2fARB(GL_TEXTURE1_ARB, + noiseX, + noiseY); + } else if (type == QUAD_BLOOM_COMBINE){ + glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 0.f, 0.f); + } + glVertex2f(0.f, (GLfloat) height + (screenH - height)); + + + if (type != QUAD_BLOOM_EXTRACT){ + glMultiTexCoord2fARB(GL_TEXTURE0_ARB, (GLfloat) width, 0.f); + } else { + glMultiTexCoord2fARB(GL_TEXTURE0_ARB, (GLfloat) width * 2.0f, 0.f); + } + if (type == QUAD_NOISE){ + glMultiTexCoord2fARB(GL_TEXTURE1_ARB, + screenRatio * noiseTextureScale + noiseX, + noiseY); + } else if (type == QUAD_BLOOM_COMBINE){ + glMultiTexCoord2fARB(GL_TEXTURE1_ARB, (GLfloat) width * 0.5f, 0.f); + } + glVertex2f((GLfloat) width, (GLfloat) height + (screenH - height)); + + + if (type != QUAD_BLOOM_EXTRACT){ + glMultiTexCoord2fARB(GL_TEXTURE0_ARB, (GLfloat) width, (GLfloat) height); + } else { + glMultiTexCoord2fARB(GL_TEXTURE0_ARB, (GLfloat) width * 2.0f, (GLfloat) height * 2.0f); + } + if (type == QUAD_NOISE){ + glMultiTexCoord2fARB(GL_TEXTURE1_ARB, + screenRatio * noiseTextureScale + noiseX, + noiseTextureScale + noiseY); + } else if (type == QUAD_BLOOM_COMBINE){ + glMultiTexCoord2fARB(GL_TEXTURE1_ARB, (GLfloat) width * 0.5f, (GLfloat) height * 0.5f); + } + glVertex2f((GLfloat) width, (GLfloat) screenH - height); + glEnd(); +#endif +} + +void LLPostProcess::viewOrthogonal(unsigned int width, unsigned int height) +{ + glMatrixMode(GL_PROJECTION); + glPushMatrix(); + glLoadIdentity(); + glOrtho( 0.f, (GLdouble) width , (GLdouble) height , 0.f, -1.f, 1.f ); + glMatrixMode(GL_MODELVIEW); + glPushMatrix(); + glLoadIdentity(); +} + +void LLPostProcess::viewPerspective(void) +{ + glMatrixMode( GL_PROJECTION ); + glPopMatrix(); + glMatrixMode( GL_MODELVIEW ); + glPopMatrix(); +} + +void LLPostProcess::changeOrthogonal(unsigned int width, unsigned int height) +{ + viewPerspective(); + viewOrthogonal(width, height); +} + +void LLPostProcess::createTexture(GLuint & texture, unsigned int width, unsigned int height) +{ + if (texture != 0){ + glDeleteTextures(1, &texture); + } + + std::vector data(width * height * 4, 0); + + glGenTextures(1, &texture); + glBindTexture(GL_TEXTURE_RECTANGLE_ARB, texture); + glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, 4, width, height, 0, + GL_RGBA, GL_UNSIGNED_BYTE, &data[0]); + glTexParameteri(GL_TEXTURE_RECTANGLE_ARB,GL_TEXTURE_MIN_FILTER,GL_LINEAR); + glTexParameteri(GL_TEXTURE_RECTANGLE_ARB,GL_TEXTURE_MAG_FILTER,GL_LINEAR); + glTexParameteri(GL_TEXTURE_RECTANGLE_ARB,GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_RECTANGLE_ARB,GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); +} + +void LLPostProcess::createNoiseTexture(GLuint & texture) +{ + if (texture != 0){ + glDeleteTextures(1, &texture); + } + glGenTextures(1, &texture); + + std::vector buffer(NOISE_SIZE * NOISE_SIZE); + for (unsigned int i = 0; i < NOISE_SIZE; i++){ + for (unsigned int k = 0; k < NOISE_SIZE; k++){ + buffer[(i * NOISE_SIZE) + k] = (GLubyte)((double) rand() / ((double) RAND_MAX + 1.f) * 255.f); + } + } + glBindTexture(GL_TEXTURE_2D, texture); + glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, NOISE_SIZE, NOISE_SIZE, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, &buffer[0]); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); +} + +bool LLPostProcess::checkError(void) +{ + GLenum glErr; + bool retCode = false; + + glErr = glGetError(); + while (glErr != GL_NO_ERROR) + { + // shaderErrorLog << (const char *) gluErrorString(glErr) << std::endl; + char const * err_str_raw = (const char *) gluErrorString(glErr); + + if(err_str_raw == NULL) + { + std::ostringstream err_builder; + err_builder << "unknown error number " << glErr; + mShaderErrorString = err_builder.str(); + } + else + { + mShaderErrorString = err_str_raw; + } + + retCode = true; + glErr = glGetError(); + } + return retCode; +} + +void LLPostProcess::checkShaderError(GLhandleARB shader) +{ + GLint infologLength = 0; + GLint charsWritten = 0; + GLchar *infoLog; + + checkError(); // Check for OpenGL errors + + glGetObjectParameterivARB(shader, GL_OBJECT_INFO_LOG_LENGTH_ARB, &infologLength); + + checkError(); // Check for OpenGL errors + + if (infologLength > 0) + { + infoLog = (GLchar *)malloc(infologLength); + if (infoLog == NULL) + { + /// Could not allocate infolog buffer + return; + } + glGetInfoLogARB(shader, infologLength, &charsWritten, infoLog); + // shaderErrorLog << (char *) infoLog << std::endl; + mShaderErrorString = (char *) infoLog; + free(infoLog); + } + checkError(); // Check for OpenGL errors +} diff --git a/linden/indra/llrender/llpostprocess.h b/linden/indra/llrender/llpostprocess.h new file mode 100644 index 0000000..cd9f477 --- /dev/null +++ b/linden/indra/llrender/llpostprocess.h @@ -0,0 +1,268 @@ +/** + * @file llpostprocess.h + * @brief LLPostProcess class definition + * + * $LicenseInfo:firstyear=2007&license=viewergpl$ + * + * Copyright (c) 2007-2008, Linden Research, Inc. + * + * Second Life Viewer Source Code + * 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://secondlifegrid.net/programs/open_source/licensing/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://secondlifegrid.net/programs/open_source/licensing/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. + * $/LicenseInfo$ + */ + +#ifndef LL_POSTPROCESS_H +#define LL_POSTPROCESS_H + +#include +#include +#include "llgl.h" +#include "llglheaders.h" + +class LLPostProcess +{ +public: + + typedef enum _QuadType { + QUAD_NORMAL, + QUAD_NOISE, + QUAD_BLOOM_EXTRACT, + QUAD_BLOOM_COMBINE + } QuadType; + + /// GLSL Shader Encapsulation Struct + typedef std::map glslUniforms; + + struct PostProcessTweaks : public LLSD { + inline PostProcessTweaks() : LLSD(LLSD::emptyMap()) + { + } + + inline LLSD & brightMult() { + return (*this)["brightness_multiplier"]; + } + + inline LLSD & noiseStrength() { + return (*this)["noise_strength"]; + } + + inline LLSD & noiseSize() { + return (*this)["noise_size"]; + } + + inline LLSD & extractLow() { + return (*this)["extract_low"]; + } + + inline LLSD & extractHigh() { + return (*this)["extract_high"]; + } + + inline LLSD & bloomWidth() { + return (*this)["bloom_width"]; + } + + inline LLSD & bloomStrength() { + return (*this)["bloom_strength"]; + } + + inline LLSD & brightness() { + return (*this)["brightness"]; + } + + inline LLSD & contrast() { + return (*this)["contrast"]; + } + + inline LLSD & contrastBaseR() { + return (*this)["contrast_base"][0]; + } + + inline LLSD & contrastBaseG() { + return (*this)["contrast_base"][1]; + } + + inline LLSD & contrastBaseB() { + return (*this)["contrast_base"][2]; + } + + inline LLSD & contrastBaseIntensity() { + return (*this)["contrast_base"][3]; + } + + inline LLSD & saturation() { + return (*this)["saturation"]; + } + + inline LLSD & useNightVisionShader() { + return (*this)["enable_night_vision"]; + } + + inline LLSD & useBloomShader() { + return (*this)["enable_bloom"]; + } + + inline LLSD & useColorFilter() { + return (*this)["enable_color_filter"]; + } + + + inline F32 getBrightMult() const { + return F32((*this)["brightness_multiplier"].asReal()); + } + + inline F32 getNoiseStrength() const { + return F32((*this)["noise_strength"].asReal()); + } + + inline F32 getNoiseSize() const { + return F32((*this)["noise_size"].asReal()); + } + + inline F32 getExtractLow() const { + return F32((*this)["extract_low"].asReal()); + } + + inline F32 getExtractHigh() const { + return F32((*this)["extract_high"].asReal()); + } + + inline F32 getBloomWidth() const { + return F32((*this)["bloom_width"].asReal()); + } + + inline F32 getBloomStrength() const { + return F32((*this)["bloom_strength"].asReal()); + } + + inline F32 getBrightness() const { + return F32((*this)["brightness"].asReal()); + } + + inline F32 getContrast() const { + return F32((*this)["contrast"].asReal()); + } + + inline F32 getContrastBaseR() const { + return F32((*this)["contrast_base"][0].asReal()); + } + + inline F32 getContrastBaseG() const { + return F32((*this)["contrast_base"][1].asReal()); + } + + inline F32 getContrastBaseB() const { + return F32((*this)["contrast_base"][2].asReal()); + } + + inline F32 getContrastBaseIntensity() const { + return F32((*this)["contrast_base"][3].asReal()); + } + + inline F32 getSaturation() const { + return F32((*this)["saturation"].asReal()); + } + + }; + + GLuint sceneRenderTexture; + GLuint noiseTexture; + GLuint tempBloomTexture; + bool initialized; + PostProcessTweaks tweaks; + + // the map of all availible effects + LLSD mAllEffects; + +public: + LLPostProcess(void); + + ~LLPostProcess(void); + + void apply(unsigned int width, unsigned int height); + + /// Perform global initialization for this class. + static void initClass(void); + + // Cleanup of global data that's only inited once per class. + static void cleanupClass(); + + void setSelectedEffect(std::string const & effectName); + + inline std::string const & getSelectedEffect(void) const { + return mSelectedEffectName; + } + + void saveEffect(std::string const & effectName); + +private: + /// read in from file + std::string mShaderErrorString; + unsigned int screenW; + unsigned int screenH; + + float noiseTextureScale; + + /// Shader Uniforms + glslUniforms nightVisionUniforms; + glslUniforms bloomExtractUniforms; + glslUniforms bloomBlurUniforms; + glslUniforms colorFilterUniforms; + + // the name of currently selected effect in mAllEffects + // invariant: tweaks == mAllEffects[mSelectedEffectName] + std::string mSelectedEffectName; + + /// General functions + void initialize(unsigned int width, unsigned int height); + void doEffects(void); + void applyShaders(void); + bool shadersEnabled(void); + + /// Night Vision Functions + void createNightVisionShader(void); + void applyNightVisionShader(void); + + /// Bloom Functions + void createBloomShader(void); + void applyBloomShader(void); + + /// Color Filter Functions + void createColorFilterShader(void); + void applyColorFilterShader(void); + + /// OpenGL Helper Functions + void getShaderUniforms(glslUniforms & uniforms, GLhandleARB & prog); + void createTexture(GLuint & texture, unsigned int width, unsigned int height); + void copyFrameBuffer(GLuint & texture, unsigned int width, unsigned int height); + void createNoiseTexture(GLuint & texture); + bool checkError(void); + void checkShaderError(GLhandleARB shader); + void drawOrthoQuad(unsigned int width, unsigned int height, QuadType type); + void viewOrthogonal(unsigned int width, unsigned int height); + void changeOrthogonal(unsigned int width, unsigned int height); + void viewPerspective(void); +}; + +extern LLPostProcess * gPostProcess; + + +#endif // LL_POSTPROCESS_H diff --git a/linden/indra/llrender/llrender.cpp b/linden/indra/llrender/llrender.cpp index e9c1227..13edf8a 100644 --- a/linden/indra/llrender/llrender.cpp +++ b/linden/indra/llrender/llrender.cpp @@ -36,6 +36,12 @@ LLRender gGL; +// Handy copies of last good GL matrices +F64 gGLModelView[16]; +F64 gGLLastModelView[16]; +F64 gGLProjection[16]; +S32 gGLViewport[4]; + static const U32 LL_NUM_TEXTURE_LAYERS = 8; static GLenum sGLCompareFunc[] = @@ -445,6 +451,12 @@ void LLRender::translatef(const GLfloat& x, const GLfloat& y, const GLfloat& z) glTranslatef(x,y,z); } +void LLRender::scalef(const GLfloat& x, const GLfloat& y, const GLfloat& z) +{ + flush(); + glScalef(x,y,z); +} + void LLRender::pushMatrix() { flush(); diff --git a/linden/indra/llrender/llrender.h b/linden/indra/llrender/llrender.h index 03280fe..edf46ff 100644 --- a/linden/indra/llrender/llrender.h +++ b/linden/indra/llrender/llrender.h @@ -178,6 +178,7 @@ public: ~LLRender(); void translatef(const GLfloat& x, const GLfloat& y, const GLfloat& z); + void scalef(const GLfloat& x, const GLfloat& y, const GLfloat& z); void pushMatrix(); void popMatrix(); @@ -232,7 +233,10 @@ private: std::vector mTexUnits; }; - +extern F64 gGLModelView[16]; +extern F64 gGLLastModelView[16]; +extern F64 gGLProjection[16]; +extern S32 gGLViewport[4]; extern LLRender gGL; diff --git a/linden/indra/llrender/llrender.vcproj b/linden/indra/llrender/llrender.vcproj deleted file mode 100644 index d9144cb..0000000 --- a/linden/indra/llrender/llrender.vcproj +++ /dev/null @@ -1,232 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/linden/indra/llrender/llrender_vc8.vcproj b/linden/indra/llrender/llrender_vc8.vcproj deleted file mode 100644 index 2147cec..0000000 --- a/linden/indra/llrender/llrender_vc8.vcproj +++ /dev/null @@ -1,329 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/linden/indra/llrender/llrender_vc9.vcproj b/linden/indra/llrender/llrender_vc9.vcproj deleted file mode 100644 index 67385e6..0000000 --- a/linden/indra/llrender/llrender_vc9.vcproj +++ /dev/null @@ -1,330 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/linden/indra/llrender/llrendersphere.cpp b/linden/indra/llrender/llrendersphere.cpp new file mode 100644 index 0000000..0c3cd19 --- /dev/null +++ b/linden/indra/llrender/llrendersphere.cpp @@ -0,0 +1,182 @@ +/** + * @file llrendersphere.cpp + * @brief implementation of the LLRenderSphere class. + * + * $LicenseInfo:firstyear=2001&license=viewergpl$ + * + * Copyright (c) 2001-2008, Linden Research, Inc. + * + * Second Life Viewer Source Code + * 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://secondlifegrid.net/programs/open_source/licensing/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://secondlifegrid.net/programs/open_source/licensing/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. + * $/LicenseInfo$ + */ + +// Sphere creates a set of display lists that can then be called to create +// a lit sphere at different LOD levels. You only need one instance of sphere +// per viewer - then call the appropriate list. + +#include "linden_common.h" + +#include "llrendersphere.h" +#include "llerror.h" + +#include "llglheaders.h" + +GLUquadricObj *gQuadObj2 = NULL; +LLRenderSphere gSphere; + +void drawSolidSphere(GLdouble radius, GLint slices, GLint stacks); + +void drawSolidSphere(GLdouble radius, GLint slices, GLint stacks) +{ + if (!gQuadObj2) + { + gQuadObj2 = gluNewQuadric(); + if (!gQuadObj2) + { + llwarns << "drawSolidSphere couldn't allocate quadric" << llendl; + return; + } + } + + gluQuadricDrawStyle(gQuadObj2, GLU_FILL); + gluQuadricNormals(gQuadObj2, GLU_SMOOTH); + // If we ever changed/used the texture or orientation state + // of quadObj, we'd need to change it to the defaults here + // with gluQuadricTexture and/or gluQuadricOrientation. + gluQuadricTexture(gQuadObj2, GL_TRUE); + gluSphere(gQuadObj2, radius, slices, stacks); +} + + +// lat = 0 is Z-axis +// lon = 0, lat = 90 at X-axis +void lat2xyz(LLVector3 * result, F32 lat, F32 lon) +{ + // Convert a latitude and longitude to x,y,z on a normal sphere and return it in result + F32 r; + result->mV[VX] = (F32) (cos(lon * DEG_TO_RAD) * sin(lat * DEG_TO_RAD)); + result->mV[VY] = (F32) (sin(lon * DEG_TO_RAD) * sin(lat * DEG_TO_RAD)); + r = (F32) pow(result->mV[VX] * result->mV[VX] + result->mV[VY] * result->mV[VY], 0.5f); + if (r == 1.0f) + { + result->mV[VZ] = 0.0f; + } + else + { + result->mV[VZ] = (F32) pow(1 - r*r, 0.5f); + if (lat > 90.01) + { + result->mV[VZ] *= -1.0; + } + } +} + +void lat2xyz_rad(LLVector3 * result, F32 lat, F32 lon) +{ + // Convert a latitude and longitude to x,y,z on a normal sphere and return it in result + F32 r; + result->mV[VX] = (F32) (cos(lon) * sin(lat)); + result->mV[VY] = (F32) (sin(lon) * sin(lat)); + r = (F32) pow(result->mV[VX] * result->mV[VX] + result->mV[VY] * result->mV[VY], 0.5f); + if (r == 1.0f) + result->mV[VZ] = 0.0f; + else + { + result->mV[VZ] = (F32) pow(1 - r*r, 0.5f); + if (lat > F_PI_BY_TWO) result->mV[VZ] *= -1.0; + } +} + +// A couple thoughts on sphere drawing: +// 1) You need more slices than stacks, but little less than 2:1 +// 2) At low LOD, setting stacks to an odd number avoids a "band" around the equator, making things look smoother +void LLRenderSphere::prerender() +{ + // Create a series of display lists for different LODs + mDList[0] = glGenLists(1); + glNewList(mDList[0], GL_COMPILE); + drawSolidSphere(1.0, 30, 20); + glEndList(); + + mDList[1] = glGenLists(1); + glNewList(mDList[1], GL_COMPILE); + drawSolidSphere(1.0, 20, 15); + glEndList(); + + mDList[2] = glGenLists(1); + glNewList(mDList[2], GL_COMPILE); + drawSolidSphere(1.0, 12, 8); + glEndList(); + + mDList[3] = glGenLists(1); + glNewList(mDList[3], GL_COMPILE); + drawSolidSphere(1.0, 8, 5); + glEndList(); +} + +void LLRenderSphere::cleanupGL() +{ + for (S32 detail = 0; detail < 4; detail++) + { + glDeleteLists(mDList[detail], 1); + mDList[detail] = 0; + } + + if (gQuadObj2) + { + gluDeleteQuadric(gQuadObj2); + gQuadObj2 = NULL; + } +} + +// Constants here are empirically derived from my eyeballs, JNC +// +// The toughest adjustment is the cutoff for the lowest LOD +// Maybe we should have more LODs at the low end? +void LLRenderSphere::render(F32 pixel_area) +{ + S32 level_of_detail; + + if (pixel_area > 10000.f) + { + level_of_detail = 0; + } + else if (pixel_area > 800.f) + { + level_of_detail = 1; + } + else if (pixel_area > 100.f) + { + level_of_detail = 2; + } + else + { + level_of_detail = 3; + } + glCallList(mDList[level_of_detail]); +} + + +void LLRenderSphere::render() +{ + glCallList(mDList[0]); +} diff --git a/linden/indra/llrender/llrendersphere.h b/linden/indra/llrender/llrendersphere.h new file mode 100644 index 0000000..ace57e4 --- /dev/null +++ b/linden/indra/llrender/llrendersphere.h @@ -0,0 +1,47 @@ +/** + * @file llrendersphere.h + * @brief interface for the LLRenderSphere class. + * + * $LicenseInfo:firstyear=2001&license=internal$ + * + * Copyright (c) 2001-2008, Linden Research, Inc. + * + * The following source code is PROPRIETARY AND CONFIDENTIAL. Use of + * this source code is governed by the Linden Lab Source Code Disclosure + * Agreement ("Agreement") previously entered between you and Linden + * Lab. By accessing, using, copying, modifying or distributing this + * software, you acknowledge that you have been informed of your + * obligations under the Agreement 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. + * $/LicenseInfo$ + */ + +#ifndef LL_LLRENDERSPHERE_H +#define LL_LLRENDERSPHERE_H + +#include "llmath.h" +#include "v3math.h" +#include "v4math.h" +#include "m3math.h" +#include "m4math.h" +#include "v4color.h" +#include "llgl.h" + +void lat2xyz(LLVector3 * result, F32 lat, F32 lon); // utility routine + +class LLRenderSphere +{ +public: + LLGLuint mDList[5]; + + void prerender(); + void cleanupGL(); + void render(F32 pixel_area); // of a box of size 1.0 at that position + void render(); // render at highest LOD +}; + +extern LLRenderSphere gSphere; +#endif diff --git a/linden/indra/llrender/llrendertarget.cpp b/linden/indra/llrender/llrendertarget.cpp index 708c582..e18ec56 100644 --- a/linden/indra/llrender/llrendertarget.cpp +++ b/linden/indra/llrender/llrendertarget.cpp @@ -99,11 +99,16 @@ void LLRenderTarget::allocate(U32 resx, U32 resy, U32 color_fmt, BOOL depth, U32 glGenFramebuffersEXT(1, (GLuint *) &mFBO); + stop_glerror(); + glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, mFBO); + stop_glerror(); + if (mDepth) { glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, mUsage, mDepth, 0); + stop_glerror(); glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_STENCIL_ATTACHMENT_EXT, mUsage, mDepth, 0); stop_glerror(); } diff --git a/linden/indra/llrender/llshadermgr.cpp b/linden/indra/llrender/llshadermgr.cpp new file mode 100644 index 0000000..4416775 --- /dev/null +++ b/linden/indra/llrender/llshadermgr.cpp @@ -0,0 +1,513 @@ +/** + * @file llshadermgr.cpp + * @brief Shader manager implementation. + * + * $LicenseInfo:firstyear=2005&license=viewergpl$ + * + * Copyright (c) 2005-2008, Linden Research, Inc. + * + * Second Life Viewer Source Code + * 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://secondlifegrid.net/programs/open_source/licensing/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://secondlifegrid.net/programs/open_source/licensing/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. + * $/LicenseInfo$ + */ + +#include "linden_common.h" + +#include "llshadermgr.h" + +#include "llfile.h" +#include "llrender.h" + +#if LL_DARWIN +#include "OpenGL/OpenGL.h" +#endif + +#ifdef LL_RELEASE_FOR_DOWNLOAD +#define UNIFORM_ERRS LL_WARNS_ONCE("Shader") +#else +#define UNIFORM_ERRS LL_ERRS("Shader") +#endif + +// Lots of STL stuff in here, using namespace std to keep things more readable +using std::vector; +using std::pair; +using std::make_pair; +using std::string; + +LLShaderMgr * LLShaderMgr::sInstance = NULL; + +LLShaderMgr::LLShaderMgr() +{ +} + + +LLShaderMgr::~LLShaderMgr() +{ +} + +// static +LLShaderMgr * LLShaderMgr::instance() +{ + if(NULL == sInstance) + { + LL_ERRS("Shaders") << "LLShaderMgr should already have been instantiated by the application!" << LL_ENDL; + } + + return sInstance; +} + +BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader) +{ + llassert_always(shader != NULL); + LLShaderFeatures *features = & shader->mFeatures; + + ////////////////////////////////////// + // Attach Vertex Shader Features First + ////////////////////////////////////// + + // NOTE order of shader object attaching is VERY IMPORTANT!!! + if (features->calculatesAtmospherics) + { + if (!shader->attachObject("windlight/atmosphericsVarsV.glsl")) + { + return FALSE; + } + } + + if (features->calculatesLighting) + { + if (!shader->attachObject("windlight/atmosphericsHelpersV.glsl")) + { + return FALSE; + } + + if (features->isSpecular) + { + if (!shader->attachObject("lighting/lightFuncSpecularV.glsl")) + { + return FALSE; + } + + if (!shader->attachObject("lighting/sumLightsSpecularV.glsl")) + { + return FALSE; + } + + if (!shader->attachObject("lighting/lightSpecularV.glsl")) + { + return FALSE; + } + } + else + { + if (!shader->attachObject("lighting/lightFuncV.glsl")) + { + return FALSE; + } + + if (!shader->attachObject("lighting/sumLightsV.glsl")) + { + return FALSE; + } + + if (!shader->attachObject("lighting/lightV.glsl")) + { + return FALSE; + } + } + } + + // NOTE order of shader object attaching is VERY IMPORTANT!!! + if (features->calculatesAtmospherics) + { + if (!shader->attachObject("windlight/atmosphericsV.glsl")) + { + return FALSE; + } + } + + if (features->hasSkinning) + { + if (!shader->attachObject("avatar/avatarSkinV.glsl")) + { + return FALSE; + } + } + + /////////////////////////////////////// + // Attach Fragment Shader Features Next + /////////////////////////////////////// + + if(features->calculatesAtmospherics) + { + if (!shader->attachObject("windlight/atmosphericsVarsF.glsl")) + { + return FALSE; + } + } + + // NOTE order of shader object attaching is VERY IMPORTANT!!! + if (features->hasGamma) + { + if (!shader->attachObject("windlight/gammaF.glsl")) + { + return FALSE; + } + } + + if (features->hasAtmospherics) + { + if (!shader->attachObject("windlight/atmosphericsF.glsl")) + { + return FALSE; + } + } + + if (features->hasTransport) + { + if (!shader->attachObject("windlight/transportF.glsl")) + { + return FALSE; + } + + // Test hasFullbright and hasShiny and attach fullbright and + // fullbright shiny atmos transport if we split them out. + } + + // NOTE order of shader object attaching is VERY IMPORTANT!!! + if (features->hasWaterFog) + { + if (!shader->attachObject("environment/waterFogF.glsl")) + { + return FALSE; + } + } + + if (features->hasLighting) + { + + if (features->hasWaterFog) + { + if (!shader->attachObject("lighting/lightWaterF.glsl")) + { + return FALSE; + } + } + + else + { + if (!shader->attachObject("lighting/lightF.glsl")) + { + return FALSE; + } + } + } + + // NOTE order of shader object attaching is VERY IMPORTANT!!! + else if (features->isFullbright) + { + + if (features->hasWaterFog) + { + if (!shader->attachObject("lighting/lightFullbrightWaterF.glsl")) + { + return FALSE; + } + } + + else if (features->isShiny) + { + if (!shader->attachObject("lighting/lightFullbrightShinyF.glsl")) + { + return FALSE; + } + } + + else + { + if (!shader->attachObject("lighting/lightFullbrightF.glsl")) + { + return FALSE; + } + } + } + + // NOTE order of shader object attaching is VERY IMPORTANT!!! + else if (features->isShiny) + { + + if (features->hasWaterFog) + { + if (!shader->attachObject("lighting/lightShinyWaterF.glsl")) + { + return FALSE; + } + } + + else + { + if (!shader->attachObject("lighting/lightShinyF.glsl")) + { + return FALSE; + } + } + } + return TRUE; +} + +//============================================================================ +// Load Shader + +static std::string get_object_log(GLhandleARB ret) +{ + std::string res; + + //get log length + GLint length; + glGetObjectParameterivARB(ret, GL_OBJECT_INFO_LOG_LENGTH_ARB, &length); + if (length > 0) + { + //the log could be any size, so allocate appropriately + GLcharARB* log = new GLcharARB[length]; + glGetInfoLogARB(ret, length, &length, log); + res = std::string((char *)log); + delete[] log; + } + return res; +} + +void LLShaderMgr::dumpObjectLog(GLhandleARB ret, BOOL warns) +{ + std::string log = get_object_log(ret); + if ( log.length() > 0 ) + { + if (warns) + { + LL_WARNS("ShaderLoading") << log << LL_ENDL; + } + else + { + LL_DEBUGS("ShaderLoading") << log << LL_ENDL; + } +} +} + +GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shader_level, GLenum type) +{ + GLenum error; + error = glGetError(); + if (error != GL_NO_ERROR) + { + LL_WARNS("ShaderLoading") << "GL ERROR entering loadShaderFile(): " << error << LL_ENDL; + } + + LL_DEBUGS("ShaderLoading") << "Loading shader file: " << filename << " class " << shader_level << LL_ENDL; + + if (filename.empty()) + { + return 0; + } + + + //read in from file + LLFILE* file = NULL; + + S32 try_gpu_class = shader_level; + S32 gpu_class; + + //find the most relevant file + for (gpu_class = try_gpu_class; gpu_class > 0; gpu_class--) + { //search from the current gpu class down to class 1 to find the most relevant shader + std::stringstream fname; + fname << getShaderDirPrefix(); + fname << gpu_class << "/" << filename; + + LL_DEBUGS("ShaderLoading") << "Looking in " << fname.str() << LL_ENDL; + file = LLFile::fopen(fname.str(), "r"); /* Flawfinder: ignore */ + if (file) + { + LL_INFOS("ShaderLoading") << "Loading file: shaders/class" << gpu_class << "/" << filename << " (Want class " << gpu_class << ")" << LL_ENDL; + break; // done + } + } + + if (file == NULL) + { + LL_WARNS("ShaderLoading") << "GLSL Shader file not found: " << filename << LL_ENDL; + return 0; + } + + //we can't have any lines longer than 1024 characters + //or any shaders longer than 1024 lines... deal - DaveP + GLcharARB buff[1024]; + GLcharARB* text[1024]; + GLuint count = 0; + + + //copy file into memory + while(fgets((char *)buff, 1024, file) != NULL && count < (sizeof(buff)/sizeof(buff[0]))) + { + text[count++] = (GLcharARB *)strdup((char *)buff); + } + fclose(file); + + //create shader object + GLhandleARB ret = glCreateShaderObjectARB(type); + error = glGetError(); + if (error != GL_NO_ERROR) + { + LL_WARNS("ShaderLoading") << "GL ERROR in glCreateShaderObjectARB: " << error << LL_ENDL; + } + else + { + //load source + glShaderSourceARB(ret, count, (const GLcharARB**) text, NULL); + error = glGetError(); + if (error != GL_NO_ERROR) + { + LL_WARNS("ShaderLoading") << "GL ERROR in glShaderSourceARB: " << error << LL_ENDL; + } + else + { + //compile source + glCompileShaderARB(ret); + error = glGetError(); + if (error != GL_NO_ERROR) + { + LL_WARNS("ShaderLoading") << "GL ERROR in glCompileShaderARB: " << error << LL_ENDL; + } + } + } + //free memory + for (GLuint i = 0; i < count; i++) + { + free(text[i]); + } + if (error == GL_NO_ERROR) + { + //check for errors + GLint success = GL_TRUE; + glGetObjectParameterivARB(ret, GL_OBJECT_COMPILE_STATUS_ARB, &success); + error = glGetError(); + if (error != GL_NO_ERROR || success == GL_FALSE) + { + //an error occured, print log + LL_WARNS("ShaderLoading") << "GLSL Compilation Error: (" << error << ") in " << filename << LL_ENDL; + dumpObjectLog(ret); + ret = 0; + } + } + else + { + ret = 0; + } + stop_glerror(); + + //successfully loaded, save results + if (ret) + { + // Add shader file to map + mShaderObjects[filename] = ret; + shader_level = try_gpu_class; + } + else + { + if (shader_level > 1) + { + shader_level--; + return loadShaderFile(filename,shader_level,type); + } + LL_WARNS("ShaderLoading") << "Failed to load " << filename << LL_ENDL; + } + return ret; +} + +BOOL LLShaderMgr::linkProgramObject(GLhandleARB obj, BOOL suppress_errors) +{ + //check for errors + glLinkProgramARB(obj); + GLint success = GL_TRUE; + glGetObjectParameterivARB(obj, GL_OBJECT_LINK_STATUS_ARB, &success); + if (!suppress_errors && success == GL_FALSE) + { + //an error occured, print log + LL_WARNS("ShaderLoading") << "GLSL Linker Error:" << LL_ENDL; + } + +// NOTE: Removing LL_DARWIN block as it doesn't seem to actually give the correct answer, +// but want it for reference once I move it. +#if 0 + // Force an evaluation of the gl state so the driver can tell if the shader will run in hardware or software + // per Apple's suggestion + glBegin(gGL.mMode); + glEnd(); + + // Query whether the shader can or cannot run in hardware + // http://developer.apple.com/qa/qa2007/qa1502.html + long vertexGPUProcessing; + CGLContextObj ctx = CGLGetCurrentContext(); + CGLGetParameter (ctx, kCGLCPGPUVertexProcessing, &vertexGPUProcessing); + long fragmentGPUProcessing; + CGLGetParameter (ctx, kCGLCPGPUFragmentProcessing, &fragmentGPUProcessing); + if (!fragmentGPUProcessing || !vertexGPUProcessing) + { + LL_WARNS("ShaderLoading") << "GLSL Linker: Running in Software:" << LL_ENDL; + success = GL_FALSE; + suppress_errors = FALSE; + } + +#else + std::string log = get_object_log(obj); + LLStringUtil::toLower(log); + if (log.find("software") != std::string::npos) + { + LL_WARNS("ShaderLoading") << "GLSL Linker: Running in Software:" << LL_ENDL; + success = GL_FALSE; + suppress_errors = FALSE; + } +#endif + if (!suppress_errors) + { + dumpObjectLog(obj, !success); + } + + return success; +} + +BOOL LLShaderMgr::validateProgramObject(GLhandleARB obj) +{ + //check program validity against current GL + glValidateProgramARB(obj); + GLint success = GL_TRUE; + glGetObjectParameterivARB(obj, GL_OBJECT_VALIDATE_STATUS_ARB, &success); + if (success == GL_FALSE) + { + LL_WARNS("ShaderLoading") << "GLSL program not valid: " << LL_ENDL; + dumpObjectLog(obj); + } + else + { + dumpObjectLog(obj, FALSE); + } + + return success; +} + diff --git a/linden/indra/llrender/llshadermgr.h b/linden/indra/llrender/llshadermgr.h new file mode 100644 index 0000000..8918416 --- /dev/null +++ b/linden/indra/llrender/llshadermgr.h @@ -0,0 +1,75 @@ +/** + * @file llshadermgr.h + * @brief Shader Manager + * + * $LicenseInfo:firstyear=2001&license=viewergpl$ + * + * Copyright (c) 2001-2008, Linden Research, Inc. + * + * Second Life Viewer Source Code + * 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://secondlifegrid.net/programs/open_source/licensing/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://secondlifegrid.net/programs/open_source/licensing/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. + * $/LicenseInfo$ + */ + +#ifndef LL_SHADERMGR_H +#define LL_SHADERMGR_H + +#include "llgl.h" +#include "llglslshader.h" + +class LLShaderMgr +{ +public: + LLShaderMgr(); + virtual ~LLShaderMgr(); + + // singleton pattern implementation + static LLShaderMgr * instance(); + + BOOL attachShaderFeatures(LLGLSLShader * shader); + void dumpObjectLog(GLhandleARB ret, BOOL warns = TRUE); + BOOL linkProgramObject(GLhandleARB obj, BOOL suppress_errors = FALSE); + BOOL validateProgramObject(GLhandleARB obj); + GLhandleARB loadShaderFile(const std::string& filename, S32 & shader_level, GLenum type); + + // Implemented in the application to actually point to the shader directory. + virtual std::string getShaderDirPrefix(void) = 0; // Pure Virtual + + // Implemented in the application to actually update out of date uniforms for a particular shader + virtual void updateShaderUniforms(LLGLSLShader * shader) = 0; // Pure Virtual + +public: + // Map of shader names to compiled + std::map mShaderObjects; + + //global (reserved slot) shader parameters + std::vector mReservedAttribs; + + std::vector mReservedUniforms; + +protected: + + // our parameter manager singleton instance + static LLShaderMgr * sInstance; + +}; //LLShaderMgr + +#endif diff --git a/linden/indra/llrender/llvertexbuffer.cpp b/linden/indra/llrender/llvertexbuffer.cpp index 9635ae3..547663b 100644 --- a/linden/indra/llrender/llvertexbuffer.cpp +++ b/linden/indra/llrender/llvertexbuffer.cpp @@ -190,10 +190,12 @@ void LLVertexBuffer::drawRange(U32 mode, U32 start, U32 end, U32 count, U32 indi if (mode > NUM_MODES) { llerrs << "Invalid draw mode: " << mode << llendl; + return; } glDrawRangeElements(sGLMode[mode], start, end, count, GL_UNSIGNED_SHORT, ((U16*) getIndicesPointer()) + indices_offset); + stop_glerror(); } void LLVertexBuffer::draw(U32 mode, U32 count, U32 indices_offset) const @@ -217,6 +219,7 @@ void LLVertexBuffer::draw(U32 mode, U32 count, U32 indices_offset) const if (mode > NUM_MODES) { llerrs << "Invalid draw mode: " << mode << llendl; + return; } glDrawElements(sGLMode[mode], count, GL_UNSIGNED_SHORT, @@ -240,9 +243,11 @@ void LLVertexBuffer::drawArrays(U32 mode, U32 first, U32 count) const if (mode > NUM_MODES) { llerrs << "Invalid draw mode: " << mode << llendl; + return; } glDrawArrays(sGLMode[mode], first, count); + stop_glerror(); } //static diff --git a/linden/indra/llrender/llvertexbuffer.h b/linden/indra/llrender/llvertexbuffer.h index 64a6f60..8edcf69 100644 --- a/linden/indra/llrender/llvertexbuffer.h +++ b/linden/indra/llrender/llvertexbuffer.h @@ -41,6 +41,7 @@ #include "llmemory.h" #include #include +#include //============================================================================ // NOTES diff --git a/linden/indra/llui/CMakeLists.txt b/linden/indra/llui/CMakeLists.txt new file mode 100644 index 0000000..77efec5 --- /dev/null +++ b/linden/indra/llui/CMakeLists.txt @@ -0,0 +1,133 @@ +# -*- cmake -*- + +project(llui) + +include(00-Common) +include(LLAudio) +include(LLCommon) +include(LLImage) +include(LLMath) +include(LLMessage) +include(LLRender) +include(LLWindow) +include(LLVFS) +include(LLXML) + +include_directories( + ${LLAUDIO_INCLUDE_DIRS} + ${LLCOMMON_INCLUDE_DIRS} + ${LLIMAGE_INCLUDE_DIRS} + ${LLMATH_INCLUDE_DIRS} + ${LLMESSAGE_INCLUDE_DIRS} + ${LLRENDER_INCLUDE_DIRS} + ${LLWINDOW_INCLUDE_DIRS} + ${LLVFS_INCLUDE_DIRS} + ${LLXML_INCLUDE_DIRS} + ) + +set(llui_SOURCE_FILES + llalertdialog.cpp + llbutton.cpp + llcheckboxctrl.cpp + llclipboard.cpp + llcombobox.cpp + llctrlselectioninterface.cpp + lldraghandle.cpp + lleditmenuhandler.cpp + llfloater.cpp + llfocusmgr.cpp + lliconctrl.cpp + llkeywords.cpp + lllineeditor.cpp + llmenugl.cpp + llmodaldialog.cpp + llmultislider.cpp + llmultisliderctrl.cpp + llpanel.cpp + llradiogroup.cpp + llresizebar.cpp + llresizehandle.cpp + llresmgr.cpp + llrootview.cpp + llscrollbar.cpp + llscrollcontainer.cpp + llscrollingpanellist.cpp + llscrolllistctrl.cpp + llslider.cpp + llsliderctrl.cpp + llspinctrl.cpp + llstyle.cpp + lltabcontainer.cpp + lltabcontainervertical.cpp + lltextbox.cpp + lltexteditor.cpp + llui.cpp + lluictrl.cpp + lluictrlfactory.cpp + lluistring.cpp + llundo.cpp + llviewborder.cpp + llview.cpp + llviewquery.cpp + ) + +set(llui_HEADER_FILES + CMakeLists.txt + + llalertdialog.h + llbutton.h + llcallbackmap.h + llcheckboxctrl.h + llclipboard.h + llcombobox.h + llctrlselectioninterface.h + lldraghandle.h + lleditmenuhandler.h + llfloater.h + llfocusmgr.h + llhtmlhelp.h + lliconctrl.h + llkeywords.h + lllineeditor.h + llmemberlistener.h + llmenugl.h + llmodaldialog.h + llmultisliderctrl.h + llmultislider.h + llpanel.h + llradiogroup.h + llresizebar.h + llresizehandle.h + llresmgr.h + llrootview.h + llscrollbar.h + llscrollcontainer.h + llscrollingpanellist.h + llscrolllistctrl.h + llsliderctrl.h + llslider.h + llspinctrl.h + llstyle.h + lltabcontainer.h + lltabcontainervertical.h + lltextbox.h + lltexteditor.h + lluiconstants.h + lluictrlfactory.h + lluictrl.h + lluifwd.h + llui.h + lluistring.h + lluixmltags.h + llundo.h + llviewborder.h + llview.h + llviewquery.h + ) + +set_source_files_properties(${llui_HEADER_FILES} + PROPERTIES HEADER_FILE_ONLY TRUE) + +list(APPEND llui_SOURCE_FILES ${llui_HEADER_FILES}) + +add_library (llui ${llui_SOURCE_FILES}) diff --git a/linden/indra/llui/files.lst b/linden/indra/llui/files.lst deleted file mode 100644 index 56bc2c3..0000000 --- a/linden/indra/llui/files.lst +++ /dev/null @@ -1,46 +0,0 @@ -llui/llalertdialog.cpp -llui/llbutton.cpp -llui/llcheckboxctrl.cpp -llui/llclipboard.cpp -llui/llcombobox.cpp -llui/llctrlselectioninterface.cpp -llui/lldraghandle.cpp -llui/lleditmenuhandler.cpp -llui/llfloater.cpp -llui/llfocusmgr.cpp -llui/lliconctrl.cpp -llui/llkeywords.cpp -llui/lllineeditor.cpp -llui/llmenugl.cpp -llui/llmodaldialog.cpp -llui/llmultislider.cpp -llui/llmultisliderctrl.cpp -llui/llpanel.cpp -llui/llradiogroup.cpp -llui/llresizebar.cpp -llui/llresizehandle.cpp -llui/llresmgr.cpp -llui/llrootview.cpp -llui/llscrollbar.cpp -llui/llscrollcontainer.cpp -llui/llscrollingpanellist.cpp -llui/llscrolllistctrl.cpp -llui/llslider.cpp -llui/llsliderctrl.cpp -llui/llspinctrl.cpp -llui/llstyle.cpp -llui/lltabcontainer.cpp -llui/lltabcontainervertical.cpp -llui/lltextbox.cpp -llui/lltexteditor.cpp -llui/llui.cpp -llui/lluictrl.cpp -llui/lluictrlfactory.cpp -llui/lluistring.cpp -llui/llundo.cpp -llui/llview.cpp -llui/llviewborder.cpp -llui/llviewquery.cpp -llui/llmultislider.cpp -llui/llmultisliderctrl.cpp - diff --git a/linden/indra/llui/llalertdialog.cpp b/linden/indra/llui/llalertdialog.cpp index 4ca9dc8..4be07e9 100644 --- a/linden/indra/llui/llalertdialog.cpp +++ b/linden/indra/llui/llalertdialog.cpp @@ -55,23 +55,23 @@ const S32 MSG_PAD = 8; /*static*/ LLAlertDialog::template_map_t LLAlertDialog::sAlertTemplates; /*static*/ LLAlertDialog::template_map_t LLAlertDialog::sIgnorableTemplates; /*static*/ LLControlGroup* LLAlertDialog::sSettings = NULL; -/*static*/ std::map LLAlertDialog::sUniqueActiveMap; +/*static*/ std::map LLAlertDialog::sUniqueActiveMap; /*static*/ LLAlertDialog::display_callback_t LLAlertDialog::sDisplayCallback; -/*static*/ LLString LLAlertDialog::sStringSkipNextTime("Skip this dialog next time"); -/*static*/ LLString LLAlertDialog::sStringAlwaysChoose("Always choose this option"); +/*static*/ std::string LLAlertDialog::sStringSkipNextTime("Skip this dialog next time"); +/*static*/ std::string LLAlertDialog::sStringAlwaysChoose("Always choose this option"); /*static*/ LLAlertDialog::URLLoader* LLAlertDialog::sURLLoader; //static -LLAlertDialog* LLAlertDialog::createXml( const LLString& xml_desc, +LLAlertDialog* LLAlertDialog::createXml( const std::string& xml_desc, alert_callback_t callback, void *user_data) { - LLString::format_map_t args; + LLStringUtil::format_map_t args; return createXml(xml_desc, args, callback, user_data); } //static -LLAlertDialog* LLAlertDialog::createXml( const LLString& xml_desc, const LLString::format_map_t& args, +LLAlertDialog* LLAlertDialog::createXml( const std::string& xml_desc, const LLStringUtil::format_map_t& args, alert_callback_t callback, void *user_data) { template_map_t::iterator iter = sAlertTemplates.find(xml_desc); @@ -85,7 +85,7 @@ LLAlertDialog* LLAlertDialog::createXml( const LLString& xml_desc, const LLStrin } else { - LLString::format_map_t args; + LLStringUtil::format_map_t args; args["[ALERT_NAME]"] = xml_desc; llwarns << "Missing Alert: [" << xml_desc << "]" << llendl; LLAlertDialog* dialogp = LLAlertDialog::showXml("MissingAlert", args); @@ -98,15 +98,15 @@ LLAlertDialog* LLAlertDialog::createXml( const LLString& xml_desc, const LLStrin } //static -LLAlertDialog* LLAlertDialog::showXml( const LLString& xml_desc, +LLAlertDialog* LLAlertDialog::showXml( const std::string& xml_desc, alert_callback_t callback, void *user_data) { - LLString::format_map_t args; + LLStringUtil::format_map_t args; return showXml(xml_desc, args, callback, user_data); } //static -LLAlertDialog* LLAlertDialog::showXml( const LLString& xml_desc, const LLString::format_map_t& args, +LLAlertDialog* LLAlertDialog::showXml( const std::string& xml_desc, const LLStringUtil::format_map_t& args, alert_callback_t callback, void *user_data) { LLAlertDialog* dialog = createXml(xml_desc, args, callback, user_data); @@ -114,10 +114,10 @@ LLAlertDialog* LLAlertDialog::showXml( const LLString& xml_desc, const LLString: } //static -LLAlertDialog* LLAlertDialog::showCritical( const LLString& desc, alert_callback_t callback, void *user_data) +LLAlertDialog* LLAlertDialog::showCritical( const std::string& desc, alert_callback_t callback, void *user_data) { LLAlertDialogTemplate xml_template; - LLString::format_map_t args; + LLStringUtil::format_map_t args; xml_template.mTitle = "Critical Error"; xml_template.mMessage = desc; xml_template.mModal = TRUE; @@ -135,7 +135,7 @@ static const S32 BTN_HPAD = 8; static const LLFONT_ID font_name = LLFONT_SANSSERIF; LLAlertDialog::LLAlertDialog( const LLAlertDialogTemplate* xml_template, - const LLString::format_map_t& args, + const LLStringUtil::format_map_t& args, alert_callback_t callback, void *user_data) : LLModalDialog( xml_template->mTitle, 100, 100, xml_template->mModal ), // dummy size. Will reshape below. mCallback( callback ), @@ -156,7 +156,7 @@ LLAlertDialog::LLAlertDialog( const LLAlertDialogTemplate* xml_template, { mURL = xml_template->mURL; mURLOption = xml_template->mURLOption; - createDialog(&(xml_template->mOptions), xml_template->mDefaultOption, + createDialog(xml_template->mOptions, xml_template->mDefaultOption, xml_template->mMessage, args, xml_template->mEditLineText); setTitle(xml_template->mTitle); @@ -226,7 +226,7 @@ bool LLAlertDialog::show() // Check to see if we are already displaying the alert if (mUnique) { - std::map::iterator iter = sUniqueActiveMap.find(mLabel); + std::map::iterator iter = sUniqueActiveMap.find(mLabel); if (iter != sUniqueActiveMap.end()) { gFloaterView->bringToFront(iter->second); @@ -254,18 +254,18 @@ bool LLAlertDialog::show() return true; } -void LLAlertDialog::format(LLString& msg, const LLString::format_map_t& args) +void LLAlertDialog::format(std::string& msg, const LLStringUtil::format_map_t& args) { // XUI:translate! - LLString::format_map_t targs = args; + LLStringUtil::format_map_t targs = args; targs["[SECOND_LIFE]"] = "Second Life"; targs["[_URL]"] = mURL; - LLString::format(msg, targs); + LLStringUtil::format(msg, targs); } -void LLAlertDialog::createDialog(const std::vector* optionsp, S32 default_option, - const LLString& msg_in, const LLString::format_map_t& args, - const LLString& edit_text) +void LLAlertDialog::createDialog(const options_list_t& options_in, S32 default_option, + const std::string& msg_in, const LLStringUtil::format_map_t& args, + const std::string& edit_text) { setBackgroundVisible(TRUE); setBackgroundOpaque(TRUE); @@ -274,9 +274,11 @@ void LLAlertDialog::createDialog(const std::vector* optionsp, S32 defa const S32 LINE_HEIGHT = llfloor(font->getLineHeight() + 0.99f); const S32 EDITOR_HEIGHT = 20; + const options_list_t* optionsp = &options_in; + // Buttons - std::vector default_option_list; - mNumOptions = optionsp->size(); + options_list_t default_option_list; + mNumOptions = options_in.size(); if( 0 == mNumOptions ) { default_option_list.push_back("Close"); @@ -285,12 +287,13 @@ void LLAlertDialog::createDialog(const std::vector* optionsp, S32 defa mNumOptions = 1; } - const std::vector& options = *optionsp; + const options_list_t& options= *optionsp; + mButtonData = new ButtonData[mNumOptions]; // Calc total width of buttons S32 button_width = 0; - S32 sp = font->getWidth("OO"); + S32 sp = font->getWidth(std::string("OO")); for( S32 i = 0; i < mNumOptions; i++ ) { S32 w = S32(font->getWidth( options[i] ) + 0.99f) + sp + 2 * LLBUTTON_H_PAD; @@ -304,10 +307,10 @@ void LLAlertDialog::createDialog(const std::vector* optionsp, S32 defa // Message: create text box using raw string, as text has been structure deliberately // Use size of created text box to generate dialog box size - LLString msg = msg_in; + std::string msg = msg_in; format( msg, args ); llwarns << "Alert: " << msg << llendl; - LLTextBox* msg_box = new LLTextBox( "Alert message", msg, (F32)MAX_ALLOWED_MSG_WIDTH, font ); + LLTextBox* msg_box = new LLTextBox( std::string("Alert message"), msg, (F32)MAX_ALLOWED_MSG_WIDTH, font ); const LLRect& text_rect = msg_box->getRect(); S32 dialog_width = llmax( btn_total_width, text_rect.getWidth() ) + 2 * HPAD; @@ -339,7 +342,7 @@ void LLAlertDialog::createDialog(const std::vector* optionsp, S32 defa if (mCaution) { - LLIconCtrl* icon = new LLIconCtrl("icon", LLRect(msg_x, msg_y, msg_x+32, msg_y-32), "notify_caution_icon.tga"); + LLIconCtrl* icon = new LLIconCtrl(std::string("icon"), LLRect(msg_x, msg_y, msg_x+32, msg_y-32), std::string("notify_caution_icon.tga")); icon->setMouseOpaque(FALSE); addChild(icon); msg_x += 32 + HPAD; @@ -362,13 +365,12 @@ void LLAlertDialog::createDialog(const std::vector* optionsp, S32 defa LLRect button_rect; button_rect.setOriginAndSize( button_left, VPAD, button_width, BTN_HEIGHT ); - LLButton* btn = new LLButton( - "btn", button_rect, - "","", "", - &LLAlertDialog::onButtonPressed, (void*)(&mButtonData[i]), - font, - options[i], - options[i]); + LLButton* btn = new LLButton(std::string("btn"), button_rect, + LLStringUtil::null, LLStringUtil::null, LLStringUtil::null, + &LLAlertDialog::onButtonPressed, (void*)(&mButtonData[i]), + font, + options[i], + options[i]); mButtonData[i].mSelf = this; mButtonData[i].mButton = btn; @@ -388,7 +390,7 @@ void LLAlertDialog::createDialog(const std::vector* optionsp, S32 defa if (edit_text.size() > 0) { S32 y = VPAD + BTN_HEIGHT + VPAD/2; - mLineEditor = new LLLineEditor("lineeditor", + mLineEditor = new LLLineEditor(std::string("lineeditor"), LLRect( HPAD, y+EDITOR_HEIGHT, dialog_width-HPAD, y), edit_text, LLFontGL::sSansSerif, @@ -397,7 +399,7 @@ void LLAlertDialog::createDialog(const std::vector* optionsp, S32 defa } } -bool LLAlertDialog::setCheckBox( const LLString& check_title, const LLString& check_control ) +bool LLAlertDialog::setCheckBox( const std::string& check_title, const std::string& check_control ) { const LLFontGL* font = LLResMgr::getInstance()->getRes( font_name ); const S32 LINE_HEIGHT = llfloor(font->getLineHeight() + 0.99f); @@ -420,7 +422,7 @@ bool LLAlertDialog::setCheckBox( const LLString& check_title, const LLString& ch check_rect.setOriginAndSize(msg_x, VPAD+BTN_HEIGHT+LINE_HEIGHT/2, max_msg_width, LINE_HEIGHT); - mCheck = new LLCheckboxCtrl("check", check_rect, check_title, font); + mCheck = new LLCheckboxCtrl(std::string("check"), check_rect, check_title, font); addChild(mCheck); // mCheck is sometimes "show again" and sometimes "hide" :-( @@ -508,7 +510,7 @@ void LLAlertDialog::handleCallbacks() } BOOL LLAlertDialog::hasTitleBar() const { - return (getTitle() != "" && getTitle() != " ") // has title + return (getCurrentTitle() != "" && getCurrentTitle() != " ") // has title || isMinimizeable() || isCloseable(); } @@ -586,11 +588,11 @@ void LLAlertDialog::setEditTextCallback(alert_text_callback_t callback, void *us } } -void LLAlertDialog::setEditTextArgs(const LLString::format_map_t& edit_args) +void LLAlertDialog::setEditTextArgs(const LLStringUtil::format_map_t& edit_args) { if (mLineEditor) { - LLString msg = mLineEditor->getText(); + std::string msg = mLineEditor->getText(); format(msg, edit_args); mLineEditor->setText(msg); } @@ -625,7 +627,7 @@ void LLAlertDialog::onButtonPressed( void* userdata ) //============================================================================= //static -const LLString& LLAlertDialog::getTemplateMessage(const LLString& xml_desc) +const std::string& LLAlertDialog::getTemplateMessage(const std::string& xml_desc) { template_map_t::iterator iter = sAlertTemplates.find(xml_desc); if (iter != sAlertTemplates.end()) @@ -639,7 +641,7 @@ const LLString& LLAlertDialog::getTemplateMessage(const LLString& xml_desc) } //static -bool LLAlertDialog::parseAlerts(const LLString& xml_filename, LLControlGroup* settings, BOOL settings_only) +bool LLAlertDialog::parseAlerts(const std::string& xml_filename, LLControlGroup* settings, BOOL settings_only) { LLXMLNodePtr root; BOOL success = LLUICtrlFactory::getLayeredXMLNode(xml_filename, root); @@ -663,7 +665,7 @@ bool LLAlertDialog::parseAlerts(const LLString& xml_filename, LLControlGroup* se { if (alert->hasName("global")) { - LLString global_name; + std::string global_name; if (alert->getAttributeString("name", global_name)) { if (global_name == "skipnexttime") @@ -686,7 +688,7 @@ bool LLAlertDialog::parseAlerts(const LLString& xml_filename, LLControlGroup* se LLAlertDialogTemplate* xml_template = settings_only ? NULL : new LLAlertDialogTemplate; // name= - LLString alert_name; + std::string alert_name; if (alert->getAttributeString("name", alert_name)) { if (xml_template) @@ -701,7 +703,7 @@ bool LLAlertDialog::parseAlerts(const LLString& xml_filename, LLControlGroup* se continue; } // title= - LLString title; + std::string title; if (alert->getAttributeString("title", title)) { if (xml_template) @@ -767,10 +769,10 @@ bool LLAlertDialog::parseAlerts(const LLString& xml_filename, LLControlGroup* se //