From ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e Mon Sep 17 00:00:00 2001 From: Jacek Antonelli Date: Thu, 30 Apr 2009 13:04:20 -0500 Subject: Second Life viewer sources 1.23.0-RC --- linden/doc/contributions.txt | 193 +- linden/etc/message.xml | 57 +- linden/indra/CMakeLists.txt | 18 +- linden/indra/cmake/00-Common.cmake | 20 +- linden/indra/cmake/APR.cmake | 10 +- linden/indra/cmake/Audio.cmake | 16 +- linden/indra/cmake/Boost.cmake | 12 +- linden/indra/cmake/CommonMiscLibs.cmake | 7 - linden/indra/cmake/CopyWinLibs.cmake | 64 +- linden/indra/cmake/FindMT.cmake | 15 + linden/indra/cmake/GooglePerfTools.cmake | 5 + linden/indra/cmake/JPEG.cmake | 2 +- linden/indra/cmake/LLAddBuildTest.cmake | 154 + linden/indra/cmake/LLAudio.cmake | 9 +- linden/indra/cmake/LLRender.cmake | 4 +- linden/indra/cmake/LLWindow.cmake | 5 + linden/indra/cmake/Linking.cmake | 5 + linden/indra/cmake/NDOF.cmake | 6 +- linden/indra/cmake/OPENAL.cmake | 2 +- linden/indra/cmake/RunBuildTest.cmake | 22 + linden/indra/cmake/Tut.cmake | 6 + linden/indra/cmake/ViewerMiscLibs.cmake | 1 - linden/indra/cmake/ZLIB.cmake | 6 +- linden/indra/develop.py | 125 +- linden/indra/lib/python/indra/base/config.py | 29 +- linden/indra/lib/python/indra/base/llsd.py | 14 +- .../indra/lib/python/indra/ipc/servicebuilder.py | 29 +- linden/indra/lib/python/indra/util/llmanifest.py | 10 +- linden/indra/lib/python/indra/util/named_query.py | 19 +- linden/indra/lib/python/uuid.py | 481 ++ .../linux_crash_logger/linux_crash_logger.cpp | 3 +- .../linux_crash_logger/llcrashloggerlinux.cpp | 5 +- .../indra/linux_crash_logger/llcrashloggerlinux.h | 3 +- linden/indra/llaudio/audioengine.cpp | 13 +- linden/indra/llaudio/audioengine.h | 3 +- linden/indra/llaudio/audioengine_fmod.cpp | 10 +- linden/indra/llaudio/audioengine_fmod.h | 3 +- linden/indra/llaudio/audioengine_openal.cpp | 3 +- linden/indra/llaudio/audioengine_openal.h | 3 +- linden/indra/llaudio/listener.cpp | 3 +- linden/indra/llaudio/listener.h | 3 +- linden/indra/llaudio/listener_ds3d.h | 3 +- linden/indra/llaudio/listener_fmod.cpp | 3 +- linden/indra/llaudio/listener_fmod.h | 3 +- linden/indra/llaudio/listener_openal.cpp | 3 +- linden/indra/llaudio/listener_openal.h | 3 +- linden/indra/llaudio/llaudiodecodemgr.cpp | 3 +- linden/indra/llaudio/llaudiodecodemgr.h | 3 +- linden/indra/llaudio/vorbisdecode.cpp | 49 +- linden/indra/llaudio/vorbisdecode.h | 3 +- linden/indra/llaudio/vorbisencode.cpp | 62 +- linden/indra/llaudio/vorbisencode.h | 3 +- linden/indra/llaudio/windgen.h | 3 +- linden/indra/llcharacter/CMakeLists.txt | 1 + linden/indra/llcharacter/llanimationstates.cpp | 15 +- linden/indra/llcharacter/llanimationstates.h | 3 +- linden/indra/llcharacter/llbvhconsts.h | 52 + linden/indra/llcharacter/llbvhloader.cpp | 12 +- linden/indra/llcharacter/llbvhloader.h | 11 +- linden/indra/llcharacter/llcharacter.cpp | 3 +- linden/indra/llcharacter/llcharacter.h | 3 +- linden/indra/llcharacter/lleditingmotion.cpp | 3 +- linden/indra/llcharacter/lleditingmotion.h | 3 +- linden/indra/llcharacter/llgesture.cpp | 3 +- linden/indra/llcharacter/llgesture.h | 3 +- linden/indra/llcharacter/llhandmotion.cpp | 3 +- linden/indra/llcharacter/llhandmotion.h | 3 +- linden/indra/llcharacter/llheadrotmotion.cpp | 3 +- linden/indra/llcharacter/llheadrotmotion.h | 3 +- linden/indra/llcharacter/lljoint.cpp | 3 +- linden/indra/llcharacter/lljoint.h | 3 +- linden/indra/llcharacter/lljointsolverrp3.cpp | 3 +- linden/indra/llcharacter/lljointsolverrp3.h | 3 +- linden/indra/llcharacter/lljointstate.h | 3 +- linden/indra/llcharacter/llkeyframefallmotion.cpp | 3 +- linden/indra/llcharacter/llkeyframefallmotion.h | 3 +- linden/indra/llcharacter/llkeyframemotion.cpp | 110 +- linden/indra/llcharacter/llkeyframemotion.h | 20 +- linden/indra/llcharacter/llkeyframemotionparam.cpp | 10 +- linden/indra/llcharacter/llkeyframemotionparam.h | 3 +- linden/indra/llcharacter/llkeyframestandmotion.cpp | 3 +- linden/indra/llcharacter/llkeyframestandmotion.h | 3 +- linden/indra/llcharacter/llkeyframewalkmotion.cpp | 3 +- linden/indra/llcharacter/llkeyframewalkmotion.h | 3 +- linden/indra/llcharacter/llmotion.cpp | 3 +- linden/indra/llcharacter/llmotion.h | 3 +- linden/indra/llcharacter/llmotioncontroller.cpp | 3 +- linden/indra/llcharacter/llmotioncontroller.h | 3 +- linden/indra/llcharacter/llmultigesture.cpp | 3 +- linden/indra/llcharacter/llmultigesture.h | 5 +- linden/indra/llcharacter/llpose.cpp | 3 +- linden/indra/llcharacter/llpose.h | 3 +- linden/indra/llcharacter/llstatemachine.cpp | 9 +- linden/indra/llcharacter/llstatemachine.h | 3 +- linden/indra/llcharacter/lltargetingmotion.cpp | 3 +- linden/indra/llcharacter/lltargetingmotion.h | 3 +- linden/indra/llcharacter/llvisualparam.cpp | 3 +- linden/indra/llcharacter/llvisualparam.h | 3 +- linden/indra/llcommon/CMakeLists.txt | 2 + linden/indra/llcommon/bitpack.h | 3 +- linden/indra/llcommon/ctype_workaround.h | 3 +- linden/indra/llcommon/doublelinkedlist.h | 3 +- linden/indra/llcommon/imageids.h | 4 +- linden/indra/llcommon/indra_constants.h | 24 +- linden/indra/llcommon/is_approx_equal_fraction.h | 85 + linden/indra/llcommon/linden_common.h | 3 +- linden/indra/llcommon/linked_lists.h | 3 +- linden/indra/llcommon/llagentconstants.h | 3 +- linden/indra/llcommon/llapp.cpp | 35 +- linden/indra/llcommon/llapp.h | 13 +- linden/indra/llcommon/llapr.cpp | 505 +- linden/indra/llcommon/llapr.h | 127 +- linden/indra/llcommon/llassettype.cpp | 3 +- linden/indra/llcommon/llassettype.h | 3 +- linden/indra/llcommon/llassoclist.h | 3 +- linden/indra/llcommon/llavatarconstants.h | 3 +- linden/indra/llcommon/llbase32.cpp | 11 +- linden/indra/llcommon/llbase32.h | 3 +- linden/indra/llcommon/llbase64.cpp | 3 +- linden/indra/llcommon/llbase64.h | 3 +- linden/indra/llcommon/llboost.h | 3 +- linden/indra/llcommon/llchat.h | 7 +- linden/indra/llcommon/llclickaction.h | 3 +- linden/indra/llcommon/llcommon.cpp | 3 +- linden/indra/llcommon/llcommon.h | 3 +- linden/indra/llcommon/llcrc.cpp | 7 +- linden/indra/llcommon/llcrc.h | 3 +- linden/indra/llcommon/llcriticaldamp.cpp | 3 +- linden/indra/llcommon/llcriticaldamp.h | 3 +- linden/indra/llcommon/llcursortypes.cpp | 90 + linden/indra/llcommon/llcursortypes.h | 82 + linden/indra/llcommon/lldarray.h | 3 +- linden/indra/llcommon/lldarrayptr.h | 3 +- linden/indra/llcommon/lldate.cpp | 20 +- linden/indra/llcommon/lldate.h | 33 +- linden/indra/llcommon/lldefs.h | 3 +- linden/indra/llcommon/lldepthstack.h | 3 +- linden/indra/llcommon/lldlinked.h | 3 +- linden/indra/llcommon/lldqueueptr.h | 3 +- linden/indra/llcommon/llendianswizzle.h | 3 +- linden/indra/llcommon/llenum.h | 3 +- linden/indra/llcommon/llerror.cpp | 126 +- linden/indra/llcommon/llerror.h | 39 +- linden/indra/llcommon/llerrorcontrol.h | 3 +- linden/indra/llcommon/llerrorlegacy.h | 4 +- linden/indra/llcommon/llerrorthread.cpp | 3 +- linden/indra/llcommon/llerrorthread.h | 3 +- linden/indra/llcommon/llevent.cpp | 3 +- linden/indra/llcommon/llevent.h | 3 +- linden/indra/llcommon/lleventemitter.h | 3 +- linden/indra/llcommon/llextendedstatus.h | 3 +- linden/indra/llcommon/llfasttimer.cpp | 5 +- linden/indra/llcommon/llfasttimer.h | 15 +- linden/indra/llcommon/llfile.cpp | 3 +- linden/indra/llcommon/llfile.h | 3 +- linden/indra/llcommon/llfindlocale.cpp | 9 +- linden/indra/llcommon/llfindlocale.h | 3 +- linden/indra/llcommon/llfixedbuffer.cpp | 10 +- linden/indra/llcommon/llfixedbuffer.h | 13 +- linden/indra/llcommon/llformat.cpp | 3 +- linden/indra/llcommon/llformat.h | 3 +- linden/indra/llcommon/llframetimer.cpp | 3 +- linden/indra/llcommon/llframetimer.h | 3 +- linden/indra/llcommon/llhash.h | 18 +- linden/indra/llcommon/llheartbeat.cpp | 3 +- linden/indra/llcommon/llheartbeat.h | 3 +- linden/indra/llcommon/llhttpstatuscodes.h | 3 +- linden/indra/llcommon/llindexedqueue.h | 3 +- linden/indra/llcommon/llindraconfigfile.cpp | 25 +- linden/indra/llcommon/llindraconfigfile.h | 25 +- linden/indra/llcommon/llkeythrottle.h | 3 +- linden/indra/llcommon/llkeyusetracker.h | 3 +- linden/indra/llcommon/lllinkedqueue.h | 3 +- linden/indra/llcommon/llliveappconfig.cpp | 3 +- linden/indra/llcommon/llliveappconfig.h | 3 +- linden/indra/llcommon/lllivefile.cpp | 3 +- linden/indra/llcommon/lllivefile.h | 3 +- linden/indra/llcommon/lllocalidhashmap.h | 3 +- linden/indra/llcommon/lllog.cpp | 15 +- linden/indra/llcommon/lllog.h | 7 +- linden/indra/llcommon/lllslconstants.h | 17 +- linden/indra/llcommon/llmap.h | 3 +- linden/indra/llcommon/llmd5.cpp | 3 +- linden/indra/llcommon/llmd5.h | 3 +- linden/indra/llcommon/llmemory.cpp | 33 +- linden/indra/llcommon/llmemory.h | 62 +- linden/indra/llcommon/llmemorystream.cpp | 3 +- linden/indra/llcommon/llmemorystream.h | 3 +- linden/indra/llcommon/llmemtype.h | 3 +- linden/indra/llcommon/llmetrics.cpp | 3 +- linden/indra/llcommon/llmetrics.h | 3 +- linden/indra/llcommon/llmortician.cpp | 3 +- linden/indra/llcommon/llmortician.h | 3 +- linden/indra/llcommon/llnametable.h | 3 +- linden/indra/llcommon/llpreprocessor.h | 14 +- linden/indra/llcommon/llpriqueuemap.h | 3 +- linden/indra/llcommon/llprocessor.cpp | 40 +- linden/indra/llcommon/llprocessor.h | 3 +- linden/indra/llcommon/llptrskiplist.h | 3 +- linden/indra/llcommon/llptrskipmap.h | 3 +- linden/indra/llcommon/llqueuedthread.cpp | 6 +- linden/indra/llcommon/llqueuedthread.h | 3 +- linden/indra/llcommon/llrand.cpp | 3 +- linden/indra/llcommon/llrand.h | 3 +- linden/indra/llcommon/llrun.cpp | 3 +- linden/indra/llcommon/llrun.h | 3 +- linden/indra/llcommon/llsd.cpp | 43 +- linden/indra/llcommon/llsd.h | 7 +- linden/indra/llcommon/llsdserialize.cpp | 3 +- linden/indra/llcommon/llsdserialize.h | 3 +- linden/indra/llcommon/llsdserialize_xml.cpp | 179 +- linden/indra/llcommon/llsdserialize_xml.h | 3 +- linden/indra/llcommon/llsdutil.cpp | 3 +- linden/indra/llcommon/llsdutil.h | 3 +- linden/indra/llcommon/llsecondlifeurls.cpp | 3 +- linden/indra/llcommon/llsecondlifeurls.h | 3 +- linden/indra/llcommon/llsimplehash.h | 3 +- linden/indra/llcommon/llskiplist.h | 3 +- linden/indra/llcommon/llskipmap.h | 3 +- linden/indra/llcommon/llsmoothstep.h | 3 +- linden/indra/llcommon/llstack.h | 3 +- linden/indra/llcommon/llstat.cpp | 3 +- linden/indra/llcommon/llstat.h | 3 +- linden/indra/llcommon/llstatenums.h | 3 +- linden/indra/llcommon/llstl.h | 3 +- linden/indra/llcommon/llstreamtools.cpp | 3 +- linden/indra/llcommon/llstreamtools.h | 3 +- linden/indra/llcommon/llstrider.h | 3 +- linden/indra/llcommon/llstring.cpp | 57 +- linden/indra/llcommon/llstring.h | 55 +- linden/indra/llcommon/llstringtable.cpp | 3 +- linden/indra/llcommon/llstringtable.h | 3 +- linden/indra/llcommon/llsys.cpp | 37 +- linden/indra/llcommon/llsys.h | 3 +- linden/indra/llcommon/llthread.cpp | 11 +- linden/indra/llcommon/llthread.h | 11 +- linden/indra/llcommon/lltimer.cpp | 11 +- linden/indra/llcommon/lltimer.h | 7 +- linden/indra/llcommon/lluri.cpp | 8 +- linden/indra/llcommon/lluri.h | 6 +- linden/indra/llcommon/lluuid.cpp | 25 +- linden/indra/llcommon/lluuid.h | 8 +- linden/indra/llcommon/lluuidhashmap.h | 3 +- linden/indra/llcommon/llversionserver.h | 9 +- linden/indra/llcommon/llversionviewer.h | 7 +- linden/indra/llcommon/llworkerthread.cpp | 21 +- linden/indra/llcommon/llworkerthread.h | 9 +- linden/indra/llcommon/metaclass.cpp | 3 +- linden/indra/llcommon/metaclass.h | 3 +- linden/indra/llcommon/metaclasst.h | 3 +- linden/indra/llcommon/metaproperty.cpp | 3 +- linden/indra/llcommon/metaproperty.h | 3 +- linden/indra/llcommon/metapropertyt.h | 3 +- linden/indra/llcommon/processor.h | 3 +- linden/indra/llcommon/reflective.cpp | 3 +- linden/indra/llcommon/reflective.h | 3 +- linden/indra/llcommon/reflectivet.h | 3 +- linden/indra/llcommon/roles_constants.h | 3 +- linden/indra/llcommon/stdenums.h | 3 +- linden/indra/llcommon/stdtypes.h | 6 +- linden/indra/llcommon/string_table.h | 3 +- linden/indra/llcommon/timer.h | 3 +- linden/indra/llcommon/timing.cpp | 3 +- linden/indra/llcommon/timing.h | 3 +- linden/indra/llcommon/u64.cpp | 3 +- linden/indra/llcommon/u64.h | 3 +- linden/indra/llcrashlogger/llcrashlogger.cpp | 5 +- linden/indra/llcrashlogger/llcrashlogger.h | 3 +- linden/indra/llimage/CMakeLists.txt | 1 + linden/indra/llimage/llimage.cpp | 23 +- linden/indra/llimage/llimage.h | 3 +- linden/indra/llimage/llimagebmp.cpp | 3 +- linden/indra/llimage/llimagebmp.h | 3 +- linden/indra/llimage/llimagedxt.cpp | 3 +- linden/indra/llimage/llimagedxt.h | 3 +- linden/indra/llimage/llimagej2c.cpp | 13 +- linden/indra/llimage/llimagej2c.h | 3 +- linden/indra/llimage/llimagejpeg.cpp | 3 +- linden/indra/llimage/llimagejpeg.h | 3 +- linden/indra/llimage/llimagepng.cpp | 3 +- linden/indra/llimage/llimagepng.h | 3 +- linden/indra/llimage/llimagetga.cpp | 5 +- linden/indra/llimage/llimagetga.h | 3 +- linden/indra/llimage/llimageworker.cpp | 3 +- linden/indra/llimage/llimageworker.h | 3 +- linden/indra/llimage/llmapimagetype.h | 3 +- linden/indra/llimage/llpngwrapper.cpp | 3 +- linden/indra/llimage/llpngwrapper.h | 3 +- linden/indra/llimagej2coj/llimagej2coj.cpp | 25 +- linden/indra/llimagej2coj/llimagej2coj.h | 3 +- linden/indra/llinventory/llcategory.cpp | 3 +- linden/indra/llinventory/llcategory.h | 3 +- linden/indra/llinventory/lleconomy.cpp | 15 +- linden/indra/llinventory/lleconomy.h | 5 +- linden/indra/llinventory/llinventory.cpp | 3 +- linden/indra/llinventory/llinventory.h | 3 +- linden/indra/llinventory/llinventorytype.cpp | 3 +- linden/indra/llinventory/llinventorytype.h | 3 +- linden/indra/llinventory/lllandmark.cpp | 3 +- linden/indra/llinventory/lllandmark.h | 3 +- linden/indra/llinventory/llnotecard.cpp | 3 +- linden/indra/llinventory/llnotecard.h | 3 +- linden/indra/llinventory/llparcel.cpp | 758 +-- linden/indra/llinventory/llparcel.h | 41 +- linden/indra/llinventory/llparcelflags.h | 3 +- linden/indra/llinventory/llpermissions.cpp | 12 +- linden/indra/llinventory/llpermissions.h | 8 +- linden/indra/llinventory/llpermissionsflags.h | 3 +- linden/indra/llinventory/llsaleinfo.cpp | 3 +- linden/indra/llinventory/llsaleinfo.h | 3 +- linden/indra/llinventory/lltransactionflags.cpp | 3 +- linden/indra/llinventory/lltransactionflags.h | 3 +- linden/indra/llinventory/lltransactiontypes.h | 3 +- linden/indra/llinventory/lluserrelations.cpp | 3 +- linden/indra/llinventory/lluserrelations.h | 3 +- linden/indra/llmath/camera.h | 3 +- linden/indra/llmath/coordframe.h | 3 +- linden/indra/llmath/llbboxlocal.cpp | 3 +- linden/indra/llmath/llbboxlocal.h | 3 +- linden/indra/llmath/llcamera.cpp | 155 +- linden/indra/llmath/llcamera.h | 25 +- linden/indra/llmath/llcoord.h | 3 +- linden/indra/llmath/llcoordframe.cpp | 3 +- linden/indra/llmath/llcoordframe.h | 3 +- linden/indra/llmath/llinterp.h | 3 +- linden/indra/llmath/llline.cpp | 27 +- linden/indra/llmath/llline.h | 25 +- linden/indra/llmath/llmath.h | 81 +- linden/indra/llmath/llmodularmath.h | 3 +- linden/indra/llmath/lloctree.h | 13 +- linden/indra/llmath/llperlin.cpp | 3 +- linden/indra/llmath/llperlin.h | 3 +- linden/indra/llmath/llplane.h | 3 +- linden/indra/llmath/llquantize.h | 3 +- linden/indra/llmath/llquaternion.cpp | 3 +- linden/indra/llmath/llquaternion.h | 3 +- linden/indra/llmath/llrect.cpp | 3 +- linden/indra/llmath/llrect.h | 8 +- linden/indra/llmath/llsdutil_math.cpp | 3 +- linden/indra/llmath/llsphere.cpp | 27 +- linden/indra/llmath/llsphere.h | 27 +- linden/indra/llmath/lltreenode.h | 3 +- linden/indra/llmath/llv4math.h | 3 +- linden/indra/llmath/llv4matrix3.h | 3 +- linden/indra/llmath/llv4matrix4.h | 3 +- linden/indra/llmath/llv4vector3.h | 3 +- linden/indra/llmath/llvolume.cpp | 87 +- linden/indra/llmath/llvolume.h | 5 +- linden/indra/llmath/llvolumemgr.cpp | 3 +- linden/indra/llmath/llvolumemgr.h | 3 +- linden/indra/llmath/m3math.cpp | 3 +- linden/indra/llmath/m3math.h | 3 +- linden/indra/llmath/m4math.cpp | 3 +- linden/indra/llmath/m4math.h | 3 +- linden/indra/llmath/raytrace.cpp | 3 +- linden/indra/llmath/raytrace.h | 3 +- linden/indra/llmath/v2math.cpp | 3 +- linden/indra/llmath/v2math.h | 7 +- linden/indra/llmath/v3color.cpp | 3 +- linden/indra/llmath/v3color.h | 11 +- linden/indra/llmath/v3dmath.cpp | 3 +- linden/indra/llmath/v3dmath.h | 3 +- linden/indra/llmath/v3math.cpp | 4 +- linden/indra/llmath/v3math.h | 7 +- linden/indra/llmath/v4color.cpp | 3 +- linden/indra/llmath/v4color.h | 3 +- linden/indra/llmath/v4coloru.cpp | 3 +- linden/indra/llmath/v4coloru.h | 3 +- linden/indra/llmath/v4math.cpp | 3 +- linden/indra/llmath/v4math.h | 3 +- linden/indra/llmath/xform.cpp | 3 +- linden/indra/llmath/xform.h | 3 +- linden/indra/llmedia/llmediabase.h | 3 +- linden/indra/llmedia/llmediaemitter.h | 3 +- linden/indra/llmedia/llmediaimplcommon.cpp | 3 +- linden/indra/llmedia/llmediaimplcommon.h | 3 +- linden/indra/llmedia/llmediaimplexample1.cpp | 3 +- linden/indra/llmedia/llmediaimplexample1.h | 3 +- linden/indra/llmedia/llmediaimplexample2.cpp | 3 +- linden/indra/llmedia/llmediaimplexample2.h | 3 +- linden/indra/llmedia/llmediaimplfactory.cpp | 3 +- linden/indra/llmedia/llmediaimplfactory.h | 3 +- linden/indra/llmedia/llmediaimplgstreamer.cpp | 249 +- linden/indra/llmedia/llmediaimplgstreamer.h | 32 +- linden/indra/llmedia/llmediaimplgstreamer_syms.cpp | 59 +- linden/indra/llmedia/llmediaimplgstreamer_syms.h | 12 +- .../llmedia/llmediaimplgstreamer_syms_raw.inc | 8 +- .../llmedia/llmediaimplgstreamer_syms_rawa.inc | 5 - .../indra/llmedia/llmediaimplgstreamervidplug.cpp | 43 +- linden/indra/llmedia/llmediaimplgstreamervidplug.h | 3 +- linden/indra/llmedia/llmediaimplllmozlib.cpp | 3 +- linden/indra/llmedia/llmediaimplllmozlib.h | 3 +- linden/indra/llmedia/llmediaimplquicktime.cpp | 3 +- linden/indra/llmedia/llmediaimplquicktime.h | 3 +- linden/indra/llmedia/llmediaimplregister.h | 3 +- linden/indra/llmedia/llmediamanager.cpp | 5 +- linden/indra/llmedia/llmediamanager.h | 3 +- linden/indra/llmedia/llmediaobserver.h | 3 +- linden/indra/llmessage/CMakeLists.txt | 26 +- linden/indra/llmessage/llares.cpp | 23 +- linden/indra/llmessage/llares.h | 3 +- linden/indra/llmessage/llassetstorage.cpp | 23 +- linden/indra/llmessage/llassetstorage.h | 3 +- linden/indra/llmessage/llblowfishcipher.cpp | 3 +- linden/indra/llmessage/llblowfishcipher.h | 3 +- linden/indra/llmessage/llbuffer.cpp | 3 +- linden/indra/llmessage/llbuffer.h | 3 +- linden/indra/llmessage/llbufferstream.cpp | 3 +- linden/indra/llmessage/llbufferstream.h | 3 +- linden/indra/llmessage/llcachename.cpp | 228 +- linden/indra/llmessage/llcachename.h | 17 +- linden/indra/llmessage/llchainio.cpp | 3 +- linden/indra/llmessage/llchainio.h | 3 +- linden/indra/llmessage/llcipher.h | 3 +- linden/indra/llmessage/llcircuit.cpp | 36 +- linden/indra/llmessage/llcircuit.h | 19 +- linden/indra/llmessage/llclassifiedflags.cpp | 28 +- linden/indra/llmessage/llclassifiedflags.h | 20 +- linden/indra/llmessage/llcurl.cpp | 3 +- linden/indra/llmessage/llcurl.h | 3 +- linden/indra/llmessage/lldatapacker.cpp | 3 +- linden/indra/llmessage/lldatapacker.h | 3 +- linden/indra/llmessage/lldbstrings.h | 3 +- linden/indra/llmessage/lldispatcher.cpp | 50 +- linden/indra/llmessage/lldispatcher.h | 3 +- linden/indra/llmessage/lleventflags.h | 4 +- linden/indra/llmessage/llfiltersd2xmlrpc.cpp | 3 +- linden/indra/llmessage/llfiltersd2xmlrpc.h | 3 +- linden/indra/llmessage/llfollowcamparams.h | 3 +- linden/indra/llmessage/llhost.cpp | 3 +- linden/indra/llmessage/llhost.h | 3 +- linden/indra/llmessage/llhttpassetstorage.cpp | 4 +- linden/indra/llmessage/llhttpassetstorage.h | 3 +- linden/indra/llmessage/llhttpclient.cpp | 81 +- linden/indra/llmessage/llhttpclient.h | 53 +- linden/indra/llmessage/llhttpclientadapter.cpp | 61 + linden/indra/llmessage/llhttpclientadapter.h | 49 + linden/indra/llmessage/llhttpclientinterface.h | 51 + linden/indra/llmessage/llhttpnode.cpp | 13 +- linden/indra/llmessage/llhttpnode.h | 78 +- linden/indra/llmessage/llhttpnodeadapter.h | 58 + linden/indra/llmessage/llhttpsender.cpp | 3 +- linden/indra/llmessage/llhttpsender.h | 3 +- linden/indra/llmessage/llinstantmessage.cpp | 3 +- linden/indra/llmessage/llinstantmessage.h | 5 +- linden/indra/llmessage/llinvite.h | 3 +- linden/indra/llmessage/lliobuffer.cpp | 3 +- linden/indra/llmessage/lliobuffer.h | 3 +- linden/indra/llmessage/lliohttpserver.cpp | 75 +- linden/indra/llmessage/lliohttpserver.h | 15 +- linden/indra/llmessage/lliopipe.cpp | 3 +- linden/indra/llmessage/lliopipe.h | 3 +- linden/indra/llmessage/lliosocket.cpp | 3 +- linden/indra/llmessage/lliosocket.h | 3 +- linden/indra/llmessage/llioutil.cpp | 3 +- linden/indra/llmessage/llioutil.h | 3 +- linden/indra/llmessage/llloginflags.h | 3 +- linden/indra/llmessage/llmail.cpp | 3 +- linden/indra/llmessage/llmail.h | 3 +- linden/indra/llmessage/llmessagebuilder.cpp | 3 +- linden/indra/llmessage/llmessagebuilder.h | 3 +- linden/indra/llmessage/llmessageconfig.cpp | 3 +- linden/indra/llmessage/llmessageconfig.h | 3 +- linden/indra/llmessage/llmessagereader.cpp | 3 +- linden/indra/llmessage/llmessagereader.h | 9 +- linden/indra/llmessage/llmessagesenderinterface.h | 50 + linden/indra/llmessage/llmessagetemplate.cpp | 3 +- linden/indra/llmessage/llmessagetemplate.h | 3 +- linden/indra/llmessage/llmessagetemplateparser.cpp | 3 +- linden/indra/llmessage/llmessagetemplateparser.h | 3 +- linden/indra/llmessage/llmessagethrottle.cpp | 7 +- linden/indra/llmessage/llmessagethrottle.h | 3 +- linden/indra/llmessage/llmime.cpp | 3 +- linden/indra/llmessage/llmime.h | 3 +- linden/indra/llmessage/llmsgvariabletype.h | 3 +- linden/indra/llmessage/llnamevalue.cpp | 4 +- linden/indra/llmessage/llnamevalue.h | 3 +- linden/indra/llmessage/llnullcipher.cpp | 3 +- linden/indra/llmessage/llnullcipher.h | 3 +- linden/indra/llmessage/llpacketack.cpp | 3 +- linden/indra/llmessage/llpacketack.h | 3 +- linden/indra/llmessage/llpacketbuffer.cpp | 6 +- linden/indra/llmessage/llpacketbuffer.h | 11 +- linden/indra/llmessage/llpacketring.cpp | 5 +- linden/indra/llmessage/llpacketring.h | 10 +- linden/indra/llmessage/llpartdata.cpp | 3 +- linden/indra/llmessage/llpartdata.h | 3 +- linden/indra/llmessage/llpumpio.cpp | 14 +- linden/indra/llmessage/llpumpio.h | 3 +- linden/indra/llmessage/llqueryflags.h | 35 +- linden/indra/llmessage/llregionflags.h | 9 +- linden/indra/llmessage/llregionhandle.h | 3 +- .../indra/llmessage/llregionpresenceverifier.cpp | 98 + linden/indra/llmessage/llregionpresenceverifier.h | 92 + linden/indra/llmessage/llsdappservices.cpp | 3 +- linden/indra/llmessage/llsdappservices.h | 3 +- linden/indra/llmessage/llsdhttpserver.cpp | 3 +- linden/indra/llmessage/llsdhttpserver.h | 3 +- linden/indra/llmessage/llsdmessagebuilder.cpp | 126 +- linden/indra/llmessage/llsdmessagebuilder.h | 3 +- linden/indra/llmessage/llsdmessagereader.cpp | 9 +- linden/indra/llmessage/llsdmessagereader.h | 3 +- linden/indra/llmessage/llsdrpcclient.cpp | 3 +- linden/indra/llmessage/llsdrpcclient.h | 3 +- linden/indra/llmessage/llsdrpcserver.cpp | 3 +- linden/indra/llmessage/llsdrpcserver.h | 3 +- linden/indra/llmessage/llservice.cpp | 3 +- linden/indra/llmessage/llservice.h | 3 +- linden/indra/llmessage/llservicebuilder.cpp | 25 +- linden/indra/llmessage/llservicebuilder.h | 3 +- linden/indra/llmessage/llstoredmessage.cpp | 38 + linden/indra/llmessage/llstoredmessage.h | 58 + linden/indra/llmessage/lltaskname.h | 3 +- linden/indra/llmessage/llteleportflags.h | 3 +- .../indra/llmessage/lltemplatemessagebuilder.cpp | 9 +- linden/indra/llmessage/lltemplatemessagebuilder.h | 8 +- .../llmessage/lltemplatemessagedispatcher.cpp | 73 + .../indra/llmessage/lltemplatemessagedispatcher.h | 54 + linden/indra/llmessage/lltemplatemessagereader.cpp | 77 +- linden/indra/llmessage/lltemplatemessagereader.h | 5 +- linden/indra/llmessage/llthrottle.cpp | 3 +- linden/indra/llmessage/llthrottle.h | 3 +- linden/indra/llmessage/lltransfermanager.cpp | 3 +- linden/indra/llmessage/lltransfermanager.h | 3 +- linden/indra/llmessage/lltransfersourceasset.cpp | 3 +- linden/indra/llmessage/lltransfersourceasset.h | 3 +- linden/indra/llmessage/lltransfersourcefile.cpp | 3 +- linden/indra/llmessage/lltransfersourcefile.h | 3 +- linden/indra/llmessage/lltransfertargetfile.cpp | 3 +- linden/indra/llmessage/lltransfertargetfile.h | 3 +- linden/indra/llmessage/lltransfertargetvfile.cpp | 3 +- linden/indra/llmessage/lltransfertargetvfile.h | 3 +- linden/indra/llmessage/lltrustedmessageservice.cpp | 90 + linden/indra/llmessage/lltrustedmessageservice.h | 52 + linden/indra/llmessage/llurlrequest.cpp | 62 +- linden/indra/llmessage/llurlrequest.h | 16 +- linden/indra/llmessage/lluseroperation.cpp | 3 +- linden/indra/llmessage/lluseroperation.h | 3 +- linden/indra/llmessage/llvehicleparams.h | 3 +- linden/indra/llmessage/llxfer.cpp | 3 +- linden/indra/llmessage/llxfer.h | 3 +- linden/indra/llmessage/llxfer_file.cpp | 3 +- linden/indra/llmessage/llxfer_file.h | 3 +- linden/indra/llmessage/llxfer_mem.cpp | 3 +- linden/indra/llmessage/llxfer_mem.h | 3 +- linden/indra/llmessage/llxfer_vfile.cpp | 3 +- linden/indra/llmessage/llxfer_vfile.h | 3 +- linden/indra/llmessage/llxfermanager.cpp | 3 +- linden/indra/llmessage/llxfermanager.h | 3 +- linden/indra/llmessage/llxorcipher.cpp | 3 +- linden/indra/llmessage/llxorcipher.h | 3 +- linden/indra/llmessage/machine.h | 3 +- linden/indra/llmessage/mean_collision_data.h | 3 +- linden/indra/llmessage/message.cpp | 383 +- linden/indra/llmessage/message.h | 102 +- linden/indra/llmessage/message_prehash.cpp | 7 +- linden/indra/llmessage/message_prehash.h | 7 +- linden/indra/llmessage/message_string_table.cpp | 3 +- linden/indra/llmessage/net.cpp | 113 +- linden/indra/llmessage/net.h | 5 +- linden/indra/llmessage/network.cpp | 31 - linden/indra/llmessage/network.h | 31 - linden/indra/llmessage/partsyspacket.cpp | 3 +- linden/indra/llmessage/partsyspacket.h | 3 +- linden/indra/llmessage/patch_code.cpp | 3 +- linden/indra/llmessage/patch_code.h | 3 +- linden/indra/llmessage/patch_dct.cpp | 3 +- linden/indra/llmessage/patch_dct.h | 3 +- linden/indra/llmessage/patch_idct.cpp | 3 +- linden/indra/llmessage/sound_ids.h | 3 +- linden/indra/llprimitive/legacy_object_types.h | 3 +- linden/indra/llprimitive/llmaterialtable.cpp | 3 +- linden/indra/llprimitive/llmaterialtable.h | 3 +- linden/indra/llprimitive/llprimitive.cpp | 16 +- linden/indra/llprimitive/llprimitive.h | 3 +- linden/indra/llprimitive/llprimlinkinfo.h | 27 +- linden/indra/llprimitive/lltextureanim.cpp | 3 +- linden/indra/llprimitive/lltextureanim.h | 3 +- linden/indra/llprimitive/lltextureentry.cpp | 3 +- linden/indra/llprimitive/lltextureentry.h | 3 +- linden/indra/llprimitive/lltree_common.h | 3 +- linden/indra/llprimitive/lltreeparams.cpp | 3 +- linden/indra/llprimitive/lltreeparams.h | 3 +- linden/indra/llprimitive/llvolumemessage.cpp | 3 +- linden/indra/llprimitive/llvolumemessage.h | 3 +- linden/indra/llprimitive/llvolumexml.cpp | 3 +- linden/indra/llprimitive/llvolumexml.h | 3 +- linden/indra/llprimitive/material_codes.h | 3 +- linden/indra/llprimitive/object_flags.h | 3 +- linden/indra/llrender/CMakeLists.txt | 14 +- linden/indra/llrender/llcubemap.cpp | 15 +- linden/indra/llrender/llcubemap.h | 3 +- linden/indra/llrender/llfont.cpp | 187 +- linden/indra/llrender/llfont.h | 52 +- linden/indra/llrender/llfontbitmapcache.cpp | 169 + linden/indra/llrender/llfontbitmapcache.h | 79 + linden/indra/llrender/llfontgl.cpp | 673 +- linden/indra/llrender/llfontgl.h | 74 +- linden/indra/llrender/llfontregistry.cpp | 651 ++ linden/indra/llrender/llfontregistry.h | 114 + linden/indra/llrender/llgl.cpp | 132 +- linden/indra/llrender/llgl.h | 7 +- linden/indra/llrender/llgldbg.cpp | 3 +- linden/indra/llrender/llgldbg.h | 3 +- linden/indra/llrender/llglheaders.h | 247 +- linden/indra/llrender/llglimmediate.cpp | 264 - linden/indra/llrender/llglimmediate.h | 97 - linden/indra/llrender/llglslshader.cpp | 89 +- linden/indra/llrender/llglslshader.h | 7 +- linden/indra/llrender/llglstates.h | 3 +- linden/indra/llrender/llgltypes.h | 3 +- linden/indra/llrender/llimagegl.cpp | 315 +- linden/indra/llrender/llimagegl.h | 78 +- linden/indra/llrender/llpostprocess.cpp | 25 +- linden/indra/llrender/llpostprocess.h | 5 +- linden/indra/llrender/llrender.cpp | 145 +- linden/indra/llrender/llrender.h | 47 +- linden/indra/llrender/llrendersphere.cpp | 3 +- linden/indra/llrender/llrendersphere.h | 25 +- linden/indra/llrender/llrendertarget.cpp | 536 +- linden/indra/llrender/llrendertarget.h | 61 +- linden/indra/llrender/llshadermgr.cpp | 5 +- linden/indra/llrender/llshadermgr.h | 3 +- linden/indra/llrender/llvertexbuffer.cpp | 109 +- linden/indra/llrender/llvertexbuffer.h | 18 +- linden/indra/llui/CMakeLists.txt | 10 + linden/indra/llui/llalertdialog.cpp | 766 +-- linden/indra/llui/llalertdialog.h | 156 +- linden/indra/llui/llbutton.cpp | 13 +- linden/indra/llui/llbutton.h | 5 +- linden/indra/llui/llcallbackmap.h | 3 +- linden/indra/llui/llcheckboxctrl.cpp | 9 +- linden/indra/llui/llcheckboxctrl.h | 3 +- linden/indra/llui/llclipboard.cpp | 3 +- linden/indra/llui/llclipboard.h | 3 +- linden/indra/llui/llcombobox.cpp | 39 +- linden/indra/llui/llcombobox.h | 4 +- linden/indra/llui/llctrlselectioninterface.cpp | 3 +- linden/indra/llui/llctrlselectioninterface.h | 3 +- linden/indra/llui/lldraghandle.cpp | 3 +- linden/indra/llui/lldraghandle.h | 3 +- linden/indra/llui/lleditmenuhandler.cpp | 3 +- linden/indra/llui/lleditmenuhandler.h | 3 +- linden/indra/llui/llfloater.cpp | 12 +- linden/indra/llui/llfloater.h | 29 +- linden/indra/llui/llfocusmgr.cpp | 3 +- linden/indra/llui/llfocusmgr.h | 3 +- linden/indra/llui/llfunctorregistry.cpp | 38 + linden/indra/llui/llfunctorregistry.h | 146 + linden/indra/llui/llhtmlhelp.h | 3 +- linden/indra/llui/lliconctrl.cpp | 3 +- linden/indra/llui/lliconctrl.h | 3 +- linden/indra/llui/llkeywords.cpp | 3 +- linden/indra/llui/llkeywords.h | 3 +- linden/indra/llui/lllineeditor.cpp | 7 +- linden/indra/llui/lllineeditor.h | 3 +- linden/indra/llui/llmemberlistener.h | 3 +- linden/indra/llui/llmenugl.cpp | 31 +- linden/indra/llui/llmenugl.h | 3 +- linden/indra/llui/llmodaldialog.cpp | 3 +- linden/indra/llui/llmodaldialog.h | 3 +- linden/indra/llui/llmultislider.cpp | 3 +- linden/indra/llui/llmultislider.h | 3 +- linden/indra/llui/llmultisliderctrl.cpp | 5 +- linden/indra/llui/llmultisliderctrl.h | 3 +- linden/indra/llui/llnotifications.cpp | 1487 +++++ linden/indra/llui/llnotifications.h | 903 +++ linden/indra/llui/llpanel.cpp | 142 +- linden/indra/llui/llpanel.h | 33 +- linden/indra/llui/llprogressbar.cpp | 181 + linden/indra/llui/llprogressbar.h | 76 + linden/indra/llui/llradiogroup.cpp | 3 +- linden/indra/llui/llradiogroup.h | 3 +- linden/indra/llui/llresizebar.cpp | 3 +- linden/indra/llui/llresizebar.h | 3 +- linden/indra/llui/llresizehandle.cpp | 3 +- linden/indra/llui/llresizehandle.h | 3 +- linden/indra/llui/llresmgr.cpp | 13 +- linden/indra/llui/llresmgr.h | 3 +- linden/indra/llui/llrootview.cpp | 3 +- linden/indra/llui/llrootview.h | 3 +- linden/indra/llui/llscrollbar.cpp | 90 +- linden/indra/llui/llscrollbar.h | 5 +- linden/indra/llui/llscrollcontainer.cpp | 3 +- linden/indra/llui/llscrollcontainer.h | 3 +- linden/indra/llui/llscrollingpanellist.cpp | 3 +- linden/indra/llui/llscrollingpanellist.h | 3 +- linden/indra/llui/llscrolllistctrl.cpp | 353 +- linden/indra/llui/llscrolllistctrl.h | 118 +- linden/indra/llui/llslider.cpp | 3 +- linden/indra/llui/llslider.h | 3 +- linden/indra/llui/llsliderctrl.cpp | 5 +- linden/indra/llui/llsliderctrl.h | 3 +- linden/indra/llui/llspinctrl.cpp | 7 +- linden/indra/llui/llspinctrl.h | 4 +- linden/indra/llui/llstyle.cpp | 3 +- linden/indra/llui/llstyle.h | 3 +- linden/indra/llui/lltabcontainer.cpp | 58 +- linden/indra/llui/lltabcontainer.h | 13 +- linden/indra/llui/lltabcontainervertical.cpp | 3 +- linden/indra/llui/lltabcontainervertical.h | 3 +- linden/indra/llui/lltextbox.cpp | 113 +- linden/indra/llui/lltextbox.h | 13 +- linden/indra/llui/lltexteditor.cpp | 109 +- linden/indra/llui/lltexteditor.h | 18 +- linden/indra/llui/lltextparser.cpp | 299 + linden/indra/llui/lltextparser.h | 73 + linden/indra/llui/llui.cpp | 31 +- linden/indra/llui/llui.h | 241 +- linden/indra/llui/lluiconstants.h | 3 +- linden/indra/llui/lluictrl.cpp | 27 +- linden/indra/llui/lluictrl.h | 9 +- linden/indra/llui/lluictrlfactory.cpp | 9 +- linden/indra/llui/lluictrlfactory.h | 6 +- linden/indra/llui/lluifwd.h | 3 +- linden/indra/llui/lluistring.cpp | 16 +- linden/indra/llui/lluistring.h | 9 +- linden/indra/llui/lluitrans.cpp | 101 + linden/indra/llui/lluitrans.h | 87 + linden/indra/llui/lluixmltags.h | 3 +- linden/indra/llui/llundo.cpp | 3 +- linden/indra/llui/llundo.h | 3 +- linden/indra/llui/llview.cpp | 63 +- linden/indra/llui/llview.h | 13 +- linden/indra/llui/llviewborder.cpp | 6 +- linden/indra/llui/llviewborder.h | 3 +- linden/indra/llui/llviewquery.cpp | 3 +- linden/indra/llui/llviewquery.h | 3 +- linden/indra/llvfs/CMakeLists.txt | 2 + linden/indra/llvfs/lldir.cpp | 52 +- linden/indra/llvfs/lldir.h | 16 +- linden/indra/llvfs/lldir_linux.cpp | 3 +- linden/indra/llvfs/lldir_linux.h | 3 +- linden/indra/llvfs/lldir_mac.cpp | 3 +- linden/indra/llvfs/lldir_mac.h | 3 +- linden/indra/llvfs/lldir_solaris.cpp | 56 +- linden/indra/llvfs/lldir_solaris.h | 5 +- linden/indra/llvfs/lldir_win32.cpp | 35 +- linden/indra/llvfs/lldir_win32.h | 3 +- linden/indra/llvfs/lllfsthread.cpp | 32 +- linden/indra/llvfs/lllfsthread.h | 3 +- linden/indra/llvfs/llpidlock.cpp | 269 + linden/indra/llvfs/llpidlock.h | 73 + linden/indra/llvfs/llvfile.cpp | 3 +- linden/indra/llvfs/llvfile.h | 3 +- linden/indra/llvfs/llvfs.cpp | 66 +- linden/indra/llvfs/llvfs.h | 3 +- linden/indra/llvfs/llvfsthread.cpp | 3 +- linden/indra/llvfs/llvfsthread.h | 3 +- linden/indra/llwindow/lldxhardware.cpp | 3 +- linden/indra/llwindow/lldxhardware.h | 3 +- linden/indra/llwindow/llkeyboard.cpp | 3 +- linden/indra/llwindow/llkeyboard.h | 3 +- linden/indra/llwindow/llkeyboardmacosx.cpp | 3 +- linden/indra/llwindow/llkeyboardmacosx.h | 3 +- linden/indra/llwindow/llkeyboardsdl.cpp | 3 +- linden/indra/llwindow/llkeyboardsdl.h | 3 +- linden/indra/llwindow/llkeyboardwin32.cpp | 3 +- linden/indra/llwindow/llkeyboardwin32.h | 3 +- linden/indra/llwindow/llmousehandler.h | 3 +- linden/indra/llwindow/llpreeditor.h | 3 +- linden/indra/llwindow/llwindow.cpp | 13 +- linden/indra/llwindow/llwindow.h | 48 +- linden/indra/llwindow/llwindowheadless.cpp | 3 +- linden/indra/llwindow/llwindowheadless.h | 3 +- linden/indra/llwindow/llwindowmacosx-objc.h | 3 +- linden/indra/llwindow/llwindowmacosx-objc.mm | 3 +- linden/indra/llwindow/llwindowmacosx.cpp | 14 +- linden/indra/llwindow/llwindowmacosx.h | 5 +- linden/indra/llwindow/llwindowmesaheadless.cpp | 3 +- linden/indra/llwindow/llwindowmesaheadless.h | 3 +- linden/indra/llwindow/llwindowsdl.cpp | 767 +-- linden/indra/llwindow/llwindowsdl.h | 17 +- linden/indra/llwindow/llwindowwin32.cpp | 60 +- linden/indra/llwindow/llwindowwin32.h | 5 +- linden/indra/llxml/CMakeLists.txt | 1 + linden/indra/llxml/llcontrol.cpp | 56 +- linden/indra/llxml/llcontrol.h | 16 +- linden/indra/llxml/llcontrolgroupreader.h | 74 + linden/indra/llxml/llxmlnode.cpp | 188 +- linden/indra/llxml/llxmlnode.h | 29 +- linden/indra/llxml/llxmlparser.cpp | 3 +- linden/indra/llxml/llxmlparser.h | 3 +- linden/indra/llxml/llxmltree.cpp | 3 +- linden/indra/llxml/llxmltree.h | 3 +- linden/indra/lscript/CMakeLists.txt | 3 + linden/indra/lscript/llscriptresource.h | 75 + linden/indra/lscript/llscriptresourceconsumer.h | 67 + linden/indra/lscript/llscriptresourcepool.h | 57 + linden/indra/lscript/lscript_alloc.h | 3 +- linden/indra/lscript/lscript_byteconvert.h | 3 +- linden/indra/lscript/lscript_byteformat.h | 12 +- linden/indra/lscript/lscript_compile/indra.l | 51 +- linden/indra/lscript/lscript_compile/indra.y | 21 + .../lscript/lscript_compile/lscript_alloc.cpp | 3 +- .../lscript/lscript_compile/lscript_bytecode.cpp | 3 +- .../lscript/lscript_compile/lscript_bytecode.h | 3 +- .../lscript/lscript_compile/lscript_error.cpp | 3 +- .../indra/lscript/lscript_compile/lscript_error.h | 3 +- .../indra/lscript/lscript_compile/lscript_heap.cpp | 3 +- .../indra/lscript/lscript_compile/lscript_heap.h | 3 +- .../lscript/lscript_compile/lscript_resource.cpp | 3 +- .../lscript/lscript_compile/lscript_resource.h | 3 +- .../lscript/lscript_compile/lscript_scope.cpp | 3 +- .../indra/lscript/lscript_compile/lscript_scope.h | 3 +- .../indra/lscript/lscript_compile/lscript_tree.cpp | 116 +- .../indra/lscript/lscript_compile/lscript_tree.h | 33 +- .../lscript/lscript_compile/lscript_typecheck.cpp | 3 +- .../lscript/lscript_compile/lscript_typecheck.h | 3 +- linden/indra/lscript/lscript_execute.h | 21 +- .../indra/lscript/lscript_execute/CMakeLists.txt | 6 + .../lscript/lscript_execute/llscriptresource.cpp | 97 + .../lscript_execute/llscriptresourceconsumer.cpp | 112 + .../lscript_execute/llscriptresourcepool.cpp | 50 + .../lscript/lscript_execute/lscript_execute.cpp | 37 +- .../lscript_execute/lscript_heapruntime.cpp | 3 +- .../lscript/lscript_execute/lscript_heapruntime.h | 3 +- .../lscript/lscript_execute/lscript_readlso.cpp | 13 +- .../lscript/lscript_execute/lscript_readlso.h | 3 +- .../lscript/lscript_execute_mono/assembly.cpp | 25 +- linden/indra/lscript/lscript_execute_mono/size.cpp | 25 +- linden/indra/lscript/lscript_export.h | 3 +- linden/indra/lscript/lscript_http.h | 3 +- linden/indra/lscript/lscript_library.h | 3 +- .../lscript/lscript_library/lscript_alloc.cpp | 3 +- .../lscript/lscript_library/lscript_export.cpp | 3 +- .../lscript/lscript_library/lscript_library.cpp | 9 +- linden/indra/lscript/lscript_rt_interface.h | 3 +- linden/indra/mac_crash_logger/llcrashloggermac.cpp | 3 +- linden/indra/mac_crash_logger/llcrashloggermac.h | 3 +- linden/indra/mac_crash_logger/mac_crash_logger.cpp | 3 +- linden/indra/mac_updater/FSCopyObject.h | 3 +- linden/indra/mac_updater/GenLinkedList.h | 3 +- linden/indra/mac_updater/MoreFilesX.h | 3 +- linden/indra/mac_updater/mac_updater.cpp | 3 +- linden/indra/newview/CMakeLists.txt | 86 +- .../indra/newview/English.lproj/InfoPlist.strings | 5 +- linden/indra/newview/Info-SecondLife.plist | 2 +- linden/indra/newview/VertexCache.h | 3 +- linden/indra/newview/VorbisFramework.h | 3 +- linden/indra/newview/app_settings/keywords.ini | 5 + linden/indra/newview/app_settings/logcontrol.xml | 1 + linden/indra/newview/app_settings/settings.xml | 1792 ++++- .../indra/newview/app_settings/settings_files.xml | 103 +- .../shaders/class1/deferred/alphaF.glsl | 88 + .../shaders/class1/deferred/alphaV.glsl | 69 + .../shaders/class1/deferred/avatarAlphaF.glsl | 68 + .../shaders/class1/deferred/avatarAlphaV.glsl | 78 + .../shaders/class1/deferred/avatarF.glsl | 20 + .../shaders/class1/deferred/avatarShadowF.glsl | 15 + .../shaders/class1/deferred/avatarShadowV.glsl | 38 + .../shaders/class1/deferred/avatarV.glsl | 42 + .../shaders/class1/deferred/blurLightF.glsl | 48 + .../shaders/class1/deferred/blurLightV.glsl | 17 + .../shaders/class1/deferred/bumpF.glsl | 29 + .../shaders/class1/deferred/bumpV.glsl | 30 + .../shaders/class1/deferred/diffuseF.glsl | 8 +- .../shaders/class1/deferred/diffuseV.glsl | 4 +- .../shaders/class1/deferred/fullbrightF.glsl | 63 + .../shaders/class1/deferred/fullbrightV.glsl | 41 + .../shaders/class1/deferred/impostorF.glsl | 20 + .../shaders/class1/deferred/impostorV.glsl | 19 + .../shaders/class1/deferred/multiPointLightF.glsl | 83 + .../shaders/class1/deferred/pointLightF.glsl | 75 + .../shaders/class1/deferred/pointLightV.glsl | 28 + .../shaders/class1/deferred/shadowF.glsl | 14 + .../shaders/class1/deferred/shadowV.glsl | 17 + .../shaders/class1/deferred/softenLightF.glsl | 279 + .../shaders/class1/deferred/softenLightV.glsl | 24 + .../shaders/class1/deferred/sunLightF.glsl | 139 + .../shaders/class1/deferred/sunLightV.glsl | 25 + .../shaders/class1/deferred/terrainF.glsl | 36 + .../shaders/class1/deferred/terrainV.glsl | 41 + .../shaders/class1/deferred/treeF.glsl | 20 + .../shaders/class1/deferred/treeV.glsl | 22 + .../shaders/class1/deferred/waterF.glsl | 157 + .../shaders/class1/deferred/waterV.glsl | 76 + .../shaders/class1/effects/glowExtractF.glsl | 4 +- .../shaders/class1/environment/waterF.glsl | 1 + linden/indra/newview/featuretable.txt | 32 + linden/indra/newview/featuretable_solaris.txt | 6 + linden/indra/newview/fmodwrapper.cpp | 3 +- linden/indra/newview/gpu_table.txt | 20 +- .../darwin/firstlookslim-dmg/Applications-alias.r | 6996 -------------------- .../installers/darwin/firstlookslim-dmg/_DS_Store | Bin 12292 -> 0 bytes .../darwin/firstlookslim-dmg/_VolumeIcon.icns | Bin 98049 -> 0 bytes .../darwin/firstlookslim-dmg/background.jpg | Bin 75112 -> 0 bytes .../newview/installers/windows/install_icon.BMP | Bin 0 -> 262198 bytes .../newview/installers/windows/install_icon.ico | Bin 0 -> 25214 bytes .../installers/windows/installer_template.nsi | 20 +- .../newview/installers/windows/uninstall_icon.BMP | Bin 0 -> 262198 bytes .../newview/installers/windows/uninstall_icon.ico | Bin 0 -> 25214 bytes linden/indra/newview/licenses-win32.txt | 34 + .../newview/linux_tools/client-readme-joystick.txt | 78 + .../newview/linux_tools/client-readme-voice.txt | 86 + linden/indra/newview/linux_tools/client-readme.txt | 17 +- linden/indra/newview/linux_tools/wrapper.sh | 13 +- linden/indra/newview/llagent.cpp | 608 +- linden/indra/newview/llagent.h | 55 +- linden/indra/newview/llagentaccess.cpp | 177 + linden/indra/newview/llagentaccess.h | 92 + linden/indra/newview/llagentdata.cpp | 3 +- linden/indra/newview/llagentdata.h | 3 +- linden/indra/newview/llagentlanguage.cpp | 3 +- linden/indra/newview/llagentlanguage.h | 3 +- linden/indra/newview/llagentpilot.cpp | 3 +- linden/indra/newview/llagentpilot.h | 3 +- linden/indra/newview/llanimstatelabels.cpp | 3 +- linden/indra/newview/llanimstatelabels.h | 3 +- linden/indra/newview/llappearance.h | 11 +- linden/indra/newview/llappviewer.cpp | 663 +- linden/indra/newview/llappviewer.h | 28 +- linden/indra/newview/llappviewerlinux.cpp | 74 +- linden/indra/newview/llappviewerlinux.h | 3 +- linden/indra/newview/llappviewerlinux_api.h | 3 +- linden/indra/newview/llappviewerlinux_api_dbus.cpp | 3 +- linden/indra/newview/llappviewerlinux_api_dbus.h | 3 +- linden/indra/newview/llappviewermacosx.cpp | 21 +- linden/indra/newview/llappviewermacosx.h | 3 +- linden/indra/newview/llappviewerwin32.cpp | 3 +- linden/indra/newview/llappviewerwin32.h | 3 +- linden/indra/newview/llassetuploadqueue.cpp | 3 +- linden/indra/newview/llassetuploadqueue.h | 3 +- linden/indra/newview/llassetuploadresponders.cpp | 159 +- linden/indra/newview/llassetuploadresponders.h | 19 +- linden/indra/newview/llaudiosourcevo.cpp | 3 +- linden/indra/newview/llaudiosourcevo.h | 3 +- linden/indra/newview/llbbox.cpp | 3 +- linden/indra/newview/llbbox.h | 3 +- linden/indra/newview/llbox.cpp | 3 +- linden/indra/newview/llbox.h | 3 +- linden/indra/newview/llcallbacklist.cpp | 3 +- linden/indra/newview/llcallbacklist.h | 3 +- linden/indra/newview/llcallingcard.cpp | 23 +- linden/indra/newview/llcallingcard.h | 3 +- linden/indra/newview/llcaphttpsender.cpp | 3 +- linden/indra/newview/llcaphttpsender.h | 3 +- linden/indra/newview/llchatbar.cpp | 12 +- linden/indra/newview/llchatbar.h | 3 +- linden/indra/newview/llclassifiedinfo.cpp | 3 +- linden/indra/newview/llclassifiedinfo.h | 3 +- .../indra/newview/llclassifiedstatsresponder.cpp | 3 +- linden/indra/newview/llclassifiedstatsresponder.h | 3 +- linden/indra/newview/llcloud.cpp | 5 +- linden/indra/newview/llcloud.h | 3 +- linden/indra/newview/llcolorscheme.cpp | 17 +- linden/indra/newview/llcolorscheme.h | 8 +- linden/indra/newview/llcolorswatch.cpp | 29 +- linden/indra/newview/llcolorswatch.h | 5 +- linden/indra/newview/llcommandhandler.cpp | 41 +- linden/indra/newview/llcommandhandler.h | 39 +- linden/indra/newview/llcommandlineparser.cpp | 3 +- linden/indra/newview/llcommandlineparser.h | 3 +- linden/indra/newview/llcompass.cpp | 3 +- linden/indra/newview/llcompass.h | 3 +- linden/indra/newview/llcompilequeue.cpp | 15 +- linden/indra/newview/llcompilequeue.h | 3 +- linden/indra/newview/llconfirmationmanager.cpp | 31 +- linden/indra/newview/llconfirmationmanager.h | 3 +- linden/indra/newview/llconsole.cpp | 56 +- linden/indra/newview/llconsole.h | 12 +- linden/indra/newview/llcontainerview.cpp | 3 +- linden/indra/newview/llcontainerview.h | 3 +- linden/indra/newview/llcurrencyuimanager.cpp | 3 +- linden/indra/newview/llcurrencyuimanager.h | 3 +- linden/indra/newview/llcylinder.cpp | 3 +- linden/indra/newview/llcylinder.h | 3 +- linden/indra/newview/lldebugmessagebox.cpp | 3 +- linden/indra/newview/lldebugmessagebox.h | 3 +- linden/indra/newview/lldebugview.cpp | 17 +- linden/indra/newview/lldebugview.h | 4 +- linden/indra/newview/lldelayedgestureerror.cpp | 11 +- linden/indra/newview/lldelayedgestureerror.h | 3 +- linden/indra/newview/lldirpicker.cpp | 10 +- linden/indra/newview/lldirpicker.h | 5 +- linden/indra/newview/lldrawable.cpp | 11 +- linden/indra/newview/lldrawable.h | 4 +- linden/indra/newview/lldrawpool.cpp | 91 +- linden/indra/newview/lldrawpool.h | 26 +- linden/indra/newview/lldrawpoolalpha.cpp | 305 +- linden/indra/newview/lldrawpoolalpha.h | 15 +- linden/indra/newview/lldrawpoolavatar.cpp | 368 +- linden/indra/newview/lldrawpoolavatar.h | 38 +- linden/indra/newview/lldrawpoolbump.cpp | 248 +- linden/indra/newview/lldrawpoolbump.h | 29 +- linden/indra/newview/lldrawpoolclouds.cpp | 3 +- linden/indra/newview/lldrawpoolclouds.h | 5 +- linden/indra/newview/lldrawpoolground.cpp | 3 +- linden/indra/newview/lldrawpoolground.h | 5 +- linden/indra/newview/lldrawpoolsimple.cpp | 207 +- linden/indra/newview/lldrawpoolsimple.h | 70 +- linden/indra/newview/lldrawpoolsky.cpp | 5 +- linden/indra/newview/lldrawpoolsky.h | 10 +- linden/indra/newview/lldrawpoolterrain.cpp | 121 +- linden/indra/newview/lldrawpoolterrain.h | 18 +- linden/indra/newview/lldrawpooltree.cpp | 112 +- linden/indra/newview/lldrawpooltree.h | 16 +- linden/indra/newview/lldrawpoolwater.cpp | 71 +- linden/indra/newview/lldrawpoolwater.h | 10 +- linden/indra/newview/lldrawpoolwlsky.cpp | 3 +- linden/indra/newview/lldrawpoolwlsky.h | 10 +- linden/indra/newview/lldriverparam.cpp | 3 +- linden/indra/newview/lldriverparam.h | 3 +- linden/indra/newview/lldynamictexture.cpp | 5 +- linden/indra/newview/lldynamictexture.h | 4 +- linden/indra/newview/llemote.cpp | 3 +- linden/indra/newview/llemote.h | 3 +- linden/indra/newview/lleventinfo.cpp | 3 +- linden/indra/newview/lleventinfo.h | 3 +- linden/indra/newview/lleventnotifier.cpp | 56 +- linden/indra/newview/lleventnotifier.h | 5 +- linden/indra/newview/lleventpoll.cpp | 3 +- linden/indra/newview/lleventpoll.h | 3 +- linden/indra/newview/llface.cpp | 191 +- linden/indra/newview/llface.h | 12 +- linden/indra/newview/llface.inl | 3 +- linden/indra/newview/llfasttimerview.cpp | 61 +- linden/indra/newview/llfasttimerview.h | 3 +- linden/indra/newview/llfeaturemanager.cpp | 3 +- linden/indra/newview/llfeaturemanager.h | 3 +- linden/indra/newview/llfilepicker.cpp | 87 +- linden/indra/newview/llfilepicker.h | 8 +- linden/indra/newview/llfirstuse.cpp | 49 +- linden/indra/newview/llfirstuse.h | 3 +- linden/indra/newview/llflexibleobject.cpp | 3 +- linden/indra/newview/llflexibleobject.h | 3 +- linden/indra/newview/llfloaterabout.cpp | 15 +- linden/indra/newview/llfloaterabout.h | 3 +- linden/indra/newview/llfloateractivespeakers.cpp | 20 +- linden/indra/newview/llfloateractivespeakers.h | 3 +- linden/indra/newview/llfloateranimpreview.cpp | 40 +- linden/indra/newview/llfloateranimpreview.h | 3 +- linden/indra/newview/llfloaterauction.cpp | 23 +- linden/indra/newview/llfloaterauction.h | 3 +- linden/indra/newview/llfloateravatarinfo.cpp | 10 +- linden/indra/newview/llfloateravatarinfo.h | 3 +- linden/indra/newview/llfloateravatarpicker.cpp | 387 +- linden/indra/newview/llfloateravatarpicker.h | 47 +- linden/indra/newview/llfloateravatartextures.cpp | 59 +- linden/indra/newview/llfloateravatartextures.h | 25 +- linden/indra/newview/llfloaterbeacons.cpp | 3 +- linden/indra/newview/llfloaterbeacons.h | 3 +- linden/indra/newview/llfloaterbuildoptions.cpp | 3 +- linden/indra/newview/llfloaterbuildoptions.h | 3 +- linden/indra/newview/llfloaterbulkpermission.cpp | 368 + linden/indra/newview/llfloaterbulkpermission.h | 108 + linden/indra/newview/llfloaterbump.cpp | 3 +- linden/indra/newview/llfloaterbump.h | 3 +- linden/indra/newview/llfloaterbuy.cpp | 7 +- linden/indra/newview/llfloaterbuy.h | 3 +- linden/indra/newview/llfloaterbuycontents.cpp | 7 +- linden/indra/newview/llfloaterbuycontents.h | 3 +- linden/indra/newview/llfloaterbuycurrency.cpp | 3 +- linden/indra/newview/llfloaterbuycurrency.h | 3 +- linden/indra/newview/llfloaterbuyland.cpp | 43 +- linden/indra/newview/llfloaterbuyland.h | 3 +- linden/indra/newview/llfloatercamera.cpp | 3 +- linden/indra/newview/llfloatercamera.h | 3 +- linden/indra/newview/llfloaterchat.cpp | 36 +- linden/indra/newview/llfloaterchat.h | 3 +- linden/indra/newview/llfloaterchatterbox.cpp | 3 +- linden/indra/newview/llfloaterchatterbox.h | 3 +- linden/indra/newview/llfloaterclassified.cpp | 10 +- linden/indra/newview/llfloaterclassified.h | 3 +- linden/indra/newview/llfloaterclothing.cpp | 423 -- linden/indra/newview/llfloaterclothing.h | 74 - linden/indra/newview/llfloatercolorpicker.cpp | 5 +- linden/indra/newview/llfloatercolorpicker.h | 3 +- linden/indra/newview/llfloatercustomize.cpp | 562 +- linden/indra/newview/llfloatercustomize.h | 23 +- linden/indra/newview/llfloaterdaycycle.cpp | 15 +- linden/indra/newview/llfloaterdaycycle.h | 3 +- linden/indra/newview/llfloaterdirectory.cpp | 3 +- linden/indra/newview/llfloaterdirectory.h | 3 +- linden/indra/newview/llfloatereditui.cpp | 7 +- linden/indra/newview/llfloatereditui.h | 3 +- linden/indra/newview/llfloaterenvsettings.cpp | 17 +- linden/indra/newview/llfloaterenvsettings.h | 3 +- linden/indra/newview/llfloaterevent.cpp | 10 +- linden/indra/newview/llfloaterevent.h | 3 +- linden/indra/newview/llfloaterfonttest.cpp | 66 + linden/indra/newview/llfloaterfonttest.h | 52 + linden/indra/newview/llfloaterfriends.cpp | 159 +- linden/indra/newview/llfloaterfriends.h | 11 +- linden/indra/newview/llfloatergesture.cpp | 3 +- linden/indra/newview/llfloatergesture.h | 3 +- linden/indra/newview/llfloatergodtools.cpp | 101 +- linden/indra/newview/llfloatergodtools.h | 11 +- linden/indra/newview/llfloatergroupinfo.cpp | 15 +- linden/indra/newview/llfloatergroupinfo.h | 3 +- linden/indra/newview/llfloatergroupinvite.cpp | 3 +- linden/indra/newview/llfloatergroupinvite.h | 3 +- linden/indra/newview/llfloatergroups.cpp | 23 +- linden/indra/newview/llfloatergroups.h | 5 +- linden/indra/newview/llfloaterhandler.cpp | 78 + linden/indra/newview/llfloaterhandler.h | 45 + linden/indra/newview/llfloaterhardwaresettings.cpp | 5 +- linden/indra/newview/llfloaterhardwaresettings.h | 3 +- linden/indra/newview/llfloaterhtml.cpp | 7 +- linden/indra/newview/llfloaterhtml.h | 7 +- linden/indra/newview/llfloaterhtmlcurrency.cpp | 61 + linden/indra/newview/llfloaterhtmlcurrency.h | 53 + linden/indra/newview/llfloaterhtmlhelp.cpp | 34 +- linden/indra/newview/llfloaterhtmlhelp.h | 3 +- linden/indra/newview/llfloaterhtmlsimple.cpp | 67 + linden/indra/newview/llfloaterhtmlsimple.h | 58 + linden/indra/newview/llfloaterhud.cpp | 5 +- linden/indra/newview/llfloaterhud.h | 3 +- linden/indra/newview/llfloaterimagepreview.cpp | 36 +- linden/indra/newview/llfloaterimagepreview.h | 6 +- linden/indra/newview/llfloaterinspect.cpp | 3 +- linden/indra/newview/llfloaterinspect.h | 3 +- linden/indra/newview/llfloaterjoystick.cpp | 70 +- linden/indra/newview/llfloaterjoystick.h | 16 +- linden/indra/newview/llfloaterlagmeter.cpp | 27 +- linden/indra/newview/llfloaterlagmeter.h | 3 +- linden/indra/newview/llfloaterland.cpp | 459 +- linden/indra/newview/llfloaterland.h | 46 +- linden/indra/newview/llfloaterlandholdings.cpp | 44 +- linden/indra/newview/llfloaterlandholdings.h | 3 +- linden/indra/newview/llfloaterlandmark.cpp | 5 +- linden/indra/newview/llfloaterlandmark.h | 3 +- linden/indra/newview/llfloatermap.cpp | 145 +- linden/indra/newview/llfloatermap.h | 31 +- linden/indra/newview/llfloatermemleak.cpp | 3 +- linden/indra/newview/llfloatermemleak.h | 3 +- linden/indra/newview/llfloatermute.cpp | 5 +- linden/indra/newview/llfloatermute.h | 3 +- linden/indra/newview/llfloaternamedesc.cpp | 17 +- linden/indra/newview/llfloaternamedesc.h | 3 +- linden/indra/newview/llfloaternewim.cpp | 3 +- linden/indra/newview/llfloaternewim.h | 3 +- .../newview/llfloaternotificationsconsole.cpp | 293 + .../indra/newview/llfloaternotificationsconsole.h | 79 + linden/indra/newview/llfloaterobjectiminfo.cpp | 207 + linden/indra/newview/llfloaterobjectiminfo.h | 46 + linden/indra/newview/llfloateropenobject.cpp | 9 +- linden/indra/newview/llfloateropenobject.h | 3 +- linden/indra/newview/llfloaterparcel.cpp | 10 +- linden/indra/newview/llfloaterparcel.h | 3 +- linden/indra/newview/llfloaterpermissionsmgr.cpp | 3 +- linden/indra/newview/llfloaterpermissionsmgr.h | 3 +- linden/indra/newview/llfloaterperms.cpp | 159 + linden/indra/newview/llfloaterperms.h | 71 + linden/indra/newview/llfloaterpostcard.cpp | 51 +- linden/indra/newview/llfloaterpostcard.h | 5 +- linden/indra/newview/llfloaterpostprocess.cpp | 19 +- linden/indra/newview/llfloaterpostprocess.h | 5 +- linden/indra/newview/llfloaterpreference.cpp | 17 +- linden/indra/newview/llfloaterpreference.h | 3 +- linden/indra/newview/llfloaterproperties.cpp | 18 +- linden/indra/newview/llfloaterproperties.h | 3 +- linden/indra/newview/llfloaterregioninfo.cpp | 537 +- linden/indra/newview/llfloaterregioninfo.h | 31 +- linden/indra/newview/llfloaterreporter.cpp | 44 +- linden/indra/newview/llfloaterreporter.h | 3 +- linden/indra/newview/llfloaterscriptdebug.cpp | 7 +- linden/indra/newview/llfloaterscriptdebug.h | 3 +- linden/indra/newview/llfloatersellland.cpp | 107 +- linden/indra/newview/llfloatersellland.h | 3 +- linden/indra/newview/llfloatersettingsdebug.cpp | 8 +- linden/indra/newview/llfloatersettingsdebug.h | 3 +- linden/indra/newview/llfloatersnapshot.cpp | 63 +- linden/indra/newview/llfloatersnapshot.h | 3 +- linden/indra/newview/llfloaterstats.cpp | 554 +- linden/indra/newview/llfloaterstats.h | 14 +- linden/indra/newview/llfloatertelehub.cpp | 4 +- linden/indra/newview/llfloatertelehub.h | 3 +- linden/indra/newview/llfloatertest.cpp | 27 +- linden/indra/newview/llfloatertest.h | 3 +- linden/indra/newview/llfloatertools.cpp | 122 +- linden/indra/newview/llfloatertools.h | 9 +- linden/indra/newview/llfloatertopobjects.cpp | 23 +- linden/indra/newview/llfloatertopobjects.h | 7 +- linden/indra/newview/llfloatertos.cpp | 43 +- linden/indra/newview/llfloatertos.h | 3 +- linden/indra/newview/llfloaterurldisplay.cpp | 7 +- linden/indra/newview/llfloaterurldisplay.h | 3 +- linden/indra/newview/llfloaterurlentry.cpp | 37 +- linden/indra/newview/llfloaterurlentry.h | 5 +- .../indra/newview/llfloatervoicedevicesettings.cpp | 9 +- .../indra/newview/llfloatervoicedevicesettings.h | 3 +- linden/indra/newview/llfloaterwater.cpp | 49 +- linden/indra/newview/llfloaterwater.h | 9 +- linden/indra/newview/llfloaterwindlight.cpp | 55 +- linden/indra/newview/llfloaterwindlight.h | 9 +- linden/indra/newview/llfloaterworldmap.cpp | 28 +- linden/indra/newview/llfloaterworldmap.h | 3 +- linden/indra/newview/llfolderview.cpp | 3 +- linden/indra/newview/llfolderview.h | 3 +- linden/indra/newview/llfollowcam.cpp | 3 +- linden/indra/newview/llfollowcam.h | 3 +- linden/indra/newview/llframestats.cpp | 3 +- linden/indra/newview/llframestats.h | 3 +- linden/indra/newview/llframestatview.cpp | 23 +- linden/indra/newview/llframestatview.h | 3 +- linden/indra/newview/llgenepool.cpp | 393 -- linden/indra/newview/llgenepool.h | 60 - linden/indra/newview/llgesturemgr.cpp | 9 +- linden/indra/newview/llgesturemgr.h | 3 +- linden/indra/newview/llgivemoney.cpp | 3 +- linden/indra/newview/llgivemoney.h | 3 +- linden/indra/newview/llglsandbox.cpp | 5 +- linden/indra/newview/llgroupmgr.cpp | 9 +- linden/indra/newview/llgroupmgr.h | 3 +- linden/indra/newview/llgroupnotify.cpp | 160 +- linden/indra/newview/llgroupnotify.h | 39 +- linden/indra/newview/llhomelocationresponder.cpp | 3 +- linden/indra/newview/llhomelocationresponder.h | 3 +- linden/indra/newview/llhoverview.cpp | 3 +- linden/indra/newview/llhoverview.h | 3 +- linden/indra/newview/llhudeffect.cpp | 3 +- linden/indra/newview/llhudeffect.h | 3 +- linden/indra/newview/llhudeffectbeam.cpp | 3 +- linden/indra/newview/llhudeffectbeam.h | 3 +- linden/indra/newview/llhudeffectlookat.cpp | 3 +- linden/indra/newview/llhudeffectlookat.h | 3 +- linden/indra/newview/llhudeffectpointat.cpp | 3 +- linden/indra/newview/llhudeffectpointat.h | 3 +- linden/indra/newview/llhudeffecttrail.cpp | 3 +- linden/indra/newview/llhudeffecttrail.h | 3 +- linden/indra/newview/llhudicon.cpp | 5 +- linden/indra/newview/llhudicon.h | 3 +- linden/indra/newview/llhudmanager.cpp | 3 +- linden/indra/newview/llhudmanager.h | 3 +- linden/indra/newview/llhudobject.cpp | 5 +- linden/indra/newview/llhudobject.h | 3 +- linden/indra/newview/llhudrender.cpp | 3 +- linden/indra/newview/llhudrender.h | 3 +- linden/indra/newview/llhudtext.cpp | 40 +- linden/indra/newview/llhudtext.h | 3 +- linden/indra/newview/llhudview.cpp | 3 +- linden/indra/newview/llhudview.h | 3 +- linden/indra/newview/llimpanel.cpp | 218 +- linden/indra/newview/llimpanel.h | 13 +- linden/indra/newview/llimview.cpp | 481 +- linden/indra/newview/llimview.h | 10 +- linden/indra/newview/llinventoryactions.cpp | 21 +- linden/indra/newview/llinventorybridge.cpp | 193 +- linden/indra/newview/llinventorybridge.h | 6 +- linden/indra/newview/llinventoryclipboard.cpp | 3 +- linden/indra/newview/llinventoryclipboard.h | 3 +- linden/indra/newview/llinventorymodel.cpp | 10 +- linden/indra/newview/llinventorymodel.h | 4 +- linden/indra/newview/llinventoryview.cpp | 5 +- linden/indra/newview/llinventoryview.h | 3 +- linden/indra/newview/lljoystickbutton.cpp | 5 +- linden/indra/newview/lljoystickbutton.h | 5 +- linden/indra/newview/lllandmarklist.cpp | 7 +- linden/indra/newview/lllandmarklist.h | 3 +- linden/indra/newview/lllightconstants.h | 3 +- linden/indra/newview/lllogchat.cpp | 3 +- linden/indra/newview/lllogchat.h | 3 +- linden/indra/newview/llloginhandler.cpp | 219 + linden/indra/newview/llloginhandler.h | 64 + linden/indra/newview/llmanip.cpp | 3 +- linden/indra/newview/llmanip.h | 3 +- linden/indra/newview/llmaniprotate.cpp | 3 +- linden/indra/newview/llmaniprotate.h | 3 +- linden/indra/newview/llmanipscale.cpp | 5 +- linden/indra/newview/llmanipscale.h | 3 +- linden/indra/newview/llmaniptranslate.cpp | 14 +- linden/indra/newview/llmaniptranslate.h | 3 +- linden/indra/newview/llmapresponders.cpp | 7 +- linden/indra/newview/llmapresponders.h | 3 +- linden/indra/newview/llmediaremotectrl.cpp | 3 +- linden/indra/newview/llmediaremotectrl.h | 3 +- linden/indra/newview/llmemoryview.cpp | 13 +- linden/indra/newview/llmemoryview.h | 3 +- linden/indra/newview/llmenucommands.cpp | 12 +- linden/indra/newview/llmenucommands.h | 4 +- linden/indra/newview/llmimetypes.cpp | 3 +- linden/indra/newview/llmimetypes.h | 7 +- linden/indra/newview/llmorphview.cpp | 3 +- linden/indra/newview/llmorphview.h | 3 +- linden/indra/newview/llmoveview.cpp | 3 +- linden/indra/newview/llmoveview.h | 3 +- linden/indra/newview/llmutelist.cpp | 31 +- linden/indra/newview/llmutelist.h | 3 +- linden/indra/newview/llnamebox.cpp | 3 +- linden/indra/newview/llnamebox.h | 3 +- linden/indra/newview/llnameeditor.cpp | 3 +- linden/indra/newview/llnameeditor.h | 3 +- linden/indra/newview/llnamelistctrl.cpp | 8 +- linden/indra/newview/llnamelistctrl.h | 3 +- linden/indra/newview/llnetmap.cpp | 402 +- linden/indra/newview/llnetmap.h | 89 +- linden/indra/newview/llnotify.cpp | 550 +- linden/indra/newview/llnotify.h | 111 +- linden/indra/newview/lloverlaybar.cpp | 21 +- linden/indra/newview/lloverlaybar.h | 4 +- linden/indra/newview/llpanelLCD.cpp | 3 +- linden/indra/newview/llpanelLCD.h | 3 +- linden/indra/newview/llpanelaudioprefs.cpp | 12 +- linden/indra/newview/llpanelaudioprefs.h | 7 +- linden/indra/newview/llpanelaudiovolume.cpp | 3 +- linden/indra/newview/llpanelaudiovolume.h | 3 +- linden/indra/newview/llpanelavatar.cpp | 215 +- linden/indra/newview/llpanelavatar.h | 17 +- linden/indra/newview/llpanelclassified.cpp | 181 +- linden/indra/newview/llpanelclassified.h | 13 +- linden/indra/newview/llpanelcontents.cpp | 31 +- linden/indra/newview/llpanelcontents.h | 4 +- linden/indra/newview/llpaneldebug.cpp | 3 +- linden/indra/newview/llpaneldebug.h | 3 +- linden/indra/newview/llpaneldirbrowser.cpp | 143 +- linden/indra/newview/llpaneldirbrowser.h | 12 +- linden/indra/newview/llpaneldirclassified.cpp | 39 +- linden/indra/newview/llpaneldirclassified.h | 3 +- linden/indra/newview/llpaneldirevents.cpp | 32 +- linden/indra/newview/llpaneldirevents.h | 3 +- linden/indra/newview/llpaneldirfind.cpp | 112 +- linden/indra/newview/llpaneldirfind.h | 8 +- linden/indra/newview/llpaneldirgroups.cpp | 22 +- linden/indra/newview/llpaneldirgroups.h | 4 +- linden/indra/newview/llpaneldirland.cpp | 68 +- linden/indra/newview/llpaneldirland.h | 5 +- linden/indra/newview/llpaneldirpeople.cpp | 11 +- linden/indra/newview/llpaneldirpeople.h | 3 +- linden/indra/newview/llpaneldirplaces.cpp | 98 +- linden/indra/newview/llpaneldirplaces.h | 5 +- linden/indra/newview/llpaneldirpopular.cpp | 3 +- linden/indra/newview/llpaneldirpopular.h | 3 +- linden/indra/newview/llpaneldisplay.cpp | 14 +- linden/indra/newview/llpaneldisplay.h | 3 +- linden/indra/newview/llpanelevent.cpp | 13 +- linden/indra/newview/llpanelevent.h | 5 +- linden/indra/newview/llpanelface.cpp | 7 +- linden/indra/newview/llpanelface.h | 3 +- linden/indra/newview/llpanelgeneral.cpp | 57 +- linden/indra/newview/llpanelgeneral.h | 3 +- linden/indra/newview/llpanelgroup.cpp | 53 +- linden/indra/newview/llpanelgroup.h | 6 +- linden/indra/newview/llpanelgroupgeneral.cpp | 118 +- linden/indra/newview/llpanelgroupgeneral.h | 10 +- linden/indra/newview/llpanelgroupinvite.cpp | 32 +- linden/indra/newview/llpanelgroupinvite.h | 3 +- linden/indra/newview/llpanelgrouplandmoney.cpp | 54 +- linden/indra/newview/llpanelgrouplandmoney.h | 3 +- linden/indra/newview/llpanelgroupnotices.cpp | 15 +- linden/indra/newview/llpanelgroupnotices.h | 3 +- linden/indra/newview/llpanelgrouproles.cpp | 115 +- linden/indra/newview/llpanelgrouproles.h | 12 +- linden/indra/newview/llpanelgroupvoting.cpp | 21 +- linden/indra/newview/llpanelgroupvoting.h | 3 +- linden/indra/newview/llpanelinput.cpp | 36 +- linden/indra/newview/llpanelinput.h | 5 +- linden/indra/newview/llpanelinventory.cpp | 88 +- linden/indra/newview/llpanelinventory.h | 3 +- linden/indra/newview/llpanelland.cpp | 18 +- linden/indra/newview/llpanelland.h | 6 +- linden/indra/newview/llpanellandmedia.cpp | 109 +- linden/indra/newview/llpanellandmedia.h | 9 +- linden/indra/newview/llpanellandobjects.cpp | 3 +- linden/indra/newview/llpanellandobjects.h | 3 +- linden/indra/newview/llpanellandoptions.cpp | 3 +- linden/indra/newview/llpanellandoptions.h | 3 +- linden/indra/newview/llpanellogin.cpp | 235 +- linden/indra/newview/llpanellogin.h | 48 +- linden/indra/newview/llpanelmorph.cpp | 3 +- linden/indra/newview/llpanelmorph.h | 3 +- linden/indra/newview/llpanelmsgs.cpp | 132 +- linden/indra/newview/llpanelmsgs.h | 7 +- linden/indra/newview/llpanelnetwork.cpp | 11 +- linden/indra/newview/llpanelnetwork.h | 3 +- linden/indra/newview/llpanelobject.cpp | 31 +- linden/indra/newview/llpanelobject.h | 3 +- linden/indra/newview/llpanelpermissions.cpp | 59 +- linden/indra/newview/llpanelpermissions.h | 3 +- linden/indra/newview/llpanelpick.cpp | 5 +- linden/indra/newview/llpanelpick.h | 3 +- linden/indra/newview/llpanelplace.cpp | 68 +- linden/indra/newview/llpanelplace.h | 10 +- linden/indra/newview/llpanelskins.cpp | 5 +- linden/indra/newview/llpanelskins.h | 3 +- linden/indra/newview/llpanelvolume.cpp | 5 +- linden/indra/newview/llpanelvolume.h | 3 +- linden/indra/newview/llpanelweb.cpp | 42 +- linden/indra/newview/llpanelweb.h | 10 +- linden/indra/newview/llparcelselection.cpp | 3 +- linden/indra/newview/llparcelselection.h | 3 +- linden/indra/newview/llpatchvertexarray.cpp | 3 +- linden/indra/newview/llpatchvertexarray.h | 3 +- linden/indra/newview/llpolymesh.cpp | 3 +- linden/indra/newview/llpolymesh.h | 3 +- linden/indra/newview/llpolymorph.cpp | 3 +- linden/indra/newview/llpolymorph.h | 3 +- linden/indra/newview/llprefschat.cpp | 13 +- linden/indra/newview/llprefschat.h | 3 +- linden/indra/newview/llprefsim.cpp | 3 +- linden/indra/newview/llprefsim.h | 3 +- linden/indra/newview/llprefsvoice.cpp | 6 +- linden/indra/newview/llprefsvoice.h | 3 +- linden/indra/newview/llpreview.cpp | 3 +- linden/indra/newview/llpreview.h | 3 +- linden/indra/newview/llpreviewanim.cpp | 3 +- linden/indra/newview/llpreviewanim.h | 3 +- linden/indra/newview/llpreviewgesture.cpp | 96 +- linden/indra/newview/llpreviewgesture.h | 8 +- linden/indra/newview/llpreviewlandmark.cpp | 3 +- linden/indra/newview/llpreviewlandmark.h | 3 +- linden/indra/newview/llpreviewnotecard.cpp | 35 +- linden/indra/newview/llpreviewnotecard.h | 5 +- linden/indra/newview/llpreviewscript.cpp | 120 +- linden/indra/newview/llpreviewscript.h | 12 +- linden/indra/newview/llpreviewsound.cpp | 3 +- linden/indra/newview/llpreviewsound.h | 3 +- linden/indra/newview/llpreviewtexture.cpp | 21 +- linden/indra/newview/llpreviewtexture.h | 3 +- linden/indra/newview/llproductinforequest.cpp | 92 + linden/indra/newview/llproductinforequest.h | 60 + linden/indra/newview/llprogressview.cpp | 275 +- linden/indra/newview/llprogressview.h | 12 +- linden/indra/newview/llregionposition.cpp | 3 +- linden/indra/newview/llregionposition.h | 3 +- linden/indra/newview/llremoteparcelrequest.cpp | 3 +- linden/indra/newview/llremoteparcelrequest.h | 3 +- linden/indra/newview/llresourcedata.h | 4 +- linden/indra/newview/llsavedsettingsglue.cpp | 3 +- linden/indra/newview/llsavedsettingsglue.h | 3 +- linden/indra/newview/llselectmgr.cpp | 48 +- linden/indra/newview/llselectmgr.h | 5 +- linden/indra/newview/llsky.cpp | 32 +- linden/indra/newview/llsky.h | 3 +- linden/indra/newview/llspatialpartition.cpp | 400 +- linden/indra/newview/llspatialpartition.h | 49 +- linden/indra/newview/llsprite.cpp | 5 +- linden/indra/newview/llsprite.h | 3 +- linden/indra/newview/llsrv.cpp | 3 +- linden/indra/newview/llsrv.h | 3 +- linden/indra/newview/llstartup.cpp | 1007 +-- linden/indra/newview/llstartup.h | 15 +- linden/indra/newview/llstatbar.cpp | 54 +- linden/indra/newview/llstatbar.h | 14 +- linden/indra/newview/llstatgraph.cpp | 3 +- linden/indra/newview/llstatgraph.h | 3 +- linden/indra/newview/llstatusbar.cpp | 85 +- linden/indra/newview/llstatusbar.h | 6 +- linden/indra/newview/llstatview.cpp | 17 +- linden/indra/newview/llstatview.h | 9 +- linden/indra/newview/llstylemap.cpp | 40 +- linden/indra/newview/llstylemap.h | 6 +- linden/indra/newview/llsurface.cpp | 9 +- linden/indra/newview/llsurface.h | 3 +- linden/indra/newview/llsurfacepatch.cpp | 5 +- linden/indra/newview/llsurfacepatch.h | 3 +- linden/indra/newview/lltable.h | 3 +- linden/indra/newview/lltexlayer.cpp | 181 +- linden/indra/newview/lltexlayer.h | 7 +- linden/indra/newview/lltexturecache.cpp | 138 +- linden/indra/newview/lltexturecache.h | 9 +- linden/indra/newview/lltexturectrl.cpp | 41 +- linden/indra/newview/lltexturectrl.h | 9 +- linden/indra/newview/lltexturefetch.cpp | 6 +- linden/indra/newview/lltexturefetch.h | 3 +- linden/indra/newview/lltextureview.cpp | 35 +- linden/indra/newview/lltextureview.h | 3 +- linden/indra/newview/lltool.cpp | 3 +- linden/indra/newview/lltool.h | 3 +- linden/indra/newview/lltoolbar.cpp | 22 +- linden/indra/newview/lltoolbar.h | 4 +- linden/indra/newview/lltoolbrush.cpp | 54 +- linden/indra/newview/lltoolbrush.h | 8 +- linden/indra/newview/lltoolcomp.cpp | 3 +- linden/indra/newview/lltoolcomp.h | 3 +- linden/indra/newview/lltooldraganddrop.cpp | 199 +- linden/indra/newview/lltooldraganddrop.h | 26 +- linden/indra/newview/lltoolface.cpp | 3 +- linden/indra/newview/lltoolface.h | 3 +- linden/indra/newview/lltoolfocus.cpp | 5 +- linden/indra/newview/lltoolfocus.h | 3 +- linden/indra/newview/lltoolgrab.cpp | 3 +- linden/indra/newview/lltoolgrab.h | 3 +- linden/indra/newview/lltoolgun.cpp | 3 +- linden/indra/newview/lltoolgun.h | 3 +- linden/indra/newview/lltoolindividual.cpp | 3 +- linden/indra/newview/lltoolindividual.h | 3 +- linden/indra/newview/lltoolmgr.cpp | 3 +- linden/indra/newview/lltoolmgr.h | 3 +- linden/indra/newview/lltoolmorph.cpp | 7 +- linden/indra/newview/lltoolmorph.h | 3 +- linden/indra/newview/lltoolobjpicker.cpp | 3 +- linden/indra/newview/lltoolobjpicker.h | 3 +- linden/indra/newview/lltoolpie.cpp | 24 +- linden/indra/newview/lltoolpie.h | 3 +- linden/indra/newview/lltoolpipette.cpp | 3 +- linden/indra/newview/lltoolpipette.h | 3 +- linden/indra/newview/lltoolplacer.cpp | 5 +- linden/indra/newview/lltoolplacer.h | 3 +- linden/indra/newview/lltoolselect.cpp | 3 +- linden/indra/newview/lltoolselect.h | 3 +- linden/indra/newview/lltoolselectland.cpp | 3 +- linden/indra/newview/lltoolselectland.h | 3 +- linden/indra/newview/lltoolselectrect.cpp | 3 +- linden/indra/newview/lltoolselectrect.h | 3 +- linden/indra/newview/lltoolview.cpp | 5 +- linden/indra/newview/lltoolview.h | 3 +- linden/indra/newview/lltracker.cpp | 5 +- linden/indra/newview/lltracker.h | 3 +- linden/indra/newview/lltrans.cpp | 18 +- linden/indra/newview/lltrans.h | 3 +- linden/indra/newview/lluiconstants.h | 3 +- linden/indra/newview/lluploaddialog.cpp | 3 +- linden/indra/newview/lluploaddialog.h | 3 +- linden/indra/newview/llurl.cpp | 3 +- linden/indra/newview/llurl.h | 3 +- linden/indra/newview/llurldispatcher.cpp | 86 +- linden/indra/newview/llurldispatcher.h | 17 +- linden/indra/newview/llurlhistory.cpp | 3 +- linden/indra/newview/llurlhistory.h | 3 +- linden/indra/newview/llurlsimstring.cpp | 3 +- linden/indra/newview/llurlsimstring.h | 3 +- linden/indra/newview/llurlwhitelist.cpp | 3 +- linden/indra/newview/llurlwhitelist.h | 3 +- linden/indra/newview/lluserauth.cpp | 3 +- linden/indra/newview/lluserauth.h | 3 +- linden/indra/newview/llvectorperfoptions.cpp | 3 +- linden/indra/newview/llvectorperfoptions.h | 3 +- linden/indra/newview/llvelocitybar.cpp | 19 +- linden/indra/newview/llvelocitybar.h | 3 +- linden/indra/newview/llviewchildren.cpp | 3 +- linden/indra/newview/llviewchildren.h | 3 +- linden/indra/newview/llviewerassetstorage.cpp | 3 +- linden/indra/newview/llviewerassetstorage.h | 3 +- linden/indra/newview/llvieweraudio.cpp | 13 +- linden/indra/newview/llvieweraudio.h | 3 +- linden/indra/newview/llviewerbuild.h | 3 +- linden/indra/newview/llviewercamera.cpp | 87 +- linden/indra/newview/llviewercamera.h | 13 +- linden/indra/newview/llviewercontrol.cpp | 54 +- linden/indra/newview/llviewercontrol.h | 3 +- linden/indra/newview/llviewerdisplay.cpp | 122 +- linden/indra/newview/llviewerdisplay.h | 3 +- linden/indra/newview/llviewergenericmessage.cpp | 3 +- linden/indra/newview/llviewergenericmessage.h | 3 +- linden/indra/newview/llviewergesture.cpp | 3 +- linden/indra/newview/llviewergesture.h | 3 +- linden/indra/newview/llviewerimage.cpp | 45 +- linden/indra/newview/llviewerimage.h | 8 +- linden/indra/newview/llviewerimagelist.cpp | 112 +- linden/indra/newview/llviewerimagelist.h | 4 +- linden/indra/newview/llviewerinventory.cpp | 7 +- linden/indra/newview/llviewerinventory.h | 3 +- linden/indra/newview/llviewerjoint.cpp | 39 +- linden/indra/newview/llviewerjoint.h | 14 +- linden/indra/newview/llviewerjointattachment.cpp | 5 +- linden/indra/newview/llviewerjointattachment.h | 5 +- linden/indra/newview/llviewerjointmesh.cpp | 41 +- linden/indra/newview/llviewerjointmesh.h | 5 +- linden/indra/newview/llviewerjointmesh_sse.cpp | 3 +- linden/indra/newview/llviewerjointmesh_sse2.cpp | 3 +- linden/indra/newview/llviewerjointmesh_vec.cpp | 3 +- linden/indra/newview/llviewerjoystick.cpp | 285 +- linden/indra/newview/llviewerjoystick.h | 5 +- linden/indra/newview/llviewerkeyboard.cpp | 3 +- linden/indra/newview/llviewerkeyboard.h | 3 +- linden/indra/newview/llviewerlayer.cpp | 3 +- linden/indra/newview/llviewerlayer.h | 3 +- linden/indra/newview/llviewermedia.cpp | 11 +- linden/indra/newview/llviewermedia.h | 3 +- linden/indra/newview/llviewermenu.cpp | 666 +- linden/indra/newview/llviewermenu.h | 4 +- linden/indra/newview/llviewermenufile.cpp | 188 +- linden/indra/newview/llviewermenufile.h | 49 +- linden/indra/newview/llviewermessage.cpp | 1400 ++-- linden/indra/newview/llviewermessage.h | 14 +- linden/indra/newview/llviewernetwork.cpp | 3 +- linden/indra/newview/llviewernetwork.h | 3 +- linden/indra/newview/llviewerobject.cpp | 35 +- linden/indra/newview/llviewerobject.h | 5 +- linden/indra/newview/llviewerobjectlist.cpp | 5 +- linden/indra/newview/llviewerobjectlist.h | 3 +- linden/indra/newview/llviewerparcelmedia.cpp | 17 +- linden/indra/newview/llviewerparcelmedia.h | 3 +- .../indra/newview/llviewerparcelmediaautoplay.cpp | 3 +- linden/indra/newview/llviewerparcelmediaautoplay.h | 3 +- linden/indra/newview/llviewerparcelmgr.cpp | 207 +- linden/indra/newview/llviewerparcelmgr.h | 15 +- linden/indra/newview/llviewerparceloverlay.cpp | 7 +- linden/indra/newview/llviewerparceloverlay.h | 3 +- linden/indra/newview/llviewerpartsim.cpp | 7 +- linden/indra/newview/llviewerpartsim.h | 3 +- linden/indra/newview/llviewerpartsource.cpp | 5 +- linden/indra/newview/llviewerpartsource.h | 3 +- .../indra/newview/llviewerprecompiledheaders.cpp | 3 +- linden/indra/newview/llviewerprecompiledheaders.h | 3 +- linden/indra/newview/llviewerregion.cpp | 87 +- linden/indra/newview/llviewerregion.h | 27 +- linden/indra/newview/llviewershadermgr.cpp | 284 +- linden/indra/newview/llviewershadermgr.h | 32 +- linden/indra/newview/llviewerstats.cpp | 13 +- linden/indra/newview/llviewerstats.h | 3 +- linden/indra/newview/llviewertexteditor.cpp | 64 +- linden/indra/newview/llviewertexteditor.h | 11 +- linden/indra/newview/llviewertextureanim.cpp | 3 +- linden/indra/newview/llviewertextureanim.h | 3 +- linden/indra/newview/llviewerthrottle.cpp | 3 +- linden/indra/newview/llviewerthrottle.h | 3 +- linden/indra/newview/llviewervisualparam.cpp | 3 +- linden/indra/newview/llviewervisualparam.h | 3 +- linden/indra/newview/llviewerwindow.cpp | 275 +- linden/indra/newview/llviewerwindow.h | 18 +- linden/indra/newview/llvlcomposition.cpp | 4 +- linden/indra/newview/llvlcomposition.h | 3 +- linden/indra/newview/llvlmanager.cpp | 3 +- linden/indra/newview/llvlmanager.h | 3 +- linden/indra/newview/llvoavatar.cpp | 4157 +++++------- linden/indra/newview/llvoavatar.h | 981 +-- linden/indra/newview/llvoavatardefines.cpp | 228 + linden/indra/newview/llvoavatardefines.h | 210 + linden/indra/newview/llvocache.cpp | 3 +- linden/indra/newview/llvocache.h | 3 +- linden/indra/newview/llvoclouds.cpp | 3 +- linden/indra/newview/llvoclouds.h | 3 +- linden/indra/newview/llvograss.cpp | 15 +- linden/indra/newview/llvograss.h | 3 +- linden/indra/newview/llvoground.cpp | 3 +- linden/indra/newview/llvoground.h | 3 +- linden/indra/newview/llvoiceclient.cpp | 301 +- linden/indra/newview/llvoiceclient.h | 23 +- linden/indra/newview/llvoiceremotectrl.cpp | 3 +- linden/indra/newview/llvoiceremotectrl.h | 3 +- linden/indra/newview/llvoicevisualizer.cpp | 5 +- linden/indra/newview/llvoicevisualizer.h | 3 +- linden/indra/newview/llvoinventorylistener.cpp | 3 +- linden/indra/newview/llvoinventorylistener.h | 3 +- linden/indra/newview/llvopartgroup.cpp | 27 +- linden/indra/newview/llvopartgroup.h | 5 +- linden/indra/newview/llvosky.cpp | 27 +- linden/indra/newview/llvosky.h | 3 +- linden/indra/newview/llvosurfacepatch.cpp | 35 +- linden/indra/newview/llvosurfacepatch.h | 7 +- linden/indra/newview/llvotextbubble.cpp | 3 +- linden/indra/newview/llvotextbubble.h | 3 +- linden/indra/newview/llvotree.cpp | 930 ++- linden/indra/newview/llvotree.h | 40 +- linden/indra/newview/llvotreenew.h | 3 +- linden/indra/newview/llvovolume.cpp | 737 ++- linden/indra/newview/llvovolume.h | 7 +- linden/indra/newview/llvowater.cpp | 3 +- linden/indra/newview/llvowater.h | 5 +- linden/indra/newview/llvowlsky.cpp | 7 +- linden/indra/newview/llvowlsky.h | 3 +- linden/indra/newview/llwatchdog.cpp | 3 +- linden/indra/newview/llwatchdog.h | 3 +- linden/indra/newview/llwaterparammanager.cpp | 3 +- linden/indra/newview/llwaterparammanager.h | 3 +- linden/indra/newview/llwaterparamset.cpp | 3 +- linden/indra/newview/llwaterparamset.h | 3 +- linden/indra/newview/llwearable.cpp | 54 +- linden/indra/newview/llwearable.h | 15 +- linden/indra/newview/llwearablelist.cpp | 44 +- linden/indra/newview/llwearablelist.h | 3 +- linden/indra/newview/llweb.cpp | 3 +- linden/indra/newview/llweb.h | 3 +- linden/indra/newview/llwebbrowserctrl.cpp | 64 +- linden/indra/newview/llwebbrowserctrl.h | 9 +- linden/indra/newview/llwind.cpp | 3 +- linden/indra/newview/llwind.h | 3 +- linden/indra/newview/llwindebug.cpp | 3 +- linden/indra/newview/llwindebug.h | 3 +- linden/indra/newview/llwlanimator.cpp | 3 +- linden/indra/newview/llwlanimator.h | 3 +- linden/indra/newview/llwldaycycle.cpp | 9 +- linden/indra/newview/llwldaycycle.h | 3 +- linden/indra/newview/llwlparammanager.cpp | 3 +- linden/indra/newview/llwlparammanager.h | 3 +- linden/indra/newview/llwlparamset.cpp | 5 +- linden/indra/newview/llwlparamset.h | 3 +- linden/indra/newview/llworld.cpp | 75 +- linden/indra/newview/llworld.h | 22 +- linden/indra/newview/llworldmap.cpp | 52 +- linden/indra/newview/llworldmap.h | 5 +- linden/indra/newview/llworldmapview.cpp | 285 +- linden/indra/newview/llworldmapview.h | 10 +- linden/indra/newview/llxmlrpctransaction.cpp | 25 +- linden/indra/newview/llxmlrpctransaction.h | 3 +- linden/indra/newview/macmain.h | 3 +- linden/indra/newview/macutil_Prefix.h | 3 +- linden/indra/newview/macview_Prefix.h | 3 +- linden/indra/newview/noise.cpp | 3 +- linden/indra/newview/noise.h | 3 +- linden/indra/newview/pipeline.cpp | 2440 +++++-- linden/indra/newview/pipeline.h | 108 +- linden/indra/newview/randgauss.h | 3 +- linden/indra/newview/res/resource.h | 11 +- linden/indra/newview/res/viewerRes.rc | 103 +- linden/indra/newview/skins/default/colors_base.xml | 16 +- .../newview/skins/default/textures/textures.xml | 4 + .../indra/newview/skins/default/xui/de/alerts.xml | 4617 +------------ .../skins/default/xui/de/floater_about_land.xml | 8 +- .../skins/default/xui/de/floater_clothing.xml | 9 - .../skins/default/xui/de/floater_directory.xml | 94 +- .../skins/default/xui/de/floater_group_info.xml | 3 +- .../default/xui/de/floater_preview_gesture.xml | 2 - .../skins/default/xui/de/floater_report_abuse.xml | 18 +- .../skins/default/xui/de/floater_sell_land.xml | 1 + .../skins/default/xui/de/floater_world_map.xml | 6 +- .../newview/skins/default/xui/de/notifications.xml | 5770 ++++++++++++++++ .../indra/newview/skins/default/xui/de/notify.xml | 1058 +-- .../default/xui/de/panel_avatar_classified.xml | 13 +- .../skins/default/xui/de/panel_classified.xml | 12 +- .../newview/skins/default/xui/de/panel_event.xml | 14 +- .../skins/default/xui/de/panel_group_general.xml | 12 +- .../default/xui/de/panel_group_land_money.xml | 2 +- .../skins/default/xui/de/panel_group_notices.xml | 2 +- .../newview/skins/default/xui/de/panel_login.xml | 2 +- .../skins/default/xui/de/panel_region_general.xml | 10 +- .../newview/skins/default/xui/en-us/alerts.xml | 4970 +------------- .../skins/default/xui/en-us/floater_about.xml | 3 +- .../skins/default/xui/en-us/floater_about_land.xml | 382 +- .../default/xui/en-us/floater_avatar_picker.xml | 128 +- .../default/xui/en-us/floater_avatar_textures.xml | 47 +- .../skins/default/xui/en-us/floater_bulk_perms.xml | 132 + .../skins/default/xui/en-us/floater_buy_land.xml | 102 +- .../default/xui/en-us/floater_chat_history.xml | 43 +- .../skins/default/xui/en-us/floater_clothing.xml | 16 - .../skins/default/xui/en-us/floater_customize.xml | 694 +- .../skins/default/xui/en-us/floater_directory.xml | 453 +- .../skins/default/xui/en-us/floater_font_test.xml | 118 + .../default/xui/en-us/floater_html_simple.xml | 7 + .../skins/default/xui/en-us/floater_import.xml | 24 - .../default/xui/en-us/floater_instant_message.xml | 3 + .../xui/en-us/floater_inventory_view_finder.xml | 60 +- .../skins/default/xui/en-us/floater_joystick.xml | 19 +- .../default/xui/en-us/floater_land_holdings.xml | 17 +- .../default/xui/en-us/floater_media_browser.xml | 10 +- .../skins/default/xui/en-us/floater_mini_map.xml | 8 + .../default/xui/en-us/floater_name_description.xml | 2 +- .../default/xui/en-us/floater_notification.xml | 14 + .../xui/en-us/floater_notifications_console.xml | 9 + .../default/xui/en-us/floater_object_im_info.xml | 54 + .../skins/default/xui/en-us/floater_perm_prefs.xml | 42 + .../default/xui/en-us/floater_report_abuse.xml | 11 +- .../skins/default/xui/en-us/floater_snapshot.xml | 4 +- .../default/xui/en-us/floater_sound_preview.xml | 2 +- .../skins/default/xui/en-us/floater_statistics.xml | 14 + .../skins/default/xui/en-us/floater_tools.xml | 249 +- .../skins/default/xui/en-us/floater_tos.xml | 3 +- .../skins/default/xui/en-us/floater_world_map.xml | 164 +- .../newview/skins/default/xui/en-us/fonts.xml | 108 + .../skins/default/xui/en-us/menu_inventory.xml | 4 + .../skins/default/xui/en-us/menu_mini_map.xml | 27 + .../default/xui/en-us/menu_pie_attachment.xml | 49 +- .../skins/default/xui/en-us/menu_pie_avatar.xml | 4 +- .../skins/default/xui/en-us/menu_pie_object.xml | 2 +- .../skins/default/xui/en-us/menu_pie_self.xml | 24 +- .../skins/default/xui/en-us/menu_viewer.xml | 65 +- .../skins/default/xui/en-us/notifications.xml | 6295 ++++++++++++++++++ .../newview/skins/default/xui/en-us/notify.xml | 1066 +-- .../default/xui/en-us/panel_avatar_classified.xml | 4 +- .../skins/default/xui/en-us/panel_classified.xml | 4 +- .../default/xui/en-us/panel_group_general.xml | 6 +- .../skins/default/xui/en-us/panel_group_invite.xml | 4 +- .../default/xui/en-us/panel_group_land_money.xml | 11 +- .../skins/default/xui/en-us/panel_group_roles.xml | 2 +- .../default/xui/en-us/panel_land_covenant.xml | 60 - .../skins/default/xui/en-us/panel_login.xml | 5 +- .../skins/default/xui/en-us/panel_mini_map.xml | 53 + .../xui/en-us/panel_notifications_channel.xml | 16 + .../skins/default/xui/en-us/panel_overlaybar.xml | 4 + .../skins/default/xui/en-us/panel_place.xml | 4 +- .../skins/default/xui/en-us/panel_place_small.xml | 13 +- .../default/xui/en-us/panel_preferences_audio.xml | 5 - .../default/xui/en-us/panel_preferences_chat.xml | 73 +- .../xui/en-us/panel_preferences_general.xml | 62 +- .../default/xui/en-us/panel_preferences_input.xml | 71 +- .../default/xui/en-us/panel_preferences_popups.xml | 2 +- .../default/xui/en-us/panel_preferences_voice.xml | 7 +- .../skins/default/xui/en-us/panel_progress.xml | 22 + .../default/xui/en-us/panel_region_covenant.xml | 153 +- .../default/xui/en-us/panel_region_general.xml | 23 +- .../newview/skins/default/xui/en-us/strings.xml | 386 +- .../newview/skins/default/xui/en-us/ui_strings.xml | 17 + .../indra/newview/skins/default/xui/es/alerts.xml | 4102 +----------- .../newview/skins/default/xui/es/floater_about.xml | 36 +- .../skins/default/xui/es/floater_about_land.xml | 565 +- .../default/xui/es/floater_active_speakers.xml | 11 + .../default/xui/es/floater_animation_preview.xml | 143 +- .../skins/default/xui/es/floater_auction.xml | 21 +- .../skins/default/xui/es/floater_audio_volume.xml | 4 + .../skins/default/xui/es/floater_avatar_picker.xml | 24 +- .../default/xui/es/floater_avatar_textures.xml | 54 +- .../skins/default/xui/es/floater_beacons.xml | 15 + .../skins/default/xui/es/floater_build_options.xml | 13 +- .../newview/skins/default/xui/es/floater_bumps.xml | 16 +- .../skins/default/xui/es/floater_buy_contents.xml | 21 +- .../skins/default/xui/es/floater_buy_currency.xml | 54 +- .../skins/default/xui/es/floater_buy_land.xml | 292 +- .../skins/default/xui/es/floater_buy_object.xml | 27 +- .../skins/default/xui/es/floater_camera.xml | 12 + .../skins/default/xui/es/floater_chat_history.xml | 95 +- .../skins/default/xui/es/floater_chatterbox.xml | 2 + .../skins/default/xui/es/floater_choose_group.xml | 6 +- .../skins/default/xui/es/floater_clothing.xml | 9 - .../skins/default/xui/es/floater_color_picker.xml | 17 +- .../skins/default/xui/es/floater_critical.xml | 8 +- .../skins/default/xui/es/floater_customize.xml | 619 +- .../default/xui/es/floater_day_cycle_options.xml | 94 + .../default/xui/es/floater_device_settings.xml | 2 + .../skins/default/xui/es/floater_directory.xml | 372 +- .../skins/default/xui/es/floater_env_settings.xml | 23 + .../skins/default/xui/es/floater_gesture.xml | 23 +- .../skins/default/xui/es/floater_group_info.xml | 196 +- .../default/xui/es/floater_hardware_settings.xml | 38 + .../newview/skins/default/xui/es/floater_html.xml | 17 +- .../newview/skins/default/xui/es/floater_hud.xml | 2 + .../newview/skins/default/xui/es/floater_im.xml | 50 +- .../skins/default/xui/es/floater_image_preview.xml | 32 +- .../skins/default/xui/es/floater_import.xml | 10 +- .../skins/default/xui/es/floater_inspect.xml | 11 + .../default/xui/es/floater_instant_message.xml | 61 +- .../xui/es/floater_instant_message_ad_hoc.xml | 42 + .../xui/es/floater_instant_message_group.xml | 48 + .../skins/default/xui/es/floater_inventory.xml | 65 +- .../xui/es/floater_inventory_item_properties.xml | 46 +- .../xui/es/floater_inventory_view_finder.xml | 42 +- .../skins/default/xui/es/floater_joystick.xml | 83 + .../skins/default/xui/es/floater_lagmeter.xml | 152 + .../skins/default/xui/es/floater_land_holdings.xml | 35 +- .../skins/default/xui/es/floater_landmark_ctrl.xml | 10 + .../default/xui/es/floater_live_lsleditor.xml | 15 +- .../skins/default/xui/es/floater_lsl_guide.xml | 7 + .../skins/default/xui/es/floater_media_browser.xml | 19 + .../skins/default/xui/es/floater_mem_leaking.xml | 18 + .../skins/default/xui/es/floater_moveview.xml | 22 +- .../newview/skins/default/xui/es/floater_mute.xml | 17 +- .../skins/default/xui/es/floater_mute_object.xml | 12 + .../skins/default/xui/es/floater_my_friends.xml | 7 + .../default/xui/es/floater_name_description.xml | 6 +- .../skins/default/xui/es/floater_new_im.xml | 10 +- .../default/xui/es/floater_new_outfit_dialog.xml | 144 +- .../skins/default/xui/es/floater_openobject.xml | 10 +- .../newview/skins/default/xui/es/floater_pay.xml | 26 +- .../skins/default/xui/es/floater_pay_object.xml | 36 +- .../skins/default/xui/es/floater_post_process.xml | 53 + .../skins/default/xui/es/floater_postcard.xml | 32 +- .../skins/default/xui/es/floater_preferences.xml | 11 +- .../default/xui/es/floater_preview_animation.xml | 10 +- .../default/xui/es/floater_preview_classified.xml | 2 + .../xui/es/floater_preview_embedded_texture.xml | 8 +- .../skins/default/xui/es/floater_preview_event.xml | 2 + .../default/xui/es/floater_preview_gesture.xml | 64 +- .../default/xui/es/floater_preview_notecard.xml | 14 +- .../es/floater_preview_notecard_keep_discard.xml | 16 +- .../skins/default/xui/es/floater_preview_sound.xml | 12 +- .../default/xui/es/floater_preview_texture.xml | 8 +- .../es/floater_preview_texture_keep_discard.xml | 10 +- .../skins/default/xui/es/floater_preview_url.xml | 2 + .../default/xui/es/floater_price_for_listing.xml | 22 +- .../skins/default/xui/es/floater_profile.xml | 4 +- .../skins/default/xui/es/floater_region_info.xml | 2 + .../skins/default/xui/es/floater_report_abuse.xml | 190 +- .../skins/default/xui/es/floater_script_debug.xml | 6 +- .../default/xui/es/floater_script_ed_panel.xml | 48 +- .../default/xui/es/floater_script_preview.xml | 6 +- .../skins/default/xui/es/floater_script_queue.xml | 6 +- .../skins/default/xui/es/floater_script_search.xml | 18 +- .../skins/default/xui/es/floater_select_key.xml | 7 + .../skins/default/xui/es/floater_sell_land.xml | 38 +- .../default/xui/es/floater_settings_debug.xml | 19 +- .../default/xui/es/floater_sim_release_message.xml | 16 + .../xui/es/floater_skin_preview_template.xml | 33 + .../skins/default/xui/es/floater_snapshot.xml | 85 +- .../skins/default/xui/es/floater_sound_preview.xml | 23 +- .../skins/default/xui/es/floater_telehub.xml | 30 +- .../newview/skins/default/xui/es/floater_test.xml | 2 + .../skins/default/xui/es/floater_texture_ctrl.xml | 33 +- .../newview/skins/default/xui/es/floater_tools.xml | 546 +- .../skins/default/xui/es/floater_top_objects.xml | 71 +- .../newview/skins/default/xui/es/floater_tos.xml | 24 +- .../skins/default/xui/es/floater_url_entry.xml | 12 + .../newview/skins/default/xui/es/floater_water.xml | 88 + .../default/xui/es/floater_wearable_save_as.xml | 10 +- .../default/xui/es/floater_windlight_options.xml | 189 + .../skins/default/xui/es/floater_world_map.xml | 85 +- .../skins/default/xui/es/menu_inventory.xml | 119 +- .../newview/skins/default/xui/es/menu_login.xml | 13 + .../skins/default/xui/es/menu_pie_attachment.xml | 8 +- .../skins/default/xui/es/menu_pie_avatar.xml | 24 +- .../newview/skins/default/xui/es/menu_pie_land.xml | 16 +- .../skins/default/xui/es/menu_pie_object.xml | 35 +- .../newview/skins/default/xui/es/menu_pie_self.xml | 46 +- .../newview/skins/default/xui/es/menu_slurl.xml | 6 + .../newview/skins/default/xui/es/menu_viewer.xml | 380 +- .../newview/skins/default/xui/es/mime_types.xml | 230 + .../newview/skins/default/xui/es/notifications.xml | 5759 ++++++++++++++++ .../indra/newview/skins/default/xui/es/notify.xml | 825 +-- .../newview/skins/default/xui/es/panel_audio.xml | 10 + .../skins/default/xui/es/panel_audio_device.xml | 25 + .../newview/skins/default/xui/es/panel_avatar.xml | 255 +- .../default/xui/es/panel_avatar_classified.xml | 46 +- .../skins/default/xui/es/panel_avatar_pick.xml | 14 +- .../skins/default/xui/es/panel_chat_bar.xml | 30 +- .../skins/default/xui/es/panel_classified.xml | 33 +- .../newview/skins/default/xui/es/panel_event.xml | 47 +- .../newview/skins/default/xui/es/panel_friends.xml | 20 + .../newview/skins/default/xui/es/panel_group.xml | 17 +- .../skins/default/xui/es/panel_group_finder.xml | 8 +- .../skins/default/xui/es/panel_group_general.xml | 100 +- .../skins/default/xui/es/panel_group_invite.xml | 37 +- .../default/xui/es/panel_group_land_money.xml | 87 +- .../skins/default/xui/es/panel_group_notices.xml | 65 +- .../skins/default/xui/es/panel_group_roles.xml | 165 +- .../skins/default/xui/es/panel_group_voting.xml | 128 +- .../newview/skins/default/xui/es/panel_groups.xml | 15 + .../skins/default/xui/es/panel_land_covenant.xml | 22 +- .../newview/skins/default/xui/es/panel_login.xml | 36 +- .../skins/default/xui/es/panel_master_volume.xml | 5 + .../skins/default/xui/es/panel_media_controls.xml | 38 + .../default/xui/es/panel_media_remote_expanded.xml | 28 + .../skins/default/xui/es/panel_overlaybar.xml | 25 +- .../newview/skins/default/xui/es/panel_place.xml | 43 +- .../skins/default/xui/es/panel_place_small.xml | 43 +- .../default/xui/es/panel_preferences_audio.xml | 77 +- .../default/xui/es/panel_preferences_chat.xml | 73 +- .../default/xui/es/panel_preferences_general.xml | 144 +- .../default/xui/es/panel_preferences_graphics1.xml | 187 +- .../skins/default/xui/es/panel_preferences_im.xml | 44 +- .../default/xui/es/panel_preferences_input.xml | 48 +- .../default/xui/es/panel_preferences_network.xml | 40 +- .../default/xui/es/panel_preferences_popups.xml | 26 +- .../default/xui/es/panel_preferences_skins.xml | 14 + .../default/xui/es/panel_preferences_voice.xml | 35 + .../skins/default/xui/es/panel_preferences_web.xml | 28 + .../skins/default/xui/es/panel_region_covenant.xml | 32 +- .../skins/default/xui/es/panel_region_debug.xml | 64 +- .../skins/default/xui/es/panel_region_estate.xml | 87 +- .../skins/default/xui/es/panel_region_general.xml | 72 +- .../skins/default/xui/es/panel_region_terrain.xml | 43 +- .../skins/default/xui/es/panel_region_texture.xml | 46 +- .../skins/default/xui/es/panel_scrolling_param.xml | 10 +- .../default/xui/es/panel_speaker_controls.xml | 41 + .../skins/default/xui/es/panel_status_bar.xml | 54 +- .../newview/skins/default/xui/es/panel_toolbar.xml | 32 +- .../skins/default/xui/es/panel_top_pick.xml | 14 +- .../skins/default/xui/es/panel_voice_controls.xml | 7 + .../skins/default/xui/es/panel_voice_enable.xml | 23 + .../skins/default/xui/es/panel_voice_options.xml | 21 + .../default/xui/es/panel_voice_remote_expanded.xml | 4 + .../indra/newview/skins/default/xui/es/strings.xml | 421 ++ .../skins/default/xui/es/teleport_strings.xml | 74 + .../indra/newview/skins/default/xui/fr/alerts.xml | 4670 +------------ .../skins/default/xui/fr/floater_about_land.xml | 9 +- .../skins/default/xui/fr/floater_bulk_perms.xml | 40 + .../skins/default/xui/fr/floater_buy_land.xml | 173 +- .../skins/default/xui/fr/floater_chat_history.xml | 43 +- .../skins/default/xui/fr/floater_clothing.xml | 9 - .../skins/default/xui/fr/floater_customize.xml | 20 +- .../skins/default/xui/fr/floater_directory.xml | 92 +- .../skins/default/xui/fr/floater_font_test.xml | 10 + .../skins/default/xui/fr/floater_group_info.xml | 2 +- .../skins/default/xui/fr/floater_joystick.xml | 32 +- .../skins/default/xui/fr/floater_media_browser.xml | 4 +- .../default/xui/fr/floater_name_description.xml | 2 +- .../skins/default/xui/fr/floater_notification.xml | 7 + .../xui/fr/floater_notifications_console.xml | 5 + .../default/xui/fr/floater_object_im_info.xml | 16 + .../skins/default/xui/fr/floater_perm_prefs.xml | 16 + .../default/xui/fr/floater_preview_gesture.xml | 2 - .../skins/default/xui/fr/floater_report_abuse.xml | 18 +- .../skins/default/xui/fr/floater_script_search.xml | 16 +- .../skins/default/xui/fr/floater_snapshot.xml | 4 +- .../skins/default/xui/fr/floater_sound_preview.xml | 2 +- .../newview/skins/default/xui/fr/floater_tools.xml | 148 +- .../skins/default/xui/fr/floater_world_map.xml | 17 +- .../indra/newview/skins/default/xui/fr/fonts.xml | 9 + .../skins/default/xui/fr/menu_inventory.xml | 7 +- .../skins/default/xui/fr/menu_pie_attachment.xml | 17 +- .../newview/skins/default/xui/fr/menu_viewer.xml | 24 +- .../newview/skins/default/xui/fr/notifications.xml | 5732 ++++++++++++++++ .../indra/newview/skins/default/xui/fr/notify.xml | 1065 +-- .../default/xui/fr/panel_avatar_classified.xml | 13 +- .../skins/default/xui/fr/panel_classified.xml | 12 +- .../newview/skins/default/xui/fr/panel_event.xml | 12 - .../skins/default/xui/fr/panel_group_general.xml | 13 +- .../skins/default/xui/fr/panel_group_invite.xml | 9 +- .../default/xui/fr/panel_group_land_money.xml | 2 +- .../skins/default/xui/fr/panel_group_roles.xml | 2 +- .../newview/skins/default/xui/fr/panel_login.xml | 2 +- .../default/xui/fr/panel_notifications_channel.xml | 15 + .../skins/default/xui/fr/panel_overlaybar.xml | 11 +- .../default/xui/fr/panel_preferences_general.xml | 12 +- .../default/xui/fr/panel_preferences_input.xml | 19 +- .../skins/default/xui/fr/panel_region_general.xml | 11 +- .../indra/newview/skins/default/xui/fr/strings.xml | 55 +- .../newview/skins/default/xui/fr/ui_strings.xml | 28 + .../indra/newview/skins/default/xui/ja/alerts.xml | 4881 +------------- .../skins/default/xui/ja/floater_about_land.xml | 16 +- .../skins/default/xui/ja/floater_bulk_perms.xml | 43 + .../skins/default/xui/ja/floater_buy_land.xml | 182 +- .../skins/default/xui/ja/floater_chat_history.xml | 45 +- .../skins/default/xui/ja/floater_clothing.xml | 9 - .../skins/default/xui/ja/floater_directory.xml | 87 +- .../skins/default/xui/ja/floater_group_info.xml | 3 +- .../skins/default/xui/ja/floater_joystick.xml | 112 +- .../skins/default/xui/ja/floater_media_browser.xml | 4 +- .../default/xui/ja/floater_name_description.xml | 2 +- .../skins/default/xui/ja/floater_notification.xml | 7 + .../xui/ja/floater_notifications_console.xml | 5 + .../default/xui/ja/floater_object_im_info.xml | 16 + .../skins/default/xui/ja/floater_perm_prefs.xml | 16 + .../default/xui/ja/floater_preview_gesture.xml | 2 - .../skins/default/xui/ja/floater_report_abuse.xml | 18 +- .../skins/default/xui/ja/floater_snapshot.xml | 4 +- .../skins/default/xui/ja/floater_sound_preview.xml | 3 +- .../newview/skins/default/xui/ja/floater_tools.xml | 431 +- .../default/xui/ja/floater_windlight_options.xml | 4 +- .../skins/default/xui/ja/floater_world_map.xml | 8 +- .../skins/default/xui/ja/menu_inventory.xml | 120 +- .../skins/default/xui/ja/menu_pie_attachment.xml | 17 +- .../newview/skins/default/xui/ja/menu_pie_land.xml | 2 +- .../newview/skins/default/xui/ja/menu_viewer.xml | 32 +- .../newview/skins/default/xui/ja/notifications.xml | 5947 +++++++++++++++++ .../indra/newview/skins/default/xui/ja/notify.xml | 1062 +-- .../default/xui/ja/panel_avatar_classified.xml | 12 +- .../skins/default/xui/ja/panel_classified.xml | 13 +- .../newview/skins/default/xui/ja/panel_event.xml | 14 +- .../newview/skins/default/xui/ja/panel_friends.xml | 2 +- .../skins/default/xui/ja/panel_group_general.xml | 12 +- .../skins/default/xui/ja/panel_group_invite.xml | 8 +- .../skins/default/xui/ja/panel_group_roles.xml | 4 +- .../newview/skins/default/xui/ja/panel_login.xml | 2 +- .../default/xui/ja/panel_notifications_channel.xml | 15 + .../skins/default/xui/ja/panel_overlaybar.xml | 18 +- .../default/xui/ja/panel_preferences_general.xml | 9 +- .../default/xui/ja/panel_preferences_input.xml | 13 +- .../skins/default/xui/ja/panel_region_general.xml | 12 +- .../indra/newview/skins/default/xui/ja/strings.xml | 73 +- .../newview/skins/default/xui/ja/ui_strings.xml | 28 + .../indra/newview/skins/default/xui/ko/alerts.xml | 4933 +------------- .../newview/skins/default/xui/ko/floater_about.xml | 3 +- .../skins/default/xui/ko/floater_about_land.xml | 9 +- .../skins/default/xui/ko/floater_chat_history.xml | 39 + .../skins/default/xui/ko/floater_clothing.xml | 9 - .../skins/default/xui/ko/floater_directory.xml | 62 +- .../skins/default/xui/ko/floater_group_info.xml | 3 +- .../default/xui/ko/floater_name_description.xml | 2 +- .../default/xui/ko/floater_preview_gesture.xml | 2 - .../skins/default/xui/ko/floater_report_abuse.xml | 18 +- .../skins/default/xui/ko/floater_snapshot.xml | 4 +- .../skins/default/xui/ko/floater_sound_preview.xml | 2 +- .../skins/default/xui/ko/floater_world_map.xml | 20 +- .../newview/skins/default/xui/ko/menu_viewer.xml | 2 + .../newview/skins/default/xui/ko/notifications.xml | 6036 +++++++++++++++++ .../indra/newview/skins/default/xui/ko/notify.xml | 1075 +-- .../default/xui/ko/panel_avatar_classified.xml | 12 +- .../skins/default/xui/ko/panel_classified.xml | 12 +- .../newview/skins/default/xui/ko/panel_event.xml | 13 +- .../skins/default/xui/ko/panel_group_general.xml | 16 +- .../newview/skins/default/xui/ko/panel_login.xml | 2 +- .../skins/default/xui/ko/panel_region_general.xml | 10 +- .../indra/newview/skins/default/xui/pl/alerts.xml | 4 + .../newview/skins/default/xui/pl/floater_about.xml | 37 + .../skins/default/xui/pl/floater_about_land.xml | 429 ++ .../default/xui/pl/floater_active_speakers.xml | 12 + .../default/xui/pl/floater_animation_preview.xml | 172 + .../skins/default/xui/pl/floater_auction.xml | 9 + .../skins/default/xui/pl/floater_audio_volume.xml | 4 + .../skins/default/xui/pl/floater_avatar_picker.xml | 15 + .../default/xui/pl/floater_avatar_textures.xml | 30 + .../skins/default/xui/pl/floater_beacons.xml | 15 + .../skins/default/xui/pl/floater_build_options.xml | 8 + .../newview/skins/default/xui/pl/floater_bumps.xml | 21 + .../skins/default/xui/pl/floater_buy_contents.xml | 21 + .../skins/default/xui/pl/floater_buy_currency.xml | 69 + .../skins/default/xui/pl/floater_buy_land.xml | 227 + .../skins/default/xui/pl/floater_buy_object.xml | 26 + .../skins/default/xui/pl/floater_camera.xml | 12 + .../skins/default/xui/pl/floater_chat_history.xml | 91 + .../skins/default/xui/pl/floater_chatterbox.xml | 2 + .../skins/default/xui/pl/floater_choose_group.xml | 8 + .../skins/default/xui/pl/floater_color_picker.xml | 31 + .../skins/default/xui/pl/floater_critical.xml | 11 + .../skins/default/xui/pl/floater_customize.xml | 456 ++ .../default/xui/pl/floater_day_cycle_options.xml | 99 + .../default/xui/pl/floater_device_settings.xml | 3 + .../skins/default/xui/pl/floater_directory.xml | 367 + .../skins/default/xui/pl/floater_env_settings.xml | 26 + .../skins/default/xui/pl/floater_gesture.xml | 16 + .../skins/default/xui/pl/floater_god_tools.xml | 113 + .../skins/default/xui/pl/floater_group_info.xml | 273 + .../default/xui/pl/floater_hardware_settings.xml | 38 + .../newview/skins/default/xui/pl/floater_html.xml | 13 + .../newview/skins/default/xui/pl/floater_hud.xml | 2 + .../newview/skins/default/xui/pl/floater_im.xml | 45 + .../skins/default/xui/pl/floater_image_preview.xml | 52 + .../skins/default/xui/pl/floater_import.xml | 17 + .../skins/default/xui/pl/floater_inspect.xml | 13 + .../default/xui/pl/floater_instant_message.xml | 47 + .../xui/pl/floater_instant_message_ad_hoc.xml | 43 + .../xui/pl/floater_instant_message_group.xml | 49 + .../skins/default/xui/pl/floater_inventory.xml | 47 + .../xui/pl/floater_inventory_item_properties.xml | 85 + .../xui/pl/floater_inventory_view_finder.xml | 24 + .../skins/default/xui/pl/floater_joystick.xml | 124 + .../skins/default/xui/pl/floater_lagmeter.xml | 154 + .../skins/default/xui/pl/floater_land_holdings.xml | 41 + .../skins/default/xui/pl/floater_landmark_ctrl.xml | 10 + .../default/xui/pl/floater_live_lsleditor.xml | 12 + .../skins/default/xui/pl/floater_lsl_guide.xml | 7 + .../skins/default/xui/pl/floater_media_browser.xml | 19 + .../skins/default/xui/pl/floater_mem_leaking.xml | 18 + .../skins/default/xui/pl/floater_moveview.xml | 13 + .../newview/skins/default/xui/pl/floater_mute.xml | 12 + .../skins/default/xui/pl/floater_mute_object.xml | 12 + .../skins/default/xui/pl/floater_my_friends.xml | 7 + .../default/xui/pl/floater_name_description.xml | 11 + .../skins/default/xui/pl/floater_new_im.xml | 11 + .../default/xui/pl/floater_new_outfit_dialog.xml | 91 + .../skins/default/xui/pl/floater_openobject.xml | 10 + .../newview/skins/default/xui/pl/floater_pay.xml | 22 + .../skins/default/xui/pl/floater_pay_object.xml | 31 + .../skins/default/xui/pl/floater_post_process.xml | 62 + .../skins/default/xui/pl/floater_postcard.xml | 36 + .../skins/default/xui/pl/floater_preferences.xml | 8 + .../default/xui/pl/floater_preview_animation.xml | 10 + .../default/xui/pl/floater_preview_classified.xml | 2 + .../xui/pl/floater_preview_embedded_texture.xml | 7 + .../skins/default/xui/pl/floater_preview_event.xml | 2 + .../xui/pl/floater_preview_existing_landmark.xml | 2 + .../default/xui/pl/floater_preview_gesture.xml | 57 + .../default/xui/pl/floater_preview_notecard.xml | 16 + .../pl/floater_preview_notecard_keep_discard.xml | 17 + .../skins/default/xui/pl/floater_preview_sound.xml | 12 + .../default/xui/pl/floater_preview_texture.xml | 9 + .../pl/floater_preview_texture_keep_discard.xml | 11 + .../skins/default/xui/pl/floater_preview_url.xml | 2 + .../default/xui/pl/floater_price_for_listing.xml | 15 + .../skins/default/xui/pl/floater_profile.xml | 2 + .../skins/default/xui/pl/floater_region_info.xml | 2 + .../skins/default/xui/pl/floater_report_abuse.xml | 184 + .../skins/default/xui/pl/floater_report_bug.xml | 108 + .../skins/default/xui/pl/floater_script_debug.xml | 6 + .../default/xui/pl/floater_script_ed_panel.xml | 43 + .../default/xui/pl/floater_script_preview.xml | 6 + .../skins/default/xui/pl/floater_script_queue.xml | 4 + .../skins/default/xui/pl/floater_script_search.xml | 14 + .../skins/default/xui/pl/floater_select_key.xml | 7 + .../skins/default/xui/pl/floater_sell_land.xml | 68 + .../default/xui/pl/floater_settings_debug.xml | 17 + .../default/xui/pl/floater_sim_release_message.xml | 16 + .../xui/pl/floater_skin_preview_template.xml | 35 + .../skins/default/xui/pl/floater_snapshot.xml | 137 + .../skins/default/xui/pl/floater_sound_preview.xml | 11 + .../skins/default/xui/pl/floater_telehub.xml | 28 + .../newview/skins/default/xui/pl/floater_test.xml | 2 + .../skins/default/xui/pl/floater_texture_ctrl.xml | 24 + .../newview/skins/default/xui/pl/floater_tools.xml | 636 ++ .../skins/default/xui/pl/floater_top_objects.xml | 51 + .../newview/skins/default/xui/pl/floater_tos.xml | 16 + .../skins/default/xui/pl/floater_url_entry.xml | 12 + .../skins/default/xui/pl/floater_voice_wizard.xml | 9 + .../newview/skins/default/xui/pl/floater_water.xml | 103 + .../default/xui/pl/floater_wearable_save_as.xml | 11 + .../default/xui/pl/floater_windlight_options.xml | 229 + .../skins/default/xui/pl/floater_world_map.xml | 81 + .../skins/default/xui/pl/menu_inventory.xml | 65 + .../newview/skins/default/xui/pl/menu_login.xml | 13 + .../skins/default/xui/pl/menu_pie_attachment.xml | 6 + .../skins/default/xui/pl/menu_pie_avatar.xml | 17 + .../newview/skins/default/xui/pl/menu_pie_land.xml | 10 + .../skins/default/xui/pl/menu_pie_object.xml | 24 + .../newview/skins/default/xui/pl/menu_pie_self.xml | 29 + .../newview/skins/default/xui/pl/menu_slurl.xml | 6 + .../newview/skins/default/xui/pl/menu_viewer.xml | 203 + .../newview/skins/default/xui/pl/mime_types.xml | 230 + .../newview/skins/default/xui/pl/notifications.xml | 5718 ++++++++++++++++ .../indra/newview/skins/default/xui/pl/notify.xml | 4 + .../newview/skins/default/xui/pl/panel_audio.xml | 17 + .../skins/default/xui/pl/panel_audio_device.xml | 26 + .../newview/skins/default/xui/pl/panel_avatar.xml | 214 + .../default/xui/pl/panel_avatar_classified.xml | 31 + .../skins/default/xui/pl/panel_avatar_pick.xml | 10 + .../skins/default/xui/pl/panel_chat_bar.xml | 22 + .../skins/default/xui/pl/panel_classified.xml | 23 + .../newview/skins/default/xui/pl/panel_event.xml | 62 + .../newview/skins/default/xui/pl/panel_friends.xml | 27 + .../newview/skins/default/xui/pl/panel_group.xml | 13 + .../skins/default/xui/pl/panel_group_finder.xml | 9 + .../skins/default/xui/pl/panel_group_general.xml | 75 + .../skins/default/xui/pl/panel_group_invite.xml | 21 + .../default/xui/pl/panel_group_land_money.xml | 88 + .../skins/default/xui/pl/panel_group_notices.xml | 71 + .../skins/default/xui/pl/panel_group_roles.xml | 157 + .../skins/default/xui/pl/panel_group_voting.xml | 114 + .../newview/skins/default/xui/pl/panel_groups.xml | 18 + .../skins/default/xui/pl/panel_land_covenant.xml | 39 + .../newview/skins/default/xui/pl/panel_login.xml | 43 + .../skins/default/xui/pl/panel_master_volume.xml | 8 + .../skins/default/xui/pl/panel_media_controls.xml | 38 + .../skins/default/xui/pl/panel_media_remote.xml | 2 + .../default/xui/pl/panel_media_remote_expanded.xml | 28 + .../skins/default/xui/pl/panel_overlaybar.xml | 16 + .../newview/skins/default/xui/pl/panel_place.xml | 39 + .../skins/default/xui/pl/panel_place_small.xml | 39 + .../default/xui/pl/panel_preferences_audio.xml | 24 + .../default/xui/pl/panel_preferences_chat.xml | 57 + .../default/xui/pl/panel_preferences_general.xml | 109 + .../default/xui/pl/panel_preferences_graphics1.xml | 179 + .../skins/default/xui/pl/panel_preferences_im.xml | 33 + .../default/xui/pl/panel_preferences_input.xml | 40 + .../default/xui/pl/panel_preferences_network.xml | 23 + .../default/xui/pl/panel_preferences_popups.xml | 21 + .../default/xui/pl/panel_preferences_skins.xml | 16 + .../default/xui/pl/panel_preferences_voice.xml | 35 + .../skins/default/xui/pl/panel_preferences_web.xml | 31 + .../skins/default/xui/pl/panel_region_covenant.xml | 50 + .../skins/default/xui/pl/panel_region_debug.xml | 40 + .../skins/default/xui/pl/panel_region_estate.xml | 74 + .../skins/default/xui/pl/panel_region_general.xml | 46 + .../skins/default/xui/pl/panel_region_terrain.xml | 30 + .../skins/default/xui/pl/panel_region_texture.xml | 57 + .../skins/default/xui/pl/panel_scrolling_param.xml | 12 + .../default/xui/pl/panel_speaker_controls.xml | 43 + .../skins/default/xui/pl/panel_status_bar.xml | 43 + .../newview/skins/default/xui/pl/panel_toolbar.xml | 23 + .../skins/default/xui/pl/panel_top_pick.xml | 10 + .../skins/default/xui/pl/panel_voice_controls.xml | 9 + .../skins/default/xui/pl/panel_voice_enable.xml | 23 + .../skins/default/xui/pl/panel_voice_options.xml | 23 + .../skins/default/xui/pl/panel_voice_remote.xml | 2 + .../default/xui/pl/panel_voice_remote_expanded.xml | 7 + .../newview/skins/default/xui/pl/role_actions.xml | 197 + .../indra/newview/skins/default/xui/pl/strings.xml | 439 ++ .../skins/default/xui/pl/teleport_strings.xml | 80 + .../newview/skins/default/xui/pl/xui_version.xml | 4 + .../indra/newview/skins/default/xui/pt/alerts.xml | 4147 +----------- .../newview/skins/default/xui/pt/floater_about.xml | 30 + .../skins/default/xui/pt/floater_about_land.xml | 133 +- .../default/xui/pt/floater_active_speakers.xml | 5 +- .../default/xui/pt/floater_animation_preview.xml | 17 +- .../skins/default/xui/pt/floater_auction.xml | 18 +- .../skins/default/xui/pt/floater_audio_volume.xml | 4 + .../skins/default/xui/pt/floater_avatar_picker.xml | 6 +- .../default/xui/pt/floater_avatar_textures.xml | 2 +- .../skins/default/xui/pt/floater_beacons.xml | 4 +- .../newview/skins/default/xui/pt/floater_bumps.xml | 4 +- .../skins/default/xui/pt/floater_buy_currency.xml | 14 +- .../skins/default/xui/pt/floater_buy_land.xml | 60 +- .../skins/default/xui/pt/floater_buy_object.xml | 2 +- .../skins/default/xui/pt/floater_chat_history.xml | 41 +- .../skins/default/xui/pt/floater_chatterbox.xml | 2 + .../skins/default/xui/pt/floater_clothing.xml | 9 - .../skins/default/xui/pt/floater_color_picker.xml | 16 +- .../skins/default/xui/pt/floater_critical.xml | 11 +- .../skins/default/xui/pt/floater_customize.xml | 50 +- .../default/xui/pt/floater_day_cycle_options.xml | 14 +- .../default/xui/pt/floater_device_settings.xml | 2 + .../skins/default/xui/pt/floater_directory.xml | 118 +- .../skins/default/xui/pt/floater_gesture.xml | 11 +- .../skins/default/xui/pt/floater_god_tools.xml | 120 +- .../skins/default/xui/pt/floater_group_info.xml | 3 +- .../newview/skins/default/xui/pt/floater_im.xml | 8 +- .../skins/default/xui/pt/floater_image_preview.xml | 4 +- .../skins/default/xui/pt/floater_inspect.xml | 19 +- .../default/xui/pt/floater_instant_message.xml | 9 +- .../xui/pt/floater_instant_message_ad_hoc.xml | 4 +- .../xui/pt/floater_instant_message_group.xml | 20 +- .../skins/default/xui/pt/floater_inventory.xml | 4 +- .../xui/pt/floater_inventory_item_properties.xml | 6 +- .../xui/pt/floater_inventory_view_finder.xml | 44 +- .../skins/default/xui/pt/floater_joystick.xml | 1 - .../skins/default/xui/pt/floater_lagmeter.xml | 4 +- .../skins/default/xui/pt/floater_land_holdings.xml | 17 +- .../skins/default/xui/pt/floater_landmark_ctrl.xml | 2 +- .../skins/default/xui/pt/floater_media_browser.xml | 12 +- .../skins/default/xui/pt/floater_moveview.xml | 20 +- .../newview/skins/default/xui/pt/floater_mute.xml | 16 +- .../skins/default/xui/pt/floater_my_friends.xml | 7 + .../default/xui/pt/floater_name_description.xml | 2 +- .../default/xui/pt/floater_new_outfit_dialog.xml | 78 +- .../skins/default/xui/pt/floater_openobject.xml | 10 +- .../skins/default/xui/pt/floater_post_process.xml | 53 + .../skins/default/xui/pt/floater_postcard.xml | 2 +- .../skins/default/xui/pt/floater_preferences.xml | 12 +- .../default/xui/pt/floater_preview_animation.xml | 10 +- .../default/xui/pt/floater_preview_classified.xml | 2 +- .../skins/default/xui/pt/floater_preview_event.xml | 2 +- .../default/xui/pt/floater_preview_gesture.xml | 16 +- .../pt/floater_preview_notecard_keep_discard.xml | 2 +- .../skins/default/xui/pt/floater_preview_sound.xml | 12 +- .../skins/default/xui/pt/floater_preview_url.xml | 2 +- .../default/xui/pt/floater_price_for_listing.xml | 15 +- .../skins/default/xui/pt/floater_profile.xml | 4 +- .../skins/default/xui/pt/floater_report_abuse.xml | 31 +- .../skins/default/xui/pt/floater_script_debug.xml | 6 +- .../skins/default/xui/pt/floater_script_queue.xml | 6 +- .../skins/default/xui/pt/floater_script_search.xml | 16 +- .../skins/default/xui/pt/floater_select_key.xml | 7 + .../skins/default/xui/pt/floater_sell_land.xml | 20 +- .../default/xui/pt/floater_settings_debug.xml | 18 +- .../default/xui/pt/floater_sim_release_message.xml | 6 + .../xui/pt/floater_skin_preview_template.xml | 33 + .../skins/default/xui/pt/floater_snapshot.xml | 12 +- .../skins/default/xui/pt/floater_sound_preview.xml | 23 +- .../skins/default/xui/pt/floater_telehub.xml | 15 +- .../skins/default/xui/pt/floater_texture_ctrl.xml | 1 - .../newview/skins/default/xui/pt/floater_tools.xml | 72 +- .../skins/default/xui/pt/floater_top_objects.xml | 12 +- .../newview/skins/default/xui/pt/floater_tos.xml | 2 +- .../skins/default/xui/pt/floater_url_entry.xml | 2 +- .../default/xui/pt/floater_wearable_save_as.xml | 10 +- .../skins/default/xui/pt/floater_world_map.xml | 65 +- .../skins/default/xui/pt/menu_inventory.xml | 116 +- .../skins/default/xui/pt/menu_pie_avatar.xml | 2 +- .../newview/skins/default/xui/pt/menu_pie_land.xml | 16 +- .../skins/default/xui/pt/menu_pie_object.xml | 38 +- .../newview/skins/default/xui/pt/menu_viewer.xml | 66 +- .../newview/skins/default/xui/pt/notifications.xml | 5748 ++++++++++++++++ .../indra/newview/skins/default/xui/pt/notify.xml | 951 +-- .../newview/skins/default/xui/pt/panel_audio.xml | 10 + .../skins/default/xui/pt/panel_audio_device.xml | 10 + .../newview/skins/default/xui/pt/panel_avatar.xml | 58 +- .../default/xui/pt/panel_avatar_classified.xml | 21 +- .../skins/default/xui/pt/panel_avatar_pick.xml | 10 +- .../skins/default/xui/pt/panel_chat_bar.xml | 6 +- .../skins/default/xui/pt/panel_classified.xml | 17 +- .../newview/skins/default/xui/pt/panel_event.xml | 14 +- .../newview/skins/default/xui/pt/panel_friends.xml | 16 +- .../newview/skins/default/xui/pt/panel_group.xml | 15 +- .../skins/default/xui/pt/panel_group_finder.xml | 4 +- .../skins/default/xui/pt/panel_group_general.xml | 38 +- .../skins/default/xui/pt/panel_group_invite.xml | 8 +- .../default/xui/pt/panel_group_land_money.xml | 17 +- .../skins/default/xui/pt/panel_group_notices.xml | 47 +- .../skins/default/xui/pt/panel_group_roles.xml | 65 +- .../skins/default/xui/pt/panel_group_voting.xml | 36 +- .../newview/skins/default/xui/pt/panel_groups.xml | 16 + .../skins/default/xui/pt/panel_land_covenant.xml | 16 +- .../newview/skins/default/xui/pt/panel_login.xml | 4 +- .../skins/default/xui/pt/panel_master_volume.xml | 5 + .../skins/default/xui/pt/panel_overlaybar.xml | 2 +- .../newview/skins/default/xui/pt/panel_place.xml | 6 +- .../skins/default/xui/pt/panel_place_small.xml | 4 +- .../default/xui/pt/panel_preferences_audio.xml | 9 +- .../default/xui/pt/panel_preferences_chat.xml | 15 +- .../default/xui/pt/panel_preferences_general.xml | 17 +- .../default/xui/pt/panel_preferences_graphics1.xml | 39 +- .../skins/default/xui/pt/panel_preferences_im.xml | 2 +- .../default/xui/pt/panel_preferences_input.xml | 18 +- .../default/xui/pt/panel_preferences_network.xml | 4 +- .../default/xui/pt/panel_preferences_popups.xml | 8 +- .../default/xui/pt/panel_preferences_voice.xml | 36 +- .../skins/default/xui/pt/panel_preferences_web.xml | 14 +- .../skins/default/xui/pt/panel_region_covenant.xml | 29 +- .../skins/default/xui/pt/panel_region_debug.xml | 18 +- .../skins/default/xui/pt/panel_region_estate.xml | 24 +- .../skins/default/xui/pt/panel_region_general.xml | 20 +- .../skins/default/xui/pt/panel_region_terrain.xml | 43 +- .../skins/default/xui/pt/panel_scrolling_param.xml | 10 +- .../default/xui/pt/panel_speaker_controls.xml | 7 +- .../skins/default/xui/pt/panel_status_bar.xml | 20 +- .../newview/skins/default/xui/pt/panel_toolbar.xml | 4 +- .../skins/default/xui/pt/panel_top_pick.xml | 14 +- .../skins/default/xui/pt/panel_voice_controls.xml | 4 +- .../skins/default/xui/pt/panel_voice_enable.xml | 10 +- .../skins/default/xui/pt/panel_voice_options.xml | 17 + .../indra/newview/skins/default/xui/pt/strings.xml | 16 +- .../skins/default/xui/pt/teleport_strings.xml | 26 +- .../indra/newview/skins/default/xui/ru/alerts.xml | 4 + .../newview/skins/default/xui/ru/floater_about.xml | 4 + .../skins/default/xui/ru/floater_about_land.xml | 477 ++ .../default/xui/ru/floater_active_speakers.xml | 12 + .../default/xui/ru/floater_animation_preview.xml | 175 + .../skins/default/xui/ru/floater_auction.xml | 11 + .../skins/default/xui/ru/floater_audio_volume.xml | 4 + .../skins/default/xui/ru/floater_avatar_picker.xml | 15 + .../default/xui/ru/floater_avatar_textures.xml | 30 + .../skins/default/xui/ru/floater_build_options.xml | 9 + .../newview/skins/default/xui/ru/floater_bumps.xml | 22 + .../skins/default/xui/ru/floater_buy_contents.xml | 21 + .../skins/default/xui/ru/floater_buy_currency.xml | 68 + .../skins/default/xui/ru/floater_buy_land.xml | 231 + .../skins/default/xui/ru/floater_buy_object.xml | 26 + .../skins/default/xui/ru/floater_camera.xml | 4 + .../skins/default/xui/ru/floater_chat_history.xml | 80 + .../skins/default/xui/ru/floater_chatterbox.xml | 2 + .../skins/default/xui/ru/floater_choose_group.xml | 8 + .../skins/default/xui/ru/floater_color_picker.xml | 31 + .../skins/default/xui/ru/floater_critical.xml | 11 + .../skins/default/xui/ru/floater_customize.xml | 506 ++ .../default/xui/ru/floater_day_cycle_options.xml | 102 + .../default/xui/ru/floater_device_settings.xml | 3 + .../skins/default/xui/ru/floater_directory.xml | 371 ++ .../skins/default/xui/ru/floater_env_settings.xml | 29 + .../skins/default/xui/ru/floater_gesture.xml | 16 + .../skins/default/xui/ru/floater_god_tools.xml | 160 + .../skins/default/xui/ru/floater_group_info.xml | 296 + .../default/xui/ru/floater_hardware_settings.xml | 44 + .../newview/skins/default/xui/ru/floater_html.xml | 10 + .../newview/skins/default/xui/ru/floater_hud.xml | 2 + .../newview/skins/default/xui/ru/floater_im.xml | 48 + .../skins/default/xui/ru/floater_image_preview.xml | 53 + .../skins/default/xui/ru/floater_import.xml | 17 + .../skins/default/xui/ru/floater_inspect.xml | 16 + .../default/xui/ru/floater_instant_message.xml | 46 + .../xui/ru/floater_instant_message_ad_hoc.xml | 43 + .../xui/ru/floater_instant_message_group.xml | 49 + .../skins/default/xui/ru/floater_inventory.xml | 48 + .../xui/ru/floater_inventory_item_properties.xml | 87 + .../xui/ru/floater_inventory_view_finder.xml | 25 + .../skins/default/xui/ru/floater_joystick.xml | 88 + .../skins/default/xui/ru/floater_lagmeter.xml | 154 + .../skins/default/xui/ru/floater_land_holdings.xml | 42 + .../skins/default/xui/ru/floater_landmark_ctrl.xml | 12 + .../default/xui/ru/floater_live_lsleditor.xml | 11 + .../skins/default/xui/ru/floater_lsl_guide.xml | 7 + .../skins/default/xui/ru/floater_media_browser.xml | 20 + .../skins/default/xui/ru/floater_moveview.xml | 15 + .../newview/skins/default/xui/ru/floater_mute.xml | 15 + .../skins/default/xui/ru/floater_mute_object.xml | 12 + .../skins/default/xui/ru/floater_my_friends.xml | 7 + .../default/xui/ru/floater_name_description.xml | 11 + .../skins/default/xui/ru/floater_new_im.xml | 12 + .../default/xui/ru/floater_new_outfit_dialog.xml | 89 + .../skins/default/xui/ru/floater_openobject.xml | 12 + .../newview/skins/default/xui/ru/floater_pay.xml | 21 + .../skins/default/xui/ru/floater_pay_object.xml | 30 + .../skins/default/xui/ru/floater_post_process.xml | 65 + .../skins/default/xui/ru/floater_postcard.xml | 33 + .../skins/default/xui/ru/floater_preferences.xml | 8 + .../default/xui/ru/floater_preview_animation.xml | 11 + .../default/xui/ru/floater_preview_classified.xml | 2 + .../xui/ru/floater_preview_embedded_texture.xml | 7 + .../skins/default/xui/ru/floater_preview_event.xml | 2 + .../xui/ru/floater_preview_existing_landmark.xml | 2 + .../default/xui/ru/floater_preview_gesture.xml | 19 + .../default/xui/ru/floater_preview_notecard.xml | 16 + .../ru/floater_preview_notecard_keep_discard.xml | 15 + .../skins/default/xui/ru/floater_preview_sound.xml | 12 + .../default/xui/ru/floater_preview_texture.xml | 9 + .../ru/floater_preview_texture_keep_discard.xml | 11 + .../skins/default/xui/ru/floater_preview_url.xml | 2 + .../default/xui/ru/floater_price_for_listing.xml | 17 + .../skins/default/xui/ru/floater_profile.xml | 2 + .../skins/default/xui/ru/floater_region_info.xml | 2 + .../skins/default/xui/ru/floater_report_abuse.xml | 95 + .../skins/default/xui/ru/floater_report_bug.xml | 110 + .../skins/default/xui/ru/floater_script_debug.xml | 7 + .../default/xui/ru/floater_script_ed_panel.xml | 43 + .../default/xui/ru/floater_script_preview.xml | 6 + .../skins/default/xui/ru/floater_script_queue.xml | 4 + .../skins/default/xui/ru/floater_script_search.xml | 14 + .../skins/default/xui/ru/floater_select_key.xml | 7 + .../skins/default/xui/ru/floater_sell_land.xml | 68 + .../default/xui/ru/floater_settings_debug.xml | 17 + .../default/xui/ru/floater_sim_release_message.xml | 16 + .../xui/ru/floater_skin_preview_template.xml | 36 + .../skins/default/xui/ru/floater_snapshot.xml | 117 + .../skins/default/xui/ru/floater_sound_preview.xml | 12 + .../skins/default/xui/ru/floater_telehub.xml | 28 + .../newview/skins/default/xui/ru/floater_test.xml | 2 + .../skins/default/xui/ru/floater_texture_ctrl.xml | 25 + .../newview/skins/default/xui/ru/floater_tools.xml | 621 ++ .../skins/default/xui/ru/floater_top_objects.xml | 51 + .../newview/skins/default/xui/ru/floater_tos.xml | 27 + .../skins/default/xui/ru/floater_url_entry.xml | 12 + .../skins/default/xui/ru/floater_voice_wizard.xml | 9 + .../newview/skins/default/xui/ru/floater_water.xml | 105 + .../default/xui/ru/floater_wearable_save_as.xml | 11 + .../default/xui/ru/floater_windlight_options.xml | 233 + .../skins/default/xui/ru/floater_world_map.xml | 91 + .../skins/default/xui/ru/menu_inventory.xml | 67 + .../newview/skins/default/xui/ru/menu_login.xml | 13 + .../skins/default/xui/ru/menu_pie_attachment.xml | 6 + .../skins/default/xui/ru/menu_pie_avatar.xml | 17 + .../newview/skins/default/xui/ru/menu_pie_land.xml | 10 + .../skins/default/xui/ru/menu_pie_object.xml | 24 + .../newview/skins/default/xui/ru/menu_pie_self.xml | 29 + .../newview/skins/default/xui/ru/menu_slurl.xml | 6 + .../newview/skins/default/xui/ru/menu_viewer.xml | 250 + .../newview/skins/default/xui/ru/mime_types.xml | 225 + .../newview/skins/default/xui/ru/notifications.xml | 5785 ++++++++++++++++ .../indra/newview/skins/default/xui/ru/notify.xml | 4 + .../newview/skins/default/xui/ru/panel_audio.xml | 17 + .../skins/default/xui/ru/panel_audio_device.xml | 28 + .../newview/skins/default/xui/ru/panel_avatar.xml | 210 + .../default/xui/ru/panel_avatar_classified.xml | 32 + .../skins/default/xui/ru/panel_avatar_pick.xml | 10 + .../skins/default/xui/ru/panel_chat_bar.xml | 13 + .../skins/default/xui/ru/panel_classified.xml | 23 + .../newview/skins/default/xui/ru/panel_event.xml | 62 + .../newview/skins/default/xui/ru/panel_friends.xml | 31 + .../newview/skins/default/xui/ru/panel_group.xml | 13 + .../skins/default/xui/ru/panel_group_finder.xml | 9 + .../skins/default/xui/ru/panel_group_general.xml | 82 + .../skins/default/xui/ru/panel_group_invite.xml | 26 + .../default/xui/ru/panel_group_land_money.xml | 88 + .../skins/default/xui/ru/panel_group_notices.xml | 79 + .../skins/default/xui/ru/panel_group_roles.xml | 162 + .../skins/default/xui/ru/panel_group_voting.xml | 130 + .../newview/skins/default/xui/ru/panel_groups.xml | 18 + .../skins/default/xui/ru/panel_land_covenant.xml | 39 + .../newview/skins/default/xui/ru/panel_login.xml | 42 + .../skins/default/xui/ru/panel_master_volume.xml | 8 + .../skins/default/xui/ru/panel_media_controls.xml | 43 + .../skins/default/xui/ru/panel_media_remote.xml | 2 + .../default/xui/ru/panel_media_remote_expanded.xml | 28 + .../skins/default/xui/ru/panel_overlaybar.xml | 23 + .../newview/skins/default/xui/ru/panel_place.xml | 39 + .../skins/default/xui/ru/panel_place_small.xml | 39 + .../default/xui/ru/panel_preferences_audio.xml | 28 + .../default/xui/ru/panel_preferences_chat.xml | 62 + .../default/xui/ru/panel_preferences_general.xml | 97 + .../default/xui/ru/panel_preferences_graphics1.xml | 180 + .../skins/default/xui/ru/panel_preferences_im.xml | 41 + .../default/xui/ru/panel_preferences_input.xml | 43 + .../default/xui/ru/panel_preferences_network.xml | 23 + .../default/xui/ru/panel_preferences_popups.xml | 23 + .../default/xui/ru/panel_preferences_skins.xml | 16 + .../default/xui/ru/panel_preferences_voice.xml | 39 + .../skins/default/xui/ru/panel_preferences_web.xml | 32 + .../skins/default/xui/ru/panel_region_covenant.xml | 52 + .../skins/default/xui/ru/panel_region_debug.xml | 37 + .../skins/default/xui/ru/panel_region_estate.xml | 72 + .../skins/default/xui/ru/panel_region_general.xml | 50 + .../skins/default/xui/ru/panel_region_terrain.xml | 30 + .../skins/default/xui/ru/panel_region_texture.xml | 57 + .../skins/default/xui/ru/panel_scrolling_param.xml | 12 + .../default/xui/ru/panel_speaker_controls.xml | 44 + .../skins/default/xui/ru/panel_status_bar.xml | 50 + .../newview/skins/default/xui/ru/panel_toolbar.xml | 25 + .../skins/default/xui/ru/panel_top_pick.xml | 10 + .../skins/default/xui/ru/panel_voice_controls.xml | 11 + .../skins/default/xui/ru/panel_voice_enable.xml | 23 + .../skins/default/xui/ru/panel_voice_options.xml | 26 + .../skins/default/xui/ru/panel_voice_remote.xml | 2 + .../default/xui/ru/panel_voice_remote_expanded.xml | 7 + .../newview/skins/default/xui/ru/role_actions.xml | 98 + .../indra/newview/skins/default/xui/ru/strings.xml | 391 ++ .../skins/default/xui/ru/teleport_strings.xml | 87 + .../newview/skins/default/xui/ru/xui_version.xml | 4 + .../indra/newview/skins/default/xui/uk/alerts.xml | 4 + .../newview/skins/default/xui/uk/floater_about.xml | 2 + .../skins/default/xui/uk/floater_about_land.xml | 474 ++ .../default/xui/uk/floater_active_speakers.xml | 12 + .../default/xui/uk/floater_animation_preview.xml | 175 + .../skins/default/xui/uk/floater_auction.xml | 11 + .../skins/default/xui/uk/floater_audio_volume.xml | 4 + .../skins/default/xui/uk/floater_avatar_picker.xml | 15 + .../default/xui/uk/floater_avatar_textures.xml | 30 + .../skins/default/xui/uk/floater_build_options.xml | 8 + .../newview/skins/default/xui/uk/floater_bumps.xml | 22 + .../skins/default/xui/uk/floater_buy_contents.xml | 21 + .../skins/default/xui/uk/floater_buy_currency.xml | 68 + .../skins/default/xui/uk/floater_buy_land.xml | 230 + .../skins/default/xui/uk/floater_buy_object.xml | 26 + .../skins/default/xui/uk/floater_camera.xml | 2 + .../skins/default/xui/uk/floater_chat_history.xml | 80 + .../skins/default/xui/uk/floater_chatterbox.xml | 2 + .../skins/default/xui/uk/floater_choose_group.xml | 8 + .../skins/default/xui/uk/floater_color_picker.xml | 31 + .../skins/default/xui/uk/floater_critical.xml | 11 + .../skins/default/xui/uk/floater_customize.xml | 518 ++ .../default/xui/uk/floater_day_cycle_options.xml | 102 + .../default/xui/uk/floater_device_settings.xml | 3 + .../skins/default/xui/uk/floater_directory.xml | 370 ++ .../skins/default/xui/uk/floater_env_settings.xml | 29 + .../skins/default/xui/uk/floater_gesture.xml | 16 + .../skins/default/xui/uk/floater_god_tools.xml | 159 + .../skins/default/xui/uk/floater_group_info.xml | 296 + .../default/xui/uk/floater_hardware_settings.xml | 37 + .../newview/skins/default/xui/uk/floater_html.xml | 10 + .../newview/skins/default/xui/uk/floater_hud.xml | 2 + .../newview/skins/default/xui/uk/floater_im.xml | 48 + .../skins/default/xui/uk/floater_image_preview.xml | 53 + .../skins/default/xui/uk/floater_import.xml | 17 + .../skins/default/xui/uk/floater_inspect.xml | 16 + .../default/xui/uk/floater_instant_message.xml | 46 + .../xui/uk/floater_instant_message_ad_hoc.xml | 43 + .../xui/uk/floater_instant_message_group.xml | 49 + .../skins/default/xui/uk/floater_inventory.xml | 48 + .../xui/uk/floater_inventory_item_properties.xml | 87 + .../xui/uk/floater_inventory_view_finder.xml | 25 + .../skins/default/xui/uk/floater_joystick.xml | 88 + .../skins/default/xui/uk/floater_lagmeter.xml | 155 + .../skins/default/xui/uk/floater_land_holdings.xml | 42 + .../skins/default/xui/uk/floater_landmark_ctrl.xml | 12 + .../default/xui/uk/floater_live_lsleditor.xml | 11 + .../skins/default/xui/uk/floater_lsl_guide.xml | 7 + .../skins/default/xui/uk/floater_media_browser.xml | 20 + .../skins/default/xui/uk/floater_moveview.xml | 15 + .../newview/skins/default/xui/uk/floater_mute.xml | 15 + .../skins/default/xui/uk/floater_mute_object.xml | 12 + .../skins/default/xui/uk/floater_my_friends.xml | 7 + .../default/xui/uk/floater_name_description.xml | 11 + .../skins/default/xui/uk/floater_new_im.xml | 12 + .../default/xui/uk/floater_new_outfit_dialog.xml | 89 + .../skins/default/xui/uk/floater_openobject.xml | 12 + .../newview/skins/default/xui/uk/floater_pay.xml | 21 + .../skins/default/xui/uk/floater_pay_object.xml | 30 + .../skins/default/xui/uk/floater_post_process.xml | 64 + .../skins/default/xui/uk/floater_postcard.xml | 33 + .../skins/default/xui/uk/floater_preferences.xml | 8 + .../default/xui/uk/floater_preview_animation.xml | 11 + .../default/xui/uk/floater_preview_classified.xml | 2 + .../xui/uk/floater_preview_embedded_texture.xml | 7 + .../skins/default/xui/uk/floater_preview_event.xml | 2 + .../xui/uk/floater_preview_existing_landmark.xml | 2 + .../default/xui/uk/floater_preview_gesture.xml | 18 + .../default/xui/uk/floater_preview_notecard.xml | 16 + .../uk/floater_preview_notecard_keep_discard.xml | 15 + .../skins/default/xui/uk/floater_preview_sound.xml | 12 + .../default/xui/uk/floater_preview_texture.xml | 9 + .../uk/floater_preview_texture_keep_discard.xml | 11 + .../skins/default/xui/uk/floater_preview_url.xml | 2 + .../default/xui/uk/floater_price_for_listing.xml | 17 + .../skins/default/xui/uk/floater_profile.xml | 2 + .../skins/default/xui/uk/floater_region_info.xml | 2 + .../skins/default/xui/uk/floater_report_abuse.xml | 96 + .../skins/default/xui/uk/floater_report_bug.xml | 111 + .../skins/default/xui/uk/floater_script_debug.xml | 7 + .../default/xui/uk/floater_script_ed_panel.xml | 43 + .../default/xui/uk/floater_script_preview.xml | 6 + .../skins/default/xui/uk/floater_script_queue.xml | 4 + .../skins/default/xui/uk/floater_script_search.xml | 14 + .../skins/default/xui/uk/floater_select_key.xml | 7 + .../skins/default/xui/uk/floater_sell_land.xml | 68 + .../default/xui/uk/floater_settings_debug.xml | 17 + .../default/xui/uk/floater_sim_release_message.xml | 16 + .../xui/uk/floater_skin_preview_template.xml | 35 + .../skins/default/xui/uk/floater_snapshot.xml | 116 + .../skins/default/xui/uk/floater_sound_preview.xml | 12 + .../skins/default/xui/uk/floater_telehub.xml | 28 + .../newview/skins/default/xui/uk/floater_test.xml | 2 + .../skins/default/xui/uk/floater_texture_ctrl.xml | 24 + .../newview/skins/default/xui/uk/floater_tools.xml | 622 ++ .../skins/default/xui/uk/floater_top_objects.xml | 50 + .../newview/skins/default/xui/uk/floater_tos.xml | 27 + .../skins/default/xui/uk/floater_url_entry.xml | 12 + .../skins/default/xui/uk/floater_voice_wizard.xml | 9 + .../newview/skins/default/xui/uk/floater_water.xml | 106 + .../default/xui/uk/floater_wearable_save_as.xml | 11 + .../default/xui/uk/floater_windlight_options.xml | 231 + .../skins/default/xui/uk/floater_world_map.xml | 91 + .../skins/default/xui/uk/menu_inventory.xml | 67 + .../newview/skins/default/xui/uk/menu_login.xml | 13 + .../skins/default/xui/uk/menu_pie_attachment.xml | 6 + .../skins/default/xui/uk/menu_pie_avatar.xml | 17 + .../newview/skins/default/xui/uk/menu_pie_land.xml | 10 + .../skins/default/xui/uk/menu_pie_object.xml | 24 + .../newview/skins/default/xui/uk/menu_pie_self.xml | 29 + .../newview/skins/default/xui/uk/menu_slurl.xml | 6 + .../newview/skins/default/xui/uk/menu_viewer.xml | 250 + .../newview/skins/default/xui/uk/mime_types.xml | 225 + .../newview/skins/default/xui/uk/notifications.xml | 5772 ++++++++++++++++ .../indra/newview/skins/default/xui/uk/notify.xml | 4 + .../newview/skins/default/xui/uk/panel_audio.xml | 17 + .../skins/default/xui/uk/panel_audio_device.xml | 28 + .../newview/skins/default/xui/uk/panel_avatar.xml | 213 + .../default/xui/uk/panel_avatar_classified.xml | 31 + .../skins/default/xui/uk/panel_avatar_pick.xml | 10 + .../skins/default/xui/uk/panel_chat_bar.xml | 13 + .../skins/default/xui/uk/panel_classified.xml | 23 + .../newview/skins/default/xui/uk/panel_event.xml | 62 + .../newview/skins/default/xui/uk/panel_friends.xml | 31 + .../newview/skins/default/xui/uk/panel_group.xml | 14 + .../skins/default/xui/uk/panel_group_finder.xml | 9 + .../skins/default/xui/uk/panel_group_general.xml | 81 + .../skins/default/xui/uk/panel_group_invite.xml | 26 + .../default/xui/uk/panel_group_land_money.xml | 88 + .../skins/default/xui/uk/panel_group_notices.xml | 79 + .../skins/default/xui/uk/panel_group_roles.xml | 162 + .../skins/default/xui/uk/panel_group_voting.xml | 129 + .../newview/skins/default/xui/uk/panel_groups.xml | 18 + .../skins/default/xui/uk/panel_land_covenant.xml | 39 + .../newview/skins/default/xui/uk/panel_login.xml | 42 + .../skins/default/xui/uk/panel_master_volume.xml | 8 + .../skins/default/xui/uk/panel_media_controls.xml | 43 + .../skins/default/xui/uk/panel_media_remote.xml | 2 + .../default/xui/uk/panel_media_remote_expanded.xml | 28 + .../skins/default/xui/uk/panel_overlaybar.xml | 25 + .../newview/skins/default/xui/uk/panel_place.xml | 39 + .../skins/default/xui/uk/panel_place_small.xml | 39 + .../default/xui/uk/panel_preferences_audio.xml | 28 + .../default/xui/uk/panel_preferences_chat.xml | 62 + .../default/xui/uk/panel_preferences_general.xml | 97 + .../default/xui/uk/panel_preferences_graphics1.xml | 180 + .../skins/default/xui/uk/panel_preferences_im.xml | 39 + .../default/xui/uk/panel_preferences_input.xml | 42 + .../default/xui/uk/panel_preferences_network.xml | 22 + .../default/xui/uk/panel_preferences_popups.xml | 22 + .../default/xui/uk/panel_preferences_skins.xml | 16 + .../default/xui/uk/panel_preferences_voice.xml | 39 + .../skins/default/xui/uk/panel_preferences_web.xml | 32 + .../skins/default/xui/uk/panel_region_covenant.xml | 52 + .../skins/default/xui/uk/panel_region_debug.xml | 37 + .../skins/default/xui/uk/panel_region_estate.xml | 72 + .../skins/default/xui/uk/panel_region_general.xml | 51 + .../skins/default/xui/uk/panel_region_terrain.xml | 30 + .../skins/default/xui/uk/panel_region_texture.xml | 57 + .../skins/default/xui/uk/panel_scrolling_param.xml | 12 + .../default/xui/uk/panel_speaker_controls.xml | 44 + .../skins/default/xui/uk/panel_status_bar.xml | 49 + .../newview/skins/default/xui/uk/panel_toolbar.xml | 24 + .../skins/default/xui/uk/panel_top_pick.xml | 10 + .../skins/default/xui/uk/panel_voice_controls.xml | 11 + .../skins/default/xui/uk/panel_voice_enable.xml | 23 + .../skins/default/xui/uk/panel_voice_options.xml | 26 + .../skins/default/xui/uk/panel_voice_remote.xml | 2 + .../default/xui/uk/panel_voice_remote_expanded.xml | 7 + .../newview/skins/default/xui/uk/role_actions.xml | 95 + .../indra/newview/skins/default/xui/uk/strings.xml | 390 ++ .../skins/default/xui/uk/teleport_strings.xml | 87 + .../newview/skins/default/xui/uk/xui_version.xml | 4 + .../indra/newview/skins/default/xui/zh/alerts.xml | 4861 +------------- .../newview/skins/default/xui/zh/floater_about.xml | 1 + .../skins/default/xui/zh/floater_about_land.xml | 475 +- .../default/xui/zh/floater_animation_preview.xml | 44 +- .../default/xui/zh/floater_avatar_textures.xml | 50 +- .../skins/default/xui/zh/floater_build_options.xml | 4 +- .../skins/default/xui/zh/floater_buy_currency.xml | 13 +- .../skins/default/xui/zh/floater_chat_history.xml | 71 +- .../skins/default/xui/zh/floater_clothing.xml | 9 - .../skins/default/xui/zh/floater_customize.xml | 448 +- .../skins/default/xui/zh/floater_directory.xml | 297 +- .../skins/default/xui/zh/floater_env_settings.xml | 4 +- .../skins/default/xui/zh/floater_group_info.xml | 3 +- .../default/xui/zh/floater_hardware_settings.xml | 16 +- .../default/xui/zh/floater_instant_message.xml | 85 +- .../xui/zh/floater_instant_message_ad_hoc.xml | 61 +- .../skins/default/xui/zh/floater_inventory.xml | 81 +- .../xui/zh/floater_inventory_item_properties.xml | 56 +- .../skins/default/xui/zh/floater_lagmeter.xml | 173 +- .../skins/default/xui/zh/floater_land_holdings.xml | 23 +- .../skins/default/xui/zh/floater_landmark_ctrl.xml | 2 +- .../default/xui/zh/floater_live_lsleditor.xml | 14 +- .../default/xui/zh/floater_name_description.xml | 2 +- .../skins/default/xui/zh/floater_post_process.xml | 18 +- .../skins/default/xui/zh/floater_postcard.xml | 29 +- .../default/xui/zh/floater_preview_gesture.xml | 58 +- .../skins/default/xui/zh/floater_report_abuse.xml | 78 +- .../default/xui/zh/floater_settings_debug.xml | 6 +- .../skins/default/xui/zh/floater_snapshot.xml | 111 +- .../skins/default/xui/zh/floater_sound_preview.xml | 2 +- .../newview/skins/default/xui/zh/floater_tools.xml | 511 +- .../skins/default/xui/zh/floater_top_objects.xml | 59 +- .../newview/skins/default/xui/zh/floater_water.xml | 283 +- .../default/xui/zh/floater_windlight_options.xml | 318 +- .../skins/default/xui/zh/floater_world_map.xml | 68 +- .../skins/default/xui/zh/menu_inventory.xml | 126 +- .../skins/default/xui/zh/menu_pie_object.xml | 35 +- .../newview/skins/default/xui/zh/menu_viewer.xml | 458 +- .../newview/skins/default/xui/zh/notifications.xml | 5956 +++++++++++++++++ .../indra/newview/skins/default/xui/zh/notify.xml | 1046 +-- .../newview/skins/default/xui/zh/panel_avatar.xml | 217 +- .../default/xui/zh/panel_avatar_classified.xml | 39 +- .../skins/default/xui/zh/panel_chat_bar.xml | 29 +- .../skins/default/xui/zh/panel_classified.xml | 31 +- .../newview/skins/default/xui/zh/panel_event.xml | 30 +- .../newview/skins/default/xui/zh/panel_friends.xml | 37 +- .../skins/default/xui/zh/panel_group_general.xml | 96 +- .../skins/default/xui/zh/panel_group_invite.xml | 31 +- .../default/xui/zh/panel_group_land_money.xml | 58 +- .../skins/default/xui/zh/panel_group_notices.xml | 35 +- .../skins/default/xui/zh/panel_group_roles.xml | 96 +- .../default/xui/zh/panel_media_remote_expanded.xml | 67 +- .../default/xui/zh/panel_preferences_audio.xml | 83 +- .../default/xui/zh/panel_preferences_general.xml | 141 +- .../default/xui/zh/panel_preferences_graphics1.xml | 218 +- .../skins/default/xui/zh/panel_preferences_im.xml | 8 +- .../default/xui/zh/panel_preferences_input.xml | 43 +- .../default/xui/zh/panel_preferences_network.xml | 27 +- .../skins/default/xui/zh/panel_region_general.xml | 11 +- .../default/xui/zh/panel_speaker_controls.xml | 85 +- .../skins/default/xui/zh/panel_status_bar.xml | 35 +- .../skins/default/xui/zh/panel_voice_options.xml | 47 +- .../newview/skins/default/xui/zh/role_actions.xml | 90 +- .../indra/newview/skins/default/xui/zh/strings.xml | 582 +- linden/indra/newview/skins/silver/colors_base.xml | 11 + .../skins/silver/xui/en-us/floater_about_land.xml | 384 +- .../skins/silver/xui/en-us/floater_directory.xml | 455 +- .../skins/silver/xui/en-us/floater_tools.xml | 275 +- linden/indra/newview/viewer_manifest.py | 50 +- linden/indra/test/CMakeLists.txt | 14 +- linden/indra/test/assembly_tut.cpp | 86 - linden/indra/test/common.cpp | 37 +- linden/indra/test/inventory.cpp | 3 +- linden/indra/test/io.cpp | 3 +- linden/indra/test/llapp_tut.cpp | 5 +- linden/indra/test/llassetuploadqueue_tut.cpp | 3 +- linden/indra/test/llbase64_tut.cpp | 3 +- linden/indra/test/llbitpack_tut.cpp | 5 +- linden/indra/test/llblowfish_tut.cpp | 15 +- linden/indra/test/llbuffer_tut.cpp | 5 +- linden/indra/test/llcontrol_tut.cpp | 5 +- linden/indra/test/lldatapacker_tut.cpp | 5 +- linden/indra/test/lldate_tut.cpp | 5 +- linden/indra/test/lldir_tut.cpp | 5 +- linden/indra/test/llerror_tut.cpp | 5 +- linden/indra/test/llhost_tut.cpp | 5 +- linden/indra/test/llhttpclient_tut.cpp | 7 +- linden/indra/test/llhttpdate_tut.cpp | 3 +- linden/indra/test/llhttpnode_tut.cpp | 6 +- linden/indra/test/llinventoryparcel_tut.cpp | 3 +- linden/indra/test/lliohttpserver_tut.cpp | 3 +- linden/indra/test/lljoint_tut.cpp | 5 +- linden/indra/test/llmessageconfig_tut.cpp | 3 +- linden/indra/test/llmessagetemplateparser_tut.cpp | 3 +- linden/indra/test/llmime_tut.cpp | 5 +- linden/indra/test/llmodularmath_tut.cpp | 5 +- linden/indra/test/llnamevalue_tut.cpp | 3 +- linden/indra/test/llpartdata_tut.cpp | 5 +- linden/indra/test/llpermissions_tut.cpp | 5 +- linden/indra/test/llpipeutil.cpp | 3 +- linden/indra/test/llpipeutil.h | 3 +- linden/indra/test/llquaternion_tut.cpp | 5 +- linden/indra/test/llrandom_tut.cpp | 5 +- linden/indra/test/llsaleinfo_tut.cpp | 7 +- linden/indra/test/llscriptresource_tut.cpp | 204 + linden/indra/test/llsd_new_tut.cpp | 5 +- linden/indra/test/llsdmessagebuilder_tut.cpp | 561 +- linden/indra/test/llsdmessagereader_tut.cpp | 5 +- linden/indra/test/llsdserialize_tut.cpp | 13 +- linden/indra/test/llsdtraits.h | 3 +- linden/indra/test/llsdutil_tut.cpp | 3 +- linden/indra/test/llservicebuilder_tut.cpp | 5 +- linden/indra/test/llstreamtools_tut.cpp | 5 +- linden/indra/test/llstring_tut.cpp | 13 +- linden/indra/test/lltemplatemessagebuilder_tut.cpp | 12 +- linden/indra/test/lltimestampcache_tut.cpp | 130 + linden/indra/test/lltiming_tut.cpp | 3 +- linden/indra/test/lltranscode_tut.cpp | 95 + linden/indra/test/lltut.cpp | 17 +- linden/indra/test/lltut.h | 15 +- linden/indra/test/lluri_tut.cpp | 3 +- linden/indra/test/lluserrelations_tut.cpp | 5 +- linden/indra/test/lluuidhashmap_tut.cpp | 5 +- linden/indra/test/llxfer_tut.cpp | 3 +- linden/indra/test/llxorcipher_tut.cpp | 3 +- linden/indra/test/m3math_tut.cpp | 5 +- linden/indra/test/mass_properties_tut.cpp | 25 +- linden/indra/test/math.cpp | 3 +- linden/indra/test/message_tut.cpp | 14 +- linden/indra/test/mock_http_client.cpp | 3 +- linden/indra/test/mock_http_client.h | 3 +- linden/indra/test/prim_linkability_tut.cpp | 25 +- linden/indra/test/reflection_tut.cpp | 5 +- linden/indra/test/test.cpp | 34 +- linden/indra/test/test.h | 50 + linden/indra/test/test_llmanifest.py | 3 +- linden/indra/test/v2math_tut.cpp | 5 +- linden/indra/test/v3color_tut.cpp | 7 +- linden/indra/test/v3dmath_tut.cpp | 7 +- linden/indra/test/v3math_tut.cpp | 5 +- linden/indra/test/v4color_tut.cpp | 5 +- linden/indra/test/v4coloru_tut.cpp | 5 +- linden/indra/test/v4math_tut.cpp | 5 +- linden/indra/test/xform_tut.cpp | 5 +- linden/indra/win_crash_logger/CMakeLists.txt | 9 +- linden/indra/win_crash_logger/StdAfx.cpp | 3 +- linden/indra/win_crash_logger/StdAfx.h | 3 +- .../win_crash_logger/llcrashloggerwindows.cpp | 7 +- .../indra/win_crash_logger/llcrashloggerwindows.h | 3 +- linden/indra/win_crash_logger/resource.h | 3 +- linden/indra/win_crash_logger/win_crash_logger.cpp | 3 +- linden/indra/win_crash_logger/win_crash_logger.h | 3 +- linden/indra/win_updater/CMakeLists.txt | 11 +- linden/indra/win_updater/updater.cpp | 15 +- linden/install.xml | 468 +- linden/scripts/install.py | 75 +- linden/scripts/messages/message_template.msg | 88 +- linden/scripts/setup-path.py | 3 +- linden/scripts/template_verifier.py | 40 +- 2865 files changed, 151856 insertions(+), 86498 deletions(-) delete mode 100644 linden/indra/cmake/CommonMiscLibs.cmake create mode 100644 linden/indra/cmake/FindMT.cmake create mode 100644 linden/indra/cmake/LLAddBuildTest.cmake create mode 100644 linden/indra/cmake/RunBuildTest.cmake create mode 100644 linden/indra/cmake/Tut.cmake create mode 100644 linden/indra/lib/python/uuid.py create mode 100644 linden/indra/llcharacter/llbvhconsts.h create mode 100644 linden/indra/llcommon/is_approx_equal_fraction.h create mode 100644 linden/indra/llcommon/llcursortypes.cpp create mode 100644 linden/indra/llcommon/llcursortypes.h delete mode 100644 linden/indra/llmedia/llmediaimplgstreamer_syms_rawa.inc create mode 100644 linden/indra/llmessage/llhttpclientadapter.cpp create mode 100644 linden/indra/llmessage/llhttpclientadapter.h create mode 100644 linden/indra/llmessage/llhttpclientinterface.h create mode 100644 linden/indra/llmessage/llhttpnodeadapter.h create mode 100644 linden/indra/llmessage/llmessagesenderinterface.h create mode 100644 linden/indra/llmessage/llregionpresenceverifier.cpp create mode 100644 linden/indra/llmessage/llregionpresenceverifier.h create mode 100644 linden/indra/llmessage/llstoredmessage.cpp create mode 100644 linden/indra/llmessage/llstoredmessage.h create mode 100644 linden/indra/llmessage/lltemplatemessagedispatcher.cpp create mode 100644 linden/indra/llmessage/lltemplatemessagedispatcher.h create mode 100644 linden/indra/llmessage/lltrustedmessageservice.cpp create mode 100644 linden/indra/llmessage/lltrustedmessageservice.h delete mode 100644 linden/indra/llmessage/network.cpp delete mode 100644 linden/indra/llmessage/network.h create mode 100644 linden/indra/llrender/llfontbitmapcache.cpp create mode 100644 linden/indra/llrender/llfontbitmapcache.h create mode 100644 linden/indra/llrender/llfontregistry.cpp create mode 100644 linden/indra/llrender/llfontregistry.h create mode 100644 linden/indra/llui/llfunctorregistry.cpp create mode 100644 linden/indra/llui/llfunctorregistry.h create mode 100644 linden/indra/llui/llnotifications.cpp create mode 100644 linden/indra/llui/llnotifications.h create mode 100644 linden/indra/llui/llprogressbar.cpp create mode 100644 linden/indra/llui/llprogressbar.h create mode 100644 linden/indra/llui/lltextparser.cpp create mode 100644 linden/indra/llui/lltextparser.h create mode 100644 linden/indra/llui/lluitrans.cpp create mode 100644 linden/indra/llui/lluitrans.h create mode 100755 linden/indra/llvfs/llpidlock.cpp create mode 100755 linden/indra/llvfs/llpidlock.h create mode 100644 linden/indra/llxml/llcontrolgroupreader.h create mode 100644 linden/indra/lscript/llscriptresource.h create mode 100644 linden/indra/lscript/llscriptresourceconsumer.h create mode 100644 linden/indra/lscript/llscriptresourcepool.h create mode 100644 linden/indra/lscript/lscript_execute/llscriptresource.cpp create mode 100644 linden/indra/lscript/lscript_execute/llscriptresourceconsumer.cpp create mode 100644 linden/indra/lscript/lscript_execute/llscriptresourcepool.cpp create mode 100644 linden/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl create mode 100644 linden/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl create mode 100644 linden/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaF.glsl create mode 100644 linden/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaV.glsl create mode 100644 linden/indra/newview/app_settings/shaders/class1/deferred/avatarF.glsl create mode 100644 linden/indra/newview/app_settings/shaders/class1/deferred/avatarShadowF.glsl create mode 100644 linden/indra/newview/app_settings/shaders/class1/deferred/avatarShadowV.glsl create mode 100644 linden/indra/newview/app_settings/shaders/class1/deferred/avatarV.glsl create mode 100644 linden/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl create mode 100644 linden/indra/newview/app_settings/shaders/class1/deferred/blurLightV.glsl create mode 100644 linden/indra/newview/app_settings/shaders/class1/deferred/bumpF.glsl create mode 100644 linden/indra/newview/app_settings/shaders/class1/deferred/bumpV.glsl create mode 100644 linden/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl create mode 100644 linden/indra/newview/app_settings/shaders/class1/deferred/fullbrightV.glsl create mode 100644 linden/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl create mode 100644 linden/indra/newview/app_settings/shaders/class1/deferred/impostorV.glsl create mode 100644 linden/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl create mode 100644 linden/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl create mode 100644 linden/indra/newview/app_settings/shaders/class1/deferred/pointLightV.glsl create mode 100644 linden/indra/newview/app_settings/shaders/class1/deferred/shadowF.glsl create mode 100644 linden/indra/newview/app_settings/shaders/class1/deferred/shadowV.glsl create mode 100644 linden/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl create mode 100644 linden/indra/newview/app_settings/shaders/class1/deferred/softenLightV.glsl create mode 100644 linden/indra/newview/app_settings/shaders/class1/deferred/sunLightF.glsl create mode 100644 linden/indra/newview/app_settings/shaders/class1/deferred/sunLightV.glsl create mode 100644 linden/indra/newview/app_settings/shaders/class1/deferred/terrainF.glsl create mode 100644 linden/indra/newview/app_settings/shaders/class1/deferred/terrainV.glsl create mode 100644 linden/indra/newview/app_settings/shaders/class1/deferred/treeF.glsl create mode 100644 linden/indra/newview/app_settings/shaders/class1/deferred/treeV.glsl create mode 100644 linden/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl create mode 100644 linden/indra/newview/app_settings/shaders/class1/deferred/waterV.glsl delete mode 100644 linden/indra/newview/installers/darwin/firstlookslim-dmg/Applications-alias.r delete mode 100644 linden/indra/newview/installers/darwin/firstlookslim-dmg/_DS_Store delete mode 100644 linden/indra/newview/installers/darwin/firstlookslim-dmg/_VolumeIcon.icns delete mode 100644 linden/indra/newview/installers/darwin/firstlookslim-dmg/background.jpg create mode 100644 linden/indra/newview/installers/windows/install_icon.BMP create mode 100644 linden/indra/newview/installers/windows/install_icon.ico create mode 100644 linden/indra/newview/installers/windows/uninstall_icon.BMP create mode 100644 linden/indra/newview/installers/windows/uninstall_icon.ico create mode 100644 linden/indra/newview/linux_tools/client-readme-joystick.txt create mode 100644 linden/indra/newview/linux_tools/client-readme-voice.txt create mode 100644 linden/indra/newview/llagentaccess.cpp create mode 100644 linden/indra/newview/llagentaccess.h create mode 100644 linden/indra/newview/llfloaterbulkpermission.cpp create mode 100644 linden/indra/newview/llfloaterbulkpermission.h delete mode 100644 linden/indra/newview/llfloaterclothing.cpp delete mode 100644 linden/indra/newview/llfloaterclothing.h create mode 100644 linden/indra/newview/llfloaterfonttest.cpp create mode 100644 linden/indra/newview/llfloaterfonttest.h create mode 100644 linden/indra/newview/llfloaterhandler.cpp create mode 100644 linden/indra/newview/llfloaterhandler.h create mode 100644 linden/indra/newview/llfloaterhtmlcurrency.cpp create mode 100644 linden/indra/newview/llfloaterhtmlcurrency.h create mode 100644 linden/indra/newview/llfloaterhtmlsimple.cpp create mode 100644 linden/indra/newview/llfloaterhtmlsimple.h create mode 100644 linden/indra/newview/llfloaternotificationsconsole.cpp create mode 100644 linden/indra/newview/llfloaternotificationsconsole.h create mode 100644 linden/indra/newview/llfloaterobjectiminfo.cpp create mode 100644 linden/indra/newview/llfloaterobjectiminfo.h create mode 100644 linden/indra/newview/llfloaterperms.cpp create mode 100644 linden/indra/newview/llfloaterperms.h delete mode 100644 linden/indra/newview/llgenepool.cpp delete mode 100644 linden/indra/newview/llgenepool.h create mode 100644 linden/indra/newview/llloginhandler.cpp create mode 100644 linden/indra/newview/llloginhandler.h create mode 100644 linden/indra/newview/llproductinforequest.cpp create mode 100644 linden/indra/newview/llproductinforequest.h create mode 100644 linden/indra/newview/llvoavatardefines.cpp create mode 100644 linden/indra/newview/llvoavatardefines.h delete mode 100644 linden/indra/newview/skins/default/xui/de/floater_clothing.xml create mode 100644 linden/indra/newview/skins/default/xui/de/notifications.xml create mode 100644 linden/indra/newview/skins/default/xui/en-us/floater_bulk_perms.xml delete mode 100644 linden/indra/newview/skins/default/xui/en-us/floater_clothing.xml create mode 100644 linden/indra/newview/skins/default/xui/en-us/floater_font_test.xml create mode 100644 linden/indra/newview/skins/default/xui/en-us/floater_html_simple.xml delete mode 100644 linden/indra/newview/skins/default/xui/en-us/floater_import.xml create mode 100644 linden/indra/newview/skins/default/xui/en-us/floater_mini_map.xml create mode 100644 linden/indra/newview/skins/default/xui/en-us/floater_notification.xml create mode 100644 linden/indra/newview/skins/default/xui/en-us/floater_notifications_console.xml create mode 100644 linden/indra/newview/skins/default/xui/en-us/floater_object_im_info.xml create mode 100644 linden/indra/newview/skins/default/xui/en-us/floater_perm_prefs.xml create mode 100644 linden/indra/newview/skins/default/xui/en-us/floater_statistics.xml create mode 100644 linden/indra/newview/skins/default/xui/en-us/fonts.xml create mode 100644 linden/indra/newview/skins/default/xui/en-us/menu_mini_map.xml create mode 100644 linden/indra/newview/skins/default/xui/en-us/notifications.xml delete mode 100644 linden/indra/newview/skins/default/xui/en-us/panel_land_covenant.xml create mode 100644 linden/indra/newview/skins/default/xui/en-us/panel_mini_map.xml create mode 100644 linden/indra/newview/skins/default/xui/en-us/panel_notifications_channel.xml create mode 100644 linden/indra/newview/skins/default/xui/en-us/panel_progress.xml create mode 100644 linden/indra/newview/skins/default/xui/en-us/ui_strings.xml create mode 100644 linden/indra/newview/skins/default/xui/es/floater_active_speakers.xml create mode 100644 linden/indra/newview/skins/default/xui/es/floater_audio_volume.xml create mode 100644 linden/indra/newview/skins/default/xui/es/floater_beacons.xml create mode 100644 linden/indra/newview/skins/default/xui/es/floater_camera.xml create mode 100644 linden/indra/newview/skins/default/xui/es/floater_chatterbox.xml delete mode 100644 linden/indra/newview/skins/default/xui/es/floater_clothing.xml create mode 100644 linden/indra/newview/skins/default/xui/es/floater_day_cycle_options.xml create mode 100644 linden/indra/newview/skins/default/xui/es/floater_device_settings.xml create mode 100644 linden/indra/newview/skins/default/xui/es/floater_env_settings.xml create mode 100644 linden/indra/newview/skins/default/xui/es/floater_hardware_settings.xml create mode 100644 linden/indra/newview/skins/default/xui/es/floater_hud.xml create mode 100644 linden/indra/newview/skins/default/xui/es/floater_inspect.xml create mode 100644 linden/indra/newview/skins/default/xui/es/floater_instant_message_ad_hoc.xml create mode 100644 linden/indra/newview/skins/default/xui/es/floater_instant_message_group.xml create mode 100644 linden/indra/newview/skins/default/xui/es/floater_joystick.xml create mode 100644 linden/indra/newview/skins/default/xui/es/floater_lagmeter.xml create mode 100644 linden/indra/newview/skins/default/xui/es/floater_landmark_ctrl.xml create mode 100644 linden/indra/newview/skins/default/xui/es/floater_lsl_guide.xml create mode 100644 linden/indra/newview/skins/default/xui/es/floater_media_browser.xml create mode 100644 linden/indra/newview/skins/default/xui/es/floater_mem_leaking.xml create mode 100644 linden/indra/newview/skins/default/xui/es/floater_mute_object.xml create mode 100644 linden/indra/newview/skins/default/xui/es/floater_my_friends.xml create mode 100644 linden/indra/newview/skins/default/xui/es/floater_post_process.xml create mode 100644 linden/indra/newview/skins/default/xui/es/floater_preview_classified.xml create mode 100644 linden/indra/newview/skins/default/xui/es/floater_preview_event.xml create mode 100644 linden/indra/newview/skins/default/xui/es/floater_preview_url.xml create mode 100644 linden/indra/newview/skins/default/xui/es/floater_region_info.xml create mode 100644 linden/indra/newview/skins/default/xui/es/floater_select_key.xml create mode 100644 linden/indra/newview/skins/default/xui/es/floater_sim_release_message.xml create mode 100644 linden/indra/newview/skins/default/xui/es/floater_skin_preview_template.xml create mode 100644 linden/indra/newview/skins/default/xui/es/floater_test.xml create mode 100644 linden/indra/newview/skins/default/xui/es/floater_url_entry.xml create mode 100644 linden/indra/newview/skins/default/xui/es/floater_water.xml create mode 100644 linden/indra/newview/skins/default/xui/es/floater_windlight_options.xml create mode 100644 linden/indra/newview/skins/default/xui/es/menu_login.xml create mode 100644 linden/indra/newview/skins/default/xui/es/menu_slurl.xml create mode 100644 linden/indra/newview/skins/default/xui/es/mime_types.xml create mode 100644 linden/indra/newview/skins/default/xui/es/notifications.xml create mode 100644 linden/indra/newview/skins/default/xui/es/panel_audio.xml create mode 100644 linden/indra/newview/skins/default/xui/es/panel_audio_device.xml create mode 100644 linden/indra/newview/skins/default/xui/es/panel_friends.xml create mode 100644 linden/indra/newview/skins/default/xui/es/panel_groups.xml create mode 100644 linden/indra/newview/skins/default/xui/es/panel_master_volume.xml create mode 100644 linden/indra/newview/skins/default/xui/es/panel_media_controls.xml create mode 100644 linden/indra/newview/skins/default/xui/es/panel_media_remote_expanded.xml create mode 100644 linden/indra/newview/skins/default/xui/es/panel_preferences_skins.xml create mode 100644 linden/indra/newview/skins/default/xui/es/panel_preferences_voice.xml create mode 100644 linden/indra/newview/skins/default/xui/es/panel_preferences_web.xml create mode 100644 linden/indra/newview/skins/default/xui/es/panel_speaker_controls.xml create mode 100644 linden/indra/newview/skins/default/xui/es/panel_voice_controls.xml create mode 100644 linden/indra/newview/skins/default/xui/es/panel_voice_enable.xml create mode 100644 linden/indra/newview/skins/default/xui/es/panel_voice_options.xml create mode 100644 linden/indra/newview/skins/default/xui/es/panel_voice_remote_expanded.xml create mode 100644 linden/indra/newview/skins/default/xui/es/strings.xml create mode 100644 linden/indra/newview/skins/default/xui/es/teleport_strings.xml create mode 100644 linden/indra/newview/skins/default/xui/fr/floater_bulk_perms.xml delete mode 100644 linden/indra/newview/skins/default/xui/fr/floater_clothing.xml create mode 100644 linden/indra/newview/skins/default/xui/fr/floater_font_test.xml create mode 100644 linden/indra/newview/skins/default/xui/fr/floater_notification.xml create mode 100644 linden/indra/newview/skins/default/xui/fr/floater_notifications_console.xml create mode 100644 linden/indra/newview/skins/default/xui/fr/floater_object_im_info.xml create mode 100644 linden/indra/newview/skins/default/xui/fr/floater_perm_prefs.xml create mode 100644 linden/indra/newview/skins/default/xui/fr/fonts.xml create mode 100644 linden/indra/newview/skins/default/xui/fr/notifications.xml create mode 100644 linden/indra/newview/skins/default/xui/fr/panel_notifications_channel.xml create mode 100644 linden/indra/newview/skins/default/xui/fr/ui_strings.xml create mode 100644 linden/indra/newview/skins/default/xui/ja/floater_bulk_perms.xml delete mode 100644 linden/indra/newview/skins/default/xui/ja/floater_clothing.xml create mode 100644 linden/indra/newview/skins/default/xui/ja/floater_notification.xml create mode 100644 linden/indra/newview/skins/default/xui/ja/floater_notifications_console.xml create mode 100644 linden/indra/newview/skins/default/xui/ja/floater_object_im_info.xml create mode 100644 linden/indra/newview/skins/default/xui/ja/floater_perm_prefs.xml create mode 100644 linden/indra/newview/skins/default/xui/ja/notifications.xml create mode 100644 linden/indra/newview/skins/default/xui/ja/panel_notifications_channel.xml create mode 100644 linden/indra/newview/skins/default/xui/ja/ui_strings.xml delete mode 100644 linden/indra/newview/skins/default/xui/ko/floater_clothing.xml create mode 100644 linden/indra/newview/skins/default/xui/ko/notifications.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/alerts.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_about.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_about_land.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_active_speakers.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_animation_preview.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_auction.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_audio_volume.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_avatar_picker.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_avatar_textures.xml create mode 100644 linden/indra/newview/skins/default/xui/pl/floater_beacons.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_build_options.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_bumps.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_buy_contents.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_buy_currency.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_buy_land.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_buy_object.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_camera.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_chat_history.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_chatterbox.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_choose_group.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_color_picker.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_critical.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_customize.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_day_cycle_options.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_device_settings.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_directory.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_env_settings.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_gesture.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_god_tools.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_group_info.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_hardware_settings.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_html.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_hud.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_im.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_image_preview.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_import.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_inspect.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_instant_message.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_instant_message_ad_hoc.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_instant_message_group.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_inventory.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_inventory_item_properties.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_inventory_view_finder.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_joystick.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_lagmeter.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_land_holdings.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_landmark_ctrl.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_live_lsleditor.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_lsl_guide.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_media_browser.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_mem_leaking.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_moveview.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_mute.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_mute_object.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_my_friends.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_name_description.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_new_im.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_new_outfit_dialog.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_openobject.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_pay.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_pay_object.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_post_process.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_postcard.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_preferences.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_preview_animation.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_preview_classified.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_preview_embedded_texture.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_preview_event.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_preview_existing_landmark.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_preview_gesture.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_preview_notecard.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_preview_notecard_keep_discard.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_preview_sound.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_preview_texture.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_preview_texture_keep_discard.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_preview_url.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_price_for_listing.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_profile.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_region_info.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_report_abuse.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_report_bug.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_script_debug.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_script_ed_panel.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_script_preview.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_script_queue.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_script_search.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_select_key.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_sell_land.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_settings_debug.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_sim_release_message.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_skin_preview_template.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_snapshot.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_sound_preview.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_telehub.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_test.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_texture_ctrl.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_tools.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_top_objects.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_tos.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_url_entry.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_voice_wizard.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_water.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_wearable_save_as.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_windlight_options.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/floater_world_map.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/menu_inventory.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/menu_login.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/menu_pie_attachment.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/menu_pie_avatar.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/menu_pie_land.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/menu_pie_object.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/menu_pie_self.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/menu_slurl.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/menu_viewer.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/mime_types.xml create mode 100644 linden/indra/newview/skins/default/xui/pl/notifications.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/notify.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/panel_audio.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/panel_audio_device.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/panel_avatar.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/panel_avatar_classified.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/panel_avatar_pick.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/panel_chat_bar.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/panel_classified.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/panel_event.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/panel_friends.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/panel_group.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/panel_group_finder.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/panel_group_general.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/panel_group_invite.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/panel_group_land_money.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/panel_group_notices.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/panel_group_roles.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/panel_group_voting.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/panel_groups.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/panel_land_covenant.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/panel_login.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/panel_master_volume.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/panel_media_controls.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/panel_media_remote.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/panel_media_remote_expanded.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/panel_overlaybar.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/panel_place.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/panel_place_small.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/panel_preferences_audio.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/panel_preferences_chat.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/panel_preferences_general.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/panel_preferences_graphics1.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/panel_preferences_im.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/panel_preferences_input.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/panel_preferences_network.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/panel_preferences_popups.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/panel_preferences_skins.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/panel_preferences_voice.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/panel_preferences_web.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/panel_region_covenant.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/panel_region_debug.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/panel_region_estate.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/panel_region_general.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/panel_region_terrain.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/panel_region_texture.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/panel_scrolling_param.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/panel_speaker_controls.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/panel_status_bar.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/panel_toolbar.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/panel_top_pick.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/panel_voice_controls.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/panel_voice_enable.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/panel_voice_options.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/panel_voice_remote.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/panel_voice_remote_expanded.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/role_actions.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/strings.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/teleport_strings.xml create mode 100755 linden/indra/newview/skins/default/xui/pl/xui_version.xml create mode 100644 linden/indra/newview/skins/default/xui/pt/floater_audio_volume.xml create mode 100644 linden/indra/newview/skins/default/xui/pt/floater_chatterbox.xml delete mode 100644 linden/indra/newview/skins/default/xui/pt/floater_clothing.xml create mode 100644 linden/indra/newview/skins/default/xui/pt/floater_device_settings.xml create mode 100644 linden/indra/newview/skins/default/xui/pt/floater_my_friends.xml create mode 100644 linden/indra/newview/skins/default/xui/pt/floater_post_process.xml create mode 100644 linden/indra/newview/skins/default/xui/pt/floater_select_key.xml create mode 100644 linden/indra/newview/skins/default/xui/pt/floater_skin_preview_template.xml create mode 100644 linden/indra/newview/skins/default/xui/pt/notifications.xml create mode 100644 linden/indra/newview/skins/default/xui/pt/panel_audio.xml create mode 100644 linden/indra/newview/skins/default/xui/pt/panel_groups.xml create mode 100644 linden/indra/newview/skins/default/xui/pt/panel_master_volume.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/alerts.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_about.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_about_land.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_active_speakers.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_animation_preview.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_auction.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_audio_volume.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_avatar_picker.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_avatar_textures.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_build_options.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_bumps.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_buy_contents.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_buy_currency.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_buy_land.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_buy_object.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_camera.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_chat_history.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_chatterbox.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_choose_group.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_color_picker.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_critical.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_customize.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_day_cycle_options.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_device_settings.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_directory.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_env_settings.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_gesture.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_god_tools.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_group_info.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_hardware_settings.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_html.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_hud.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_im.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_image_preview.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_import.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_inspect.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_instant_message.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_instant_message_ad_hoc.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_instant_message_group.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_inventory.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_inventory_item_properties.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_inventory_view_finder.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_joystick.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_lagmeter.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_land_holdings.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_landmark_ctrl.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_live_lsleditor.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_lsl_guide.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_media_browser.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_moveview.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_mute.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_mute_object.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_my_friends.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_name_description.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_new_im.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_new_outfit_dialog.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_openobject.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_pay.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_pay_object.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_post_process.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_postcard.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_preferences.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_preview_animation.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_preview_classified.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_preview_embedded_texture.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_preview_event.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_preview_existing_landmark.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_preview_gesture.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_preview_notecard.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_preview_notecard_keep_discard.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_preview_sound.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_preview_texture.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_preview_texture_keep_discard.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_preview_url.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_price_for_listing.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_profile.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_region_info.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_report_abuse.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_report_bug.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_script_debug.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_script_ed_panel.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_script_preview.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_script_queue.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_script_search.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_select_key.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_sell_land.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_settings_debug.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_sim_release_message.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_skin_preview_template.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_snapshot.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_sound_preview.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_telehub.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_test.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_texture_ctrl.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_tools.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_top_objects.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_tos.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_url_entry.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_voice_wizard.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_water.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_wearable_save_as.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_windlight_options.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/floater_world_map.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/menu_inventory.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/menu_login.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/menu_pie_attachment.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/menu_pie_avatar.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/menu_pie_land.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/menu_pie_object.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/menu_pie_self.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/menu_slurl.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/menu_viewer.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/mime_types.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/notifications.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/notify.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/panel_audio.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/panel_audio_device.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/panel_avatar.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/panel_avatar_classified.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/panel_avatar_pick.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/panel_chat_bar.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/panel_classified.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/panel_event.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/panel_friends.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/panel_group.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/panel_group_finder.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/panel_group_general.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/panel_group_invite.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/panel_group_land_money.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/panel_group_notices.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/panel_group_roles.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/panel_group_voting.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/panel_groups.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/panel_land_covenant.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/panel_login.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/panel_master_volume.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/panel_media_controls.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/panel_media_remote.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/panel_media_remote_expanded.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/panel_overlaybar.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/panel_place.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/panel_place_small.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/panel_preferences_audio.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/panel_preferences_chat.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/panel_preferences_general.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/panel_preferences_graphics1.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/panel_preferences_im.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/panel_preferences_input.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/panel_preferences_network.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/panel_preferences_popups.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/panel_preferences_skins.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/panel_preferences_voice.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/panel_preferences_web.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/panel_region_covenant.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/panel_region_debug.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/panel_region_estate.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/panel_region_general.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/panel_region_terrain.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/panel_region_texture.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/panel_scrolling_param.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/panel_speaker_controls.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/panel_status_bar.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/panel_toolbar.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/panel_top_pick.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/panel_voice_controls.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/panel_voice_enable.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/panel_voice_options.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/panel_voice_remote.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/panel_voice_remote_expanded.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/role_actions.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/strings.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/teleport_strings.xml create mode 100644 linden/indra/newview/skins/default/xui/ru/xui_version.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/alerts.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_about.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_about_land.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_active_speakers.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_animation_preview.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_auction.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_audio_volume.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_avatar_picker.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_avatar_textures.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_build_options.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_bumps.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_buy_contents.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_buy_currency.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_buy_land.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_buy_object.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_camera.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_chat_history.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_chatterbox.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_choose_group.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_color_picker.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_critical.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_customize.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_day_cycle_options.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_device_settings.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_directory.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_env_settings.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_gesture.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_god_tools.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_group_info.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_hardware_settings.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_html.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_hud.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_im.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_image_preview.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_import.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_inspect.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_instant_message.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_instant_message_ad_hoc.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_instant_message_group.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_inventory.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_inventory_item_properties.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_inventory_view_finder.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_joystick.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_lagmeter.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_land_holdings.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_landmark_ctrl.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_live_lsleditor.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_lsl_guide.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_media_browser.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_moveview.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_mute.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_mute_object.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_my_friends.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_name_description.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_new_im.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_new_outfit_dialog.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_openobject.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_pay.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_pay_object.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_post_process.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_postcard.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_preferences.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_preview_animation.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_preview_classified.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_preview_embedded_texture.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_preview_event.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_preview_existing_landmark.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_preview_gesture.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_preview_notecard.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_preview_notecard_keep_discard.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_preview_sound.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_preview_texture.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_preview_texture_keep_discard.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_preview_url.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_price_for_listing.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_profile.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_region_info.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_report_abuse.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_report_bug.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_script_debug.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_script_ed_panel.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_script_preview.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_script_queue.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_script_search.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_select_key.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_sell_land.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_settings_debug.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_sim_release_message.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_skin_preview_template.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_snapshot.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_sound_preview.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_telehub.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_test.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_texture_ctrl.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_tools.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_top_objects.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_tos.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_url_entry.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_voice_wizard.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_water.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_wearable_save_as.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_windlight_options.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/floater_world_map.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/menu_inventory.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/menu_login.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/menu_pie_attachment.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/menu_pie_avatar.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/menu_pie_land.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/menu_pie_object.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/menu_pie_self.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/menu_slurl.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/menu_viewer.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/mime_types.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/notifications.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/notify.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/panel_audio.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/panel_audio_device.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/panel_avatar.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/panel_avatar_classified.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/panel_avatar_pick.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/panel_chat_bar.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/panel_classified.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/panel_event.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/panel_friends.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/panel_group.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/panel_group_finder.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/panel_group_general.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/panel_group_invite.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/panel_group_land_money.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/panel_group_notices.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/panel_group_roles.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/panel_group_voting.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/panel_groups.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/panel_land_covenant.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/panel_login.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/panel_master_volume.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/panel_media_controls.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/panel_media_remote.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/panel_media_remote_expanded.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/panel_overlaybar.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/panel_place.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/panel_place_small.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/panel_preferences_audio.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/panel_preferences_chat.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/panel_preferences_general.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/panel_preferences_graphics1.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/panel_preferences_im.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/panel_preferences_input.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/panel_preferences_network.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/panel_preferences_popups.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/panel_preferences_skins.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/panel_preferences_voice.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/panel_preferences_web.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/panel_region_covenant.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/panel_region_debug.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/panel_region_estate.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/panel_region_general.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/panel_region_terrain.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/panel_region_texture.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/panel_scrolling_param.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/panel_speaker_controls.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/panel_status_bar.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/panel_toolbar.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/panel_top_pick.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/panel_voice_controls.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/panel_voice_enable.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/panel_voice_options.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/panel_voice_remote.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/panel_voice_remote_expanded.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/role_actions.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/strings.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/teleport_strings.xml create mode 100644 linden/indra/newview/skins/default/xui/uk/xui_version.xml delete mode 100644 linden/indra/newview/skins/default/xui/zh/floater_clothing.xml create mode 100644 linden/indra/newview/skins/default/xui/zh/notifications.xml delete mode 100644 linden/indra/test/assembly_tut.cpp create mode 100644 linden/indra/test/llscriptresource_tut.cpp create mode 100644 linden/indra/test/lltimestampcache_tut.cpp create mode 100644 linden/indra/test/lltranscode_tut.cpp create mode 100644 linden/indra/test/test.h (limited to 'linden') diff --git a/linden/doc/contributions.txt b/linden/doc/contributions.txt index 5cc26c2..2b55e5e 100644 --- a/linden/doc/contributions.txt +++ b/linden/doc/contributions.txt @@ -1,4 +1,3 @@ - Linden Lab would like to acknowledge source code contributions from the following residents. The Second Life resident name is given below, along with the issue identifier corresponding to the patches we've @@ -10,16 +9,35 @@ Able Whitman VWR-1460 VWR-1691 VWR-1735 + VWR-1813 Adam Marker VWR-2755 +Agathos Frascati + CT-246 Aimee Trescothick - VWR-3336 + VWR-1813 + VWR-3321 + VWR-3336 VWR-3903 VWR-4083 - VWR-7109 + VWR-6348 + VWR-6358 + VWR-6360 + VWR-6550 + VWR-6583 + VWR-6482 + VWR-7109 + VWR-7383 + VWR-8341 + VWR-8430 + VWR-8482 VWR-9255 + VWR-11844 Alejandro Rosenthal VWR-1184 +Aleric Inglewood + VWR-10759 + VWR-10837 Alissa Sabre VWR-81 VWR-83 @@ -41,34 +59,48 @@ Alissa Sabre VWR-1351 VWR-1353 VWR-1410 + VWR-1843 VWR-2116 VWR-2826 VWR-3290 + VWR-3410 VWR-3857 VWR-4010 - VWR-3410 - VWR-6386 + VWR-5575 + VWR-5929 VWR-6384 VWR-6385 - VWR-5929 + VWR-6386 VWR-6430 - VWR-1843 + VWR-6858 VWR-6668 + VWR-7086 + VWR-7087 VWR-7153 VWR-7168 - VWR-7087 - VWR-7086 + VWR-9190 VWR-10728 Angus Boyd VWR-592 +Ann Congrejo + CT-193 Argent Stonecutter VWR-68 Asuka Neely - VWR-3434 + VWR-3434 + VWR-8179 Balp Allen - VWR-4157 + VWR-4157 Benja Kepler VWR-746 +Biancaluce Robbiani + CT-225 + CT-226 + CT-227 + CT-228 + CT-229 + CT-230 + CT-231 Blakar Ogre VWR-418 VWR-881 @@ -81,15 +113,28 @@ blino Nakamura Boroondas Gupte VWR-233 WEB-262 +Bulli Schumann + CT-218 + CT-219 + CT-220 + CT-221 + CT-222 + CT-223 + CT-224 bushing Spatula VWR-119 VWR-424 Carjay McGinnis VWR-3737 VWR-4070 + VWR-4212 VWR-6154 Catherine Pfeffer VWR-1282 + VWR-8624 +Celierra Darling + VWR-1274 + VWR-6975 Dale Glass VWR-120 VWR-560 @@ -131,6 +176,8 @@ Feep Larsson VWR-447 VWR-1314 VWR-4444 +Flemming Congrejo + CT-193 Fluf Fredriksson VWR-3450 Fremont Cunningham @@ -138,8 +185,6 @@ Fremont Cunningham Geneko Nemeth CT-117 VWR-11069 -Gudmund Shepherd - VWR-1873 Gigs Taggart SVC-493 VWR-6 @@ -160,6 +205,7 @@ Gigs Taggart VWR-2491 VWR-2502 VWR-2331 + VWR-8781 Ginko Bayliss VWR-4 Grazer Kline @@ -167,8 +213,11 @@ Grazer Kline VWR-2113 Gudmund Shepherd VWR-1594 + VWR-1873 Hamncheese Omlet VWR-333 +HappySmurf Papp + CT-193 Henri Beauchamp VWR-1320 VWR-1406 @@ -181,15 +230,18 @@ Hiro Sommambulist VWR-97 VWR-100 VWR-105 - VWR-108 VWR-118 VWR-132 VWR-136 VWR-143 Hoze Menges VWR-255 +Ian Kas + VWR-8780 (Russian localization) + [NO JIRA] (Ukranian localization) Iskar Ariantho VWR-1223 + VWR-11759 Jacek Antonelli VWR-165 VWR-188 @@ -199,15 +251,31 @@ Jacek Antonelli VWR-2448 VWR-3605 JB Kraft - VWR-5283 - VWR-7802 + VWR-5283 + VWR-7802 Joghert LeSabre VWR-64 Kage Pixel VWR-11 +Ken March + CT-245 +Kerutsen Sellery + VWR-1350 +Khyota Wulluf + VWR-9256 Kunnis Basiat VWR-82 VWR-102 +Lisa Lowe + CT-218 + CT-219 + CT-220 + CT-221 + CT-222 + CT-223 + CT-224 +Lockhart Cordoso + VWR-108 maciek marksman CT-86 march Korda @@ -218,10 +286,17 @@ Matthew Dowd VWR-1736 VWR-1737 VWR-1761 + VWR-2681 McCabe Maxsted VWR-1318 + VWR-4065 + VWR-4826 + VWR-7827 + VWR-7877 VWR-7893 + VWR-8080 VWR-8689 + VWR-9007 Michelle2 Zenovka VWR-2652 VWR-2662 @@ -231,11 +306,12 @@ Michelle2 Zenovka VWR-4331 VWR-4506 VWR-4981 + VWR-5082 VWR-5659 VWR-7831 VWR-8889 VWR-8310 - VWR-4022 + VWR-9499 Mm Alder VWR-3777 VWR-4794 @@ -299,6 +375,7 @@ Nicholaz Beresford VWR-1754 VWR-1769 VWR-1808 + VWR-1826 VWR-1861 VWR-1872 VWR-1968 @@ -313,7 +390,7 @@ Nicholaz Beresford Nounouch Hapmouche VWR-238 Patric Mills - VWR-2645 + VWR-2645 Paul Churchill VWR-20 VWR-493 @@ -321,6 +398,7 @@ Paul Churchill VWR-1567 VWR-1647 VWR-1880 + VWR-2072 Paula Innis VWR-30 VWR-293 @@ -332,16 +410,42 @@ Peekay Semyorka VWR-49 VWR-79 Peter Lameth - VWR-7331 + VWR-7331 +Pf Shan + CT-225 + CT-226 + CT-227 + CT-228 + CT-229 + CT-230 + CT-231 princess niven VWR-5733 CT-85 Renault Clio VWR-1976 +Ringo Tuxing + CT-225 + CT-226 + CT-227 + CT-228 + CT-229 + CT-230 + CT-231 Robin Cornelius VWR-2488 + VWR-9557 Ryozu Kojima + VWR-53 VWR-287 +Salahzar Stenvaag + CT-225 + CT-226 + CT-227 + CT-228 + CT-229 + CT-230 + CT-231 Sammy Frederix VWR-6186 Scrippy Scofield @@ -354,12 +458,21 @@ Seg Baphomet VWR-2662 VWR-3206 VWR-2488 +Sergen Davies + CT-225 + CT-226 + CT-227 + CT-228 + CT-229 + CT-230 + CT-231 SignpostMarv Martin VWR-153 VWR-154 VWR-155 VWR-218 VWR-373 + VWR-8357 Simon Nolan VWR-409 SpacedOut Frye @@ -390,10 +503,6 @@ Strife Onizuka VWR-183 VWR-2265 VWR-4111 -Teardrops Fall - VWR-5366 -tenebrous pau - VWR-247 TBBle Kurosawa VWR-938 VWR-941 @@ -402,6 +511,10 @@ TBBle Kurosawa VWR-945 VWR-1891 VWR-1892 +Teardrops Fall + VWR-5366 +tenebrous pau + VWR-247 Tharax Ferraris VWR-605 Thickbrick Sleaford @@ -409,6 +522,8 @@ Thickbrick Sleaford Thraxis Epsilon SVC-371 VWR-383 +tiamat bingyi + CT-246 Tue Torok CT-68 CT-69 @@ -416,24 +531,46 @@ Tue Torok CT-72 CT-73 CT-74 -Wilton Lundquist - VWR-7682 +Vadim Bigbear + VWR-2681 +Vixen Heron + VWR-2710 Whoops Babii VWR-631 VWR-1640 VWR-3340 + VWR-4800 + VWR-4802 + VWR-4804 + VWR-4805 + VWR-4806 + VWR-4808 + VWR-4809 + VWR-4811 + VWR-4815 + VWR-4816 + VWR-4818 VWR-5659 + VWR-8291 + VWR-8292 + VWR-8293 + VWR-8294 + VWR-8295 + VWR-8296 + VWR-8297 + VWR-8298 +Wilton Lundquist + VWR-7682 Zarkonnen Decosta VWR-253 Zi Ree + VWR-423 VWR-671 VWR-682 VWR-684 + VWR-9127 VWR-1140 Zipherius Turas VWR-76 VWR-77 -Kerutsen Sellery - VWR-1350 - diff --git a/linden/etc/message.xml b/linden/etc/message.xml index d833074..dd149dd 100644 --- a/linden/etc/message.xml +++ b/linden/etc/message.xml @@ -243,6 +243,24 @@ trusted-sender false + + + GodKickUser + + flavor + llsd + trusted-sender + false + + + RoutedMoneyBalanceReply + + flavor + llsd + trusted-sender + false + + EdgeDataPacket @@ -384,7 +402,23 @@ true - avatarnotesrequest + PlacesReply + + flavor + llsd + trusted-sender + true + + + DirLandReply + + flavor + llsd + trusted-sender + true + + + avatarnotesrequest service_name avatar-notes @@ -456,8 +490,16 @@ trusted-sender true - - CrossedRegion + + TeleportFailed + + flavor + llsd + trusted-sender + true + + + CrossedRegion flavor llsd @@ -506,6 +548,15 @@ false + RpcScriptRequestInboundForward + + flavor + llsd + trusted-sender + false + + + capBans diff --git a/linden/indra/CMakeLists.txt b/linden/indra/CMakeLists.txt index c473b94..d198115 100644 --- a/linden/indra/CMakeLists.txt +++ b/linden/indra/CMakeLists.txt @@ -7,13 +7,14 @@ # 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) +# This makes cmake 2.6 not complain about version 2.4 compatibility. +if (COMMAND cmake_policy) cmake_policy(SET CMP0003 OLD) -endif(COMMAND cmake_policy) +endif (COMMAND cmake_policy) -project(SecondLife) +set(ROOT_PROJECT_NAME "SecondLife" CACHE STRING + "The root project/makefile/solution name. Defaults to SecondLife.") +project(${ROOT_PROJECT_NAME}) set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake") @@ -66,14 +67,19 @@ if (VIEWER) if (LINUX) add_subdirectory(${VIEWER_PREFIX}linux_crash_logger) - add_dependencies(viewer linux-crash-logger) + add_dependencies(viewer linux-crash-logger-strip-target) 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) + # cmake EXISTS requires an absolute path, see indra/cmake/Variables.cmake + if (EXISTS ${VIEWER_DIR}win_setup) + add_subdirectory(${VIEWER_DIR}win_setup) + endif (EXISTS ${VIEWER_DIR}win_setup) add_subdirectory(${VIEWER_PREFIX}win_updater) + # add_dependencies(viewer windows-updater windows-setup windows-crash-logger) add_dependencies(viewer windows-updater windows-crash-logger) elseif (SOLARIS) add_subdirectory(solaris_crash_logger) diff --git a/linden/indra/cmake/00-Common.cmake b/linden/indra/cmake/00-Common.cmake index bf2d2c3..a4ea9ff 100644 --- a/linden/indra/cmake/00-Common.cmake +++ b/linden/indra/cmake/00-Common.cmake @@ -9,9 +9,9 @@ include(Variables) set(CMAKE_CXX_FLAGS_DEBUG "-D_DEBUG -DLL_DEBUG=1") set(CMAKE_CXX_FLAGS_RELEASE - "-DLL_RELEASE=1 -DLL_RELEASE_FOR_DOWNLOAD=1 -DNDEBUG") + "-DLL_RELEASE=1 -DLL_RELEASE_FOR_DOWNLOAD=1 -D_SECURE_SCL=0 -DNDEBUG") set(CMAKE_CXX_FLAGS_RELWITHDEBINFO - "-DLL_RELEASE=1 -DNDEBUG -DLL_RELEASE_WITH_DEBUG_INFO=1") + "-DLL_RELEASE=1 -D_SECURE_SCL=0 -DNDEBUG -DLL_RELEASE_WITH_DEBUG_INFO=1") # Don't bother with a MinSizeRel build. @@ -26,15 +26,18 @@ if (WINDOWS) # Don't build DLLs. set(BUILD_SHARED_LIBS OFF) - set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /Od /Zi /MTd" + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /Od /Zi /MDd" CACHE STRING "C++ compiler debug options" FORCE) set(CMAKE_CXX_FLAGS_RELWITHDEBINFO - "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /Od /Zi /MT" + "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /Od /Zi /MD" CACHE STRING "C++ compiler release-with-debug options" FORCE) set(CMAKE_CXX_FLAGS_RELEASE - "${CMAKE_CXX_FLAGS_RELEASE} ${LL_CXX_FLAGS} /O2 /Zi /MT" + "${CMAKE_CXX_FLAGS_RELEASE} ${LL_CXX_FLAGS} /O2 /Zi /MD" CACHE STRING "C++ compiler release options" FORCE) + set(CMAKE_CXX_STANDARD_LIBRARIES "") + set(CMAKE_C_STANDARD_LIBRARIES "") + add_definitions( /DLL_WINDOWS=1 /DUNICODE @@ -111,7 +114,8 @@ if (LINUX) # widespread of them. if (${CXX_VERSION} MATCHES "4.3") - add_definitions(-Wno-deprecated -Wno-parentheses) + add_definitions(-Wno-parentheses) + set(CMAKE_CXX_FLAGS "-Wno-deprecated ${CMAKE_CXX_FLAGS}") endif (${CXX_VERSION} MATCHES "4.3") # End of hacks. @@ -152,6 +156,8 @@ if (LINUX) if (VIEWER) add_definitions(-DAPPID=secondlife) add_definitions(-fvisibility=hidden) + # don't catch SIGCHLD in our base application class for the viewer - some of our 3rd party libs may need their *own* SIGCHLD handler to work. Sigh! The viewer doesn't need to catch SIGCHLD anyway. + add_definitions(-DLL_IGNORE_SIGCHLD) if (NOT STANDALONE) # this stops us requiring a really recent glibc at runtime add_definitions(-fno-stack-protector) @@ -177,7 +183,7 @@ endif (DARWIN) if (LINUX OR DARWIN) - set(GCC_WARNINGS "-Wall -Wno-sign-compare -Wno-trigraphs") + set(GCC_WARNINGS "-Wall -Wno-sign-compare -Wno-trigraphs -Wno-non-virtual-dtor") if (NOT GCC_DISABLE_FATAL_WARNINGS) set(GCC_WARNINGS "${GCC_WARNINGS} -Werror") diff --git a/linden/indra/cmake/APR.cmake b/linden/indra/cmake/APR.cmake index 523d8ee..25ee364 100644 --- a/linden/indra/cmake/APR.cmake +++ b/linden/indra/cmake/APR.cmake @@ -1,5 +1,3 @@ -# -*- cmake -*- - include(BerkeleyDB) include(Linking) include(Prebuilt) @@ -19,14 +17,14 @@ else (STANDALONE) debug ${ARCH_PREBUILT_DIRS_DEBUG}/apr-1.lib optimized ${ARCH_PREBUILT_DIRS_RELEASE}/apr-1.lib ) - set(APRUTIL_LIBRARIES - debug ${ARCH_PREBUILT_DIRS_DEBUG}/aprutil-1.lib - optimized ${ARCH_PREBUILT_DIRS_RELEASE}/aprutil-1.lib - ) set(APRICONV_LIBRARIES debug ${ARCH_PREBUILT_DIRS_DEBUG}/apriconv-1.lib optimized ${ARCH_PREBUILT_DIRS_RELEASE}/apriconv-1.lib ) + set(APRUTIL_LIBRARIES + debug ${ARCH_PREBUILT_DIRS_DEBUG}/aprutil-1.lib ${APRICONV_LIBRARIES} + optimized ${ARCH_PREBUILT_DIRS_RELEASE}/aprutil-1.lib ${APRICONV_LIBRARIES} + ) elseif (DARWIN) set(APR_LIBRARIES debug ${ARCH_PREBUILT_DIRS_DEBUG}/libapr-1.a diff --git a/linden/indra/cmake/Audio.cmake b/linden/indra/cmake/Audio.cmake index c6ccab2..d23bc2f 100644 --- a/linden/indra/cmake/Audio.cmake +++ b/linden/indra/cmake/Audio.cmake @@ -14,10 +14,18 @@ else (STANDALONE) 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) + set(OGG_LIBRARIES + optimized ogg_static + debug ogg_static_d) + set(VORBIS_LIBRARIES + optimized vorbis_static + debug vorbis_static_d) + set(VORBISENC_LIBRARIES + optimized vorbisenc_static + debug vorbisenc_static_d) + set(VORBISFILE_LIBRARIES + optimized vorbisfile_static + debug vorbisfile_static_d) else (WINDOWS) set(OGG_LIBRARIES ogg) set(VORBIS_LIBRARIES vorbis) diff --git a/linden/indra/cmake/Boost.cmake b/linden/indra/cmake/Boost.cmake index a7db67c..0578ae9 100644 --- a/linden/indra/cmake/Boost.cmake +++ b/linden/indra/cmake/Boost.cmake @@ -28,14 +28,14 @@ else (STANDALONE) 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}) + optimized libboost_program_options-vc80-mt-${BOOST_VERSION} + debug libboost_program_options-vc80-mt-gd-${BOOST_VERSION}) set(BOOST_REGEX_LIBRARY - optimized libboost_regex-vc80-mt-s-${BOOST_VERSION} - debug libboost_regex-vc80-mt-sgd-${BOOST_VERSION}) + optimized libboost_regex-vc80-mt-${BOOST_VERSION} + debug libboost_regex-vc80-mt-gd-${BOOST_VERSION}) set(BOOST_SIGNALS_LIBRARY - optimized libboost_signals-vc80-mt-s-${BOOST_VERSION} - debug libboost_signals-vc80-mt-sgd-${BOOST_VERSION}) + optimized libboost_signals-vc80-mt-${BOOST_VERSION} + debug libboost_signals-vc80-mt-gd-${BOOST_VERSION}) endif (MSVC71) elseif (DARWIN) set(BOOST_PROGRAM_OPTIONS_LIBRARY boost_program_options-mt) diff --git a/linden/indra/cmake/CommonMiscLibs.cmake b/linden/indra/cmake/CommonMiscLibs.cmake deleted file mode 100644 index 513acf3..0000000 --- a/linden/indra/cmake/CommonMiscLibs.cmake +++ /dev/null @@ -1,7 +0,0 @@ -# -*- cmake -*- -include(Prebuilt) - -if (NOT STANDALONE) - use_prebuilt_binary(tut) -endif(NOT STANDALONE) - diff --git a/linden/indra/cmake/CopyWinLibs.cmake b/linden/indra/cmake/CopyWinLibs.cmake index 92b5d71..b1291df 100644 --- a/linden/indra/cmake/CopyWinLibs.cmake +++ b/linden/indra/cmake/CopyWinLibs.cmake @@ -18,7 +18,6 @@ set(vivox_files 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 @@ -53,7 +52,6 @@ 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 @@ -112,34 +110,38 @@ if(EXISTS ${internal_llkdu_path}) ) 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}) + if (EXISTS "${debug_src_dir}/llkdu.dll") + 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}) + endif (EXISTS "${debug_src_dir}/llkdu.dll") + + if (EXISTS "${release_src_dir}/llkdu.dll") + 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 "${release_src_dir}/llkdu.dll") endif (EXISTS ${internal_llkdu_path}) @@ -150,6 +152,7 @@ if (MSVC80) PATHS [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0\\Setup\\VC;ProductDir]/redist/Debug_NonRedist/x86/Microsoft.VC80.DebugCRT NO_DEFAULT_PATH + NO_DEFAULT_PATH ) if(EXISTS ${debug_msvc8_redist_path}) @@ -172,6 +175,7 @@ if (MSVC80) PATHS [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0\\Setup\\VC;ProductDir]/redist/x86/Microsoft.VC80.CRT NO_DEFAULT_PATH + NO_DEFAULT_PATH ) if(EXISTS ${release_msvc8_redist_path}) diff --git a/linden/indra/cmake/FindMT.cmake b/linden/indra/cmake/FindMT.cmake new file mode 100644 index 0000000..5239a4c --- /dev/null +++ b/linden/indra/cmake/FindMT.cmake @@ -0,0 +1,15 @@ +#Find the windows manifest tool. + +FIND_PROGRAM(HAVE_MANIFEST_TOOL NAMES mt + PATHS + "$ENV{PROGRAMFILES}/Microsoft Visual Studio 8/VC/bin" + "$ENV{PROGRAMFILES}/Microsoft Visual Studio 8/Common7/Tools/Bin" + "$ENV{PROGRAMFILES}/Microsoft Visual Studio 8/SDK/v2.0/Bin") +IF(HAVE_MANIFEST_TOOL) + MESSAGE(STATUS "Found Mainfest Tool. Embedding custom manifests.") +ELSE(HAVE_MANIFEST_TOOL) + MESSAGE(FATAL_ERROR "Manifest tool, mt.exe, can't be found.") +ENDIF(HAVE_MANIFEST_TOOL) + +STRING(REPLACE "/MANIFEST" "/MANIFEST:NO" CMAKE_EXE_LINKER_FLAGS + ${CMAKE_EXE_LINKER_FLAGS}) diff --git a/linden/indra/cmake/GooglePerfTools.cmake b/linden/indra/cmake/GooglePerfTools.cmake index 25e9f6d..aff65cb 100644 --- a/linden/indra/cmake/GooglePerfTools.cmake +++ b/linden/indra/cmake/GooglePerfTools.cmake @@ -5,6 +5,11 @@ if (STANDALONE) include(FindGooglePerfTools) else (STANDALONE) use_prebuilt_binary(google) + if (WINDOWS) + set(TCMALLOC_LIBRARIES + debug libtcmalloc_minimal-debug + optimized libtcmalloc_minimal-debug) + endif (WINDOWS) if (LINUX) set(TCMALLOC_LIBRARIES tcmalloc) set(STACKTRACE_LIBRARIES stacktrace) diff --git a/linden/indra/cmake/JPEG.cmake b/linden/indra/cmake/JPEG.cmake index 5d0ee0d..9514d59 100644 --- a/linden/indra/cmake/JPEG.cmake +++ b/linden/indra/cmake/JPEG.cmake @@ -17,7 +17,7 @@ else (STANDALONE) debug ${ARCH_PREBUILT_DIRS_DEBUG}/liblljpeg.a ) elseif (WINDOWS) - set(JPEG_LIBRARIES jpeglib_6b) + set(JPEG_LIBRARIES jpeglib) endif (LINUX) set(JPEG_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include) endif (STANDALONE) diff --git a/linden/indra/cmake/LLAddBuildTest.cmake b/linden/indra/cmake/LLAddBuildTest.cmake new file mode 100644 index 0000000..08151bc --- /dev/null +++ b/linden/indra/cmake/LLAddBuildTest.cmake @@ -0,0 +1,154 @@ +# -*- cmake -*- + +INCLUDE(APR) +INCLUDE(LLMath) + +MACRO(ADD_BUILD_TEST_NO_COMMON name parent) +# MESSAGE("${CMAKE_CURRENT_SOURCE_DIR}/tests/${name}_test.cpp") + IF (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/tests/${name}_test.cpp") + SET(no_common_libraries + ${APRUTIL_LIBRARIES} + ${APR_LIBRARIES} + ${PTHREAD_LIBRARY} + ${WINDOWS_LIBRARIES} + ) + SET(no_common_source_files + ${name}.cpp + tests/${name}_test.cpp + ${CMAKE_SOURCE_DIR}/test/test.cpp + ) + ADD_BUILD_TEST_INTERNAL("${name}" "${parent}" "${no_common_libraries}" "${no_common_source_files}") + ENDIF (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/tests/${name}_test.cpp") +ENDMACRO(ADD_BUILD_TEST_NO_COMMON name parent) + + +MACRO(ADD_BUILD_TEST name parent) + # optional extra parameter: list of additional source files + SET(more_source_files "${ARGN}") + +# MESSAGE("${CMAKE_CURRENT_SOURCE_DIR}/tests/${name}_test.cpp") + IF (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/tests/${name}_test.cpp") + + SET(basic_libraries + ${LLCOMMON_LIBRARIES} + ${APRUTIL_LIBRARIES} + ${APR_LIBRARIES} + ${PTHREAD_LIBRARY} + ${WINDOWS_LIBRARIES} + ) + SET(basic_source_files + ${name}.cpp + tests/${name}_test.cpp + ${CMAKE_SOURCE_DIR}/test/test.cpp + ${CMAKE_SOURCE_DIR}/test/lltut.cpp + ${more_source_files} + ) + ADD_BUILD_TEST_INTERNAL("${name}" "${parent}" "${basic_libraries}" "${basic_source_files}") + + ENDIF (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/tests/${name}_test.cpp") +ENDMACRO(ADD_BUILD_TEST name parent) + + +MACRO(ADD_VIEWER_BUILD_TEST name parent) + # This is just like the generic ADD_BUILD_TEST, but we implicitly + # add the necessary precompiled header .cpp file (anyone else find that + # oxymoronic?) because the MSVC build errors will NOT point you there. + ADD_BUILD_TEST("${name}" "${parent}" llviewerprecompiledheaders.cpp) +ENDMACRO(ADD_VIEWER_BUILD_TEST name parent) + + +MACRO(ADD_SIMULATOR_BUILD_TEST name parent) + ADD_BUILD_TEST("${name}" "${parent}" llsimprecompiledheaders.cpp) + + if (WINDOWS) + SET_SOURCE_FILES_PROPERTIES( + "tests/${name}_test.cpp" + PROPERTIES + COMPILE_FLAGS "/Yullsimprecompiledheaders.h" + ) + endif (WINDOWS) +ENDMACRO(ADD_SIMULATOR_BUILD_TEST name parent) + +MACRO(ADD_BUILD_TEST_INTERNAL name parent libraries source_files) + # Optional additional parameter: pathname of Python wrapper script + SET(wrapper "${ARGN}") + #MESSAGE(STATUS "ADD_BUILD_TEST_INTERNAL ${name} wrapper = ${wrapper}") + + SET(TEST_SOURCE_FILES ${source_files}) + SET(HEADER "${name}.h") + set_source_files_properties(${HEADER} + PROPERTIES HEADER_FILE_ONLY TRUE) + LIST(APPEND TEST_SOURCE_FILES ${HEADER}) + INCLUDE_DIRECTORIES("${LIBS_OPEN_DIR}/test") + ADD_EXECUTABLE(${name}_test ${TEST_SOURCE_FILES}) + TARGET_LINK_LIBRARIES(${name}_test + ${libraries} + ) + + GET_TARGET_PROPERTY(TEST_EXE ${name}_test LOCATION) + SET(TEST_OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${name}_test_ok.txt) + + IF ("${wrapper}" STREQUAL "") + SET(TEST_CMD ${TEST_EXE} --touch=${TEST_OUTPUT} --sourcedir=${CMAKE_CURRENT_SOURCE_DIR}) + ELSE ("${wrapper}" STREQUAL "") + SET(TEST_CMD ${PYTHON_EXECUTABLE} ${wrapper} ${TEST_EXE} --touch=${TEST_OUTPUT} --sourcedir=${CMAKE_CURRENT_SOURCE_DIR}) + ENDIF ("${wrapper}" STREQUAL "") + + #MESSAGE(STATUS "ADD_BUILD_TEST_INTERNAL ${name} test_cmd = ${TEST_CMD}") + SET(TEST_SCRIPT_CMD + ${CMAKE_COMMAND} + -DLD_LIBRARY_PATH=${ARCH_PREBUILT_DIRS}:/usr/lib + -DTEST_CMD:STRING="${TEST_CMD}" + -P ${CMAKE_SOURCE_DIR}/cmake/RunBuildTest.cmake + ) + + #MESSAGE(STATUS "ADD_BUILD_TEST_INTERNAL ${name} test_script = ${TEST_SCRIPT_CMD}") + ADD_CUSTOM_COMMAND( + OUTPUT ${TEST_OUTPUT} + COMMAND ${TEST_SCRIPT_CMD} + DEPENDS ${name}_test + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + ) + + ADD_CUSTOM_TARGET(${name}_test_ok ALL DEPENDS ${TEST_OUTPUT}) + IF (${parent}) + ADD_DEPENDENCIES(${parent} ${name}_test_ok) + ENDIF (${parent}) + +ENDMACRO(ADD_BUILD_TEST_INTERNAL name parent libraries source_files) + + +MACRO(ADD_COMM_BUILD_TEST name parent wrapper) +## MESSAGE(STATUS "ADD_COMM_BUILD_TEST ${name} wrapper = ${wrapper}") + # optional extra parameter: list of additional source files + SET(more_source_files "${ARGN}") +## MESSAGE(STATUS "ADD_COMM_BUILD_TEST ${name} more_source_files = ${more_source_files}") + + SET(libraries + ${LLMESSAGE_LIBRARIES} + ${LLMATH_LIBRARIES} + ${LLVFS_LIBRARIES} + ${LLCOMMON_LIBRARIES} + ${APRUTIL_LIBRARIES} + ${APR_LIBRARIES} + ${PTHREAD_LIBRARY} + ${WINDOWS_LIBRARIES} + ) + SET(source_files + ${name}.cpp + tests/${name}_test.cpp + ${CMAKE_SOURCE_DIR}/test/test.cpp + ${CMAKE_SOURCE_DIR}/test/lltut.cpp + ${more_source_files} + ) + + ADD_BUILD_TEST_INTERNAL("${name}" "${parent}" "${libraries}" "${source_files}" "${wrapper}") +ENDMACRO(ADD_COMM_BUILD_TEST name parent wrapper) + +MACRO(ADD_VIEWER_COMM_BUILD_TEST name parent wrapper) + # This is just like the generic ADD_COMM_BUILD_TEST, but we implicitly + # add the necessary precompiled header .cpp file (anyone else find that + # oxymoronic?) because the MSVC build errors will NOT point you there. +## MESSAGE(STATUS "ADD_VIEWER_COMM_BUILD_TEST ${name} wrapper = ${wrapper}") + ADD_COMM_BUILD_TEST("${name}" "${parent}" "${wrapper}" llviewerprecompiledheaders.cpp) +ENDMACRO(ADD_VIEWER_COMM_BUILD_TEST name parent wrapper) diff --git a/linden/indra/cmake/LLAudio.cmake b/linden/indra/cmake/LLAudio.cmake index ff479f6..89b790c 100644 --- a/linden/indra/cmake/LLAudio.cmake +++ b/linden/indra/cmake/LLAudio.cmake @@ -6,11 +6,4 @@ set(LLAUDIO_INCLUDE_DIRS ${LIBS_OPEN_DIR}/llaudio ) -set(LLAUDIO_LIBRARIES - llaudio - ${VORBISENC_LIBRARIES} - ${VORBISFILE_LIBRARIES} - ${VORBIS_LIBRARIES} - ${OGG_LIBRARIES} - ${OPENAL_LIBRARIES} - ) +set(LLAUDIO_LIBRARIES llaudio ${OPENAL_LIBRARIES}) diff --git a/linden/indra/cmake/LLRender.cmake b/linden/indra/cmake/LLRender.cmake index bbcf4cd..c47e887 100644 --- a/linden/indra/cmake/LLRender.cmake +++ b/linden/indra/cmake/LLRender.cmake @@ -18,8 +18,8 @@ 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}) +macro (copy_server_sources ) + foreach (PREFIX ${ARGV}) add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${PREFIX}_server.cpp COMMAND ${CMAKE_COMMAND} diff --git a/linden/indra/cmake/LLWindow.cmake b/linden/indra/cmake/LLWindow.cmake index c0efa27..e749055 100644 --- a/linden/indra/cmake/LLWindow.cmake +++ b/linden/indra/cmake/LLWindow.cmake @@ -40,4 +40,9 @@ else (SERVER AND LINUX) set(LLWINDOW_LIBRARIES llwindow ) + if (WINDOWS) + list(APPEND LLWINDOW_LIBRARIES + comdlg32 + ) + endif (WINDOWS) endif (SERVER AND LINUX) diff --git a/linden/indra/cmake/Linking.cmake b/linden/indra/cmake/Linking.cmake index 167c5dd..2bddb95 100644 --- a/linden/indra/cmake/Linking.cmake +++ b/linden/indra/cmake/Linking.cmake @@ -32,11 +32,16 @@ endif (LINUX) if (WINDOWS) set(WINDOWS_LIBRARIES + advapi32 + shell32 ws2_32 mswsock psapi winmm netapi32 + wldap32 + gdi32 + user32 ) else (WINDOWS) set(WINDOWS_LIBRARIES "") diff --git a/linden/indra/cmake/NDOF.cmake b/linden/indra/cmake/NDOF.cmake index 3f715a2..dad74e9 100644 --- a/linden/indra/cmake/NDOF.cmake +++ b/linden/indra/cmake/NDOF.cmake @@ -3,12 +3,12 @@ include(Prebuilt) use_prebuilt_binary(ndofdev) -if (WINDOWS OR DARWIN) +if (WINDOWS OR DARWIN OR LINUX) add_definitions(-DLIB_NDOF=1) -endif (WINDOWS OR DARWIN) +endif (WINDOWS OR DARWIN OR LINUX) if (WINDOWS) set(NDOF_LIBRARY libndofdev) -elseif (DARWIN) +elseif (DARWIN OR LINUX) set(NDOF_LIBRARY ndofdev) endif (WINDOWS) diff --git a/linden/indra/cmake/OPENAL.cmake b/linden/indra/cmake/OPENAL.cmake index eb195a0..d01c680 100644 --- a/linden/indra/cmake/OPENAL.cmake +++ b/linden/indra/cmake/OPENAL.cmake @@ -15,7 +15,7 @@ if (OPENAL) pkg_check_modules(OPENAL_LIB REQUIRED openal) pkg_check_modules(FREEALUT_LIB REQUIRED freealut) else (STANDALONE) - use_prebuilt_binary(openal) + use_prebuilt_binary(openal-soft) endif (STANDALONE) set(OPENAL_LIBRARIES openal diff --git a/linden/indra/cmake/RunBuildTest.cmake b/linden/indra/cmake/RunBuildTest.cmake new file mode 100644 index 0000000..2da3e88 --- /dev/null +++ b/linden/indra/cmake/RunBuildTest.cmake @@ -0,0 +1,22 @@ +#This cmake script is meant to be run as a build time custom command. +#The script is run using cmake w/ the -P option. +# parameters are passed to this scripts execution with the -D option. +# A full command line would look like this: +# cmake -D LD_LIBRARY_PATH=~/checkout/libraries -D TEST_CMD=./llunit_test -D ARGS=--touch=llunit_test_ok.txt -P RunBuildTest.cmake + +# Parameters: +# LD_LIBRARY_PATH: string, What to set the LD_LIBRARY_PATH env var. +# TEST_CMD: string list, command to run the unit test with, followed by its args. +set(ENV{LD_LIBRARY_PATH} ${LD_LIBRARY_PATH}) +#message("Running: ${TEST_CMD}") +separate_arguments(TEST_CMD) +#message("Running: ${TEST_CMD}") +execute_process( + COMMAND ${TEST_CMD} + RESULT_VARIABLE RES + ) + +if(NOT ${RES} STREQUAL 0) + message(STATUS "Failure running: ${TEST_CMD}") + message(FATAL_ERROR "Error: ${RES}") +endif(NOT ${RES} STREQUAL 0) \ No newline at end of file diff --git a/linden/indra/cmake/Tut.cmake b/linden/indra/cmake/Tut.cmake new file mode 100644 index 0000000..7488e9d --- /dev/null +++ b/linden/indra/cmake/Tut.cmake @@ -0,0 +1,6 @@ +# -*- cmake -*- +include(Prebuilt) + +if (NOT STANDALONE) + use_prebuilt_binary(tut) +endif(NOT STANDALONE) diff --git a/linden/indra/cmake/ViewerMiscLibs.cmake b/linden/indra/cmake/ViewerMiscLibs.cmake index 68ee881..2a8abda 100644 --- a/linden/indra/cmake/ViewerMiscLibs.cmake +++ b/linden/indra/cmake/ViewerMiscLibs.cmake @@ -2,7 +2,6 @@ include(Prebuilt) if (NOT STANDALONE) - use_prebuilt_binary(libstdc++) use_prebuilt_binary(libuuid) use_prebuilt_binary(vivox) use_prebuilt_binary(fontconfig) diff --git a/linden/indra/cmake/ZLIB.cmake b/linden/indra/cmake/ZLIB.cmake index 80d4191..48e5130 100644 --- a/linden/indra/cmake/ZLIB.cmake +++ b/linden/indra/cmake/ZLIB.cmake @@ -10,11 +10,13 @@ if (STANDALONE) else (STANDALONE) use_prebuilt_binary(zlib) if (WINDOWS) - set(ZLIB_LIBRARIES zlib) + set(ZLIB_LIBRARIES + debug zlibd + optimized 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) + set(ZLIB_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include/zlib) endif (WINDOWS OR LINUX) endif (STANDALONE) diff --git a/linden/indra/develop.py b/linden/indra/develop.py index 29fe0e8..d1875c9 100755 --- a/linden/indra/develop.py +++ b/linden/indra/develop.py @@ -19,7 +19,8 @@ # 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 +# 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, @@ -75,6 +76,7 @@ class PlatformSetup(object): build_type = build_types['relwithdebinfo'] standalone = 'OFF' unattended = 'OFF' + project_name = 'SecondLife' distcc = True cmake_opts = [] @@ -127,24 +129,6 @@ class PlatformSetup(object): '-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.''' @@ -206,10 +190,28 @@ class PlatformSetup(object): return os.path.isdir(os.path.join(self.script_dir, 'newsim')) + def find_in_path(self, name, defval=None, basename=False): + for ext in self.exe_suffixes: + name_ext = name + ext + if os.sep in name_ext: + path = os.path.abspath(name_ext) + if os.access(path, os.X_OK): + return [basename and os.path.basename(path) or path] + for p in os.getenv('PATH', self.search_path).split(os.pathsep): + path = os.path.join(p, name_ext) + if os.access(path, os.X_OK): + return [basename and os.path.basename(path) or path] + if defval: + return [defval] + return [] + class UnixSetup(PlatformSetup): '''Generic Unixy build instructions.''' + search_path = '/usr/bin:/usr/local/bin' + exe_suffixes = ('',) + def __init__(self): super(UnixSetup, self).__init__() self.generator = 'Unix Makefiles' @@ -229,6 +231,25 @@ class UnixSetup(PlatformSetup): cpu = 'ppc' return cpu + 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): + st = os.WEXITSTATUS(ret) + if st == 127: + event = 'was not found' + else: + event = 'exited with status %d' % st + elif os.WIFSIGNALED(ret): + event = 'was killed by signal %d' % os.WTERMSIG(ret) + else: + event = 'died unexpectedly (!?) with 16-bit status %d' % ret + raise CommandError('the command %r %s' % + (name, event)) + class LinuxSetup(UnixSetup): def __init__(self): @@ -256,15 +277,6 @@ class LinuxSetup(UnixSetup): else: return ['viewer-' + platform_build] - 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, @@ -272,7 +284,8 @@ class LinuxSetup(UnixSetup): opts=quote(opts), standalone=self.standalone, unattended=self.unattended, - type=self.build_type.upper() + type=self.build_type.upper(), + project_name=self.project_name ) if not self.is_internal_tree(): args.update({'cxx':'g++', 'server':'OFF', 'viewer':'ON'}) @@ -298,6 +311,7 @@ class LinuxSetup(UnixSetup): '-G %(generator)r -DSERVER:BOOL=%(server)s ' '-DVIEWER:BOOL=%(viewer)s -DSTANDALONE:BOOL=%(standalone)s ' '-DUNATTENDED:BOOL=%(unattended)s ' + '-DROOT_PROJECT_NAME:STRING=%(project_name)s ' '%(opts)s %(dir)r') % args) if 'CXX' not in os.environ: @@ -400,6 +414,7 @@ class DarwinSetup(UnixSetup): opts=quote(opts), standalone=self.standalone, unattended=self.unattended, + project_name=self.project_name, universal='', type=self.build_type.upper() ) @@ -411,6 +426,7 @@ class DarwinSetup(UnixSetup): '-DCMAKE_BUILD_TYPE:STRING=%(type)s ' '-DSTANDALONE:BOOL=%(standalone)s ' '-DUNATTENDED:BOOL=%(unattended)s ' + '-DROOT_PROJECT_NAME:STRING=%(project_name)s ' '%(universal)s ' '%(opts)s %(dir)r' % args) @@ -451,6 +467,9 @@ class WindowsSetup(PlatformSetup): gens['vs2005'] = gens['vc80'] gens['vs2008'] = gens['vc90'] + search_path = r'C:\windows' + exe_suffixes = ('.exe', '.bat', '.com') + def __init__(self): super(WindowsSetup, self).__init__() self._generator = None @@ -486,12 +505,14 @@ class WindowsSetup(PlatformSetup): opts=quote(opts), standalone=self.standalone, unattended=self.unattended, + project_name=self.project_name ) #if simple: # return 'cmake %(opts)s "%(dir)s"' % args return ('cmake -G "%(generator)s" ' '-DSTANDALONE:BOOL=%(standalone)s ' '-DUNATTENDED:BOOL=%(unattended)s ' + '-DROOT_PROJECT_NAME:STRING=%(project_name)s ' '%(opts)s "%(dir)s"' % args) def find_visual_studio(self, gen=None): @@ -522,21 +543,24 @@ class WindowsSetup(PlatformSetup): if self.gens[self.generator]['ver'] in [ r'8.0', r'9.0' ]: config = '\"%s|Win32\"' % config - return "buildconsole Secondlife.sln /build %s" % config + return "buildconsole %s.sln /build %s" % (self.project_name, 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)) + return ('"%sdevenv.com" %s.sln /build %s' % + (self.find_visual_studio(), self.project_name, 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' % + path = self.find_in_path(name) + if not path: + ret = 'was not found' + else: + ret = 'exited with status %d' % ret + raise CommandError('the command %r %s' % (name, ret)) def run_cmake(self, args=[]): @@ -596,12 +620,14 @@ class CygwinSetup(WindowsSetup): opts=quote(opts), standalone=self.standalone, unattended=self.unattended, + project_name=self.project_name ) #if simple: # return 'cmake %(opts)s "%(dir)s"' % args return ('cmake -G "%(generator)s" ' '-DUNATTENDED:BOOl=%(unattended)s ' '-DSTANDALONE:BOOL=%(standalone)s ' + '-DROOT_PROJECT_NAME:STRING=%(project_name)s ' '%(opts)s "%(dir)s"' % args) setup_platform = { @@ -613,7 +639,7 @@ setup_platform = { usage_msg = ''' -Usage: develop.py [options] command [command-options] +Usage: develop.py [options] [command [command-options]] Options: -h | --help print this help message @@ -623,21 +649,29 @@ Options: -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) + Windows: VC71 or VS2003 (default), VC80 (VS2005) or + VC90 (VS2008) Mac OS X: Xcode (default), Unix Makefiles Linux: Unix Makefiles (default), KDevelop3 + -p | --project=NAME set the root project name. (Doesn't effect makefiles) + Commands: - build configure and build default target - clean delete all build directories (does not affect sources) - configure configure project by running cmake + build configure and build default target + clean delete all build directories, does not affect sources + configure configure project by running cmake (default command if none given) -If you do not specify a command, the default is "configure". +Command-options for "configure": + We use cmake variables to change the build configuration. + -DSERVER:BOOL=OFF Don't configure simulator/dataserver/etc + -DVIEWER:BOOL=OFF Don't configure the viewer + -DPACKAGE:BOOL=ON Create "package" target to make installers + -DLOCALIZESETUP:BOOL=ON Create one win_setup target per supported language Examples: Set up a viewer-only project for your system: develop.py configure -DSERVER:BOOL=OFF - Set up a Visual Studio 2005 project with package target (to build installer): + Set up a Visual Studio 2005 project with "package" target: develop.py -G vc80 configure -DPACKAGE:BOOL=ON ''' @@ -646,13 +680,14 @@ def main(arguments): try: opts, args = getopt.getopt( arguments, - '?hNt:G:', - ['help', 'standalone', 'no-distcc', 'unattended', 'type=', 'incredibuild', 'generator=']) + '?hNt:p:G:', + ['help', 'standalone', 'no-distcc', 'unattended', 'type=', 'incredibuild', 'generator=', 'project=']) except getopt.GetoptError, err: print >> sys.stderr, 'Error:', err print >> sys.stderr, """ Note: You must pass -D options to cmake after the "configure" command For example: develop.py configure -DSERVER:BOOL=OFF""" + print >> sys.stderr, usage_msg.strip() sys.exit(1) for o, a in opts: @@ -678,6 +713,8 @@ For example: develop.py configure -DSERVER:BOOL=OFF""" setup.generator = a elif o in ('-N', '--no-distcc'): setup.distcc = False + elif o in ('-p', '--project'): + setup.project_name = a elif o in ('--incredibuild'): setup.incredibuild = True else: diff --git a/linden/indra/lib/python/indra/base/config.py b/linden/indra/lib/python/indra/base/config.py index d6866fd..adafa29 100644 --- a/linden/indra/lib/python/indra/base/config.py +++ b/linden/indra/lib/python/indra/base/config.py @@ -27,6 +27,7 @@ $/LicenseInfo$ """ import copy +import errno import os import traceback import time @@ -62,6 +63,8 @@ class IndraConfig(object): self._load() def _load(self): + # if you initialize the IndraConfig with None, no attempt + # is made to load any files if self._indra_config_file is None: return @@ -164,22 +167,36 @@ class IndraConfig(object): """ return copy.deepcopy(self._combined_dict) -def load(indra_xml_file = None): +def load(config_xml_file = None): global _g_config - if indra_xml_file is None: + load_default_files = config_xml_file is None + if load_default_files: ## going from: ## "/opt/linden/indra/lib/python/indra/base/config.py" ## to: ## "/opt/linden/etc/indra.xml" - indra_xml_file = realpath( + config_xml_file = realpath( dirname(realpath(__file__)) + "../../../../../../etc/indra.xml") try: - _g_config = IndraConfig(indra_xml_file) + _g_config = IndraConfig(config_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 + # Failure to load passed in file + # or indra.xml default file + if load_default_files: + try: + config_xml_file = realpath( + dirname(realpath(__file__)) + "../../../../../../etc/globals.xml") + _g_config = IndraConfig(config_xml_file) + return + except IOError: + # Failure to load globals.xml + # fall to code below + pass + + # Either failed to load passed in file + # or failed to load all default files _g_config = IndraConfig(None) def dump(indra_xml_file, indra_cfg = None, update_in_mem=False): diff --git a/linden/indra/lib/python/indra/base/llsd.py b/linden/indra/lib/python/indra/base/llsd.py index 4a575fc..9534d59 100644 --- a/linden/indra/lib/python/indra/base/llsd.py +++ b/linden/indra/lib/python/indra/base/llsd.py @@ -28,6 +28,7 @@ $/LicenseInfo$ import datetime import base64 +import string import struct import time import types @@ -36,10 +37,13 @@ import re from indra.util.fastest_elementtree import ElementTreeError, fromstring from indra.base import lluuid -try: - import cllsd -except ImportError: - cllsd = None +# cllsd.c in server/server-1.25 has memory leaks, +# so disabling cllsd for now +#try: +# import cllsd +#except ImportError: +# cllsd = None +cllsd = None int_regex = re.compile(r"[-+]?\d+") real_regex = re.compile(r"[-+]?(\d+(\.\d*)?|\d*\.\d+)([eE][-+]?\d+)?") @@ -126,6 +130,7 @@ def date_to_python(node): if not val: val = "1970-01-01T00:00:00Z" return parse_datestr(val) + def uri_to_python(node): val = node.text or '' @@ -936,6 +941,7 @@ def parse_notation(something): def parse(something): try: + something = string.lstrip(something) #remove any pre-trailing whitespace if something.startswith(''): return parse_binary(something) # This should be better. diff --git a/linden/indra/lib/python/indra/ipc/servicebuilder.py b/linden/indra/lib/python/indra/ipc/servicebuilder.py index b5872de..04ccee7 100644 --- a/linden/indra/lib/python/indra/ipc/servicebuilder.py +++ b/linden/indra/lib/python/indra/ipc/servicebuilder.py @@ -51,12 +51,10 @@ def build(name, context={}, **kwargs): > servicebuilder.build('version-manager-version', context, version='1.18.1.2') 'http://int.util.vaak.lindenlab.com/channel/Second%20Life%20Release/1.18.1.2' """ - context = context.copy() # shouldn't modify the caller's dictionary - context.update(kwargs) global _g_builder if _g_builder is None: _g_builder = ServiceBuilder() - return _g_builder.buildServiceURL(name, context) + return _g_builder.buildServiceURL(name, context, **kwargs) class ServiceBuilder(object): def __init__(self, services_definition = services_config): @@ -81,13 +79,36 @@ class ServiceBuilder(object): else: self.builders[service['name']] = service_builder - def buildServiceURL(self, name, context): + def buildServiceURL(self, name, context={}, **kwargs): """\ @brief given the environment on construction, return a service URL. @param name The name of the service. @param context A dict of name value lookups for the service. + @param kwargs Any keyword arguments are treated as members of the + context, this allows you to be all 31337 by writing shit like: + servicebuilder.build('name', param=value) @returns Returns the """ + context = context.copy() # shouldn't modify the caller's dictionary + context.update(kwargs) base_url = config.get('services-base-url') svc_path = russ.format(self.builders[name], context) return base_url + svc_path + + +def on_in(query_name, host_key, schema_key): + """\ + @brief Constructs an on/in snippet (for running named queries) + from a schema name and two keys referencing values stored in + indra.xml. + + @param query_name Name of the query. + @param host_key Logical name of destination host. Will be + looked up in indra.xml. + @param schema_key Logical name of destination schema. Will + be looked up in indra.xml. + """ + host_name = config.get(host_key) + schema_name = config.get(schema_key) + return '/'.join( ('on', host_name, 'in', schema_name, query_name.lstrip('/')) ) + diff --git a/linden/indra/lib/python/indra/util/llmanifest.py b/linden/indra/lib/python/indra/util/llmanifest.py index 12e33f2..59c84e5 100644 --- a/linden/indra/lib/python/indra/util/llmanifest.py +++ b/linden/indra/lib/python/indra/util/llmanifest.py @@ -452,7 +452,7 @@ class LLManifest(object): # *TODO is this gonna be useful? print "Cleaning up " + c - def process_file(self, src, dst, strip=False): + def process_file(self, src, dst): if self.includes(src, dst): # print src, "=>", dst for action in self.actions: @@ -460,7 +460,7 @@ class LLManifest(object): method = getattr(self, methodname, None) if method is not None: method(src, dst) - self.file_list.append([src, dst, strip]) + self.file_list.append([src, dst]) return 1 else: sys.stdout.write(" (excluding %r, %r)" % (src, dst)) @@ -607,7 +607,7 @@ class LLManifest(object): d = src_re.sub(d_template, s.replace('\\', '/')) yield os.path.normpath(s), os.path.normpath(d) - def path(self, src, dst=None, strip=False): + def path(self, src, dst=None): sys.stdout.write("Processing %s => %s ... " % (src, dst)) sys.stdout.flush() if src == None: @@ -622,7 +622,7 @@ class LLManifest(object): if self.wildcard_pattern.search(src): for s,d in self.expand_globs(src, dst): assert(s != d) - count += self.process_file(s, d, strip) + count += 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 @@ -631,7 +631,7 @@ class LLManifest(object): if os.path.isdir(src): count += self.process_directory(src, dst) else: - count += self.process_file(src, dst, strip) + count += self.process_file(src, dst) return count try: count = try_path(os.path.join(self.get_src_prefix(), src)) diff --git a/linden/indra/lib/python/indra/util/named_query.py b/linden/indra/lib/python/indra/util/named_query.py index cbde2d9..688a520 100644 --- a/linden/indra/lib/python/indra/util/named_query.py +++ b/linden/indra/lib/python/indra/util/named_query.py @@ -47,6 +47,8 @@ except NameError: from indra.base import llsd from indra.base import config +DEBUG = False + NQ_FILE_SUFFIX = config.get('named-query-file-suffix', '.nq') NQ_FILE_SUFFIX_LEN = len(NQ_FILE_SUFFIX) @@ -63,7 +65,9 @@ def _init_g_named_manager(sql_dir = None): # extra fallback directory in case config doesn't return what we want if sql_dir is None: - sql_dir = os.path.join(os.path.dirname(__file__), "..", "..", "..", "..", "web", "dataservice", "sql") + sql_dir = os.path.abspath( + os.path.join( + os.path.realpath(os.path.dirname(__file__)), "..", "..", "..", "..", "web", "dataservice", "sql")) global _g_named_manager _g_named_manager = NamedQueryManager( @@ -188,6 +192,16 @@ class NamedQuery(object): ready them for use in LIKE statements""" if sql: #print >>sys.stderr, "sql:",sql + + # This first sub is to properly escape any % signs that + # are meant to be literally passed through to mysql in the + # query. It leaves any %'s that are used for + # like-expressions. + expr = re.compile("(?<=[^a-zA-Z0-9_-])%(?=[^:])") + sql = expr.sub('%%', sql) + + # This should tackle the rest of the %'s in the query, by + # converting them to LIKE clauses. expr = re.compile("(%?):([a-zA-Z][a-zA-Z0-9_-]*)%") sql = expr.sub(self._prepare_like, sql) expr = re.compile("#:([a-zA-Z][a-zA-Z0-9_-]*)") @@ -339,7 +353,8 @@ class NamedQuery(object): cursor = connection.cursor() statement = self.sql(connection, params) - #print "SQL:", statement + if DEBUG: + print "SQL:", statement rows = cursor.execute(statement) # *NOTE: the expect_rows argument is a very cheesy way to get some diff --git a/linden/indra/lib/python/uuid.py b/linden/indra/lib/python/uuid.py new file mode 100644 index 0000000..48dac84 --- /dev/null +++ b/linden/indra/lib/python/uuid.py @@ -0,0 +1,481 @@ +r"""UUID objects (universally unique identifiers) according to RFC 4122. + +This module provides immutable UUID objects (class UUID) and the functions +uuid1(), uuid3(), uuid4(), uuid5() for generating version 1, 3, 4, and 5 +UUIDs as specified in RFC 4122. + +If all you want is a unique ID, you should probably call uuid1() or uuid4(). +Note that uuid1() may compromise privacy since it creates a UUID containing +the computer's network address. uuid4() creates a random UUID. + +Typical usage: + + >>> import uuid + + # make a UUID based on the host ID and current time + >>> uuid.uuid1() + UUID('a8098c1a-f86e-11da-bd1a-00112444be1e') + + # make a UUID using an MD5 hash of a namespace UUID and a name + >>> uuid.uuid3(uuid.NAMESPACE_DNS, 'python.org') + UUID('6fa459ea-ee8a-3ca4-894e-db77e160355e') + + # make a random UUID + >>> uuid.uuid4() + UUID('16fd2706-8baf-433b-82eb-8c7fada847da') + + # make a UUID using a SHA-1 hash of a namespace UUID and a name + >>> uuid.uuid5(uuid.NAMESPACE_DNS, 'python.org') + UUID('886313e1-3b8a-5372-9b90-0c9aee199e5d') + + # make a UUID from a string of hex digits (braces and hyphens ignored) + >>> x = uuid.UUID('{00010203-0405-0607-0809-0a0b0c0d0e0f}') + + # convert a UUID to a string of hex digits in standard form + >>> str(x) + '00010203-0405-0607-0809-0a0b0c0d0e0f' + + # get the raw 16 bytes of the UUID + >>> x.bytes + '\x00\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f' + + # make a UUID from a 16-byte string + >>> uuid.UUID(bytes=x.bytes) + UUID('00010203-0405-0607-0809-0a0b0c0d0e0f') + +This module works with Python 2.3 or higher.""" + +__author__ = 'Ka-Ping Yee ' +__date__ = '$Date: 2006/06/12 23:15:40 $'.split()[1].replace('/', '-') +__version__ = '$Revision: 1.30 $'.split()[1] + +RESERVED_NCS, RFC_4122, RESERVED_MICROSOFT, RESERVED_FUTURE = [ + 'reserved for NCS compatibility', 'specified in RFC 4122', + 'reserved for Microsoft compatibility', 'reserved for future definition'] + +class UUID(object): + """Instances of the UUID class represent UUIDs as specified in RFC 4122. + UUID objects are immutable, hashable, and usable as dictionary keys. + Converting a UUID to a string with str() yields something in the form + '12345678-1234-1234-1234-123456789abc'. The UUID constructor accepts + four possible forms: a similar string of hexadecimal digits, or a + string of 16 raw bytes as an argument named 'bytes', or a tuple of + six integer fields (with 32-bit, 16-bit, 16-bit, 8-bit, 8-bit, and + 48-bit values respectively) as an argument named 'fields', or a single + 128-bit integer as an argument named 'int'. + + UUIDs have these read-only attributes: + + bytes the UUID as a 16-byte string + + fields a tuple of the six integer fields of the UUID, + which are also available as six individual attributes + and two derived attributes: + + time_low the first 32 bits of the UUID + time_mid the next 16 bits of the UUID + time_hi_version the next 16 bits of the UUID + clock_seq_hi_variant the next 8 bits of the UUID + clock_seq_low the next 8 bits of the UUID + node the last 48 bits of the UUID + + time the 60-bit timestamp + clock_seq the 14-bit sequence number + + hex the UUID as a 32-character hexadecimal string + + int the UUID as a 128-bit integer + + urn the UUID as a URN as specified in RFC 4122 + + variant the UUID variant (one of the constants RESERVED_NCS, + RFC_4122, RESERVED_MICROSOFT, or RESERVED_FUTURE) + + version the UUID version number (1 through 5, meaningful only + when the variant is RFC_4122) + """ + + def __init__(self, hex=None, bytes=None, fields=None, int=None, + version=None): + r"""Create a UUID from either a string of 32 hexadecimal digits, + a string of 16 bytes as the 'bytes' argument, a tuple of six + integers (32-bit time_low, 16-bit time_mid, 16-bit time_hi_version, + 8-bit clock_seq_hi_variant, 8-bit clock_seq_low, 48-bit node) as + the 'fields' argument, or a single 128-bit integer as the 'int' + argument. When a string of hex digits is given, curly braces, + hyphens, and a URN prefix are all optional. For example, these + expressions all yield the same UUID: + + UUID('{12345678-1234-5678-1234-567812345678}') + UUID('12345678123456781234567812345678') + UUID('urn:uuid:12345678-1234-5678-1234-567812345678') + UUID(bytes='\x12\x34\x56\x78'*4) + UUID(fields=(0x12345678, 0x1234, 0x5678, 0x12, 0x34, 0x567812345678)) + UUID(int=0x12345678123456781234567812345678) + + Exactly one of 'hex', 'bytes', 'fields', or 'int' must be given. + The 'version' argument is optional; if given, the resulting UUID + will have its variant and version number set according to RFC 4122, + overriding bits in the given 'hex', 'bytes', 'fields', or 'int'. + """ + + if [hex, bytes, fields, int].count(None) != 3: + raise TypeError('need just one of hex, bytes, fields, or int') + if hex is not None: + hex = hex.replace('urn:', '').replace('uuid:', '') + hex = hex.strip('{}').replace('-', '') + if len(hex) != 32: + raise ValueError('badly formed hexadecimal UUID string') + int = long(hex, 16) + if bytes is not None: + if len(bytes) != 16: + raise ValueError('bytes is not a 16-char string') + int = long(('%02x'*16) % tuple(map(ord, bytes)), 16) + if fields is not None: + if len(fields) != 6: + raise ValueError('fields is not a 6-tuple') + (time_low, time_mid, time_hi_version, + clock_seq_hi_variant, clock_seq_low, node) = fields + if not 0 <= time_low < 1<<32L: + raise ValueError('field 1 out of range (need a 32-bit value)') + if not 0 <= time_mid < 1<<16L: + raise ValueError('field 2 out of range (need a 16-bit value)') + if not 0 <= time_hi_version < 1<<16L: + raise ValueError('field 3 out of range (need a 16-bit value)') + if not 0 <= clock_seq_hi_variant < 1<<8L: + raise ValueError('field 4 out of range (need an 8-bit value)') + if not 0 <= clock_seq_low < 1<<8L: + raise ValueError('field 5 out of range (need an 8-bit value)') + if not 0 <= node < 1<<48L: + raise ValueError('field 6 out of range (need a 48-bit value)') + clock_seq = (clock_seq_hi_variant << 8L) | clock_seq_low + int = ((time_low << 96L) | (time_mid << 80L) | + (time_hi_version << 64L) | (clock_seq << 48L) | node) + if int is not None: + if not 0 <= int < 1<<128L: + raise ValueError('int is out of range (need a 128-bit value)') + if version is not None: + if not 1 <= version <= 5: + raise ValueError('illegal version number') + # Set the variant to RFC 4122. + int &= ~(0xc000 << 48L) + int |= 0x8000 << 48L + # Set the version number. + int &= ~(0xf000 << 64L) + int |= version << 76L + self.__dict__['int'] = int + + def __cmp__(self, other): + if isinstance(other, UUID): + return cmp(self.int, other.int) + return NotImplemented + + def __hash__(self): + return hash(self.int) + + def __int__(self): + return self.int + + def __repr__(self): + return 'UUID(%r)' % str(self) + + def __setattr__(self, name, value): + raise TypeError('UUID objects are immutable') + + def __str__(self): + hex = '%032x' % self.int + return '%s-%s-%s-%s-%s' % ( + hex[:8], hex[8:12], hex[12:16], hex[16:20], hex[20:]) + + def get_bytes(self): + bytes = '' + for shift in range(0, 128, 8): + bytes = chr((self.int >> shift) & 0xff) + bytes + return bytes + + bytes = property(get_bytes) + + def get_fields(self): + return (self.time_low, self.time_mid, self.time_hi_version, + self.clock_seq_hi_variant, self.clock_seq_low, self.node) + + fields = property(get_fields) + + def get_time_low(self): + return self.int >> 96L + + time_low = property(get_time_low) + + def get_time_mid(self): + return (self.int >> 80L) & 0xffff + + time_mid = property(get_time_mid) + + def get_time_hi_version(self): + return (self.int >> 64L) & 0xffff + + time_hi_version = property(get_time_hi_version) + + def get_clock_seq_hi_variant(self): + return (self.int >> 56L) & 0xff + + clock_seq_hi_variant = property(get_clock_seq_hi_variant) + + def get_clock_seq_low(self): + return (self.int >> 48L) & 0xff + + clock_seq_low = property(get_clock_seq_low) + + def get_time(self): + return (((self.time_hi_version & 0x0fffL) << 48L) | + (self.time_mid << 32L) | self.time_low) + + time = property(get_time) + + def get_clock_seq(self): + return (((self.clock_seq_hi_variant & 0x3fL) << 8L) | + self.clock_seq_low) + + clock_seq = property(get_clock_seq) + + def get_node(self): + return self.int & 0xffffffffffff + + node = property(get_node) + + def get_hex(self): + return '%032x' % self.int + + hex = property(get_hex) + + def get_urn(self): + return 'urn:uuid:' + str(self) + + urn = property(get_urn) + + def get_variant(self): + if not self.int & (0x8000 << 48L): + return RESERVED_NCS + elif not self.int & (0x4000 << 48L): + return RFC_4122 + elif not self.int & (0x2000 << 48L): + return RESERVED_MICROSOFT + else: + return RESERVED_FUTURE + + variant = property(get_variant) + + def get_version(self): + # The version bits are only meaningful for RFC 4122 UUIDs. + if self.variant == RFC_4122: + return int((self.int >> 76L) & 0xf) + + version = property(get_version) + +def _ifconfig_getnode(): + """Get the hardware address on Unix by running ifconfig.""" + import os + for dir in ['', '/sbin/', '/usr/sbin']: + try: + path = os.path.join(dir, 'ifconfig') + if os.path.exists(path): + pipe = os.popen(path) + else: + continue + except IOError: + continue + for line in pipe: + words = line.lower().split() + for i in range(len(words)): + if words[i] in ['hwaddr', 'ether']: + return int(words[i + 1].replace(':', ''), 16) + +def _ipconfig_getnode(): + """Get the hardware address on Windows by running ipconfig.exe.""" + import os, re + dirs = ['', r'c:\windows\system32', r'c:\winnt\system32'] + try: + import ctypes + buffer = ctypes.create_string_buffer(300) + ctypes.windll.kernel32.GetSystemDirectoryA(buffer, 300) + dirs.insert(0, buffer.value.decode('mbcs')) + except: + pass + for dir in dirs: + try: + pipe = os.popen(os.path.join(dir, 'ipconfig') + ' /all') + except IOError: + continue + for line in pipe: + value = line.split(':')[-1].strip().lower() + if re.match('([0-9a-f][0-9a-f]-){5}[0-9a-f][0-9a-f]', value): + return int(value.replace('-', ''), 16) + +def _netbios_getnode(): + """Get the hardware address on Windows using NetBIOS calls. + See http://support.microsoft.com/kb/118623 for details.""" + import win32wnet, netbios + ncb = netbios.NCB() + ncb.Command = netbios.NCBENUM + ncb.Buffer = adapters = netbios.LANA_ENUM() + adapters._pack() + if win32wnet.Netbios(ncb) != 0: + return + adapters._unpack() + for i in range(adapters.length): + ncb.Reset() + ncb.Command = netbios.NCBRESET + ncb.Lana_num = ord(adapters.lana[i]) + if win32wnet.Netbios(ncb) != 0: + continue + ncb.Reset() + ncb.Command = netbios.NCBASTAT + ncb.Lana_num = ord(adapters.lana[i]) + ncb.Callname = '*'.ljust(16) + ncb.Buffer = status = netbios.ADAPTER_STATUS() + if win32wnet.Netbios(ncb) != 0: + continue + status._unpack() + bytes = map(ord, status.adapter_address) + return ((bytes[0]<<40L) + (bytes[1]<<32L) + (bytes[2]<<24L) + + (bytes[3]<<16L) + (bytes[4]<<8L) + bytes[5]) + +# Thanks to Thomas Heller for ctypes and for his help with its use here. + +# If ctypes is available, use it to find system routines for UUID generation. +_uuid_generate_random = _uuid_generate_time = _UuidCreate = None +try: + import ctypes, ctypes.util + _buffer = ctypes.create_string_buffer(16) + + # The uuid_generate_* routines are provided by libuuid on at least + # Linux and FreeBSD, and provided by libc on Mac OS X. + for libname in ['uuid', 'c']: + try: + lib = ctypes.CDLL(ctypes.util.find_library(libname)) + except: + continue + if hasattr(lib, 'uuid_generate_random'): + _uuid_generate_random = lib.uuid_generate_random + if hasattr(lib, 'uuid_generate_time'): + _uuid_generate_time = lib.uuid_generate_time + + # On Windows prior to 2000, UuidCreate gives a UUID containing the + # hardware address. On Windows 2000 and later, UuidCreate makes a + # random UUID and UuidCreateSequential gives a UUID containing the + # hardware address. These routines are provided by the RPC runtime. + try: + lib = ctypes.windll.rpcrt4 + except: + lib = None + _UuidCreate = getattr(lib, 'UuidCreateSequential', + getattr(lib, 'UuidCreate', None)) +except: + pass + +def _unixdll_getnode(): + """Get the hardware address on Unix using ctypes.""" + _uuid_generate_time(_buffer) + return UUID(bytes=_buffer.raw).node + +def _windll_getnode(): + """Get the hardware address on Windows using ctypes.""" + if _UuidCreate(_buffer) == 0: + return UUID(bytes=_buffer.raw).node + +def _random_getnode(): + """Get a random node ID, with eighth bit set as suggested by RFC 4122.""" + import random + return random.randrange(0, 1<<48L) | 0x010000000000L + +_node = None + +def getnode(): + """Get the hardware address as a 48-bit integer. The first time this + runs, it may launch a separate program, which could be quite slow. If + all attempts to obtain the hardware address fail, we choose a random + 48-bit number with its eighth bit set to 1 as recommended in RFC 4122.""" + + global _node + if _node is not None: + return _node + + import sys + if sys.platform == 'win32': + getters = [_windll_getnode, _netbios_getnode, _ipconfig_getnode] + else: + getters = [_unixdll_getnode, _ifconfig_getnode] + + for getter in getters + [_random_getnode]: + try: + _node = getter() + except: + continue + if _node is not None: + return _node + +def uuid1(node=None, clock_seq=None): + """Generate a UUID from a host ID, sequence number, and the current time. + If 'node' is not given, getnode() is used to obtain the hardware + address. If 'clock_seq' is given, it is used as the sequence number; + otherwise a random 14-bit sequence number is chosen.""" + + # When the system provides a version-1 UUID generator, use it (but don't + # use UuidCreate here because its UUIDs don't conform to RFC 4122). + if _uuid_generate_time and node is clock_seq is None: + _uuid_generate_time(_buffer) + return UUID(bytes=_buffer.raw) + + import time + nanoseconds = int(time.time() * 1e9) + # 0x01b21dd213814000 is the number of 100-ns intervals between the + # UUID epoch 1582-10-15 00:00:00 and the Unix epoch 1970-01-01 00:00:00. + timestamp = int(nanoseconds/100) + 0x01b21dd213814000L + if clock_seq is None: + import random + clock_seq = random.randrange(1<<14L) # instead of stable storage + time_low = timestamp & 0xffffffffL + time_mid = (timestamp >> 32L) & 0xffffL + time_hi_version = (timestamp >> 48L) & 0x0fffL + clock_seq_low = clock_seq & 0xffL + clock_seq_hi_variant = (clock_seq >> 8L) & 0x3fL + if node is None: + node = getnode() + return UUID(fields=(time_low, time_mid, time_hi_version, + clock_seq_hi_variant, clock_seq_low, node), version=1) + +def uuid3(namespace, name): + """Generate a UUID from the MD5 hash of a namespace UUID and a name.""" + import md5 + hash = md5.md5(namespace.bytes + name).digest() + return UUID(bytes=hash[:16], version=3) + +def uuid4(): + """Generate a random UUID.""" + + # When the system provides a version-4 UUID generator, use it. + if _uuid_generate_random: + _uuid_generate_random(_buffer) + return UUID(bytes=_buffer.raw) + + # Otherwise, get randomness from urandom or the 'random' module. + try: + import os + return UUID(bytes=os.urandom(16), version=4) + except: + import random + bytes = [chr(random.randrange(256)) for i in range(16)] + return UUID(bytes=bytes, version=4) + +def uuid5(namespace, name): + """Generate a UUID from the SHA-1 hash of a namespace UUID and a name.""" + import sha + hash = sha.sha(namespace.bytes + name).digest() + return UUID(bytes=hash[:16], version=5) + +# The following standard UUIDs are for use with uuid3() or uuid5(). + +NAMESPACE_DNS = UUID('6ba7b810-9dad-11d1-80b4-00c04fd430c8') +NAMESPACE_URL = UUID('6ba7b811-9dad-11d1-80b4-00c04fd430c8') +NAMESPACE_OID = UUID('6ba7b812-9dad-11d1-80b4-00c04fd430c8') +NAMESPACE_X500 = UUID('6ba7b814-9dad-11d1-80b4-00c04fd430c8') diff --git a/linden/indra/linux_crash_logger/linux_crash_logger.cpp b/linden/indra/linux_crash_logger/linux_crash_logger.cpp index 18e2637..97eec85 100644 --- a/linden/indra/linux_crash_logger/linux_crash_logger.cpp +++ b/linden/indra/linux_crash_logger/linux_crash_logger.cpp @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/linux_crash_logger/llcrashloggerlinux.cpp b/linden/indra/linux_crash_logger/llcrashloggerlinux.cpp index 0896814..039b70e 100644 --- a/linden/indra/linux_crash_logger/llcrashloggerlinux.cpp +++ b/linden/indra/linux_crash_logger/llcrashloggerlinux.cpp @@ -17,7 +17,8 @@ * 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 + * 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, @@ -90,7 +91,7 @@ static BOOL do_ask_dialog(void) win = gtk_message_dialog_new(NULL, flags, messagetype, buttons, - dialog_text); + "%s", dialog_text); gtk_window_set_type_hint(GTK_WINDOW(win), GDK_WINDOW_TYPE_HINT_DIALOG); gtk_window_set_title(GTK_WINDOW(win), dialog_title); diff --git a/linden/indra/linux_crash_logger/llcrashloggerlinux.h b/linden/indra/linux_crash_logger/llcrashloggerlinux.h index b9b56bb..937d547 100644 --- a/linden/indra/linux_crash_logger/llcrashloggerlinux.h +++ b/linden/indra/linux_crash_logger/llcrashloggerlinux.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llaudio/audioengine.cpp b/linden/indra/llaudio/audioengine.cpp index c5bc367..d8082aa 100644 --- a/linden/indra/llaudio/audioengine.cpp +++ b/linden/indra/llaudio/audioengine.cpp @@ -18,7 +18,8 @@ * 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 + * 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, @@ -96,11 +97,11 @@ void LLAudioEngine::setDefaults() mInternetStreamGain = 0.125f; mNextWindUpdate = 0.f; - for (U32 i = 0; i < LLAudioEngine::AUDIO_TYPE_COUNT; i++) - mSecondaryGain[i] = 1.0f; - mInternetStreamMedia = NULL; mInternetStreamURL.clear(); + + for (U32 i = 0; i < LLAudioEngine::AUDIO_TYPE_COUNT; i++) + mSecondaryGain[i] = 1.0f; } @@ -1624,7 +1625,9 @@ bool LLAudioSource::hasPendingPreloads() const for (iter = mPreloadMap.begin(); iter != mPreloadMap.end(); iter++) { LLAudioData *adp = iter->second; - if (!adp->hasDecodedData()) + // note: a bad UUID will forever be !hasDecodedData() + // but also !hasValidData(), hence the check for hasValidData() + if (!adp->hasDecodedData() && adp->hasValidData()) { // This source is still waiting for a preload return true; diff --git a/linden/indra/llaudio/audioengine.h b/linden/indra/llaudio/audioengine.h index b582f14..76f1f95 100644 --- a/linden/indra/llaudio/audioengine.h +++ b/linden/indra/llaudio/audioengine.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llaudio/audioengine_fmod.cpp b/linden/indra/llaudio/audioengine_fmod.cpp index 2197a45..938c2aa 100644 --- a/linden/indra/llaudio/audioengine_fmod.cpp +++ b/linden/indra/llaudio/audioengine_fmod.cpp @@ -17,7 +17,8 @@ * 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 + * 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, @@ -659,15 +660,12 @@ bool LLAudioBufferFMOD::loadWAV(const std::string& filename) return false; } - S32 file_size = 0; - apr_file_t* apr_file = ll_apr_file_open(filename, LL_APR_RPB, &file_size); - if (!apr_file) + if (!LLAPRFile::isExist(filename, NULL, LL_APR_RPB)) { // File not found, abort. return false; } - apr_file_close(apr_file); - + if (mSamplep) { // If there's already something loaded in this buffer, clean it up. diff --git a/linden/indra/llaudio/audioengine_fmod.h b/linden/indra/llaudio/audioengine_fmod.h index 4d2cbce..facbbb3 100644 --- a/linden/indra/llaudio/audioengine_fmod.h +++ b/linden/indra/llaudio/audioengine_fmod.h @@ -18,7 +18,8 @@ * 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 + * 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, diff --git a/linden/indra/llaudio/audioengine_openal.cpp b/linden/indra/llaudio/audioengine_openal.cpp index b33e0b0..244deec 100644 --- a/linden/indra/llaudio/audioengine_openal.cpp +++ b/linden/indra/llaudio/audioengine_openal.cpp @@ -18,7 +18,8 @@ * 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 + * 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, diff --git a/linden/indra/llaudio/audioengine_openal.h b/linden/indra/llaudio/audioengine_openal.h index 54b60e6..4997090 100644 --- a/linden/indra/llaudio/audioengine_openal.h +++ b/linden/indra/llaudio/audioengine_openal.h @@ -19,7 +19,8 @@ * 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 + * 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, diff --git a/linden/indra/llaudio/listener.cpp b/linden/indra/llaudio/listener.cpp index 9b99c5f..e2dc30e 100644 --- a/linden/indra/llaudio/listener.cpp +++ b/linden/indra/llaudio/listener.cpp @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llaudio/listener.h b/linden/indra/llaudio/listener.h index 1c15e29..4137304 100644 --- a/linden/indra/llaudio/listener.h +++ b/linden/indra/llaudio/listener.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llaudio/listener_ds3d.h b/linden/indra/llaudio/listener_ds3d.h index e58f3ff..3121e12 100644 --- a/linden/indra/llaudio/listener_ds3d.h +++ b/linden/indra/llaudio/listener_ds3d.h @@ -18,7 +18,8 @@ * 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 + * 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, diff --git a/linden/indra/llaudio/listener_fmod.cpp b/linden/indra/llaudio/listener_fmod.cpp index eca3547..4bbb3d9 100644 --- a/linden/indra/llaudio/listener_fmod.cpp +++ b/linden/indra/llaudio/listener_fmod.cpp @@ -18,7 +18,8 @@ * 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 + * 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, diff --git a/linden/indra/llaudio/listener_fmod.h b/linden/indra/llaudio/listener_fmod.h index 6ac8f20..5f372ab 100644 --- a/linden/indra/llaudio/listener_fmod.h +++ b/linden/indra/llaudio/listener_fmod.h @@ -18,7 +18,8 @@ * 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 + * 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, diff --git a/linden/indra/llaudio/listener_openal.cpp b/linden/indra/llaudio/listener_openal.cpp index 718de63..b7d75ec 100644 --- a/linden/indra/llaudio/listener_openal.cpp +++ b/linden/indra/llaudio/listener_openal.cpp @@ -18,7 +18,8 @@ * 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 + * 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, diff --git a/linden/indra/llaudio/listener_openal.h b/linden/indra/llaudio/listener_openal.h index 3e4353f..790dca2 100644 --- a/linden/indra/llaudio/listener_openal.h +++ b/linden/indra/llaudio/listener_openal.h @@ -18,7 +18,8 @@ * 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 + * 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, diff --git a/linden/indra/llaudio/llaudiodecodemgr.cpp b/linden/indra/llaudio/llaudiodecodemgr.cpp index 0515648..5b6db3b 100644 --- a/linden/indra/llaudio/llaudiodecodemgr.cpp +++ b/linden/indra/llaudio/llaudiodecodemgr.cpp @@ -16,7 +16,8 @@ * 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 + * 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, diff --git a/linden/indra/llaudio/llaudiodecodemgr.h b/linden/indra/llaudio/llaudiodecodemgr.h index fa6dbd8..040506c 100644 --- a/linden/indra/llaudio/llaudiodecodemgr.h +++ b/linden/indra/llaudio/llaudiodecodemgr.h @@ -16,7 +16,8 @@ * 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 + * 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, diff --git a/linden/indra/llaudio/vorbisdecode.cpp b/linden/indra/llaudio/vorbisdecode.cpp index 85c4b16..4bf70f4 100644 --- a/linden/indra/llaudio/vorbisdecode.cpp +++ b/linden/indra/llaudio/vorbisdecode.cpp @@ -17,7 +17,8 @@ * 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 + * 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, @@ -131,8 +132,12 @@ BOOL decode_vorbis_file(LLVFS *vfs, const LLUUID &in_uuid, char *out_fname) llwarning("unable to open vorbis source vfile for reading",0); return(FALSE); } - apr_file_t* outfp = ll_apr_file_open(out_fname,LL_APR_WPB); - if (!outfp) + + //********************************** + LLAPRFile outfile ; + outfile.open(out_fname,LL_APR_WPB); + //********************************** + if (!outfile.getFileHandle()) { llwarning("unable to open vorbis destination file for writing",0); return(FALSE); @@ -211,8 +216,7 @@ BOOL decode_vorbis_file(LLVFS *vfs, const LLUUID &in_uuid, char *out_fname) temp[42] = 0x00; temp[43] = 0x00; - - ll_apr_file_write(outfp, temp, 44); + outfile.write(temp, 44); } OggVorbis_File vf; @@ -222,7 +226,7 @@ BOOL decode_vorbis_file(LLVFS *vfs, const LLUUID &in_uuid, char *out_fname) int r = ov_open_callbacks(in_vfile, &vf, NULL, 0, vfs_callbacks); if(r < 0) { - llwarns << r << " Input to vorbis decode does not appear to be an Ogg bitstream: " << in_uuid << llendl; + llwarns << r << " Input to vorbis decode does not appear to be an Ogg bitstream: " << in_uuid << llendl; return(FALSE); } @@ -254,20 +258,20 @@ BOOL decode_vorbis_file(LLVFS *vfs, const LLUUID &in_uuid, char *out_fname) // llinfos << "Vorbis read " << ret << "bytes" << llendl; /* we don't bother dealing with sample rate changes, etc, but. you'll have to*/ - data_length += ll_apr_file_write(outfp, pcmout, ret); + data_length += outfile.write(pcmout, ret); } } ov_clear(&vf); // write "data" chunk length - ll_apr_file_seek(outfp,APR_SET,40); - ll_apr_file_write(outfp,&data_length,4); + outfile.seek(APR_SET,40); + outfile.write(&data_length,4); // write overall "RIFF" length data_length += 36; - ll_apr_file_seek(outfp,APR_SET,4); - ll_apr_file_write(outfp,&data_length,1*4); + outfile.seek(APR_SET,4); + outfile.write(&data_length,1*4); // FUCK!!! Vorbis encode/decode messes up loop point transitions (pop) // do a cheap-and-cheesy crossfade @@ -279,8 +283,8 @@ BOOL decode_vorbis_file(LLVFS *vfs, const LLUUID &in_uuid, char *out_fname) fade_length = llmin((S32)128,(S32)(data_length-36)/8); - ll_apr_file_seek(outfp,APR_SET,44); - ll_apr_file_read(outfp, pcmout,2*fade_length); //read first 16 samples + outfile.seek(APR_SET,44); + outfile.read(pcmout,2*fade_length); //read first 16 samples samplep = (S16 *)pcmout; @@ -289,11 +293,11 @@ BOOL decode_vorbis_file(LLVFS *vfs, const LLUUID &in_uuid, char *out_fname) *samplep++ = ((F32)*samplep * ((F32)i/(F32)fade_length)); } - ll_apr_file_seek(outfp,APR_SET,44); - ll_apr_file_write(outfp,pcmout,2*fade_length); //write back xfaded first 16 samples + outfile.seek(APR_SET,44); + outfile.write(pcmout,2*fade_length); //write back xfaded first 16 samples - ll_apr_file_seek(outfp,APR_END,-fade_length*2); - ll_apr_file_read(outfp, pcmout,2*fade_length); //read last 16 samples + outfile.seek(APR_END,-fade_length*2); + outfile.read(pcmout,2*fade_length); //read last 16 samples samplep = (S16 *)pcmout; @@ -302,11 +306,12 @@ BOOL decode_vorbis_file(LLVFS *vfs, const LLUUID &in_uuid, char *out_fname) *samplep++ = ((F32)*samplep * ((F32)i/(F32)fade_length)); } - ll_apr_file_seek(outfp,SEEK_END,-fade_length*2); - ll_apr_file_write(outfp,pcmout,2*fade_length); //write back xfaded last 16 samples - - apr_file_close(outfp); - + outfile.seek(SEEK_END,-fade_length*2); + outfile.write(pcmout,2*fade_length); //write back xfaded last 16 samples + //******************* + outfile.close(); + //******************* + if ((36 == data_length) || (!(eof))) { llwarning("BAD Vorbis DECODE!, removing .wav!",0); diff --git a/linden/indra/llaudio/vorbisdecode.h b/linden/indra/llaudio/vorbisdecode.h index e130c85..cb67c99 100644 --- a/linden/indra/llaudio/vorbisdecode.h +++ b/linden/indra/llaudio/vorbisdecode.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llaudio/vorbisencode.cpp b/linden/indra/llaudio/vorbisencode.cpp index c5a751e..7df1416 100644 --- a/linden/indra/llaudio/vorbisencode.cpp +++ b/linden/indra/llaudio/vorbisencode.cpp @@ -17,7 +17,8 @@ * 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 + * 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, @@ -85,28 +86,29 @@ S32 check_for_invalid_wav_formats(const std::string& in_fname, std::string& erro error_msg.clear(); - apr_file_t* infp = ll_apr_file_open(in_fname,LL_APR_RB); - if (!infp) + //******************************** + LLAPRFile infile ; + infile.open(in_fname,LL_APR_RB); + //******************************** + if (!infile.getFileHandle()) { error_msg = "CannotUploadSoundFile"; return(LLVORBISENC_SOURCE_OPEN_ERR); } - ll_apr_file_read(infp, wav_header, 44); - physical_file_size = ll_apr_file_seek(infp,APR_END,0); + infile.read(wav_header, 44); + physical_file_size = infile.seek(APR_END,0); if (strncmp((char *)&(wav_header[0]),"RIFF",4)) { error_msg = "SoundFileNotRIFF"; - apr_file_close(infp); - return(LLVORBISENC_WAV_FORMAT_ERR); + return(LLVORBISENC_WAV_FORMAT_ERR); } if (strncmp((char *)&(wav_header[8]),"WAVE",4)) { error_msg = "SoundFileNotRIFF"; - apr_file_close(infp); - return(LLVORBISENC_WAV_FORMAT_ERR); + return(LLVORBISENC_WAV_FORMAT_ERR); } // parse the chunks @@ -115,8 +117,8 @@ S32 check_for_invalid_wav_formats(const std::string& in_fname, std::string& erro while ((file_pos + 8)< physical_file_size) { - ll_apr_file_seek(infp,APR_SET,file_pos); - ll_apr_file_read(infp, wav_header, 44); + infile.seek(APR_SET,file_pos); + infile.read(wav_header, 44); chunk_length = ((U32) wav_header[7] << 24) + ((U32) wav_header[6] << 16) @@ -149,8 +151,9 @@ S32 check_for_invalid_wav_formats(const std::string& in_fname, std::string& erro file_pos += (chunk_length + 8); chunk_length = 0; } - - apr_file_close(infp); + //**************** + infile.close(); + //**************** if (!uncompressed_pcm) { @@ -228,19 +231,21 @@ S32 encode_vorbis_file(const std::string& in_fname, const std::string& out_fname S32 data_left = 0; - apr_file_t* infp = ll_apr_file_open(in_fname,LL_APR_RB); - if (!infp) + LLAPRFile infile ; + infile.open(in_fname,LL_APR_RB); + if (!infile.getFileHandle()) { llwarns << "Couldn't open temporary ogg file for writing: " << in_fname << llendl; return(LLVORBISENC_SOURCE_OPEN_ERR); } - apr_file_t* outfp = ll_apr_file_open(out_fname,LL_APR_WPB); - if (!outfp) + + LLAPRFile outfile ; + outfile.open(out_fname,LL_APR_WPB); + if (!outfile.getFileHandle()) { llwarns << "Couldn't open upload sound file for reading: " << in_fname << llendl; - apr_file_close (infp); return(LLVORBISENC_DEST_OPEN_ERR); } @@ -248,10 +253,10 @@ S32 encode_vorbis_file(const std::string& in_fname, const std::string& out_fname U32 chunk_length = 0; U32 file_pos = 12; // start at the first chunk (usually fmt but not always) - while (apr_file_eof(infp) != APR_EOF) + while (infile.eof() != APR_EOF) { - ll_apr_file_seek(infp,APR_SET,file_pos); - ll_apr_file_read(infp, wav_header, 44); + infile.seek(APR_SET,file_pos); + infile.read(wav_header, 44); chunk_length = ((U32) wav_header[7] << 24) + ((U32) wav_header[6] << 16) @@ -271,7 +276,7 @@ S32 encode_vorbis_file(const std::string& in_fname, const std::string& out_fname } else if (!(strncmp((char *)&(wav_header[0]),"data",4))) { - ll_apr_file_seek(infp,APR_SET,file_pos+8); + infile.seek(APR_SET,file_pos+8); // leave the file pointer at the beginning of the data chunk data data_left = chunk_length; break; @@ -280,7 +285,6 @@ S32 encode_vorbis_file(const std::string& in_fname, const std::string& out_fname chunk_length = 0; } -// apr_file_close(infp); /********** Encode setup ************/ @@ -345,8 +349,8 @@ S32 encode_vorbis_file(const std::string& in_fname, const std::string& out_fname while(!eos){ int result=ogg_stream_flush(&os,&og); if(result==0)break; - ll_apr_file_write(outfp, og.header, og.header_len); - ll_apr_file_write(outfp, og.body, og.body_len); + outfile.write(og.header, og.header_len); + outfile.write(og.body, og.body_len); } } @@ -356,7 +360,7 @@ S32 encode_vorbis_file(const std::string& in_fname, const std::string& out_fname { long bytes_per_sample = bits_per_sample/8; - long bytes=(long)ll_apr_file_read(infp, readbuffer,llclamp((S32)(READ_BUFFER*num_channels*bytes_per_sample),0,data_left)); /* stereo hardwired here */ + long bytes=(long)infile.read(readbuffer,llclamp((S32)(READ_BUFFER*num_channels*bytes_per_sample),0,data_left)); /* stereo hardwired here */ if (bytes==0) { @@ -464,8 +468,8 @@ S32 encode_vorbis_file(const std::string& in_fname, const std::string& out_fname if(result==0) break; - ll_apr_file_write(outfp, og.header, og.header_len); - ll_apr_file_write(outfp, og.body, og.body_len); + outfile.write(og.header, og.header_len); + outfile.write(og.body, og.body_len); /* this could be set above, but for illustrative purposes, I do it here (to show that vorbis does know where the stream ends) */ @@ -493,8 +497,6 @@ S32 encode_vorbis_file(const std::string& in_fname, const std::string& out_fname // fprintf(stderr,"Vorbis encoding: Done.\n"); llinfos << "Vorbis encoding: Done." << llendl; - apr_file_close(outfp); - apr_file_close(infp); #endif return(LLVORBISENC_NOERR); diff --git a/linden/indra/llaudio/vorbisencode.h b/linden/indra/llaudio/vorbisencode.h index eadfa7d..ff5ce3a 100644 --- a/linden/indra/llaudio/vorbisencode.h +++ b/linden/indra/llaudio/vorbisencode.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llaudio/windgen.h b/linden/indra/llaudio/windgen.h index faffd3c..847bfa6 100644 --- a/linden/indra/llaudio/windgen.h +++ b/linden/indra/llaudio/windgen.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llcharacter/CMakeLists.txt b/linden/indra/llcharacter/CMakeLists.txt index 6301062..612229d 100644 --- a/linden/indra/llcharacter/CMakeLists.txt +++ b/linden/indra/llcharacter/CMakeLists.txt @@ -46,6 +46,7 @@ set(llcharacter_HEADER_FILES llanimationstates.h llbvhloader.h + llbvhconsts.h llcharacter.h lleditingmotion.h llgesture.h diff --git a/linden/indra/llcharacter/llanimationstates.cpp b/linden/indra/llcharacter/llanimationstates.cpp index 97c282e..365fb67 100644 --- a/linden/indra/llcharacter/llanimationstates.cpp +++ b/linden/indra/llcharacter/llanimationstates.cpp @@ -17,7 +17,8 @@ * 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 + * 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, @@ -39,19 +40,19 @@ #include "llstring.h" LLUUID AGENT_WALK_ANIMS[] = {ANIM_AGENT_WALK, ANIM_AGENT_RUN, ANIM_AGENT_CROUCHWALK, ANIM_AGENT_TURNLEFT, ANIM_AGENT_TURNRIGHT}; -S32 NUM_AGENT_WALK_ANIMS = sizeof(AGENT_WALK_ANIMS) / sizeof(LLUUID); +S32 NUM_AGENT_WALK_ANIMS = LL_ARRAY_SIZE(AGENT_WALK_ANIMS); LLUUID AGENT_GUN_HOLD_ANIMS[] = {ANIM_AGENT_HOLD_RIFLE_R, ANIM_AGENT_HOLD_HANDGUN_R, ANIM_AGENT_HOLD_BAZOOKA_R, ANIM_AGENT_HOLD_BOW_L}; -S32 NUM_AGENT_GUN_HOLD_ANIMS = sizeof(AGENT_GUN_HOLD_ANIMS) / sizeof(LLUUID); +S32 NUM_AGENT_GUN_HOLD_ANIMS = LL_ARRAY_SIZE(AGENT_GUN_HOLD_ANIMS); LLUUID AGENT_GUN_AIM_ANIMS[] = {ANIM_AGENT_AIM_RIFLE_R, ANIM_AGENT_AIM_HANDGUN_R, ANIM_AGENT_AIM_BAZOOKA_R, ANIM_AGENT_AIM_BOW_L}; -S32 NUM_AGENT_GUN_AIM_ANIMS = sizeof(AGENT_GUN_AIM_ANIMS) / sizeof(LLUUID); +S32 NUM_AGENT_GUN_AIM_ANIMS = LL_ARRAY_SIZE(AGENT_GUN_AIM_ANIMS); LLUUID AGENT_NO_ROTATE_ANIMS[] = {ANIM_AGENT_SIT_GROUND, ANIM_AGENT_SIT_GROUND_CONSTRAINED, ANIM_AGENT_STANDUP}; -S32 NUM_AGENT_NO_ROTATE_ANIMS = sizeof(AGENT_NO_ROTATE_ANIMS) / sizeof(LLUUID); +S32 NUM_AGENT_NO_ROTATE_ANIMS = LL_ARRAY_SIZE(AGENT_NO_ROTATE_ANIMS); LLUUID AGENT_STAND_ANIMS[] = {ANIM_AGENT_STAND, ANIM_AGENT_STAND_1, ANIM_AGENT_STAND_2, ANIM_AGENT_STAND_3, ANIM_AGENT_STAND_4}; -S32 NUM_AGENT_STAND_ANIMS = sizeof(AGENT_STAND_ANIMS) / sizeof(LLUUID); +S32 NUM_AGENT_STAND_ANIMS = LL_ARRAY_SIZE(AGENT_STAND_ANIMS); LLAnimationLibrary gAnimLibrary; @@ -333,7 +334,7 @@ const LLAnimStateEntry gUserAnimStates[] = { LLAnimStateEntry("yes_head", ANIM_AGENT_YES), }; -const S32 gUserAnimStatesCount = sizeof(gUserAnimStates) / sizeof(gUserAnimStates[0]); +const S32 gUserAnimStatesCount = LL_ARRAY_SIZE(gUserAnimStates); diff --git a/linden/indra/llcharacter/llanimationstates.h b/linden/indra/llcharacter/llanimationstates.h index 67786cc..56b24d5 100644 --- a/linden/indra/llcharacter/llanimationstates.h +++ b/linden/indra/llcharacter/llanimationstates.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llcharacter/llbvhconsts.h b/linden/indra/llcharacter/llbvhconsts.h new file mode 100644 index 0000000..d5876aa --- /dev/null +++ b/linden/indra/llcharacter/llbvhconsts.h @@ -0,0 +1,52 @@ +/** + * @file llbvhconsts.h + * @brief Consts and types useful to BVH files and LindenLabAnimation format. + * + * $LicenseInfo:firstyear=2004&license=viewergpl$ + * + * Copyright (c) 2004-2009, 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_LLBVHCONSTS_H +#define LL_LLBVHCONSTS_H + +const F32 MAX_ANIM_DURATION = 30.f; + +typedef enum e_constraint_type + { + CONSTRAINT_TYPE_POINT, + CONSTRAINT_TYPE_PLANE, + NUM_CONSTRAINT_TYPES + } EConstraintType; + +typedef enum e_constraint_target_type + { + CONSTRAINT_TARGET_TYPE_BODY, + CONSTRAINT_TARGET_TYPE_GROUND, + NUM_CONSTRAINT_TARGET_TYPES + } EConstraintTargetType; + +#endif // LL_LLBVHCONSTS_H diff --git a/linden/indra/llcharacter/llbvhloader.cpp b/linden/indra/llcharacter/llbvhloader.cpp index ae6272d..e1f8ce5 100644 --- a/linden/indra/llcharacter/llbvhloader.cpp +++ b/linden/indra/llcharacter/llbvhloader.cpp @@ -17,7 +17,8 @@ * 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 + * 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, @@ -177,7 +178,9 @@ LLBVHLoader::Status LLBVHLoader::loadTranslationTable(const char *fileName) //-------------------------------------------------------------------- std::string path = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS,fileName); - apr_file_t *fp = ll_apr_file_open(path, LL_APR_R); + LLAPRFile infile ; + infile.open(path, LL_APR_R); + apr_file_t *fp = infile.getFileHandle(); if (!fp) return ST_NO_XLT_FILE; @@ -186,8 +189,7 @@ LLBVHLoader::Status LLBVHLoader::loadTranslationTable(const char *fileName) //-------------------------------------------------------------------- // register file to be closed on function exit //-------------------------------------------------------------------- - FileCloser fileCloser(fp); - + //-------------------------------------------------------------------- // load header //-------------------------------------------------------------------- @@ -617,6 +619,8 @@ LLBVHLoader::Status LLBVHLoader::loadTranslationTable(const char *fileName) } } + + infile.close() ; return ST_OK; } diff --git a/linden/indra/llcharacter/llbvhloader.h b/linden/indra/llcharacter/llbvhloader.h index b65368c..6937b9d 100644 --- a/linden/indra/llcharacter/llbvhloader.h +++ b/linden/indra/llcharacter/llbvhloader.h @@ -17,7 +17,8 @@ * 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 + * 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, @@ -36,9 +37,9 @@ #include "m3math.h" #include "llmath.h" #include "llapr.h" +#include "llbvhconsts.h" const S32 BVH_PARSER_LINE_SIZE = 2048; -const F32 MAX_ANIM_DURATION = 30.f; class LLDataPacker; //------------------------------------------------------------------------ @@ -131,12 +132,6 @@ struct Joint }; -typedef enum e_constraint_type -{ - CONSTRAINT_TYPE_POINT, - CONSTRAINT_TYPE_PLANE -} EConstraintType; - struct Constraint { char mSourceJointName[16]; /* Flawfinder: ignore */ diff --git a/linden/indra/llcharacter/llcharacter.cpp b/linden/indra/llcharacter/llcharacter.cpp index 04d05e6..6633c65 100644 --- a/linden/indra/llcharacter/llcharacter.cpp +++ b/linden/indra/llcharacter/llcharacter.cpp @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llcharacter/llcharacter.h b/linden/indra/llcharacter/llcharacter.h index 8f1f7fb..0112788 100644 --- a/linden/indra/llcharacter/llcharacter.h +++ b/linden/indra/llcharacter/llcharacter.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llcharacter/lleditingmotion.cpp b/linden/indra/llcharacter/lleditingmotion.cpp index a2d126a..913be27 100644 --- a/linden/indra/llcharacter/lleditingmotion.cpp +++ b/linden/indra/llcharacter/lleditingmotion.cpp @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llcharacter/lleditingmotion.h b/linden/indra/llcharacter/lleditingmotion.h index 218d959..4a83d4b 100644 --- a/linden/indra/llcharacter/lleditingmotion.h +++ b/linden/indra/llcharacter/lleditingmotion.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llcharacter/llgesture.cpp b/linden/indra/llcharacter/llgesture.cpp index 7c55e92..4ee29fe 100644 --- a/linden/indra/llcharacter/llgesture.cpp +++ b/linden/indra/llcharacter/llgesture.cpp @@ -16,7 +16,8 @@ * 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 + * 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, diff --git a/linden/indra/llcharacter/llgesture.h b/linden/indra/llcharacter/llgesture.h index 7ddd46c..d394ab7 100644 --- a/linden/indra/llcharacter/llgesture.h +++ b/linden/indra/llcharacter/llgesture.h @@ -18,7 +18,8 @@ * 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 + * 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, diff --git a/linden/indra/llcharacter/llhandmotion.cpp b/linden/indra/llcharacter/llhandmotion.cpp index be25de6..4c97fcd 100644 --- a/linden/indra/llcharacter/llhandmotion.cpp +++ b/linden/indra/llcharacter/llhandmotion.cpp @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llcharacter/llhandmotion.h b/linden/indra/llcharacter/llhandmotion.h index df341eb..dcf1696 100644 --- a/linden/indra/llcharacter/llhandmotion.h +++ b/linden/indra/llcharacter/llhandmotion.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llcharacter/llheadrotmotion.cpp b/linden/indra/llcharacter/llheadrotmotion.cpp index 979e320..88cd77f 100644 --- a/linden/indra/llcharacter/llheadrotmotion.cpp +++ b/linden/indra/llcharacter/llheadrotmotion.cpp @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llcharacter/llheadrotmotion.h b/linden/indra/llcharacter/llheadrotmotion.h index 0bef35c..97e61ea 100644 --- a/linden/indra/llcharacter/llheadrotmotion.h +++ b/linden/indra/llcharacter/llheadrotmotion.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llcharacter/lljoint.cpp b/linden/indra/llcharacter/lljoint.cpp index c96b8ad..37afcb7 100644 --- a/linden/indra/llcharacter/lljoint.cpp +++ b/linden/indra/llcharacter/lljoint.cpp @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llcharacter/lljoint.h b/linden/indra/llcharacter/lljoint.h index d4cc16d..b1a0b74 100644 --- a/linden/indra/llcharacter/lljoint.h +++ b/linden/indra/llcharacter/lljoint.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llcharacter/lljointsolverrp3.cpp b/linden/indra/llcharacter/lljointsolverrp3.cpp index f7e6dc7..0ea92a2 100644 --- a/linden/indra/llcharacter/lljointsolverrp3.cpp +++ b/linden/indra/llcharacter/lljointsolverrp3.cpp @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llcharacter/lljointsolverrp3.h b/linden/indra/llcharacter/lljointsolverrp3.h index 7d98cd8..75f9f9e 100644 --- a/linden/indra/llcharacter/lljointsolverrp3.h +++ b/linden/indra/llcharacter/lljointsolverrp3.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llcharacter/lljointstate.h b/linden/indra/llcharacter/lljointstate.h index 7b35ad9..16ad0e1 100644 --- a/linden/indra/llcharacter/lljointstate.h +++ b/linden/indra/llcharacter/lljointstate.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llcharacter/llkeyframefallmotion.cpp b/linden/indra/llcharacter/llkeyframefallmotion.cpp index 92f6505..15ad1b9 100644 --- a/linden/indra/llcharacter/llkeyframefallmotion.cpp +++ b/linden/indra/llcharacter/llkeyframefallmotion.cpp @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llcharacter/llkeyframefallmotion.h b/linden/indra/llcharacter/llkeyframefallmotion.h index 40a50bf..495be97 100644 --- a/linden/indra/llcharacter/llkeyframefallmotion.h +++ b/linden/indra/llcharacter/llkeyframefallmotion.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llcharacter/llkeyframemotion.cpp b/linden/indra/llcharacter/llkeyframemotion.cpp index 212020b..46dee09 100644 --- a/linden/indra/llcharacter/llkeyframemotion.cpp +++ b/linden/indra/llcharacter/llkeyframemotion.cpp @@ -17,7 +17,8 @@ * 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 + * 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, @@ -861,7 +862,7 @@ void LLKeyframeMotion::activateConstraint(JointConstraint* constraint) S32 joint_num; // grab ground position if we need to - if (shared_data->mConstraintTargetType == TYPE_GROUND) + if (shared_data->mConstraintTargetType == CONSTRAINT_TARGET_TYPE_GROUND) { LLVector3 source_pos = mCharacter->getVolumePos(shared_data->mSourceConstraintVolume, shared_data->mSourceConstraintOffset); LLVector3 ground_pos_agent; @@ -888,7 +889,7 @@ void LLKeyframeMotion::deactivateConstraint(JointConstraint *constraintp) constraintp->mSourceVolume->mUpdateXform = FALSE; } - if (!constraintp->mSharedData->mConstraintTargetType == TYPE_GROUND) + if (!constraintp->mSharedData->mConstraintTargetType == CONSTRAINT_TARGET_TYPE_GROUND) { if (constraintp->mTargetVolume) { @@ -958,11 +959,11 @@ void LLKeyframeMotion::applyConstraint(JointConstraint* constraint, F32 time, U8 switch(shared_data->mConstraintTargetType) { - case TYPE_GROUND: + case CONSTRAINT_TARGET_TYPE_GROUND: target_pos = mCharacter->getPosAgentFromGlobal(constraint->mGroundPos); // llinfos << "Target Pos " << constraint->mGroundPos << " on " << mCharacter->findCollisionVolume(shared_data->mSourceConstraintVolume)->getName() << llendl; break; - case TYPE_BODY: + case CONSTRAINT_TARGET_TYPE_BODY: target_pos = mCharacter->getVolumePos(shared_data->mTargetConstraintVolume, shared_data->mTargetConstraintOffset); break; default: @@ -973,14 +974,14 @@ void LLKeyframeMotion::applyConstraint(JointConstraint* constraint, F32 time, U8 LLJoint *source_jointp = NULL; LLJoint *target_jointp = NULL; - if (shared_data->mConstraintType == TYPE_PLANE) + if (shared_data->mConstraintType == CONSTRAINT_TYPE_PLANE) { switch(shared_data->mConstraintTargetType) { - case TYPE_GROUND: + case CONSTRAINT_TARGET_TYPE_GROUND: norm = constraint->mGroundNorm; break; - case TYPE_BODY: + case CONSTRAINT_TARGET_TYPE_BODY: target_jointp = mCharacter->findCollisionVolume(shared_data->mTargetConstraintVolume); if (target_jointp) { @@ -1226,6 +1227,12 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp) llwarns << "can't read duration" << llendl; return FALSE; } + + if (mJointMotionList->mDuration > MAX_ANIM_DURATION ) + { + llwarns << "invalid animation duration" << llendl; + return FALSE; + } //------------------------------------------------------------------------- // get emote (optional) @@ -1281,6 +1288,13 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp) llwarns << "can't read hand pose" << llendl; return FALSE; } + + if(word > LLHandMotion::NUM_HAND_POSES) + { + llwarns << "invalid LLHandMotion::eHandPose index: " << word << llendl; + return FALSE; + } + mJointMotionList->mHandPose = (LLHandMotion::eHandPose)word; //------------------------------------------------------------------------- @@ -1324,7 +1338,13 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp) llwarns << "can't read joint name" << llendl; return FALSE; } - + + if (joint_name == "mScreen" || joint_name == "mRoot") + { + llwarns << "attempted to animate special " << joint_name << " joint" << llendl; + return FALSE; + } + //--------------------------------------------------------------------- // find the corresponding joint //--------------------------------------------------------------------- @@ -1408,6 +1428,12 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp) } time = U16_to_F32(time_short, 0.f, mJointMotionList->mDuration); + + if (time < 0 || time > mJointMotionList->mDuration) + { + llwarns << "invalid frame time" << llendl; + return FALSE; + } } RotationKey rot_key; @@ -1437,6 +1463,12 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp) rot_key.mRotation.unpackFromVector3(rot_vec); } + if( !(rot_key.mRotation.isFinite()) ) + { + llwarns << "non-finite angle in rotation key" << llendl; + success = FALSE; + } + if (!success) { llwarns << "can't read rotation key (" << k << ")" << llendl; @@ -1508,7 +1540,13 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp) pos_key.mPosition.mV[VY] = U16_to_F32(y, -LL_MAX_PELVIS_OFFSET, LL_MAX_PELVIS_OFFSET); pos_key.mPosition.mV[VZ] = U16_to_F32(z, -LL_MAX_PELVIS_OFFSET, LL_MAX_PELVIS_OFFSET); } - + + if( !(pos_key.mPosition.isFinite()) ) + { + llwarns << "non-finite position in key" << llendl; + success = FALSE; + } + if (!success) { llwarns << "can't read position key (" << k << ")" << llendl; @@ -1538,7 +1576,7 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp) if (num_constraints > MAX_CONSTRAINTS) { - llwarns << "Too many constraints...ignoring" << llendl; + llwarns << "Too many constraints... ignoring" << llendl; } else { @@ -1560,12 +1598,26 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp) } constraintp->mChainLength = (S32) byte; + if((U32)constraintp->mChainLength > mJointMotionList->getNumJointMotions()) + { + llwarns << "invalid constraint chain length" << llendl; + delete constraintp; + return FALSE; + } + if (!dp.unpackU8(byte, "constraint_type")) { llwarns << "can't read constraint type" << llendl; delete constraintp; return FALSE; } + + if( byte >= NUM_CONSTRAINT_TYPES ) + { + llwarns << "invalid constraint type" << llendl; + delete constraintp; + return FALSE; + } constraintp->mConstraintType = (EConstraintType)byte; const S32 BIN_DATA_LENGTH = 16; @@ -1587,7 +1639,14 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp) delete constraintp; return FALSE; } - + + if( !(constraintp->mSourceConstraintOffset.isFinite()) ) + { + llwarns << "non-finite constraint source offset" << llendl; + delete constraintp; + return FALSE; + } + if (!dp.unpackBinaryDataFixed(bin_data, BIN_DATA_LENGTH, "target_volume")) { llwarns << "can't read target volume name" << llendl; @@ -1600,11 +1659,11 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp) if (str == "GROUND") { // constrain to ground - constraintp->mConstraintTargetType = TYPE_GROUND; + constraintp->mConstraintTargetType = CONSTRAINT_TARGET_TYPE_GROUND; } else { - constraintp->mConstraintTargetType = TYPE_BODY; + constraintp->mConstraintTargetType = CONSTRAINT_TARGET_TYPE_BODY; constraintp->mTargetConstraintVolume = mCharacter->getCollisionVolumeID(str); } @@ -1615,6 +1674,13 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp) return FALSE; } + if( !(constraintp->mTargetConstraintOffset.isFinite()) ) + { + llwarns << "non-finite constraint target offset" << llendl; + delete constraintp; + return FALSE; + } + if (!dp.unpackVector3(constraintp->mTargetConstraintDir, "target_dir")) { llwarns << "can't read constraint target direction" << llendl; @@ -1622,6 +1688,13 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp) return FALSE; } + if( !(constraintp->mTargetConstraintDir.isFinite()) ) + { + llwarns << "non-finite constraint target direction" << llendl; + delete constraintp; + return FALSE; + } + if (!constraintp->mTargetConstraintDir.isExactlyZero()) { constraintp->mUseTargetOffset = TRUE; @@ -1685,8 +1758,13 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp) break; } } + if (constraintp->mJointStateIndices[i] < 0 ) + { + llwarns << "No joint index for constraint " << i << llendl; + delete constraintp; + return FALSE; + } } - } } @@ -1776,7 +1854,7 @@ BOOL LLKeyframeMotion::serialize(LLDataPacker& dp) const mCharacter->findCollisionVolume(shared_constraintp->mSourceConstraintVolume)->getName().c_str()); success &= dp.packBinaryDataFixed((U8*)volume_name, 16, "source_volume"); success &= dp.packVector3(shared_constraintp->mSourceConstraintOffset, "source_offset"); - if (shared_constraintp->mConstraintTargetType == TYPE_GROUND) + if (shared_constraintp->mConstraintTargetType == CONSTRAINT_TARGET_TYPE_GROUND) { snprintf(volume_name,sizeof(volume_name), "%s", "GROUND"); /* Flawfinder: ignore */ } diff --git a/linden/indra/llcharacter/llkeyframemotion.h b/linden/indra/llcharacter/llkeyframemotion.h index 3c78090..7e8c844 100644 --- a/linden/indra/llcharacter/llkeyframemotion.h +++ b/linden/indra/llcharacter/llkeyframemotion.h @@ -17,7 +17,8 @@ * 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 + * 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, @@ -47,6 +48,7 @@ #include "v3dmath.h" #include "v3math.h" #include "llapr.h" +#include "llbvhconsts.h" class LLKeyframeDataCache; class LLVFS; @@ -197,18 +199,6 @@ public: static void flushKeyframeCache(); - typedef enum e_constraint_type - { - TYPE_POINT, - TYPE_PLANE - } EConstraintType; - - typedef enum e_constraint_target_type - { - TYPE_BODY, - TYPE_GROUND - } EConstraintTargetType; - protected: //------------------------------------------------------------------------- // JointConstraintSharedData @@ -223,8 +213,8 @@ protected: mEaseOutStartTime(0.f), mEaseOutStopTime(0.f), mUseTargetOffset(FALSE), - mConstraintType(TYPE_POINT), - mConstraintTargetType(TYPE_BODY), + mConstraintType(CONSTRAINT_TYPE_POINT), + mConstraintTargetType(CONSTRAINT_TARGET_TYPE_BODY), mSourceConstraintVolume(0), mTargetConstraintVolume(0), mJointStateIndices(NULL) diff --git a/linden/indra/llcharacter/llkeyframemotionparam.cpp b/linden/indra/llcharacter/llkeyframemotionparam.cpp index 385a848..a9c1f6f 100644 --- a/linden/indra/llcharacter/llkeyframemotionparam.cpp +++ b/linden/indra/llcharacter/llkeyframemotionparam.cpp @@ -17,7 +17,8 @@ * 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 + * 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, @@ -353,7 +354,9 @@ BOOL LLKeyframeMotionParam::loadMotions() // open the file //------------------------------------------------------------------------- S32 fileSize = 0; - apr_file_t* fp = ll_apr_file_open(path, LL_APR_R, &fileSize); + LLAPRFile infile ; + infile.open(path, LL_APR_R, NULL, &fileSize); + apr_file_t* fp = infile.getFileHandle() ; if (!fp || fileSize == 0) { llinfos << "ERROR: can't open: " << path << llendl; @@ -365,7 +368,6 @@ BOOL LLKeyframeMotionParam::loadMotions() if ( !text ) { llinfos << "ERROR: can't allocated keyframe text buffer." << llendl; - apr_file_close(fp); return FALSE; } @@ -392,7 +394,7 @@ BOOL LLKeyframeMotionParam::loadMotions() //------------------------------------------------------------------------- // close the file //------------------------------------------------------------------------- - apr_file_close( fp ); + infile.close(); //------------------------------------------------------------------------- // check for error diff --git a/linden/indra/llcharacter/llkeyframemotionparam.h b/linden/indra/llcharacter/llkeyframemotionparam.h index 849e869..f74aea2 100644 --- a/linden/indra/llcharacter/llkeyframemotionparam.h +++ b/linden/indra/llcharacter/llkeyframemotionparam.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llcharacter/llkeyframestandmotion.cpp b/linden/indra/llcharacter/llkeyframestandmotion.cpp index 21bef08..1d42298 100644 --- a/linden/indra/llcharacter/llkeyframestandmotion.cpp +++ b/linden/indra/llcharacter/llkeyframestandmotion.cpp @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llcharacter/llkeyframestandmotion.h b/linden/indra/llcharacter/llkeyframestandmotion.h index 102dcc3..b0500dc 100644 --- a/linden/indra/llcharacter/llkeyframestandmotion.h +++ b/linden/indra/llcharacter/llkeyframestandmotion.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llcharacter/llkeyframewalkmotion.cpp b/linden/indra/llcharacter/llkeyframewalkmotion.cpp index 59c09f2..b5817e5 100644 --- a/linden/indra/llcharacter/llkeyframewalkmotion.cpp +++ b/linden/indra/llcharacter/llkeyframewalkmotion.cpp @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llcharacter/llkeyframewalkmotion.h b/linden/indra/llcharacter/llkeyframewalkmotion.h index b836c3c..90dd4db 100644 --- a/linden/indra/llcharacter/llkeyframewalkmotion.h +++ b/linden/indra/llcharacter/llkeyframewalkmotion.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llcharacter/llmotion.cpp b/linden/indra/llcharacter/llmotion.cpp index af9ff58..ce926a3 100644 --- a/linden/indra/llcharacter/llmotion.cpp +++ b/linden/indra/llcharacter/llmotion.cpp @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llcharacter/llmotion.h b/linden/indra/llcharacter/llmotion.h index 34bc9c7..d6628fd 100644 --- a/linden/indra/llcharacter/llmotion.h +++ b/linden/indra/llcharacter/llmotion.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llcharacter/llmotioncontroller.cpp b/linden/indra/llcharacter/llmotioncontroller.cpp index 9afb8c7..006d2b5 100644 --- a/linden/indra/llcharacter/llmotioncontroller.cpp +++ b/linden/indra/llcharacter/llmotioncontroller.cpp @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llcharacter/llmotioncontroller.h b/linden/indra/llcharacter/llmotioncontroller.h index 51b4018..9271483 100644 --- a/linden/indra/llcharacter/llmotioncontroller.h +++ b/linden/indra/llcharacter/llmotioncontroller.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llcharacter/llmultigesture.cpp b/linden/indra/llcharacter/llmultigesture.cpp index c9285a1..7fe21db 100644 --- a/linden/indra/llcharacter/llmultigesture.cpp +++ b/linden/indra/llcharacter/llmultigesture.cpp @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llcharacter/llmultigesture.h b/linden/indra/llcharacter/llmultigesture.h index e1a6019..eb15f60 100644 --- a/linden/indra/llcharacter/llmultigesture.h +++ b/linden/indra/llcharacter/llmultigesture.h @@ -17,7 +17,8 @@ * 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 + * 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, @@ -107,6 +108,8 @@ public: }; +// Order must match the library_list in floater_preview_gesture.xml! + enum EStepType { STEP_ANIMATION = 0, diff --git a/linden/indra/llcharacter/llpose.cpp b/linden/indra/llcharacter/llpose.cpp index f7fee28..93255d7 100644 --- a/linden/indra/llcharacter/llpose.cpp +++ b/linden/indra/llcharacter/llpose.cpp @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llcharacter/llpose.h b/linden/indra/llcharacter/llpose.h index ebf6a87..5698f21 100644 --- a/linden/indra/llcharacter/llpose.h +++ b/linden/indra/llcharacter/llpose.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llcharacter/llstatemachine.cpp b/linden/indra/llcharacter/llstatemachine.cpp index 5643603..73c6951 100644 --- a/linden/indra/llcharacter/llstatemachine.cpp +++ b/linden/indra/llcharacter/llstatemachine.cpp @@ -17,7 +17,8 @@ * 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 + * 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, @@ -208,7 +209,9 @@ LLFSMState* LLStateDiagram::getState(U32 state_id) BOOL LLStateDiagram::saveDotFile(const std::string& filename) { - apr_file_t* dot_file = ll_apr_file_open(filename, LL_APR_W); + LLAPRFile outfile ; + outfile.open(filename, LL_APR_W); + apr_file_t* dot_file = outfile.getFileHandle() ; if (!dot_file) { @@ -257,8 +260,6 @@ BOOL LLStateDiagram::saveDotFile(const std::string& filename) apr_file_printf(dot_file, "}\n"); - apr_file_close(dot_file); - return TRUE; } diff --git a/linden/indra/llcharacter/llstatemachine.h b/linden/indra/llcharacter/llstatemachine.h index 9d9de9b..42e4995 100644 --- a/linden/indra/llcharacter/llstatemachine.h +++ b/linden/indra/llcharacter/llstatemachine.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llcharacter/lltargetingmotion.cpp b/linden/indra/llcharacter/lltargetingmotion.cpp index 07850b2..a330b22 100644 --- a/linden/indra/llcharacter/lltargetingmotion.cpp +++ b/linden/indra/llcharacter/lltargetingmotion.cpp @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llcharacter/lltargetingmotion.h b/linden/indra/llcharacter/lltargetingmotion.h index 07a2a99..1ec9f80 100644 --- a/linden/indra/llcharacter/lltargetingmotion.h +++ b/linden/indra/llcharacter/lltargetingmotion.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llcharacter/llvisualparam.cpp b/linden/indra/llcharacter/llvisualparam.cpp index 4a4ad8b..d7a144e 100644 --- a/linden/indra/llcharacter/llvisualparam.cpp +++ b/linden/indra/llcharacter/llvisualparam.cpp @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llcharacter/llvisualparam.h b/linden/indra/llcharacter/llvisualparam.h index 13850b6..3a0c1bb 100644 --- a/linden/indra/llcharacter/llvisualparam.h +++ b/linden/indra/llcharacter/llvisualparam.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/CMakeLists.txt b/linden/indra/llcommon/CMakeLists.txt index 4001e1f..3f14be6 100644 --- a/linden/indra/llcommon/CMakeLists.txt +++ b/linden/indra/llcommon/CMakeLists.txt @@ -20,6 +20,7 @@ set(llcommon_SOURCE_FILES llcommon.cpp llcrc.cpp llcriticaldamp.cpp + llcursortypes.cpp lldate.cpp llerror.cpp llerrorthread.cpp @@ -90,6 +91,7 @@ set(llcommon_HEADER_FILES llcommon.h llcrc.h llcriticaldamp.h + llcursortypes.h lldarray.h lldarrayptr.h lldate.h diff --git a/linden/indra/llcommon/bitpack.h b/linden/indra/llcommon/bitpack.h index bcbc880..cb9c70c 100644 --- a/linden/indra/llcommon/bitpack.h +++ b/linden/indra/llcommon/bitpack.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/ctype_workaround.h b/linden/indra/llcommon/ctype_workaround.h index ee35986..32ccb86 100644 --- a/linden/indra/llcommon/ctype_workaround.h +++ b/linden/indra/llcommon/ctype_workaround.h @@ -18,7 +18,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/doublelinkedlist.h b/linden/indra/llcommon/doublelinkedlist.h index 993ef00..a87860c 100644 --- a/linden/indra/llcommon/doublelinkedlist.h +++ b/linden/indra/llcommon/doublelinkedlist.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/imageids.h b/linden/indra/llcommon/imageids.h index 73ab1b8..832708c 100644 --- a/linden/indra/llcommon/imageids.h +++ b/linden/indra/llcommon/imageids.h @@ -17,7 +17,8 @@ * 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 + * 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, @@ -55,6 +56,7 @@ const LLUUID IMG_SPARK ("d2e75ac1-d0fb-4532-820e-a20034ac814d"); // dataserver const LLUUID IMG_FIRE ("aca40aa8-44cf-44ca-a0fa-93e1a2986f82"); // dataserver const LLUUID IMG_FACE_SELECT ("a85ac674-cb75-4af6-9499-df7c5aaf7a28"); // face selector const LLUUID IMG_DEFAULT_AVATAR ("c228d1cf-4b5d-4ba8-84f4-899a0796aa97"); // dataserver +const LLUUID IMG_INVISIBLE ("3a367d1c-bef1-6d43-7595-e88c1e3aadb3"); // dataserver const LLUUID IMG_EXPLOSION ("68edcf47-ccd7-45b8-9f90-1649d7f12806"); // On dataserver const LLUUID IMG_EXPLOSION_2 ("21ce046c-83fe-430a-b629-c7660ac78d7c"); // On dataserver diff --git a/linden/indra/llcommon/indra_constants.h b/linden/indra/llcommon/indra_constants.h index 087af6a..ae7863d 100644 --- a/linden/indra/llcommon/indra_constants.h +++ b/linden/indra/llcommon/indra_constants.h @@ -17,7 +17,8 @@ * 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 + * 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, @@ -77,6 +78,14 @@ enum LAND_STAT_REPORT_TYPE const U32 STAT_FILTER_MASK = 0x1FFFFFFF; +// Region absolute limits +static const S32 REGION_AGENT_COUNT_MIN = 1; +static const S32 REGION_AGENT_COUNT_MAX = 200; // Must fit in U8 for the moment (RegionInfo msg) +static const S32 REGION_PRIM_COUNT_MIN = 0; +static const S32 REGION_PRIM_COUNT_MAX = 40000; +static const F32 REGION_PRIM_BONUS_MIN = 1.0; +static const F32 REGION_PRIM_BONUS_MAX = 10.0; + // Default maximum number of tasks/prims per region. const U32 DEFAULT_MAX_REGION_WIDE_PRIM_COUNT = 15000; @@ -109,6 +118,7 @@ const char* const DEFAULT_AGNI_DATA_SERVER = "63.211.139.100"; const char* const DEFAULT_AGNI_ASSET_SERVER = "http://asset.agni.lindenlab.com:80"; // Information about what ports are for what services is in the wiki Name Space Ports page +// https://wiki.lindenlab.com/wiki/Name_Space_Ports const char* const DEFAULT_LOCAL_ASSET_SERVER = "http://localhost:12041/asset/tmp"; const char* const LOCAL_ASSET_URL_FORMAT = "http://%s:12041/asset"; @@ -129,6 +139,10 @@ const U32 DEFAULT_CAP_PROXY_PORT = 12043; const U32 DEFAULT_INV_DATA_SERVER_PORT = 12044; const U32 DEFAULT_CGI_SERVICES_PORT = 12045; +// Mapserver uses ports 12124 - 12139 to allow multiple mapservers to run +// on a single host for map tile generation. JC +const U32 DEFAULT_MAPSERVER_PORT = 12124; + // For automatic port discovery when running multiple viewers on one host const U32 PORT_DISCOVERY_RANGE_MIN = 13000; const U32 PORT_DISCOVERY_RANGE_MAX = PORT_DISCOVERY_RANGE_MIN + 50; @@ -229,12 +243,12 @@ const S32 KEY_COUNT = 256; const F32 DEFAULT_WATER_HEIGHT = 20.0f; // Maturity ratings for simulators -const U8 SIM_ACCESS_MIN = 0; -const U8 SIM_ACCESS_TRIAL = 7; +const U8 SIM_ACCESS_MIN = 0; // Treated as 'unknown', usually ends up being SIM_ACCESS_PG const U8 SIM_ACCESS_PG = 13; const U8 SIM_ACCESS_MATURE = 21; +const U8 SIM_ACCESS_ADULT = 42; // Seriously Adult Only const U8 SIM_ACCESS_DOWN = 254; -const U8 SIM_ACCESS_MAX = SIM_ACCESS_MATURE; +const U8 SIM_ACCESS_MAX = SIM_ACCESS_ADULT; // group constants const S32 MAX_AGENT_GROUPS = 25; @@ -345,6 +359,8 @@ const U32 MAP_ITEM_POPULAR = 0x04; const U32 MAP_ITEM_AGENT_LOCATIONS = 0x06; const U32 MAP_ITEM_LAND_FOR_SALE = 0x07; const U32 MAP_ITEM_CLASSIFIED = 0x08; +const U32 MAP_ITEM_ADULT_EVENT = 0x09; +const U32 MAP_ITEM_LAND_FOR_SALE_ADULT = 0x0a; // Crash reporter behavior const char* const CRASH_SETTINGS_FILE = "settings_crash_behavior.xml"; diff --git a/linden/indra/llcommon/is_approx_equal_fraction.h b/linden/indra/llcommon/is_approx_equal_fraction.h new file mode 100644 index 0000000..d369fbc --- /dev/null +++ b/linden/indra/llcommon/is_approx_equal_fraction.h @@ -0,0 +1,85 @@ +/** + * @file is_approx_equal_fraction.h + * @author Nat Goodspeed + * @date 2009-01-28 + * @brief lltut.h uses is_approx_equal_fraction(). Moved to this header + * file in llcommon so we can use lltut.h for llcommon tests without + * making llcommon depend on llmath. + * + * $LicenseInfo:firstyear=2009&license=viewergpl$ + * + * Copyright (c) 2009, 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$ + */ + +#if ! defined(LL_IS_APPROX_EQUAL_FRACTION_H) +#define LL_IS_APPROX_EQUAL_FRACTION_H + +#include "lldefs.h" +#include + +/** + * Originally llmath.h contained two complete implementations of + * is_approx_equal_fraction(), with signatures as below, bodies identical save + * where they specifically mentioned F32/F64. Unifying these into a template + * makes sense -- but to preserve the compiler's overload-selection behavior, + * we still wrap the template implementation with the specific overloaded + * signatures. + */ +template +inline BOOL is_approx_equal_fraction_impl(FTYPE x, FTYPE y, U32 frac_bits) +{ + BOOL ret = TRUE; + FTYPE diff = (FTYPE) fabs(x - y); + + S32 diffInt = (S32) diff; + S32 diffFracTolerance = (S32) ((diff - (FTYPE) diffInt) * (1 << frac_bits)); + + // if integer portion is not equal, not enough bits were used for packing + // so error out since either the use case is not correct OR there is + // an issue with pack/unpack. should fail in either case. + // for decimal portion, make sure that the delta is no more than 1 + // based on the number of bits used for packing decimal portion. + if (diffInt != 0 || diffFracTolerance > 1) + { + ret = FALSE; + } + + return ret; +} + +/// F32 flavor +inline BOOL is_approx_equal_fraction(F32 x, F32 y, U32 frac_bits) +{ + return is_approx_equal_fraction_impl(x, y, frac_bits); +} + +/// F64 flavor +inline BOOL is_approx_equal_fraction(F64 x, F64 y, U32 frac_bits) +{ + return is_approx_equal_fraction_impl(x, y, frac_bits); +} + +#endif /* ! defined(LL_IS_APPROX_EQUAL_FRACTION_H) */ diff --git a/linden/indra/llcommon/linden_common.h b/linden/indra/llcommon/linden_common.h index 70803ff..f9d5877 100644 --- a/linden/indra/llcommon/linden_common.h +++ b/linden/indra/llcommon/linden_common.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/linked_lists.h b/linden/indra/llcommon/linked_lists.h index f173d61..3d89a05 100644 --- a/linden/indra/llcommon/linked_lists.h +++ b/linden/indra/llcommon/linked_lists.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/llagentconstants.h b/linden/indra/llcommon/llagentconstants.h index fda8e9d..282db0a 100644 --- a/linden/indra/llcommon/llagentconstants.h +++ b/linden/indra/llcommon/llagentconstants.h @@ -18,7 +18,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/llapp.cpp b/linden/indra/llcommon/llapp.cpp index 6406d12..199315f 100644 --- a/linden/indra/llcommon/llapp.cpp +++ b/linden/indra/llcommon/llapp.cpp @@ -17,7 +17,8 @@ * 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 + * 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, @@ -57,7 +58,7 @@ void default_unix_signal_handler(int signum, siginfo_t *info, void *); /* OSX doesn't support SIGRT* */ S32 LL_SMACKDOWN_SIGNAL = SIGUSR1; S32 LL_HEARTBEAT_SIGNAL = SIGUSR2; -# else +# else // linux or (assumed) other similar unixoid /* We want reliable delivery of our signals - SIGRT* is it. */ /* Old LinuxThreads versions eat SIGRTMIN+0 to SIGRTMIN+2, avoid those. */ /* Note that SIGRTMIN/SIGRTMAX may expand to a glibc function call with a @@ -89,6 +90,12 @@ LLAppChildCallback LLApp::sDefaultChildCallback = NULL; LLApp::LLApp() : mThreadErrorp(NULL) { + commonCtor(); + startErrorThread(); +} + +void LLApp::commonCtor() +{ // Set our status to running setStatus(APP_STATUS_RUNNING); @@ -96,9 +103,9 @@ LLApp::LLApp() : mThreadErrorp(NULL) #if !LL_WINDOWS // This must be initialized before the error handler. - sSigChildCount = new LLAtomicU32(0); + sSigChildCount = new LLAtomicU32(0); #endif - + // Setup error handling setupErrorHandling(); @@ -118,6 +125,13 @@ LLApp::LLApp() : mThreadErrorp(NULL) // Set the application to this instance. sApplication = this; + +} + +LLApp::LLApp(LLErrorThread *error_thread) : + mThreadErrorp(error_thread) +{ + commonCtor(); } @@ -261,17 +275,20 @@ void LLApp::setupErrorHandling() #endif +} + +void LLApp::startErrorThread() +{ // // Start the error handling thread, which is responsible for taking action // when the app goes into the APP_STATUS_ERROR state // - llinfos << "LLApp::setupErrorHandling - Starting error thread" << llendl; + llinfos << "Starting error thread" << llendl; mThreadErrorp = new LLErrorThread(); mThreadErrorp->setUserData((void *) this); - mThreadErrorp->start(); + mThreadErrorp->start(); } - void LLApp::setErrorHandler(LLAppErrorHandler handler) { LLApp::sErrorHandler = handler; @@ -542,7 +559,9 @@ void setup_signals() sigaction(LL_SMACKDOWN_SIGNAL, &act, NULL); // Asynchronous signals that are normally ignored +#ifndef LL_IGNORE_SIGCHLD sigaction(SIGCHLD, &act, NULL); +#endif // LL_IGNORE_SIGCHLD sigaction(SIGUSR2, &act, NULL); // Asynchronous signals that result in attempted graceful exit @@ -576,7 +595,9 @@ void clear_signals() sigaction(LL_SMACKDOWN_SIGNAL, &act, NULL); // Asynchronous signals that are normally ignored +#ifndef LL_IGNORE_SIGCHLD sigaction(SIGCHLD, &act, NULL); +#endif // LL_IGNORE_SIGCHLD // Asynchronous signals that result in attempted graceful exit sigaction(SIGHUP, &act, NULL); diff --git a/linden/indra/llcommon/llapp.h b/linden/indra/llcommon/llapp.h index b5e72f5..f8a593c 100644 --- a/linden/indra/llcommon/llapp.h +++ b/linden/indra/llcommon/llapp.h @@ -17,7 +17,8 @@ * 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 + * 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, @@ -77,6 +78,11 @@ public: LLApp(); virtual ~LLApp(); +protected: + LLApp(LLErrorThread* error_thread); + void commonCtor(); +public: + /** * @brief Return the static app instance if one was created. */ @@ -183,6 +189,8 @@ public: #if !LL_WINDOWS static U32 getSigChildCount(); static void incSigChildCount(); +#else +#define getpid GetCurrentProcessId #endif static int getPid(); @@ -245,8 +253,9 @@ protected: void stepFrame(); private: + void startErrorThread(); + void setupErrorHandling(); // Do platform-specific error-handling setup (signals, structured exceptions) - static void runErrorHandler(); // run shortly after we detect an error, ran in the relatively robust context of the LLErrorThread - preferred. static void runSyncErrorHandler(); // run IMMEDIATELY when we get an error, ran in the context of the faulting thread. diff --git a/linden/indra/llcommon/llapr.cpp b/linden/indra/llcommon/llapr.cpp index 589d3f5..82530b1 100644 --- a/linden/indra/llcommon/llapr.cpp +++ b/linden/indra/llcommon/llapr.cpp @@ -19,7 +19,8 @@ * 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 + * 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, @@ -35,8 +36,10 @@ #include "llapr.h" apr_pool_t *gAPRPoolp = NULL; // Global APR memory pool +LLVolatileAPRPool *LLAPRFile::sAPRFilePoolp = NULL ; //global volatile APR memory pool. apr_thread_mutex_t *gLogMutexp = NULL; +const S32 FULL_VOLATILE_APR_POOL = 1024 ; //number of references to LLVolatileAPRPool void ll_init_apr() { @@ -45,10 +48,15 @@ void ll_init_apr() // Initialize APR and create the global pool apr_initialize(); apr_pool_create(&gAPRPoolp, NULL); - + // Initialize the logging mutex apr_thread_mutex_create(&gLogMutexp, APR_THREAD_MUTEX_UNNESTED, gAPRPoolp); } + + if(!LLAPRFile::sAPRFilePoolp) + { + LLAPRFile::sAPRFilePoolp = new LLVolatileAPRPool() ; + } } @@ -69,31 +77,127 @@ void ll_cleanup_apr() apr_pool_destroy(gAPRPoolp); gAPRPoolp = NULL; } + if (LLAPRFile::sAPRFilePoolp) + { + delete LLAPRFile::sAPRFilePoolp ; + LLAPRFile::sAPRFilePoolp = NULL ; + } apr_terminate(); } // +// //LLAPRPool // -LLAPRPool::LLAPRPool(apr_pool_t *parent, apr_size_t size) +LLAPRPool::LLAPRPool(apr_pool_t *parent, apr_size_t size, BOOL releasePoolFlag) { - mStatus = apr_pool_create(&mPool, parent); + mParent = parent ; + mReleasePoolFlag = releasePoolFlag ; + mMaxSize = size ; + mPool = NULL ; + + createAPRPool() ; +} + +LLAPRPool::~LLAPRPool() +{ + releaseAPRPool() ; +} - if(size > 0) //size is the number of blocks (which is usually 4K), NOT bytes. +void LLAPRPool::createAPRPool() +{ + if(mPool) + { + return ; + } + + mStatus = apr_pool_create(&mPool, mParent); + ll_apr_warn_status(mStatus) ; + + if(mMaxSize > 0) //size is the number of blocks (which is usually 4K), NOT bytes. { apr_allocator_t *allocator = apr_pool_allocator_get(mPool); if (allocator) { - apr_allocator_max_free_set(allocator, size) ; + apr_allocator_max_free_set(allocator, mMaxSize) ; } } } -LLAPRPool::~LLAPRPool() +void LLAPRPool::releaseAPRPool() +{ + if(!mPool) + { + return ; + } + + if(!mParent || mReleasePoolFlag) + { + apr_pool_destroy(mPool) ; + mPool = NULL ; + } +} + +apr_pool_t* LLAPRPool::getAPRPool() { - apr_pool_destroy(mPool) ; + if(!mPool) + { + createAPRPool() ; + } + + return mPool ; +} +LLVolatileAPRPool::LLVolatileAPRPool(apr_pool_t *parent, apr_size_t size, BOOL releasePoolFlag) + : LLAPRPool(parent, size, releasePoolFlag) +{ + mNumActiveRef = 0 ; + mNumTotalRef = 0 ; } +apr_pool_t* LLVolatileAPRPool::getVolatileAPRPool() +{ + mNumTotalRef++ ; + mNumActiveRef++ ; + return getAPRPool() ; +} + +void LLVolatileAPRPool::clearVolatileAPRPool() +{ + if(mNumActiveRef > 0) + { + mNumActiveRef--; + if(mNumActiveRef < 1) + { + if(isFull()) + { + mNumTotalRef = 0 ; + + //destroy the apr_pool. + releaseAPRPool() ; + } + else + { + //This does not actually free the memory, + //it just allows the pool to re-use this memory for the next allocation. + apr_pool_clear(mPool) ; + } + } + } + else + { + llassert_always(mNumActiveRef > 0) ; + } + + //paranoia check if the pool is jammed. + //will remove the check before going to release. + llassert_always(mNumTotalRef < (FULL_VOLATILE_APR_POOL << 2)) ; +} + +BOOL LLVolatileAPRPool::isFull() +{ + return mNumTotalRef > FULL_VOLATILE_APR_POOL ; +} +//--------------------------------------------------------------------- // // LLScopedLock // @@ -132,9 +236,8 @@ void LLScopedLock::unlock() } } -// -// Misc functions -// +//--------------------------------------------------------------------- + bool ll_apr_warn_status(apr_status_t status) { if(APR_SUCCESS == status) return false; @@ -150,55 +253,110 @@ void ll_apr_assert_status(apr_status_t status) llassert(ll_apr_warn_status(status) == false); } -// File I/O -apr_file_t* ll_apr_file_open(const std::string& filename, apr_int32_t flags, S32* sizep, apr_pool_t* pool) +//--------------------------------------------------------------------- +// +// LLAPRFile functions +// +LLAPRFile::LLAPRFile() +{ + mFile = NULL ; + mCurrentFilePoolp = NULL ; +} +LLAPRFile::~LLAPRFile() +{ + close() ; +} + +apr_status_t LLAPRFile::close() +{ + apr_status_t ret = APR_SUCCESS ; + if(mFile) + { + ret = apr_file_close(mFile); + mFile = NULL ; + } + + if(mCurrentFilePoolp) + { + mCurrentFilePoolp->clearVolatileAPRPool() ; + mCurrentFilePoolp = NULL ; + } + + return ret ; +} + +apr_status_t LLAPRFile::open(LLVolatileAPRPool* pool, const std::string& filename, apr_int32_t flags, S32* sizep) +{ + apr_status_t s ; + s = open(filename, flags, pool ? pool->getVolatileAPRPool() : NULL, sizep) ; + + if(!mCurrentFilePoolp) + { + mCurrentFilePoolp = pool ; + + if(!mFile) + { + close() ; + } + } + + return s ; +} +apr_status_t LLAPRFile::open(const std::string& filename, apr_int32_t flags, apr_pool_t* pool, S32* sizep) { - apr_file_t* apr_file; apr_status_t s; - if (pool == NULL) pool = gAPRPoolp; - s = apr_file_open(&apr_file, filename.c_str(), flags, APR_OS_DEFAULT, pool); - if (s != APR_SUCCESS) + + //check if already open some file + llassert_always(!mFile) ; + llassert_always(!mCurrentFilePoolp) ; + + s = apr_file_open(&mFile, filename.c_str(), flags, APR_OS_DEFAULT, getAPRFilePool(pool)); + if (s != APR_SUCCESS || !mFile) { + mFile = NULL ; + close() ; if (sizep) { *sizep = 0; } - return NULL; + return s; } if (sizep) { S32 file_size = 0; apr_off_t offset = 0; - if (apr_file_seek(apr_file, APR_END, &offset) == APR_SUCCESS) + if (apr_file_seek(mFile, APR_END, &offset) == APR_SUCCESS) { llassert_always(offset <= 0x7fffffff); file_size = (S32)offset; offset = 0; - apr_file_seek(apr_file, APR_SET, &offset); + apr_file_seek(mFile, APR_SET, &offset); } *sizep = file_size; } - return apr_file; + return s; } -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 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 std::string& filename, apr_int32_t flags) -{ - return ll_apr_file_open(filename, flags, NULL, NULL); + +apr_pool_t* LLAPRFile::getAPRFilePool(apr_pool_t* pool) +{ + if(!pool) + { + mCurrentFilePoolp = sAPRFilePoolp ; + return mCurrentFilePoolp->getVolatileAPRPool() ; + } + + return pool ; } -S32 ll_apr_file_read(apr_file_t* apr_file, void *buf, S32 nbytes) +// File I/O +S32 LLAPRFile::read(void *buf, S32 nbytes) { + llassert_always(mFile) ; + apr_size_t sz = nbytes; - apr_status_t s = apr_file_read(apr_file, buf, &sz); + apr_status_t s = apr_file_read(mFile, buf, &sz); if (s != APR_SUCCESS) { return 0; @@ -210,165 +368,273 @@ S32 ll_apr_file_read(apr_file_t* apr_file, void *buf, S32 nbytes) } } -S32 ll_apr_file_read_ex(const std::string& filename, apr_pool_t* pool, void *buf, S32 offset, S32 nbytes) +S32 LLAPRFile::write(const void *buf, S32 nbytes) { - if (pool == NULL) pool = gAPRPoolp; - apr_file_t* filep = ll_apr_file_open(filename, APR_READ|APR_BINARY, pool); - if (!filep) + llassert_always(mFile) ; + + apr_size_t sz = nbytes; + apr_status_t s = apr_file_write(mFile, buf, &sz); + if (s != APR_SUCCESS) { return 0; } - S32 off; - if (offset < 0) - off = ll_apr_file_seek(filep, APR_END, 0); else - off = ll_apr_file_seek(filep, APR_SET, offset); - S32 bytes_read; - if (off < 0) { - bytes_read = 0; + llassert_always(sz <= 0x7fffffff); + return (S32)sz; } - else +} + +S32 LLAPRFile::seek(apr_seek_where_t where, S32 offset) +{ + return LLAPRFile::seek(mFile, where, offset) ; +} + +// +//******************************************************************************************************************************* +//static components of LLAPRFile +// + +//static +apr_status_t LLAPRFile::close(apr_file_t* file_handle, LLVolatileAPRPool* pool) +{ + apr_status_t ret = APR_SUCCESS ; + if(file_handle) { - bytes_read = ll_apr_file_read(filep, buf, nbytes ); + ret = apr_file_close(file_handle); + file_handle = NULL ; } - apr_file_close(filep); - return bytes_read; + if(pool) + { + pool->clearVolatileAPRPool() ; + } + + return ret ; } -S32 ll_apr_file_write(apr_file_t* apr_file, const void *buf, S32 nbytes) +//static +apr_file_t* LLAPRFile::open(const std::string& filename, LLVolatileAPRPool* pool, apr_int32_t flags) { - apr_size_t sz = nbytes; - apr_status_t s = apr_file_write(apr_file, buf, &sz); + apr_status_t s; + apr_file_t* file_handle ; + + pool = pool ? pool : LLAPRFile::sAPRFilePoolp ; + + s = apr_file_open(&file_handle, filename.c_str(), flags, APR_OS_DEFAULT, pool->getVolatileAPRPool()); + if (s != APR_SUCCESS || !file_handle) + { + file_handle = NULL ; + close(file_handle, pool) ; + return NULL; + } + + return file_handle ; +} + +//static +S32 LLAPRFile::seek(apr_file_t* file_handle, apr_seek_where_t where, S32 offset) +{ + if(!file_handle) + { + return -1 ; + } + + apr_status_t s; + apr_off_t apr_offset; + if (offset >= 0) + { + apr_offset = (apr_off_t)offset; + s = apr_file_seek(file_handle, where, &apr_offset); + } + else + { + apr_offset = 0; + s = apr_file_seek(file_handle, APR_END, &apr_offset); + } if (s != APR_SUCCESS) { + return -1; + } + else + { + llassert_always(apr_offset <= 0x7fffffff); + return (S32)apr_offset; + } +} + +//static +S32 LLAPRFile::readEx(const std::string& filename, void *buf, S32 offset, S32 nbytes, LLVolatileAPRPool* pool) +{ + //***************************************** + apr_file_t* file_handle = open(filename, pool, APR_READ|APR_BINARY); + //***************************************** + if (!file_handle) + { return 0; } + + S32 off; + if (offset < 0) + off = LLAPRFile::seek(file_handle, APR_END, 0); else + off = LLAPRFile::seek(file_handle, APR_SET, offset); + + apr_size_t bytes_read; + if (off < 0) { - llassert_always(sz <= 0x7fffffff); - return (S32)sz; + bytes_read = 0; } + else + { + bytes_read = nbytes ; + apr_status_t s = apr_file_read(file_handle, buf, &bytes_read); + if (s != APR_SUCCESS) + { + bytes_read = 0; + } + else + { + llassert_always(bytes_read <= 0x7fffffff); + } + } + + //***************************************** + close(file_handle, pool) ; + //***************************************** + return (S32)bytes_read; } -S32 ll_apr_file_write_ex(const std::string& filename, apr_pool_t* pool, void *buf, S32 offset, S32 nbytes) +//static +S32 LLAPRFile::writeEx(const std::string& filename, void *buf, S32 offset, S32 nbytes, LLVolatileAPRPool* pool) { - if (pool == NULL) pool = gAPRPoolp; apr_int32_t flags = APR_CREATE|APR_WRITE|APR_BINARY; if (offset < 0) { flags |= APR_APPEND; offset = 0; } - apr_file_t* filep = ll_apr_file_open(filename, flags, pool); - if (!filep) + + //***************************************** + apr_file_t* file_handle = open(filename, pool, flags); + //***************************************** + if (!file_handle) { return 0; } + if (offset > 0) { - offset = ll_apr_file_seek(filep, APR_SET, offset); + offset = LLAPRFile::seek(file_handle, APR_SET, offset); } - S32 bytes_written; + + apr_size_t bytes_written; if (offset < 0) { bytes_written = 0; } else { - bytes_written = ll_apr_file_write(filep, buf, nbytes ); + bytes_written = nbytes ; + apr_status_t s = apr_file_write(file_handle, buf, &bytes_written); + if (s != APR_SUCCESS) + { + bytes_written = 0; + } + else + { + llassert_always(bytes_written <= 0x7fffffff); + } } - apr_file_close(filep); - return bytes_written; -} + //***************************************** + LLAPRFile::close(file_handle, pool); + //***************************************** -S32 ll_apr_file_seek(apr_file_t* apr_file, apr_seek_where_t where, S32 offset) -{ - apr_status_t s; - apr_off_t apr_offset; - if (offset >= 0) - { - apr_offset = (apr_off_t)offset; - s = apr_file_seek(apr_file, where, &apr_offset); - } - else - { - apr_offset = 0; - s = apr_file_seek(apr_file, APR_END, &apr_offset); - } - if (s != APR_SUCCESS) - { - return -1; - } - else - { - llassert_always(apr_offset <= 0x7fffffff); - return (S32)apr_offset; - } + return (S32)bytes_written; } -bool ll_apr_file_remove(const std::string& filename, apr_pool_t* pool) +//static +bool LLAPRFile::remove(const std::string& filename, LLVolatileAPRPool* pool) { apr_status_t s; - if (pool == NULL) pool = gAPRPoolp; - s = apr_file_remove(filename.c_str(), pool); + + pool = pool ? pool : LLAPRFile::sAPRFilePoolp ; + s = apr_file_remove(filename.c_str(), pool->getVolatileAPRPool()); + pool->clearVolatileAPRPool() ; + if (s != APR_SUCCESS) { - LL_DEBUGS("APR") << "ll_apr_file_remove failed on file: " << filename << LL_ENDL; + LL_DEBUGS("APR") << "LLAPRFile::remove failed on file: " << filename << LL_ENDL; ll_apr_warn_status(s); return false; } return true; } -bool ll_apr_file_rename(const std::string& filename, const std::string& newname, apr_pool_t* pool) +//static +bool LLAPRFile::rename(const std::string& filename, const std::string& newname, LLVolatileAPRPool* pool) { apr_status_t s; - if (pool == NULL) pool = gAPRPoolp; - s = apr_file_rename(filename.c_str(), newname.c_str(), pool); + + pool = pool ? pool : LLAPRFile::sAPRFilePoolp ; + s = apr_file_rename(filename.c_str(), newname.c_str(), pool->getVolatileAPRPool()); + pool->clearVolatileAPRPool() ; + if (s != APR_SUCCESS) { - LL_DEBUGS("APR") << "ll_apr_file_rename failed on file: " << filename << LL_ENDL; + LL_DEBUGS("APR") << "LLAPRFile::rename failed on file: " << filename << LL_ENDL; ll_apr_warn_status(s); return false; } return true; } -bool ll_apr_file_exists(const std::string& filename, apr_pool_t* pool) +//static +bool LLAPRFile::isExist(const std::string& filename, LLVolatileAPRPool* pool, apr_int32_t flags) { apr_file_t* apr_file; apr_status_t s; - if (pool == NULL) pool = gAPRPoolp; - s = apr_file_open(&apr_file, filename.c_str(), APR_READ, APR_OS_DEFAULT, pool); + + pool = pool ? pool : LLAPRFile::sAPRFilePoolp ; + s = apr_file_open(&apr_file, filename.c_str(), flags, APR_OS_DEFAULT, pool->getVolatileAPRPool()); + if (s != APR_SUCCESS || !apr_file) { + pool->clearVolatileAPRPool() ; return false; } else { - apr_file_close(apr_file); + apr_file_close(apr_file) ; + pool->clearVolatileAPRPool() ; return true; } } -S32 ll_apr_file_size(const std::string& filename, apr_pool_t* pool) +//static +S32 LLAPRFile::size(const std::string& filename, LLVolatileAPRPool* pool) { apr_file_t* apr_file; apr_finfo_t info; apr_status_t s; - if (pool == NULL) pool = gAPRPoolp; - s = apr_file_open(&apr_file, filename.c_str(), APR_READ, APR_OS_DEFAULT, pool); + + pool = pool ? pool : LLAPRFile::sAPRFilePoolp ; + s = apr_file_open(&apr_file, filename.c_str(), APR_READ, APR_OS_DEFAULT, pool->getVolatileAPRPool()); + if (s != APR_SUCCESS || !apr_file) - { + { + pool->clearVolatileAPRPool() ; + return 0; } else { - apr_status_t s = apr_file_info_get(&info, APR_FINFO_SIZE, apr_file); - apr_file_close(apr_file); + apr_status_t s = apr_file_info_get(&info, APR_FINFO_SIZE, apr_file); + + apr_file_close(apr_file) ; + pool->clearVolatileAPRPool() ; + if (s == APR_SUCCESS) { return (S32)info.size; @@ -380,31 +646,42 @@ S32 ll_apr_file_size(const std::string& filename, apr_pool_t* pool) } } -bool ll_apr_dir_make(const std::string& dirname, apr_pool_t* pool) +//static +bool LLAPRFile::makeDir(const std::string& dirname, LLVolatileAPRPool* pool) { apr_status_t s; - if (pool == NULL) pool = gAPRPoolp; - s = apr_dir_make(dirname.c_str(), APR_FPROT_OS_DEFAULT, pool); + + pool = pool ? pool : LLAPRFile::sAPRFilePoolp ; + s = apr_dir_make(dirname.c_str(), APR_FPROT_OS_DEFAULT, pool->getVolatileAPRPool()); + pool->clearVolatileAPRPool() ; + if (s != APR_SUCCESS) { - LL_DEBUGS("APR") << "ll_apr_dir_make failed on file: " << dirname << LL_ENDL; + LL_DEBUGS("APR") << "LLAPRFile::makeDir failed on file: " << dirname << LL_ENDL; ll_apr_warn_status(s); return false; } return true; } -bool ll_apr_dir_remove(const std::string& dirname, apr_pool_t* pool) +//static +bool LLAPRFile::removeDir(const std::string& dirname, LLVolatileAPRPool* pool) { apr_status_t s; - if (pool == NULL) pool = gAPRPoolp; - s = apr_file_remove(dirname.c_str(), pool); + + pool = pool ? pool : LLAPRFile::sAPRFilePoolp ; + s = apr_file_remove(dirname.c_str(), pool->getVolatileAPRPool()); + pool->clearVolatileAPRPool() ; + if (s != APR_SUCCESS) { - LL_DEBUGS("APR") << "ll_apr_dir_remove failed on file: " << dirname << LL_ENDL; + LL_DEBUGS("APR") << "LLAPRFile::removeDir failed on file: " << dirname << LL_ENDL; ll_apr_warn_status(s); return false; } return true; } - +// +//end of static components of LLAPRFile +//******************************************************************************************************************************* +// diff --git a/linden/indra/llcommon/llapr.h b/linden/indra/llcommon/llapr.h index a80c1d6..44ad2dd 100644 --- a/linden/indra/llcommon/llapr.h +++ b/linden/indra/llcommon/llapr.h @@ -19,7 +19,8 @@ * 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 + * 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, @@ -60,18 +61,51 @@ void ll_init_apr(); */ void ll_cleanup_apr(); +// +//LL apr_pool +//manage apr_pool_t, destroy allocated apr_pool in the destruction function. +// class LLAPRPool { public: - LLAPRPool(apr_pool_t *parent = NULL, apr_size_t size = 0) ; + LLAPRPool(apr_pool_t *parent = NULL, apr_size_t size = 0, BOOL releasePoolFlag = TRUE) ; ~LLAPRPool() ; - apr_pool_t* getAPRPool() {return mPool ; } + apr_pool_t* getAPRPool() ; apr_status_t getStatus() {return mStatus ; } +protected: + void releaseAPRPool() ; + void createAPRPool() ; + +protected: + apr_pool_t* mPool ; //pointing to an apr_pool + apr_pool_t* mParent ; //parent pool + apr_size_t mMaxSize ; //max size of mPool, mPool should return memory to system if allocated memory beyond this limit. However it seems not to work. + apr_status_t mStatus ; //status when creating the pool + BOOL mReleasePoolFlag ; //if set, mPool is destroyed when LLAPRPool is deleted. default value is true. +}; + +// +//volatile LL apr_pool +//which clears memory automatically. +//so it can not hold static data or data after memory is cleared +// +class LLVolatileAPRPool : public LLAPRPool +{ +public: + LLVolatileAPRPool(apr_pool_t *parent = NULL, apr_size_t size = 0, BOOL releasePoolFlag = TRUE); + ~LLVolatileAPRPool(){} + + apr_pool_t* getVolatileAPRPool() ; + + void clearVolatileAPRPool() ; + + BOOL isFull() ; + BOOL isEmpty() {return !mNumActiveRef ;} private: - apr_pool_t* mPool ; - apr_status_t mStatus ; + S32 mNumActiveRef ; //number of active pointers pointing to the apr_pool. + S32 mNumTotalRef ; //number of total pointers pointing to the apr_pool since last creating. } ; /** @@ -144,24 +178,71 @@ 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 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 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 std::string& filename, apr_pool_t* pool, void *buf, S32 offset, S32 nbytes); -// returns false if failure: -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); + +// +//apr_file manager +//which: 1)only keeps one file open; +// 2)closes the open file in the destruction function +// 3)informs the apr_pool to clean the memory when the file is closed. +//Note: please close an open file at the earliest convenience. +// especially do not put some time-costly operations between open() and close(). +// otherwise it might lock the APRFilePool. +//there are two different apr_pools the APRFile can use: +// 1, a temperary pool passed to an APRFile function, which is used within this function and only once. +// 2, a global pool. +// +class LLAPRFile +{ +private: + apr_file_t* mFile ; + LLVolatileAPRPool *mCurrentFilePoolp ; //currently in use apr_pool, could be one of them: sAPRFilePoolp, or a temp pool. + +public: + LLAPRFile() ; + ~LLAPRFile() ; + + apr_status_t open(LLVolatileAPRPool* pool, const std::string& filename, apr_int32_t flags, S32* sizep = NULL); + apr_status_t open(const std::string& filename, apr_int32_t flags, apr_pool_t* pool = NULL, S32* sizep = NULL); + apr_status_t close() ; + + // Returns actual offset, -1 if seek fails + S32 seek(apr_seek_where_t where, S32 offset); + apr_status_t eof() { return apr_file_eof(mFile);} + + // Returns bytes read/written, 0 if read/write fails: + S32 read(void* buf, S32 nbytes); + S32 write(const void* buf, S32 nbytes); + + apr_file_t* getFileHandle() {return mFile;} + +private: + apr_pool_t* getAPRFilePool(apr_pool_t* pool) ; + +// +//******************************************************************************************************************************* +//static components +// +public: + static LLVolatileAPRPool *sAPRFilePoolp ; //a global apr_pool for APRFile, which is used only when local pool does not exist. + +private: + static apr_file_t* open(const std::string& filename, LLVolatileAPRPool* pool, apr_int32_t flags); + static apr_status_t close(apr_file_t* file, LLVolatileAPRPool* pool) ; + static S32 seek(apr_file_t* file, apr_seek_where_t where, S32 offset); +public: + // returns false if failure: + static bool remove(const std::string& filename, LLVolatileAPRPool* pool = NULL); + static bool rename(const std::string& filename, const std::string& newname, LLVolatileAPRPool* pool = NULL); + static bool isExist(const std::string& filename, LLVolatileAPRPool* pool = NULL, apr_int32_t flags = APR_READ); + static S32 size(const std::string& filename, LLVolatileAPRPool* pool = NULL); + static bool makeDir(const std::string& dirname, LLVolatileAPRPool* pool = NULL); + static bool removeDir(const std::string& dirname, LLVolatileAPRPool* pool = NULL); + + // Returns bytes read/written, 0 if read/write fails: + static S32 readEx(const std::string& filename, void *buf, S32 offset, S32 nbytes, LLVolatileAPRPool* pool = NULL); + static S32 writeEx(const std::string& filename, void *buf, S32 offset, S32 nbytes, LLVolatileAPRPool* pool = NULL); +//******************************************************************************************************************************* +}; /** * @brief Function which approprately logs error or remains quiet on diff --git a/linden/indra/llcommon/llassettype.cpp b/linden/indra/llcommon/llassettype.cpp index 33e23e8..cf3bf89 100644 --- a/linden/indra/llcommon/llassettype.cpp +++ b/linden/indra/llcommon/llassettype.cpp @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/llassettype.h b/linden/indra/llcommon/llassettype.h index 35b993d..4077b8d 100644 --- a/linden/indra/llcommon/llassettype.h +++ b/linden/indra/llcommon/llassettype.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/llassoclist.h b/linden/indra/llcommon/llassoclist.h index 722d29f..5aa26ea 100644 --- a/linden/indra/llcommon/llassoclist.h +++ b/linden/indra/llcommon/llassoclist.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/llavatarconstants.h b/linden/indra/llcommon/llavatarconstants.h index 1b385b8..6517b70 100644 --- a/linden/indra/llcommon/llavatarconstants.h +++ b/linden/indra/llcommon/llavatarconstants.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/llbase32.cpp b/linden/indra/llcommon/llbase32.cpp index 79f560f..5e6ced9 100644 --- a/linden/indra/llcommon/llbase32.cpp +++ b/linden/indra/llcommon/llbase32.cpp @@ -22,7 +22,8 @@ * 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 + * 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, @@ -145,8 +146,6 @@ base32_encode(char *dst, size_t size, const void *data, size_t len) /* *TODO: Implement base32 encode. -#define ARRAY_LEN(a) (sizeof (a) / sizeof((a)[0])) - static inline int ascii_toupper(int c) { @@ -172,7 +171,7 @@ base32_decode(char *dst, size_t size, const void *data, size_t len) unsigned max_pad = 3; if (0 == base32_map[0]) { - for (i = 0; i < ARRAY_LEN(base32_map); i++) { + for (i = 0; i < LL_ARRAY_SIZE(base32_map); i++) { const char *x; x = memchr(base32_alphabet, ascii_toupper(i), sizeof base32_alphabet); @@ -196,7 +195,7 @@ base32_decode(char *dst, size_t size, const void *data, size_t len) } } - j = i % ARRAY_LEN(s); + j = i % LL_ARRAY_SIZE(s); s[j] = c; if (7 == j) { @@ -208,7 +207,7 @@ base32_decode(char *dst, size_t size, const void *data, size_t len) b[3] = ((s[4] & 1) << 7) | ((s[5] & 0x1f) << 2) | ((s[6] >> 3) & 0x03); b[4] = ((s[6] & 0x07) << 5) | (s[7] & 0x1f); - for (j = 0; j < ARRAY_LEN(b); j++) { + for (j = 0; j < LL_ARRAY_SIZE(b); j++) { if (q != end) *q = b[j]; q++; diff --git a/linden/indra/llcommon/llbase32.h b/linden/indra/llcommon/llbase32.h index 667d8eb..63a93e1 100644 --- a/linden/indra/llcommon/llbase32.h +++ b/linden/indra/llcommon/llbase32.h @@ -18,7 +18,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/llbase64.cpp b/linden/indra/llcommon/llbase64.cpp index 304fd08..7020a79 100644 --- a/linden/indra/llcommon/llbase64.cpp +++ b/linden/indra/llcommon/llbase64.cpp @@ -18,7 +18,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/llbase64.h b/linden/indra/llcommon/llbase64.h index 24c3f3e..58414bb 100644 --- a/linden/indra/llcommon/llbase64.h +++ b/linden/indra/llcommon/llbase64.h @@ -18,7 +18,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/llboost.h b/linden/indra/llcommon/llboost.h index 9eb7cd7..4df9dbf 100644 --- a/linden/indra/llcommon/llboost.h +++ b/linden/indra/llcommon/llboost.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/llchat.h b/linden/indra/llcommon/llchat.h index 1bb3f3b..7b010d6 100644 --- a/linden/indra/llcommon/llchat.h +++ b/linden/indra/llcommon/llchat.h @@ -18,7 +18,8 @@ * 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 + * 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, @@ -77,7 +78,8 @@ public: mAudible(CHAT_AUDIBLE_FULLY), mMuted(FALSE), mTime(0.0), - mPosAgent() + mPosAgent(), + mURL() { } std::string mText; // UTF-8 line of text @@ -89,6 +91,7 @@ public: BOOL mMuted; // pass muted chat to maintain list of chatters F64 mTime; // viewer only, seconds from viewer start LLVector3 mPosAgent; + std::string mURL; }; #endif diff --git a/linden/indra/llcommon/llclickaction.h b/linden/indra/llcommon/llclickaction.h index 1193c32..8048724 100644 --- a/linden/indra/llcommon/llclickaction.h +++ b/linden/indra/llcommon/llclickaction.h @@ -18,7 +18,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/llcommon.cpp b/linden/indra/llcommon/llcommon.cpp index 1875044..2cbb718 100644 --- a/linden/indra/llcommon/llcommon.cpp +++ b/linden/indra/llcommon/llcommon.cpp @@ -16,7 +16,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/llcommon.h b/linden/indra/llcommon/llcommon.h index 0cb5c0e..5f77988 100644 --- a/linden/indra/llcommon/llcommon.h +++ b/linden/indra/llcommon/llcommon.h @@ -16,7 +16,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/llcrc.cpp b/linden/indra/llcommon/llcrc.cpp index 593a385..7f183dc 100644 --- a/linden/indra/llcommon/llcrc.cpp +++ b/linden/indra/llcommon/llcrc.cpp @@ -17,7 +17,8 @@ * 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 + * 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, @@ -196,6 +197,10 @@ void LLCRC::update(const std::string& filename) update(data, nread); delete[] data; } + else + { + fclose(fp); + } } } diff --git a/linden/indra/llcommon/llcrc.h b/linden/indra/llcommon/llcrc.h index 3dd2b3f..27fae7d 100644 --- a/linden/indra/llcommon/llcrc.h +++ b/linden/indra/llcommon/llcrc.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/llcriticaldamp.cpp b/linden/indra/llcommon/llcriticaldamp.cpp index cc0caed..b6f715b 100644 --- a/linden/indra/llcommon/llcriticaldamp.cpp +++ b/linden/indra/llcommon/llcriticaldamp.cpp @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/llcriticaldamp.h b/linden/indra/llcommon/llcriticaldamp.h index 17659da..ad98284 100644 --- a/linden/indra/llcommon/llcriticaldamp.h +++ b/linden/indra/llcommon/llcriticaldamp.h @@ -18,7 +18,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/llcursortypes.cpp b/linden/indra/llcommon/llcursortypes.cpp new file mode 100644 index 0000000..7444115 --- /dev/null +++ b/linden/indra/llcommon/llcursortypes.cpp @@ -0,0 +1,90 @@ +/** + * @file llcursortypes.cpp + * @brief Cursor types and lookup of types from a string + * + * $LicenseInfo:firstyear=2008&license=viewergpl$ + * + * Copyright (c) 2008-2009, 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 "llcursortypes.h" + +ECursorType getCursorFromString(const std::string& cursor_string) +{ + static std::map cursor_string_table; + if (cursor_string_table.empty()) + { + cursor_string_table["UI_CURSOR_ARROW"] = UI_CURSOR_ARROW; + cursor_string_table["UI_CURSOR_WAIT"] = UI_CURSOR_WAIT; + cursor_string_table["UI_CURSOR_HAND"] = UI_CURSOR_HAND; + cursor_string_table["UI_CURSOR_IBEAM"] = UI_CURSOR_IBEAM; + cursor_string_table["UI_CURSOR_CROSS"] = UI_CURSOR_CROSS; + cursor_string_table["UI_CURSOR_SIZENWSE"] = UI_CURSOR_SIZENWSE; + cursor_string_table["UI_CURSOR_SIZENESW"] = UI_CURSOR_SIZENESW; + cursor_string_table["UI_CURSOR_SIZEWE"] = UI_CURSOR_SIZEWE; + cursor_string_table["UI_CURSOR_SIZENS"] = UI_CURSOR_SIZENS; + cursor_string_table["UI_CURSOR_NO"] = UI_CURSOR_NO; + cursor_string_table["UI_CURSOR_WORKING"] = UI_CURSOR_WORKING; + cursor_string_table["UI_CURSOR_TOOLGRAB"] = UI_CURSOR_TOOLGRAB; + cursor_string_table["UI_CURSOR_TOOLLAND"] = UI_CURSOR_TOOLLAND; + cursor_string_table["UI_CURSOR_TOOLFOCUS"] = UI_CURSOR_TOOLFOCUS; + cursor_string_table["UI_CURSOR_TOOLCREATE"] = UI_CURSOR_TOOLCREATE; + cursor_string_table["UI_CURSOR_ARROWDRAG"] = UI_CURSOR_ARROWDRAG; + cursor_string_table["UI_CURSOR_ARROWCOPY"] = UI_CURSOR_ARROWCOPY; + cursor_string_table["UI_CURSOR_ARROWDRAGMULTI"] = UI_CURSOR_ARROWDRAGMULTI; + cursor_string_table["UI_CURSOR_ARROWCOPYMULTI"] = UI_CURSOR_ARROWCOPYMULTI; + cursor_string_table["UI_CURSOR_NOLOCKED"] = UI_CURSOR_NOLOCKED; + cursor_string_table["UI_CURSOR_ARROWLOCKED"] = UI_CURSOR_ARROWLOCKED; + cursor_string_table["UI_CURSOR_GRABLOCKED"] = UI_CURSOR_GRABLOCKED; + cursor_string_table["UI_CURSOR_TOOLTRANSLATE"] = UI_CURSOR_TOOLTRANSLATE; + cursor_string_table["UI_CURSOR_TOOLROTATE"] = UI_CURSOR_TOOLROTATE; + cursor_string_table["UI_CURSOR_TOOLSCALE"] = UI_CURSOR_TOOLSCALE; + cursor_string_table["UI_CURSOR_TOOLCAMERA"] = UI_CURSOR_TOOLCAMERA; + cursor_string_table["UI_CURSOR_TOOLPAN"] = UI_CURSOR_TOOLPAN; + cursor_string_table["UI_CURSOR_TOOLZOOMIN"] = UI_CURSOR_TOOLZOOMIN; + cursor_string_table["UI_CURSOR_TOOLPICKOBJECT3"] = UI_CURSOR_TOOLPICKOBJECT3; + cursor_string_table["UI_CURSOR_TOOLSIT"] = UI_CURSOR_TOOLSIT; + cursor_string_table["UI_CURSOR_TOOLBUY"] = UI_CURSOR_TOOLBUY; + cursor_string_table["UI_CURSOR_TOOLPAY"] = UI_CURSOR_TOOLPAY; + cursor_string_table["UI_CURSOR_TOOLOPEN"] = UI_CURSOR_TOOLOPEN; + cursor_string_table["UI_CURSOR_TOOLPLAY"] = UI_CURSOR_TOOLPLAY; + cursor_string_table["UI_CURSOR_TOOLPAUSE"] = UI_CURSOR_TOOLPAUSE; + cursor_string_table["UI_CURSOR_TOOLMEDIAOPEN"] = UI_CURSOR_TOOLMEDIAOPEN; + cursor_string_table["UI_CURSOR_PIPETTE"] = UI_CURSOR_PIPETTE; + } + + std::map::const_iterator iter = cursor_string_table.find(cursor_string); + + if (iter != cursor_string_table.end()) + { + return (ECursorType)iter->second; + } + + return UI_CURSOR_ARROW; +} + + + diff --git a/linden/indra/llcommon/llcursortypes.h b/linden/indra/llcommon/llcursortypes.h new file mode 100644 index 0000000..bea7035 --- /dev/null +++ b/linden/indra/llcommon/llcursortypes.h @@ -0,0 +1,82 @@ +/** + * @file llcursortypes.h + * @brief Cursor types + * + * $LicenseInfo:firstyear=2008&license=viewergpl$ + * + * Copyright (c) 2008-2009, 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_LLCURSORTYPES_H +#define LL_LLCURSORTYPES_H + +#include "linden_common.h" + +// If you add types here, add them in LLCursor::getCursorFromString +enum ECursorType { + UI_CURSOR_ARROW, + UI_CURSOR_WAIT, + UI_CURSOR_HAND, + UI_CURSOR_IBEAM, + UI_CURSOR_CROSS, + UI_CURSOR_SIZENWSE, + UI_CURSOR_SIZENESW, + UI_CURSOR_SIZEWE, + UI_CURSOR_SIZENS, + UI_CURSOR_NO, + UI_CURSOR_WORKING, + UI_CURSOR_TOOLGRAB, + UI_CURSOR_TOOLLAND, + UI_CURSOR_TOOLFOCUS, + UI_CURSOR_TOOLCREATE, + UI_CURSOR_ARROWDRAG, + UI_CURSOR_ARROWCOPY, // drag with copy + UI_CURSOR_ARROWDRAGMULTI, + UI_CURSOR_ARROWCOPYMULTI, // drag with copy + UI_CURSOR_NOLOCKED, + UI_CURSOR_ARROWLOCKED, + UI_CURSOR_GRABLOCKED, + UI_CURSOR_TOOLTRANSLATE, + UI_CURSOR_TOOLROTATE, + UI_CURSOR_TOOLSCALE, + UI_CURSOR_TOOLCAMERA, + UI_CURSOR_TOOLPAN, + UI_CURSOR_TOOLZOOMIN, + UI_CURSOR_TOOLPICKOBJECT3, + UI_CURSOR_TOOLSIT, + UI_CURSOR_TOOLBUY, + UI_CURSOR_TOOLPAY, + UI_CURSOR_TOOLOPEN, + UI_CURSOR_TOOLPLAY, + UI_CURSOR_TOOLPAUSE, + UI_CURSOR_TOOLMEDIAOPEN, + UI_CURSOR_PIPETTE, + UI_CURSOR_COUNT // Number of elements in this enum (NOT a cursor) +}; + +ECursorType getCursorFromString(const std::string& cursor_string); + +#endif // LL_LLCURSORTYPES_H diff --git a/linden/indra/llcommon/lldarray.h b/linden/indra/llcommon/lldarray.h index 3b84aab..0e56a11 100644 --- a/linden/indra/llcommon/lldarray.h +++ b/linden/indra/llcommon/lldarray.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/lldarrayptr.h b/linden/indra/llcommon/lldarrayptr.h index 06336a7..7fde52b 100644 --- a/linden/indra/llcommon/lldarrayptr.h +++ b/linden/indra/llcommon/lldarrayptr.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/lldate.cpp b/linden/indra/llcommon/lldate.cpp index 512b3ee..41a3af3 100644 --- a/linden/indra/llcommon/lldate.cpp +++ b/linden/indra/llcommon/lldate.cpp @@ -19,7 +19,8 @@ * 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 + * 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, @@ -36,9 +37,12 @@ #include "apr_time.h" +#include #include #include +#include "lltimer.h" + static const F64 DATE_EPOCH = 0.0; static const F64 LL_APR_USEC_PER_SEC = 1000000.0; @@ -122,7 +126,7 @@ void LLDate::toHTTPDateStream(std::ostream& s) const << " GMT"; // RFC 1123 date does not use microseconds - llinfos << "Date in RFC 1123 format is " << s << llendl; + //llinfos << "Date in RFC 1123 format is " << s << llendl; } void LLDate::toStream(std::ostream& s) const @@ -234,6 +238,17 @@ void LLDate::secondsSinceEpoch(F64 seconds) mSecondsSinceEpoch = seconds; } +/* static */ LLDate LLDate::now() +{ + // time() returns seconds, we want fractions of a second, which LLTimer provides --RN + return LLDate(LLTimer::getTotalSeconds()); +} + +bool LLDate::operator<(const LLDate& rhs) const +{ + return mSecondsSinceEpoch < rhs.mSecondsSinceEpoch; +} + std::ostream& operator<<(std::ostream& s, const LLDate& date) { date.toStream(s); @@ -245,3 +260,4 @@ std::istream& operator>>(std::istream& s, LLDate& date) date.fromStream(s); return s; } + diff --git a/linden/indra/llcommon/lldate.h b/linden/indra/llcommon/lldate.h index 7adf724..32825b1 100644 --- a/linden/indra/llcommon/lldate.h +++ b/linden/indra/llcommon/lldate.h @@ -19,7 +19,8 @@ * 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 + * 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, @@ -35,6 +36,7 @@ #define LL_LLDATE_H #include +#include #include "stdtypes.h" @@ -53,7 +55,7 @@ public: LLDate(); /** - * @brief Construct a date equal to epoch. + * @brief Construct a date equal to the source date. */ LLDate(const LLDate& date); @@ -111,12 +113,37 @@ public: * @param seconds The number of seconds since epoch UTC. */ void secondsSinceEpoch(F64 seconds); + + /** + * @brief Create an LLDate object set to the current time. + * + * @return The number of seconds since epoch UTC. + */ + static LLDate now(); + + /** + * @brief Compare dates using operator< so we can order them using STL. + * + * @param rhs -- the right hand side of the comparison operator + */ + bool operator<(const LLDate& rhs) const; + + /** + * @brief Remaining comparison operators in terms of operator< + * This conforms to the expectation of STL. + * + * @param rhs -- the right hand side of the comparison operator + */ + bool operator>(const LLDate& rhs) const { return rhs < *this; } + bool operator<=(const LLDate& rhs) const { return !(rhs < *this); } + bool operator>=(const LLDate& rhs) const { return !(*this < rhs); } + bool operator!=(const LLDate& rhs) const { return (*this < rhs) || (rhs < *this); } + bool operator==(const LLDate& rhs) const { return !(*this != rhs); } private: F64 mSecondsSinceEpoch; }; - // Helper function to stream out a date std::ostream& operator<<(std::ostream& s, const LLDate& date); diff --git a/linden/indra/llcommon/lldefs.h b/linden/indra/llcommon/lldefs.h index c0ff00b..f3b5ca3 100644 --- a/linden/indra/llcommon/lldefs.h +++ b/linden/indra/llcommon/lldefs.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/lldepthstack.h b/linden/indra/llcommon/lldepthstack.h index c099f13..accc11f 100644 --- a/linden/indra/llcommon/lldepthstack.h +++ b/linden/indra/llcommon/lldepthstack.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/lldlinked.h b/linden/indra/llcommon/lldlinked.h index 0d8e812..8b68532 100644 --- a/linden/indra/llcommon/lldlinked.h +++ b/linden/indra/llcommon/lldlinked.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/lldqueueptr.h b/linden/indra/llcommon/lldqueueptr.h index eede159..77df47b 100644 --- a/linden/indra/llcommon/lldqueueptr.h +++ b/linden/indra/llcommon/lldqueueptr.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/llendianswizzle.h b/linden/indra/llcommon/llendianswizzle.h index f119a5b..043d330 100644 --- a/linden/indra/llcommon/llendianswizzle.h +++ b/linden/indra/llcommon/llendianswizzle.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/llenum.h b/linden/indra/llcommon/llenum.h index a93eb31..ac6d46b 100644 --- a/linden/indra/llcommon/llenum.h +++ b/linden/indra/llcommon/llenum.h @@ -18,7 +18,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/llerror.cpp b/linden/indra/llcommon/llerror.cpp index 5d50f3b..5e520af 100644 --- a/linden/indra/llcommon/llerror.cpp +++ b/linden/indra/llcommon/llerror.cpp @@ -18,7 +18,8 @@ * 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 + * 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, @@ -989,6 +990,38 @@ namespace LLError return new std::ostringstream; } + + void Log::flush(std::ostringstream* out, char* message) + { + LogLock lock; + if (!lock.ok()) + { + return; + } + + if(strlen(out->str().c_str()) < 128) + { + strcpy(message, out->str().c_str()); + } + else + { + strncpy(message, out->str().c_str(), 127); + message[127] = '\0' ; + } + + Globals& g = Globals::get(); + if (out == &g.messageStream) + { + g.messageStream.clear(); + g.messageStream.str(""); + g.messageStreamInUse = false; + } + else + { + delete out; + } + return ; + } void Log::flush(std::ostringstream* out, const CallSite& site) { @@ -1204,3 +1237,94 @@ namespace LLError } } +namespace LLError +{ + char** LLCallStacks::sBuffer = NULL ; + S32 LLCallStacks::sIndex = 0 ; + + //static + void LLCallStacks::push(const char* function, const int line) + { + if(!sBuffer) + { + sBuffer = new char*[512] ; + sBuffer[0] = new char[512 * 128] ; + for(S32 i = 1 ; i < 512 ; i++) + { + sBuffer[i] = sBuffer[i-1] + 128 ; + } + sIndex = 0 ; + } + + if(sIndex > 511) + { + clear() ; + } + + strcpy(sBuffer[sIndex], function) ; + sprintf(sBuffer[sIndex] + strlen(function), " line: %d ", line) ; + sIndex++ ; + + return ; + } + + //static + std::ostringstream* LLCallStacks::insert(const char* function, const int line) + { + std::ostringstream* _out = LLError::Log::out(); + *_out << function << " line " << line << " " ; + + return _out ; + } + + //static + void LLCallStacks::end(std::ostringstream* _out) + { + if(!sBuffer) + { + sBuffer = new char*[512] ; + sBuffer[0] = new char[512 * 128] ; + for(S32 i = 1 ; i < 512 ; i++) + { + sBuffer[i] = sBuffer[i-1] + 128 ; + } + sIndex = 0 ; + } + + if(sIndex > 511) + { + clear() ; + } + + LLError::Log::flush(_out, sBuffer[sIndex++]) ; + } + + //static + void LLCallStacks::print() + { + if(sIndex > 0) + { + llinfos << " ************* PRINT OUT LL CALL STACKS ************* " << llendl ; + while(sIndex > 0) + { + sIndex-- ; + llinfos << sBuffer[sIndex] << llendl ; + } + llinfos << " *************** END OF LL CALL STACKS *************** " << llendl ; + } + + if(sBuffer) + { + delete[] sBuffer[0] ; + delete[] sBuffer ; + sBuffer = NULL ; + } + } + + //static + void LLCallStacks::clear() + { + sIndex = 0 ; + } +} + diff --git a/linden/indra/llcommon/llerror.h b/linden/indra/llcommon/llerror.h index 211f89f..6794be4 100644 --- a/linden/indra/llcommon/llerror.h +++ b/linden/indra/llcommon/llerror.h @@ -18,7 +18,8 @@ * 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 + * 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, @@ -37,6 +38,7 @@ #include #include "llerrorlegacy.h" +#include "stdtypes.h" /* Error Logging Facility @@ -134,6 +136,7 @@ namespace LLError public: static bool shouldLog(CallSite&); static std::ostringstream* out(); + static void flush(std::ostringstream* out, char* message) ; static void flush(std::ostringstream*, const CallSite&); }; @@ -178,9 +181,41 @@ namespace LLError class NoClassInfo { }; // used to indicate no class info known for logging -} + //LLCallStacks keeps track of call stacks and output the call stacks to log file + //when LLAppViewer::handleViewerCrash() is triggered. + // + //Note: to be simple, efficient and necessary to keep track of correct call stacks, + //LLCallStacks is designed not to be thread-safe. + //so try not to use it in multiple parallel threads at same time. + //Used in a single thread at a time is fine. + class LLCallStacks + { + private: + static char** sBuffer ; + static S32 sIndex ; + + public: + static void push(const char* function, const int line) ; + static std::ostringstream* insert(const char* function, const int line) ; + static void print() ; + static void clear() ; + static void end(std::ostringstream* _out) ; + }; +} +//this is cheaper than llcallstacks if no need to output other variables to call stacks. +#define llpushcallstacks LLError::LLCallStacks::push(__FUNCTION__, __LINE__) +#define llcallstacks \ + {\ + std::ostringstream* _out = LLError::LLCallStacks::insert(__FUNCTION__, __LINE__) ; \ + (*_out) +#define llcallstacksendl \ + LLError::End(); \ + LLError::LLCallStacks::end(_out) ; \ + } +#define llclearcallstacks LLError::LLCallStacks::clear() +#define llprintcallstacks LLError::LLCallStacks::print() /* Class type information for logging diff --git a/linden/indra/llcommon/llerrorcontrol.h b/linden/indra/llcommon/llerrorcontrol.h index 9888444..a55d706 100644 --- a/linden/indra/llcommon/llerrorcontrol.h +++ b/linden/indra/llcommon/llerrorcontrol.h @@ -18,7 +18,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/llerrorlegacy.h b/linden/indra/llcommon/llerrorlegacy.h index 71cec83..143fe20 100644 --- a/linden/indra/llcommon/llerrorlegacy.h +++ b/linden/indra/llcommon/llerrorlegacy.h @@ -18,7 +18,8 @@ * 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 + * 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, @@ -52,6 +53,7 @@ const int LL_ERR_FILE_NOT_FOUND = -43; const int LL_ERR_FILE_EMPTY = -44; const int LL_ERR_TCP_TIMEOUT = -23016; const int LL_ERR_CIRCUIT_GONE = -23017; +const int LL_ERR_PRICE_MISMATCH = -23018; diff --git a/linden/indra/llcommon/llerrorthread.cpp b/linden/indra/llcommon/llerrorthread.cpp index d3e522d..4c779c5 100644 --- a/linden/indra/llcommon/llerrorthread.cpp +++ b/linden/indra/llcommon/llerrorthread.cpp @@ -16,7 +16,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/llerrorthread.h b/linden/indra/llcommon/llerrorthread.h index 56d2a23..f1d6ffc 100644 --- a/linden/indra/llcommon/llerrorthread.h +++ b/linden/indra/llcommon/llerrorthread.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/llevent.cpp b/linden/indra/llcommon/llevent.cpp index 8b81837..24be6e8 100644 --- a/linden/indra/llcommon/llevent.cpp +++ b/linden/indra/llcommon/llevent.cpp @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/llevent.h b/linden/indra/llcommon/llevent.h index 3b20a61..60887a0 100644 --- a/linden/indra/llcommon/llevent.h +++ b/linden/indra/llcommon/llevent.h @@ -18,7 +18,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/lleventemitter.h b/linden/indra/llcommon/lleventemitter.h index e3f143b..2d15b01 100644 --- a/linden/indra/llcommon/lleventemitter.h +++ b/linden/indra/llcommon/lleventemitter.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/llextendedstatus.h b/linden/indra/llcommon/llextendedstatus.h index 56cd872..4f954ff 100644 --- a/linden/indra/llcommon/llextendedstatus.h +++ b/linden/indra/llcommon/llextendedstatus.h @@ -18,7 +18,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/llfasttimer.cpp b/linden/indra/llcommon/llfasttimer.cpp index 3304528..cdaadb0 100644 --- a/linden/indra/llcommon/llfasttimer.cpp +++ b/linden/indra/llcommon/llfasttimer.cpp @@ -17,7 +17,8 @@ * 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 + * 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, @@ -48,6 +49,8 @@ ////////////////////////////////////////////////////////////////////////////// // statics + +LLFastTimer::EFastTimerType LLFastTimer::sCurType = LLFastTimer::FTM_OTHER; int LLFastTimer::sCurDepth = 0; U64 LLFastTimer::sStart[LLFastTimer::FTM_MAX_DEPTH]; U64 LLFastTimer::sCounter[LLFastTimer::FTM_NUM_TYPES]; diff --git a/linden/indra/llcommon/llfasttimer.h b/linden/indra/llcommon/llfasttimer.h index a32da18..94b5111 100644 --- a/linden/indra/llcommon/llfasttimer.h +++ b/linden/indra/llcommon/llfasttimer.h @@ -17,7 +17,8 @@ * 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 + * 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, @@ -70,6 +71,14 @@ public: FTM_UPDATE_AVATAR, // common render components + FTM_SHADOW_GEOMETRY, + FTM_SHADOW_RENDER, + FTM_SHADOW_TERRAIN, + FTM_SHADOW_AVATAR, + FTM_SHADOW_SIMPLE, + FTM_SHADOW_ALPHA, + FTM_SHADOW_TREE, + FTM_RENDER_GEOMETRY, FTM_RENDER_TERRAIN, FTM_RENDER_SIMPLE, @@ -185,11 +194,13 @@ public: enum { FTM_MAX_DEPTH = 64 }; public: + static LLFastTimer::EFastTimerType sCurType; + LLFastTimer(EFastTimerType type) { #if FAST_TIMER_ON mType = type; - + sCurType = type; // These don't get counted, because they use CPU clockticks //gTimerBins[gCurTimerBin]++; //LLTimer::sNumTimerCalls++; diff --git a/linden/indra/llcommon/llfile.cpp b/linden/indra/llcommon/llfile.cpp index 7395d24..2a76f7f 100644 --- a/linden/indra/llcommon/llfile.cpp +++ b/linden/indra/llcommon/llfile.cpp @@ -20,7 +20,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/llfile.h b/linden/indra/llcommon/llfile.h index d0a0b8e..c6092f7 100644 --- a/linden/indra/llcommon/llfile.h +++ b/linden/indra/llcommon/llfile.h @@ -20,7 +20,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/llfindlocale.cpp b/linden/indra/llcommon/llfindlocale.cpp index c0d4aff..505f5c5 100644 --- a/linden/indra/llcommon/llfindlocale.cpp +++ b/linden/indra/llcommon/llfindlocale.cpp @@ -17,7 +17,8 @@ * 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 + * 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, @@ -416,10 +417,8 @@ static const IDToCode primary_to_code[] = { /*{LANG_WALON, "wa"},*/ {LANG_CHINESE, "zh"}, }; -static int num_primary_to_code = - sizeof(primary_to_code) / sizeof(*primary_to_code); -static int num_both_to_code = - sizeof(both_to_code) / sizeof(*both_to_code); +static int num_primary_to_code = LL_ARRAY_SIZE(primary_to_code); +static int num_both_to_code = LL_ARRAY_SIZE(both_to_code); static const int lcid_to_fl(LCID lcid, diff --git a/linden/indra/llcommon/llfindlocale.h b/linden/indra/llcommon/llfindlocale.h index 56ec976..f17c774 100644 --- a/linden/indra/llcommon/llfindlocale.h +++ b/linden/indra/llcommon/llfindlocale.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/llfixedbuffer.cpp b/linden/indra/llcommon/llfixedbuffer.cpp index a819150..e9d6029 100644 --- a/linden/indra/llcommon/llfixedbuffer.cpp +++ b/linden/indra/llcommon/llfixedbuffer.cpp @@ -16,7 +16,8 @@ * 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 + * 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, @@ -32,6 +33,7 @@ #include "llfixedbuffer.h" LLFixedBuffer::LLFixedBuffer(const U32 max_lines) + : mMutex(NULL) { mMaxLines = max_lines; mTimer.reset(); @@ -46,9 +48,11 @@ LLFixedBuffer::~LLFixedBuffer() void LLFixedBuffer::clear() { + mMutex.lock() ; mLines.clear(); mAddTimes.clear(); mLineLengths.clear(); + mMutex.unlock() ; mTimer.reset(); } @@ -69,9 +73,11 @@ void LLFixedBuffer::addLine(const LLWString& line) removeExtraLines(); + mMutex.lock() ; mLines.push_back(line); mLineLengths.push_back((S32)line.length()); mAddTimes.push_back(mTimer.getElapsedTimeF32()); + mMutex.unlock() ; } @@ -85,10 +91,12 @@ void LLFixedBuffer::setMaxLines(S32 max_lines) void LLFixedBuffer::removeExtraLines() { + mMutex.lock() ; while ((S32)mLines.size() > llmax((S32)0, (S32)(mMaxLines - 1))) { mLines.pop_front(); mAddTimes.pop_front(); mLineLengths.pop_front(); } + mMutex.unlock() ; } diff --git a/linden/indra/llcommon/llfixedbuffer.h b/linden/indra/llcommon/llfixedbuffer.h index dcd4dfb..992a024 100644 --- a/linden/indra/llcommon/llfixedbuffer.h +++ b/linden/indra/llcommon/llfixedbuffer.h @@ -17,7 +17,8 @@ * 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 + * 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, @@ -36,6 +37,7 @@ #include #include #include "llstring.h" +#include "llthread.h" // Fixed size buffer for console output and other things. @@ -52,14 +54,19 @@ public: std::deque mLineLengths; void clear(); // Clear the buffer, and reset it. - virtual void addLine(const std::string& utf8line); - virtual void addLine(const LLWString& line); + + //do not make these two "virtual" + void addLine(const std::string& utf8line); + void addLine(const LLWString& line); // Get lines currently in the buffer, up to max_size chars, max_length lines char *getLines(U32 max_size = 0, U32 max_length = 0); void setMaxLines(S32 max_lines); protected: virtual void removeExtraLines(); + +protected: + LLMutex mMutex ; }; const U32 FIXED_BUF_MAX_LINE_LEN = 255; // Not including termnating 0 diff --git a/linden/indra/llcommon/llformat.cpp b/linden/indra/llcommon/llformat.cpp index 4a9fce6..cf509be 100644 --- a/linden/indra/llcommon/llformat.cpp +++ b/linden/indra/llcommon/llformat.cpp @@ -18,7 +18,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/llformat.h b/linden/indra/llcommon/llformat.h index a29afcc..44c62d9 100644 --- a/linden/indra/llcommon/llformat.h +++ b/linden/indra/llcommon/llformat.h @@ -18,7 +18,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/llframetimer.cpp b/linden/indra/llcommon/llframetimer.cpp index aca1ec5..138c67a 100644 --- a/linden/indra/llcommon/llframetimer.cpp +++ b/linden/indra/llcommon/llframetimer.cpp @@ -16,7 +16,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/llframetimer.h b/linden/indra/llcommon/llframetimer.h index fa88af6..8f51272 100644 --- a/linden/indra/llcommon/llframetimer.h +++ b/linden/indra/llcommon/llframetimer.h @@ -18,7 +18,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/llhash.h b/linden/indra/llcommon/llhash.h index 0344d63..0ce1088 100644 --- a/linden/indra/llcommon/llhash.h +++ b/linden/indra/llcommon/llhash.h @@ -17,7 +17,8 @@ * 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 + * 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, @@ -53,15 +54,20 @@ #error Please define your platform. #endif -template inline size_t llhash(T value) -{ +// Warning - an earlier template-based version of this routine did not do +// the correct thing on Windows. Since this is only used to get +// a string hash, it was converted to a regular routine and +// unit tests added. + +inline size_t llhash( const char * value ) +{ #if LL_WINDOWS - return stdext::hash_value(value); + return stdext::hash_value(value); #elif ( (defined _STLPORT_VERSION) || ((LL_LINUX) && (__GNUC__ <= 2)) ) - std::hash H; + std::hash H; return H(value); #elif LL_DARWIN || LL_LINUX || LL_SOLARIS - __gnu_cxx::hash H; + __gnu_cxx::hash H; return H(value); #else #error Please define your platform. diff --git a/linden/indra/llcommon/llheartbeat.cpp b/linden/indra/llcommon/llheartbeat.cpp index 0777ac3..49c0ad5 100644 --- a/linden/indra/llcommon/llheartbeat.cpp +++ b/linden/indra/llcommon/llheartbeat.cpp @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/llheartbeat.h b/linden/indra/llcommon/llheartbeat.h index 7cfdda6..fecb5b1 100644 --- a/linden/indra/llcommon/llheartbeat.h +++ b/linden/indra/llcommon/llheartbeat.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/llhttpstatuscodes.h b/linden/indra/llcommon/llhttpstatuscodes.h index 9f625a0..83dde17 100644 --- a/linden/indra/llcommon/llhttpstatuscodes.h +++ b/linden/indra/llcommon/llhttpstatuscodes.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/llindexedqueue.h b/linden/indra/llcommon/llindexedqueue.h index d41da6b..1b80e6e 100644 --- a/linden/indra/llcommon/llindexedqueue.h +++ b/linden/indra/llcommon/llindexedqueue.h @@ -18,7 +18,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/llindraconfigfile.cpp b/linden/indra/llcommon/llindraconfigfile.cpp index d64bc8f..ca63e28 100644 --- a/linden/indra/llcommon/llindraconfigfile.cpp +++ b/linden/indra/llcommon/llindraconfigfile.cpp @@ -5,16 +5,27 @@ * This class is an LLLiveFile that has config info for indra * Currently only whether it's blacklisted * - * $LicenseInfo:firstyear=2007&license=internal$ + * $LicenseInfo:firstyear=2007&license=viewergpl$ * * Copyright (c) 2007-2009, 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. + * 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, diff --git a/linden/indra/llcommon/llindraconfigfile.h b/linden/indra/llcommon/llindraconfigfile.h index c426276..232e408 100644 --- a/linden/indra/llcommon/llindraconfigfile.h +++ b/linden/indra/llcommon/llindraconfigfile.h @@ -2,16 +2,27 @@ * @file llindraconfigfile.h * @brief manages configuration file for indra.xml * - * $LicenseInfo:firstyear=2007&license=internal$ + * $LicenseInfo:firstyear=2007&license=viewergpl$ * * Copyright (c) 2007-2009, 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. + * 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, diff --git a/linden/indra/llcommon/llkeythrottle.h b/linden/indra/llcommon/llkeythrottle.h index 3b5e595..873f50a 100644 --- a/linden/indra/llcommon/llkeythrottle.h +++ b/linden/indra/llcommon/llkeythrottle.h @@ -16,7 +16,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/llkeyusetracker.h b/linden/indra/llcommon/llkeyusetracker.h index 1c196bc..1dc29ce 100644 --- a/linden/indra/llcommon/llkeyusetracker.h +++ b/linden/indra/llcommon/llkeyusetracker.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/lllinkedqueue.h b/linden/indra/llcommon/lllinkedqueue.h index 7b87909..3f0eb18 100644 --- a/linden/indra/llcommon/lllinkedqueue.h +++ b/linden/indra/llcommon/lllinkedqueue.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/llliveappconfig.cpp b/linden/indra/llcommon/llliveappconfig.cpp index 21b646b..e1bfc11 100644 --- a/linden/indra/llcommon/llliveappconfig.cpp +++ b/linden/indra/llcommon/llliveappconfig.cpp @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/llliveappconfig.h b/linden/indra/llcommon/llliveappconfig.h index 2a96661..55d84a4 100644 --- a/linden/indra/llcommon/llliveappconfig.h +++ b/linden/indra/llcommon/llliveappconfig.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/lllivefile.cpp b/linden/indra/llcommon/lllivefile.cpp index a1e2d8f..810ae70 100644 --- a/linden/indra/llcommon/lllivefile.cpp +++ b/linden/indra/llcommon/lllivefile.cpp @@ -16,7 +16,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/lllivefile.h b/linden/indra/llcommon/lllivefile.h index 8bf0371..fddf006 100644 --- a/linden/indra/llcommon/lllivefile.h +++ b/linden/indra/llcommon/lllivefile.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/lllocalidhashmap.h b/linden/indra/llcommon/lllocalidhashmap.h index c264ac0..a58ae2e 100644 --- a/linden/indra/llcommon/lllocalidhashmap.h +++ b/linden/indra/llcommon/lllocalidhashmap.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/lllog.cpp b/linden/indra/llcommon/lllog.cpp index d5fb2a0..db5d25d 100644 --- a/linden/indra/llcommon/lllog.cpp +++ b/linden/indra/llcommon/lllog.cpp @@ -19,7 +19,8 @@ * 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 + * 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, @@ -45,8 +46,8 @@ public: LLLogImpl(LLApp* app) : mApp(app) {} ~LLLogImpl() {} - void log(const std::string message, LLSD& info); - bool useLegacyLogMessage(const std::string message); + void log(const std::string &message, LLSD& info); + bool useLegacyLogMessage(const std::string &message); private: LLApp* mApp; @@ -54,7 +55,7 @@ private: //@brief Function to log a message to syslog for streambase to collect. -void LLLogImpl::log(const std::string message, LLSD& info) +void LLLogImpl::log(const std::string &message, LLSD& info) { static S32 sequence = 0; LLSD log_config = mApp->getOption("log-messages"); @@ -74,7 +75,7 @@ void LLLogImpl::log(const std::string message, LLSD& info) } //@brief Function to check if specified legacy log message should be sent. -bool LLLogImpl::useLegacyLogMessage(const std::string message) +bool LLLogImpl::useLegacyLogMessage(const std::string &message) { LLSD log_config = mApp->getOption("log-messages"); if (log_config.has(message)) @@ -100,12 +101,12 @@ LLLog::~LLLog() mImpl = NULL; } -void LLLog::log(const std::string message, LLSD& info) +void LLLog::log(const std::string &message, LLSD& info) { if (mImpl) mImpl->log(message, info); } -bool LLLog::useLegacyLogMessage(const std::string message) +bool LLLog::useLegacyLogMessage(const std::string &message) { if (mImpl) { diff --git a/linden/indra/llcommon/lllog.h b/linden/indra/llcommon/lllog.h index 200f48a..7ac6c8a 100644 --- a/linden/indra/llcommon/lllog.h +++ b/linden/indra/llcommon/lllog.h @@ -19,7 +19,8 @@ * 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 + * 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, @@ -46,8 +47,8 @@ public: LLLog(LLApp* app); virtual ~LLLog(); - virtual void log(const std::string message, LLSD& info); - virtual bool useLegacyLogMessage(const std::string message); + virtual void log(const std::string &message, LLSD& info); + virtual bool useLegacyLogMessage(const std::string &message); private: LLLogImpl* mImpl; diff --git a/linden/indra/llcommon/lllslconstants.h b/linden/indra/llcommon/lllslconstants.h index 3aa38b8..7cd854f 100644 --- a/linden/indra/llcommon/lllslconstants.h +++ b/linden/indra/llcommon/lllslconstants.h @@ -18,7 +18,8 @@ * 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 + * 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, @@ -187,4 +188,18 @@ const S32 OBJECT_CREATOR = 8; // llTextBox() magic token string - yes this is a hack. sue me. const std::string TEXTBOX_MAGIC_TOKEN = "!!llTextBox!!"; +// changed() event flags +const U32 CHANGED_NONE = 0x0; +const U32 CHANGED_INVENTORY = 0x1; +const U32 CHANGED_COLOR = 0x2; +const U32 CHANGED_SHAPE = 0x4; +const U32 CHANGED_SCALE = 0x8; +const U32 CHANGED_TEXTURE = 0x10; +const U32 CHANGED_LINK = 0x20; +const U32 CHANGED_ALLOWED_DROP = 0x40; +const U32 CHANGED_OWNER = 0x80; +const U32 CHANGED_REGION = 0x100; +const U32 CHANGED_TELEPORT = 0x200; +const U32 CHANGED_REGION_START = 0x400; + #endif diff --git a/linden/indra/llcommon/llmap.h b/linden/indra/llcommon/llmap.h index 71a168b..c94d4d4 100644 --- a/linden/indra/llcommon/llmap.h +++ b/linden/indra/llcommon/llmap.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/llmd5.cpp b/linden/indra/llcommon/llmd5.cpp index c58461f..14b4f9f 100644 --- a/linden/indra/llcommon/llmd5.cpp +++ b/linden/indra/llcommon/llmd5.cpp @@ -16,7 +16,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/llmd5.h b/linden/indra/llcommon/llmd5.h index 2d0205d..d8bca03 100644 --- a/linden/indra/llcommon/llmd5.h +++ b/linden/indra/llcommon/llmd5.h @@ -16,7 +16,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/llmemory.cpp b/linden/indra/llcommon/llmemory.cpp index a03fe9d..a6de3d2 100644 --- a/linden/indra/llcommon/llmemory.cpp +++ b/linden/indra/llcommon/llmemory.cpp @@ -17,7 +17,8 @@ * 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 + * 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, @@ -38,7 +39,7 @@ # include # include # include -#elif defined(LL_LINUX) +#elif LL_LINUX || LL_SOLARIS # include #endif @@ -388,6 +389,34 @@ bail: return rss; } +#elif LL_SOLARIS +#include +#include +#include +#define _STRUCTURED_PROC 1 +#include + +U64 getCurrentRSS() +{ + char path [LL_MAX_PATH]; /* Flawfinder: ignore */ + + sprintf(path, "/proc/%d/psinfo", (int)getpid()); + int proc_fd = -1; + if((proc_fd = open(path, O_RDONLY)) == -1){ + llwarns << "LLmemory::getCurrentRSS() unable to open " << path << ". Returning 0 RSS!" << llendl; + return 0; + } + psinfo_t proc_psinfo; + if(read(proc_fd, &proc_psinfo, sizeof(psinfo_t)) != sizeof(psinfo_t)){ + llwarns << "LLmemory::getCurrentRSS() Unable to read from " << path << ". Returning 0 RSS!" << llendl; + close(proc_fd); + return 0; + } + + close(proc_fd); + + return((U64)proc_psinfo.pr_rssize * 1024); +} #else U64 getCurrentRSS() diff --git a/linden/indra/llcommon/llmemory.h b/linden/indra/llcommon/llmemory.h index 7b3426f..b5c0711 100644 --- a/linden/indra/llcommon/llmemory.h +++ b/linden/indra/llcommon/llmemory.h @@ -17,7 +17,8 @@ * 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 + * 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, @@ -409,53 +410,58 @@ protected: // // class Foo: public LLSingleton{}; // -// Foo* instance = Foo::getInstance(); +// Foo& instance = Foo::instance(); // -// The second way is to define a seperate class that exposes the singleton -// interface: +// The second way is to use the singleton class directly, without inheritance: // -// class FooSingleton: public LLSingleton{}; +// typedef LLSingleton FooSingleton; // -// Foo* instance = FooSingleton::getInstance(); +// Foo& instance = FooSingleton::instance(); +// +// In this case, the class being managed as a singleton needs to provide an +// initSingleton() method since the LLSingleton virtual method won't be +// available // // As currently written, it is not thread-safe. -#if LL_WINDOWS && _MSC_VER < 1400 // this is Visual C++ 2003 or earlier -// workaround for VC7 compiler bug -// adapted from http://www.codeproject.com/KB/tips/VC2003MeyersSingletonBug.aspx -// our version doesn't introduce a nested struct so that you can still declare LLSingleton -// a friend and hide your constructor - template class LLSingleton { public: - static T* getInstance() + virtual ~LLSingleton() {} +#ifdef LL_MSVC7 +// workaround for VC7 compiler bug +// adapted from http://www.codeproject.com/KB/tips/VC2003MeyersSingletonBug.aspx +// our version doesn't introduce a nested struct so that you can still declare LLSingleton +// a friend and hide your constructor + static T* getInstance() { LLSingleton singleton; - return singleton.get(); - } -private: - T* get() - { - static T instance; - return &instance; + return singleton.vsHack(); } -}; + T* vsHack() #else - -template -class LLSingleton -{ -public: static T* getInstance() +#endif { static T instance; + static bool needs_init = true; + if (needs_init) + { + needs_init = false; + instance.initSingleton(); + } return &instance; } -}; -#endif + static T& instance() + { + return *getInstance(); + } + +private: + virtual void initSingleton() {} +}; //---------------------------------------------------------------------------- diff --git a/linden/indra/llcommon/llmemorystream.cpp b/linden/indra/llcommon/llmemorystream.cpp index 362c7d1..5c01c95 100644 --- a/linden/indra/llcommon/llmemorystream.cpp +++ b/linden/indra/llcommon/llmemorystream.cpp @@ -19,7 +19,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/llmemorystream.h b/linden/indra/llcommon/llmemorystream.h index 89abb7b..f348632 100644 --- a/linden/indra/llcommon/llmemorystream.h +++ b/linden/indra/llcommon/llmemorystream.h @@ -19,7 +19,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/llmemtype.h b/linden/indra/llcommon/llmemtype.h index 27091ff..a9ebc20 100644 --- a/linden/indra/llcommon/llmemtype.h +++ b/linden/indra/llcommon/llmemtype.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/llmetrics.cpp b/linden/indra/llcommon/llmetrics.cpp index 73748c8..8db3284 100644 --- a/linden/indra/llcommon/llmetrics.cpp +++ b/linden/indra/llcommon/llmetrics.cpp @@ -19,7 +19,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/llmetrics.h b/linden/indra/llcommon/llmetrics.h index 1b763ba..1d91e8c 100644 --- a/linden/indra/llcommon/llmetrics.h +++ b/linden/indra/llcommon/llmetrics.h @@ -19,7 +19,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/llmortician.cpp b/linden/indra/llcommon/llmortician.cpp index bb93843..c800b65 100644 --- a/linden/indra/llcommon/llmortician.cpp +++ b/linden/indra/llcommon/llmortician.cpp @@ -16,7 +16,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/llmortician.h b/linden/indra/llcommon/llmortician.h index 5a8aae6..fcda3df 100644 --- a/linden/indra/llcommon/llmortician.h +++ b/linden/indra/llcommon/llmortician.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/llnametable.h b/linden/indra/llcommon/llnametable.h index 35a40af..335a191 100644 --- a/linden/indra/llcommon/llnametable.h +++ b/linden/indra/llcommon/llnametable.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/llpreprocessor.h b/linden/indra/llcommon/llpreprocessor.h index 9bc2847..2e4fd47 100644 --- a/linden/indra/llcommon/llpreprocessor.h +++ b/linden/indra/llcommon/llpreprocessor.h @@ -18,7 +18,8 @@ * 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 + * 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, @@ -39,7 +40,16 @@ #include #endif // LL_LINUX -#if (defined(LL_WINDOWS) || (defined(LL_LINUX) && (__BYTE_ORDER == __LITTLE_ENDIAN)) || (defined(LL_DARWIN) && defined(__LITTLE_ENDIAN__))) +#if LL_SOLARIS +# ifdef __sparc // Since we're talking Solaris 10 and up, only 64 bit is supported. +# define LL_BIG_ENDIAN 1 +# define LL_SOLARIS_ALIGNED_CPU 1 // used to designate issues where SPARC alignment is addressed +# define LL_SOLARIS_NON_MESA_GL 1 // The SPARC GL does not provide a MESA-based GL API +# endif +# include // ensure we know which end is up +#endif // LL_SOLARIS + +#if (defined(LL_WINDOWS) || (defined(LL_LINUX) && (__BYTE_ORDER == __LITTLE_ENDIAN)) || (defined(LL_DARWIN) && defined(__LITTLE_ENDIAN__)) || (defined(LL_SOLARIS) && defined(__i386))) #define LL_LITTLE_ENDIAN 1 #else #define LL_BIG_ENDIAN 1 diff --git a/linden/indra/llcommon/llpriqueuemap.h b/linden/indra/llcommon/llpriqueuemap.h index 13b2887..a861ac1 100644 --- a/linden/indra/llcommon/llpriqueuemap.h +++ b/linden/indra/llcommon/llpriqueuemap.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/llprocessor.cpp b/linden/indra/llcommon/llprocessor.cpp index 1857fdc..469e544 100644 --- a/linden/indra/llcommon/llprocessor.cpp +++ b/linden/indra/llcommon/llprocessor.cpp @@ -17,7 +17,8 @@ * 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 + * 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, @@ -278,7 +279,7 @@ bool CProcessor::AnalyzeIntelProcessor() // Only override the brand if we have it in the lookup table. We should // already have a string here from GetCPUInfo(). JC - if (CPUInfo.uiBrandID < (sizeof(INTEL_BRAND)/sizeof(INTEL_BRAND[0]))) + if ( CPUInfo.uiBrandID < LL_ARRAY_SIZE(INTEL_BRAND) ) { strcpy(CPUInfo.strBrandID, INTEL_BRAND[CPUInfo.uiBrandID]); @@ -1664,6 +1665,10 @@ const ProcessorInfo *CProcessor::GetCPUInfo() #elif LL_SOLARIS #include +#if defined(__i386) +#include +#endif + // ====================== // Class constructor: ///////////////////////// @@ -1777,6 +1782,37 @@ const ProcessorInfo *CProcessor::GetCPUInfo() // DEBUG llinfo << "The system has " << ncpus << " CPUs with a clock rate of " << uqwFrequency << "MHz." << llendl; +#if defined (__i386) // we really don't care about the CPU extensions on SPARC but on x86... + + // Now get cpu extensions + + uint_t ui; + + (void) getisax(&ui, 1); + + if(ui & AV_386_FPU) + CPUInfo._Ext.FPU_FloatingPointUnit = true; + if(ui & AV_386_CX8) + CPUInfo._Ext.CX8_COMPXCHG8B_Instruction = true; + if(ui & AV_386_MMX) + CPUInfo._Ext.MMX_MultimediaExtensions = true; + if(ui & AV_386_AMD_MMX) + CPUInfo._Ext.MMX_MultimediaExtensions = true; + if(ui & AV_386_FXSR) + CPUInfo._Ext.FXSR_FastStreamingSIMD_ExtensionsSaveRestore = true; + if(ui & AV_386_SSE) + CPUInfo._Ext.SSE_StreamingSIMD_Extensions = true; + if(ui & AV_386_SSE2) + CPUInfo._Ext.SSE2_StreamingSIMD2_Extensions = true; +/* Left these here since they may get used later + if(ui & AV_386_SSE3) + CPUInfo._Ext.... = true; + if(ui & AV_386_AMD_3DNow) + CPUInfo._Ext.... = true; + if(ui & AV_386_AMD_3DNowx) + CPUInfo._Ext.... = true; +*/ +#endif return (&CPUInfo); } diff --git a/linden/indra/llcommon/llprocessor.h b/linden/indra/llcommon/llprocessor.h index f5ffd5e..746d007 100644 --- a/linden/indra/llcommon/llprocessor.h +++ b/linden/indra/llcommon/llprocessor.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/llptrskiplist.h b/linden/indra/llcommon/llptrskiplist.h index 453171d..6878165 100644 --- a/linden/indra/llcommon/llptrskiplist.h +++ b/linden/indra/llcommon/llptrskiplist.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/llptrskipmap.h b/linden/indra/llcommon/llptrskipmap.h index b568fef..20d0019 100644 --- a/linden/indra/llcommon/llptrskipmap.h +++ b/linden/indra/llcommon/llptrskipmap.h @@ -18,7 +18,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/llqueuedthread.cpp b/linden/indra/llcommon/llqueuedthread.cpp index dfe3d6f..cd53e70 100644 --- a/linden/indra/llcommon/llqueuedthread.cpp +++ b/linden/indra/llcommon/llqueuedthread.cpp @@ -16,7 +16,8 @@ * 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 + * 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, @@ -196,8 +197,9 @@ LLQueuedThread::handle_t LLQueuedThread::generateHandle() { mNextHandle++; } + const LLQueuedThread::handle_t res = mNextHandle++; unlockData(); - return mNextHandle++; + return res; } // MAIN thread diff --git a/linden/indra/llcommon/llqueuedthread.h b/linden/indra/llcommon/llqueuedthread.h index 180ff42..3ba43e1 100644 --- a/linden/indra/llcommon/llqueuedthread.h +++ b/linden/indra/llcommon/llqueuedthread.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/llrand.cpp b/linden/indra/llcommon/llrand.cpp index 80335bb..0b2f8b8 100644 --- a/linden/indra/llcommon/llrand.cpp +++ b/linden/indra/llcommon/llrand.cpp @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/llrand.h b/linden/indra/llcommon/llrand.h index 3634918..d12597b 100644 --- a/linden/indra/llcommon/llrand.h +++ b/linden/indra/llcommon/llrand.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/llrun.cpp b/linden/indra/llcommon/llrun.cpp index 12e3f69..e2f69ff 100644 --- a/linden/indra/llcommon/llrun.cpp +++ b/linden/indra/llcommon/llrun.cpp @@ -19,7 +19,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/llrun.h b/linden/indra/llcommon/llrun.h index 736a355..77b23d9 100644 --- a/linden/indra/llcommon/llrun.h +++ b/linden/indra/llcommon/llrun.h @@ -19,7 +19,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/llsd.cpp b/linden/indra/llcommon/llsd.cpp index 19471a0..2cc94c2 100644 --- a/linden/indra/llcommon/llsd.cpp +++ b/linden/indra/llcommon/llsd.cpp @@ -17,7 +17,8 @@ * 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 + * 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, @@ -349,7 +350,7 @@ namespace virtual bool has(const LLSD::String&) const; virtual LLSD get(const LLSD::String&) const; - void insert(const LLSD::String& k, const LLSD& v); + LLSD& insert(const LLSD::String& k, const LLSD& v); virtual void erase(const LLSD::String&); LLSD& ref(const LLSD::String&); virtual const LLSD& ref(const LLSD::String&) const; @@ -388,9 +389,14 @@ namespace return (i != mData.end()) ? i->second : LLSD(); } - void ImplMap::insert(const LLSD::String& k, const LLSD& v) + LLSD& ImplMap::insert(const LLSD::String& k, const LLSD& v) { mData.insert(DataMap::value_type(k, v)); + #ifdef LL_MSVC7 + return *((LLSD*)this); + #else + return *dynamic_cast(this); + #endif } void ImplMap::erase(const LLSD::String& k) @@ -436,7 +442,7 @@ namespace virtual int size() const; virtual LLSD get(LLSD::Integer) const; void set(LLSD::Integer, const LLSD&); - void insert(LLSD::Integer, const LLSD&); + LLSD& insert(LLSD::Integer, const LLSD&); void append(const LLSD&); virtual void erase(LLSD::Integer); LLSD& ref(LLSD::Integer); @@ -485,9 +491,15 @@ namespace mData[index] = v; } - void ImplArray::insert(LLSD::Integer i, const LLSD& v) + LLSD& ImplArray::insert(LLSD::Integer i, const LLSD& v) { - if (i < 0) { return; } + if (i < 0) { + #ifdef LL_MSVC7 + return *((LLSD*)this); + #else + return *dynamic_cast(this); + #endif + } DataVector::size_type index = i; if (index >= mData.size()) @@ -496,6 +508,11 @@ namespace } mData.insert(mData.begin() + index, v); + #ifdef LL_MSVC7 + return *((LLSD*)this); + #else + return *dynamic_cast(this); + #endif } void ImplArray::append(const LLSD& v) @@ -739,8 +756,11 @@ LLSD LLSD::emptyMap() bool LLSD::has(const String& k) const { return safe(impl).has(k); } LLSD LLSD::get(const String& k) const { return safe(impl).get(k); } -void LLSD::insert(const String& k, const LLSD& v) - { makeMap(impl).insert(k, v); } +LLSD& LLSD::insert(const String& k, const LLSD& v) + { + makeMap(impl).insert(k, v); + return *dynamic_cast(this); + } void LLSD::erase(const String& k) { makeMap(impl).erase(k); } LLSD& LLSD::operator[](const String& k) @@ -761,8 +781,11 @@ int LLSD::size() const { return safe(impl).size(); } LLSD LLSD::get(Integer i) const { return safe(impl).get(i); } void LLSD::set(Integer i, const LLSD& v){ makeArray(impl).set(i, v); } -void LLSD::insert(Integer i, const LLSD& v) - { makeArray(impl).insert(i, v); } +LLSD& LLSD::insert(Integer i, const LLSD& v) + { + makeArray(impl).insert(i, v); + return *this; + } void LLSD::append(const LLSD& v) { makeArray(impl).append(v); } void LLSD::erase(Integer i) { makeArray(impl).erase(i); } diff --git a/linden/indra/llcommon/llsd.h b/linden/indra/llcommon/llsd.h index 31b519f..d2845a3 100644 --- a/linden/indra/llcommon/llsd.h +++ b/linden/indra/llcommon/llsd.h @@ -17,7 +17,8 @@ * 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 + * 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, @@ -222,7 +223,7 @@ public: bool has(const String&) const; LLSD get(const String&) const; - void insert(const String&, const LLSD&); + LLSD& insert(const String&, const LLSD&); void erase(const String&); LLSD& operator[](const String&); @@ -237,7 +238,7 @@ public: LLSD get(Integer) const; void set(Integer, const LLSD&); - void insert(Integer, const LLSD&); + LLSD& insert(Integer, const LLSD&); void append(const LLSD&); void erase(Integer); diff --git a/linden/indra/llcommon/llsdserialize.cpp b/linden/indra/llcommon/llsdserialize.cpp index 0ee1d73..9f4ce64 100644 --- a/linden/indra/llcommon/llsdserialize.cpp +++ b/linden/indra/llcommon/llsdserialize.cpp @@ -19,7 +19,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/llsdserialize.h b/linden/indra/llcommon/llsdserialize.h index f56e45c..f7cd91b 100644 --- a/linden/indra/llcommon/llsdserialize.h +++ b/linden/indra/llcommon/llsdserialize.h @@ -19,7 +19,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/llsdserialize_xml.cpp b/linden/indra/llcommon/llsdserialize_xml.cpp index 6734ed4..c12ca35 100644 --- a/linden/indra/llcommon/llsdserialize_xml.cpp +++ b/linden/indra/llcommon/llsdserialize_xml.cpp @@ -17,7 +17,8 @@ * 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 + * 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, @@ -318,8 +319,8 @@ private: bool mSkipping; int mSkipThrough; - std::string mCurrentKey; - std::ostringstream mCurrentContent; + std::string mCurrentKey; // Current XML + std::string mCurrentContent; // String data between and }; @@ -556,16 +557,50 @@ void LLSDXMLParser::Impl::parsePart(const char* buf, int len) } } +// Performance testing code +//#define XML_PARSER_PERFORMANCE_TESTS + +#ifdef XML_PARSER_PERFORMANCE_TESTS + +extern U64 totalTime(); +U64 readElementTime = 0; +U64 startElementTime = 0; +U64 endElementTime = 0; +U64 charDataTime = 0; +U64 parseTime = 0; + +class XML_Timer +{ +public: + XML_Timer( U64 * sum ) : mSum( sum ) + { + mStart = totalTime(); + } + ~XML_Timer() + { + *mSum += (totalTime() - mStart); + } + + U64 * mSum; + U64 mStart; +}; +#endif // XML_PARSER_PERFORMANCE_TESTS + void LLSDXMLParser::Impl::startElementHandler(const XML_Char* name, const XML_Char** attributes) { + #ifdef XML_PARSER_PERFORMANCE_TESTS + XML_Timer timer( &startElementTime ); + #endif // XML_PARSER_PERFORMANCE_TESTS + ++mDepth; if (mSkipping) { return; } - + Element element = readElement(name); - mCurrentContent.str(""); + + mCurrentContent.clear(); switch (element) { @@ -645,6 +680,10 @@ void LLSDXMLParser::Impl::startElementHandler(const XML_Char* name, const XML_Ch void LLSDXMLParser::Impl::endElementHandler(const XML_Char* name) { + #ifdef XML_PARSER_PERFORMANCE_TESTS + XML_Timer timer( &endElementTime ); + #endif // XML_PARSER_PERFORMANCE_TESTS + --mDepth; if (mSkipping) { @@ -669,7 +708,7 @@ void LLSDXMLParser::Impl::endElementHandler(const XML_Char* name) return; case ELEMENT_KEY: - mCurrentKey = mCurrentContent.str(); + mCurrentKey = mCurrentContent; return; default: @@ -682,9 +721,6 @@ void LLSDXMLParser::Impl::endElementHandler(const XML_Char* name) LLSD& value = *mStack.back(); mStack.pop_back(); - std::string content = mCurrentContent.str(); - mCurrentContent.str(""); - switch (element) { case ELEMENT_UNDEF: @@ -692,39 +728,59 @@ void LLSDXMLParser::Impl::endElementHandler(const XML_Char* name) break; case ELEMENT_BOOL: - value = content == "true" || content == "1"; + value = (mCurrentContent == "true" || mCurrentContent == "1"); break; case ELEMENT_INTEGER: - value = LLSD(content).asInteger(); + { + S32 i; + if ( sscanf(mCurrentContent.c_str(), "%d", &i ) == 1 ) + { // See if sscanf works - it's faster + value = i; + } + else + { + value = LLSD(mCurrentContent).asInteger(); + } + } break; case ELEMENT_REAL: - value = LLSD(content).asReal(); + { + F64 r; + if ( sscanf(mCurrentContent.c_str(), "%lf", &r ) == 1 ) + { // See if sscanf works - it's faster + value = r; + } + else + { + value = LLSD(mCurrentContent).asReal(); + } + } break; case ELEMENT_STRING: - value = content; + value = mCurrentContent; break; case ELEMENT_UUID: - value = LLSD(content).asUUID(); + value = LLSD(mCurrentContent).asUUID(); break; case ELEMENT_DATE: - value = LLSD(content).asDate(); + value = LLSD(mCurrentContent).asDate(); break; case ELEMENT_URI: - value = LLSD(content).asURI(); + value = LLSD(mCurrentContent).asURI(); break; case ELEMENT_BINARY: { - S32 len = apr_base64_decode_len(content.c_str()); + S32 len = apr_base64_decode_len(mCurrentContent.c_str()); std::vector data; data.resize(len); - len = apr_base64_decode_binary(&data[0], content.c_str()); + len = apr_base64_decode_binary(&data[0], mCurrentContent.c_str()); data.resize(len); value = data; break; @@ -738,11 +794,17 @@ void LLSDXMLParser::Impl::endElementHandler(const XML_Char* name) // other values, map and array, have already been set break; } + + mCurrentContent.clear(); } void LLSDXMLParser::Impl::characterDataHandler(const XML_Char* data, int length) { - mCurrentContent.write(data, length); + #ifdef XML_PARSER_PERFORMANCE_TESTS + XML_Timer timer( &charDataTime ); + #endif // XML_PARSER_PERFORMANCE_TESTS + + mCurrentContent.append(data, length); } @@ -765,22 +827,69 @@ void LLSDXMLParser::Impl::sCharacterDataHandler( } +/* + This code is time critical + + This is a sample of tag occurances of text in simstate file with ~8000 objects. + A tag pair (something) counts is counted as two: + + key - 2680178 + real - 1818362 + integer - 906078 + array - 295682 + map - 191818 + uuid - 177903 + binary - 175748 + string - 53482 + undef - 40353 + boolean - 33874 + llsd - 16332 + uri - 38 + date - 1 +*/ LLSDXMLParser::Impl::Element LLSDXMLParser::Impl::readElement(const XML_Char* name) { - if (strcmp(name, "llsd") == 0) { return ELEMENT_LLSD; } - if (strcmp(name, "undef") == 0) { return ELEMENT_UNDEF; } - if (strcmp(name, "boolean") == 0) { return ELEMENT_BOOL; } - if (strcmp(name, "integer") == 0) { return ELEMENT_INTEGER; } - if (strcmp(name, "real") == 0) { return ELEMENT_REAL; } - if (strcmp(name, "string") == 0) { return ELEMENT_STRING; } - if (strcmp(name, "uuid") == 0) { return ELEMENT_UUID; } - if (strcmp(name, "date") == 0) { return ELEMENT_DATE; } - if (strcmp(name, "uri") == 0) { return ELEMENT_URI; } - if (strcmp(name, "binary") == 0) { return ELEMENT_BINARY; } - if (strcmp(name, "map") == 0) { return ELEMENT_MAP; } - if (strcmp(name, "array") == 0) { return ELEMENT_ARRAY; } - if (strcmp(name, "key") == 0) { return ELEMENT_KEY; } - + #ifdef XML_PARSER_PERFORMANCE_TESTS + XML_Timer timer( &readElementTime ); + #endif // XML_PARSER_PERFORMANCE_TESTS + + XML_Char c = *name; + switch (c) + { + case 'k': + if (strcmp(name, "key") == 0) { return ELEMENT_KEY; } + break; + case 'r': + if (strcmp(name, "real") == 0) { return ELEMENT_REAL; } + break; + case 'i': + if (strcmp(name, "integer") == 0) { return ELEMENT_INTEGER; } + break; + case 'a': + if (strcmp(name, "array") == 0) { return ELEMENT_ARRAY; } + break; + case 'm': + if (strcmp(name, "map") == 0) { return ELEMENT_MAP; } + break; + case 'u': + if (strcmp(name, "uuid") == 0) { return ELEMENT_UUID; } + if (strcmp(name, "undef") == 0) { return ELEMENT_UNDEF; } + if (strcmp(name, "uri") == 0) { return ELEMENT_URI; } + break; + case 'b': + if (strcmp(name, "binary") == 0) { return ELEMENT_BINARY; } + if (strcmp(name, "boolean") == 0) { return ELEMENT_BOOL; } + break; + case 's': + if (strcmp(name, "string") == 0) { return ELEMENT_STRING; } + break; + case 'l': + if (strcmp(name, "llsd") == 0) { return ELEMENT_LLSD; } + break; + case 'd': + if (strcmp(name, "date") == 0) { return ELEMENT_DATE; } + break; + } return ELEMENT_UNKNOWN; } @@ -808,6 +917,10 @@ void LLSDXMLParser::parsePart(const char *buf, int len) // virtual S32 LLSDXMLParser::doParse(std::istream& input, LLSD& data) const { + #ifdef XML_PARSER_PERFORMANCE_TESTS + XML_Timer timer( &parseTime ); + #endif // XML_PARSER_PERFORMANCE_TESTS + if (mParseLines) { // Use line-based reading (faster code) diff --git a/linden/indra/llcommon/llsdserialize_xml.h b/linden/indra/llcommon/llsdserialize_xml.h index 1cbc345..53aa09f 100644 --- a/linden/indra/llcommon/llsdserialize_xml.h +++ b/linden/indra/llcommon/llsdserialize_xml.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/llsdutil.cpp b/linden/indra/llcommon/llsdutil.cpp index 37b7f24..aa0e0f3 100644 --- a/linden/indra/llcommon/llsdutil.cpp +++ b/linden/indra/llcommon/llsdutil.cpp @@ -19,7 +19,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/llsdutil.h b/linden/indra/llcommon/llsdutil.h index db5ede3..b67ad52 100644 --- a/linden/indra/llcommon/llsdutil.h +++ b/linden/indra/llcommon/llsdutil.h @@ -19,7 +19,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/llsecondlifeurls.cpp b/linden/indra/llcommon/llsecondlifeurls.cpp index f1ce653..36d8e88 100644 --- a/linden/indra/llcommon/llsecondlifeurls.cpp +++ b/linden/indra/llcommon/llsecondlifeurls.cpp @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/llsecondlifeurls.h b/linden/indra/llcommon/llsecondlifeurls.h index 73ada00..9fd75c3 100644 --- a/linden/indra/llcommon/llsecondlifeurls.h +++ b/linden/indra/llcommon/llsecondlifeurls.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/llsimplehash.h b/linden/indra/llcommon/llsimplehash.h index 24edf82..0ba2a30 100644 --- a/linden/indra/llcommon/llsimplehash.h +++ b/linden/indra/llcommon/llsimplehash.h @@ -16,7 +16,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/llskiplist.h b/linden/indra/llcommon/llskiplist.h index 514f3ba..33a8687 100644 --- a/linden/indra/llcommon/llskiplist.h +++ b/linden/indra/llcommon/llskiplist.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/llskipmap.h b/linden/indra/llcommon/llskipmap.h index d0f557f..6bbca8f 100644 --- a/linden/indra/llcommon/llskipmap.h +++ b/linden/indra/llcommon/llskipmap.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/llsmoothstep.h b/linden/indra/llcommon/llsmoothstep.h index 86cc884..153c83d 100644 --- a/linden/indra/llcommon/llsmoothstep.h +++ b/linden/indra/llcommon/llsmoothstep.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/llstack.h b/linden/indra/llcommon/llstack.h index b36cfb7..66175c7 100644 --- a/linden/indra/llcommon/llstack.h +++ b/linden/indra/llcommon/llstack.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/llstat.cpp b/linden/indra/llcommon/llstat.cpp index 31a72e2..cbf5a2e 100644 --- a/linden/indra/llcommon/llstat.cpp +++ b/linden/indra/llcommon/llstat.cpp @@ -16,7 +16,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/llstat.h b/linden/indra/llcommon/llstat.h index eceb5e3..66521a3 100644 --- a/linden/indra/llcommon/llstat.h +++ b/linden/indra/llcommon/llstat.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/llstatenums.h b/linden/indra/llcommon/llstatenums.h index febd958..f8bf07f 100644 --- a/linden/indra/llcommon/llstatenums.h +++ b/linden/indra/llcommon/llstatenums.h @@ -16,7 +16,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/llstl.h b/linden/indra/llcommon/llstl.h index 13fd9a7..7886179 100644 --- a/linden/indra/llcommon/llstl.h +++ b/linden/indra/llcommon/llstl.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/llstreamtools.cpp b/linden/indra/llcommon/llstreamtools.cpp index cd903d8..ee4f463 100644 --- a/linden/indra/llcommon/llstreamtools.cpp +++ b/linden/indra/llcommon/llstreamtools.cpp @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/llstreamtools.h b/linden/indra/llcommon/llstreamtools.h index 70cff4d..a6dc4d5 100644 --- a/linden/indra/llcommon/llstreamtools.h +++ b/linden/indra/llcommon/llstreamtools.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/llstrider.h b/linden/indra/llcommon/llstrider.h index 645f3c1..369b06b 100644 --- a/linden/indra/llcommon/llstrider.h +++ b/linden/indra/llcommon/llstrider.h @@ -16,7 +16,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/llstring.cpp b/linden/indra/llcommon/llstring.cpp index dfd131b..1f653c1 100644 --- a/linden/indra/llcommon/llstring.cpp +++ b/linden/indra/llcommon/llstring.cpp @@ -17,7 +17,8 @@ * 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 + * 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, @@ -662,7 +663,8 @@ S32 LLStringOps::collate(const llwchar* a, const llwchar* b) namespace LLStringFn { - void replace_nonprintable(std::basic_string& string, char replacement) + // NOTE - this restricts output to ascii + void replace_nonprintable_in_ascii(std::basic_string& string, char replacement) { const char MIN = 0x20; std::basic_string::size_type len = string.size(); @@ -675,23 +677,9 @@ namespace LLStringFn } } - void replace_nonprintable( - std::basic_string& string, - llwchar replacement) - { - const llwchar MIN = 0x20; - const llwchar MAX = 0x7f; - std::basic_string::size_type len = string.size(); - for(std::basic_string::size_type ii = 0; ii < len; ++ii) - { - if((string[ii] < MIN) || (string[ii] > MAX)) - { - string[ii] = replacement; - } - } - } - void replace_nonprintable_and_pipe(std::basic_string& str, + // NOTE - this restricts output to ascii + void replace_nonprintable_and_pipe_in_ascii(std::basic_string& str, char replacement) { const char MIN = 0x20; @@ -706,22 +694,6 @@ namespace LLStringFn } } - void replace_nonprintable_and_pipe(std::basic_string& str, - llwchar replacement) - { - const llwchar MIN = 0x20; - const llwchar MAX = 0x7f; - const llwchar PIPE = 0x7c; - std::basic_string::size_type len = str.size(); - for(std::basic_string::size_type ii = 0; ii < len; ++ii) - { - if( (str[ii] < MIN) || (str[ii] > MAX) || (str[ii] == PIPE) ) - { - str[ii] = replacement; - } - } - } - // 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 @@ -747,6 +719,23 @@ namespace LLStringFn return output; } + /** + * @brief Replace all control characters (c < 0x20) with replacement in + * string. + */ + void replace_ascii_controlchars(std::basic_string& string, char replacement) + { + const unsigned char MIN = 0x20; + std::basic_string::size_type len = string.size(); + for(std::basic_string::size_type ii = 0; ii < len; ++ii) + { + const unsigned char c = (unsigned char) string[ii]; + if(c < MIN) + { + string[ii] = replacement; + } + } + } } diff --git a/linden/indra/llcommon/llstring.h b/linden/indra/llcommon/llstring.h index 720b163..99a9b9e 100644 --- a/linden/indra/llcommon/llstring.h +++ b/linden/indra/llcommon/llstring.h @@ -17,7 +17,8 @@ * 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 + * 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, @@ -32,15 +33,27 @@ #ifndef LL_LLSTRING_H #define LL_LLSTRING_H +#include + #if LL_LINUX || LL_SOLARIS #include #include #endif +#include + +#if LL_SOLARIS +// stricmp and strnicmp do not exist on Solaris: +#define stricmp strcasecmp +#define strnicmp strncasecmp +#endif + const char LL_UNKNOWN_CHAR = '?'; #if LL_DARWIN || LL_LINUX || LL_SOLARIS // Template specialization of char_traits for U16s. Only necessary on Mac and Linux (exists on Windows already) +#include + namespace std { template<> @@ -486,48 +499,29 @@ namespace LLStringFn /** * @brief Replace all non-printable characters with replacement in * string. + * NOTE - this will zap non-ascii * * @param [in,out] string the to modify. out value is the string * with zero non-printable characters. * @param The replacement character. use LL_UNKNOWN_CHAR if unsure. */ - void replace_nonprintable( + void replace_nonprintable_in_ascii( std::basic_string& string, char replacement); - /** - * @brief Replace all non-printable characters with replacement in - * a wide string. - * - * @param [in,out] string the to modify. out value is the string - * with zero non-printable characters. - * @param The replacement character. use LL_UNKNOWN_CHAR if unsure. - */ - void replace_nonprintable( - std::basic_string& string, - llwchar replacement); /** * @brief Replace all non-printable characters and pipe characters * with replacement in a string. + * NOTE - this will zap non-ascii * * @param [in,out] the string to modify. out value is the string * with zero non-printable characters and zero pipe characters. * @param The replacement character. use LL_UNKNOWN_CHAR if unsure. */ - void replace_nonprintable_and_pipe(std::basic_string& str, + void replace_nonprintable_and_pipe_in_ascii(std::basic_string& str, char replacement); - /** - * @brief Replace all non-printable characters and pipe characters - * with replacement in a wide string. - * - * @param [in,out] the string to modify. out value is the string - * with zero non-printable characters and zero pipe characters. - * @param The replacement wide character. use LL_UNKNOWN_CHAR if unsure. - */ - void replace_nonprintable_and_pipe(std::basic_string& str, - llwchar replacement); /** * @brief Remove all characters that are not allowed in XML 1.0. @@ -535,6 +529,19 @@ namespace LLStringFn * Works with US ASCII and UTF-8 encoded strings. JC */ std::string strip_invalid_xml(const std::string& input); + + + /** + * @brief Replace all control characters (0 <= c < 0x20) with replacement in + * string. This is safe for utf-8 + * + * @param [in,out] string the to modify. out value is the string + * with zero non-printable characters. + * @param The replacement character. use LL_UNKNOWN_CHAR if unsure. + */ + void replace_ascii_controlchars( + std::basic_string& string, + char replacement); } //////////////////////////////////////////////////////////// diff --git a/linden/indra/llcommon/llstringtable.cpp b/linden/indra/llcommon/llstringtable.cpp index c5f575f..27f9036 100644 --- a/linden/indra/llcommon/llstringtable.cpp +++ b/linden/indra/llcommon/llstringtable.cpp @@ -18,7 +18,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/llstringtable.h b/linden/indra/llcommon/llstringtable.h index e7a2edd..4492063 100644 --- a/linden/indra/llcommon/llstringtable.h +++ b/linden/indra/llcommon/llstringtable.h @@ -18,7 +18,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/llsys.cpp b/linden/indra/llcommon/llsys.cpp index 06982f0..2e93b2a 100644 --- a/linden/indra/llcommon/llsys.cpp +++ b/linden/indra/llcommon/llsys.cpp @@ -17,7 +17,8 @@ * 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 + * 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, @@ -58,6 +59,17 @@ # include const char MEMINFO_FILE[] = "/proc/meminfo"; const char CPUINFO_FILE[] = "/proc/cpuinfo"; +#elif LL_SOLARIS +# include +# include +# include +# define _STRUCTURED_PROC 1 +# include +# include +# include +# include +# include +extern int errno; #endif @@ -288,19 +300,22 @@ U32 LLOSInfo::getProcessVirtualSizeKB() #endif #if LL_LINUX LLFILE* status_filep = LLFile::fopen("/proc/self/status", "rb"); - S32 numRead = 0; - char buff[STATUS_SIZE]; /* Flawfinder: ignore */ + if (status_filep) + { + S32 numRead = 0; + char buff[STATUS_SIZE]; /* Flawfinder: ignore */ - size_t nbytes = fread(buff, 1, STATUS_SIZE-1, status_filep); - buff[nbytes] = '\0'; + size_t nbytes = fread(buff, 1, STATUS_SIZE-1, status_filep); + buff[nbytes] = '\0'; - // All these guys return numbers in KB - char *memp = strstr(buff, "VmSize:"); - if (memp) - { - numRead += sscanf(memp, "%*s %u", &virtual_size); + // All these guys return numbers in KB + char *memp = strstr(buff, "VmSize:"); + if (memp) + { + numRead += sscanf(memp, "%*s %u", &virtual_size); + } + fclose(status_filep); } - fclose(status_filep); #elif LL_SOLARIS char proc_ps[LL_MAX_PATH]; sprintf(proc_ps, "/proc/%d/psinfo", (int)getpid()); diff --git a/linden/indra/llcommon/llsys.h b/linden/indra/llcommon/llsys.h index b2e9624..03f48ca 100644 --- a/linden/indra/llcommon/llsys.h +++ b/linden/indra/llcommon/llsys.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/llthread.cpp b/linden/indra/llcommon/llthread.cpp index b31c9ab..920d8c0 100644 --- a/linden/indra/llcommon/llthread.cpp +++ b/linden/indra/llcommon/llthread.cpp @@ -16,7 +16,8 @@ * 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 + * 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, @@ -101,12 +102,20 @@ LLThread::LLThread(const std::string& name, apr_pool_t *poolp) : apr_pool_create(&mAPRPoolp, NULL); // Create a subpool for this thread } mRunCondition = new LLCondition(mAPRPoolp); + + mLocalAPRFilePoolp = NULL ; } LLThread::~LLThread() { shutdown(); + + if(mLocalAPRFilePoolp) + { + delete mLocalAPRFilePoolp ; + mLocalAPRFilePoolp = NULL ; + } } void LLThread::shutdown() diff --git a/linden/indra/llcommon/llthread.h b/linden/indra/llcommon/llthread.h index 258a43e..c8c9fd4 100644 --- a/linden/indra/llcommon/llthread.h +++ b/linden/indra/llcommon/llthread.h @@ -17,7 +17,8 @@ * 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 + * 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, @@ -82,7 +83,8 @@ public: void start(void); apr_pool_t *getAPRPool() { return mAPRPoolp; } - + LLVolatileAPRPool* getLocalAPRFilePool() { return mLocalAPRFilePoolp ; } + private: BOOL mPaused; @@ -98,6 +100,11 @@ protected: BOOL mIsLocalPool; EThreadStatus mStatus; + //a local apr_pool for APRFile operations in this thread. If it exists, LLAPRFile::sAPRFilePoolp should not be used. + //Note: this pool is used by APRFile ONLY, do NOT use it for any other purposes. + // otherwise it will cause severe memory leaking!!! --bao + LLVolatileAPRPool *mLocalAPRFilePoolp ; + void setQuitting(); // virtual function overridden by subclass -- this will be called when the thread runs diff --git a/linden/indra/llcommon/lltimer.cpp b/linden/indra/llcommon/lltimer.cpp index f5b5ef0..fa6efaf 100644 --- a/linden/indra/llcommon/lltimer.cpp +++ b/linden/indra/llcommon/lltimer.cpp @@ -17,7 +17,8 @@ * 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 + * 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, @@ -569,6 +570,14 @@ LLEventTimer::LLEventTimer(F32 period) sActiveList.push_back(this); } +LLEventTimer::LLEventTimer(const LLDate& time) +: mEventTimer() +{ + mPeriod = (F32)(time.secondsSinceEpoch() - LLDate::now().secondsSinceEpoch()); + sActiveList.push_back(this); +} + + LLEventTimer::~LLEventTimer() { sActiveList.remove(this); diff --git a/linden/indra/llcommon/lltimer.h b/linden/indra/llcommon/lltimer.h index a8ec0cc..e2cf1c7 100644 --- a/linden/indra/llcommon/lltimer.h +++ b/linden/indra/llcommon/lltimer.h @@ -17,7 +17,8 @@ * 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 + * 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, @@ -32,12 +33,13 @@ #ifndef LL_TIMER_H #define LL_TIMER_H -#if LL_LINUX || LL_DARWIN +#if LL_LINUX || LL_DARWIN || LL_SOLARIS #include #endif #include #include "stdtypes.h" +#include "lldate.h" #include #include @@ -173,6 +175,7 @@ class LLEventTimer { public: LLEventTimer(F32 period); // period is the amount of time between each call to tick() in seconds + LLEventTimer(const LLDate& time); virtual ~LLEventTimer(); //function to be called at the supplied frequency diff --git a/linden/indra/llcommon/lluri.cpp b/linden/indra/llcommon/lluri.cpp index 1c78b2d..3dbc837 100644 --- a/linden/indra/llcommon/lluri.cpp +++ b/linden/indra/llcommon/lluri.cpp @@ -19,7 +19,8 @@ * 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 + * 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, @@ -599,3 +600,8 @@ std::string LLURI::mapToQueryString(const LLSD& queryMap) } return query_string; } + +bool operator!=(const LLURI& first, const LLURI& second) +{ + return (first.asString() != second.asString()); +} diff --git a/linden/indra/llcommon/lluri.h b/linden/indra/llcommon/lluri.h index 9271349..156d80b 100644 --- a/linden/indra/llcommon/lluri.h +++ b/linden/indra/llcommon/lluri.h @@ -19,7 +19,8 @@ * 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 + * 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, @@ -187,4 +188,7 @@ private: std::string mEscapedQuery; }; +// this operator required for tut +bool operator!=(const LLURI& first, const LLURI& second); + #endif // LL_LLURI_H diff --git a/linden/indra/llcommon/lluuid.cpp b/linden/indra/llcommon/lluuid.cpp index 4f0f95e..bcbae06 100644 --- a/linden/indra/llcommon/lluuid.cpp +++ b/linden/indra/llcommon/lluuid.cpp @@ -16,7 +16,8 @@ * 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 + * 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, @@ -208,7 +209,7 @@ std::string LLUUID::asString() const BOOL LLUUID::set(const char* in_string, BOOL emit) { - return set(ll_safe_string(in_string)); + return set(ll_safe_string(in_string),emit); } BOOL LLUUID::set(const std::string& in_string, BOOL emit) @@ -230,7 +231,7 @@ BOOL LLUUID::set(const std::string& in_string, BOOL emit) { if(emit) { - llinfos << "Warning! Using broken UUID string format" << llendl; + llwarns << "Warning! Using broken UUID string format" << llendl; } broken_format = TRUE; } @@ -239,7 +240,8 @@ BOOL LLUUID::set(const std::string& in_string, BOOL emit) // Bad UUID string. Spam as INFO, as most cases we don't care. if(emit) { - llinfos << "Bad UUID string: " << in_string << llendl; + //don't spam the logs because a resident can't spell. + llwarns << "Bad UUID string: " << in_string << llendl; } setNull(); return FALSE; @@ -908,6 +910,21 @@ BOOL LLUUID::parseUUID(const std::string& buf, LLUUID* value) return FALSE; } +//static +LLUUID LLUUID::generateNewID(std::string hash_string) +{ + LLUUID new_id; + if (hash_string.empty()) + { + new_id.generate(); + } + else + { + new_id.generate(hash_string); + } + return new_id; +} + LLAssetID LLTransactionID::makeAssetID(const LLUUID& session) const { LLAssetID result; diff --git a/linden/indra/llcommon/lluuid.h b/linden/indra/llcommon/lluuid.h index 876941f..4b32138 100644 --- a/linden/indra/llcommon/lluuid.h +++ b/linden/indra/llcommon/lluuid.h @@ -16,7 +16,8 @@ * 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 + * 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, @@ -65,6 +66,9 @@ public: // void generate(); // Generate a new UUID void generate(const std::string& stream); //Generate a new UUID based on hash of input stream + + static LLUUID generateNewID(std::string stream = ""); //static version of above for use in initializer expressions such as constructor params, etc. + 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. @@ -124,7 +128,7 @@ public: static S32 getNodeID(unsigned char * node_id); static BOOL parseUUID(const std::string& buf, LLUUID* value); - + U8 mData[UUID_BYTES]; }; diff --git a/linden/indra/llcommon/lluuidhashmap.h b/linden/indra/llcommon/lluuidhashmap.h index 67921e6..c45e413 100644 --- a/linden/indra/llcommon/lluuidhashmap.h +++ b/linden/indra/llcommon/lluuidhashmap.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/llversionserver.h b/linden/indra/llcommon/llversionserver.h index 79f4630..f9b84dd 100644 --- a/linden/indra/llcommon/llversionserver.h +++ b/linden/indra/llcommon/llversionserver.h @@ -17,7 +17,8 @@ * 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 + * 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, @@ -33,9 +34,9 @@ #define LL_LLVERSIONSERVER_H const S32 LL_VERSION_MAJOR = 1; -const S32 LL_VERSION_MINOR = 24; -const S32 LL_VERSION_PATCH = 9; -const S32 LL_VERSION_BUILD = 98650; +const S32 LL_VERSION_MINOR = 27; +const S32 LL_VERSION_PATCH = 0; +const S32 LL_VERSION_BUILD = 112940; const char * const LL_CHANNEL = "Second Life Server"; diff --git a/linden/indra/llcommon/llversionviewer.h b/linden/indra/llcommon/llversionviewer.h index 33e5fdc..ad3886c 100644 --- a/linden/indra/llcommon/llversionviewer.h +++ b/linden/indra/llcommon/llversionviewer.h @@ -17,7 +17,8 @@ * 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 + * 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, @@ -33,8 +34,8 @@ #define LL_LLVERSIONVIEWER_H const S32 LL_VERSION_MAJOR = 1; -const S32 LL_VERSION_MINOR = 22; -const S32 LL_VERSION_PATCH = 11; +const S32 LL_VERSION_MINOR = 23; +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/llworkerthread.cpp b/linden/indra/llcommon/llworkerthread.cpp index 96a957b..5dda600 100644 --- a/linden/indra/llcommon/llworkerthread.cpp +++ b/linden/indra/llcommon/llworkerthread.cpp @@ -16,7 +16,8 @@ * 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 + * 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, @@ -36,16 +37,18 @@ #include "llframecallbackmanager.h" #endif -BOOL LLWorkerClass::sDeleteLock = FALSE ; //============================================================================ // Run on MAIN thread LLWorkerThread::LLWorkerThread(const std::string& name, bool threaded) : - LLQueuedThread(name, threaded), - mWorkerAPRPoolp(NULL) + LLQueuedThread(name, threaded) { - apr_pool_create(&mWorkerAPRPoolp, NULL); - mDeleteMutex = new LLMutex(getAPRPool()); + mDeleteMutex = new LLMutex(NULL); + + if(!mLocalAPRFilePoolp) + { + mLocalAPRFilePoolp = new LLVolatileAPRPool() ; + } } LLWorkerThread::~LLWorkerThread() @@ -95,7 +98,6 @@ S32 LLWorkerThread::update(U32 max_time_ms) { (*iter)->abortWork(false); } - LLWorkerClass::sDeleteLock = TRUE ; for (std::vector::iterator iter = delete_list.begin(); iter != delete_list.end(); ++iter) { @@ -109,8 +111,7 @@ S32 LLWorkerThread::update(U32 max_time_ms) } delete *iter; } - LLWorkerClass::sDeleteLock = FALSE ; - // delete and aborted entries mean there's still work to do + // delete and aborted entries mean there's still work to do res += delete_list.size() + abort_list.size(); return res; } @@ -187,7 +188,7 @@ LLWorkerClass::LLWorkerClass(LLWorkerThread* workerthread, const std::string& na : mWorkerThread(workerthread), mWorkerClassName(name), mRequestHandle(LLWorkerThread::nullHandle()), - mMutex(workerthread->getWorkerAPRPool()), + mMutex(NULL), mWorkFlags(0) { if (!mWorkerThread) diff --git a/linden/indra/llcommon/llworkerthread.h b/linden/indra/llcommon/llworkerthread.h index 62b0696..19407f4 100644 --- a/linden/indra/llcommon/llworkerthread.h +++ b/linden/indra/llcommon/llworkerthread.h @@ -16,7 +16,8 @@ * 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 + * 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, @@ -37,6 +38,7 @@ #include #include "llqueuedthread.h" +#include "llapr.h" #define USE_FRAME_CALLBACK_MANAGER 0 @@ -81,14 +83,11 @@ private: typedef std::list delete_list_t; delete_list_t mDeleteList; LLMutex* mDeleteMutex; - apr_pool_t* mWorkerAPRPoolp; public: LLWorkerThread(const std::string& name, bool threaded = true); ~LLWorkerThread(); - apr_pool_t* getWorkerAPRPool() { return mWorkerAPRPoolp; } - /*virtual*/ S32 update(U32 max_time_ms); handle_t addWorkRequest(LLWorkerClass* workerclass, S32 param, U32 priority = PRIORITY_NORMAL); @@ -120,8 +119,6 @@ class LLWorkerClass friend class LLWorkerThread::WorkRequest; public: - static BOOL sDeleteLock ; -public: typedef LLWorkerThread::handle_t handle_t; enum FLAGS { diff --git a/linden/indra/llcommon/metaclass.cpp b/linden/indra/llcommon/metaclass.cpp index 760d568..90679d3 100644 --- a/linden/indra/llcommon/metaclass.cpp +++ b/linden/indra/llcommon/metaclass.cpp @@ -19,7 +19,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/metaclass.h b/linden/indra/llcommon/metaclass.h index 3ee7b6f..cc10f16 100644 --- a/linden/indra/llcommon/metaclass.h +++ b/linden/indra/llcommon/metaclass.h @@ -19,7 +19,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/metaclasst.h b/linden/indra/llcommon/metaclasst.h index 6266c62..0d6a450 100644 --- a/linden/indra/llcommon/metaclasst.h +++ b/linden/indra/llcommon/metaclasst.h @@ -16,7 +16,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/metaproperty.cpp b/linden/indra/llcommon/metaproperty.cpp index a017318..784a52a 100644 --- a/linden/indra/llcommon/metaproperty.cpp +++ b/linden/indra/llcommon/metaproperty.cpp @@ -19,7 +19,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/metaproperty.h b/linden/indra/llcommon/metaproperty.h index 8d8e1c6..e5ac359 100644 --- a/linden/indra/llcommon/metaproperty.h +++ b/linden/indra/llcommon/metaproperty.h @@ -19,7 +19,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/metapropertyt.h b/linden/indra/llcommon/metapropertyt.h index ab08116..79a536a 100644 --- a/linden/indra/llcommon/metapropertyt.h +++ b/linden/indra/llcommon/metapropertyt.h @@ -16,7 +16,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/processor.h b/linden/indra/llcommon/processor.h index d9196e3..5ba5540 100644 --- a/linden/indra/llcommon/processor.h +++ b/linden/indra/llcommon/processor.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/reflective.cpp b/linden/indra/llcommon/reflective.cpp index f20565a..88e07d7 100644 --- a/linden/indra/llcommon/reflective.cpp +++ b/linden/indra/llcommon/reflective.cpp @@ -19,7 +19,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/reflective.h b/linden/indra/llcommon/reflective.h index e61c931..e2c18eb 100644 --- a/linden/indra/llcommon/reflective.h +++ b/linden/indra/llcommon/reflective.h @@ -19,7 +19,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/reflectivet.h b/linden/indra/llcommon/reflectivet.h index 732c48f..b3195cb 100644 --- a/linden/indra/llcommon/reflectivet.h +++ b/linden/indra/llcommon/reflectivet.h @@ -16,7 +16,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/roles_constants.h b/linden/indra/llcommon/roles_constants.h index a0a24c0..854a153 100644 --- a/linden/indra/llcommon/roles_constants.h +++ b/linden/indra/llcommon/roles_constants.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/stdenums.h b/linden/indra/llcommon/stdenums.h index 1c28c0e..41da51f 100644 --- a/linden/indra/llcommon/stdenums.h +++ b/linden/indra/llcommon/stdenums.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/stdtypes.h b/linden/indra/llcommon/stdtypes.h index e88cde6..af0b4dd 100644 --- a/linden/indra/llcommon/stdtypes.h +++ b/linden/indra/llcommon/stdtypes.h @@ -17,7 +17,8 @@ * 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 + * 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, @@ -32,6 +33,7 @@ #define LL_STDTYPES_H #include +#include typedef signed char S8; typedef unsigned char U8; @@ -104,6 +106,8 @@ typedef U32 TPACKETID; typedef U8 LLPCode; +#define LL_ARRAY_SIZE( _kArray ) ( sizeof( (_kArray) ) / sizeof( _kArray[0] ) ) + #if LL_LINUX && __GNUC__ <= 2 typedef int intptr_t; #endif diff --git a/linden/indra/llcommon/string_table.h b/linden/indra/llcommon/string_table.h index 1d46d81..176be21 100644 --- a/linden/indra/llcommon/string_table.h +++ b/linden/indra/llcommon/string_table.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/timer.h b/linden/indra/llcommon/timer.h index b8ed29f..21ed06a 100644 --- a/linden/indra/llcommon/timer.h +++ b/linden/indra/llcommon/timer.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/timing.cpp b/linden/indra/llcommon/timing.cpp index 5b5cd55..e1c1f6d 100644 --- a/linden/indra/llcommon/timing.cpp +++ b/linden/indra/llcommon/timing.cpp @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/timing.h b/linden/indra/llcommon/timing.h index ae7ac31..2b9f60a 100644 --- a/linden/indra/llcommon/timing.h +++ b/linden/indra/llcommon/timing.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/u64.cpp b/linden/indra/llcommon/u64.cpp index 6163191..01fe973 100644 --- a/linden/indra/llcommon/u64.cpp +++ b/linden/indra/llcommon/u64.cpp @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llcommon/u64.h b/linden/indra/llcommon/u64.h index 1c38468..09a6b3e 100644 --- a/linden/indra/llcommon/u64.h +++ b/linden/indra/llcommon/u64.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llcrashlogger/llcrashlogger.cpp b/linden/indra/llcrashlogger/llcrashlogger.cpp index 095cf8a..78c4f8e 100755 --- a/linden/indra/llcrashlogger/llcrashlogger.cpp +++ b/linden/indra/llcrashlogger/llcrashlogger.cpp @@ -17,7 +17,8 @@ * 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 +* 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, @@ -391,7 +392,7 @@ bool LLCrashLogger::init() if( gDirUtilp ) { std::string marker_file = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,"SecondLife.exec_marker"); - ll_apr_file_remove( marker_file ); + LLAPRFile::remove( marker_file ); } return true; diff --git a/linden/indra/llcrashlogger/llcrashlogger.h b/linden/indra/llcrashlogger/llcrashlogger.h index 9faaa76..f8abe20 100755 --- a/linden/indra/llcrashlogger/llcrashlogger.h +++ b/linden/indra/llcrashlogger/llcrashlogger.h @@ -17,7 +17,8 @@ * 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 +* 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, diff --git a/linden/indra/llimage/CMakeLists.txt b/linden/indra/llimage/CMakeLists.txt index 1a4d92b..5fa7472 100644 --- a/linden/indra/llimage/CMakeLists.txt +++ b/linden/indra/llimage/CMakeLists.txt @@ -14,6 +14,7 @@ include_directories( ${LLMATH_INCLUDE_DIRS} ${LLVFS_INCLUDE_DIRS} ${PNG_INCLUDE_DIRS} + ${ZLIB_INCLUDE_DIRS} ) set(llimage_SOURCE_FILES diff --git a/linden/indra/llimage/llimage.cpp b/linden/indra/llimage/llimage.cpp index d4489fc..88edc99 100644 --- a/linden/indra/llimage/llimage.cpp +++ b/linden/indra/llimage/llimage.cpp @@ -17,7 +17,8 @@ * 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 + * 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, @@ -1136,7 +1137,7 @@ file_extensions[] = { "dxt", IMG_CODEC_DXT }, { "png", IMG_CODEC_PNG } }; -#define NUM_FILE_EXTENSIONS sizeof(file_extensions)/sizeof(file_extensions[0]) +#define NUM_FILE_EXTENSIONS LL_ARRAY_SIZE(file_extensions) static std::string find_file(std::string &name, S8 *codec) { @@ -1512,7 +1513,9 @@ BOOL LLImageFormatted::load(const std::string &filename) resetLastError(); S32 file_size = 0; - apr_file_t* apr_file = ll_apr_file_open(filename, LL_APR_RB, &file_size); + LLAPRFile infile ; + infile.open(filename, LL_APR_RB, NULL, &file_size); + apr_file_t* apr_file = infile.getFileHandle(); if (!apr_file) { setLastError("Unable to open file for reading", filename); @@ -1521,7 +1524,6 @@ BOOL LLImageFormatted::load(const std::string &filename) if (file_size == 0) { setLastError("File is empty",filename); - apr_file_close(apr_file); return FALSE; } @@ -1539,8 +1541,7 @@ BOOL LLImageFormatted::load(const std::string &filename) { res = updateData(); } - apr_file_close(apr_file); - + return res; } @@ -1548,16 +1549,16 @@ BOOL LLImageFormatted::save(const std::string &filename) { resetLastError(); - apr_file_t* apr_file = ll_apr_file_open(filename, LL_APR_WB); - if (!apr_file) + LLAPRFile outfile ; + outfile.open(filename, LL_APR_WB); + if (!outfile.getFileHandle()) { setLastError("Unable to open file for writing", filename); return FALSE; } - ll_apr_file_write(apr_file, getData(), getDataSize()); - apr_file_close(apr_file); - + outfile.write(getData(), getDataSize()); + outfile.close() ; return TRUE; } diff --git a/linden/indra/llimage/llimage.h b/linden/indra/llimage/llimage.h index 321eda8..bd609b6 100644 --- a/linden/indra/llimage/llimage.h +++ b/linden/indra/llimage/llimage.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llimage/llimagebmp.cpp b/linden/indra/llimage/llimagebmp.cpp index ddc8825..ceded29 100644 --- a/linden/indra/llimage/llimagebmp.cpp +++ b/linden/indra/llimage/llimagebmp.cpp @@ -16,7 +16,8 @@ * 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 + * 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, diff --git a/linden/indra/llimage/llimagebmp.h b/linden/indra/llimage/llimagebmp.h index 9c0c611..c4d6fd8 100644 --- a/linden/indra/llimage/llimagebmp.h +++ b/linden/indra/llimage/llimagebmp.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llimage/llimagedxt.cpp b/linden/indra/llimage/llimagedxt.cpp index fe66ee3..1ce4517 100644 --- a/linden/indra/llimage/llimagedxt.cpp +++ b/linden/indra/llimage/llimagedxt.cpp @@ -16,7 +16,8 @@ * 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 + * 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, diff --git a/linden/indra/llimage/llimagedxt.h b/linden/indra/llimage/llimagedxt.h index 3d81414..bc2d652 100644 --- a/linden/indra/llimage/llimagedxt.h +++ b/linden/indra/llimage/llimagedxt.h @@ -16,7 +16,8 @@ * 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 + * 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, diff --git a/linden/indra/llimage/llimagej2c.cpp b/linden/indra/llimage/llimagej2c.cpp index fe5d656..1b93c21 100644 --- a/linden/indra/llimage/llimagej2c.cpp +++ b/linden/indra/llimage/llimagej2c.cpp @@ -16,7 +16,8 @@ * 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 + * 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, @@ -418,7 +419,9 @@ BOOL LLImageJ2C::loadAndValidate(const std::string &filename) resetLastError(); S32 file_size = 0; - apr_file_t* apr_file = ll_apr_file_open(filename, LL_APR_RB, &file_size); + LLAPRFile infile ; + infile.open(filename, LL_APR_RB, NULL, &file_size); + apr_file_t* apr_file = infile.getFileHandle() ; if (!apr_file) { setLastError("Unable to open file for reading", filename); @@ -427,7 +430,6 @@ BOOL LLImageJ2C::loadAndValidate(const std::string &filename) else if (file_size == 0) { setLastError("File is empty",filename); - apr_file_close(apr_file); res = FALSE; } else @@ -435,7 +437,8 @@ BOOL LLImageJ2C::loadAndValidate(const std::string &filename) U8 *data = new U8[file_size]; apr_size_t bytes_read = file_size; apr_status_t s = apr_file_read(apr_file, data, &bytes_read); // modifies bytes_read - apr_file_close(apr_file); + infile.close() ; + if (s != APR_SUCCESS || (S32)bytes_read != file_size) { delete[] data; @@ -447,7 +450,7 @@ BOOL LLImageJ2C::loadAndValidate(const std::string &filename) res = validate(data, file_size); } } - + if (!mLastError.empty()) { LLImage::setLastError(mLastError); diff --git a/linden/indra/llimage/llimagej2c.h b/linden/indra/llimage/llimagej2c.h index ad514eb..23f6ef5 100644 --- a/linden/indra/llimage/llimagej2c.h +++ b/linden/indra/llimage/llimagej2c.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llimage/llimagejpeg.cpp b/linden/indra/llimage/llimagejpeg.cpp index afb3368..fa0dd3f 100644 --- a/linden/indra/llimage/llimagejpeg.cpp +++ b/linden/indra/llimage/llimagejpeg.cpp @@ -16,7 +16,8 @@ * 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 + * 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, diff --git a/linden/indra/llimage/llimagejpeg.h b/linden/indra/llimage/llimagejpeg.h index 0914fd7..884d071 100644 --- a/linden/indra/llimage/llimagejpeg.h +++ b/linden/indra/llimage/llimagejpeg.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llimage/llimagepng.cpp b/linden/indra/llimage/llimagepng.cpp index f2d6376..b5de104 100644 --- a/linden/indra/llimage/llimagepng.cpp +++ b/linden/indra/llimage/llimagepng.cpp @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llimage/llimagepng.h b/linden/indra/llimage/llimagepng.h index 0387982..083dda7 100644 --- a/linden/indra/llimage/llimagepng.h +++ b/linden/indra/llimage/llimagepng.h @@ -16,7 +16,8 @@ * 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 + * 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, diff --git a/linden/indra/llimage/llimagetga.cpp b/linden/indra/llimage/llimagetga.cpp index 853a0dc..a6721bf 100644 --- a/linden/indra/llimage/llimagetga.cpp +++ b/linden/indra/llimage/llimagetga.cpp @@ -16,7 +16,8 @@ * 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 + * 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, @@ -104,7 +105,7 @@ LLImageTGA::LLImageTGA(const std::string& file_name) LLImageTGA::~LLImageTGA() { - delete mColorMap; + delete [] mColorMap; } BOOL LLImageTGA::updateData() diff --git a/linden/indra/llimage/llimagetga.h b/linden/indra/llimage/llimagetga.h index b522930..e237cc5 100644 --- a/linden/indra/llimage/llimagetga.h +++ b/linden/indra/llimage/llimagetga.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llimage/llimageworker.cpp b/linden/indra/llimage/llimageworker.cpp index d570ad1..532e996 100644 --- a/linden/indra/llimage/llimageworker.cpp +++ b/linden/indra/llimage/llimageworker.cpp @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llimage/llimageworker.h b/linden/indra/llimage/llimageworker.h index a133f77..879fcf5 100644 --- a/linden/indra/llimage/llimageworker.h +++ b/linden/indra/llimage/llimageworker.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llimage/llmapimagetype.h b/linden/indra/llimage/llmapimagetype.h index 0e17aaa..762d28b 100644 --- a/linden/indra/llimage/llmapimagetype.h +++ b/linden/indra/llimage/llmapimagetype.h @@ -16,7 +16,8 @@ * 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 + * 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, diff --git a/linden/indra/llimage/llpngwrapper.cpp b/linden/indra/llimage/llpngwrapper.cpp index 2b0f7b6..0dd991a 100644 --- a/linden/indra/llimage/llpngwrapper.cpp +++ b/linden/indra/llimage/llpngwrapper.cpp @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llimage/llpngwrapper.h b/linden/indra/llimage/llpngwrapper.h index 87ddb9e..2e6c1dc 100644 --- a/linden/indra/llimage/llpngwrapper.h +++ b/linden/indra/llimage/llpngwrapper.h @@ -16,7 +16,8 @@ * 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 + * 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, diff --git a/linden/indra/llimagej2coj/llimagej2coj.cpp b/linden/indra/llimagej2coj/llimagej2coj.cpp index 5afac0e..be6b6c8 100644 --- a/linden/indra/llimagej2coj/llimagej2coj.cpp +++ b/linden/indra/llimagej2coj/llimagej2coj.cpp @@ -17,7 +17,8 @@ * 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 + * 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, @@ -57,26 +58,42 @@ void fallbackDestroyLLImageJ2CImpl(LLImageJ2CImpl* impl) impl = NULL; } +// Return string from message, eliminating final \n if present +static std::string chomp(const char* msg) +{ + // stomp trailing \n + std::string message = msg; + if (!message.empty()) + { + size_t last = message.size() - 1; + if (message[last] == '\n') + { + message.resize( last ); + } + } + return message; +} + /** sample error callback expecting a LLFILE* client object */ void error_callback(const char* msg, void*) { - lldebugs << "LLImageJ2CImpl error_callback: " << msg << llendl; + lldebugs << "LLImageJ2COJ: " << chomp(msg) << llendl; } /** sample warning callback expecting a LLFILE* client object */ void warning_callback(const char* msg, void*) { - lldebugs << "LLImageJ2CImpl warning_callback: " << msg << llendl; + lldebugs << "LLImageJ2COJ: " << chomp(msg) << llendl; } /** sample debug callback expecting no client object */ void info_callback(const char* msg, void*) { - lldebugs << "LLImageJ2CImpl info_callback: " << msg << llendl; + lldebugs << "LLImageJ2COJ: " << chomp(msg) << llendl; } diff --git a/linden/indra/llimagej2coj/llimagej2coj.h b/linden/indra/llimagej2coj/llimagej2coj.h index 05504d6..73cb074 100644 --- a/linden/indra/llimagej2coj/llimagej2coj.h +++ b/linden/indra/llimagej2coj/llimagej2coj.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llinventory/llcategory.cpp b/linden/indra/llinventory/llcategory.cpp index 9f58c6f..02c5a8e 100644 --- a/linden/indra/llinventory/llcategory.cpp +++ b/linden/indra/llinventory/llcategory.cpp @@ -16,7 +16,8 @@ * 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 + * 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, diff --git a/linden/indra/llinventory/llcategory.h b/linden/indra/llinventory/llcategory.h index 1692c96..c8e2dac 100644 --- a/linden/indra/llinventory/llcategory.h +++ b/linden/indra/llinventory/llcategory.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llinventory/lleconomy.cpp b/linden/indra/llinventory/lleconomy.cpp index 5f8342d..4366d1e 100644 --- a/linden/indra/llinventory/lleconomy.cpp +++ b/linden/indra/llinventory/lleconomy.cpp @@ -16,7 +16,8 @@ * 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 + * 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, @@ -73,6 +74,18 @@ void LLGlobalEconomy::processEconomyData(LLMessageSystem *msg, LLGlobalEconomy* econ_data->setPricePublicObjectDelete(i); msg->getS32Fast(_PREHASH_Info, _PREHASH_PriceUpload, i); econ_data->setPriceUpload(i); +#if LL_LINUX + // We can optionally fake the received upload price for testing. + // Note that the server is within its rights to not obey our fake + // price. :) + const char* fakeprice_str = getenv("LL_FAKE_UPLOAD_PRICE"); + if (fakeprice_str) + { + S32 fakeprice = (S32)atoi(fakeprice_str); + llwarns << "LL_FAKE_UPLOAD_PRICE: Faking upload price as L$" << fakeprice << llendl; + econ_data->setPriceUpload(fakeprice); + } +#endif msg->getS32Fast(_PREHASH_Info, _PREHASH_PriceRentLight, i); econ_data->setPriceRentLight(i); msg->getS32Fast(_PREHASH_Info, _PREHASH_TeleportMinPrice, i); diff --git a/linden/indra/llinventory/lleconomy.h b/linden/indra/llinventory/lleconomy.h index 03db99b..2e2adc4 100644 --- a/linden/indra/llinventory/lleconomy.h +++ b/linden/indra/llinventory/lleconomy.h @@ -16,7 +16,8 @@ * 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 + * 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, @@ -47,6 +48,8 @@ public: // become a singleton and this pattern will more easily disambiguate them. typedef LLSingleton Singleton; + void initSingleton() { } + virtual void print(); static void processEconomyData(LLMessageSystem *msg, LLGlobalEconomy* econ_data); diff --git a/linden/indra/llinventory/llinventory.cpp b/linden/indra/llinventory/llinventory.cpp index 2d86256..b1cfd68 100644 --- a/linden/indra/llinventory/llinventory.cpp +++ b/linden/indra/llinventory/llinventory.cpp @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llinventory/llinventory.h b/linden/indra/llinventory/llinventory.h index 578d331..937e12d 100644 --- a/linden/indra/llinventory/llinventory.h +++ b/linden/indra/llinventory/llinventory.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llinventory/llinventorytype.cpp b/linden/indra/llinventory/llinventorytype.cpp index 585532c..a161a0e 100644 --- a/linden/indra/llinventory/llinventorytype.cpp +++ b/linden/indra/llinventory/llinventorytype.cpp @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llinventory/llinventorytype.h b/linden/indra/llinventory/llinventorytype.h index 51747d6..d3effc0 100644 --- a/linden/indra/llinventory/llinventorytype.h +++ b/linden/indra/llinventory/llinventorytype.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llinventory/lllandmark.cpp b/linden/indra/llinventory/lllandmark.cpp index 234b087..13a63bc 100644 --- a/linden/indra/llinventory/lllandmark.cpp +++ b/linden/indra/llinventory/lllandmark.cpp @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llinventory/lllandmark.h b/linden/indra/llinventory/lllandmark.h index 4bce527..cb0c11a 100644 --- a/linden/indra/llinventory/lllandmark.h +++ b/linden/indra/llinventory/lllandmark.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llinventory/llnotecard.cpp b/linden/indra/llinventory/llnotecard.cpp index 0c33d23..9e7e043 100644 --- a/linden/indra/llinventory/llnotecard.cpp +++ b/linden/indra/llinventory/llnotecard.cpp @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llinventory/llnotecard.h b/linden/indra/llinventory/llnotecard.h index aa4e2bd..b903f1f 100644 --- a/linden/indra/llinventory/llnotecard.h +++ b/linden/indra/llinventory/llnotecard.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llinventory/llparcel.cpp b/linden/indra/llinventory/llparcel.cpp index d2f3a87..9c27476 100644 --- a/linden/indra/llinventory/llparcel.cpp +++ b/linden/indra/llinventory/llparcel.cpp @@ -17,7 +17,8 @@ * 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 + * 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, @@ -57,8 +58,11 @@ static const std::string PARCEL_OWNERSHIP_STATUS_STRING[LLParcel::OS_COUNT+1] = }; // NOTE: Adding parcel categories also requires updating: -// * newview/app_settings/floater_directory.xml category combobox +// * floater_directory.xml category combobox +// * floater_about_land.xml category combobox // * Web site "create event" tools +// DO NOT DELETE ITEMS FROM THIS LIST WITHOUT DEEPLY UNDERSTANDING WHAT YOU'RE DOING. +// static const std::string PARCEL_CATEGORY_STRING[LLParcel::C_COUNT] = { "none", @@ -109,37 +113,11 @@ static const std::string PARCEL_ACTION_STRING[LLParcel::A_COUNT + 1] = "unknown" }; -// Timeouts for parcels -// default is 21 days * 24h/d * 60m/h * 60s/m *1000000 usec/s = 1814400000000 -const U64 DEFAULT_USEC_CONVERSION_TIMEOUT = U64L(1814400000000); -// ***** TESTING is 10 minutes -//const U64 DEFAULT_USEC_CONVERSION_TIMEOUT = U64L(600000000); -// group is 60 days * 24h/d * 60m/h * 60s/m *1000000 usec/s = 5184000000000 -const U64 GROUP_USEC_CONVERSION_TIMEOUT = U64L(5184000000000); -// ***** TESTING is 10 minutes -//const U64 GROUP_USEC_CONVERSION_TIMEOUT = U64L(600000000); -// default sale timeout is 2 days -> 172800000000 -const U64 DEFAULT_USEC_SALE_TIMEOUT = U64L(172800000000); -// ***** TESTING is 10 minutes -//const U64 DEFAULT_USEC_SALE_TIMEOUT = U64L(600000000); - -// more grace period extensions. -const U64 SEVEN_DAYS_IN_USEC = U64L(604800000000); - -// if more than 100,000s before sale revert, and no extra extension -// has been given, go ahead and extend it more. That's about 1.2 days. -const S32 EXTEND_GRACE_IF_MORE_THAN_SEC = 100000; - - -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 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() @@ -277,7 +255,7 @@ void LLParcel::setName(const std::string& name) // The escaping here must match the escaping in the database // abstraction layer. mName = name; - LLStringFn::replace_nonprintable(mName, LL_UNKNOWN_CHAR); + LLStringFn::replace_nonprintable_in_ascii(mName, LL_UNKNOWN_CHAR); } void LLParcel::setDesc(const std::string& desc) @@ -295,7 +273,7 @@ void LLParcel::setMusicURL(const std::string& url) // abstraction layer. // This should really filter the url in some way. Other than // simply requiring non-printable. - LLStringFn::replace_nonprintable(mMusicURL, LL_UNKNOWN_CHAR); + LLStringFn::replace_nonprintable_in_ascii(mMusicURL, LL_UNKNOWN_CHAR); } void LLParcel::setMediaURL(const std::string& url) @@ -305,7 +283,7 @@ void LLParcel::setMediaURL(const std::string& url) // abstraction layer if it's ever added. // This should really filter the url in some way. Other than // simply requiring non-printable. - LLStringFn::replace_nonprintable(mMediaURL, LL_UNKNOWN_CHAR); + LLStringFn::replace_nonprintable_in_ascii(mMediaURL, LL_UNKNOWN_CHAR); } void LLParcel::setMediaDesc(const std::string& desc) @@ -547,500 +525,6 @@ void LLParcel::setDiscountRate(F32 rate) // File input and output //----------------------------------------------------------- - -// WARNING: Area will be wrong until you calculate it. -BOOL LLParcel::importStream(std::istream& input_stream) -{ - U32 setting; - S32 secs_until_revert = 0; - - skip_to_end_of_next_keyword("{", input_stream); - if (!input_stream.good()) - { - llwarns << "LLParcel::importStream() - bad input_stream" << llendl; - return FALSE; - } - - while (input_stream.good()) - { - skip_comments_and_emptyspace(input_stream); - std::string line, keyword, value; - get_line(line, input_stream, MAX_STRING); - get_keyword_and_value(keyword, value, line); - - if ("}" == keyword) - { - break; - } - else if ("parcel_id" == keyword) - { - mID.set(value); - } - else if ("status" == keyword) - { - mStatus = ownership_string_to_status(value); - } - else if ("category" == keyword) - { - mCategory = category_string_to_category(value); - } - else if ("local_id" == keyword) - { - LLStringUtil::convertToS32(value, mLocalID); - } - else if ("name" == keyword) - { - setName( value ); - } - else if ("desc" == keyword) - { - setDesc( value ); - } - else if ("music_url" == keyword) - { - setMusicURL( value ); - } - else if ("media_url" == keyword) - { - setMediaURL( value ); - } - else if ("media_desc" == keyword) - { - setMediaDesc( value ); - } - else if ("media_type" == keyword) - { - setMediaType( value ); - } - else if ("media_width" == keyword) - { - S32 width; - LLStringUtil::convertToS32(value, width); - setMediaWidth( width ); - } - else if ("media_height" == keyword) - { - S32 height; - LLStringUtil::convertToS32(value, height); - setMediaHeight( height ); - } - else if ("media_id" == keyword) - { - mMediaID.set( value ); - } - else if ("media_auto_scale" == keyword) - { - LLStringUtil::convertToU8(value, mMediaAutoScale); - } - else if ("media_loop" == keyword) - { - LLStringUtil::convertToU8(value, mMediaLoop); - } - else if ("obscure_media" == keyword) - { - LLStringUtil::convertToU8(value, mObscureMedia); - } - else if ("obscure_music" == keyword) - { - LLStringUtil::convertToU8(value, mObscureMusic); - } - else if ("owner_id" == keyword) - { - mOwnerID.set( value ); - } - else if ("group_owned" == keyword) - { - LLStringUtil::convertToBOOL(value, mGroupOwned); - } - else if ("clean_other_time" == keyword) - { - S32 time; - LLStringUtil::convertToS32(value, time); - setCleanOtherTime(time); - } - else if ("auth_buyer_id" == keyword) - { - mAuthBuyerID.set(value); - } - else if ("snapshot_id" == keyword) - { - mSnapshotID.set(value); - } - else if ("user_location" == keyword) - { - sscanf(value.c_str(), "%f %f %f", - &mUserLocation.mV[VX], - &mUserLocation.mV[VY], - &mUserLocation.mV[VZ]); - } - else if ("user_look_at" == keyword) - { - sscanf(value.c_str(), "%f %f %f", - &mUserLookAt.mV[VX], - &mUserLookAt.mV[VY], - &mUserLookAt.mV[VZ]); - } - else if ("landing_type" == keyword) - { - S32 landing_type = 0; - LLStringUtil::convertToS32(value, landing_type); - mLandingType = (ELandingType) landing_type; - } - else if ("join_neighbors" == keyword) - { - llinfos << "found deprecated keyword join_neighbors" << llendl; - } - else if ("revert_sale" == keyword) - { - LLStringUtil::convertToS32(value, secs_until_revert); - if (secs_until_revert > 0) - { - mSaleTimerExpires.start(); - mSaleTimerExpires.setTimerExpirySec((F32)secs_until_revert); - } - } - else if("extended_grace" == keyword) - { - LLStringUtil::convertToS32(value, mGraceExtension); - } - else if ("user_list_type" == keyword) - { - // deprecated - } - else if("auction_id" == keyword) - { - LLStringUtil::convertToU32(value, mAuctionID); - } - else if ("allow_modify" == keyword) - { - LLStringUtil::convertToU32(value, setting); - setParcelFlag(PF_CREATE_OBJECTS, setting); - } - else if ("allow_group_modify" == keyword) - { - LLStringUtil::convertToU32(value, setting); - setParcelFlag(PF_CREATE_GROUP_OBJECTS, setting); - } - else if ("allow_all_object_entry" == keyword) - { - LLStringUtil::convertToU32(value, setting); - setParcelFlag(PF_ALLOW_ALL_OBJECT_ENTRY, setting); - } - else if ("allow_group_object_entry" == keyword) - { - LLStringUtil::convertToU32(value, setting); - setParcelFlag(PF_ALLOW_GROUP_OBJECT_ENTRY, setting); - } - else if ("allow_deed_to_group" == keyword) - { - LLStringUtil::convertToU32(value, setting); - setParcelFlag(PF_ALLOW_DEED_TO_GROUP, setting); - } - else if("contribute_with_deed" == keyword) - { - LLStringUtil::convertToU32(value, setting); - setParcelFlag(PF_CONTRIBUTE_WITH_DEED, setting); - } - else if ("allow_terraform" == keyword) - { - LLStringUtil::convertToU32(value, setting); - setParcelFlag(PF_ALLOW_TERRAFORM, setting); - } - else if ("allow_damage" == keyword) - { - LLStringUtil::convertToU32(value, setting); - setParcelFlag(PF_ALLOW_DAMAGE, setting); - } - else if ("allow_fly" == keyword) - { - LLStringUtil::convertToU32(value, setting); - setParcelFlag(PF_ALLOW_FLY, setting); - } - else if ("allow_landmark" == keyword) - { - LLStringUtil::convertToU32(value, setting); - setParcelFlag(PF_ALLOW_LANDMARK, setting); - } - else if ("sound_local" == keyword) - { - LLStringUtil::convertToU32(value, setting); - setParcelFlag(PF_SOUND_LOCAL, setting); - } - else if ("allow_group_scripts" == keyword) - { - LLStringUtil::convertToU32(value, setting); - setParcelFlag(PF_ALLOW_GROUP_SCRIPTS, setting); - } - else if ("allow_voice_chat" == keyword) - { - LLStringUtil::convertToU32(value, setting); - setParcelFlag(PF_ALLOW_VOICE_CHAT, setting); - } - else if ("use_estate_voice_chan" == keyword) - { - LLStringUtil::convertToU32(value, setting); - setParcelFlag(PF_USE_ESTATE_VOICE_CHAN, setting); - } - else if ("allow_scripts" == keyword) - { - LLStringUtil::convertToU32(value, setting); - setParcelFlag(PF_ALLOW_OTHER_SCRIPTS, setting); - } - else if ("for_sale" == keyword) - { - LLStringUtil::convertToU32(value, setting); - setParcelFlag(PF_FOR_SALE, setting); - } - else if ("sell_w_objects" == keyword) - { - LLStringUtil::convertToU32(value, setting); - setParcelFlag(PF_SELL_PARCEL_OBJECTS, setting); - } - else if ("use_pass_list" == keyword) - { - LLStringUtil::convertToU32(value, setting); - setParcelFlag(PF_USE_PASS_LIST, setting); - } - else if ("show_directory" == keyword) - { - LLStringUtil::convertToU32(value, setting); - setParcelFlag(PF_SHOW_DIRECTORY, setting); - } - else if ("allow_publish" == keyword) - { - LLStringUtil::convertToU32(value, setting); - setParcelFlag(PF_ALLOW_PUBLISH, setting); - } - else if ("mature_publish" == keyword) - { - 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; - LLStringUtil::convertToS32(value, time); - mClaimDate = time; - } - else if ("claim_price" == keyword) - { - LLStringUtil::convertToS32(value, mClaimPricePerMeter); - } - else if ("rent_price" == keyword) - { - LLStringUtil::convertToS32(value, mRentPricePerMeter); - } - else if ("discount_rate" == keyword) - { - LLStringUtil::convertToF32(value, mDiscountRate); - } - else if ("draw_distance" == keyword) - { - LLStringUtil::convertToF32(value, mDrawDistance); - } - else if ("sale_price" == keyword) - { - LLStringUtil::convertToS32(value, mSalePrice); - } - else if ("pass_price" == keyword) - { - LLStringUtil::convertToS32(value, mPassPrice); - } - else if ("pass_hours" == keyword) - { - LLStringUtil::convertToF32(value, mPassHours); - } - else if ("box" == keyword) - { - // deprecated - } - else if ("aabb_min" == keyword) - { - sscanf(value.c_str(), "%f %f %f", - &mAABBMin.mV[VX], &mAABBMin.mV[VY], &mAABBMin.mV[VZ]); - } - else if ("use_access_group" == keyword) - { - LLStringUtil::convertToU32(value, setting); - setParcelFlag(PF_USE_ACCESS_GROUP, setting); - } - else if ("use_access_list" == keyword) - { - LLStringUtil::convertToU32(value, setting); - setParcelFlag(PF_USE_ACCESS_LIST, setting); - } - else if ("use_ban_list" == keyword) - { - LLStringUtil::convertToU32(value, setting); - setParcelFlag(PF_USE_BAN_LIST, setting); - } - else if ("group_name" == keyword) - { - llinfos << "found deprecated keyword group_name" << llendl; - } - else if ("group_id" == keyword) - { - mGroupID.set( value ); - } - // TODO: DEPRECATED FLAG - // Flag removed from simstate files in 1.11.1 - // Remove at some point where we have guarenteed this flag - // no longer exists anywhere in simstate files. - else if ("require_identified" == keyword) - { - // LLStringUtil::convertToU32(value, setting); - // setParcelFlag(PF_DENY_ANONYMOUS, setting); - } - // TODO: DEPRECATED FLAG - // Flag removed from simstate files in 1.11.1 - // Remove at some point where we have guarenteed this flag - // no longer exists anywhere in simstate files. - else if ("require_transacted" == keyword) - { - // LLStringUtil::convertToU32(value, setting); - // setParcelFlag(PF_DENY_ANONYMOUS, setting); - // setParcelFlag(PF_DENY_IDENTIFIED, setting); - } - else if ("restrict_pushobject" == keyword) - { - LLStringUtil::convertToU32(value, setting); - setParcelFlag(PF_RESTRICT_PUSHOBJECT, setting); - } - else if ("deny_anonymous" == keyword) - { - LLStringUtil::convertToU32(value, setting); - setParcelFlag(PF_DENY_ANONYMOUS, setting); - } - else if ("deny_identified" == keyword) - { -// LLStringUtil::convertToU32(value, setting); -// setParcelFlag(PF_DENY_IDENTIFIED, setting); - } - else if ("deny_transacted" == keyword) - { -// LLStringUtil::convertToU32(value, setting); -// setParcelFlag(PF_DENY_TRANSACTED, setting); - } - else if ("deny_age_unverified" == keyword) - { - LLStringUtil::convertToU32(value, setting); - setParcelFlag(PF_DENY_AGEUNVERIFIED, setting); - } - else if ("access_list" == keyword) - { - S32 entry_count = 0; - LLStringUtil::convertToS32(value, entry_count); - for (S32 i = 0; i < entry_count; i++) - { - LLAccessEntry entry; - if (importAccessEntry(input_stream, &entry)) - { - mAccessList[entry.mID] = entry; - } - } - } - else if ("ban_list" == keyword) - { - S32 entry_count = 0; - LLStringUtil::convertToS32(value, entry_count); - for (S32 i = 0; i < entry_count; i++) - { - LLAccessEntry entry; - if (importAccessEntry(input_stream, &entry)) - { - mBanList[entry.mID] = entry; - } - } - } - else if ("renter_list" == keyword) - { - /* - S32 entry_count = 0; - LLStringUtil::convertToS32(value, entry_count); - for (S32 i = 0; i < entry_count; i++) - { - LLAccessEntry entry; - if (importAccessEntry(input_stream, &entry)) - { - mRenterList.put(entry); - } - }*/ - } - else if ("pass_list" == keyword) - { - // legacy - put into access list - S32 entry_count = 0; - LLStringUtil::convertToS32(value, entry_count); - for (S32 i = 0; i < entry_count; i++) - { - LLAccessEntry entry; - if (importAccessEntry(input_stream, &entry)) - { - mAccessList[entry.mID] = entry; - } - } - } - - else - { - llwarns << "Unknown keyword in parcel section: <" - << keyword << ">" << llendl; - } - } - - // this code block detects if we have loaded a 1.1 simstate file, - // and follows the conversion rules specified in - // design_docs/land/pay_for_parcel.txt. - F32 time_to_expire = 0.0f; - if(mID.isNull()) - { - mID.generate(); - mStatus = OS_LEASE_PENDING; - //mBuyerID = mOwnerID; - if(getIsGroupOwned()) - { - time_to_expire += GROUP_USEC_CONVERSION_TIMEOUT / SEC_TO_MICROSEC; - } - else - { - time_to_expire += DEFAULT_USEC_CONVERSION_TIMEOUT / SEC_TO_MICROSEC; - } - //mExpireAction = STEA_PUBLIC; - mRecordTransaction = TRUE; - } - - // this code block deals with giving an extension to pending - // parcels to the midday of 2004-01-19 if they were originally set - // for some time on 2004-01-12. - if((0 == mGraceExtension) - && (EXTEND_GRACE_IF_MORE_THAN_SEC < secs_until_revert)) - { - const S32 NEW_CONVERSION_DATE = 1074538800; // 2004-01-19T11:00:00 - time_t now = time(NULL); // now in epoch - secs_until_revert = (S32)(NEW_CONVERSION_DATE - now); - time_to_expire = (F32)secs_until_revert; - mGraceExtension = 1; - } - - // This code block adds yet another week to the deadline. :( - if(1 == mGraceExtension) - { - time_to_expire += SEVEN_DAYS_IN_USEC / SEC_TO_MICROSEC; - mGraceExtension = 2; - } - - if (time_to_expire > 0) - { - mSaleTimerExpires.setTimerExpirySec(time_to_expire); - mSaleTimerExpires.start(); - } - - // successful import - return TRUE; -} - - BOOL LLParcel::importAccessEntry(std::istream& input_stream, LLAccessEntry* entry) { skip_to_end_of_next_keyword("{", input_stream); @@ -1084,230 +568,6 @@ BOOL LLParcel::importAccessEntry(std::istream& input_stream, LLAccessEntry* entr return input_stream.good(); } -BOOL LLParcel::exportStream(std::ostream& output_stream) -{ - S32 setting; - std::string id_string; - - std::ios::fmtflags old_flags = output_stream.flags(); - output_stream.setf(std::ios::showpoint); - output_stream << "\t{\n"; - - mID.toString(id_string); - output_stream << "\t\t parcel_id " << id_string << "\n"; - output_stream << "\t\t status " << ownership_status_to_string(mStatus) << "\n"; - output_stream << "\t\t category " << category_to_string(mCategory) << "\n"; - - output_stream << "\t\t local_id " << mLocalID << "\n"; - - const char* name = (mName.empty() ? "" : mName.c_str() ); - output_stream << "\t\t name " << name << "\n"; - - const char* desc = (mDesc.empty() ? "" : mDesc.c_str() ); - output_stream << "\t\t desc " << desc << "\n"; - - const char* music_url = (mMusicURL.empty() ? "" : mMusicURL.c_str() ); - output_stream << "\t\t music_url " << music_url << "\n"; - - const char* media_url = (mMediaURL.empty() ? "" : mMediaURL.c_str() ); - output_stream << "\t\t media_url " << media_url << "\n"; - - const char* media_type = (mMediaType.empty() ? "" : mMediaType.c_str() ); - output_stream << "\t\t media_type " << media_type << "\n"; - - const char* media_desc = (mMediaDesc.empty() ? "" : mMediaDesc.c_str() ); - output_stream << "\t\t media_desc " << media_desc << "\n"; - - output_stream << "\t\t media_auto_scale " << (mMediaAutoScale ? 1 : 0) << "\n"; - output_stream << "\t\t media_loop " << (mMediaLoop ? 1 : 0) << "\n"; - output_stream << "\t\t obscure_media " << (mObscureMedia ? 1 : 0) << "\n"; - output_stream << "\t\t obscure_music " << (mObscureMusic ? 1 : 0) << "\n"; - - mMediaID.toString(id_string); - output_stream << "\t\t media_id " << id_string << "\n"; - - output_stream << "\t\t media_width " << mMediaWidth << "\n"; - output_stream << "\t\t media_height " << mMediaHeight << "\n"; - - mOwnerID.toString(id_string); - output_stream << "\t\t owner_id " << id_string << "\n"; - output_stream << "\t\t group_owned " << (mGroupOwned ? 1 : 0) << "\n"; - output_stream << "\t\t clean_other_time " << getCleanOtherTime() << "\n"; - - if(!mAuthBuyerID.isNull()) - { - mAuthBuyerID.toString(id_string); - output_stream << "\t\t auth_buyer_id " << id_string << "\n"; - } - if (!mSnapshotID.isNull()) - { - mSnapshotID.toString(id_string); - output_stream << "\t\t snapshot_id " << id_string << "\n"; - } - if (!mUserLocation.isExactlyZero()) - { - output_stream << "\t\t user_location " - << (F64)mUserLocation.mV[VX] - << " " << (F64)mUserLocation.mV[VY] - << " " << (F64)mUserLocation.mV[VZ] << "\n"; - output_stream << "\t\t user_look_at " - << (F64)mUserLookAt.mV[VX] - << " " << (F64)mUserLookAt.mV[VY] - << " " << (F64)mUserLookAt.mV[VZ] << "\n"; - } - output_stream << "\t\t landing_type " << mLandingType << "\n"; - //if(mJoinNeighbors) - //{ - // output_stream << "\t\t join_neighbors " << mJoinNeighbors << "\n"; - //} - if(mSaleTimerExpires.getStarted()) - { - S32 dt_sec = (S32) mSaleTimerExpires.getRemainingTimeF32()+60; // Add a minute to prevent race conditions - output_stream << "\t\t revert_sale " << dt_sec << "\n"; - //output_stream << "\t\t revert_action " << revert_action_to_string(mExpireAction) << "\n"; - output_stream << "\t\t extended_grace " << mGraceExtension << "\n"; - } - - if(0 != mAuctionID) - { - output_stream << "\t\t auction_id " << mAuctionID << "\n"; - } - - output_stream << "\t\t allow_modify " << getAllowModify() << "\n"; - output_stream << "\t\t allow_group_modify " << getAllowGroupModify() << "\n"; - output_stream << "\t\t allow_all_object_entry " << getAllowAllObjectEntry() << "\n"; - output_stream << "\t\t allow_group_object_entry " << getAllowGroupObjectEntry() << "\n"; - output_stream << "\t\t allow_terraform " << getAllowTerraform() << "\n"; - output_stream << "\t\t allow_deed_to_group " << getAllowDeedToGroup() << "\n"; - output_stream << "\t\t contribute_with_deed " << getContributeWithDeed() << "\n"; - output_stream << "\t\t allow_damage " << getAllowDamage() << "\n"; - output_stream << "\t\t claim_date " << (S32)mClaimDate << "\n"; - output_stream << "\t\t claim_price " << mClaimPricePerMeter << "\n"; - output_stream << "\t\t rent_price " << mRentPricePerMeter << "\n"; - output_stream << "\t\t discount_rate " << mDiscountRate << "\n"; - output_stream << "\t\t allow_fly " << (getAllowFly() ? 1 : 0) << "\n"; - output_stream << "\t\t allow_landmark " << (getAllowLandmark() ? 1 : 0) << "\n"; - 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 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"; - output_stream << "\t\t sale_price " << mSalePrice << "\n"; - - setting = (getParcelFlag(PF_USE_ACCESS_GROUP) ? 1 : 0); - output_stream << "\t\t use_access_group " << setting << "\n"; - - setting = (getParcelFlag(PF_USE_ACCESS_LIST) ? 1 : 0); - output_stream << "\t\t use_access_list " << setting << "\n"; - - setting = (getParcelFlag(PF_USE_BAN_LIST) ? 1 : 0); - output_stream << "\t\t use_ban_list " << setting << "\n"; - - mGroupID.toString(id_string); - output_stream << "\t\t group_id " << id_string << "\n"; - - //const char* group_name - // = (mGroupName.isEmpty() ? "" : mGroupName.c_str() ); - //output_stream << "\t\t group_name " << group_name << "\n"; - - setting = (getParcelFlag(PF_USE_PASS_LIST) ? 1 : 0); - output_stream << "\t\t use_pass_list " << setting << "\n"; - - output_stream << "\t\t pass_price " << mPassPrice << "\n"; - output_stream << "\t\t pass_hours " << mPassHours << "\n"; - - setting = (getParcelFlag(PF_SHOW_DIRECTORY) ? 1 : 0); - output_stream << "\t\t show_directory " << setting << "\n"; - - setting = (getParcelFlag(PF_ALLOW_PUBLISH) ? 1 : 0); - output_stream << "\t\t allow_publish " << setting << "\n"; - - setting = (getParcelFlag(PF_MATURE_PUBLISH) ? 1 : 0); - output_stream << "\t\t mature_publish " << setting << "\n"; - - setting = (getParcelFlag(PF_DENY_ANONYMOUS) ? 1 : 0); - output_stream << "\t\t deny_anonymous " << setting << "\n"; - -// setting = (getParcelFlag(PF_DENY_IDENTIFIED) ? 1 : 0); -// output_stream << "\t\t deny_identified " << setting << "\n"; - -// setting = (getParcelFlag(PF_DENY_TRANSACTED) ? 1 : 0); -// output_stream << "\t\t deny_transacted " << setting << "\n"; - - setting = (getParcelFlag(PF_DENY_AGEUNVERIFIED) ? 1 : 0); - output_stream << "\t\t deny_age_unverified " << setting << "\n"; - - setting = (getParcelFlag(PF_RESTRICT_PUSHOBJECT) ? 1 : 0); - output_stream << "\t\t restrict_pushobject " << setting << "\n"; - - output_stream << "\t\t aabb_min " - << mAABBMin.mV[VX] - << " " << mAABBMin.mV[VY] - << " " << mAABBMin.mV[VZ] << "\n"; - - if (!mAccessList.empty()) - { - output_stream << "\t\t access_list " << mAccessList.size() << "\n"; - access_map_const_iterator cit = mAccessList.begin(); - access_map_const_iterator end = mAccessList.end(); - - for ( ; cit != end; ++cit) - { - output_stream << "\t\t{\n"; - const LLAccessEntry& entry = (*cit).second; - entry.mID.toString(id_string); - output_stream << "\t\t\tid " << id_string << "\n"; - output_stream << "\t\t\ttime " << entry.mTime << "\n"; - output_stream << "\t\t\tflags " << entry.mFlags << "\n"; - output_stream << "\t\t}\n"; - } - } - - if (!mBanList.empty()) - { - output_stream << "\t\t ban_list " << mBanList.size() << "\n"; - access_map_const_iterator cit = mBanList.begin(); - access_map_const_iterator end = mBanList.end(); - - for ( ; cit != end; ++cit) - { - output_stream << "\t\t{\n"; - const LLAccessEntry& entry = (*cit).second; - entry.mID.toString(id_string); - output_stream << "\t\t\tid " << id_string << "\n"; - output_stream << "\t\t\ttime " << entry.mTime << "\n"; - output_stream << "\t\t\tflags " << entry.mFlags << "\n"; - output_stream << "\t\t}\n"; - } - } - - /*if (mRenterList.count() > 0) - { - output_stream << "\t\t renter_list " << mRenterList.count() << "\n"; - for (i = 0; i < mRenterList.count(); i++) - { - output_stream << "\t\t{\n"; - const LLAccessEntry& entry = mRenterList.get(i); - entry.mID.toString(id_string); - output_stream << "\t\t\tid " << id_string << "\n"; - output_stream << "\t\t\ttime " << entry.mTime << "\n"; - output_stream << "\t\t\tflags " << entry.mFlags << "\n"; - output_stream << "\t\t}\n"; - } - }*/ - - output_stream << "\t}\n"; - output_stream.flags(old_flags); - - return TRUE; -} - - // Assumes we are in a block "ParcelData" void LLParcel::packMessage(LLMessageSystem* msg) { diff --git a/linden/indra/llinventory/llparcel.h b/linden/indra/llinventory/llparcel.h index 90d0d04..6f5ae87 100644 --- a/linden/indra/llinventory/llparcel.h +++ b/linden/indra/llinventory/llparcel.h @@ -16,7 +16,8 @@ * 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 + * 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, @@ -102,6 +103,32 @@ const U32 RT_OTHER = 0x1 << 3; const U32 RT_LIST = 0x1 << 4; const U32 RT_SELL = 0x1 << 5; + +// Timeouts for parcels +// default is 21 days * 24h/d * 60m/h * 60s/m *1000000 usec/s = 1814400000000 +const U64 DEFAULT_USEC_CONVERSION_TIMEOUT = U64L(1814400000000); +// ***** TESTING is 10 minutes +//const U64 DEFAULT_USEC_CONVERSION_TIMEOUT = U64L(600000000); + +// group is 60 days * 24h/d * 60m/h * 60s/m *1000000 usec/s = 5184000000000 +const U64 GROUP_USEC_CONVERSION_TIMEOUT = U64L(5184000000000); +// ***** TESTING is 10 minutes +//const U64 GROUP_USEC_CONVERSION_TIMEOUT = U64L(600000000); + +// default sale timeout is 2 days -> 172800000000 +const U64 DEFAULT_USEC_SALE_TIMEOUT = U64L(172800000000); +// ***** TESTING is 10 minutes +//const U64 DEFAULT_USEC_SALE_TIMEOUT = U64L(600000000); + +// more grace period extensions. +const U64 SEVEN_DAYS_IN_USEC = U64L(604800000000); + +// if more than 100,000s before sale revert, and no extra extension +// has been given, go ahead and extend it more. That's about 1.2 days. +const S32 EXTEND_GRACE_IF_MORE_THAN_SEC = 100000; + + + class LLMessageSystem; class LLSD; @@ -242,7 +269,7 @@ public: void setAllParcelFlags(U32 flags); void setParcelFlag(U32 flag, BOOL b); - void setArea(S32 area, S32 sim_object_limit); + virtual void setArea(S32 area, S32 sim_object_limit); void setDiscountRate(F32 rate); void setAllowModify(BOOL b) { setParcelFlag(PF_CREATE_OBJECTS, b); } @@ -270,9 +297,9 @@ public: void setPassPrice(S32 price) { mPassPrice = price; } void setPassHours(F32 hours) { mPassHours = hours; } - BOOL importStream(std::istream& input_stream); +// BOOL importStream(std::istream& input_stream); BOOL importAccessEntry(std::istream& input_stream, LLAccessEntry* entry); - BOOL exportStream(std::ostream& output_stream); +// BOOL exportStream(std::ostream& output_stream); void packMessage(LLMessageSystem* msg); void packMessage(LLSD& msg); @@ -632,4 +659,10 @@ public: }; +const std::string& ownership_status_to_string(LLParcel::EOwnershipStatus status); +LLParcel::EOwnershipStatus ownership_string_to_status(const std::string& s); +LLParcel::ECategory category_string_to_category(const std::string& s); +const std::string& category_to_string(LLParcel::ECategory category); + + #endif diff --git a/linden/indra/llinventory/llparcelflags.h b/linden/indra/llinventory/llparcelflags.h index 4cc9500..a1bd85f 100644 --- a/linden/indra/llinventory/llparcelflags.h +++ b/linden/indra/llinventory/llparcelflags.h @@ -16,7 +16,8 @@ * 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 + * 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, diff --git a/linden/indra/llinventory/llpermissions.cpp b/linden/indra/llinventory/llpermissions.cpp index 684a618..328ed45 100644 --- a/linden/indra/llinventory/llpermissions.cpp +++ b/linden/indra/llinventory/llpermissions.cpp @@ -18,7 +18,8 @@ * 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 + * 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, @@ -276,6 +277,15 @@ BOOL LLPermissions::setOwnerAndGroup( return allowed; } +// only call this if you know what you're doing +// there are usually perm-bit consequences when the +// ownerhsip changes +void LLPermissions::yesReallySetOwner(const LLUUID& owner, bool group_owned) +{ + mOwner = owner; + mIsGroupOwned = group_owned; +} + BOOL LLPermissions::deedToGroup(const LLUUID& agent, const LLUUID& group) { if(group.notNull() && (agent.isNull() || ((group == mGroup) diff --git a/linden/indra/llinventory/llpermissions.h b/linden/indra/llinventory/llpermissions.h index c1eb207..5587f8c 100644 --- a/linden/indra/llinventory/llpermissions.h +++ b/linden/indra/llinventory/llpermissions.h @@ -17,7 +17,8 @@ * 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 + * 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, @@ -223,6 +224,11 @@ public: // item. BOOL setOwnerAndGroup(const LLUUID& agent, const LLUUID& owner, const LLUUID& group, bool is_atomic); + // only call this if you know what you're doing + // there are usually perm-bit consequences when the + // ownerhsip changes + void yesReallySetOwner(const LLUUID& owner, bool group_owned); + // saves last owner, sets owner to uuid null, sets group // owned. group_id must be the group of the object (that's who it // is being deeded to) and the object must be group diff --git a/linden/indra/llinventory/llpermissionsflags.h b/linden/indra/llinventory/llpermissionsflags.h index 16eb444..afa2adb 100644 --- a/linden/indra/llinventory/llpermissionsflags.h +++ b/linden/indra/llinventory/llpermissionsflags.h @@ -16,7 +16,8 @@ * 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 + * 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, diff --git a/linden/indra/llinventory/llsaleinfo.cpp b/linden/indra/llinventory/llsaleinfo.cpp index 10182a6..11709bc 100644 --- a/linden/indra/llinventory/llsaleinfo.cpp +++ b/linden/indra/llinventory/llsaleinfo.cpp @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llinventory/llsaleinfo.h b/linden/indra/llinventory/llsaleinfo.h index 60dcfc6..07f4405 100644 --- a/linden/indra/llinventory/llsaleinfo.h +++ b/linden/indra/llinventory/llsaleinfo.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llinventory/lltransactionflags.cpp b/linden/indra/llinventory/lltransactionflags.cpp index a3ced5c..e0f87aa 100644 --- a/linden/indra/llinventory/lltransactionflags.cpp +++ b/linden/indra/llinventory/lltransactionflags.cpp @@ -18,7 +18,8 @@ * 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 + * 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, diff --git a/linden/indra/llinventory/lltransactionflags.h b/linden/indra/llinventory/lltransactionflags.h index c892b3a..75f1d12 100644 --- a/linden/indra/llinventory/lltransactionflags.h +++ b/linden/indra/llinventory/lltransactionflags.h @@ -16,7 +16,8 @@ * 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 + * 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, diff --git a/linden/indra/llinventory/lltransactiontypes.h b/linden/indra/llinventory/lltransactiontypes.h index 48f7b39..d701098 100644 --- a/linden/indra/llinventory/lltransactiontypes.h +++ b/linden/indra/llinventory/lltransactiontypes.h @@ -16,7 +16,8 @@ * 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 + * 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, diff --git a/linden/indra/llinventory/lluserrelations.cpp b/linden/indra/llinventory/lluserrelations.cpp index 2905a1a..8d6bfc6 100644 --- a/linden/indra/llinventory/lluserrelations.cpp +++ b/linden/indra/llinventory/lluserrelations.cpp @@ -19,7 +19,8 @@ * 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 + * 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, diff --git a/linden/indra/llinventory/lluserrelations.h b/linden/indra/llinventory/lluserrelations.h index 669706c..1682f50 100644 --- a/linden/indra/llinventory/lluserrelations.h +++ b/linden/indra/llinventory/lluserrelations.h @@ -19,7 +19,8 @@ * 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 + * 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, diff --git a/linden/indra/llmath/camera.h b/linden/indra/llmath/camera.h index 19df760..ce41f87 100644 --- a/linden/indra/llmath/camera.h +++ b/linden/indra/llmath/camera.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmath/coordframe.h b/linden/indra/llmath/coordframe.h index 47cbad5..b8a1c14 100644 --- a/linden/indra/llmath/coordframe.h +++ b/linden/indra/llmath/coordframe.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmath/llbboxlocal.cpp b/linden/indra/llmath/llbboxlocal.cpp index b348edd..3d0dbb0 100644 --- a/linden/indra/llmath/llbboxlocal.cpp +++ b/linden/indra/llmath/llbboxlocal.cpp @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmath/llbboxlocal.h b/linden/indra/llmath/llbboxlocal.h index 6406ee3..d69028e 100644 --- a/linden/indra/llmath/llbboxlocal.h +++ b/linden/indra/llmath/llbboxlocal.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmath/llcamera.cpp b/linden/indra/llmath/llcamera.cpp index cb9fae6..0f343bc 100644 --- a/linden/indra/llmath/llcamera.cpp +++ b/linden/indra/llmath/llcamera.cpp @@ -17,7 +17,8 @@ * 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 + * 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, @@ -50,33 +51,38 @@ LLCamera::LLCamera() : } -LLCamera::LLCamera(F32 z_field_of_view, F32 aspect_ratio, S32 view_height_in_pixels, F32 near_plane, F32 far_plane) : +LLCamera::LLCamera(F32 vertical_fov_rads, F32 aspect_ratio, S32 view_height_in_pixels, F32 near_plane, F32 far_plane) : LLCoordFrame(), - mView(z_field_of_view), - mAspect(aspect_ratio), mViewHeightInPixels(view_height_in_pixels), - mNearPlane(near_plane), - mFarPlane(far_plane), mFixedDistance(-1.f), mPlaneCount(6) { - if (mView < MIN_FIELD_OF_VIEW) { mView = MIN_FIELD_OF_VIEW; } - else if (mView > MAX_FIELD_OF_VIEW) { mView = MAX_FIELD_OF_VIEW; } + mAspect = llclamp(aspect_ratio, MIN_ASPECT_RATIO, MAX_ASPECT_RATIO); + mNearPlane = llclamp(near_plane, MIN_NEAR_PLANE, MAX_NEAR_PLANE); + if(far_plane < 0) far_plane = DEFAULT_FAR_PLANE; + mFarPlane = llclamp(far_plane, MIN_FAR_PLANE, MAX_FAR_PLANE); - if (mAspect < MIN_ASPECT_RATIO) { mAspect = MIN_ASPECT_RATIO; } - else if (mAspect > MAX_ASPECT_RATIO) { mAspect = MAX_ASPECT_RATIO; } - - if (mNearPlane < MIN_NEAR_PLANE) { mNearPlane = MIN_NEAR_PLANE; } - else if (mNearPlane > MAX_NEAR_PLANE) { mNearPlane = MAX_NEAR_PLANE; } + setView(vertical_fov_rads); +} - if (mFarPlane < 0) { mFarPlane = DEFAULT_FAR_PLANE; } - else if (mFarPlane < MIN_FAR_PLANE) { mFarPlane = MIN_FAR_PLANE; } - else if (mFarPlane > MAX_FAR_PLANE) { mFarPlane = MAX_FAR_PLANE; } - calculateFrustumPlanes(); -} +// ---------------- LLCamera::getFoo() member functions ---------------- +F32 LLCamera::getMinView() const +{ + // minimum vertical fov needs to be constrained in narrow windows. + return mAspect > 1 + ? MIN_FIELD_OF_VIEW // wide views + : MIN_FIELD_OF_VIEW * 1/mAspect; // clamps minimum width in narrow views +} +F32 LLCamera::getMaxView() const +{ + // maximum vertical fov needs to be constrained in wide windows. + return mAspect > 1 + ? MAX_FIELD_OF_VIEW / mAspect // clamps maximum width in wide views + : MAX_FIELD_OF_VIEW; // narrow views +} // ---------------- LLCamera::setFoo() member functions ---------------- @@ -92,11 +98,9 @@ void LLCamera::disableUserClipPlane() mPlaneCount = 6; } -void LLCamera::setView(F32 field_of_view) +void LLCamera::setView(F32 vertical_fov_rads) { - mView = field_of_view; - if (mView < MIN_FIELD_OF_VIEW) { mView = MIN_FIELD_OF_VIEW; } - else if (mView > MAX_FIELD_OF_VIEW) { mView = MAX_FIELD_OF_VIEW; } + mView = llclamp(vertical_fov_rads, MIN_FIELD_OF_VIEW, MAX_FIELD_OF_VIEW); calculateFrustumPlanes(); } @@ -110,27 +114,21 @@ void LLCamera::setViewHeightInPixels(S32 height) void LLCamera::setAspect(F32 aspect_ratio) { - mAspect = aspect_ratio; - if (mAspect < MIN_ASPECT_RATIO) { mAspect = MIN_ASPECT_RATIO; } - else if (mAspect > MAX_ASPECT_RATIO) { mAspect = MAX_ASPECT_RATIO; } + mAspect = llclamp(aspect_ratio, MIN_ASPECT_RATIO, MAX_ASPECT_RATIO); calculateFrustumPlanes(); } void LLCamera::setNear(F32 near_plane) { - mNearPlane = near_plane; - if (mNearPlane < MIN_NEAR_PLANE) { mNearPlane = MIN_NEAR_PLANE; } - else if (mNearPlane > MAX_NEAR_PLANE) { mNearPlane = MAX_NEAR_PLANE; } + mNearPlane = llclamp(near_plane, MIN_NEAR_PLANE, MAX_NEAR_PLANE); calculateFrustumPlanes(); } void LLCamera::setFar(F32 far_plane) { - mFarPlane = far_plane; - if (mFarPlane < MIN_FAR_PLANE) { mFarPlane = MIN_FAR_PLANE; } - else if (mFarPlane > MAX_FAR_PLANE) { mFarPlane = MAX_FAR_PLANE; } + mFarPlane = llclamp(far_plane, MIN_FAR_PLANE, MAX_FAR_PLANE); calculateFrustumPlanes(); } @@ -180,28 +178,95 @@ S32 LLCamera::AABBInFrustum(const LLVector3 ¢er, const LLVector3& radius) U8 mask = 0; S32 result = 2; - for (U32 i = 0; i < mPlaneCount; i++) - { - mask = mAgentPlanes[i].mask; - LLPlane p = mAgentPlanes[i].p; - LLVector3 n = LLVector3(p); - float d = p.mV[3]; - LLVector3 rscale = radius.scaledVec(scaler[mask]); - - LLVector3 minp = center - rscale; - LLVector3 maxp = center + rscale; + if (radius.magVecSquared() > mFrustumCornerDist * mFrustumCornerDist) + { //box is larger than frustum, check frustum quads against box planes - if (n * minp > -d) + static const LLVector3 dir[] = { - return 0; + LLVector3(1, 0, 0), + LLVector3(-1, 0, 0), + LLVector3(0, 1, 0), + LLVector3(0, -1, 0), + LLVector3(0, 0, 1), + LLVector3(0, 0, -1) + }; + + U32 quads[] = + { + 0, 1, 2, 3, + 0, 1, 5, 4, + 2, 3, 7, 6, + 3, 0, 7, 4, + 1, 2, 6, 4, + 4, 5, 6, 7 + }; + + result = 0; + + BOOL total_inside = TRUE; + for (U32 i = 0; i < 6; i++) + { + LLVector3 p = center + radius.scaledVec(dir[i]); + F32 d = -p*dir[i]; + + for (U32 j = 0; j < 6; j++) + { //for each quad + F32 dist = mAgentFrustum[quads[j*4+0]]*dir[i] + d; + if (dist > 0) + { //at least one frustum point is outside the AABB + total_inside = FALSE; + for (U32 k = 1; k < 4; k++) + { //for each other point on quad + if ( mAgentFrustum[quads[j*4+k]]*dir[i]+d <= 0.f) + { //quad is straddling some plane of AABB + return 1; + } + } + } + else + { + for (U32 k = 1; k < 4; k++) + { + if (mAgentFrustum[quads[j*4+k]]*dir[i]+d > 0.f) + { + return 1; + } + } + } + } } - - if (n * maxp > -d) + + if (total_inside) { result = 1; } } + else + { + for (U32 i = 0; i < mPlaneCount; i++) + { + mask = mAgentPlanes[i].mask; + LLPlane p = mAgentPlanes[i].p; + LLVector3 n = LLVector3(p); + float d = p.mV[3]; + LLVector3 rscale = radius.scaledVec(scaler[mask]); + + LLVector3 minp = center - rscale; + LLVector3 maxp = center + rscale; + + if (n * minp > -d) + { + return 0; + } + + if (n * maxp > -d) + { + result = 1; + } + } + } + return result; } diff --git a/linden/indra/llmath/llcamera.h b/linden/indra/llmath/llcamera.h index bb9ae55..23ee115 100644 --- a/linden/indra/llmath/llcamera.h +++ b/linden/indra/llmath/llcamera.h @@ -17,7 +17,8 @@ * 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 + * 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, @@ -42,17 +43,19 @@ const F32 DEFAULT_ASPECT_RATIO = 640.f / 480.f; const F32 DEFAULT_NEAR_PLANE = 0.25f; const F32 DEFAULT_FAR_PLANE = 64.f; // far reaches across two horizontal, not diagonal, regions -const F32 MAX_FIELD_OF_VIEW = F_PI; const F32 MAX_ASPECT_RATIO = 50.0f; const F32 MAX_NEAR_PLANE = 10.f; const F32 MAX_FAR_PLANE = 100000.0f; //1000000.0f; // Max allowed. Not good Z precision though. const F32 MAX_FAR_CLIP = 512.0f; -const F32 MIN_FIELD_OF_VIEW = 0.1f; const F32 MIN_ASPECT_RATIO = 0.02f; const F32 MIN_NEAR_PLANE = 0.1f; const F32 MIN_FAR_PLANE = 0.2f; +// Min/Max FOV values for square views. Call getMin/MaxView to get extremes based on current aspect ratio. +static const F32 MIN_FIELD_OF_VIEW = 5.0f * DEG_TO_RAD; +static const F32 MAX_FIELD_OF_VIEW = 175.f * DEG_TO_RAD; + static const LLVector3 X_AXIS(1.f,0.f,0.f); static const LLVector3 Y_AXIS(0.f,1.f,0.f); static const LLVector3 Z_AXIS(0.f,0.f,1.f); @@ -101,7 +104,7 @@ public: HORIZ_PLANE_ALL_MASK = 0x3 }; -protected: +private: F32 mView; // angle between top and bottom frustum planes in radians. F32 mAspect; // width/height S32 mViewHeightInPixels; // for ViewHeightInPixels() only @@ -117,12 +120,12 @@ protected: struct frustum_plane { - frustum_plane() : mask(0) {} + frustum_plane() : mask(0) {} LLPlane p; U8 mask; }; 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 LLVector3 mWorldPlanePos; // Position of World Planes (may be offset from camera) @@ -132,12 +135,13 @@ public: public: LLCamera(); - LLCamera(F32 z_field_of_view, F32 aspect_ratio, S32 view_height_in_pixels, F32 near_plane, F32 far_plane); + LLCamera(F32 vertical_fov_rads, F32 aspect_ratio, S32 view_height_in_pixels, F32 near_plane, F32 far_plane); + virtual ~LLCamera(){} // no-op virtual destructor void setUserClipPlane(LLPlane plane); void disableUserClipPlane(); U8 calcPlaneMask(const LLPlane& plane); - void setView(F32 new_view); + virtual void setView(F32 vertical_fov_rads); void setViewHeightInPixels(S32 height); void setAspect(F32 new_aspect); void setNear(F32 new_near); @@ -148,6 +152,11 @@ public: F32 getAspect() const { return mAspect; } // width / height F32 getNear() const { return mNearPlane; } // meters F32 getFar() const { return mFarPlane; } // meters + + // The values returned by the min/max view getters depend upon the aspect ratio + // at the time they are called and therefore should not be cached. + F32 getMinView() const; + F32 getMaxView() const; F32 getYaw() const { diff --git a/linden/indra/llmath/llcoord.h b/linden/indra/llmath/llcoord.h index dbe6678..9d46a8b 100644 --- a/linden/indra/llmath/llcoord.h +++ b/linden/indra/llmath/llcoord.h @@ -16,7 +16,8 @@ * 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 + * 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, diff --git a/linden/indra/llmath/llcoordframe.cpp b/linden/indra/llmath/llcoordframe.cpp index f1707c9..673a8f2 100644 --- a/linden/indra/llmath/llcoordframe.cpp +++ b/linden/indra/llmath/llcoordframe.cpp @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmath/llcoordframe.h b/linden/indra/llmath/llcoordframe.h index 0ce56bf..89b5d8b 100644 --- a/linden/indra/llmath/llcoordframe.h +++ b/linden/indra/llmath/llcoordframe.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmath/llinterp.h b/linden/indra/llmath/llinterp.h index 7438317..8beeef4 100644 --- a/linden/indra/llmath/llinterp.h +++ b/linden/indra/llmath/llinterp.h @@ -16,7 +16,8 @@ * 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 + * 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, diff --git a/linden/indra/llmath/llline.cpp b/linden/indra/llmath/llline.cpp index 147918c..b198573 100644 --- a/linden/indra/llmath/llline.cpp +++ b/linden/indra/llmath/llline.cpp @@ -3,16 +3,27 @@ * @author Andrew Meadows * @brief Simple line class that can compute nearest approach between two lines * - * $LicenseInfo:firstyear=2001&license=internal$ + * $LicenseInfo:firstyear=2006&license=viewergpl$ * - * Copyright (c) 2001-2009, Linden Research, Inc. + * Copyright (c) 2006-2009, 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. + * 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, diff --git a/linden/indra/llmath/llline.h b/linden/indra/llmath/llline.h index e7827d5..9ab41b1 100644 --- a/linden/indra/llmath/llline.h +++ b/linden/indra/llmath/llline.h @@ -4,16 +4,27 @@ * @author Andrew Meadows * @brief Simple line for computing nearest approach between two infinite lines * - * $LicenseInfo:firstyear=2006&license=internal$ + * $LicenseInfo:firstyear=2006&license=viewergpl$ * * Copyright (c) 2006-2009, 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. + * 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, diff --git a/linden/indra/llmath/llmath.h b/linden/indra/llmath/llmath.h index b2d4d26..66451b1 100644 --- a/linden/indra/llmath/llmath.h +++ b/linden/indra/llmath/llmath.h @@ -17,7 +17,8 @@ * 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 + * 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, @@ -37,6 +38,10 @@ #include "lldefs.h" #include "llstl.h" // *TODO: Remove when LLString is gone #include "llstring.h" // *TODO: Remove when LLString is gone +// lltut.h uses is_approx_equal_fraction(). This was moved to its own header +// file in llcommon so we can use lltut.h for llcommon tests without making +// llcommon depend on llmath. +#include "is_approx_equal_fraction.h" // work around for Windows & older gcc non-standard function names. #if LL_WINDOWS @@ -85,6 +90,8 @@ const F32 GRAVITY = -9.8f; const F32 F_PI = 3.1415926535897932384626433832795f; const F32 F_TWO_PI = 6.283185307179586476925286766559f; const F32 F_PI_BY_TWO = 1.5707963267948966192313216916398f; +const F32 F_SQRT_TWO_PI = 2.506628274631000502415765284811f; +const F32 F_E = 2.71828182845904523536f; const F32 F_SQRT2 = 1.4142135623730950488016887242097f; const F32 F_SQRT3 = 1.73205080756888288657986402541f; const F32 OO_SQRT2 = 0.7071067811865475244008443621049f; @@ -103,6 +110,30 @@ const F32 FP_MAG_THRESHOLD = 0.0000001f; // TODO: Replace with logic like is_approx_equal inline BOOL is_approx_zero( F32 f ) { return (-F_APPROXIMATELY_ZERO < f) && (f < F_APPROXIMATELY_ZERO); } +// These functions work by interpreting sign+exp+mantissa as an unsigned +// integer. +// For example: +// x = 1 00000010 00000000000000000000000 +// y = 1 00000001 11111111111111111111111 +// +// interpreted as ints = +// x = 10000001000000000000000000000000 +// y = 10000000111111111111111111111111 +// which is clearly a different of 1 in the least significant bit +// Values with the same exponent can be trivially shown to work. +// +// WARNING: Denormals of opposite sign do not work +// x = 1 00000000 00000000000000000000001 +// y = 0 00000000 00000000000000000000001 +// Although these values differ by 2 in the LSB, the sign bit makes +// the int comparison fail. +// +// WARNING: NaNs can compare equal +// There is no special treatment of exceptional values like NaNs +// +// WARNING: Infinity is comparable with F32_MAX and negative +// infinity is comparable with F32_MIN + inline BOOL is_approx_equal(F32 x, F32 y) { const S32 COMPARE_MANTISSA_UP_TO_BIT = 0x02; @@ -115,48 +146,6 @@ inline BOOL is_approx_equal(F64 x, F64 y) 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) -{ - BOOL ret = TRUE; - F32 diff = (F32) fabs(x - y); - - S32 diffInt = (S32) diff; - S32 diffFracTolerance = (S32) ((diff - (F32) diffInt) * (1 << frac_bits)); - - // if integer portion is not equal, not enough bits were used for packing - // so error out since either the use case is not correct OR there is - // an issue with pack/unpack. should fail in either case. - // for decimal portion, make sure that the delta is no more than 1 - // based on the number of bits used for packing decimal portion. - if (diffInt != 0 || diffFracTolerance > 1) - { - ret = FALSE; - } - - return ret; -} - -inline BOOL is_approx_equal_fraction(F64 x, F64 y, U32 frac_bits) -{ - BOOL ret = TRUE; - F64 diff = (F64) fabs(x - y); - - S32 diffInt = (S32) diff; - S32 diffFracTolerance = (S32) ((diff - (F64) diffInt) * (1 << frac_bits)); - - // if integer portion is not equal, not enough bits were used for packing - // so error out since either the use case is not correct OR there is - // an issue with pack/unpack. should fail in either case. - // for decimal portion, make sure that the delta is no more than 1 - // based on the number of bits used for packing decimal portion. - if (diffInt != 0 || diffFracTolerance > 1) - { - ret = FALSE; - } - - return ret; -} - inline S32 llabs(const S32 a) { return S32(std::labs(a)); @@ -523,4 +512,10 @@ inline U32 get_next_power_two(U32 val, U32 max_power_two) return val; } +//get the gaussian value given the linear distance from axis x and guassian value o +inline F32 llgaussian(F32 x, F32 o) +{ + return 1.f/(F_SQRT_TWO_PI*o)*powf(F_E, -(x*x)/(2*o*o)); +} + #endif diff --git a/linden/indra/llmath/llmodularmath.h b/linden/indra/llmath/llmodularmath.h index 67083ea..6009529 100644 --- a/linden/indra/llmath/llmodularmath.h +++ b/linden/indra/llmath/llmodularmath.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmath/lloctree.h b/linden/indra/llmath/lloctree.h index 3c94aa3..bced84c 100644 --- a/linden/indra/llmath/lloctree.h +++ b/linden/indra/llmath/lloctree.h @@ -17,7 +17,8 @@ * 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 + * 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, @@ -330,6 +331,16 @@ public: //push center in direction of data LLOctreeNode::pushCenter(center, size, data); + // handle case where floating point number gets too small + if( llabs(center.mdV[0] - getCenter().mdV[0]) < F_APPROXIMATELY_ZERO && + llabs(center.mdV[1] - getCenter().mdV[1]) < F_APPROXIMATELY_ZERO && + llabs(center.mdV[2] - getCenter().mdV[2]) < F_APPROXIMATELY_ZERO) + { + mData.insert(data); + BaseType::insert(data); + return true; + } + #if LL_OCTREE_PARANOIA_CHECK if (getChildCount() == 8) { diff --git a/linden/indra/llmath/llperlin.cpp b/linden/indra/llmath/llperlin.cpp index 2c3ed90..9293d97 100644 --- a/linden/indra/llmath/llperlin.cpp +++ b/linden/indra/llmath/llperlin.cpp @@ -16,7 +16,8 @@ * 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 + * 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, diff --git a/linden/indra/llmath/llperlin.h b/linden/indra/llmath/llperlin.h index d6cf823..e8815ec 100644 --- a/linden/indra/llmath/llperlin.h +++ b/linden/indra/llmath/llperlin.h @@ -16,7 +16,8 @@ * 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 + * 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, diff --git a/linden/indra/llmath/llplane.h b/linden/indra/llmath/llplane.h index 558cc37..89c6a14 100644 --- a/linden/indra/llmath/llplane.h +++ b/linden/indra/llmath/llplane.h @@ -16,7 +16,8 @@ * 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 + * 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, diff --git a/linden/indra/llmath/llquantize.h b/linden/indra/llmath/llquantize.h index 25be9c0..2192427 100644 --- a/linden/indra/llmath/llquantize.h +++ b/linden/indra/llmath/llquantize.h @@ -18,7 +18,8 @@ * 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 + * 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, diff --git a/linden/indra/llmath/llquaternion.cpp b/linden/indra/llmath/llquaternion.cpp index 485d0cd..cfd6183 100644 --- a/linden/indra/llmath/llquaternion.cpp +++ b/linden/indra/llmath/llquaternion.cpp @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmath/llquaternion.h b/linden/indra/llmath/llquaternion.h index 2289bc8..5db9c5b 100644 --- a/linden/indra/llmath/llquaternion.h +++ b/linden/indra/llmath/llquaternion.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmath/llrect.cpp b/linden/indra/llmath/llrect.cpp index 025d476..cba76dd 100644 --- a/linden/indra/llmath/llrect.cpp +++ b/linden/indra/llmath/llrect.cpp @@ -16,7 +16,8 @@ * 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 + * 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, diff --git a/linden/indra/llmath/llrect.h b/linden/indra/llmath/llrect.h index a9faa19..9eb58db 100644 --- a/linden/indra/llmath/llrect.h +++ b/linden/indra/llmath/llrect.h @@ -17,7 +17,8 @@ * 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 + * 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, @@ -223,6 +224,11 @@ public: return *this; } + bool isValid() const + { + return mLeft <= mRight && mBottom <= mTop; + } + bool isNull() const { return mLeft == mRight || mBottom == mTop; diff --git a/linden/indra/llmath/llsdutil_math.cpp b/linden/indra/llmath/llsdutil_math.cpp index c17c682..073cb2e 100644 --- a/linden/indra/llmath/llsdutil_math.cpp +++ b/linden/indra/llmath/llsdutil_math.cpp @@ -19,7 +19,8 @@ * 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 + * 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, diff --git a/linden/indra/llmath/llsphere.cpp b/linden/indra/llmath/llsphere.cpp index 2923ffe..b260c13 100644 --- a/linden/indra/llmath/llsphere.cpp +++ b/linden/indra/llmath/llsphere.cpp @@ -3,16 +3,27 @@ * @author Andrew Meadows * @brief Simple line class that can compute nearest approach between two lines * - * $LicenseInfo:firstyear=2006&license=internal$ + * $LicenseInfo:firstyear=2007&license=viewergpl$ * - * Copyright (c) 2006-2009, Linden Research, Inc. + * Copyright (c) 2007-2009, 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. + * 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, diff --git a/linden/indra/llmath/llsphere.h b/linden/indra/llmath/llsphere.h index 2f905e6..58df07a 100644 --- a/linden/indra/llmath/llsphere.h +++ b/linden/indra/llmath/llsphere.h @@ -4,16 +4,27 @@ * @author Andrew Meadows * @brief Simple sphere implementation for basic geometric operations * - * $LicenseInfo:firstyear=2001&license=internal$ + * $LicenseInfo:firstyear=2007&license=viewergpl$ * - * Copyright (c) 2001-2009, Linden Research, Inc. + * Copyright (c) 2007-2009, 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. + * 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, diff --git a/linden/indra/llmath/lltreenode.h b/linden/indra/llmath/lltreenode.h index 6f5e701..ee98362 100644 --- a/linden/indra/llmath/lltreenode.h +++ b/linden/indra/llmath/lltreenode.h @@ -16,7 +16,8 @@ * 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 + * 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, diff --git a/linden/indra/llmath/llv4math.h b/linden/indra/llmath/llv4math.h index 9c1737e..5b180b3 100644 --- a/linden/indra/llmath/llv4math.h +++ b/linden/indra/llmath/llv4math.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmath/llv4matrix3.h b/linden/indra/llmath/llv4matrix3.h index 619c966..ed503e9 100644 --- a/linden/indra/llmath/llv4matrix3.h +++ b/linden/indra/llmath/llv4matrix3.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmath/llv4matrix4.h b/linden/indra/llmath/llv4matrix4.h index 662d379..959fa34 100644 --- a/linden/indra/llmath/llv4matrix4.h +++ b/linden/indra/llmath/llv4matrix4.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmath/llv4vector3.h b/linden/indra/llmath/llv4vector3.h index e45ba50..a41de47 100644 --- a/linden/indra/llmath/llv4vector3.h +++ b/linden/indra/llmath/llv4vector3.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmath/llvolume.cpp b/linden/indra/llmath/llvolume.cpp index 5603a9c..1250f53 100644 --- a/linden/indra/llmath/llvolume.cpp +++ b/linden/indra/llmath/llvolume.cpp @@ -16,7 +16,8 @@ * 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 + * 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, @@ -1972,34 +1973,29 @@ inline LLVector3 sculpt_xy_to_vector(U32 x, U32 y, U16 sculpt_width, U16 sculpt_ } -F32 LLVolume::sculptGetSurfaceArea(U16 sculpt_width, U16 sculpt_height, S8 sculpt_components, const U8* sculpt_data) +F32 LLVolume::sculptGetSurfaceArea() { // test to see if image has enough variation to create non-degenerate geometry + F32 area = 0; + S32 sizeS = mPathp->mPath.size(); S32 sizeT = mProfilep->mProfile.size(); - - F32 area = 0; - - if ((sculpt_width != 0) && - (sculpt_height != 0) && - (sculpt_components != 0) && - (sculpt_data != NULL)) + + for (S32 s = 0; s < sizeS-1; s++) { - for (S32 s = 0; s < sizeS - 1; s++) + for (S32 t = 0; t < sizeT-1; t++) { - for (S32 t = 0; t < sizeT - 1; t++) - { - // convert image data to vectors - LLVector3 p1 = sculpt_st_to_vector(s, t, sizeS, sizeT, sculpt_width, sculpt_height, sculpt_components, sculpt_data); - LLVector3 p2 = sculpt_st_to_vector(s+1, t, sizeS, sizeT, sculpt_width, sculpt_height, sculpt_components, sculpt_data); - LLVector3 p3 = sculpt_st_to_vector(s, t+1, sizeS, sizeT, sculpt_width, sculpt_height, sculpt_components, sculpt_data); - - // compute the area of the parallelogram by taking the length of the cross product: - // (parallegram is an approximation of two triangles) - LLVector3 cross = (p1 - p2) % (p1 - p3); - area += cross.magVec(); - } + // get four corners of quad + LLVector3 p1 = mMesh[(s )*sizeT + (t )].mPos; + LLVector3 p2 = mMesh[(s+1)*sizeT + (t )].mPos; + LLVector3 p3 = mMesh[(s )*sizeT + (t+1)].mPos; + LLVector3 p4 = mMesh[(s+1)*sizeT + (t+1)].mPos; + + // compute the area of the quad by taking the length of the cross product of the two triangles + LLVector3 cross1 = (p1 - p2) % (p1 - p3); + LLVector3 cross2 = (p4 - p2) % (p4 - p3); + area += (cross1.magVec() + cross2.magVec()) / 2.0; } } @@ -2163,7 +2159,21 @@ S32 sculpt_sides(F32 detail) // 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); + // this code has the following properties: + // 1) the aspect ratio of the mesh is as close as possible to the ratio of the map + // while still using all available verts + // 2) the mesh cannot have more verts than is allowed by LOD + // 3) the mesh cannot have more verts than is allowed by the map + + S32 max_vertices_lod = (S32)pow((double)sculpt_sides(detail), 2.0); + S32 max_vertices_map = width * height / 4; + + S32 vertices; + if (max_vertices_map > 0) + vertices = llmin(max_vertices_lod, max_vertices_map); + else + vertices = max_vertices_lod; + F32 ratio; if ((width == 0) || (height == 0)) @@ -2172,13 +2182,13 @@ void sculpt_calc_mesh_resolution(U16 width, U16 height, U8 type, F32 detail, S32 ratio = (F32) width / (F32) height; - s = (S32)(vertices / fsqrtf(ratio)); + s = (S32)fsqrtf(((F32)vertices / ratio)); - s = llmax(s, 3); // no degenerate sizes, please - t = vertices * vertices / s; + s = llmax(s, 4); // no degenerate sizes, please + t = vertices / s; - t = llmax(t, 3); // no degenerate sizes, please - s = vertices * vertices / t; + t = llmax(t, 4); // no degenerate sizes, please + s = vertices / t; } // sculpt replaces generate() for sculpted surfaces @@ -2215,20 +2225,25 @@ void LLVolume::sculpt(U16 sculpt_width, U16 sculpt_height, S8 sculpt_components, sNumMeshPoints -= mMesh.size(); mMesh.resize(sizeS * sizeT); sNumMeshPoints += mMesh.size(); - - if (!data_is_empty && sculptGetSurfaceArea(sculpt_width, sculpt_height, sculpt_components, sculpt_data) < SCULPT_MIN_AREA) - data_is_empty = TRUE; //generate vertex positions - if (data_is_empty) // if empty, make a placeholder mesh - { - sculptGeneratePlaceholder(); - } - else + if (!data_is_empty) { sculptGenerateMapVertices(sculpt_width, sculpt_height, sculpt_components, sculpt_data, sculpt_type); + + if (sculptGetSurfaceArea() < SCULPT_MIN_AREA) + { + data_is_empty = TRUE; + } } + if (data_is_empty) + { + sculptGeneratePlaceholder(); + } + + + for (S32 i = 0; i < (S32)mProfilep->mFaces.size(); i++) { mFaceMask |= mProfilep->mFaces[i].mFaceID; diff --git a/linden/indra/llmath/llvolume.h b/linden/indra/llmath/llvolume.h index 48c48e4..e55fe52 100644 --- a/linden/indra/llmath/llvolume.h +++ b/linden/indra/llmath/llvolume.h @@ -17,7 +17,8 @@ * 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 + * 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, @@ -942,8 +943,8 @@ public: void sculpt(U16 sculpt_width, U16 sculpt_height, S8 sculpt_components, const U8* sculpt_data, S32 sculpt_level); 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); + F32 sculptGetSurfaceArea(); void sculptGeneratePlaceholder(); void sculptCalcMeshResolution(U16 width, U16 height, U8 type, S32& s, S32& t); diff --git a/linden/indra/llmath/llvolumemgr.cpp b/linden/indra/llmath/llvolumemgr.cpp index edd7513..53641fc 100644 --- a/linden/indra/llmath/llvolumemgr.cpp +++ b/linden/indra/llmath/llvolumemgr.cpp @@ -16,7 +16,8 @@ * 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 + * 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, diff --git a/linden/indra/llmath/llvolumemgr.h b/linden/indra/llmath/llvolumemgr.h index 0348373..e10ad94 100644 --- a/linden/indra/llmath/llvolumemgr.h +++ b/linden/indra/llmath/llvolumemgr.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmath/m3math.cpp b/linden/indra/llmath/m3math.cpp index 578a4c6..1b878c8 100644 --- a/linden/indra/llmath/m3math.cpp +++ b/linden/indra/llmath/m3math.cpp @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmath/m3math.h b/linden/indra/llmath/m3math.h index 76ee1ea..3ac963e 100644 --- a/linden/indra/llmath/m3math.h +++ b/linden/indra/llmath/m3math.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmath/m4math.cpp b/linden/indra/llmath/m4math.cpp index dc6b0b5..59a0bc2 100644 --- a/linden/indra/llmath/m4math.cpp +++ b/linden/indra/llmath/m4math.cpp @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmath/m4math.h b/linden/indra/llmath/m4math.h index 1d30489..58c9c09 100644 --- a/linden/indra/llmath/m4math.h +++ b/linden/indra/llmath/m4math.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmath/raytrace.cpp b/linden/indra/llmath/raytrace.cpp index 0116502..a5eb0d2 100644 --- a/linden/indra/llmath/raytrace.cpp +++ b/linden/indra/llmath/raytrace.cpp @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmath/raytrace.h b/linden/indra/llmath/raytrace.h index 757181f..b433e17 100644 --- a/linden/indra/llmath/raytrace.h +++ b/linden/indra/llmath/raytrace.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmath/v2math.cpp b/linden/indra/llmath/v2math.cpp index ee60143..555e1f9 100644 --- a/linden/indra/llmath/v2math.cpp +++ b/linden/indra/llmath/v2math.cpp @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmath/v2math.h b/linden/indra/llmath/v2math.h index 6016c04..9fef885 100644 --- a/linden/indra/llmath/v2math.h +++ b/linden/indra/llmath/v2math.h @@ -17,7 +17,8 @@ * 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 + * 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, @@ -115,8 +116,8 @@ class LLVector2 F32 angle_between(const LLVector2 &a, const LLVector2 &b); // Returns angle (radians) between a and b BOOL are_parallel(const LLVector2 &a, const LLVector2 &b, F32 epsilon=F_APPROXIMATELY_ZERO); // Returns TRUE if a and b are very close to parallel F32 dist_vec(const LLVector2 &a, const LLVector2 &b); // Returns distance between a and b -F32 dist_vec_squared(const LLVector2 &a, const LLVector2 &b);// Returns distance sqaured between a and b -F32 dist_vec_squared2D(const LLVector2 &a, const LLVector2 &b);// Returns distance sqaured between a and b ignoring Z component +F32 dist_vec_squared(const LLVector2 &a, const LLVector2 &b);// Returns distance squared between a and b +F32 dist_vec_squared2D(const LLVector2 &a, const LLVector2 &b);// Returns distance squared between a and b ignoring Z component LLVector2 lerp(const LLVector2 &a, const LLVector2 &b, F32 u); // Returns a vector that is a linear interpolation between a and b // Constructors diff --git a/linden/indra/llmath/v3color.cpp b/linden/indra/llmath/v3color.cpp index b55b883..fa7b61c 100644 --- a/linden/indra/llmath/v3color.cpp +++ b/linden/indra/llmath/v3color.cpp @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmath/v3color.h b/linden/indra/llmath/v3color.h index d530187..179687a 100644 --- a/linden/indra/llmath/v3color.h +++ b/linden/indra/llmath/v3color.h @@ -17,7 +17,8 @@ * 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 + * 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, @@ -56,7 +57,7 @@ public: LLColor3(); // Initializes LLColor3 to (0, 0, 0) LLColor3(F32 r, F32 g, F32 b); // Initializes LLColor3 to (r, g, b) LLColor3(const F32 *vec); // Initializes LLColor3 to (vec[0]. vec[1], vec[2]) - LLColor3(char *color_string); // html format color ie "#FFDDEE" + LLColor3(const char *color_string); // html format color ie "#FFDDEE" explicit LLColor3(const LLColor4& color4); // "explicit" to avoid automatic conversion explicit LLColor3(const LLVector4& vector4); // "explicit" to avoid automatic conversion LLColor3(const LLSD& sd); @@ -160,7 +161,7 @@ void LLColor3::clamp() // Non-member functions F32 distVec(const LLColor3 &a, const LLColor3 &b); // Returns distance between a and b -F32 distVec_squared(const LLColor3 &a, const LLColor3 &b);// Returns distance sqaured between a and b +F32 distVec_squared(const LLColor3 &a, const LLColor3 &b);// Returns distance squared between a and b inline LLColor3::LLColor3(void) { @@ -188,7 +189,7 @@ inline LLColor3::LLColor3(const F32 *vec) # 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 +inline LLColor3::LLColor3(const char* color_string) // takes a string of format "RRGGBB" where RR is hex 00..FF { if (strlen(color_string) < 6) /* Flawfinder: ignore */ { @@ -198,7 +199,7 @@ inline LLColor3::LLColor3(char* color_string) // takes a string of format "RRGGB return; } - static char tempstr[7]; /* Flawfinder: ignore */ + char tempstr[7]; strncpy(tempstr,color_string,6); /* Flawfinder: ignore */ tempstr[6] = '\0'; mV[VZ] = (F32)strtol(&tempstr[4],NULL,16)/255.f; diff --git a/linden/indra/llmath/v3dmath.cpp b/linden/indra/llmath/v3dmath.cpp index bd42830..2bcbf63 100644 --- a/linden/indra/llmath/v3dmath.cpp +++ b/linden/indra/llmath/v3dmath.cpp @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmath/v3dmath.h b/linden/indra/llmath/v3dmath.h index 078fde8..a99bf5b 100644 --- a/linden/indra/llmath/v3dmath.h +++ b/linden/indra/llmath/v3dmath.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmath/v3math.cpp b/linden/indra/llmath/v3math.cpp index b97b410..d403179 100644 --- a/linden/indra/llmath/v3math.cpp +++ b/linden/indra/llmath/v3math.cpp @@ -17,7 +17,8 @@ * 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 + * 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, @@ -133,6 +134,7 @@ BOOL LLVector3::clampLength( F32 length_limit ) mV[0] *= length_limit; mV[1] *= length_limit; mV[2] *= length_limit; + changed = TRUE; } } diff --git a/linden/indra/llmath/v3math.h b/linden/indra/llmath/v3math.h index 4935443..7f96800 100644 --- a/linden/indra/llmath/v3math.h +++ b/linden/indra/llmath/v3math.h @@ -17,7 +17,8 @@ * 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 + * 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, @@ -160,8 +161,8 @@ typedef LLVector3 LLSimLocalVec; F32 angle_between(const LLVector3 &a, const LLVector3 &b); // Returns angle (radians) between a and b BOOL are_parallel(const LLVector3 &a, const LLVector3 &b, F32 epsilon=F_APPROXIMATELY_ZERO); // Returns TRUE if a and b are very close to parallel F32 dist_vec(const LLVector3 &a, const LLVector3 &b); // Returns distance between a and b -F32 dist_vec_squared(const LLVector3 &a, const LLVector3 &b);// Returns distance sqaured between a and b -F32 dist_vec_squared2D(const LLVector3 &a, const LLVector3 &b);// Returns distance sqaured between a and b ignoring Z component +F32 dist_vec_squared(const LLVector3 &a, const LLVector3 &b);// Returns distance squared between a and b +F32 dist_vec_squared2D(const LLVector3 &a, const LLVector3 &b);// Returns distance squared between a and b ignoring Z component LLVector3 projected_vec(const LLVector3 &a, const LLVector3 &b); // Returns vector a projected on vector b LLVector3 lerp(const LLVector3 &a, const LLVector3 &b, F32 u); // Returns a vector that is a linear interpolation between a and b diff --git a/linden/indra/llmath/v4color.cpp b/linden/indra/llmath/v4color.cpp index 32cfd5e..0cbfce0 100644 --- a/linden/indra/llmath/v4color.cpp +++ b/linden/indra/llmath/v4color.cpp @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmath/v4color.h b/linden/indra/llmath/v4color.h index 57055c5..785b47d 100644 --- a/linden/indra/llmath/v4color.h +++ b/linden/indra/llmath/v4color.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmath/v4coloru.cpp b/linden/indra/llmath/v4coloru.cpp index b127a53..061b497 100644 --- a/linden/indra/llmath/v4coloru.cpp +++ b/linden/indra/llmath/v4coloru.cpp @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmath/v4coloru.h b/linden/indra/llmath/v4coloru.h index f3f1c57..082d0ef 100644 --- a/linden/indra/llmath/v4coloru.h +++ b/linden/indra/llmath/v4coloru.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmath/v4math.cpp b/linden/indra/llmath/v4math.cpp index a183c78..b938480 100644 --- a/linden/indra/llmath/v4math.cpp +++ b/linden/indra/llmath/v4math.cpp @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmath/v4math.h b/linden/indra/llmath/v4math.h index 6234b17..4c82e6b 100644 --- a/linden/indra/llmath/v4math.h +++ b/linden/indra/llmath/v4math.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmath/xform.cpp b/linden/indra/llmath/xform.cpp index 9917880..ce6f756 100644 --- a/linden/indra/llmath/xform.cpp +++ b/linden/indra/llmath/xform.cpp @@ -16,7 +16,8 @@ * 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 + * 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, diff --git a/linden/indra/llmath/xform.h b/linden/indra/llmath/xform.h index 6f880cb..d3be28f 100644 --- a/linden/indra/llmath/xform.h +++ b/linden/indra/llmath/xform.h @@ -16,7 +16,8 @@ * 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 + * 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, diff --git a/linden/indra/llmedia/llmediabase.h b/linden/indra/llmedia/llmediabase.h index 7f7f06f..68e6677 100644 --- a/linden/indra/llmedia/llmediabase.h +++ b/linden/indra/llmedia/llmediabase.h @@ -19,7 +19,8 @@ * 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 + * 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, diff --git a/linden/indra/llmedia/llmediaemitter.h b/linden/indra/llmedia/llmediaemitter.h index a5e0554..ef3caeb 100644 --- a/linden/indra/llmedia/llmediaemitter.h +++ b/linden/indra/llmedia/llmediaemitter.h @@ -19,7 +19,8 @@ * 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 + * 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, diff --git a/linden/indra/llmedia/llmediaimplcommon.cpp b/linden/indra/llmedia/llmediaimplcommon.cpp index b206618..87838f7 100644 --- a/linden/indra/llmedia/llmediaimplcommon.cpp +++ b/linden/indra/llmedia/llmediaimplcommon.cpp @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmedia/llmediaimplcommon.h b/linden/indra/llmedia/llmediaimplcommon.h index 4985cba..2e60a1a 100644 --- a/linden/indra/llmedia/llmediaimplcommon.h +++ b/linden/indra/llmedia/llmediaimplcommon.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmedia/llmediaimplexample1.cpp b/linden/indra/llmedia/llmediaimplexample1.cpp index 910bbf7..fe7b7e2 100644 --- a/linden/indra/llmedia/llmediaimplexample1.cpp +++ b/linden/indra/llmedia/llmediaimplexample1.cpp @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmedia/llmediaimplexample1.h b/linden/indra/llmedia/llmediaimplexample1.h index 19b8ed6..1b90e93 100644 --- a/linden/indra/llmedia/llmediaimplexample1.h +++ b/linden/indra/llmedia/llmediaimplexample1.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmedia/llmediaimplexample2.cpp b/linden/indra/llmedia/llmediaimplexample2.cpp index 7bda982..7590e19 100644 --- a/linden/indra/llmedia/llmediaimplexample2.cpp +++ b/linden/indra/llmedia/llmediaimplexample2.cpp @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmedia/llmediaimplexample2.h b/linden/indra/llmedia/llmediaimplexample2.h index ad76088..6a4f80b 100644 --- a/linden/indra/llmedia/llmediaimplexample2.h +++ b/linden/indra/llmedia/llmediaimplexample2.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmedia/llmediaimplfactory.cpp b/linden/indra/llmedia/llmediaimplfactory.cpp index 6f8787e..c5d098f 100644 --- a/linden/indra/llmedia/llmediaimplfactory.cpp +++ b/linden/indra/llmedia/llmediaimplfactory.cpp @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmedia/llmediaimplfactory.h b/linden/indra/llmedia/llmediaimplfactory.h index 663efd8..93a7cc1 100644 --- a/linden/indra/llmedia/llmediaimplfactory.h +++ b/linden/indra/llmedia/llmediaimplfactory.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmedia/llmediaimplgstreamer.cpp b/linden/indra/llmedia/llmediaimplgstreamer.cpp index 51614c5..a4fe930 100644 --- a/linden/indra/llmedia/llmediaimplgstreamer.cpp +++ b/linden/indra/llmedia/llmediaimplgstreamer.cpp @@ -18,7 +18,8 @@ * 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 + * 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, @@ -43,10 +44,6 @@ extern "C" { #include "llmediaimplgstreamervidplug.h" -#ifdef LL_GST_SOUNDSINK -#include "llmediaimplgstreamersndplug.h" -#endif // LL_GST_SOUNDSINK - #include "llmediaimplgstreamer_syms.h" // register this impl with media manager factory @@ -67,6 +64,7 @@ LLMediaImplGStreamerMaker::LLMediaImplGStreamerMaker() // LLMediaImplGStreamer:: LLMediaImplGStreamer () : + mBusWatchID ( 0 ), mediaData ( NULL ), mMediaRowbytes ( 1 ), mTextureFormatPrimary ( LL_MEDIA_BGRA ), @@ -74,10 +72,10 @@ LLMediaImplGStreamer () : mPump ( NULL ), mPlaybin ( NULL ), mVideoSink ( NULL ) -#ifdef LL_GST_SOUNDSINK - ,mAudioSink ( NULL ) -#endif // LL_GST_SOUNDSINK { + if (!mDoneInit) + return; // error + DEBUGMSG("constructing media..."); mVolume = 0.1234567; // minor hack to force an initial volume update @@ -95,10 +93,20 @@ LLMediaImplGStreamer () : mPlaybin = llgst_element_factory_make ("playbin", "play"); if (!mPlaybin) { - // todo: cleanup pump return; // error } + // get playbin's bus + GstBus *bus = llgst_pipeline_get_bus (GST_PIPELINE (mPlaybin)); + if (!bus) + { + return; // error + } + mBusWatchID = llgst_bus_add_watch (bus, + llmediaimplgstreamer_bus_callback, + this); + llgst_object_unref (bus); + if (NULL == getenv("LL_GSTREAMER_EXTERNAL")) { // instantiate and connect a custom video sink mVideoSink = @@ -111,20 +119,6 @@ LLMediaImplGStreamer () : } g_object_set(mPlaybin, "video-sink", mVideoSink, NULL); - -#ifdef LL_GST_SOUNDSINK - // instantiate and connect a custom audio sink - mAudioSink = - GST_SLSOUND(llgst_element_factory_make ("private-slsound", "slsound")); - if (!mAudioSink) - { - WARNMSG("Could not instantiate private-slsound element."); - // todo: cleanup. - return; // error - } - - g_object_set(mPlaybin, "audio-sink", mAudioSink, NULL); -#endif } } @@ -166,48 +160,96 @@ std::string LLMediaImplGStreamer::getVersion() /////////////////////////////////////////////////////////////////////////////// // (static) super-initialization - called once at application startup + +//static +bool LLMediaImplGStreamer::mDoneInit = false; + +//static bool LLMediaImplGStreamer:: startup ( LLMediaManagerData* init_data ) { - static bool done_init = false; - if (!done_init) + // first - check if GStreamer is explicitly disabled + if (NULL != getenv("LL_DISABLE_GSTREAMER")) + return false; + + // only do global GStreamer initialization once. + if (!mDoneInit) { // Init the glib type system - we need it. g_type_init(); // Get symbols! if (! grab_gst_syms("libgstreamer-0.10.so.0", - "libgstvideo-0.10.so.0", - "libgstaudio-0.10.so.0") ) + "libgstvideo-0.10.so.0") ) { WARNMSG("Couldn't find suitable GStreamer 0.10 support on this system - video playback disabled."); return false; } if (llgst_segtrap_set_enabled) + { llgst_segtrap_set_enabled(FALSE); + } else + { WARNMSG("gst_segtrap_set_enabled() is not available; Automated crash-reporter may cease to function until next restart."); + } + +#if LL_LINUX + // Gstreamer tries a fork during init, waitpid-ing on it, + // which conflicts with any installed SIGCHLD handler... + struct sigaction tmpact, oldact; + if (llgst_registry_fork_set_enabled) { + // if we can disable SIGCHLD-using forking behaviour, + // do it. + llgst_registry_fork_set_enabled(false); + } + else { + // else temporarily install default SIGCHLD handler + // while GStreamer initialises + tmpact.sa_handler = SIG_DFL; + sigemptyset( &tmpact.sa_mask ); + tmpact.sa_flags = SA_SIGINFO; + sigaction(SIGCHLD, &tmpact, &oldact); + } +#endif // LL_LINUX // Protect against GStreamer resetting the locale, yuck. static std::string saved_locale; saved_locale = setlocale(LC_ALL, NULL); - if (0 == llgst_init_check(NULL, NULL, NULL)) + + // finally, try to initialize GStreamer! + GError *err = NULL; + gboolean init_gst_success = llgst_init_check(NULL, NULL, &err); + + // restore old locale + setlocale(LC_ALL, saved_locale.c_str() ); + +#if LL_LINUX + // restore old SIGCHLD handler + if (!llgst_registry_fork_set_enabled) + sigaction(SIGCHLD, &oldact, NULL); +#endif // LL_LINUX + + if (!init_gst_success) // fail { - WARNMSG("GST init failed for unspecified reason."); - setlocale(LC_ALL, saved_locale.c_str() ); + if (err) + { + WARNMSG("GST init failed: %s", err->message); + g_error_free(err); + } + else + { + WARNMSG("GST init failed for unspecified reason."); + } return false; } - setlocale(LC_ALL, saved_locale.c_str() ); // Init our custom plugins - only really need do this once. gst_slvideo_init_class(); -#if 0 - gst_slsound_init_class(); -#endif - done_init = true; + mDoneInit = true; } return true; @@ -217,6 +259,9 @@ startup ( LLMediaManagerData* init_data ) bool LLMediaImplGStreamer:: closedown() { + if (!mDoneInit) + return false; // error + ungrab_gst_syms(); return true; @@ -240,12 +285,15 @@ static char* get_gst_state_name(GstState state) } #endif // LL_GST_REPORT_STATE_CHANGES -//static +extern "C" { gboolean -LLMediaImplGStreamer::bus_callback (GstBus *bus, - GstMessage *message, - gpointer data) +llmediaimplgstreamer_bus_callback (GstBus *bus, + GstMessage *message, + gpointer data) { + if (!message) + return TRUE; // shield against GStreamer bug + if (GST_MESSAGE_TYPE(message) != GST_MESSAGE_STATE_CHANGED && GST_MESSAGE_TYPE(message) != GST_MESSAGE_BUFFERING) { @@ -352,10 +400,35 @@ LLMediaImplGStreamer::bus_callback (GstBus *bus, if (impl->isLooping()) { DEBUGMSG("looping media..."); - impl->stop(); - impl->play(); + double eos_pos_sec = 0.0F; + bool got_eos_position = impl->getTimePos(eos_pos_sec); + + if (got_eos_position && eos_pos_sec < impl->MIN_LOOP_SEC) + { + // if we know that the movie is really short, don't + // loop it else it can easily become a time-hog + // because of GStreamer spin-up overhead + DEBUGMSG("really short movie (%0.3fsec) - not gonna loop this, pausing instead.", eos_pos_sec); + // inject a COMMAND_PAUSE + impl->addCommand(LLMediaBase::COMMAND_PAUSE); + } + else + { + // first try looping by an explicit rewind + bool seeksuccess = impl->seek(0.0); + if (seeksuccess) + { + impl->play(); + } + else // use clumsy stop-start to loop + { + DEBUGMSG("couldn't loop by rewinding - stopping and starting instead..."); + impl->stop(); + impl->play(); + } + } } - else + else // not a looping media { // inject a COMMAND_STOP impl->addCommand(LLMediaBase::COMMAND_STOP); @@ -372,6 +445,7 @@ LLMediaImplGStreamer::bus_callback (GstBus *bus, */ return TRUE; } +} // extern "C" /////////////////////////////////////////////////////////// // virtual @@ -379,15 +453,15 @@ bool LLMediaImplGStreamer:: navigateTo ( const std::string urlIn ) { + if (!mDoneInit) + return false; // error + DEBUGMSG("Setting media URI: %s", urlIn.c_str()); - if (NULL == mPump -#ifdef LL_GST_SOUNDSINK - || NULL == mAudioSink -#endif - || NULL == mPlaybin) + if (NULL == mPump || + NULL == mPlaybin) { - return false; + return false; // error } setStatus( LLMediaBase::STATUS_NAVIGATING ); @@ -396,15 +470,6 @@ navigateTo ( const std::string urlIn ) g_object_set (G_OBJECT (mPlaybin), "uri", urlIn.c_str(), NULL); //g_object_set (G_OBJECT (mPlaybin), "uri", "file:///tmp/movie", NULL); - // get playbin's bus - perhaps this can/should be done in ctor - GstBus *bus = llgst_pipeline_get_bus (GST_PIPELINE (mPlaybin)); - if (!bus) - { - return false; - } - llgst_bus_add_watch (bus, bus_callback, this); - llgst_object_unref (bus); - // navigateTo implicitly plays, too. play(); @@ -417,7 +482,14 @@ bool LLMediaImplGStreamer:: unload () { + if (!mDoneInit) + return false; // error + DEBUGMSG("unloading media..."); + + // stop getting callbacks for this bus + g_source_remove(mBusWatchID); + if (mPlaybin) { llgst_element_set_state (mPlaybin, GST_STATE_NULL); @@ -433,7 +505,7 @@ unload () if (mediaData) { - delete mediaData; + delete [] mediaData; mediaData = NULL; } @@ -448,14 +520,14 @@ bool LLMediaImplGStreamer:: updateMedia () { + if (!mDoneInit) + return false; // error + DEBUGMSG("updating media..."); // sanity check - if (NULL == mPump -#ifdef LL_GST_SOUNDSINK - || NULL == mAudioSink -#endif - || NULL == mPlaybin) + if (NULL == mPump || + NULL == mPlaybin) { DEBUGMSG("dead media..."); return false; @@ -517,7 +589,7 @@ updateMedia () mVideoSink->retained_frame_height != getMediaHeight()) // *TODO: also check for change in format { - // just resize containe + // just resize container int neww = mVideoSink->retained_frame_width; int newh = mVideoSink->retained_frame_height; int newd = SLVPixelFormatBytes[mVideoSink->retained_frame_format]; @@ -621,12 +693,12 @@ LLMediaImplGStreamer:: seek( double time ) { bool success = false; - if (mPlaybin) + if (mDoneInit && 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_SET, gint64(time*GST_SECOND), GST_SEEK_TYPE_NONE, GST_CLOCK_TIME_NONE); } DEBUGMSG("MEDIA SEEK REQUEST to %fsec result was %d", @@ -634,6 +706,49 @@ seek( double time ) return success; } +bool +LLMediaImplGStreamer:: +getTimePos(double &sec_out) +{ + bool got_position = false; + if (mPlaybin) + { + gint64 pos; + GstFormat timefmt = GST_FORMAT_TIME; + got_position = + llgst_element_query_position && + llgst_element_query_position(mPlaybin, + &timefmt, + &pos); + got_position = got_position + && (timefmt == GST_FORMAT_TIME); + // GStreamer may have other ideas, but we consider the current position + // undefined if not PLAYING or PAUSED + got_position = got_position && + (GST_STATE(mPlaybin) == GST_STATE_PLAYING || + GST_STATE(mPlaybin) == GST_STATE_PAUSED); + if (got_position && !GST_CLOCK_TIME_IS_VALID(pos)) + { + if (GST_STATE(mPlaybin) == GST_STATE_PLAYING) + { + // if we're playing then we treat an invalid clock time + // as 0, for complicated reasons (insert reason here) + pos = 0; + } + else + { + got_position = false; + } + + } + // If all the preconditions succeeded... we can trust the result. + if (got_position) + { + sec_out = double(pos) / double(GST_SECOND); // gst to sec + } + } + return got_position; +} /////////////////////////////////////////////////////////////////////////////// // virtual @@ -648,7 +763,7 @@ setVolume(float volume) return true; // nothing to do, everything's fine mVolume = volume; - if (mPlaybin) + if (mDoneInit && mPlaybin) { g_object_set(mPlaybin, "volume", mVolume, NULL); return true; diff --git a/linden/indra/llmedia/llmediaimplgstreamer.h b/linden/indra/llmedia/llmediaimplgstreamer.h index f1ffd3a..07b698d 100644 --- a/linden/indra/llmedia/llmediaimplgstreamer.h +++ b/linden/indra/llmedia/llmediaimplgstreamer.h @@ -18,7 +18,8 @@ * 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 + * 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, @@ -48,9 +49,6 @@ extern "C" { } #include "llmediaimplgstreamervidplug.h" -#ifdef LL_GST_SOUNDSINK -#include "llmediaimplgstreamersndplug.h" -#endif // LL_GST_SOUNDSINK class LLMediaManagerData; class LLMediaImplMaker; @@ -81,30 +79,38 @@ class LLMediaImplGStreamer: 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); + bool getTimePos(double &sec_out); + static const double MIN_LOOP_SEC = 1.0F; + + private: + bool unload(); + + static bool mDoneInit; + + guint mBusWatchID; + unsigned char* mediaData; int mMediaRowbytes; int mTextureFormatPrimary; int mTextureFormatType; - // GStreamer-specific + // Very GStreamer-specific GMainLoop *mPump; // event pump for this media GstElement *mPlaybin; GstSLVideo *mVideoSink; -#ifdef LL_GST_SOUNDSINK - GstSLSound *mAudioSink; -#endif // LL_GST_SOUNDSINK }; +extern "C" { +gboolean llmediaimplgstreamer_bus_callback (GstBus *bus, + GstMessage *message, + gpointer data); +} + class LLMediaImplGStreamerMaker : public LLMediaImplMaker { public: diff --git a/linden/indra/llmedia/llmediaimplgstreamer_syms.cpp b/linden/indra/llmedia/llmediaimplgstreamer_syms.cpp index 20ee00b..db26dda 100644 --- a/linden/indra/llmedia/llmediaimplgstreamer_syms.cpp +++ b/linden/indra/llmedia/llmediaimplgstreamer_syms.cpp @@ -17,7 +17,8 @@ * 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 + * 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, @@ -42,21 +43,28 @@ extern "C" { #define LL_GST_SYM(REQ, GSTSYM, RTN, ...) RTN (*ll##GSTSYM)(__VA_ARGS__) = NULL #include "llmediaimplgstreamer_syms_raw.inc" -#include "llmediaimplgstreamer_syms_rawa.inc" #include "llmediaimplgstreamer_syms_rawv.inc" #undef LL_GST_SYM +// a couple of stubs for disgusting reasons +GstDebugCategory* +ll_gst_debug_category_new(gchar *name, guint color, gchar *description) +{ + static GstDebugCategory dummy; + return &dummy; +} +void ll_gst_debug_register_funcptr(GstDebugFuncPtr func, gchar* ptrname) +{ +} static bool sSymsGrabbed = false; static apr_pool_t *sSymGSTDSOMemoryPool = NULL; static apr_dso_handle_t *sSymGSTDSOHandleG = NULL; static apr_dso_handle_t *sSymGSTDSOHandleV = NULL; -static apr_dso_handle_t *sSymGSTDSOHandleA = NULL; bool grab_gst_syms(std::string gst_dso_name, - std::string gst_dso_name_vid, - std::string gst_dso_name_aud) + std::string gst_dso_name_vid) { if (sSymsGrabbed) { @@ -87,40 +95,20 @@ bool grab_gst_syms(std::string gst_dso_name, sSymGSTDSOHandle = NULL; } - if ( APR_SUCCESS == (rv = apr_dso_load(&sSymGSTDSOHandle, - gst_dso_name_aud.c_str(), - sSymGSTDSOMemoryPool) )) + if ( APR_SUCCESS == + (rv = apr_dso_load(&sSymGSTDSOHandle, + gst_dso_name_vid.c_str(), + sSymGSTDSOMemoryPool) )) { - INFOMSG("Found DSO: %s", gst_dso_name_aud.c_str()); -#include "llmediaimplgstreamer_syms_rawa.inc" - - if ( sSymGSTDSOHandle ) - { - sSymGSTDSOHandleA = sSymGSTDSOHandle; - sSymGSTDSOHandle = NULL; - } - - if ( APR_SUCCESS == - (rv = apr_dso_load(&sSymGSTDSOHandle, - gst_dso_name_vid.c_str(), - sSymGSTDSOMemoryPool) )) - { - INFOMSG("Found DSO: %s", gst_dso_name_vid.c_str()); + INFOMSG("Found DSO: %s", gst_dso_name_vid.c_str()); #include "llmediaimplgstreamer_syms_rawv.inc" - } - else - { - INFOMSG("Couldn't load DSO: %s", gst_dso_name_vid.c_str()); - rtn = false; // failure - } + rtn = !sym_error; } else { - INFOMSG("Couldn't load DSO: %s", gst_dso_name_aud.c_str()); + INFOMSG("Couldn't load DSO: %s", gst_dso_name_vid.c_str()); rtn = false; // failure } - - rtn = !sym_error; } else { @@ -156,12 +144,6 @@ void ungrab_gst_syms() sSymGSTDSOHandleG = NULL; } - if ( sSymGSTDSOHandleA ) - { - apr_dso_unload(sSymGSTDSOHandleA); - sSymGSTDSOHandleA = NULL; - } - if ( sSymGSTDSOHandleV ) { apr_dso_unload(sSymGSTDSOHandleV); @@ -177,7 +159,6 @@ void ungrab_gst_syms() // NULL-out all of the symbols we'd grabbed #define LL_GST_SYM(REQ, GSTSYM, RTN, ...) do{ll##GSTSYM = NULL;}while(0) #include "llmediaimplgstreamer_syms_raw.inc" -#include "llmediaimplgstreamer_syms_rawa.inc" #include "llmediaimplgstreamer_syms_rawv.inc" #undef LL_GST_SYM diff --git a/linden/indra/llmedia/llmediaimplgstreamer_syms.h b/linden/indra/llmedia/llmediaimplgstreamer_syms.h index 6957b1c..4220bdb 100644 --- a/linden/indra/llmedia/llmediaimplgstreamer_syms.h +++ b/linden/indra/llmedia/llmediaimplgstreamer_syms.h @@ -17,7 +17,8 @@ * 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 + * 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, @@ -38,13 +39,11 @@ extern "C" { } bool grab_gst_syms(std::string gst_dso_name, - std::string gst_dso_name_vid, - std::string gst_dso_name_aud); + std::string gst_dso_name_vid); void ungrab_gst_syms(); #define LL_GST_SYM(REQ, GSTSYM, RTN, ...) extern RTN (*ll##GSTSYM)(__VA_ARGS__) #include "llmediaimplgstreamer_syms_raw.inc" -#include "llmediaimplgstreamer_syms_rawa.inc" #include "llmediaimplgstreamer_syms_rawv.inc" #undef LL_GST_SYM @@ -61,12 +60,13 @@ void ungrab_gst_syms(); #define GST_TYPE_PIPELINE (llgst_pipeline_get_type()) #undef GST_TYPE_ELEMENT #define GST_TYPE_ELEMENT (llgst_element_get_type()) -#undef GST_TYPE_AUDIO_SINK -#define GST_TYPE_AUDIO_SINK (llgst_audio_sink_get_type()) #undef GST_TYPE_VIDEO_SINK #define GST_TYPE_VIDEO_SINK (llgst_video_sink_get_type()) +// more regrettable hacks to stub-out these .h-exposed GStreamer internals +void ll_gst_debug_register_funcptr(GstDebugFuncPtr func, gchar* ptrname); #undef _gst_debug_register_funcptr #define _gst_debug_register_funcptr ll_gst_debug_register_funcptr +GstDebugCategory* ll_gst_debug_category_new(gchar *name, guint color, gchar *description); #undef _gst_debug_category_new #define _gst_debug_category_new ll_gst_debug_category_new #undef __gst_debug_enabled diff --git a/linden/indra/llmedia/llmediaimplgstreamer_syms_raw.inc b/linden/indra/llmedia/llmediaimplgstreamer_syms_raw.inc index 08ba6df..b81872a 100644 --- a/linden/indra/llmedia/llmediaimplgstreamer_syms_raw.inc +++ b/linden/indra/llmedia/llmediaimplgstreamer_syms_raw.inc @@ -19,8 +19,6 @@ LL_GST_SYM(true, gst_element_class_add_pad_template, void, GstElementClass *klas LL_GST_SYM(true, gst_element_class_set_details, void, GstElementClass *klass, const GstElementDetails *details); LL_GST_SYM(true, gst_caps_unref, void, GstCaps* caps); LL_GST_SYM(true, gst_caps_ref, GstCaps *, GstCaps* caps); -LL_GST_SYM(true, _gst_debug_register_funcptr, void, GstDebugFuncPtr func, gchar* ptrname); -LL_GST_SYM(true, _gst_debug_category_new, GstDebugCategory *, gchar *name, guint color, gchar *description); LL_GST_SYM(true, gst_caps_is_empty, gboolean, const GstCaps *caps); LL_GST_SYM(true, gst_caps_from_string, GstCaps *, const gchar *string); LL_GST_SYM(true, gst_caps_replace, void, GstCaps **caps, GstCaps *newcaps); @@ -37,6 +35,12 @@ LL_GST_SYM(true, gst_structure_get_name, G_CONST_RETURN gchar *, const GstStruct 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_registry_fork_set_enabled, void, gboolean enabled); LL_GST_SYM(false, gst_segtrap_set_enabled, void, gboolean enabled); LL_GST_SYM(false, gst_message_parse_buffering, void, GstMessage *message, gint *percent); LL_GST_SYM(false, gst_message_parse_info, void, GstMessage *message, GError **gerror, gchar **debug); +LL_GST_SYM(false, gst_element_query_position, gboolean, GstElement *element, GstFormat *format, gint64 *cur); + +// GStreamer 'internal' symbols which may not be visible in some runtimes but are still used in expanded GStreamer header macros - yuck! We'll substitute our own stubs for these. +//LL_GST_SYM(true, _gst_debug_register_funcptr, void, GstDebugFuncPtr func, gchar* ptrname); +//LL_GST_SYM(true, _gst_debug_category_new, GstDebugCategory *, gchar *name, guint color, gchar *description); diff --git a/linden/indra/llmedia/llmediaimplgstreamer_syms_rawa.inc b/linden/indra/llmedia/llmediaimplgstreamer_syms_rawa.inc deleted file mode 100644 index 0be99b5..0000000 --- a/linden/indra/llmedia/llmediaimplgstreamer_syms_rawa.inc +++ /dev/null @@ -1,5 +0,0 @@ - -// required symbols to grab -LL_GST_SYM(true, gst_audio_sink_get_type, GType, void); - -// optional symbols to grab diff --git a/linden/indra/llmedia/llmediaimplgstreamervidplug.cpp b/linden/indra/llmedia/llmediaimplgstreamervidplug.cpp index dc3fe61..5e96666 100644 --- a/linden/indra/llmedia/llmediaimplgstreamervidplug.cpp +++ b/linden/indra/llmedia/llmediaimplgstreamervidplug.cpp @@ -17,7 +17,8 @@ * 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 + * 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, @@ -81,10 +82,10 @@ static void gst_slvideo_base_init (gpointer gclass) { static GstElementDetails element_details = { - "PluginTemplate", - "Generic/PluginTemplate", - "Generic Template Element", - "Linden Lab" + (gchar*)"PluginTemplate", + (gchar*)"Generic/PluginTemplate", + (gchar*)"Generic Template Element", + (gchar*)"Linden Lab" }; GstElementClass *element_class = GST_ELEMENT_CLASS (gclass); @@ -317,14 +318,6 @@ gst_slvideo_stop (GstBaseSink * bsink) } -static gboolean -gst_slvideo_unlock (GstBaseSink * bsink) -{ - // nothing really to do here. - return TRUE; -} - - /* initialize the plugin's class */ static void gst_slvideo_class_init (GstSLVideoClass * klass) @@ -343,17 +336,19 @@ gst_slvideo_class_init (GstSLVideoClass * klass) gstelement_class->change_state = gst_slvideo_change_state; - gstbasesink_class->get_caps = GST_DEBUG_FUNCPTR (gst_slvideo_get_caps); - gstbasesink_class->set_caps = GST_DEBUG_FUNCPTR( gst_slvideo_set_caps); - //gstbasesink_class->buffer_alloc=GST_DEBUG_FUNCPTR(gst_slvideo_buffer_alloc); - //gstbasesink_class->get_times = GST_DEBUG_FUNCPTR (gst_slvideo_get_times); - gstbasesink_class->preroll = GST_DEBUG_FUNCPTR (gst_slvideo_show_frame); - gstbasesink_class->render = GST_DEBUG_FUNCPTR (gst_slvideo_show_frame); +#define LLGST_DEBUG_FUNCPTR(p) (p) + gstbasesink_class->get_caps = LLGST_DEBUG_FUNCPTR (gst_slvideo_get_caps); + gstbasesink_class->set_caps = LLGST_DEBUG_FUNCPTR( gst_slvideo_set_caps); + //gstbasesink_class->buffer_alloc=LLGST_DEBUG_FUNCPTR(gst_slvideo_buffer_alloc); + //gstbasesink_class->get_times = LLGST_DEBUG_FUNCPTR (gst_slvideo_get_times); + gstbasesink_class->preroll = LLGST_DEBUG_FUNCPTR (gst_slvideo_show_frame); + gstbasesink_class->render = LLGST_DEBUG_FUNCPTR (gst_slvideo_show_frame); - gstbasesink_class->start = GST_DEBUG_FUNCPTR (gst_slvideo_start); - gstbasesink_class->stop = GST_DEBUG_FUNCPTR (gst_slvideo_stop); + gstbasesink_class->start = LLGST_DEBUG_FUNCPTR (gst_slvideo_start); + gstbasesink_class->stop = LLGST_DEBUG_FUNCPTR (gst_slvideo_stop); - gstbasesink_class->unlock = GST_DEBUG_FUNCPTR (gst_slvideo_unlock); + // gstbasesink_class->unlock = LLGST_DEBUG_FUNCPTR (gst_slvideo_unlock); +#undef LLGST_DEBUG_FUNCPTR } @@ -433,8 +428,8 @@ plugin_init (GstPlugin * plugin) { //fprintf(stderr, "\n\n\nPLUGIN INIT\n\n\n"); - GST_DEBUG_CATEGORY_INIT (gst_slvideo_debug, "private-slvideo-plugin", - 0, "Second Life Video Sink"); + GST_DEBUG_CATEGORY_INIT (gst_slvideo_debug, (gchar*)"private-slvideo-plugin", + 0, (gchar*)"Second Life Video Sink"); return llgst_element_register (plugin, "private-slvideo", GST_RANK_NONE, GST_TYPE_SLVIDEO); diff --git a/linden/indra/llmedia/llmediaimplgstreamervidplug.h b/linden/indra/llmedia/llmediaimplgstreamervidplug.h index 660d261..3db064c 100644 --- a/linden/indra/llmedia/llmediaimplgstreamervidplug.h +++ b/linden/indra/llmedia/llmediaimplgstreamervidplug.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmedia/llmediaimplllmozlib.cpp b/linden/indra/llmedia/llmediaimplllmozlib.cpp index 05d7220..689d4b4 100644 --- a/linden/indra/llmedia/llmediaimplllmozlib.cpp +++ b/linden/indra/llmedia/llmediaimplllmozlib.cpp @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmedia/llmediaimplllmozlib.h b/linden/indra/llmedia/llmediaimplllmozlib.h index 18b1c6a..f71300e 100644 --- a/linden/indra/llmedia/llmediaimplllmozlib.h +++ b/linden/indra/llmedia/llmediaimplllmozlib.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmedia/llmediaimplquicktime.cpp b/linden/indra/llmedia/llmediaimplquicktime.cpp index 5bd530d..76cacee 100644 --- a/linden/indra/llmedia/llmediaimplquicktime.cpp +++ b/linden/indra/llmedia/llmediaimplquicktime.cpp @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmedia/llmediaimplquicktime.h b/linden/indra/llmedia/llmediaimplquicktime.h index c8de1dd..d4e1db8 100644 --- a/linden/indra/llmedia/llmediaimplquicktime.h +++ b/linden/indra/llmedia/llmediaimplquicktime.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmedia/llmediaimplregister.h b/linden/indra/llmedia/llmediaimplregister.h index fcc3ab7..5191274 100644 --- a/linden/indra/llmedia/llmediaimplregister.h +++ b/linden/indra/llmedia/llmediaimplregister.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmedia/llmediamanager.cpp b/linden/indra/llmedia/llmediamanager.cpp index 6db8dbe..e1c7608 100644 --- a/linden/indra/llmedia/llmediamanager.cpp +++ b/linden/indra/llmedia/llmediamanager.cpp @@ -17,7 +17,8 @@ * 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 + * 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, @@ -150,8 +151,10 @@ LLMediaManager* LLMediaManager::getInstance() // (static) void LLMediaManager::setBrowserUserAgent(std::string user_agent) { +#if LL_LLMOZLIB_ENABLED // *HACK: Breaks encapsulation model, as initClass does above. JC LLMediaImplLLMozLib::setBrowserUserAgent(user_agent); +#endif // LL_LLMOZLIB_ENABLED } //////////////////////////////////////////////////////////////////////////////// diff --git a/linden/indra/llmedia/llmediamanager.h b/linden/indra/llmedia/llmediamanager.h index f618f4c..dc832d5 100644 --- a/linden/indra/llmedia/llmediamanager.h +++ b/linden/indra/llmedia/llmediamanager.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmedia/llmediaobserver.h b/linden/indra/llmedia/llmediaobserver.h index e6da4f6..5f794bb 100644 --- a/linden/indra/llmedia/llmediaobserver.h +++ b/linden/indra/llmedia/llmediaobserver.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/CMakeLists.txt b/linden/indra/llmessage/CMakeLists.txt index fd22de9..0f3e159 100644 --- a/linden/indra/llmessage/CMakeLists.txt +++ b/linden/indra/llmessage/CMakeLists.txt @@ -7,6 +7,8 @@ include(LLCommon) include(LLMath) include(LLMessage) include(LLVFS) +include(LLAddBuildTest) +include(Tut) include_directories (${CMAKE_CURRENT_SOURCE_DIR}) @@ -34,6 +36,7 @@ set(llmessage_SOURCE_FILES llhost.cpp llhttpassetstorage.cpp llhttpclient.cpp + llhttpclientadapter.cpp llhttpnode.cpp llhttpsender.cpp llinstantmessage.cpp @@ -57,6 +60,7 @@ set(llmessage_SOURCE_FILES llpacketring.cpp llpartdata.cpp llpumpio.cpp + llregionpresenceverifier.cpp llsdappservices.cpp llsdhttpserver.cpp llsdmessagebuilder.cpp @@ -65,7 +69,9 @@ set(llmessage_SOURCE_FILES llsdrpcserver.cpp llservicebuilder.cpp llservice.cpp + llstoredmessage.cpp lltemplatemessagebuilder.cpp + lltemplatemessagedispatcher.cpp lltemplatemessagereader.cpp llthrottle.cpp lltransfermanager.cpp @@ -73,6 +79,7 @@ set(llmessage_SOURCE_FILES lltransfersourcefile.cpp lltransfertargetfile.cpp lltransfertargetvfile.cpp + lltrustedmessageservice.cpp llurlrequest.cpp lluseroperation.cpp llxfer.cpp @@ -85,7 +92,6 @@ set(llmessage_SOURCE_FILES message_prehash.cpp message_string_table.cpp net.cpp - network.cpp partsyspacket.cpp patch_code.cpp patch_dct.cpp @@ -115,7 +121,10 @@ set(llmessage_HEADER_FILES llhost.h llhttpassetstorage.h llhttpclient.h + llhttpclientinterface.h + llhttpclientadapter.h llhttpnode.h + llhttpnodeadapter.h llhttpsender.h llinstantmessage.h llinvite.h @@ -144,6 +153,7 @@ set(llmessage_HEADER_FILES llqueryflags.h llregionflags.h llregionhandle.h + llregionpresenceverifier.h llsdappservices.h llsdhttpserver.h llsdmessagebuilder.h @@ -152,9 +162,11 @@ set(llmessage_HEADER_FILES llsdrpcserver.h llservice.h llservicebuilder.h + llstoredmessage.h lltaskname.h llteleportflags.h lltemplatemessagebuilder.h + lltemplatemessagedispatcher.h lltemplatemessagereader.h llthrottle.h lltransfermanager.h @@ -162,6 +174,7 @@ set(llmessage_HEADER_FILES lltransfersourcefile.h lltransfertargetfile.h lltransfertargetvfile.h + lltrustedmessageservice.h llurlrequest.h lluseroperation.h llvehicleparams.h @@ -176,7 +189,6 @@ set(llmessage_HEADER_FILES message.h message_prehash.h net.h - network.h partsyspacket.h patch_code.h patch_dct.h @@ -197,3 +209,13 @@ target_link_libraries( ${CRYPTO_LIBRARIES} ${XMLRPCEPI_LIBRARIES} ) + +IF (NOT LINUX AND VIEWER) + # When building the viewer the tests links against the shared objects. + # These can not be found when we try to run the tests, so we had to disable them, for the viewer build. + # TODO: Can someone with viewer knowledge figure out how to make these find the correct so. + #ADD_BUILD_TEST(llhttpclientadapter llmessage) + ADD_BUILD_TEST(lltrustedmessageservice llmessage) + ADD_BUILD_TEST(lltemplatemessagedispatcher llmessage) +ENDIF (NOT LINUX AND VIEWER) + diff --git a/linden/indra/llmessage/llares.cpp b/linden/indra/llmessage/llares.cpp index 578304a..fe37fe8 100644 --- a/linden/indra/llmessage/llares.cpp +++ b/linden/indra/llmessage/llares.cpp @@ -19,7 +19,8 @@ * 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 + * 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, @@ -469,9 +470,7 @@ bool LLAres::process(U64 timeout) 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; + apr_int32_t nsds = 0; int nactive = 0; int bitmask; @@ -479,10 +478,12 @@ bool LLAres::process(U64 timeout) if (bitmask == 0) { - goto bail; + return nsds > 0; } - status = apr_pool_create(&pool, gAPRPoolp); + apr_status_t status; + LLAPRPool pool; + status = pool.getStatus() ; ll_apr_assert_status(status); for (int i = 0; i < ARES_GETSOCK_MAXNUM; i++) @@ -500,16 +501,16 @@ bool LLAres::process(U64 timeout) apr_socket_t *aprSock = NULL; - status = apr_os_sock_put(&aprSock, (apr_os_sock_t *) &socks[i], pool); + status = apr_os_sock_put(&aprSock, (apr_os_sock_t *) &socks[i], pool.getAPRPool()); if (status != APR_SUCCESS) { ll_apr_warn_status(status); - goto bail_pool; + return nsds > 0; } aprFds[nactive].desc.s = aprSock; aprFds[nactive].desc_type = APR_POLL_SOCKET; - aprFds[nactive].p = pool; + aprFds[nactive].p = pool.getAPRPool(); aprFds[nactive].rtnevents = 0; aprFds[nactive].client_data = &socks[i]; @@ -537,10 +538,6 @@ bool LLAres::process(U64 timeout) } } -bail_pool: - apr_pool_destroy(pool); - -bail: return nsds > 0; } diff --git a/linden/indra/llmessage/llares.h b/linden/indra/llmessage/llares.h index 96eed79..96d7f6d 100644 --- a/linden/indra/llmessage/llares.h +++ b/linden/indra/llmessage/llares.h @@ -19,7 +19,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/llassetstorage.cpp b/linden/indra/llmessage/llassetstorage.cpp index a89a786..2966b60 100644 --- a/linden/indra/llmessage/llassetstorage.cpp +++ b/linden/indra/llmessage/llassetstorage.cpp @@ -17,7 +17,8 @@ * 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 + * 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, @@ -539,8 +540,19 @@ void LLAssetStorage::downloadCompleteCallback( return; } - req->setUUID(file_id); - req->setType(file_type); + // Inefficient since we're doing a find through a list that may have thousands of elements. + // This is due for refactoring; we will probably change mPendingDownloads into a set. + request_list_t::iterator download_iter = std::find(gAssetStorage->mPendingDownloads.begin(), + gAssetStorage->mPendingDownloads.end(), + req); + // If the LLAssetRequest doesn't exist in the downloads queue, then it either has already been deleted + // by _cleanupRequests, or it's a transfer. + if (download_iter != gAssetStorage->mPendingDownloads.end()) + { + req->setUUID(file_id); + req->setType(file_type); + } + if (LL_ERR_NOERR == result) { // we might have gotten a zero-size file @@ -563,7 +575,7 @@ void LLAssetStorage::downloadCompleteCallback( { request_list_t::iterator curiter = iter++; LLAssetRequest* tmp = *curiter; - if ((tmp->getUUID() == req->getUUID()) && (tmp->getType()== req->getType())) + if ((tmp->getUUID() == file_id) && (tmp->getType()== file_type)) { requests.push_front(tmp); iter = gAssetStorage->mPendingDownloads.erase(curiter); @@ -1198,6 +1210,9 @@ const char* LLAssetStorage::getErrorString(S32 status) case LL_ERR_CIRCUIT_GONE: return "Circuit gone"; + case LL_ERR_PRICE_MISMATCH: + return "Viewer and server do not agree on price"; + default: return "Unknown status"; } diff --git a/linden/indra/llmessage/llassetstorage.h b/linden/indra/llmessage/llassetstorage.h index eefa9a1..f01ee6a 100644 --- a/linden/indra/llmessage/llassetstorage.h +++ b/linden/indra/llmessage/llassetstorage.h @@ -18,7 +18,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/llblowfishcipher.cpp b/linden/indra/llmessage/llblowfishcipher.cpp index 908fb49..f24d103 100644 --- a/linden/indra/llmessage/llblowfishcipher.cpp +++ b/linden/indra/llmessage/llblowfishcipher.cpp @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/llblowfishcipher.h b/linden/indra/llmessage/llblowfishcipher.h index 2d51a49..f8b5e1f 100644 --- a/linden/indra/llmessage/llblowfishcipher.h +++ b/linden/indra/llmessage/llblowfishcipher.h @@ -20,7 +20,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/llbuffer.cpp b/linden/indra/llmessage/llbuffer.cpp index 4499b97..1ffcecd 100644 --- a/linden/indra/llmessage/llbuffer.cpp +++ b/linden/indra/llmessage/llbuffer.cpp @@ -19,7 +19,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/llbuffer.h b/linden/indra/llmessage/llbuffer.h index 1c200b0..b031ee8 100644 --- a/linden/indra/llmessage/llbuffer.h +++ b/linden/indra/llmessage/llbuffer.h @@ -19,7 +19,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/llbufferstream.cpp b/linden/indra/llmessage/llbufferstream.cpp index ea8d0bb..bdb0d68 100644 --- a/linden/indra/llmessage/llbufferstream.cpp +++ b/linden/indra/llmessage/llbufferstream.cpp @@ -19,7 +19,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/llbufferstream.h b/linden/indra/llmessage/llbufferstream.h index fe9b2dc..de68884 100644 --- a/linden/indra/llmessage/llbufferstream.h +++ b/linden/indra/llmessage/llbufferstream.h @@ -19,7 +19,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/llcachename.cpp b/linden/indra/llmessage/llcachename.cpp index 3acd881..1e6584a 100644 --- a/linden/indra/llmessage/llcachename.cpp +++ b/linden/indra/llmessage/llcachename.cpp @@ -17,7 +17,8 @@ * 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 + * 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, @@ -41,8 +42,7 @@ #include "llsdserialize.h" #include "lluuid.h" #include "message.h" -#include "llservicebuilder.h" -#include "llframetimer.h" + // Constants static const std::string CN_WAITING("(Loading...)"); // *TODO: translate static const std::string CN_NOBODY("(nobody)"); // *TODO: translate @@ -197,8 +197,6 @@ class LLCacheName::Impl public: LLMessageSystem* mMsg; LLHost mUpstreamHost; - std::string mGroupNameURL; - std::string mAgentNameURL; Cache mCache; // the map of UUIDs to names @@ -224,8 +222,6 @@ public: void processPendingReplies(); void sendRequest(const char* msg_name, const AskQueue& queue); bool isRequestPending(const LLUUID& id); - void getAgentName(const AskQueue&); - void getGroupName(const AskQueue&); // Message system callbacks. void processUUIDRequest(LLMessageSystem* msg, bool isGroup); @@ -239,35 +235,6 @@ public: void notifyObservers(const LLUUID& id, const std::string& first, const std::string& last, BOOL group); }; -class LLHTTPAgentNamesResponse : public LLHTTPClient::Responder -{ -public: - LLHTTPAgentNamesResponse(const LLSD& agent_ids) - : mAgentIDs(agent_ids) - { } - void result(const LLSD& content); -private: - LLHost mSender; - LLSD mAgentIDs; - -}; - -class LLHTTPGroupNamesResponse : public LLHTTPClient::Responder -{ -public: - LLHTTPGroupNamesResponse(const LLSD& group_ids) - : mGroupIDs(group_ids) - { }; - - void result(const LLSD& content); -private: - LLHost mSender; - LLSD mGroupIDs; - -}; - - - /// -------------------------------------------------------------------------- /// class LLCacheName @@ -353,57 +320,6 @@ void LLCacheName::cancelCallback(const LLUUID& id, LLCacheNameCallback callback, } } -void LLCacheName::sendAgentNames(const LLUUID& id, std::string& first, std::string& last) -{ - - LLCacheNameEntry* entry = get_ptr_in_map(impl.mCache, id); - if (!entry) - { - entry = new LLCacheNameEntry; - impl.mCache[id] = entry; - - } - entry->mIsGroup = false; - entry->mCreateTime = (U32)LLFrameTimer::getTotalSeconds(); - //entry->mFirstName = first; - //entry->mLastName = last; - //LLStringUtil::truncate(entry->mFirstName, DB_FIRST_NAME_BUF_SIZE); - //LLStringUtil::truncate(entry->mLastName, DB_LAST_NAME_BUF_SIZE); - entry->mFirstName = std::string(first, DB_FIRST_NAME_BUF_SIZE); - entry->mLastName = std::string(last, DB_LAST_NAME_BUF_SIZE); - - impl.mPendingQueue.erase(id); - impl.notifyObservers(id, - entry->mFirstName, entry->mLastName, - FALSE); - -} - -void LLCacheName::sendGroupNames(const LLUUID& id, std::string& name) -{ - - LLCacheNameEntry* entry = get_ptr_in_map(impl.mCache, id); - if (!entry) - { - entry = new LLCacheNameEntry; - impl.mCache[id] = entry; - - } - - entry->mIsGroup = true; - entry->mCreateTime = (U32)time(NULL); - - entry->mGroupName = std::string(name, DB_GROUP_NAME_BUF_SIZE); - - impl.mPendingQueue.erase(id); - - impl.notifyObservers(id, - entry->mFirstName, entry->mLastName, - FALSE); - - -} - void LLCacheName::importFile(LLFILE* fp) { S32 count = 0; @@ -609,16 +525,6 @@ BOOL LLCacheName::getFullName(const LLUUID& id, std::string& fullname) return res; } -void LLCacheName::setGroupURL(const std::string& group_url) -{ - impl.mGroupNameURL = group_url; -} - -void LLCacheName::setAgentURL(const std::string& agent_url) -{ - impl.mAgentNameURL = agent_url; -} - BOOL LLCacheName::getGroupName(const LLUUID& id, std::string& group) { if(id.isNull()) @@ -653,111 +559,6 @@ BOOL LLCacheName::getGroupName(const LLUUID& id, std::string& group) } } -void LLCacheName::Impl::getAgentName(const AskQueue &queue) -{ - - // get the names from backbone module - if(queue.empty()) - { - return; - } - - LLSD request; - request["action"] = "GET"; - LLSD id_block = LLSD::emptyArray(); - AskQueue::const_iterator it = queue.begin(); - AskQueue::const_iterator end = queue.end(); - for(;it!=end;++it) - { - id_block.append(*it); - } - lldebugs<(id_block) <(content) <mIsGroup = FALSE; - entry->mCreateTime = (U32)LLFrameTimer::getTotalSeconds(); - std::string first = name["first"]; - std::string last = name["last"]; - entry->mFirstName = std::string(first, DB_FIRST_NAME_BUF_SIZE); - entry->mLastName = std::string(last, DB_LAST_NAME_BUF_SIZE); - - gCacheName->sendAgentNames(id,first,last); - } -} - - -void LLCacheName::Impl::getGroupName(const AskQueue &queue) -{ - // get the group names from backbone module - if(queue.empty()) - { - return; - } - - LLSD request; - request["action"] = "GET"; - LLSD id_block = LLSD::emptyArray(); - AskQueue::const_iterator it = queue.begin(); - AskQueue::const_iterator end = queue.end(); - for(;it!=end;++it) - { - id_block.append(*it); - } - - request["groups"] = id_block; - - if(!mGroupNameURL.empty()) - { - LLHTTPClient::post( - mGroupNameURL, - request, - new LLHTTPGroupNamesResponse(id_block)); - } - lldebugs<<"Service builder call to group-name "<< mGroupNameURL<(content) << llendl; - LLUUID id; - - LLSD::map_const_iterator iter = content.beginMap(); - for ( ; iter != content.endMap(); ++iter) - { - - id.set((*iter).first); - std::string name = (*iter).second.asString(); - LLCacheNameEntry* entry = new LLCacheNameEntry; - entry->mIsGroup = TRUE; - entry->mCreateTime = (U32)time(NULL); - entry->mGroupName = std::string(name, DB_GROUP_NAME_BUF_SIZE); - lldebugs<<"Group Name"<sendGroupNames(id,name); - } -} - // 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) @@ -765,6 +566,7 @@ void LLCacheName::get(const LLUUID& id, BOOL is_group, LLCacheNameCallback callb if(id.isNull()) { callback(id, CN_NOBODY, "", is_group, user_data); + return; } LLCacheNameEntry* entry = get_ptr_in_map(impl.mCache, id ); @@ -806,14 +608,12 @@ void LLCacheName::processPending() return; } - /* if(!impl.mUpstreamHost.isOk()) { lldebugs << "LLCacheName::processPending() - bad upstream host." << llendl; return; } - */ impl.processPendingAsks(); impl.processPendingReplies(); @@ -895,16 +695,8 @@ std::string LLCacheName::getDefaultName() void LLCacheName::Impl::processPendingAsks() { - if (mUpstreamHost.isOk()) //its the vuewer asking for names send request to simulator - { - sendRequest(_PREHASH_UUIDNameRequest, mAskNameQueue); - sendRequest(_PREHASH_UUIDGroupNameRequest, mAskGroupQueue); - } - else //its simulator asking for names ask the backbone - { - getAgentName(mAskNameQueue); - getGroupName(mAskGroupQueue); - } + sendRequest(_PREHASH_UUIDNameRequest, mAskNameQueue); + sendRequest(_PREHASH_UUIDGroupNameRequest, mAskGroupQueue); mAskNameQueue.clear(); mAskGroupQueue.clear(); } @@ -1025,15 +817,12 @@ void LLCacheName::Impl::processUUIDRequest(LLMessageSystem* msg, bool isGroup) { // You should only get this message if the cache is at the simulator // level, hence having an upstream provider. - // 03/31/2008 Simulator is talking to backbone and not dataserver - // This check was for dataserver - /* if (!mUpstreamHost.isOk()) { llwarns << "LLCacheName - got UUID name/group request, but no upstream provider!" << llendl; return; } - */ + LLHost fromHost = msg->getSender(); ReplySender sender(msg); @@ -1104,8 +893,9 @@ void LLCacheName::Impl::processUUIDReply(LLMessageSystem* msg, bool isGroup) msg->getStringFast(_PREHASH_UUIDNameBlock, _PREHASH_LastName, entry->mLastName, i); } else - { + { // is group msg->getStringFast(_PREHASH_UUIDNameBlock, _PREHASH_GroupName, entry->mGroupName, i); + LLStringFn::replace_ascii_controlchars(entry->mGroupName, LL_UNKNOWN_CHAR); } if (!isGroup) diff --git a/linden/indra/llmessage/llcachename.h b/linden/indra/llmessage/llcachename.h index 8626dd5..2757b86 100644 --- a/linden/indra/llmessage/llcachename.h +++ b/linden/indra/llmessage/llcachename.h @@ -17,7 +17,8 @@ * 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 + * 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, @@ -31,9 +32,7 @@ #ifndef LL_LLCACHENAME_H #define LL_LLCACHENAME_H -#include "llhttpclient.h" -#include "llhost.h" -#include "lluri.h" + class LLMessageSystem; class LLHost; class LLUUID; @@ -99,15 +98,10 @@ public: // This method needs to be called from time to time to send out // requests. void processPending(); - void setAgentURL(const std::string& url); - void setGroupURL(const std::string& url); - + // Expire entries created more than "secs" seconds ago. void deleteEntriesOlderThan(S32 secs); - //send the information retrived from backbone - void sendAgentNames(const LLUUID& id, std::string& first, std::string& last); - void sendGroupNames(const LLUUID& id, std::string& name); // Debugging void dump(); // Dumps the contents of the cache void dumpStats(); // Dumps the sizes of the cache and associated queues. @@ -118,9 +112,10 @@ private: class Impl; Impl& impl; - }; + + extern LLCacheName* gCacheName; #endif diff --git a/linden/indra/llmessage/llchainio.cpp b/linden/indra/llmessage/llchainio.cpp index dd76c46..9e61356 100644 --- a/linden/indra/llmessage/llchainio.cpp +++ b/linden/indra/llmessage/llchainio.cpp @@ -19,7 +19,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/llchainio.h b/linden/indra/llmessage/llchainio.h index ab0410b..22140be 100644 --- a/linden/indra/llmessage/llchainio.h +++ b/linden/indra/llmessage/llchainio.h @@ -19,7 +19,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/llcipher.h b/linden/indra/llmessage/llcipher.h index f8fadb3..b68a1ac 100644 --- a/linden/indra/llmessage/llcipher.h +++ b/linden/indra/llmessage/llcipher.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/llcircuit.cpp b/linden/indra/llmessage/llcircuit.cpp index c58628b..725425c 100644 --- a/linden/indra/llmessage/llcircuit.cpp +++ b/linden/indra/llmessage/llcircuit.cpp @@ -17,7 +17,8 @@ * 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 + * 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, @@ -62,7 +63,6 @@ #include "lltransfermanager.h" #include "llmodularmath.h" -const F32 PING_INTERVAL = 5.f; // seconds const S32 PING_START_BLOCK = 3; // How many pings behind we have to be to consider ourself blocked. const S32 PING_RELEASE_BLOCK = 2; // How many pings behind we have to be to consider ourself unblocked. @@ -70,7 +70,8 @@ const F32 TARGET_PERIOD_LENGTH = 5.f; // seconds const F32 LL_DUPLICATE_SUPPRESSION_TIMEOUT = 60.f; //seconds - this can be long, as time-based cleanup is // only done when wrapping packetids, now... -LLCircuitData::LLCircuitData(const LLHost &host, TPACKETID in_id) +LLCircuitData::LLCircuitData(const LLHost &host, TPACKETID in_id, + const F32 circuit_heartbeat_interval, const F32 circuit_timeout) : mHost (host), mWrapID(0), mPacketsOutID(0), @@ -105,7 +106,9 @@ LLCircuitData::LLCircuitData(const LLHost &host, TPACKETID in_id) mPeakBPSOut(0), mPeriodTime(0.0), mExistenceTimer(), - mCurrentResendCount(0) + mCurrentResendCount(0), + mHeartbeatInterval(circuit_heartbeat_interval), + mHeartbeatTimeout(circuit_timeout) { // Need to guarantee that this time is up to date, we may be creating a circuit even though we haven't been // running a message system loop. @@ -113,9 +116,9 @@ LLCircuitData::LLCircuitData(const LLHost &host, TPACKETID in_id) F32 distribution_offset = ll_frand(); mPingTime = mt_sec; - mLastPingSendTime = mt_sec + PING_INTERVAL * distribution_offset; + mLastPingSendTime = mt_sec + mHeartbeatInterval * distribution_offset; mLastPingReceivedTime = mt_sec; - mNextPingSendTime = mLastPingSendTime + 0.95*PING_INTERVAL + ll_frand(0.1f*PING_INTERVAL); + mNextPingSendTime = mLastPingSendTime + 0.95*mHeartbeatInterval + ll_frand(0.1f*mHeartbeatInterval); mPeriodTime = mt_sec; mTimeoutCallback = NULL; @@ -429,7 +432,8 @@ S32 LLCircuitData::resendUnackedPackets(const F64 now) } -LLCircuit::LLCircuit() : mLastCircuit(NULL) +LLCircuit::LLCircuit(const F32 circuit_heartbeat_interval, const F32 circuit_timeout) : mLastCircuit(NULL), + mHeartbeatInterval(circuit_heartbeat_interval), mHeartbeatTimeout(circuit_timeout) { } @@ -447,7 +451,7 @@ LLCircuitData *LLCircuit::addCircuitData(const LLHost &host, TPACKETID in_id) { // This should really validate if one already exists llinfos << "LLCircuit::addCircuitData for " << host << llendl; - LLCircuitData *tempp = new LLCircuitData(host, in_id); + LLCircuitData *tempp = new LLCircuitData(host, in_id, mHeartbeatInterval, mHeartbeatTimeout); mCircuitData.insert(circuit_data_map::value_type(host, tempp)); mPingSet.insert(tempp); @@ -801,7 +805,7 @@ void LLCircuit::updateWatchDogTimers(LLMessageSystem *msgsys) // Always remember to remove it from the set before changing the sorting // key (mNextPingSendTime) mPingSet.erase(psit); - cdp->mNextPingSendTime = cur_time + PING_INTERVAL; + cdp->mNextPingSendTime = cur_time + mHeartbeatInterval; mPingSet.insert(cdp); continue; } @@ -819,7 +823,7 @@ void LLCircuit::updateWatchDogTimers(LLMessageSystem *msgsys) if (cdp->updateWatchDogTimers(msgsys)) { // Randomize our pings a bit by doing some up to 5% early or late - F64 dt = 0.95f*PING_INTERVAL + ll_frand(0.1f*PING_INTERVAL); + F64 dt = 0.95f*mHeartbeatInterval + ll_frand(0.1f*mHeartbeatInterval); // Remove it, and reinsert it with the new next ping time. // Always remove before changing the sorting key. @@ -1047,7 +1051,7 @@ BOOL LLCircuitData::checkCircuitTimeout() F64 time_since_last_ping = LLMessageSystem::getMessageTimeSeconds() - mLastPingReceivedTime; // Nota Bene: This needs to be turned off if you are debugging multiple simulators - if (time_since_last_ping > PING_INTERVAL_MAX) + if (time_since_last_ping > mHeartbeatTimeout) { llwarns << "LLCircuitData::checkCircuitTimeout for " << mHost << " last ping " << time_since_last_ping << " seconds ago." < PING_INTERVAL_ALARM) - { - //llwarns << "Unresponsive circuit: " << mHost << ": " << time_since_last_ping << " seconds since last ping."<< llendl; - } + return TRUE; } @@ -1280,7 +1281,7 @@ void LLCircuitData::pingTimerStop(const U8 ping_id) delta_ping += 256; } - U32 msec = (U32) ((delta_ping*PING_INTERVAL + time) * 1000.f); + U32 msec = (U32) ((delta_ping*mHeartbeatInterval + time) * 1000.f); setPingDelay(msec); mPingsInTransit = delta_ping; @@ -1371,7 +1372,8 @@ F32 LLCircuitData::getPingInTransitTime() if (mPingsInTransit) { - time_since_ping_was_sent = (F32)((mPingsInTransit*PING_INTERVAL - 1) + (LLMessageSystem::getMessageTimeSeconds() - mPingTime))*1000.f; + time_since_ping_was_sent = (F32)((mPingsInTransit*mHeartbeatInterval - 1) + + (LLMessageSystem::getMessageTimeSeconds() - mPingTime))*1000.f; } return time_since_ping_was_sent; diff --git a/linden/indra/llmessage/llcircuit.h b/linden/indra/llmessage/llcircuit.h index 6df7279..e373cb1 100644 --- a/linden/indra/llmessage/llcircuit.h +++ b/linden/indra/llmessage/llcircuit.h @@ -18,7 +18,8 @@ * 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 + * 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, @@ -50,10 +51,6 @@ // // Constants // -const F32 PING_INTERVAL_MAX = 100.f; -const F32 PING_INTERVAL_ALARM = 50.f; - - const F32 LL_AVERAGED_PING_ALPHA = 0.2f; // relaxation constant on ping running average const F32 LL_AVERAGED_PING_MAX = 2000; // msec const F32 LL_AVERAGED_PING_MIN = 100; // msec // IW: increased to avoid retransmits when a process is slow @@ -85,7 +82,8 @@ class LLSD; class LLCircuitData { public: - LLCircuitData(const LLHost &host, TPACKETID in_id); + LLCircuitData(const LLHost &host, TPACKETID in_id, + const F32 circuit_heartbeat_interval, const F32 circuit_timeout); ~LLCircuitData(); S32 resendUnackedPackets(const F64 now); @@ -283,6 +281,9 @@ protected: S32 mCurrentResendCount; // Number of resent packets since last spam LLStatRate mOutOfOrderRate; // Rate of out of order packets coming in. U32 mLastPacketGap; // Gap in sequence number of last packet. + + const F32 mHeartbeatInterval; + const F32 mHeartbeatTimeout; }; @@ -292,7 +293,7 @@ class LLCircuit { public: // CREATORS - LLCircuit(); + LLCircuit(const F32 circuit_heartbeat_interval, const F32 circuit_timeout); ~LLCircuit(); // ACCESSORS @@ -345,5 +346,9 @@ protected: // optimize the many, many times we call findCircuit. This may be // set in otherwise const methods, so it is declared mutable. mutable LLCircuitData* mLastCircuit; + +private: + const F32 mHeartbeatInterval; + const F32 mHeartbeatTimeout; }; #endif diff --git a/linden/indra/llmessage/llclassifiedflags.cpp b/linden/indra/llmessage/llclassifiedflags.cpp index c0579b8..da608e4 100644 --- a/linden/indra/llmessage/llclassifiedflags.cpp +++ b/linden/indra/llmessage/llclassifiedflags.cpp @@ -17,7 +17,8 @@ * 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 + * 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, @@ -40,18 +41,35 @@ #include "linden_common.h" #include "llclassifiedflags.h" - -ClassifiedFlags pack_classified_flags(BOOL is_mature, BOOL auto_renew) + +ClassifiedFlags pack_classified_flags_request(BOOL auto_renew, BOOL inc_pg, BOOL inc_mature, BOOL inc_adult) +{ + U8 rv = 0; + if(inc_pg) rv |= CLASSIFIED_QUERY_INC_PG; + if(inc_mature) rv |= CLASSIFIED_QUERY_INC_MATURE; + if (inc_pg && !inc_mature) rv |= CLASSIFIED_FLAG_MATURE; + if(inc_adult) rv |= CLASSIFIED_QUERY_INC_ADULT; + if(auto_renew) rv |= CLASSIFIED_FLAG_AUTO_RENEW; + return rv; +} + +ClassifiedFlags pack_classified_flags(BOOL auto_renew, BOOL inc_pg, BOOL inc_mature, BOOL inc_adult) { U8 rv = 0; - if(is_mature) rv |= CLASSIFIED_FLAG_MATURE; + if(inc_pg) rv |= CLASSIFIED_QUERY_INC_PG; + if(inc_mature) + { + rv |= CLASSIFIED_QUERY_INC_MATURE; + rv |= CLASSIFIED_FLAG_MATURE; + } + if(inc_adult) rv |= CLASSIFIED_QUERY_INC_ADULT; if(auto_renew) rv |= CLASSIFIED_FLAG_AUTO_RENEW; return rv; } bool is_cf_mature(ClassifiedFlags flags) { - return ((flags & CLASSIFIED_FLAG_MATURE) != 0); + return ((flags & CLASSIFIED_FLAG_MATURE) != 0) || ((flags & CLASSIFIED_QUERY_INC_MATURE) != 0); } // Deprecated, but leaving commented out because someday we might diff --git a/linden/indra/llmessage/llclassifiedflags.h b/linden/indra/llmessage/llclassifiedflags.h index 6c15042..9d3e49b 100644 --- a/linden/indra/llmessage/llclassifiedflags.h +++ b/linden/indra/llmessage/llclassifiedflags.h @@ -17,7 +17,8 @@ * 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 + * 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, @@ -42,12 +43,23 @@ const U8 CLASSIFIED_FLAG_UPDATE_TIME= 1 << 4; const U8 CLASSIFIED_FLAG_AUTO_RENEW = 1 << 5; const U8 CLASSIFIED_QUERY_FILTER_MATURE = 1 << 1; -const U8 CLASSIFIED_QUERY_FILTER_ENABLED = 1 << 2; -const U8 CLASSIFIED_QUERY_FILTER_PRICE = 1 << 3; +//const U8 CLASSIFIED_QUERY_FILTER_ENABLED = 1 << 2; +//const U8 CLASSIFIED_QUERY_FILTER_PRICE = 1 << 3; + +// These are new with Adult-enabled viewers (1.23 and later) +const U8 CLASSIFIED_QUERY_INC_PG = 1 << 2; +const U8 CLASSIFIED_QUERY_INC_MATURE = 1 << 3; +const U8 CLASSIFIED_QUERY_INC_ADULT = 1 << 6; +const U8 CLASSIFIED_QUERY_INC_NEW_VIEWER = (CLASSIFIED_QUERY_INC_PG | CLASSIFIED_QUERY_INC_MATURE | CLASSIFIED_QUERY_INC_ADULT); const S32 MAX_CLASSIFIEDS = 100; -ClassifiedFlags pack_classified_flags(BOOL is_mature, BOOL auto_renew); +// This function is used in AO viewers to pack old query flags into the request +// so that they can talk to old dataservers properly. When the AO servers are deployed on agni +// we can revert back to ClassifiedFlags pack_classified_flags and get rider of this one. +ClassifiedFlags pack_classified_flags_request(BOOL auto_renew, BOOL is_pg, BOOL is_mature, BOOL is_adult); + +ClassifiedFlags pack_classified_flags(BOOL auto_renew, BOOL is_pg, BOOL is_mature, BOOL is_adult); bool is_cf_mature(ClassifiedFlags flags); //bool is_cf_enabled(ClassifiedFlags flags); bool is_cf_update_time(ClassifiedFlags flags); diff --git a/linden/indra/llmessage/llcurl.cpp b/linden/indra/llmessage/llcurl.cpp index 266bfac..a4eb90d 100644 --- a/linden/indra/llmessage/llcurl.cpp +++ b/linden/indra/llmessage/llcurl.cpp @@ -19,7 +19,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/llcurl.h b/linden/indra/llmessage/llcurl.h index ca231a2..ff63904 100644 --- a/linden/indra/llmessage/llcurl.h +++ b/linden/indra/llmessage/llcurl.h @@ -19,7 +19,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/lldatapacker.cpp b/linden/indra/llmessage/lldatapacker.cpp index 33aa699..1cdb475 100644 --- a/linden/indra/llmessage/lldatapacker.cpp +++ b/linden/indra/llmessage/lldatapacker.cpp @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/lldatapacker.h b/linden/indra/llmessage/lldatapacker.h index 344b313..92bfec6 100644 --- a/linden/indra/llmessage/lldatapacker.h +++ b/linden/indra/llmessage/lldatapacker.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/lldbstrings.h b/linden/indra/llmessage/lldbstrings.h index d551d49..cdee400 100644 --- a/linden/indra/llmessage/lldbstrings.h +++ b/linden/indra/llmessage/lldbstrings.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/lldispatcher.cpp b/linden/indra/llmessage/lldispatcher.cpp index 2a0aa67..6632fbb 100644 --- a/linden/indra/llmessage/lldispatcher.cpp +++ b/linden/indra/llmessage/lldispatcher.cpp @@ -17,7 +17,8 @@ * 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 + * 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, @@ -120,29 +121,32 @@ bool LLDispatcher::unpackMessage( // we treat the SParam as binary data (since it might be an // LLUUID in compressed form which may have embedded \0's,) size = msg->getSizeFast(_PREHASH_ParamList, i, _PREHASH_Parameter); - msg->getBinaryDataFast( - _PREHASH_ParamList, _PREHASH_Parameter, - buf, size, i, MAX_STRING-1); - - // If the last byte of the data is 0x0, this is either a normally - // packed string, or a binary packed UUID (which for these messages - // are packed with a 17th byte 0x0). Unpack into a std::string - // without the trailing \0, so "abc\0" becomes std::string("abc", 3) - // which matches const char* "abc". - if (size > 0 - && buf[size-1] == 0x0) - { - // special char*/size constructor because UUIDs may have embedded - // 0x0 bytes. - std::string binary_data(buf, size-1); - parameters.push_back(binary_data); - } - else + if (size >= 0) { - // This is either a NULL string, or a string that was packed - // incorrectly as binary data, without the usual trailing '\0'. - std::string string_data(buf, size); - parameters.push_back(string_data); + msg->getBinaryDataFast( + _PREHASH_ParamList, _PREHASH_Parameter, + buf, size, i, MAX_STRING-1); + + // If the last byte of the data is 0x0, this is either a normally + // packed string, or a binary packed UUID (which for these messages + // are packed with a 17th byte 0x0). Unpack into a std::string + // without the trailing \0, so "abc\0" becomes std::string("abc", 3) + // which matches const char* "abc". + if (size > 0 + && buf[size-1] == 0x0) + { + // special char*/size constructor because UUIDs may have embedded + // 0x0 bytes. + std::string binary_data(buf, size-1); + parameters.push_back(binary_data); + } + else + { + // This is either a NULL string, or a string that was packed + // incorrectly as binary data, without the usual trailing '\0'. + std::string string_data(buf, size); + parameters.push_back(string_data); + } } } return true; diff --git a/linden/indra/llmessage/lldispatcher.h b/linden/indra/llmessage/lldispatcher.h index 492ac04..520b740 100644 --- a/linden/indra/llmessage/lldispatcher.h +++ b/linden/indra/llmessage/lldispatcher.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/lleventflags.h b/linden/indra/llmessage/lleventflags.h index 431ca01..965d978 100644 --- a/linden/indra/llmessage/lleventflags.h +++ b/linden/indra/llmessage/lleventflags.h @@ -17,7 +17,8 @@ * 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 + * 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, @@ -36,5 +37,6 @@ const U32 EVENT_FLAG_NONE = 0x0000; // set for mature events const U32 EVENT_FLAG_MATURE = 0x0001; +const U32 EVENT_FLAG_ADULT = 0x0002; #endif diff --git a/linden/indra/llmessage/llfiltersd2xmlrpc.cpp b/linden/indra/llmessage/llfiltersd2xmlrpc.cpp index 5a173f3..0560a31 100644 --- a/linden/indra/llmessage/llfiltersd2xmlrpc.cpp +++ b/linden/indra/llmessage/llfiltersd2xmlrpc.cpp @@ -18,7 +18,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/llfiltersd2xmlrpc.h b/linden/indra/llmessage/llfiltersd2xmlrpc.h index 6be090a..f907bbd 100644 --- a/linden/indra/llmessage/llfiltersd2xmlrpc.h +++ b/linden/indra/llmessage/llfiltersd2xmlrpc.h @@ -18,7 +18,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/llfollowcamparams.h b/linden/indra/llmessage/llfollowcamparams.h index ca9ca75..7dd8d56 100644 --- a/linden/indra/llmessage/llfollowcamparams.h +++ b/linden/indra/llmessage/llfollowcamparams.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/llhost.cpp b/linden/indra/llmessage/llhost.cpp index 77126a5..8e9e233 100644 --- a/linden/indra/llmessage/llhost.cpp +++ b/linden/indra/llmessage/llhost.cpp @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/llhost.h b/linden/indra/llmessage/llhost.h index 39e29f4..ac35980 100644 --- a/linden/indra/llmessage/llhost.h +++ b/linden/indra/llmessage/llhost.h @@ -18,7 +18,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/llhttpassetstorage.cpp b/linden/indra/llmessage/llhttpassetstorage.cpp index d1ea777..dfdad59 100644 --- a/linden/indra/llmessage/llhttpassetstorage.cpp +++ b/linden/indra/llmessage/llhttpassetstorage.cpp @@ -18,7 +18,8 @@ * 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 + * 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, @@ -234,6 +235,7 @@ LLSD LLHTTPAssetRequest::getFullDetails() const void LLHTTPAssetRequest::setupCurlHandle() { + // *NOTE: Similar code exists in mapserver/llcurlutil.cpp JC mCurlHandle = curl_easy_init(); curl_easy_setopt(mCurlHandle, CURLOPT_NOSIGNAL, 1); curl_easy_setopt(mCurlHandle, CURLOPT_NOPROGRESS, 1); diff --git a/linden/indra/llmessage/llhttpassetstorage.h b/linden/indra/llmessage/llhttpassetstorage.h index 8704a04..5786c5d 100644 --- a/linden/indra/llmessage/llhttpassetstorage.h +++ b/linden/indra/llmessage/llhttpassetstorage.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/llhttpclient.cpp b/linden/indra/llmessage/llhttpclient.cpp index 88a6afd..a6041b4 100644 --- a/linden/indra/llmessage/llhttpclient.cpp +++ b/linden/indra/llmessage/llhttpclient.cpp @@ -1,4 +1,4 @@ - /** +/** * @file llhttpclient.cpp * @brief Implementation of classes for making HTTP requests. * @@ -17,7 +17,8 @@ * 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 + * 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, @@ -310,9 +311,13 @@ void LLHTTPClient::getByteRange( request(url,LLURLRequest::HTTP_GET, NULL, responder, timeout, headers); } -void LLHTTPClient::head(const std::string& url, ResponderPtr responder, const F32 timeout) +void LLHTTPClient::head( + const std::string& url, + ResponderPtr responder, + const LLSD& headers, + const F32 timeout) { - request(url, LLURLRequest::HTTP_HEAD, NULL, responder, timeout); + request(url, LLURLRequest::HTTP_HEAD, NULL, responder, timeout, headers); } void LLHTTPClient::get(const std::string& url, ResponderPtr responder, const LLSD& headers, const F32 timeout) @@ -397,6 +402,14 @@ LLSD LLHTTPClient::blockingGet(const std::string& url) curl_easy_setopt(curlp, CURLOPT_ERRORBUFFER, curl_error_buffer); curl_easy_setopt(curlp, CURLOPT_FAILONERROR, 1); + struct curl_slist *header_list = NULL; + header_list = curl_slist_append(header_list, "Accept: application/llsd+xml"); + CURLcode curl_result = curl_easy_setopt(curlp, CURLOPT_HTTPHEADER, header_list); + if ( curl_result != CURLE_OK ) + { + llinfos << "Curl is hosed - can't add Accept header for llsd+xml" << llendl; + } + LLSD response = LLSD::emptyMap(); S32 curl_success = curl_easy_perform(curlp); @@ -418,44 +431,77 @@ LLSD LLHTTPClient::blockingGet(const std::string& url) response["body"] = http_buffer.asLLSD(); } + if(header_list) + { // free the header list + curl_slist_free_all(header_list); + header_list = NULL; + } + curl_easy_cleanup(curlp); return response; } -void LLHTTPClient::put(const std::string& url, const LLSD& body, ResponderPtr responder, const F32 timeout) +void LLHTTPClient::put( + const std::string& url, + const LLSD& body, + ResponderPtr responder, + const LLSD& headers, + const F32 timeout) { - request(url, LLURLRequest::HTTP_PUT, new LLSDInjector(body), responder, timeout); + request(url, LLURLRequest::HTTP_PUT, new LLSDInjector(body), responder, timeout, headers); } -void LLHTTPClient::post(const std::string& url, const LLSD& body, ResponderPtr responder, const F32 timeout) +void LLHTTPClient::post( + const std::string& url, + const LLSD& body, + ResponderPtr responder, + const LLSD& headers, + const F32 timeout) { - request(url, LLURLRequest::HTTP_POST, new LLSDInjector(body), responder, timeout); + request(url, LLURLRequest::HTTP_POST, new LLSDInjector(body), responder, timeout, headers); } -void LLHTTPClient::postRaw(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 LLSD& headers, + const F32 timeout) { - request(url, LLURLRequest::HTTP_POST, new RawInjector(data, size), responder, timeout); + request(url, LLURLRequest::HTTP_POST, new RawInjector(data, size), responder, timeout, headers); } -void LLHTTPClient::postFile(const std::string& url, const std::string& filename, ResponderPtr responder, const F32 timeout) +void LLHTTPClient::postFile( + const std::string& url, + const std::string& filename, + ResponderPtr responder, + const LLSD& headers, + const F32 timeout) { - request(url, LLURLRequest::HTTP_POST, new FileInjector(filename), responder, timeout); + request(url, LLURLRequest::HTTP_POST, new FileInjector(filename), responder, timeout, headers); } -void LLHTTPClient::postFile(const std::string& url, const LLUUID& uuid, - LLAssetType::EType asset_type, ResponderPtr responder, const F32 timeout) +void LLHTTPClient::postFile( + const std::string& url, + const LLUUID& uuid, + LLAssetType::EType asset_type, + ResponderPtr responder, + const LLSD& headers, + const F32 timeout) { - request(url, LLURLRequest::HTTP_POST, new VFileInjector(uuid, asset_type), responder, timeout); + request(url, LLURLRequest::HTTP_POST, new VFileInjector(uuid, asset_type), responder, timeout, headers); } // static void LLHTTPClient::del( const std::string& url, ResponderPtr responder, + const LLSD& headers, const F32 timeout) { - request(url, LLURLRequest::HTTP_DELETE, NULL, responder, timeout); + request(url, LLURLRequest::HTTP_DELETE, NULL, responder, timeout, headers); } // static @@ -463,9 +509,10 @@ void LLHTTPClient::move( const std::string& url, const std::string& destination, ResponderPtr responder, + const LLSD& hdrs, const F32 timeout) { - LLSD headers; + LLSD headers = hdrs; headers["Destination"] = destination; request(url, LLURLRequest::HTTP_MOVE, NULL, responder, timeout, headers); } diff --git a/linden/indra/llmessage/llhttpclient.h b/linden/indra/llmessage/llhttpclient.h index bfefc3a..a0c9fac 100644 --- a/linden/indra/llmessage/llhttpclient.h +++ b/linden/indra/llmessage/llhttpclient.h @@ -17,7 +17,8 @@ * 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 + * 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, @@ -62,28 +63,56 @@ public: /** @name non-blocking API */ //@{ - static void head(const std::string& url, ResponderPtr, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); + static void head( + const std::string& url, + ResponderPtr, + const LLSD& headers = LLSD(), + 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); static void get(const std::string& url, const LLSD& query, ResponderPtr, const LLSD& headers = LLSD(), const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); - static void put(const std::string& url, const LLSD& body, ResponderPtr, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); + static void put( + const std::string& url, + const LLSD& body, + ResponderPtr, + const LLSD& headers = LLSD(), + const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); 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); - 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 LLSD& body, + ResponderPtr, + const LLSD& headers = LLSD(), + 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 postRaw( + const std::string& url, + const U8* data, + S32 size, + ResponderPtr responder, + const LLSD& headers = LLSD(), + const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); + static void postFile( + const std::string& url, + const std::string& filename, + ResponderPtr, + const LLSD& headers = LLSD(), + const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); + static void postFile( + const std::string& url, + const LLUUID& uuid, + LLAssetType::EType asset_type, + ResponderPtr responder, + const LLSD& headers = LLSD(), + const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); static void del( const std::string& url, ResponderPtr responder, + const LLSD& headers = LLSD(), const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); ///< sends a DELETE method, but we can't call it delete in c++ @@ -93,12 +122,14 @@ public: * @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 headers A map of key:value headers to pass to the request * @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 LLSD& headers = LLSD(), const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); //@} diff --git a/linden/indra/llmessage/llhttpclientadapter.cpp b/linden/indra/llmessage/llhttpclientadapter.cpp new file mode 100644 index 0000000..b698822 --- /dev/null +++ b/linden/indra/llmessage/llhttpclientadapter.cpp @@ -0,0 +1,61 @@ +/** + * @file + * @brief + * + * $LicenseInfo:firstyear=2009&license=viewergpl$ + * + * Copyright (c) 2009, 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 "llhttpclientadapter.h" +#include "llhttpclient.h" + +LLHTTPClientAdapter::~LLHTTPClientAdapter() +{ +} + +void LLHTTPClientAdapter::get(const std::string& url, LLCurl::ResponderPtr responder) +{ + LLSD empty_pragma_header; + // Pragma is required to stop curl adding "no-cache" + // Space is required to stop llurlrequest from turnning off proxying + empty_pragma_header["Pragma"] = " "; + LLHTTPClient::get(url, responder, empty_pragma_header); +} + +void LLHTTPClientAdapter::get(const std::string& url, LLCurl::ResponderPtr responder, const LLSD& headers) +{ + LLSD empty_pragma_header = headers; + // as above + empty_pragma_header["Pragma"] = " "; + LLHTTPClient::get(url, responder, empty_pragma_header); +} + +void LLHTTPClientAdapter::put(const std::string& url, const LLSD& body, LLCurl::ResponderPtr responder) +{ + LLHTTPClient::put(url, body, responder); +} + diff --git a/linden/indra/llmessage/llhttpclientadapter.h b/linden/indra/llmessage/llhttpclientadapter.h new file mode 100644 index 0000000..7d61357 --- /dev/null +++ b/linden/indra/llmessage/llhttpclientadapter.h @@ -0,0 +1,49 @@ +/** + * @file + * @brief + * + * $LicenseInfo:firstyear=2008&license=viewergpl$ + * + * Copyright (c) 2008-2009, 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_HTTPCLIENTADAPTER_H +#define LL_HTTPCLIENTADAPTER_H + +#include "llhttpclientinterface.h" +#include "llmemory.h" // LLSingleton<> + +class LLHTTPClientAdapter : public LLHTTPClientInterface, public LLSingleton +{ +public: + virtual ~LLHTTPClientAdapter(); + virtual void get(const std::string& url, LLCurl::ResponderPtr responder); + virtual void get(const std::string& url, LLCurl::ResponderPtr responder, const LLSD& headers); + virtual void put(const std::string& url, const LLSD& body, LLCurl::ResponderPtr responder); +}; + +#endif + diff --git a/linden/indra/llmessage/llhttpclientinterface.h b/linden/indra/llmessage/llhttpclientinterface.h new file mode 100644 index 0000000..42a8e5c --- /dev/null +++ b/linden/indra/llmessage/llhttpclientinterface.h @@ -0,0 +1,51 @@ +/** + * @file + * @brief + * + * $LicenseInfo:firstyear=2008&license=viewergpl$ + * + * Copyright (c) 2008-2009, 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_LLHTTPCLIENTINTERFACE_H +#define LL_LLHTTPCLIENTINTERFACE_H + +#include "linden_common.h" +#include "llcurl.h" + +#include + +class LLHTTPClientInterface +{ +public: + virtual ~LLHTTPClientInterface() {} + virtual void get(const std::string& url, LLCurl::ResponderPtr responder) = 0; + virtual void get(const std::string& url, LLCurl::ResponderPtr responder, const LLSD& headers) = 0; + virtual void put(const std::string& url, const LLSD& body, LLCurl::ResponderPtr responder) = 0; +}; + +#endif // LL_LLHTTPCLIENTINTERFACE_H + diff --git a/linden/indra/llmessage/llhttpnode.cpp b/linden/indra/llmessage/llhttpnode.cpp index 0d60a64..2ba900a 100644 --- a/linden/indra/llmessage/llhttpnode.cpp +++ b/linden/indra/llmessage/llhttpnode.cpp @@ -17,7 +17,8 @@ * 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 + * 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, @@ -35,8 +36,8 @@ #include #include "llstl.h" +#include "lliohttpserver.h" // for string constants -static const std::string CONTEXT_REQUEST("request"); static const std::string CONTEXT_WILDCARD("wildcard"); /** @@ -180,7 +181,8 @@ 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(); + std::string host( + context[CONTEXT_REQUEST][CONTEXT_HEADERS]["host"].asString()); if(host.empty()) { response->status(400, "Bad Request -- need Host header"); @@ -474,6 +476,11 @@ void LLSimpleResponse::result(const LLSD& result) status(200, "OK"); } +void LLSimpleResponse::extendedResult(S32 code, const std::string& body, const LLSD& headers) +{ + status(code,body); +} + void LLSimpleResponse::status(S32 code, const std::string& message) { mCode = code; diff --git a/linden/indra/llmessage/llhttpnode.h b/linden/indra/llmessage/llhttpnode.h index ea89ee2..17ffd66 100644 --- a/linden/indra/llmessage/llhttpnode.h +++ b/linden/indra/llmessage/llhttpnode.h @@ -17,7 +17,8 @@ * 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 + * 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, @@ -37,7 +38,6 @@ class LLChainIOFactory; - /** * These classes represent the HTTP framework: The URL tree, and the LLSD * REST interface that such nodes implement. @@ -88,6 +88,9 @@ public: virtual LLSD post(const LLSD& input) const; virtual LLSD del(const LLSD& context) const; + /** + * @brief Abstract Base Class declaring Response interface. + */ class Response : public LLRefCount { protected: @@ -95,53 +98,57 @@ public: public: /** - * @brief Return the LLSD content and a 200 OK. - */ + * @brief Return the LLSD content and a 200 OK. + */ virtual void result(const LLSD&) = 0; /** + * @brief return status code and message with headers. + */ + virtual void extendedResult(S32 code, const std::string& message, const LLSD& headers) = 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); + * @brief Return no body, just status code and 'UNKNOWN ERROR'. + */ + virtual void status(S32 code); - void notFound(const std::string& message); - void notFound(); - void methodNotAllowed(); + virtual void notFound(const std::string& message); + virtual void notFound(); + virtual 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); + * @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" + */ + virtual 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. - */ + * @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; }; - typedef LLPointer ResponsePtr; virtual void get(ResponsePtr, const LLSD& context) const; @@ -217,6 +224,14 @@ public: const LLHTTPNode* rootNode() const; const LLHTTPNode* findNode(const std::string& name) const; + + enum EHTTPNodeContentType + { + CONTENT_TYPE_LLSD, + CONTENT_TYPE_TEXT + }; + + virtual EHTTPNodeContentType getContentType() const { return CONTENT_TYPE_LLSD; } //@} /* @name Description system @@ -276,6 +291,7 @@ public: static LLPointer create(); void result(const LLSD& result); + void extendedResult(S32 code, const std::string& body, const LLSD& headers); void status(S32 code, const std::string& message); void print(std::ostream& out) const; diff --git a/linden/indra/llmessage/llhttpnodeadapter.h b/linden/indra/llmessage/llhttpnodeadapter.h new file mode 100644 index 0000000..7c3e9d8 --- /dev/null +++ b/linden/indra/llmessage/llhttpnodeadapter.h @@ -0,0 +1,58 @@ +/** + * @file llhttpnodeadapter.h + * @brief Declaration of llhttpnode adapter classes + * + * $LicenseInfo:firstyear=2009&license=viewergpl$ + * + * Copyright (c) 2009, 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_HTTP_NODE_ADAPTER_H +#define LL_HTTP_NODE_ADAPTER_H + +#include "llhttpnode.h" + +template +class LLHTTPNodeAdapter : public LLHTTPNode +{ +public: + + virtual bool validate(const std::string& name, LLSD& context) const + { + T node; + return node.validate(name, context); + } + + virtual void post(LLHTTPNode::ResponsePtr response, + const LLSD& context, + const LLSD& input) const + { + T node; + return node.post(response, context, input); + } +}; + +#endif // LL_HTTP_NODE_ADAPTER_H diff --git a/linden/indra/llmessage/llhttpsender.cpp b/linden/indra/llmessage/llhttpsender.cpp index 30b2cf0..0acd728 100644 --- a/linden/indra/llmessage/llhttpsender.cpp +++ b/linden/indra/llmessage/llhttpsender.cpp @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/llhttpsender.h b/linden/indra/llmessage/llhttpsender.h index 1df9824..b6d8a3a 100644 --- a/linden/indra/llmessage/llhttpsender.h +++ b/linden/indra/llmessage/llhttpsender.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/llinstantmessage.cpp b/linden/indra/llmessage/llinstantmessage.cpp index dbee96b..44be3ae 100644 --- a/linden/indra/llmessage/llinstantmessage.cpp +++ b/linden/indra/llmessage/llinstantmessage.cpp @@ -19,7 +19,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/llinstantmessage.h b/linden/indra/llmessage/llinstantmessage.h index 0468c5a..96a2cf9 100644 --- a/linden/indra/llmessage/llinstantmessage.h +++ b/linden/indra/llmessage/llinstantmessage.h @@ -17,7 +17,8 @@ * 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 + * 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, @@ -158,7 +159,7 @@ enum EInstantMessage IM_FRIENDSHIP_OFFERED = 38, IM_FRIENDSHIP_ACCEPTED = 39, - IM_FRIENDSHIP_DECLINED = 40, + IM_FRIENDSHIP_DECLINED_DEPRECATED = 40, IM_TYPING_START = 41, IM_TYPING_STOP = 42, diff --git a/linden/indra/llmessage/llinvite.h b/linden/indra/llmessage/llinvite.h index 1a7e5e3..7bafccb 100644 --- a/linden/indra/llmessage/llinvite.h +++ b/linden/indra/llmessage/llinvite.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/lliobuffer.cpp b/linden/indra/llmessage/lliobuffer.cpp index a628bf6..71c1df8 100644 --- a/linden/indra/llmessage/lliobuffer.cpp +++ b/linden/indra/llmessage/lliobuffer.cpp @@ -19,7 +19,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/lliobuffer.h b/linden/indra/llmessage/lliobuffer.h index ae776f9..16bef15 100644 --- a/linden/indra/llmessage/lliobuffer.h +++ b/linden/indra/llmessage/lliobuffer.h @@ -19,7 +19,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/lliohttpserver.cpp b/linden/indra/llmessage/lliohttpserver.cpp index 167f212..83dfa94 100644 --- a/linden/indra/llmessage/lliohttpserver.cpp +++ b/linden/indra/llmessage/lliohttpserver.cpp @@ -19,7 +19,8 @@ * 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 + * 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, @@ -56,15 +57,15 @@ #include 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"); +const std::string CONTEXT_REQUEST("request"); +const std::string CONTEXT_RESPONSE("response"); +const std::string CONTEXT_VERB("verb"); +const std::string CONTEXT_HEADERS("headers"); +const std::string HTTP_VERB_GET("GET"); +const std::string HTTP_VERB_PUT("PUT"); +const std::string HTTP_VERB_POST("POST"); +const std::string HTTP_VERB_DELETE("DELETE"); +const std::string HTTP_VERB_OPTIONS("OPTIONS"); static LLIOHTTPServer::timing_callback_t sTimingCallback = NULL; static void* sTimingCallbackData = NULL; @@ -103,6 +104,7 @@ private: // from LLHTTPNode::Response virtual void result(const LLSD&); + virtual void extendedResult(S32 code, const std::string& body, const LLSD& headers); virtual void status(S32 code, const std::string& message); void nullPipe(); @@ -121,7 +123,8 @@ private: STATE_DELAYED, STATE_LOCKED, STATE_GOOD_RESULT, - STATE_STATUS_RESULT + STATE_STATUS_RESULT, + STATE_EXTENDED_RESULT }; State mState; @@ -179,14 +182,32 @@ LLIOPipe::EStatus LLHTTPPipe::process_impl( { LLPerfBlock putblock("http_put"); LLSD input; - LLSDSerialize::fromXML(input, istr); + if (mNode.getContentType() == LLHTTPNode::CONTENT_TYPE_LLSD) + { + LLSDSerialize::fromXML(input, istr); + } + else if (mNode.getContentType() == LLHTTPNode::CONTENT_TYPE_TEXT) + { + std::stringstream strstrm; + strstrm << istr.rdbuf(); + input = strstrm.str(); + } mNode.put(LLHTTPNode::ResponsePtr(mResponse), context, input); } else if(verb == HTTP_VERB_POST) { LLPerfBlock postblock("http_post"); LLSD input; - LLSDSerialize::fromXML(input, istr); + if (mNode.getContentType() == LLHTTPNode::CONTENT_TYPE_LLSD) + { + LLSDSerialize::fromXML(input, istr); + } + else if (mNode.getContentType() == LLHTTPNode::CONTENT_TYPE_TEXT) + { + std::stringstream strstrm; + strstrm << istr.rdbuf(); + input = strstrm.str(); + } mNode.post(LLHTTPNode::ResponsePtr(mResponse), context, input); } else if(verb == HTTP_VERB_DELETE) @@ -261,7 +282,16 @@ LLIOPipe::EStatus LLHTTPPipe::process_impl( context[CONTEXT_RESPONSE]["statusCode"] = mStatusCode; context[CONTEXT_RESPONSE]["statusMessage"] = mStatusMessage; LLBufferStream ostr(channels, buffer.get()); - ostr << mStatusMessage << std::ends; + ostr << mStatusMessage; + + return STATUS_DONE; + } + case STATE_EXTENDED_RESULT: + { + context[CONTEXT_RESPONSE][CONTEXT_HEADERS] = mHeaders; + context[CONTEXT_RESPONSE]["statusCode"] = mStatusCode; + LLBufferStream ostr(channels, buffer.get()); + ostr << mStatusMessage; return STATUS_DONE; } @@ -308,6 +338,21 @@ void LLHTTPPipe::Response::result(const LLSD& r) mPipe->unlockChain(); } +void LLHTTPPipe::Response::extendedResult(S32 code, const std::string& body, const LLSD& headers) +{ + if(! mPipe) + { + llwarns << "LLHTTPPipe::Response::status: NULL pipe" << llendl; + return; + } + + mPipe->mStatusCode = code; + mPipe->mStatusMessage = body; + mPipe->mHeaders = headers; + mPipe->mState = STATE_EXTENDED_RESULT; + mPipe->unlockChain(); +} + // virtual void LLHTTPPipe::Response::status(S32 code, const std::string& message) { @@ -408,6 +453,7 @@ LLIOPipe::EStatus LLHTTPResponseHeader::process_impl( } ostr << HTTP_VERSION_STR << " " << code << " " << message << "\r\n"; + S32 content_length = buffer->countAfter(channels.in(), NULL); if(0 < content_length) { @@ -798,6 +844,7 @@ LLIOPipe::EStatus LLHTTPResponder::process_impl( = node->getProtocolHandler(); if (protocolHandler) { + lldebugs << "HTTP context: " << context << llendl; protocolHandler->build(chain, context); } else diff --git a/linden/indra/llmessage/lliohttpserver.h b/linden/indra/llmessage/lliohttpserver.h index 0f39c30..d1c9bdd 100644 --- a/linden/indra/llmessage/lliohttpserver.h +++ b/linden/indra/llmessage/lliohttpserver.h @@ -18,7 +18,8 @@ * 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 + * 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, @@ -39,6 +40,18 @@ class LLPumpIO; +// common strings use for populating the context. bascally 'request', +// 'wildcard', and 'headers'. +extern const std::string CONTEXT_REQUEST; +extern const std::string CONTEXT_RESPONSE; +extern const std::string CONTEXT_VERB; +extern const std::string CONTEXT_HEADERS; +extern const std::string HTTP_VERB_GET; +extern const std::string HTTP_VERB_PUT; +extern const std::string HTTP_VERB_POST; +extern const std::string HTTP_VERB_DELETE; +extern const std::string HTTP_VERB_OPTIONS; + class LLIOHTTPServer { public: diff --git a/linden/indra/llmessage/lliopipe.cpp b/linden/indra/llmessage/lliopipe.cpp index 05a54d3..af9737d 100644 --- a/linden/indra/llmessage/lliopipe.cpp +++ b/linden/indra/llmessage/lliopipe.cpp @@ -19,7 +19,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/lliopipe.h b/linden/indra/llmessage/lliopipe.h index 999916f..8c5f151 100644 --- a/linden/indra/llmessage/lliopipe.h +++ b/linden/indra/llmessage/lliopipe.h @@ -19,7 +19,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/lliosocket.cpp b/linden/indra/llmessage/lliosocket.cpp index 2b9c478..7ec577c 100644 --- a/linden/indra/llmessage/lliosocket.cpp +++ b/linden/indra/llmessage/lliosocket.cpp @@ -19,7 +19,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/lliosocket.h b/linden/indra/llmessage/lliosocket.h index 02610d9..ec09ad8 100644 --- a/linden/indra/llmessage/lliosocket.h +++ b/linden/indra/llmessage/lliosocket.h @@ -19,7 +19,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/llioutil.cpp b/linden/indra/llmessage/llioutil.cpp index 494ac55..d282a7d 100644 --- a/linden/indra/llmessage/llioutil.cpp +++ b/linden/indra/llmessage/llioutil.cpp @@ -19,7 +19,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/llioutil.h b/linden/indra/llmessage/llioutil.h index 668de97..5bc674a 100644 --- a/linden/indra/llmessage/llioutil.h +++ b/linden/indra/llmessage/llioutil.h @@ -19,7 +19,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/llloginflags.h b/linden/indra/llmessage/llloginflags.h index 064e893..6f119e7 100644 --- a/linden/indra/llmessage/llloginflags.h +++ b/linden/indra/llmessage/llloginflags.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/llmail.cpp b/linden/indra/llmessage/llmail.cpp index 6945a45..d52ff6c 100644 --- a/linden/indra/llmessage/llmail.cpp +++ b/linden/indra/llmessage/llmail.cpp @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/llmail.h b/linden/indra/llmessage/llmail.h index 7049a5b..7effb84 100644 --- a/linden/indra/llmessage/llmail.h +++ b/linden/indra/llmessage/llmail.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/llmessagebuilder.cpp b/linden/indra/llmessage/llmessagebuilder.cpp index 21c2db6..def9f47 100644 --- a/linden/indra/llmessage/llmessagebuilder.cpp +++ b/linden/indra/llmessage/llmessagebuilder.cpp @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/llmessagebuilder.h b/linden/indra/llmessage/llmessagebuilder.h index 180cf1e..6fa218d 100644 --- a/linden/indra/llmessage/llmessagebuilder.h +++ b/linden/indra/llmessage/llmessagebuilder.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/llmessageconfig.cpp b/linden/indra/llmessage/llmessageconfig.cpp index 8721b09..d427935 100644 --- a/linden/indra/llmessage/llmessageconfig.cpp +++ b/linden/indra/llmessage/llmessageconfig.cpp @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/llmessageconfig.h b/linden/indra/llmessage/llmessageconfig.h index 17bcf00..e8b5164 100644 --- a/linden/indra/llmessage/llmessageconfig.h +++ b/linden/indra/llmessage/llmessageconfig.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/llmessagereader.cpp b/linden/indra/llmessage/llmessagereader.cpp index a7a4597..6237172 100644 --- a/linden/indra/llmessage/llmessagereader.cpp +++ b/linden/indra/llmessage/llmessagereader.cpp @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/llmessagereader.h b/linden/indra/llmessage/llmessagereader.h index b1aa6e1..6edc2f3 100644 --- a/linden/indra/llmessage/llmessagereader.h +++ b/linden/indra/llmessage/llmessagereader.h @@ -17,7 +17,8 @@ * 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 + * 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, @@ -43,6 +44,12 @@ class LLVector3; class LLVector3d; class LLVector4; +// Error return values for getSize() functions +const S32 LL_BLOCK_NOT_IN_MESSAGE = -1; +const S32 LL_VARIABLE_NOT_IN_BLOCK = -2; +const S32 LL_MESSAGE_ERROR = -3; + + class LLMessageReader { public: diff --git a/linden/indra/llmessage/llmessagesenderinterface.h b/linden/indra/llmessage/llmessagesenderinterface.h new file mode 100644 index 0000000..119eb1d --- /dev/null +++ b/linden/indra/llmessage/llmessagesenderinterface.h @@ -0,0 +1,50 @@ +/** + * @file + * @brief + * + * $LicenseInfo:firstyear=2008&license=viewergpl$ + * + * Copyright (c) 2008-2009, 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_LLMESSAGESENDERINTERFACE_H +#define LL_LLMESSAGESENDERINTERFACE_H + +#include "linden_common.h" +#include "llstoredmessage.h" +class LLHost; +class LLSD; + +class LLMessageSenderInterface +{ +public: + virtual ~LLMessageSenderInterface() {} + virtual S32 sendMessage(const LLHost& host, LLStoredMessagePtr message) = 0; + +}; + +#endif // LL_LLMESSAGESENDERINTERFACE_H + diff --git a/linden/indra/llmessage/llmessagetemplate.cpp b/linden/indra/llmessage/llmessagetemplate.cpp index 6cbffca..7f3a97f 100644 --- a/linden/indra/llmessage/llmessagetemplate.cpp +++ b/linden/indra/llmessage/llmessagetemplate.cpp @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/llmessagetemplate.h b/linden/indra/llmessage/llmessagetemplate.h index 2390eea..d7f02eb 100644 --- a/linden/indra/llmessage/llmessagetemplate.h +++ b/linden/indra/llmessage/llmessagetemplate.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/llmessagetemplateparser.cpp b/linden/indra/llmessage/llmessagetemplateparser.cpp index b7fe8f9..283547e 100644 --- a/linden/indra/llmessage/llmessagetemplateparser.cpp +++ b/linden/indra/llmessage/llmessagetemplateparser.cpp @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/llmessagetemplateparser.h b/linden/indra/llmessage/llmessagetemplateparser.h index 97e51c4..af66131 100644 --- a/linden/indra/llmessage/llmessagetemplateparser.h +++ b/linden/indra/llmessage/llmessagetemplateparser.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/llmessagethrottle.cpp b/linden/indra/llmessage/llmessagethrottle.cpp index 0d61f90..8fec4b3 100644 --- a/linden/indra/llmessage/llmessagethrottle.cpp +++ b/linden/indra/llmessage/llmessagethrottle.cpp @@ -17,7 +17,8 @@ * 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 + * 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, @@ -119,7 +120,7 @@ BOOL LLMessageThrottle::addViewerAlert(const LLUUID& to, const std::string& mesg full_mesg << to << mesg; // Create an entry for this message. - size_t hash = llhash (full_mesg.str().c_str()); + size_t hash = llhash(full_mesg.str().c_str()); LLMessageThrottleEntry entry(hash, LLFrameTimer::getTotalTime()); // Check if this message is already in the list. @@ -153,7 +154,7 @@ BOOL LLMessageThrottle::addAgentAlert(const LLUUID& agent, const LLUUID& task, c full_mesg << agent << task << mesg; // Create an entry for this message. - size_t hash = llhash (full_mesg.str().c_str()); + size_t hash = llhash(full_mesg.str().c_str()); LLMessageThrottleEntry entry(hash, LLFrameTimer::getTotalTime()); // Check if this message is already in the list. diff --git a/linden/indra/llmessage/llmessagethrottle.h b/linden/indra/llmessage/llmessagethrottle.h index fdd1b4b..b8a5de0 100644 --- a/linden/indra/llmessage/llmessagethrottle.h +++ b/linden/indra/llmessage/llmessagethrottle.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/llmime.cpp b/linden/indra/llmessage/llmime.cpp index 355d0b7..fa623b6 100644 --- a/linden/indra/llmessage/llmime.cpp +++ b/linden/indra/llmessage/llmime.cpp @@ -19,7 +19,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/llmime.h b/linden/indra/llmessage/llmime.h index 9fbfcd7..29211a9 100644 --- a/linden/indra/llmessage/llmime.h +++ b/linden/indra/llmessage/llmime.h @@ -19,7 +19,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/llmsgvariabletype.h b/linden/indra/llmessage/llmsgvariabletype.h index 08e5aef..b3b3589 100644 --- a/linden/indra/llmessage/llmsgvariabletype.h +++ b/linden/indra/llmessage/llmsgvariabletype.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/llnamevalue.cpp b/linden/indra/llmessage/llnamevalue.cpp index d4db063..01e922e 100644 --- a/linden/indra/llmessage/llnamevalue.cpp +++ b/linden/indra/llmessage/llnamevalue.cpp @@ -17,7 +17,8 @@ * 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 + * 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, @@ -38,7 +39,6 @@ #include "u64.h" #include "llstring.h" -#include "llcamera.h" #include "string_table.h" // Anonymous enumeration to provide constants in this file. diff --git a/linden/indra/llmessage/llnamevalue.h b/linden/indra/llmessage/llnamevalue.h index eecfd4c..ad69d3a 100644 --- a/linden/indra/llmessage/llnamevalue.h +++ b/linden/indra/llmessage/llnamevalue.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/llnullcipher.cpp b/linden/indra/llmessage/llnullcipher.cpp index 89c66cc..30279bc 100644 --- a/linden/indra/llmessage/llnullcipher.cpp +++ b/linden/indra/llmessage/llnullcipher.cpp @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/llnullcipher.h b/linden/indra/llmessage/llnullcipher.h index 2b5a4a5..6e87720 100644 --- a/linden/indra/llmessage/llnullcipher.h +++ b/linden/indra/llmessage/llnullcipher.h @@ -16,7 +16,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/llpacketack.cpp b/linden/indra/llmessage/llpacketack.cpp index 8eb6694..f7de44c 100644 --- a/linden/indra/llmessage/llpacketack.cpp +++ b/linden/indra/llmessage/llpacketack.cpp @@ -19,7 +19,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/llpacketack.h b/linden/indra/llmessage/llpacketack.h index 1023295..6f78dda 100644 --- a/linden/indra/llmessage/llpacketack.h +++ b/linden/indra/llmessage/llpacketack.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/llpacketbuffer.cpp b/linden/indra/llmessage/llpacketbuffer.cpp index cb42ab3..027d35c 100644 --- a/linden/indra/llmessage/llpacketbuffer.cpp +++ b/linden/indra/llmessage/llpacketbuffer.cpp @@ -17,7 +17,8 @@ * 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 + * 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, @@ -73,5 +74,6 @@ void LLPacketBuffer::init (S32 hSocket) { mSize = receive_packet(hSocket, mData); mHost = ::get_sender(); + mReceivingIF = ::get_receiving_interface(); } - + diff --git a/linden/indra/llmessage/llpacketbuffer.h b/linden/indra/llmessage/llpacketbuffer.h index b8c9f83..bbcbdf2 100644 --- a/linden/indra/llmessage/llpacketbuffer.h +++ b/linden/indra/llmessage/llpacketbuffer.h @@ -18,7 +18,8 @@ * 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 + * 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, @@ -43,15 +44,17 @@ public: LLPacketBuffer(S32 hSocket); // receive a packet ~LLPacketBuffer(); - S32 getSize() const { return mSize; } - const char *getData() const { return mData; } - LLHost getHost() const { return mHost; } + S32 getSize() const { return mSize; } + const char *getData() const { return mData; } + LLHost getHost() const { return mHost; } + LLHost getReceivingInterface() const { return mReceivingIF; } void init(S32 hSocket); protected: char mData[NET_BUFFER_SIZE]; // packet data /* Flawfinder : ignore */ S32 mSize; // size of buffer in bytes LLHost mHost; // source/dest IP and port + LLHost mReceivingIF; // source/dest IP and port }; #endif diff --git a/linden/indra/llmessage/llpacketring.cpp b/linden/indra/llmessage/llpacketring.cpp index cd59b12..35d5aac 100644 --- a/linden/indra/llmessage/llpacketring.cpp +++ b/linden/indra/llmessage/llpacketring.cpp @@ -17,7 +17,8 @@ * 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 + * 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, @@ -140,6 +141,7 @@ S32 LLPacketRing::receiveFromRing (S32 socket, char *datap) } // need to set sender IP/port!! mLastSender = packetp->getHost(); + mLastReceivingIF = packetp->getReceivingInterface(); delete packetp; this->mInBufferLength -= packet_size; @@ -222,6 +224,7 @@ S32 LLPacketRing::receivePacket (S32 socket, char *datap) // no delay, pull straight from net packet_size = receive_packet(socket, datap); mLastSender = ::get_sender(); + mLastReceivingIF = ::get_receiving_interface(); if (packet_size) // did we actually get a packet? { diff --git a/linden/indra/llmessage/llpacketring.h b/linden/indra/llmessage/llpacketring.h index e914a32..4408abe 100644 --- a/linden/indra/llmessage/llpacketring.h +++ b/linden/indra/llmessage/llpacketring.h @@ -18,7 +18,8 @@ * 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 + * 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, @@ -61,6 +62,7 @@ public: BOOL sendPacket(int h_socket, char * send_buffer, S32 buf_size, LLHost host); inline LLHost getLastSender(); + inline LLHost getLastReceivingInterface(); S32 getAndResetActualInBits() { S32 bits = mActualBitsIn; mActualBitsIn = 0; return bits;} S32 getAndResetActualOutBits() { S32 bits = mActualBitsOut; mActualBitsOut = 0; return bits;} @@ -85,6 +87,7 @@ protected: std::queue mSendQueue; LLHost mLastSender; + LLHost mLastReceivingIF; }; @@ -93,4 +96,9 @@ inline LLHost LLPacketRing::getLastSender() return mLastSender; } +inline LLHost LLPacketRing::getLastReceivingInterface() +{ + return mLastReceivingIF; +} + #endif diff --git a/linden/indra/llmessage/llpartdata.cpp b/linden/indra/llmessage/llpartdata.cpp index fe859fe..485bc6a 100644 --- a/linden/indra/llmessage/llpartdata.cpp +++ b/linden/indra/llmessage/llpartdata.cpp @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/llpartdata.h b/linden/indra/llmessage/llpartdata.h index a72c6b2..6dcb311 100644 --- a/linden/indra/llmessage/llpartdata.h +++ b/linden/indra/llmessage/llpartdata.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/llpumpio.cpp b/linden/indra/llmessage/llpumpio.cpp index 01a43ec..3e3f0b3 100644 --- a/linden/indra/llmessage/llpumpio.cpp +++ b/linden/indra/llmessage/llpumpio.cpp @@ -19,7 +19,8 @@ * 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 + * 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, @@ -180,6 +181,8 @@ LLPumpIO::LLPumpIO(apr_pool_t* pool) : mCallbackMutex(NULL), mCurrentChain(mRunningChains.end()) { + mCurrentChain = mRunningChains.end(); + LLMemType m1(LLMemType::MTYPE_IO_PUMP); initialize(pool); } @@ -273,12 +276,11 @@ bool LLPumpIO::setTimeoutSeconds(F32 timeout) void LLPumpIO::adjustTimeoutSeconds(F32 delta) { - // If no chain is running, bail - if(mRunningChains.end() == mCurrentChain) + // Ensure a chain is running + if(mRunningChains.end() != mCurrentChain) { - return; + (*mCurrentChain).adjustTimeoutSeconds(delta); } - (*mCurrentChain).adjustTimeoutSeconds(delta); } static std::string events_2_string(apr_int16_t events) @@ -548,7 +550,7 @@ void LLPumpIO::pump(const S32& poll_timeout) //lldebugs << "Running chain count: " << mRunningChains.size() << llendl; running_chains_t::iterator run_chain = mRunningChains.begin(); bool process_this_chain = false; - for(; run_chain != mRunningChains.end(); ) + while( run_chain != mRunningChains.end() ) { PUMP_DEBUG; if((*run_chain).mInit diff --git a/linden/indra/llmessage/llpumpio.h b/linden/indra/llmessage/llpumpio.h index bf62832..fc0bfab 100644 --- a/linden/indra/llmessage/llpumpio.h +++ b/linden/indra/llmessage/llpumpio.h @@ -19,7 +19,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/llqueryflags.h b/linden/indra/llmessage/llqueryflags.h index b4f7373..960d777 100644 --- a/linden/indra/llmessage/llqueryflags.h +++ b/linden/indra/llmessage/llqueryflags.h @@ -17,7 +17,8 @@ * 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 + * 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, @@ -64,6 +65,13 @@ const U32 DFQ_LIMIT_BY_AREA = 0x1 << 21; const U32 DFQ_FILTER_MATURE = 0x1 << 22; const U32 DFQ_PG_PARCELS_ONLY = 0x1 << 23; +const U32 DFQ_INC_PG = 0x1 << 24; // Flags appear in 1.23 viewer or later +const U32 DFQ_INC_MATURE = 0x1 << 25; +const U32 DFQ_INC_ADULT = 0x1 << 26; +const U32 DFQ_INC_NEW_VIEWER = (DFQ_INC_PG | DFQ_INC_MATURE | DFQ_INC_ADULT); // Indicates 1.23 viewer or later + +const U32 DFQ_ADULT_SIMS_ONLY = 0x1 << 27; + // Sell Type flags const U32 ST_AUCTION = 0x1 << 1; const U32 ST_NEWBIE = 0x1 << 2; @@ -72,4 +80,29 @@ const U32 ST_ESTATE = 0x1 << 4; const U32 ST_ALL = 0xFFFFFFFF; +// status flags embedded in search replay messages of classifieds, events, groups, and places. +// Places +const U32 STATUS_SEARCH_PLACES_NONE = 0x0; +const U32 STATUS_SEARCH_PLACES_BANNEDWORD = 0x1 << 0; +const U32 STATUS_SEARCH_PLACES_SHORTSTRING = 0x1 << 1; +const U32 STATUS_SEARCH_PLACES_FOUNDNONE = 0x1 << 2; +const U32 STATUS_SEARCH_PLACES_SEARCHDISABLED = 0x1 << 3; +const U32 STATUS_SEARCH_PLACES_ESTATEEMPTY = 0x1 << 4; +// Events +const U32 STATUS_SEARCH_EVENTS_NONE = 0x0; +const U32 STATUS_SEARCH_EVENTS_BANNEDWORD = 0x1 << 0; +const U32 STATUS_SEARCH_EVENTS_SHORTSTRING = 0x1 << 1; +const U32 STATUS_SEARCH_EVENTS_FOUNDNONE = 0x1 << 2; +const U32 STATUS_SEARCH_EVENTS_SEARCHDISABLED = 0x1 << 3; +const U32 STATUS_SEARCH_EVENTS_NODATEOFFSET = 0x1 << 4; +const U32 STATUS_SEARCH_EVENTS_NOCATEGORY = 0x1 << 5; +const U32 STATUS_SEARCH_EVENTS_NOQUERY = 0x1 << 6; + +//Classifieds +const U32 STATUS_SEARCH_CLASSIFIEDS_NONE = 0x0; +const U32 STATUS_SEARCH_CLASSIFIEDS_BANNEDWORD = 0x1 << 0; +const U32 STATUS_SEARCH_CLASSIFIEDS_SHORTSTRING = 0x1 << 1; +const U32 STATUS_SEARCH_CLASSIFIEDS_FOUNDNONE = 0x1 << 2; +const U32 STATUS_SEARCH_CLASSIFIEDS_SEARCHDISABLED = 0x1 << 3; + #endif diff --git a/linden/indra/llmessage/llregionflags.h b/linden/indra/llmessage/llregionflags.h index 4c47199..2324785 100644 --- a/linden/indra/llmessage/llregionflags.h +++ b/linden/indra/llmessage/llregionflags.h @@ -17,7 +17,8 @@ * 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 + * 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, @@ -60,8 +61,10 @@ const U32 REGION_FLAGS_BLOCK_LAND_RESELL = (1 << 7); // All content wiped once per night const U32 REGION_FLAGS_SANDBOX = (1 << 8); const U32 REGION_FLAGS_NULL_LAYER = (1 << 9); -const U32 REGION_FLAGS_SKIP_AGENT_ACTION = (1 << 10); -const U32 REGION_FLAGS_SKIP_UPDATE_INTEREST_LIST= (1 << 11); +// const U32 REGION_FLAGS_SKIP_AGENT_ACTION = (1 << 10); +const U32 REGION_FLAGS_HARD_ALLOW_LAND_TRANSFER = (1 << 10); // Region allows land reselling +// const U32 REGION_FLAGS_SKIP_UPDATE_INTEREST_LIST= (1 << 11); +const U32 REGION_FLAGS_HARD_ALLOW_POST_CLASSIFIED = (1 << 11); // Region allows posting of classified ads const U32 REGION_FLAGS_SKIP_COLLISIONS = (1 << 12); // Pin all non agent rigid bodies const U32 REGION_FLAGS_SKIP_SCRIPTS = (1 << 13); const U32 REGION_FLAGS_SKIP_PHYSICS = (1 << 14); // Skip all physics diff --git a/linden/indra/llmessage/llregionhandle.h b/linden/indra/llmessage/llregionhandle.h index 80b79cd..da899cd 100644 --- a/linden/indra/llmessage/llregionhandle.h +++ b/linden/indra/llmessage/llregionhandle.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/llregionpresenceverifier.cpp b/linden/indra/llmessage/llregionpresenceverifier.cpp new file mode 100644 index 0000000..24410a7 --- /dev/null +++ b/linden/indra/llmessage/llregionpresenceverifier.cpp @@ -0,0 +1,98 @@ +/** + * @file + * @brief + * + * $LicenseInfo:firstyear=2008&license=viewergpl$ + * + * Copyright (c) 2008-2009, 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 "llregionpresenceverifier.h" +#include "llhttpclientinterface.h" +#include +#include "net.h" +#include "message.h" + + +LLRegionPresenceVerifier::RegionResponder::RegionResponder(ResponsePtr data) : mSharedData(data) +{ +} + + +void LLRegionPresenceVerifier::RegionResponder::result(const LLSD& content) +{ + std::string host = content["private_host"].asString(); + U32 port = content["private_port"].asInteger(); + LLHost destination(host, port); + LLUUID id = content["region_id"]; + + llinfos << "Verifying " << destination.getString() << " is region " << id << llendl; + + std::stringstream uri; + uri << "http://" << destination.getString() << "/state/basic"; + mSharedData->getHttpClient().get(uri.str(), new VerifiedDestinationResponder(mSharedData, content)); +} + +void LLRegionPresenceVerifier::RegionResponder::completed( + U32 status, + const std::string& reason, + const LLSD& content) +{ + LLHTTPClient::Responder::completed(status, reason, content); + + mSharedData->onCompletedRegionRequest(); +} + + +LLRegionPresenceVerifier::VerifiedDestinationResponder::VerifiedDestinationResponder(ResponsePtr data, const LLSD& content) : mSharedData(data), mContent(content) +{ +} + + + + +void LLRegionPresenceVerifier::VerifiedDestinationResponder::result(const LLSD& content) +{ + LLUUID actual_region_id = content["region_id"]; + LLUUID expected_region_id = mContent["region_id"]; + + if (mSharedData->checkValidity(content)) + { + mSharedData->onRegionVerified(mContent); + } + else if ((mSharedData->shouldRetry()) && (actual_region_id != expected_region_id)) // If the region is correct, then it means we've deliberately changed the data + { + LLSD headers; + headers["Cache-Control"] = "no-cache, max-age=0"; + llinfos << "Requesting region information, get uncached for region " << mSharedData->getRegionUri() << llendl; + mSharedData->decrementRetries(); + mSharedData->getHttpClient().get(mSharedData->getRegionUri(), new RegionResponder(mSharedData), headers); + } + else + { + llwarns << "Could not correctly look up region from region presence service. Region: " << mSharedData->getRegionUri() << llendl; + } +} diff --git a/linden/indra/llmessage/llregionpresenceverifier.h b/linden/indra/llmessage/llregionpresenceverifier.h new file mode 100644 index 0000000..54a7cce --- /dev/null +++ b/linden/indra/llmessage/llregionpresenceverifier.h @@ -0,0 +1,92 @@ +/** + * @file + * @brief + * + * $LicenseInfo:firstyear=2008&license=viewergpl$ + * + * Copyright (c) 2008-2009, 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$ + */ + +/* Macro Definitions */ +#ifndef LL_LLREGIONPRESENCEVERIFIER_H +#define LL_LLREGIONPRESENCEVERIFIER_H + +#include "llhttpclient.h" +#include +#include "llsd.h" +#include + +class LLHTTPClientInterface; + +class LLRegionPresenceVerifier +{ +public: + class Response + { + public: + virtual ~Response() {} + + virtual bool checkValidity(const LLSD& content) const = 0; + virtual void onRegionVerified(const LLSD& region_details) = 0; + + virtual void decrementRetries() = 0; + + virtual LLHTTPClientInterface& getHttpClient() = 0; + virtual std::string getRegionUri() const = 0; + virtual bool shouldRetry() const = 0; + + virtual void onCompletedRegionRequest() {} + }; + + typedef boost::shared_ptr ResponsePtr; + + class RegionResponder : public LLHTTPClient::Responder + { + public: + RegionResponder(ResponsePtr data); + virtual void result(const LLSD& content); + virtual void completed( + U32 status, + const std::string& reason, + const LLSD& content); + + private: + ResponsePtr mSharedData; + }; + + class VerifiedDestinationResponder : public LLHTTPClient::Responder + { + public: + VerifiedDestinationResponder(ResponsePtr data, const LLSD& content); + virtual void result(const LLSD& content); + private: + ResponsePtr mSharedData; + LLSD mContent; + }; +}; + + +#endif //LL_LLREGIONPRESENCEVERIFIER_H diff --git a/linden/indra/llmessage/llsdappservices.cpp b/linden/indra/llmessage/llsdappservices.cpp index a051b4f..dc135c5 100644 --- a/linden/indra/llmessage/llsdappservices.cpp +++ b/linden/indra/llmessage/llsdappservices.cpp @@ -18,7 +18,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/llsdappservices.h b/linden/indra/llmessage/llsdappservices.h index 71d7c4a..8f145e8 100644 --- a/linden/indra/llmessage/llsdappservices.h +++ b/linden/indra/llmessage/llsdappservices.h @@ -19,7 +19,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/llsdhttpserver.cpp b/linden/indra/llmessage/llsdhttpserver.cpp index 9249d0a..00fc170 100644 --- a/linden/indra/llmessage/llsdhttpserver.cpp +++ b/linden/indra/llmessage/llsdhttpserver.cpp @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/llsdhttpserver.h b/linden/indra/llmessage/llsdhttpserver.h index 432cd59..63ec195 100644 --- a/linden/indra/llmessage/llsdhttpserver.h +++ b/linden/indra/llmessage/llsdhttpserver.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/llsdmessagebuilder.cpp b/linden/indra/llmessage/llsdmessagebuilder.cpp index d709f91..21937f0 100755 --- a/linden/indra/llmessage/llsdmessagebuilder.cpp +++ b/linden/indra/llmessage/llsdmessagebuilder.cpp @@ -17,7 +17,8 @@ * 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 + * 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, @@ -267,10 +268,125 @@ void LLSDMessageBuilder::copyFromMessageData(const LLMsgData& data) for(; dit != dend; ++dit) { - //const LLMsgVarData& mvci = *dit; - - // TODO: Copy mvci data in to block: - // (*mCurrentBlock)[varname] = v; + const LLMsgVarData& mvci = *dit; + const char* varname = mvci.getName(); + + switch(mvci.getType()) + { + case MVT_FIXED: + addBinaryData(varname, mvci.getData(), mvci.getSize()); + break; + + case MVT_VARIABLE: + { + const char end = ((const char*)mvci.getData())[mvci.getSize()-1]; // Ensure null terminated + if (mvci.getDataSize() == 1 && end == 0) + { + addString(varname, (const char*)mvci.getData()); + } + else + { + addBinaryData(varname, mvci.getData(), mvci.getSize()); + } + break; + } + + case MVT_U8: + addU8(varname, *(U8*)mvci.getData()); + break; + + case MVT_U16: + addU16(varname, *(U16*)mvci.getData()); + break; + + case MVT_U32: + addU32(varname, *(U32*)mvci.getData()); + break; + + case MVT_U64: + addU64(varname, *(U64*)mvci.getData()); + break; + + case MVT_S8: + addS8(varname, *(S8*)mvci.getData()); + break; + + case MVT_S16: + addS16(varname, *(S16*)mvci.getData()); + break; + + case MVT_S32: + addS32(varname, *(S32*)mvci.getData()); + break; + + // S64 not supported in LLSD so we just truncate it + case MVT_S64: + addS32(varname, *(S64*)mvci.getData()); + break; + + case MVT_F32: + addF32(varname, *(F32*)mvci.getData()); + break; + + case MVT_F64: + addF64(varname, *(F64*)mvci.getData()); + break; + + case MVT_LLVector3: + addVector3(varname, *(LLVector3*)mvci.getData()); + break; + + case MVT_LLVector3d: + addVector3d(varname, *(LLVector3d*)mvci.getData()); + break; + + case MVT_LLVector4: + addVector4(varname, *(LLVector4*)mvci.getData()); + break; + + case MVT_LLQuaternion: + { + LLVector3 v = *(LLVector3*)mvci.getData(); + LLQuaternion q; + q.unpackFromVector3(v); + addQuat(varname, q); + break; + } + + case MVT_LLUUID: + addUUID(varname, *(LLUUID*)mvci.getData()); + break; + + case MVT_BOOL: + addBOOL(varname, *(BOOL*)mvci.getData()); + break; + + case MVT_IP_ADDR: + addIPAddr(varname, *(U32*)mvci.getData()); + break; + + case MVT_IP_PORT: + addIPPort(varname, *(U16*)mvci.getData()); + break; + + case MVT_U16Vec3: + //treated as an array of 6 bytes + addBinaryData(varname, mvci.getData(), 6); + break; + + case MVT_U16Quat: + //treated as an array of 8 bytes + addBinaryData(varname, mvci.getData(), 8); + break; + + case MVT_S16Array: + addBinaryData(varname, mvci.getData(), mvci.getSize()); + break; + + default: + llwarns << "Unknown type in conversion of message to LLSD" << llendl; + break; + } } } } diff --git a/linden/indra/llmessage/llsdmessagebuilder.h b/linden/indra/llmessage/llsdmessagebuilder.h index 3bebef7..ef9ca35 100755 --- a/linden/indra/llmessage/llsdmessagebuilder.h +++ b/linden/indra/llmessage/llsdmessagebuilder.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/llsdmessagereader.cpp b/linden/indra/llmessage/llsdmessagereader.cpp index 2cf74e8..e699ec9 100755 --- a/linden/indra/llmessage/llsdmessagereader.cpp +++ b/linden/indra/llmessage/llsdmessagereader.cpp @@ -17,7 +17,8 @@ * 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 + * 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, @@ -107,6 +108,12 @@ void LLSDMessageReader::getBinaryData(const char *block, const char *var, data_size = max_size; } + // Calls to memcpy will fail if data_size is not positive. + // Phoenix 2009-02-27 + if(data_size <= 0) + { + return; + } memcpy(datap, &(data[0]), data_size); } diff --git a/linden/indra/llmessage/llsdmessagereader.h b/linden/indra/llmessage/llsdmessagereader.h index 2f824d3..7b38659 100755 --- a/linden/indra/llmessage/llsdmessagereader.h +++ b/linden/indra/llmessage/llsdmessagereader.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/llsdrpcclient.cpp b/linden/indra/llmessage/llsdrpcclient.cpp index 4b2f069..3f36d23 100644 --- a/linden/indra/llmessage/llsdrpcclient.cpp +++ b/linden/indra/llmessage/llsdrpcclient.cpp @@ -19,7 +19,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/llsdrpcclient.h b/linden/indra/llmessage/llsdrpcclient.h index 447af00..7d2d21e 100644 --- a/linden/indra/llmessage/llsdrpcclient.h +++ b/linden/indra/llmessage/llsdrpcclient.h @@ -19,7 +19,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/llsdrpcserver.cpp b/linden/indra/llmessage/llsdrpcserver.cpp index f81f9a8..0c92e7d 100644 --- a/linden/indra/llmessage/llsdrpcserver.cpp +++ b/linden/indra/llmessage/llsdrpcserver.cpp @@ -19,7 +19,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/llsdrpcserver.h b/linden/indra/llmessage/llsdrpcserver.h index dd54ad4..9307323 100644 --- a/linden/indra/llmessage/llsdrpcserver.h +++ b/linden/indra/llmessage/llsdrpcserver.h @@ -19,7 +19,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/llservice.cpp b/linden/indra/llmessage/llservice.cpp index d9e70dd..9824c19 100644 --- a/linden/indra/llmessage/llservice.cpp +++ b/linden/indra/llmessage/llservice.cpp @@ -18,7 +18,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/llservice.h b/linden/indra/llmessage/llservice.h index 0e37221..ab5abe0 100644 --- a/linden/indra/llmessage/llservice.h +++ b/linden/indra/llmessage/llservice.h @@ -19,7 +19,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/llservicebuilder.cpp b/linden/indra/llmessage/llservicebuilder.cpp index 39f2f85..3f07147 100644 --- a/linden/indra/llmessage/llservicebuilder.cpp +++ b/linden/indra/llmessage/llservicebuilder.cpp @@ -17,7 +17,8 @@ * 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 + * 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, @@ -85,6 +86,14 @@ void LLServiceBuilder::createServiceDefinition( } } +static +bool starts_with(const std::string& text, const char* prefix) +{ + return text.substr(0, strlen(prefix)) == prefix; +} + +// TODO: Build a real services.xml for windows development. +// and remove the base_url logic below. std::string LLServiceBuilder::buildServiceURI(const std::string& service_name) { std::ostringstream service_url; @@ -95,7 +104,19 @@ std::string LLServiceBuilder::buildServiceURI(const std::string& service_name) LLApp* app = LLApp::instance(); if(app) { - LLSD base_url = app->getOption("services-base-url"); + // We define a base-url for some development configurations + // In production neither of these are defined and all services have full urls + LLSD base_url; + + if (starts_with(service_name,"cap")) + { + base_url = app->getOption("cap-base-url"); + } + + if (base_url.asString().empty()) + { + base_url = app->getOption("services-base-url"); + } service_url << base_url.asString(); } service_url << mServiceMap[service_name]; diff --git a/linden/indra/llmessage/llservicebuilder.h b/linden/indra/llmessage/llservicebuilder.h index 9b4c925..40061a0 100644 --- a/linden/indra/llmessage/llservicebuilder.h +++ b/linden/indra/llmessage/llservicebuilder.h @@ -17,7 +17,8 @@ * 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 +* 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, diff --git a/linden/indra/llmessage/llstoredmessage.cpp b/linden/indra/llmessage/llstoredmessage.cpp new file mode 100644 index 0000000..32cbb15 --- /dev/null +++ b/linden/indra/llmessage/llstoredmessage.cpp @@ -0,0 +1,38 @@ +/** + * @file + * @brief + * + * $LicenseInfo:firstyear=2009&license=viewergpl$ + * + * Copyright (c) 2009, 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 "llstoredmessage.h" + +LLStoredMessage::LLStoredMessage(const std::string& name, const LLSD& message) : mMessage(message), mName(name) +{ +} + diff --git a/linden/indra/llmessage/llstoredmessage.h b/linden/indra/llmessage/llstoredmessage.h new file mode 100644 index 0000000..5069c2c --- /dev/null +++ b/linden/indra/llmessage/llstoredmessage.h @@ -0,0 +1,58 @@ +/** + * @file + * @brief + * + * $LicenseInfo:firstyear=2009&license=viewergpl$ + * + * Copyright (c) 2009, 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_STOREDMESSAGE_H +#define LL_STOREDMESSAGE_H + +#include "linden_common.h" +#include "llsd.h" +#include +#include + + +class LLMessageSystem; + +class LLStoredMessage +{ +public: + LLStoredMessage(const std::string& name, const LLSD& message); +private: + friend class LLMessageSystem; + + LLSD mMessage; + std::string mName; +}; + +typedef boost::shared_ptr LLStoredMessagePtr; + + +#endif // LL_STOREDMESSAGE_H diff --git a/linden/indra/llmessage/lltaskname.h b/linden/indra/llmessage/lltaskname.h index cae642d..401d355 100644 --- a/linden/indra/llmessage/lltaskname.h +++ b/linden/indra/llmessage/lltaskname.h @@ -18,7 +18,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/llteleportflags.h b/linden/indra/llmessage/llteleportflags.h index 1eb5a74..c418865 100644 --- a/linden/indra/llmessage/llteleportflags.h +++ b/linden/indra/llmessage/llteleportflags.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/lltemplatemessagebuilder.cpp b/linden/indra/llmessage/lltemplatemessagebuilder.cpp index 2d8f3cf..e641980 100644 --- a/linden/indra/llmessage/lltemplatemessagebuilder.cpp +++ b/linden/indra/llmessage/lltemplatemessagebuilder.cpp @@ -17,7 +17,8 @@ * 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 + * 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, @@ -40,7 +41,7 @@ #include "v3math.h" #include "v4math.h" -LLTemplateMessageBuilder::LLTemplateMessageBuilder(message_template_name_map_t& name_template_map) : +LLTemplateMessageBuilder::LLTemplateMessageBuilder(const message_template_name_map_t& name_template_map) : mCurrentSMessageData(NULL), mCurrentSMessageTemplate(NULL), mCurrentSDataBlock(NULL), @@ -74,14 +75,14 @@ void LLTemplateMessageBuilder::newMessage(const char *name) char* namep = (char*)name; if (mMessageTemplates.count(namep) > 0) { - mCurrentSMessageTemplate = mMessageTemplates[namep]; + mCurrentSMessageTemplate = mMessageTemplates.find(name)->second; mCurrentSMessageData = new LLMsgData(namep); mCurrentSMessageName = namep; mCurrentSDataBlock = NULL; mCurrentSBlockName = NULL; // add at one of each block - const LLMessageTemplate* msg_template = mMessageTemplates[namep]; + const LLMessageTemplate* msg_template = mMessageTemplates.find(name)->second; if (msg_template->getDeprecation() != MD_NOTDEPRECATED) { diff --git a/linden/indra/llmessage/lltemplatemessagebuilder.h b/linden/indra/llmessage/lltemplatemessagebuilder.h index f4048fa..96e7ae1 100644 --- a/linden/indra/llmessage/lltemplatemessagebuilder.h +++ b/linden/indra/llmessage/lltemplatemessagebuilder.h @@ -17,7 +17,8 @@ * 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 + * 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, @@ -48,7 +49,7 @@ public: typedef std::map message_template_name_map_t; - LLTemplateMessageBuilder(message_template_name_map_t&); + LLTemplateMessageBuilder(const message_template_name_map_t&); virtual ~LLTemplateMessageBuilder(); virtual void newMessage(const char* name); @@ -98,6 +99,7 @@ public: virtual void copyFromMessageData(const LLMsgData& data); virtual void copyFromLLSD(const LLSD&); + LLMsgData* getCurrentMessage() const { return mCurrentSMessageData; } private: void addData(const char* varname, const void* data, EMsgVariableType type, S32 size); @@ -113,7 +115,7 @@ private: BOOL mbSBuilt; BOOL mbSClear; S32 mCurrentSendTotal; - message_template_name_map_t& mMessageTemplates; + const message_template_name_map_t& mMessageTemplates; }; #endif // LL_LLTEMPLATEMESSAGEBUILDER_H diff --git a/linden/indra/llmessage/lltemplatemessagedispatcher.cpp b/linden/indra/llmessage/lltemplatemessagedispatcher.cpp new file mode 100644 index 0000000..ab1beb3 --- /dev/null +++ b/linden/indra/llmessage/lltemplatemessagedispatcher.cpp @@ -0,0 +1,73 @@ +/** + * @file lltemplatemessagedispatcher.h + * @brief LLTemplateMessageDispatcher class + * + * $LicenseInfo:firstyear=2009&license=viewergpl$ + * + * Copyright (c) 2009, 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 "lltemplatemessagedispatcher.h" + +#include "llhttpnode.h" +#include "llhost.h" +#include "message.h" +#include "llsd.h" +#include "lltemplatemessagereader.h" + + +LLTemplateMessageDispatcher::LLTemplateMessageDispatcher(LLTemplateMessageReader &template_message_reader) : + mTemplateMessageReader(template_message_reader) +{ +} + +void LLTemplateMessageDispatcher::dispatch(const std::string& msg_name, + const LLSD& message, + LLHTTPNode::ResponsePtr responsep) +{ + std::vector data = message["body"]["binary-template-data"].asBinary(); + U32 size = data.size(); + if(size == 0) + { + return; + } + + LLHost host; + host = gMessageSystem->getSender(); + + bool validate_message = mTemplateMessageReader.validateMessage(&(data[0]), data.size(), host, true); + + if (validate_message) + { + mTemplateMessageReader.readMessage(&(data[0]),host); + } + else + { + gMessageSystem->clearReceiveState(); + } +} + diff --git a/linden/indra/llmessage/lltemplatemessagedispatcher.h b/linden/indra/llmessage/lltemplatemessagedispatcher.h new file mode 100644 index 0000000..fa861e4 --- /dev/null +++ b/linden/indra/llmessage/lltemplatemessagedispatcher.h @@ -0,0 +1,54 @@ +/** + * @file lltemplatemessagedispatcher.h + * @brief LLTemplateMessageDispatcher class + * + * $LicenseInfo:firstyear=2009&license=viewergpl$ + * + * Copyright (c) 2009, 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 LLTEMPLATEMESSAGEDISPATCHER_H +#define LLTEMPLATEMESSAGEDISPATCHER_H + +#include "linden_common.h" +#include "llsd.h" +#include "llhttpnode.h" +#include "lltemplatemessagereader.h" + + +class LLTemplateMessageDispatcher +{ +public: + LLTemplateMessageDispatcher(LLTemplateMessageReader& template_message_reader); + void dispatch(const std::string& msg_name, + const LLSD& message, + LLHTTPNode::ResponsePtr responsep); + +private: + LLTemplateMessageReader &mTemplateMessageReader; +}; + +#endif // LLTEMPLATEMESSAGEDISPATCHER_H diff --git a/linden/indra/llmessage/lltemplatemessagereader.cpp b/linden/indra/llmessage/lltemplatemessagereader.cpp index 7a7d3bb..af04956 100644 --- a/linden/indra/llmessage/lltemplatemessagereader.cpp +++ b/linden/indra/llmessage/lltemplatemessagereader.cpp @@ -17,7 +17,8 @@ * 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 + * 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, @@ -181,15 +182,15 @@ S32 LLTemplateMessageReader::getSize(const char *blockname, const char *varname) { // is there a message ready to go? if (mReceiveSize == -1) - { + { // This is a serious error - crash llerrs << "No message waiting for decode 4!" << llendl; - return -1; + return LL_MESSAGE_ERROR; } if (!mCurrentRMessageData) - { + { // This is a serious error - crash llerrs << "Invalid mCurrentRMessageData in getData!" << llendl; - return -1; + return LL_MESSAGE_ERROR; } char *bnamep = (char *)blockname; @@ -197,10 +198,10 @@ S32 LLTemplateMessageReader::getSize(const char *blockname, const char *varname) LLMsgData::msg_blk_data_map_t::const_iterator iter = mCurrentRMessageData->mMemberBlocks.find(bnamep); if (iter == mCurrentRMessageData->mMemberBlocks.end()) - { - llerrs << "Block " << bnamep << " not in message " + { // don't crash + llinfos << "Block " << bnamep << " not in message " << mCurrentRMessageData->mName << llendl; - return -1; + return LL_BLOCK_NOT_IN_MESSAGE; } char *vnamep = (char *)varname; @@ -209,17 +210,17 @@ S32 LLTemplateMessageReader::getSize(const char *blockname, const char *varname) LLMsgVarData& vardata = msg_data->mMemberVarData[vnamep]; if (!vardata.getName()) - { - llerrs << "Variable " << varname << " not in message " + { // don't crash + llinfos << "Variable " << varname << " not in message " << mCurrentRMessageData->mName << " block " << bnamep << llendl; - return -1; + return LL_VARIABLE_NOT_IN_BLOCK; } if (mCurrentRMessageTemplate->mMemberBlocks[bnamep]->mType != MBT_SINGLE) - { + { // This is a serious error - crash llerrs << "Block " << bnamep << " isn't type MBT_SINGLE," " use getSize with blocknum argument!" << llendl; - return -1; + return LL_MESSAGE_ERROR; } return vardata.getSize(); @@ -229,15 +230,15 @@ S32 LLTemplateMessageReader::getSize(const char *blockname, S32 blocknum, const { // is there a message ready to go? if (mReceiveSize == -1) - { + { // This is a serious error - crash llerrs << "No message waiting for decode 5!" << llendl; - return -1; + return LL_MESSAGE_ERROR; } if (!mCurrentRMessageData) - { + { // This is a serious error - crash llerrs << "Invalid mCurrentRMessageData in getData!" << llendl; - return -1; + return LL_MESSAGE_ERROR; } char *bnamep = (char *)blockname + blocknum; @@ -246,20 +247,20 @@ S32 LLTemplateMessageReader::getSize(const char *blockname, S32 blocknum, const LLMsgData::msg_blk_data_map_t::const_iterator iter = mCurrentRMessageData->mMemberBlocks.find(bnamep); if (iter == mCurrentRMessageData->mMemberBlocks.end()) - { - llerrs << "Block " << bnamep << " not in message " + { // don't crash + llinfos << "Block " << bnamep << " not in message " << mCurrentRMessageData->mName << llendl; - return -1; + return LL_BLOCK_NOT_IN_MESSAGE; } LLMsgBlkData* msg_data = iter->second; LLMsgVarData& vardata = msg_data->mMemberVarData[vnamep]; if (!vardata.getName()) - { - llerrs << "Variable " << vnamep << " not in message " + { // don't crash + llinfos << "Variable " << vnamep << " not in message " << mCurrentRMessageData->mName << " block " << bnamep << llendl; - return -1; + return LL_VARIABLE_NOT_IN_BLOCK; } return vardata.getSize(); @@ -754,18 +755,38 @@ BOOL LLTemplateMessageReader::decodeData(const U8* buffer, const LLHost& sender BOOL LLTemplateMessageReader::validateMessage(const U8* buffer, S32 buffer_size, - const LLHost& sender) + const LLHost& sender, + bool trusted) { mReceiveSize = buffer_size; - BOOL result = decodeTemplate(buffer, buffer_size, &mCurrentRMessageTemplate ); - if(result) + BOOL valid = decodeTemplate(buffer, buffer_size, &mCurrentRMessageTemplate ); + if(valid) { mCurrentRMessageTemplate->mReceiveCount++; - //lldebugs << "MessageRecvd:" + //lldebugs << "MessageRecvd:" // << mCurrentRMessageTemplate->mName // << " from " << sender << llendl; } - return result; + + if (valid && isBanned(trusted)) + { + LL_WARNS("Messaging") << "LLMessageSystem::checkMessages " + << "received banned message " + << getMessageName() + << " from " + << ((trusted) ? "trusted " : "untrusted ") + << sender << llendl; + valid = FALSE; + } + + if(valid && isUdpBanned()) + { + llwarns << "Received UDP black listed message " + << getMessageName() + << " from " << sender << llendl; + valid = FALSE; + } + return valid; } BOOL LLTemplateMessageReader::readMessage(const U8* buffer, diff --git a/linden/indra/llmessage/lltemplatemessagereader.h b/linden/indra/llmessage/lltemplatemessagereader.h index 15b2a91..ab06ab4 100644 --- a/linden/indra/llmessage/lltemplatemessagereader.h +++ b/linden/indra/llmessage/lltemplatemessagereader.h @@ -17,7 +17,8 @@ * 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 + * 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, @@ -104,7 +105,7 @@ public: virtual void copyToBuilder(LLMessageBuilder&) const; BOOL validateMessage(const U8* buffer, S32 buffer_size, - const LLHost& sender); + const LLHost& sender, bool trusted = false); BOOL readMessage(const U8* buffer, const LLHost& sender); bool isTrusted() const; diff --git a/linden/indra/llmessage/llthrottle.cpp b/linden/indra/llmessage/llthrottle.cpp index 78258f5..70279a3 100644 --- a/linden/indra/llmessage/llthrottle.cpp +++ b/linden/indra/llmessage/llthrottle.cpp @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/llthrottle.h b/linden/indra/llmessage/llthrottle.h index 7e2d024..7d1679b 100644 --- a/linden/indra/llmessage/llthrottle.h +++ b/linden/indra/llmessage/llthrottle.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/lltransfermanager.cpp b/linden/indra/llmessage/lltransfermanager.cpp index 2c08163..d67911e 100644 --- a/linden/indra/llmessage/lltransfermanager.cpp +++ b/linden/indra/llmessage/lltransfermanager.cpp @@ -18,7 +18,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/lltransfermanager.h b/linden/indra/llmessage/lltransfermanager.h index ef5f530..0bb52f1 100644 --- a/linden/indra/llmessage/lltransfermanager.h +++ b/linden/indra/llmessage/lltransfermanager.h @@ -18,7 +18,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/lltransfersourceasset.cpp b/linden/indra/llmessage/lltransfersourceasset.cpp index b9354ec..a4d5927 100644 --- a/linden/indra/llmessage/lltransfersourceasset.cpp +++ b/linden/indra/llmessage/lltransfersourceasset.cpp @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/lltransfersourceasset.h b/linden/indra/llmessage/lltransfersourceasset.h index e372730..70b09b6 100644 --- a/linden/indra/llmessage/lltransfersourceasset.h +++ b/linden/indra/llmessage/lltransfersourceasset.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/lltransfersourcefile.cpp b/linden/indra/llmessage/lltransfersourcefile.cpp index 795434a..ec0eaf1 100644 --- a/linden/indra/llmessage/lltransfersourcefile.cpp +++ b/linden/indra/llmessage/lltransfersourcefile.cpp @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/lltransfersourcefile.h b/linden/indra/llmessage/lltransfersourcefile.h index b095b7c..004a3ee 100644 --- a/linden/indra/llmessage/lltransfersourcefile.h +++ b/linden/indra/llmessage/lltransfersourcefile.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/lltransfertargetfile.cpp b/linden/indra/llmessage/lltransfertargetfile.cpp index 6d1aac5..445e4f1 100644 --- a/linden/indra/llmessage/lltransfertargetfile.cpp +++ b/linden/indra/llmessage/lltransfertargetfile.cpp @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/lltransfertargetfile.h b/linden/indra/llmessage/lltransfertargetfile.h index 52c4ebb..18b9b52 100644 --- a/linden/indra/llmessage/lltransfertargetfile.h +++ b/linden/indra/llmessage/lltransfertargetfile.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/lltransfertargetvfile.cpp b/linden/indra/llmessage/lltransfertargetvfile.cpp index f6c272e..e9bf2ba 100644 --- a/linden/indra/llmessage/lltransfertargetvfile.cpp +++ b/linden/indra/llmessage/lltransfertargetvfile.cpp @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/lltransfertargetvfile.h b/linden/indra/llmessage/lltransfertargetvfile.h index c1011ca..8c2bc7e 100644 --- a/linden/indra/llmessage/lltransfertargetvfile.h +++ b/linden/indra/llmessage/lltransfertargetvfile.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/lltrustedmessageservice.cpp b/linden/indra/llmessage/lltrustedmessageservice.cpp new file mode 100644 index 0000000..505ece5 --- /dev/null +++ b/linden/indra/llmessage/lltrustedmessageservice.cpp @@ -0,0 +1,90 @@ +/** + * @file lltrustedmessageservice.cpp + * @brief LLTrustedMessageService implementation + * + * $LicenseInfo:firstyear=2009&license=viewergpl$ + * + * Copyright (c) 2009, 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 "lltrustedmessageservice.h" +#include "llhost.h" +#include "llmessageconfig.h" +#include "message.h" + + +bool LLTrustedMessageService::validate(const std::string& name, LLSD& context) +const +{ + return true; +} + +void LLTrustedMessageService::post(LLHTTPNode::ResponsePtr response, + const LLSD& context, + const LLSD& input) const +{ + std::string name = context["request"]["wildcard"]["message-name"]; + std::string senderIP = context["request"]["remote-host"]; + std::string senderPort = context["request"]["headers"] + ["x-secondlife-udp-listen-port"]; + + LLSD message_data; + std::string sender = senderIP + ":" + senderPort; + message_data["sender"] = sender; + message_data["body"] = input; + + // untrusted senders should not have access to the trusted message + // service, but this can happen in development, so check and warn + LLMessageConfig::SenderTrust trust = + LLMessageConfig::getSenderTrustedness(name); + if ((trust == LLMessageConfig::TRUSTED || + (trust == LLMessageConfig::NOT_SET && + gMessageSystem->isTrustedMessage(name))) + && !gMessageSystem->isTrustedSender(LLHost(sender))) + { + LL_WARNS("Messaging") << "trusted message POST to /trusted-message/" + << name << " from unknown or untrusted sender " + << sender << llendl; + response->status(403, "Unknown or untrusted sender"); + } + else + { + gMessageSystem->receivedMessageFromTrustedSender(); + if (input.has("binary-template-data")) + { + llinfos << "Dispatching template: " << input << llendl; + // try and send this message using udp dispatch + LLMessageSystem::dispatchTemplate(name, message_data, response); + } + else + { + llinfos << "Dispatching without template: " << input << llendl; + LLMessageSystem::dispatch(name, message_data, response); + } + } +} diff --git a/linden/indra/llmessage/lltrustedmessageservice.h b/linden/indra/llmessage/lltrustedmessageservice.h new file mode 100644 index 0000000..dc37702 --- /dev/null +++ b/linden/indra/llmessage/lltrustedmessageservice.h @@ -0,0 +1,52 @@ +/** + * @file lltrustedmessageservice.h + * @brief LLTrustedMessageService class + * + * $LicenseInfo:firstyear=2009&license=viewergpl$ + * + * Copyright (c) 2009, 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 LLTRUSTEDMESSAGESERVICE_H +#define LLTRUSTEDMESSAGESERVICE_H + +#include "linden_common.h" +#include "llhttpnode.h" + +class LLSD; + +class LLTrustedMessageService +{ +public: + + bool validate(const std::string& name, LLSD& context) const; + + void post(LLHTTPNode::ResponsePtr response, + const LLSD& context, + const LLSD& input) const; +}; + +#endif // LLTRUSTEDMESSAGESERVICE_H diff --git a/linden/indra/llmessage/llurlrequest.cpp b/linden/indra/llmessage/llurlrequest.cpp index d2f854e..46e976f 100644 --- a/linden/indra/llmessage/llurlrequest.cpp +++ b/linden/indra/llmessage/llurlrequest.cpp @@ -19,7 +19,8 @@ * 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 + * 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, @@ -43,7 +44,7 @@ #include "llsd.h" #include "llstring.h" #include "apr_env.h" - +#include "llapr.h" static const U32 HTTP_STATUS_PIPE_ERROR = 499; /** @@ -165,18 +166,16 @@ void LLURLRequest::useProxy(bool use_proxy) if (use_proxy && (env_proxy == NULL)) { apr_status_t status; - apr_pool_t* pool; - apr_pool_create(&pool, NULL); - status = apr_env_get(&env_proxy, "ALL_PROXY", pool); + LLAPRPool pool; + status = apr_env_get(&env_proxy, "ALL_PROXY", pool.getAPRPool()); if (status != APR_SUCCESS) { - status = apr_env_get(&env_proxy, "http_proxy", pool); + status = apr_env_get(&env_proxy, "http_proxy", pool.getAPRPool()); } if (status != APR_SUCCESS) { use_proxy = FALSE; } - apr_pool_destroy(pool); } @@ -501,33 +500,25 @@ static size_t headerCallback(void* data, size_t size, size_t nmemb, void* user) std::string header(header_line, header_len); // Per HTTP spec the first header line must be the status line. - if (!complete->haveHTTPStatus()) + if (header.substr(0,5) == "HTTP/") { - if (header.substr(0,5) == "HTTP/") + std::string::iterator end = header.end(); + std::string::iterator pos1 = std::find(header.begin(), end, ' '); + if (pos1 != end) ++pos1; + std::string::iterator pos2 = std::find(pos1, end, ' '); + if (pos2 != end) ++pos2; + std::string::iterator pos3 = std::find(pos2, end, '\r'); + + std::string version(header.begin(), pos1); + std::string status(pos1, pos2); + std::string reason(pos2, pos3); + + S32 status_code = atoi(status.c_str()); + if (status_code > 0) { - std::string::iterator end = header.end(); - std::string::iterator pos1 = std::find(header.begin(), end, ' '); - if (pos1 != end) ++pos1; - std::string::iterator pos2 = std::find(pos1, end, ' '); - if (pos2 != end) ++pos2; - std::string::iterator pos3 = std::find(pos2, end, '\r'); - - std::string version(header.begin(), pos1); - std::string status(pos1, pos2); - std::string reason(pos2, pos3); - - int statusCode = atoi(status.c_str()); - if (statusCode >= 300 && statusCode < 400) - { - // This is a redirect, ignore it and all headers - // until we find a normal status code. - } - else if (statusCode > 0) - { - complete->httpStatus((U32)statusCode, reason); - } + complete->httpStatus((U32)status_code, reason); + return header_len; } - return header_len; } std::string::iterator sep = std::find(header.begin(),header.end(),':'); @@ -592,8 +583,7 @@ LLIOPipe::EStatus LLContextURLExtractor::process_impl( * LLURLRequestComplete */ LLURLRequestComplete::LLURLRequestComplete() : - mRequestStatus(LLIOPipe::STATUS_ERROR), - mHaveHTTPStatus(false) + mRequestStatus(LLIOPipe::STATUS_ERROR) { LLMemType m1(LLMemType::MTYPE_IO_URL_REQUEST); } @@ -610,12 +600,6 @@ void LLURLRequestComplete::header(const std::string& header, const std::string& } //virtual -void LLURLRequestComplete::httpStatus(U32 status, const std::string& reason) -{ - mHaveHTTPStatus = true; -} - -//virtual void LLURLRequestComplete::complete(const LLChannelDescriptors& channels, const buffer_ptr_t& buffer) { diff --git a/linden/indra/llmessage/llurlrequest.h b/linden/indra/llmessage/llurlrequest.h index c76eec8..d1facbf 100644 --- a/linden/indra/llmessage/llurlrequest.h +++ b/linden/indra/llmessage/llurlrequest.h @@ -19,7 +19,8 @@ * 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 + * 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, @@ -286,11 +287,13 @@ class LLURLRequestComplete : public LLIOPipe { public: + // Called once for each header received, except status lines virtual void header(const std::string& header, const std::string& value); - ///< Called once for each header received, prior to httpStatus - virtual void httpStatus(U32 status, const std::string& reason); - ///< Always called on request completion, prior to complete + // May be called more than once, particularly for redirects and proxy madness. + // Ex. a 200 for a connection to https through a proxy, followed by the "real" status + // a 3xx for a redirect followed by a "real" status, or more redirects. + virtual void httpStatus(U32 status, const std::string& reason) { } virtual void complete( const LLChannelDescriptors& channels, @@ -327,9 +330,6 @@ public: LLURLRequestComplete(); virtual ~LLURLRequestComplete(); - // The first line of an http response must be the status line - // true if we have already parsed this line. - bool haveHTTPStatus() const { return mHaveHTTPStatus; } protected: /* @name LLIOPipe virtual implementations */ @@ -348,8 +348,6 @@ protected: // value to note if we actually got the response. This value // depends on correct useage from the LLURLRequest instance. EStatus mRequestStatus; - - bool mHaveHTTPStatus; }; diff --git a/linden/indra/llmessage/lluseroperation.cpp b/linden/indra/llmessage/lluseroperation.cpp index 4d34e48..9736efe 100644 --- a/linden/indra/llmessage/lluseroperation.cpp +++ b/linden/indra/llmessage/lluseroperation.cpp @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/lluseroperation.h b/linden/indra/llmessage/lluseroperation.h index 814e6bf..b3988c0 100644 --- a/linden/indra/llmessage/lluseroperation.h +++ b/linden/indra/llmessage/lluseroperation.h @@ -18,7 +18,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/llvehicleparams.h b/linden/indra/llmessage/llvehicleparams.h index d37a83f..a839171 100644 --- a/linden/indra/llmessage/llvehicleparams.h +++ b/linden/indra/llmessage/llvehicleparams.h @@ -18,7 +18,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/llxfer.cpp b/linden/indra/llmessage/llxfer.cpp index 6fdd399..8404f65 100644 --- a/linden/indra/llmessage/llxfer.cpp +++ b/linden/indra/llmessage/llxfer.cpp @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/llxfer.h b/linden/indra/llmessage/llxfer.h index 85b3122..bd81462 100644 --- a/linden/indra/llmessage/llxfer.h +++ b/linden/indra/llmessage/llxfer.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/llxfer_file.cpp b/linden/indra/llmessage/llxfer_file.cpp index c7bab07..80bea37 100644 --- a/linden/indra/llmessage/llxfer_file.cpp +++ b/linden/indra/llmessage/llxfer_file.cpp @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/llxfer_file.h b/linden/indra/llmessage/llxfer_file.h index 0b3ee79..df29135 100644 --- a/linden/indra/llmessage/llxfer_file.h +++ b/linden/indra/llmessage/llxfer_file.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/llxfer_mem.cpp b/linden/indra/llmessage/llxfer_mem.cpp index 64889a2..0d81fd5 100644 --- a/linden/indra/llmessage/llxfer_mem.cpp +++ b/linden/indra/llmessage/llxfer_mem.cpp @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/llxfer_mem.h b/linden/indra/llmessage/llxfer_mem.h index b98e8e9..fa1b4cf 100644 --- a/linden/indra/llmessage/llxfer_mem.h +++ b/linden/indra/llmessage/llxfer_mem.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/llxfer_vfile.cpp b/linden/indra/llmessage/llxfer_vfile.cpp index 288c5ff..625cf4a 100644 --- a/linden/indra/llmessage/llxfer_vfile.cpp +++ b/linden/indra/llmessage/llxfer_vfile.cpp @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/llxfer_vfile.h b/linden/indra/llmessage/llxfer_vfile.h index e07326f..8f5b193 100644 --- a/linden/indra/llmessage/llxfer_vfile.h +++ b/linden/indra/llmessage/llxfer_vfile.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/llxfermanager.cpp b/linden/indra/llmessage/llxfermanager.cpp index eea814c..08c9192 100644 --- a/linden/indra/llmessage/llxfermanager.cpp +++ b/linden/indra/llmessage/llxfermanager.cpp @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/llxfermanager.h b/linden/indra/llmessage/llxfermanager.h index 1022bbe..0a83f84 100644 --- a/linden/indra/llmessage/llxfermanager.h +++ b/linden/indra/llmessage/llxfermanager.h @@ -18,7 +18,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/llxorcipher.cpp b/linden/indra/llmessage/llxorcipher.cpp index 7b1c7af..fbcd893 100644 --- a/linden/indra/llmessage/llxorcipher.cpp +++ b/linden/indra/llmessage/llxorcipher.cpp @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/llxorcipher.h b/linden/indra/llmessage/llxorcipher.h index 434c88d..ef2bfd6 100644 --- a/linden/indra/llmessage/llxorcipher.h +++ b/linden/indra/llmessage/llxorcipher.h @@ -16,7 +16,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/machine.h b/linden/indra/llmessage/machine.h index 212334e..63a0381 100644 --- a/linden/indra/llmessage/machine.h +++ b/linden/indra/llmessage/machine.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/mean_collision_data.h b/linden/indra/llmessage/mean_collision_data.h index c7df839..03b96f9 100644 --- a/linden/indra/llmessage/mean_collision_data.h +++ b/linden/indra/llmessage/mean_collision_data.h @@ -18,7 +18,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/message.cpp b/linden/indra/llmessage/message.cpp index ccc3d79..78af35b 100644 --- a/linden/indra/llmessage/message.cpp +++ b/linden/indra/llmessage/message.cpp @@ -17,7 +17,8 @@ * 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 + * 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, @@ -58,13 +59,16 @@ #include "llerrorlegacy.h" #include "llfasttimer.h" #include "llhttpclient.h" +#include "llhttpnodeadapter.h" #include "llhttpsender.h" #include "llmd5.h" #include "llmessagebuilder.h" #include "llmessageconfig.h" +#include "lltemplatemessagedispatcher.h" #include "llpumpio.h" #include "lltemplatemessagebuilder.h" #include "lltemplatemessagereader.h" +#include "lltrustedmessageservice.h" #include "llmessagetemplate.h" #include "llmessagetemplateparser.h" #include "llsd.h" @@ -141,52 +145,6 @@ namespace }; } - -class LLTrustedMessageService : public LLHTTPNode -{ - virtual bool validate(const std::string& name, LLSD& context) const - { return true; } - - virtual void post(LLHTTPNode::ResponsePtr response, - const LLSD& context, - const LLSD& input) const; -}; - -//virtual -void LLTrustedMessageService::post(LLHTTPNode::ResponsePtr response, - const LLSD& context, - const LLSD& input) const -{ - std::string name = context["request"]["wildcard"]["message-name"]; - std::string senderIP = context["request"]["remote-host"]; - std::string senderPort = context["request"]["headers"] - ["x-secondlife-udp-listen-port"]; - - LLSD message_data; - std::string sender = senderIP + ":" + senderPort; - message_data["sender"] = sender; - message_data["body"] = input; - - // untrusted senders should not have access to the trusted message - // service, but this can happen in development, so check and warn - LLMessageConfig::SenderTrust trust = - LLMessageConfig::getSenderTrustedness(name); - if ((trust == LLMessageConfig::TRUSTED || - (trust == LLMessageConfig::NOT_SET && - gMessageSystem->isTrustedMessage(name))) - && !gMessageSystem->isTrustedSender(LLHost(sender))) - { - LL_WARNS("Messaging") << "trusted message POST to /trusted-message/" - << name << " from unknown or untrusted sender " - << sender << llendl; - response->status(403, "Unknown or untrusted sender"); - } - else - { - LLMessageSystem::dispatch(name, message_data, response); - } -} - class LLMessageHandlerBridge : public LLHTTPNode { virtual bool validate(const std::string& name, LLSD& context) const @@ -222,9 +180,6 @@ void LLMessageHandlerBridge::post(LLHTTPNode::ResponsePtr response, LLHTTPRegistration gHTTPRegistrationMessageWildcard("/message/"); -LLHTTPRegistration - gHTTPRegistrationTrustedMessageWildcard("/trusted-message/"); - //virtual LLUseCircuitCodeResponder::~LLUseCircuitCodeResponder() { @@ -290,7 +245,10 @@ LLMessageSystem::LLMessageSystem(const std::string& filename, U32 port, S32 version_major, S32 version_minor, S32 version_patch, - bool failure_is_fatal) + bool failure_is_fatal, + const F32 circuit_heartbeat_interval, const F32 circuit_timeout) : + mCircuitInfo(circuit_heartbeat_interval, circuit_timeout), + mLastMessageFromTrustedMessageService(false) { init(); @@ -303,6 +261,9 @@ LLMessageSystem::LLMessageSystem(const std::string& filename, U32 port, // default to not accepting packets from not alive circuits mbProtected = TRUE; + // default to blocking trusted connections on a public interface if one is specified + mBlockUntrustedInterface = true; + mSendPacketFailureCount = 0; mCircuitPrintFreq = 60.f; // seconds @@ -437,7 +398,9 @@ void LLMessageSystem::clearReceiveState() mCurrentRecvPacketID = 0; mIncomingCompressedSize = 0; mLastSender.invalidate(); + mLastReceivingIF.invalidate(); mMessageReader->clearMessage(); + mLastMessageFromTrustedMessageService = false; } @@ -470,6 +433,17 @@ bool LLMessageSystem::isTrustedSender(const LLHost& host) const return cdp->getTrusted(); } +void LLMessageSystem::receivedMessageFromTrustedSender() +{ + mLastMessageFromTrustedMessageService = true; +} + +bool LLMessageSystem::isTrustedSender() const +{ + return mLastMessageFromTrustedMessageService || + isTrustedSender(getSender()); +} + static LLMessageSystem::message_template_name_map_t::const_iterator findTemplate(const LLMessageSystem::message_template_name_map_t& templates, std::string name) @@ -586,6 +560,7 @@ BOOL LLMessageSystem::checkMessages( S64 frame_count ) receive_size = mTrueReceiveSize; mLastSender = mPacketRing.getLastSender(); + mLastReceivingIF = mPacketRing.getLastReceivingInterface(); if (receive_size < (S32) LL_MINIMUM_VALID_PACKET_SIZE) { @@ -709,11 +684,16 @@ BOOL LLMessageSystem::checkMessages( S64 frame_count ) // UseCircuitCode can be a valid, off-circuit packet. // But we don't want to acknowledge UseCircuitCode until the circuit is // available, which is why the acknowledgement test is done above. JC - + bool trusted = cdp && cdp->getTrusted(); valid_packet = mTemplateMessageReader->validateMessage( buffer, receive_size, - host); + host, + trusted); + if (!valid_packet) + { + clearReceiveState(); + } // UseCircuitCode is allowed in even from an invalid circuit, so that // we can toss circuits around. @@ -741,29 +721,6 @@ BOOL LLMessageSystem::checkMessages( S64 frame_count ) valid_packet = FALSE; } - if ( - valid_packet && - mTemplateMessageReader->isBanned(cdp && cdp->getTrusted())) - { - LL_WARNS("Messaging") << "LLMessageSystem::checkMessages " - << "received banned message " - << mTemplateMessageReader->getMessageName() - << " from " - << ((cdp && cdp->getTrusted()) ? "trusted " : "untrusted ") - << host << llendl; - clearReceiveState(); - valid_packet = FALSE; - } - - if( valid_packet && mTemplateMessageReader->isUdpBanned()) - { - llwarns << "Received UDP black listed message " - << mTemplateMessageReader->getMessageName() - << " from " << host << llendl; - clearReceiveState(); - valid_packet = FALSE; - } - if( valid_packet ) { logValidMsg(cdp, host, recv_reliable, recv_resent, (BOOL)(acks>0) ); @@ -776,94 +733,6 @@ BOOL LLMessageSystem::checkMessages( S64 frame_count ) if (valid_packet) { - // enable this for output of message names - //LL_INFOS("Messaging") << "< \"" << mTemplateMessageReader->getMessageName() - //<< "\"" << llendl; - - /* Code for dumping the complete contents of a message. Keep for future use in optimizing messages. - if( 1 ) - { - static char* object_update = LLMessageStringTable::getInstance()->getString("ObjectUpdate"); - if(object_update == mTemplateMessageReader->getMessageName() ) - { - LL_INFOS("Messaging") << "ObjectUpdate:" << llendl; - U32 i; - LL_INFOS("Messaging") << " Zero Encoded: " << zero_unexpanded_size << llendl; - for( i = 0; imMemberBlocks.begin(), - end = mCurrentRMessageTemplate->mMemberBlocks.end(); - iter != end; iter++) - { - LLMessageBlock* block = iter->second; - const char* block_name = block->mName; - for (LLMsgBlkData::msg_var_data_map_t::iterator - iter = block->mMemberVariables.begin(), - end = block->mMemberVariables.end(); - iter != end; iter++) - { - const char* var_name = iter->first; - - if( getNumberOfBlocksFast( block_name ) < 1 ) - { - LL_INFOS("Messaging") << var_name << " has no blocks" << llendl; - } - for( S32 blocknum = 0; blocknum < getNumberOfBlocksFast( block_name ); blocknum++ ) - { - char *bnamep = (char *)block_name + blocknum; // this works because it's just a hash. The bnamep is never derefference - char *vnamep = (char *)var_name; - - LLMsgBlkData *msg_block_data = mCurrentRMessageData->mMemberBlocks[bnamep]; - - if (!msg_block_data) - { - std::string errmsg = llformat("Block %s #%d not in message %s", block_name, blocknum, mCurrentRMessageData->mName); - LL_ERRS("Messaging") << errmsg << llendl; - } - - LLMsgVarData vardata = msg_block_data->mMemberVarData[vnamep]; - - if (!vardata.getName()) - { - std::string errmsg = llformat("Variable %s not in message %s block %s", vnamep, mCurrentRMessageData->mName, bnamep); - LL_ERRS("Messaging") << errmsg << llendl; - } - - const S32 vardata_size = vardata.getSize(); - if( vardata_size ) - { - for( i = 0; i < vardata_size; i++ ) - { - byte_count++; - LL_INFOS("Messaging") << block_name << " " << var_name << " [" << blocknum << "][" << i << "]= " << (U32)(((U8*)vardata.getData())[i]) << llendl; - } - } - else - { - LL_INFOS("Messaging") << block_name << " " << var_name << " [" << blocknum << "] 0 bytes" << llendl; - } - } - } - } - LL_INFOS("Messaging") << "Byte count =" << byte_count << llendl; - } - } - */ - mPacketsIn++; mBytesIn += mTrueReceiveSize; @@ -891,9 +760,6 @@ BOOL LLMessageSystem::checkMessages( S64 frame_count ) mInvalidOnCircuitPackets++; } } - - // Code for dumping the complete contents of a message - // delete [] zero_unexpanded_buffer; } } while (!valid_packet && receive_size > 0); @@ -996,7 +862,7 @@ void LLMessageSystem::processAcks() } } -void LLMessageSystem::copyMessageRtoS() +void LLMessageSystem::copyMessageReceivedToSend() { // NOTE: babbage: switch builder to match reader to avoid // converting message format @@ -1013,6 +879,94 @@ void LLMessageSystem::copyMessageRtoS() mMessageReader->copyToBuilder(*mMessageBuilder); } +LLSD LLMessageSystem::getReceivedMessageLLSD() const +{ + LLSDMessageBuilder builder; + mMessageReader->copyToBuilder(builder); + return builder.getMessage(); +} + +LLSD LLMessageSystem::getBuiltMessageLLSD() const +{ + LLSD result; + if (mLLSDMessageBuilder == mMessageBuilder) + { + result = mLLSDMessageBuilder->getMessage(); + } + else + { + // TODO: implement as below? + llerrs << "Message not built as LLSD." << llendl; + } + return result; +} + +LLSD LLMessageSystem::wrapReceivedTemplateData() const +{ + if(mMessageReader == mTemplateMessageReader) + { + LLTemplateMessageBuilder builder(mMessageTemplates); + builder.newMessage(mMessageReader->getMessageName()); + mMessageReader->copyToBuilder(builder); + U8 buffer[MAX_BUFFER_SIZE]; + const U8 offset_to_data = 0; + U32 size = builder.buildMessage(buffer, MAX_BUFFER_SIZE, + offset_to_data); + std::vector binary_data(buffer, buffer+size); + LLSD wrapped_data = LLSD::emptyMap(); + wrapped_data["binary-template-data"] = binary_data; + return wrapped_data; + } + else + { + return getReceivedMessageLLSD(); + } +} + +LLSD LLMessageSystem::wrapBuiltTemplateData() const +{ + LLSD result; + if (mLLSDMessageBuilder == mMessageBuilder) + { + result = getBuiltMessageLLSD(); + } + else + { + U8 buffer[MAX_BUFFER_SIZE]; + const U8 offset_to_data = 0; + U32 size = mTemplateMessageBuilder->buildMessage( + buffer, MAX_BUFFER_SIZE, + offset_to_data); + std::vector binary_data(buffer, buffer+size); + LLSD wrapped_data = LLSD::emptyMap(); + wrapped_data["binary-template-data"] = binary_data; + result = wrapped_data; + } + return result; +} + +LLStoredMessagePtr LLMessageSystem::getReceivedMessage() const +{ + const std::string& name = mMessageReader->getMessageName(); + LLSD message = wrapReceivedTemplateData(); + + return LLStoredMessagePtr(new LLStoredMessage(name, message)); +} + +LLStoredMessagePtr LLMessageSystem::getBuiltMessage() const +{ + const std::string& name = mMessageBuilder->getMessageName(); + LLSD message = wrapBuiltTemplateData(); + + return LLStoredMessagePtr(new LLStoredMessage(name, message)); +} + +S32 LLMessageSystem::sendMessage(const LLHost &host, LLStoredMessagePtr message) +{ + return sendMessage(host, message->mName.c_str(), message->mMessage); +} + + void LLMessageSystem::clearMessage() { mSendReliable = FALSE; @@ -1025,6 +979,11 @@ void LLMessageSystem::nextBlockFast(const char *blockname) mMessageBuilder->nextBlock(blockname); } +void LLMessageSystem::nextBlock(const char *blockname) +{ + nextBlockFast(LLMessageStringTable::getInstance()->getString(blockname)); +} + BOOL LLMessageSystem::isSendFull(const char* blockname) { char* stringTableName = NULL; @@ -1104,19 +1063,19 @@ S32 LLMessageSystem::sendReliable( const LLHost &host, void LLMessageSystem::forwardMessage(const LLHost &host) { - copyMessageRtoS(); + copyMessageReceivedToSend(); sendMessage(host); } void LLMessageSystem::forwardReliable(const LLHost &host) { - copyMessageRtoS(); + copyMessageReceivedToSend(); sendReliable(host); } void LLMessageSystem::forwardReliable(const U32 circuit_code) { - copyMessageRtoS(); + copyMessageReceivedToSend(); sendReliable(findHost(circuit_code)); } @@ -1127,7 +1086,7 @@ S32 LLMessageSystem::forwardReliable( const LLHost &host, void (*callback)(void **,S32), void ** callback_data) { - copyMessageRtoS(); + copyMessageReceivedToSend(); return sendReliable(host, retries, ping_based_timeout, timeout, callback, callback_data); } @@ -1194,7 +1153,7 @@ LLHTTPClient::ResponderPtr LLMessageSystem::createResponder(const std::string& n return new LLFnPtrResponder( NULL, NULL, - mMessageBuilder->getMessageName()); + name); } } @@ -1455,13 +1414,6 @@ S32 LLMessageSystem::sendMessage( LL_WARNS("Messaging") << "trying to send message to invalid host" << llendl; return 0; } - newMessage(name); - if (mMessageBuilder != mLLSDMessageBuilder) - { - LL_WARNS("Messaging") << "trying to send llsd message when builder is not LLSD!" - << llendl; - return 0; - } const LLHTTPSender& sender = LLHTTPSender::getSender(host); sender.send(host, name, message, createResponder(name)); @@ -2170,6 +2122,15 @@ void LLMessageSystem::dispatch( handler->post(responsep, context, message); } +//static +void LLMessageSystem::dispatchTemplate(const std::string& msg_name, + const LLSD& message, + LLHTTPNode::ResponsePtr responsep) +{ + LLTemplateMessageDispatcher dispatcher(*(gMessageSystem->mTemplateMessageReader)); + dispatcher.dispatch(msg_name, message, responsep); +} + static void check_for_unrecognized_messages( const char* type, const LLSD& map, @@ -2352,6 +2313,23 @@ void process_create_trusted_circuit(LLMessageSystem *msg, void **) return; } + U32 untrusted_interface = msg->getUntrustedInterface().getAddress(); + U32 last_interface = msg->getReceivingInterface().getAddress(); + if ( ( untrusted_interface != INVALID_HOST_IP_ADDRESS ) && ( untrusted_interface == last_interface ) ) + { + if( msg->getBlockUntrustedInterface() ) + { + LL_WARNS("Messaging") << "Ignoring CreateTrustedCircuit on public interface from host: " + << msg->getSender() << llendl; + return; + } + else + { + LL_WARNS("Messaging") << "Processing CreateTrustedCircuit on public interface from host: " + << msg->getSender() << llendl; + } + } + char their_digest[MD5HEX_STR_SIZE]; /* Flawfinder: ignore */ S32 size = msg->getSizeFast(_PREHASH_DataBlock, _PREHASH_Digest); if(size != MD5HEX_STR_BYTES) @@ -2408,6 +2386,24 @@ void process_deny_trusted_circuit(LLMessageSystem *msg, void **) // Don't respond to requests that use the same end point ID return; } + + U32 untrusted_interface = msg->getUntrustedInterface().getAddress(); + U32 last_interface = msg->getReceivingInterface().getAddress(); + if ( ( untrusted_interface != INVALID_HOST_IP_ADDRESS ) && ( untrusted_interface == last_interface ) ) + { + if( msg->getBlockUntrustedInterface() ) + { + LL_WARNS("Messaging") << "Ignoring DenyTrustedCircuit on public interface from host: " + << msg->getSender() << llendl; + return; + } + else + { + LL_WARNS("Messaging") << "Processing DenyTrustedCircuit on public interface from host: " + << msg->getSender() << llendl; + } + } + // Assume that we require trust to proceed, so resend. // This catches the case where a circuit that was trusted @@ -2496,7 +2492,9 @@ bool start_messaging_system( bool b_dump_prehash_file, const std::string& secret, const LLUseCircuitCodeResponder* responder, - bool failure_is_fatal) + bool failure_is_fatal, + const F32 circuit_heartbeat_interval, + const F32 circuit_timeout) { gMessageSystem = new LLMessageSystem( template_name, @@ -2504,7 +2502,9 @@ bool start_messaging_system( version_major, version_minor, version_patch, - failure_is_fatal); + failure_is_fatal, + circuit_heartbeat_interval, + circuit_timeout); g_shared_secret.assign(secret); if (!gMessageSystem) @@ -2683,7 +2683,7 @@ void LLMessageSystem::summarizeLogs(std::ostream& str) str << "END MESSAGE LOG SUMMARY" << std::endl; } -void end_messaging_system() +void end_messaging_system(bool print_summary) { gTransferManager.cleanup(); LLTransferTargetVFile::updateQueue(true); // shutdown LLTransferTargetVFile @@ -2691,9 +2691,12 @@ void end_messaging_system() { gMessageSystem->stopLogging(); - std::ostringstream str; - gMessageSystem->summarizeLogs(str); - LL_INFOS("Messaging") << str.str().c_str() << llendl; + if (print_summary) + { + std::ostringstream str; + gMessageSystem->summarizeLogs(str); + LL_INFOS("Messaging") << str.str().c_str() << llendl; + } delete gMessageSystem; gMessageSystem = NULL; @@ -4041,3 +4044,11 @@ void LLMessageSystem::banUdpMessage(const std::string& name) llwarns << "Attempted to ban an unknown message: " << name << "." << llendl; } } +const LLHost& LLMessageSystem::getSender() const +{ + return mLastSender; +} + +LLHTTPRegistration > + gHTTPRegistrationTrustedMessageWildcard("/trusted-message/"); + diff --git a/linden/indra/llmessage/message.h b/linden/indra/llmessage/message.h index c503a58..b25b27e 100644 --- a/linden/indra/llmessage/message.h +++ b/linden/indra/llmessage/message.h @@ -17,7 +17,8 @@ * 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 + * 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, @@ -62,6 +63,9 @@ #include "llstl.h" #include "llmsgvariabletype.h" #include "llmsgvariabletype.h" +#include "llmessagesenderinterface.h" + +#include "llstoredmessage.h" const U32 MESSAGE_MAX_STRINGS_LENGTH = 64; const U32 MESSAGE_NUMBER_OF_HASH_BUCKETS = 8192; @@ -205,12 +209,15 @@ public: virtual void complete(const LLHost& host, const LLUUID& agent) const = 0; }; -class LLMessageSystem +class LLMessageSystem : public LLMessageSenderInterface { private: U8 mSendBuffer[MAX_BUFFER_SIZE]; S32 mSendSize; + bool mBlockUntrustedInterface; + LLHost mUntrustedInterface; + public: LLPacketRing mPacketRing; LLReliablePacketParams mReliablePacketParams; @@ -285,7 +292,8 @@ public: // Read file and build message templates LLMessageSystem(const std::string& filename, U32 port, S32 version_major, S32 version_minor, S32 version_patch, - bool failure_is_fatal = true); + bool failure_is_fatal, + const F32 circuit_heartbeat_interval, const F32 circuit_timeout); ~LLMessageSystem(); @@ -350,6 +358,8 @@ public: U32 getSenderIP() const; // getSender() is preferred U32 getSenderPort() const; // getSender() is preferred + const LLHost& getReceivingInterface() const; + // This method returns the uuid associated with the sender. The // UUID will be null if it is not yet known or is a server // circuit. @@ -366,14 +376,34 @@ public: void newMessageFast(const char *name); void newMessage(const char *name); - void copyMessageRtoS(); - void clearMessage(); + +public: + LLStoredMessagePtr getReceivedMessage() const; + LLStoredMessagePtr getBuiltMessage() const; + S32 sendMessage(const LLHost &host, LLStoredMessagePtr message); + +private: + LLSD getReceivedMessageLLSD() const; + LLSD getBuiltMessageLLSD() const; + + // NOTE: babbage: Only use to support legacy misuse of the + // LLMessageSystem API where values are dangerously written + // as one type and read as another. LLSD does not support + // dangerous conversions and so converting the message to an + // LLSD would result in the reads failing. All code which + // misuses the message system in this way should be made safe + // but while the unsafe code is run in old processes, this + // method should be used to forward unsafe messages. + LLSD wrapReceivedTemplateData() const; + LLSD wrapBuiltTemplateData() const; + +public: + + void copyMessageReceivedToSend(); + void clearMessage(); void nextBlockFast(const char *blockname); - void nextBlock(const char *blockname) - { - nextBlockFast(LLMessageStringTable::getInstance()->getString(blockname)); - } + void nextBlock(const char *blockname); public: void addBinaryDataFast(const char *varname, const void *data, S32 size); @@ -454,14 +484,14 @@ public: void (*callback)(void **,S32), void ** callback_data); // flush sends a message only if data's been pushed on it. - S32 flushSemiReliable( const LLHost &host, + S32 flushSemiReliable( const LLHost &host, void (*callback)(void **,S32), void ** callback_data); - S32 flushReliable( const LLHost &host ); + S32 flushReliable( const LLHost &host ); - void forwardMessage(const LLHost &host); - void forwardReliable(const LLHost &host); - void forwardReliable(const U32 circuit_code); + void forwardMessage(const LLHost &host); + void forwardReliable(const LLHost &host); + void forwardReliable(const U32 circuit_code); S32 forwardReliable( const LLHost &host, S32 retries, @@ -473,9 +503,10 @@ public: LLHTTPClient::ResponderPtr createResponder(const std::string& name); S32 sendMessage(const LLHost &host); S32 sendMessage(const U32 circuit); +private: S32 sendMessage(const LLHost &host, const char* name, const LLSD& message); - +public: // BOOL decodeData(const U8 *buffer, const LLHost &host); void getBinaryDataFast(const char *blockname, const char *varname, void *datap, S32 size, S32 blocknum = 0, S32 max_size = S32_MAX); @@ -554,17 +585,28 @@ public: void sendDenyTrustedCircuit(const LLHost &host); /** Return false if host is unknown or untrusted */ + // Note:DaveH/Babbage some trusted messages can be received without a circuit bool isTrustedSender(const LLHost& host) const; + /** Return true if current message is from trusted source */ + bool isTrustedSender() const; + /** Return false true if name is unknown or untrusted */ bool isTrustedMessage(const std::string& name) const; /** Return false true if name is unknown or trusted */ bool isUntrustedMessage(const std::string& name) const; + // Mark an interface ineligible for trust + void setUntrustedInterface( const LLHost host ) { mUntrustedInterface = host; } + LLHost getUntrustedInterface() const { return mUntrustedInterface; } + void setBlockUntrustedInterface( bool block ) { mBlockUntrustedInterface = block; } // Throw a switch to allow, sending warnings only + bool getBlockUntrustedInterface() const { return mBlockUntrustedInterface; } + // Change this message to be UDP black listed. void banUdpMessage(const std::string& name); + private: // A list of the circuits that need to be sent DenyTrustedCircuit messages. typedef std::set host_set_t; @@ -581,6 +623,7 @@ public: void establishBidirectionalTrust(const LLHost &host, S64 frame_count = 0); // returns whether the given host is on a trusted circuit + // Note:DaveH/Babbage some trusted messages can be received without a circuit BOOL getCircuitTrust(const LLHost &host); void setCircuitAllowTimeout(const LLHost &host, BOOL allow); @@ -650,6 +693,12 @@ public: const LLSD& message, LLHTTPNode::ResponsePtr responsep); + // this is added to support specific legacy messages and is + // ***not intended for general use*** Si, Gabriel, 2009 + static void dispatchTemplate(const std::string& msg_name, + const LLSD& message, + LLHTTPNode::ResponsePtr responsep); + void setMessageBans(const LLSD& trusted, const LLSD& untrusted); /** @@ -677,9 +726,18 @@ public: // Check UDP messages and pump http_pump to receive HTTP messages. bool checkAllMessages(S64 frame_count, LLPumpIO* http_pump); + + // Moved to allow access from LLTemplateMessageDispatcher + void clearReceiveState(); + + // This will cause all trust queries to return true until the next message + // is read: use with caution! + void receivedMessageFromTrustedSender(); private: + bool mLastMessageFromTrustedMessageService; + // The mCircuitCodes is a map from circuit codes to session // ids. This allows us to verify sessions on connect. typedef std::map code_session_map_t; @@ -690,7 +748,6 @@ private: LLUUID mSessionID; void addTemplate(LLMessageTemplate *templatep); - void clearReceiveState(); BOOL decodeTemplate( const U8* buffer, S32 buffer_size, LLMessageTemplate** msg_template ); void logMsgFromInvalidCircuit( const LLHost& sender, BOOL recv_reliable ); @@ -745,6 +802,7 @@ private: void init(); // ctor shared initialisation. LLHost mLastSender; + LLHost mLastReceivingIF; S32 mIncomingCompressedSize; // original size of compressed msg (0 if uncomp.) TPACKETID mCurrentRecvPacketID; // packet ID of current receive packet (for reporting) @@ -780,10 +838,12 @@ bool start_messaging_system( S32 version_patch, bool b_dump_prehash_file, const std::string& secret, - const LLUseCircuitCodeResponder* responder = NULL, - bool failure_is_fatal = true); + const LLUseCircuitCodeResponder* responder, + bool failure_is_fatal, + const F32 circuit_heartbeat_interval, + const F32 circuit_timeout); -void end_messaging_system(); +void end_messaging_system(bool print_summary = true); void null_message_callback(LLMessageSystem *msg, void **data); @@ -960,8 +1020,7 @@ inline void *ntohmemcpy(void *s, const void *ct, EMsgVariableType type, size_t n return(htonmemcpy(s,ct,type, n)); } - -inline const LLHost& LLMessageSystem::getSender() const {return mLastSender;} +inline const LLHost& LLMessageSystem::getReceivingInterface() const {return mLastReceivingIF;} inline U32 LLMessageSystem::getSenderIP() const { @@ -973,6 +1032,7 @@ inline U32 LLMessageSystem::getSenderPort() const return mLastSender.getPort(); } + //----------------------------------------------------------------------------- // Transmission aliases //----------------------------------------------------------------------------- diff --git a/linden/indra/llmessage/message_prehash.cpp b/linden/indra/llmessage/message_prehash.cpp index a286d0f..da16e6e 100644 --- a/linden/indra/llmessage/message_prehash.cpp +++ b/linden/indra/llmessage/message_prehash.cpp @@ -17,7 +17,8 @@ * 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 + * 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, @@ -313,6 +314,7 @@ char* _PREHASH_TextColor = LLMessageStringTable::getInstance()->getString("TextC char* _PREHASH_SlaveID = LLMessageStringTable::getInstance()->getString("SlaveID"); char* _PREHASH_Charter = LLMessageStringTable::getInstance()->getString("Charter"); char* _PREHASH_AlertData = LLMessageStringTable::getInstance()->getString("AlertData"); +char* _PREHASH_AlertInfo = LLMessageStringTable::getInstance()->getString("AlertInfo"); char* _PREHASH_TargetBlock = LLMessageStringTable::getInstance()->getString("TargetBlock"); char* _PREHASH_CheckParcelAuctions = LLMessageStringTable::getInstance()->getString("CheckParcelAuctions"); char* _PREHASH_ParcelAuctions = LLMessageStringTable::getInstance()->getString("ParcelAuctions"); @@ -1374,4 +1376,5 @@ char* _PREHASH_AgeVerificationBlock = LLMessageStringTable::getInstance()->getSt char* _PREHASH_UCoord = LLMessageStringTable::getInstance()->getString("UCoord"); char* _PREHASH_VCoord = LLMessageStringTable::getInstance()->getString("VCoord"); char* _PREHASH_FaceIndex = LLMessageStringTable::getInstance()->getString("FaceIndex"); - +char* _PREHASH_StatusData = LLMessageStringTable::getInstance()->getString("StatusData"); +char* _PREHASH_ProductSKU = LLMessageStringTable::getInstance()->getString("ProductSKU"); diff --git a/linden/indra/llmessage/message_prehash.h b/linden/indra/llmessage/message_prehash.h index d7014df..1445d6a 100644 --- a/linden/indra/llmessage/message_prehash.h +++ b/linden/indra/llmessage/message_prehash.h @@ -17,7 +17,8 @@ * 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 + * 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, @@ -313,6 +314,7 @@ extern char * _PREHASH_TextColor; extern char * _PREHASH_SlaveID; extern char * _PREHASH_Charter; extern char * _PREHASH_AlertData; +extern char * _PREHASH_AlertInfo; extern char * _PREHASH_TargetBlock; extern char * _PREHASH_CheckParcelAuctions; extern char * _PREHASH_ParcelAuctions; @@ -1374,5 +1376,6 @@ extern char * _PREHASH_AgeVerificationBlock; extern char * _PREHASH_UCoord; extern char * _PREHASH_VCoord; extern char * _PREHASH_FaceIndex; - +extern char * _PREHASH_StatusData; +extern char * _PREHASH_ProductSKU; #endif diff --git a/linden/indra/llmessage/message_string_table.cpp b/linden/indra/llmessage/message_string_table.cpp index 39ba399..cd60103 100644 --- a/linden/indra/llmessage/message_string_table.cpp +++ b/linden/indra/llmessage/message_string_table.cpp @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/net.cpp b/linden/indra/llmessage/net.cpp index 0f0cddf..f63faa5 100644 --- a/linden/indra/llmessage/net.cpp +++ b/linden/indra/llmessage/net.cpp @@ -17,7 +17,8 @@ * 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 + * 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, @@ -50,7 +51,6 @@ #endif // linden library includes -#include "network.h" #include "llerror.h" #include "llhost.h" #include "lltimer.h" @@ -80,6 +80,7 @@ typedef int socklen_t; #endif +static U32 gsnReceivingIFAddr = INVALID_HOST_IP_ADDRESS; // Address to which datagram was sent const char* LOOPBACK_ADDRESS_STRING = "127.0.0.1"; @@ -109,6 +110,16 @@ U32 get_sender_port() return ntohs(stSrcAddr.sin_port); } +LLHost get_receiving_interface() +{ + return LLHost(gsnReceivingIFAddr, INVALID_PORT); +} + +U32 get_receiving_interface_ip(void) +{ + return gsnReceivingIFAddr; +} + const char* u32_to_ip_string(U32 ip) { static char buffer[MAXADDRSTR]; /* Flawfinder: ignore */ @@ -383,11 +394,30 @@ S32 start_net(S32& socket_out, int& nPort) return 1; } - // Don't bind() if we want the operating system to assign our ports for - // us. if (NET_USE_OS_ASSIGNED_PORT == nPort) { - // Do nothing; the operating system will do it for us. + // Although bind is not required it will tell us which port we were + // assigned to. + stLclAddr.sin_family = AF_INET; + stLclAddr.sin_addr.s_addr = htonl(INADDR_ANY); + stLclAddr.sin_port = htons(0); + llinfos << "attempting to connect on OS assigned port" << llendl; + nRet = bind(hSocket, (struct sockaddr*) &stLclAddr, sizeof(stLclAddr)); + if (nRet < 0) + { + llwarns << "Failed to bind on an OS assigned port error: " + << nRet << llendl; + } + else + { + sockaddr_in socket_info; + socklen_t len = sizeof(sockaddr_in); + int err = getsockname(hSocket, (sockaddr*)&socket_info, &len); + llinfos << "Get socket returned: " << err << " length " << len << llendl; + nPort = ntohs(socket_info.sin_port); + llinfos << "Assigned port: " << nPort << llendl; + + } } else { @@ -454,6 +484,21 @@ S32 start_net(S32& socket_out, int& nPort) llinfos << "startNet - receive buffer size : " << rec_size << llendl; llinfos << "startNet - send buffer size : " << snd_size << llendl; +#if LL_LINUX + // Turn on recipient address tracking + { + int use_pktinfo = 1; + if( setsockopt( hSocket, SOL_IP, IP_PKTINFO, &use_pktinfo, sizeof(use_pktinfo) ) == -1 ) + { + llwarns << "No IP_PKTINFO available" << llendl; + } + else + { + llinfos << "IP_PKKTINFO enabled" << llendl; + } + } +#endif + // Setup a destination address char achMCAddr[MAXADDRSTR] = "127.0.0.1"; /* Flawfinder: ignore */ stDstAddr.sin_family = AF_INET; @@ -472,6 +517,52 @@ void end_net(S32& socket_out) } } +#if LL_LINUX +static int recvfrom_destip( int socket, void *buf, int len, struct sockaddr *from, socklen_t *fromlen, U32 *dstip ) +{ + int size; + struct iovec iov[1]; + char cmsg[CMSG_SPACE(sizeof(struct in_pktinfo))]; + struct cmsghdr *cmsgptr; + struct msghdr msg = {0}; + + iov[0].iov_base = buf; + iov[0].iov_len = len; + + memset( &msg, 0, sizeof msg ); + msg.msg_name = from; + msg.msg_namelen = *fromlen; + msg.msg_iov = iov; + msg.msg_iovlen = 1; + msg.msg_control = &cmsg; + msg.msg_controllen = sizeof(cmsg); + + size = recvmsg( socket, &msg, 0 ); + + if( size == -1 ) + { + return -1; + } + + for( cmsgptr = CMSG_FIRSTHDR(&msg); cmsgptr != NULL; cmsgptr = CMSG_NXTHDR( &msg, cmsgptr ) ) + { + if( cmsgptr->cmsg_level == SOL_IP && cmsgptr->cmsg_type == IP_PKTINFO ) + { + in_pktinfo *pktinfo = (in_pktinfo *)CMSG_DATA(cmsgptr); + if( pktinfo ) + { + // Two choices. routed and specified. ipi_addr is routed, ipi_spec_dst is + // routed. We should stay with specified until we go to multiple + // interfaces + *dstip = pktinfo->ipi_spec_dst.s_addr; + } + } + } + + return size; +} +#endif + int receive_packet(int hSocket, char * receiveBuffer) { // Receives data asynchronously from the socket set by initNet(). @@ -481,7 +572,14 @@ int receive_packet(int hSocket, char * receiveBuffer) int nRet; socklen_t addr_size = sizeof(struct sockaddr_in); - nRet = recvfrom(hSocket, receiveBuffer, NET_BUFFER_SIZE, 0, (struct sockaddr*)&stSrcAddr, &addr_size); + gsnReceivingIFAddr = INVALID_HOST_IP_ADDRESS; + +#if LL_LINUX + nRet = recvfrom_destip(hSocket, receiveBuffer, NET_BUFFER_SIZE, (struct sockaddr*)&stSrcAddr, &addr_size, &gsnReceivingIFAddr); +#else + int recv_flags = 0; + nRet = recvfrom(hSocket, receiveBuffer, NET_BUFFER_SIZE, recv_flags, (struct sockaddr*)&stSrcAddr, &addr_size); +#endif if (nRet == -1) { @@ -489,6 +587,9 @@ int receive_packet(int hSocket, char * receiveBuffer) return 0; } + // Uncomment for testing if/when implementing for Mac or Windows: + // llinfos << "Received datagram to in addr " << u32_to_ip_string(get_receiving_interface_ip()) << llendl; + return nRet; } diff --git a/linden/indra/llmessage/net.h b/linden/indra/llmessage/net.h index ec2af59..45b07a0 100644 --- a/linden/indra/llmessage/net.h +++ b/linden/indra/llmessage/net.h @@ -17,7 +17,8 @@ * 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 + * 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, @@ -54,6 +55,8 @@ BOOL send_packet(int hSocket, const char *sendBuffer, int size, U32 recipient, i LLHost get_sender(); U32 get_sender_port(); U32 get_sender_ip(void); +LLHost get_receiving_interface(); +U32 get_receiving_interface_ip(void); const char* u32_to_ip_string(U32 ip); // Returns pointer to internal string buffer, "(bad IP addr)" on failure, cannot nest calls char* u32_to_ip_string(U32 ip, char *ip_string); // NULL on failure, ip_string on success, you must allocate at least MAXADDRSTR chars diff --git a/linden/indra/llmessage/network.cpp b/linden/indra/llmessage/network.cpp deleted file mode 100644 index a5c5ea4..0000000 --- a/linden/indra/llmessage/network.cpp +++ /dev/null @@ -1,31 +0,0 @@ -/** - * @file network.cpp - * @brief Legacy file - * - * $LicenseInfo:firstyear=2000&license=viewergpl$ - * - * Copyright (c) 2000-2009, 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$ - */ - diff --git a/linden/indra/llmessage/network.h b/linden/indra/llmessage/network.h deleted file mode 100644 index 781c4f4..0000000 --- a/linden/indra/llmessage/network.h +++ /dev/null @@ -1,31 +0,0 @@ -/** - * @file network.h - * @brief Legacy file. - * - * $LicenseInfo:firstyear=2000&license=viewergpl$ - * - * Copyright (c) 2000-2009, 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$ - */ - diff --git a/linden/indra/llmessage/partsyspacket.cpp b/linden/indra/llmessage/partsyspacket.cpp index 9cef9c9..cfb3572 100644 --- a/linden/indra/llmessage/partsyspacket.cpp +++ b/linden/indra/llmessage/partsyspacket.cpp @@ -18,7 +18,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/partsyspacket.h b/linden/indra/llmessage/partsyspacket.h index 46564a1..b4edc8c 100644 --- a/linden/indra/llmessage/partsyspacket.h +++ b/linden/indra/llmessage/partsyspacket.h @@ -18,7 +18,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/patch_code.cpp b/linden/indra/llmessage/patch_code.cpp index baa8aca..90fb236 100644 --- a/linden/indra/llmessage/patch_code.cpp +++ b/linden/indra/llmessage/patch_code.cpp @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/patch_code.h b/linden/indra/llmessage/patch_code.h index c6fd90e..82fa6bb 100644 --- a/linden/indra/llmessage/patch_code.h +++ b/linden/indra/llmessage/patch_code.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/patch_dct.cpp b/linden/indra/llmessage/patch_dct.cpp index 8c1c0cb..be5e90c 100644 --- a/linden/indra/llmessage/patch_dct.cpp +++ b/linden/indra/llmessage/patch_dct.cpp @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/patch_dct.h b/linden/indra/llmessage/patch_dct.h index 204ed0d..663e146 100644 --- a/linden/indra/llmessage/patch_dct.h +++ b/linden/indra/llmessage/patch_dct.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/patch_idct.cpp b/linden/indra/llmessage/patch_idct.cpp index 39a6f52..b9a0931 100644 --- a/linden/indra/llmessage/patch_idct.cpp +++ b/linden/indra/llmessage/patch_idct.cpp @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llmessage/sound_ids.h b/linden/indra/llmessage/sound_ids.h index 884bf14..e7a9190 100644 --- a/linden/indra/llmessage/sound_ids.h +++ b/linden/indra/llmessage/sound_ids.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llprimitive/legacy_object_types.h b/linden/indra/llprimitive/legacy_object_types.h index 2716d8b..645af83 100644 --- a/linden/indra/llprimitive/legacy_object_types.h +++ b/linden/indra/llprimitive/legacy_object_types.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llprimitive/llmaterialtable.cpp b/linden/indra/llprimitive/llmaterialtable.cpp index eeb4b7f..4c22203 100644 --- a/linden/indra/llprimitive/llmaterialtable.cpp +++ b/linden/indra/llprimitive/llmaterialtable.cpp @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llprimitive/llmaterialtable.h b/linden/indra/llprimitive/llmaterialtable.h index d366163..ca9017a 100644 --- a/linden/indra/llprimitive/llmaterialtable.h +++ b/linden/indra/llprimitive/llmaterialtable.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llprimitive/llprimitive.cpp b/linden/indra/llprimitive/llprimitive.cpp index dc389c1..6fc0a55 100644 --- a/linden/indra/llprimitive/llprimitive.cpp +++ b/linden/indra/llprimitive/llprimitive.cpp @@ -17,7 +17,8 @@ * 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 + * 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, @@ -114,6 +115,11 @@ const BOOL FLEXIBLE_OBJECT_DEFAULT_RENDERING_COLLISION_SPHERE = FALSE; const char *SCULPT_DEFAULT_TEXTURE = "be293869-d0d9-0a69-5989-ad27f1946fd4"; // old inverted texture: "7595d345-a24c-e7ef-f0bd-78793792133e"; +// Texture rotations are sent over the wire as a S16. This is used to scale the actual float +// value to a S16. Don't use 7FFF as it introduces some odd rounding with 180 since it +// can't be divided by 2. See DEV-19108 +const F32 TEXTURE_ROTATION_PACK_FACTOR = ((F32) 0x08000); + //static // LEGACY: by default we use the LLVolumeMgr::gVolumeMgr global // TODO -- eliminate this global from the codebase! @@ -1176,7 +1182,7 @@ BOOL LLPrimitive::packTEMessage(LLMessageSystem *mesgsys) const scale_t[face_index] = (F32) te->mScaleT; offset_s[face_index] = (S16) llround((llclamp(te->mOffsetS,-1.0f,1.0f) * (F32)0x7FFF)) ; offset_t[face_index] = (S16) llround((llclamp(te->mOffsetT,-1.0f,1.0f) * (F32)0x7FFF)) ; - image_rot[face_index] = (S16) llround(((fmod(te->mRotation, F_TWO_PI)/F_TWO_PI) * (F32)0x7FFF)); + image_rot[face_index] = (S16) llround(((fmod(te->mRotation, F_TWO_PI)/F_TWO_PI) * TEXTURE_ROTATION_PACK_FACTOR)); bump[face_index] = te->getBumpShinyFullbright(); media_flags[face_index] = te->getMediaTexGen(); glow[face_index] = (U8) llround((llclamp(te->getGlow(), 0.0f, 1.0f) * (F32)0xFF)); @@ -1255,7 +1261,7 @@ BOOL LLPrimitive::packTEMessage(LLDataPacker &dp) const scale_t[face_index] = (F32) te->mScaleT; offset_s[face_index] = (S16) llround((llclamp(te->mOffsetS,-1.0f,1.0f) * (F32)0x7FFF)) ; offset_t[face_index] = (S16) llround((llclamp(te->mOffsetT,-1.0f,1.0f) * (F32)0x7FFF)) ; - image_rot[face_index] = (S16) llround(((fmod(te->mRotation, F_TWO_PI)/F_TWO_PI) * (F32)0x7FFF)); + image_rot[face_index] = (S16) llround(((fmod(te->mRotation, F_TWO_PI)/F_TWO_PI) * TEXTURE_ROTATION_PACK_FACTOR)); bump[face_index] = te->getBumpShinyFullbright(); media_flags[face_index] = te->getMediaTexGen(); glow[face_index] = (U8) llround((llclamp(te->getGlow(), 0.0f, 1.0f) * (F32)0xFF)); @@ -1369,7 +1375,7 @@ S32 LLPrimitive::unpackTEMessage(LLMessageSystem *mesgsys, char *block_name, con retval |= setTETexture(i, ((LLUUID*)image_data)[i]); retval |= setTEScale(i, scale_s[i], scale_t[i]); retval |= setTEOffset(i, (F32)offset_s[i] / (F32)0x7FFF, (F32) offset_t[i] / (F32) 0x7FFF); - retval |= setTERotation(i, ((F32)image_rot[i]/ (F32)0x7FFF) * F_TWO_PI); + retval |= setTERotation(i, ((F32)image_rot[i] / TEXTURE_ROTATION_PACK_FACTOR) * F_TWO_PI); retval |= setTEBumpShinyFullbright(i, bump[i]); retval |= setTEMediaTexGen(i, media_flags[i]); retval |= setTEGlow(i, (F32)glow[i] / (F32)0xFF); @@ -1463,7 +1469,7 @@ S32 LLPrimitive::unpackTEMessage(LLDataPacker &dp) retval |= setTETexture(i, image_ids[i]); retval |= setTEScale(i, scale_s[i], scale_t[i]); retval |= setTEOffset(i, (F32)offset_s[i] / (F32)0x7FFF, (F32) offset_t[i] / (F32) 0x7FFF); - retval |= setTERotation(i, ((F32)image_rot[i]/ (F32)0x7FFF) * F_TWO_PI); + retval |= setTERotation(i, ((F32)image_rot[i] / TEXTURE_ROTATION_PACK_FACTOR) * F_TWO_PI); retval |= setTEBumpShinyFullbright(i, bump[i]); retval |= setTEMediaTexGen(i, media_flags[i]); retval |= setTEGlow(i, (F32)glow[i] / (F32)0xFF); diff --git a/linden/indra/llprimitive/llprimitive.h b/linden/indra/llprimitive/llprimitive.h index 4e36f55..cc86f5b 100644 --- a/linden/indra/llprimitive/llprimitive.h +++ b/linden/indra/llprimitive/llprimitive.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llprimitive/llprimlinkinfo.h b/linden/indra/llprimitive/llprimlinkinfo.h index b1bfa03..946fa75 100644 --- a/linden/indra/llprimitive/llprimlinkinfo.h +++ b/linden/indra/llprimitive/llprimlinkinfo.h @@ -3,16 +3,27 @@ * @author andrew@lindenlab.com * @brief A template for determining which prims in a set are linkable * - * $LicenseInfo:firstyear=2007&license=internal$ + * $LicenseInfo:firstyear=2007&license=viewergpl$ * * Copyright (c) 2007-2009, 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. + * 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, @@ -39,7 +50,7 @@ const F32 MAX_OBJECT_SPAN = 54.f; // max distance from outside edge of an object to the farthest edge const F32 OBJECT_SPAN_BONUS = 2.f; // infinitesimally small prims can always link up to this distance -const S32 MAX_PRIMS_PER_OBJECT = 255; +const S32 MAX_PRIMS_PER_OBJECT = 256; template < typename DATA_TYPE > diff --git a/linden/indra/llprimitive/lltextureanim.cpp b/linden/indra/llprimitive/lltextureanim.cpp index 7dcfb02..011f047 100644 --- a/linden/indra/llprimitive/lltextureanim.cpp +++ b/linden/indra/llprimitive/lltextureanim.cpp @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llprimitive/lltextureanim.h b/linden/indra/llprimitive/lltextureanim.h index 8e886d4..c618092 100644 --- a/linden/indra/llprimitive/lltextureanim.h +++ b/linden/indra/llprimitive/lltextureanim.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llprimitive/lltextureentry.cpp b/linden/indra/llprimitive/lltextureentry.cpp index 07be994..14b4544 100644 --- a/linden/indra/llprimitive/lltextureentry.cpp +++ b/linden/indra/llprimitive/lltextureentry.cpp @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llprimitive/lltextureentry.h b/linden/indra/llprimitive/lltextureentry.h index 2663ebb..c562545 100644 --- a/linden/indra/llprimitive/lltextureentry.h +++ b/linden/indra/llprimitive/lltextureentry.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llprimitive/lltree_common.h b/linden/indra/llprimitive/lltree_common.h index 1e53c70..7d36447 100644 --- a/linden/indra/llprimitive/lltree_common.h +++ b/linden/indra/llprimitive/lltree_common.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llprimitive/lltreeparams.cpp b/linden/indra/llprimitive/lltreeparams.cpp index 59535ba..1c82fb6 100644 --- a/linden/indra/llprimitive/lltreeparams.cpp +++ b/linden/indra/llprimitive/lltreeparams.cpp @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llprimitive/lltreeparams.h b/linden/indra/llprimitive/lltreeparams.h index 08c72f3..9ca2c81 100644 --- a/linden/indra/llprimitive/lltreeparams.h +++ b/linden/indra/llprimitive/lltreeparams.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llprimitive/llvolumemessage.cpp b/linden/indra/llprimitive/llvolumemessage.cpp index 4be9d15..dcfecb1 100644 --- a/linden/indra/llprimitive/llvolumemessage.cpp +++ b/linden/indra/llprimitive/llvolumemessage.cpp @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llprimitive/llvolumemessage.h b/linden/indra/llprimitive/llvolumemessage.h index 9dfcd91..514c700 100644 --- a/linden/indra/llprimitive/llvolumemessage.h +++ b/linden/indra/llprimitive/llvolumemessage.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llprimitive/llvolumexml.cpp b/linden/indra/llprimitive/llvolumexml.cpp index 4a33db9..cdc6f62 100644 --- a/linden/indra/llprimitive/llvolumexml.cpp +++ b/linden/indra/llprimitive/llvolumexml.cpp @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llprimitive/llvolumexml.h b/linden/indra/llprimitive/llvolumexml.h index 0b59c4c..1c6a50c 100644 --- a/linden/indra/llprimitive/llvolumexml.h +++ b/linden/indra/llprimitive/llvolumexml.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llprimitive/material_codes.h b/linden/indra/llprimitive/material_codes.h index 088eecf..e5a59a2 100644 --- a/linden/indra/llprimitive/material_codes.h +++ b/linden/indra/llprimitive/material_codes.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llprimitive/object_flags.h b/linden/indra/llprimitive/object_flags.h index dbd3556..c873f50 100644 --- a/linden/indra/llprimitive/object_flags.h +++ b/linden/indra/llprimitive/object_flags.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llrender/CMakeLists.txt b/linden/indra/llrender/CMakeLists.txt index 76858d9..0bdb55f 100644 --- a/linden/indra/llrender/CMakeLists.txt +++ b/linden/indra/llrender/CMakeLists.txt @@ -9,6 +9,8 @@ include(LLImage) include(LLMath) include(LLRender) include(LLWindow) +include(LLXML) +include(LLVFS) include_directories( ${FREETYPE_INCLUDE_DIRS} @@ -17,19 +19,21 @@ include_directories( ${LLMATH_INCLUDE_DIRS} ${LLRENDER_INCLUDE_DIRS} ${LLWINDOW_INCLUDE_DIRS} + ${LLXML_INCLUDE_DIRS} + ${LLVFS_INCLUDE_DIRS} ) set(llrender_SOURCE_FILES llcubemap.cpp llfont.cpp llfontgl.cpp + llfontbitmapcache.cpp + llfontregistry.cpp llgldbg.cpp llglslshader.cpp llimagegl.cpp llpostprocess.cpp - llrender.cpp llrendersphere.cpp - llrendertarget.cpp llshadermgr.cpp llvertexbuffer.cpp ) @@ -40,6 +44,8 @@ set(llrender_HEADER_FILES llcubemap.h llfontgl.h llfont.h + llfontbitmapcache.h + llfontregistry.h llgl.h llgldbg.h llglheaders.h @@ -50,7 +56,6 @@ set(llrender_HEADER_FILES llpostprocess.h llrender.h llrendersphere.h - llrendertarget.h llshadermgr.h llvertexbuffer.h ) @@ -63,6 +68,7 @@ list(APPEND llrender_SOURCE_FILES ${llrender_HEADER_FILES}) if (SERVER AND NOT WINDOWS AND NOT DARWIN) copy_server_sources( llgl + llrender ) @@ -78,6 +84,8 @@ if (SERVER AND NOT WINDOWS AND NOT DARWIN) else (SERVER AND NOT WINDOWS AND NOT DARWIN) list(APPEND llrender_SOURCE_FILES llgl.cpp + llrender.cpp + llrendertarget.cpp ) endif (SERVER AND NOT WINDOWS AND NOT DARWIN) add_library (llrender ${llrender_SOURCE_FILES}) diff --git a/linden/indra/llrender/llcubemap.cpp b/linden/indra/llrender/llcubemap.cpp index 60215f0..754d90c 100644 --- a/linden/indra/llrender/llcubemap.cpp +++ b/linden/indra/llrender/llcubemap.cpp @@ -17,7 +17,8 @@ * 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 + * 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, @@ -39,7 +40,6 @@ #include "v3dmath.h" #include "m3math.h" #include "m4math.h" -#include "llcamera.h" #include "llrender.h" @@ -85,9 +85,9 @@ void LLCubeMap::initGL() // Not initialized, do stuff. if (mImages[0].isNull()) { - GLuint texname = 0; + U32 texname = 0; - glGenTextures(1, &texname); + LLImageGL::generateTextures(1, &texname); for (int i = 0; i < 6; i++) { @@ -97,9 +97,10 @@ void LLCubeMap::initGL() mImages[i]->createGLTexture(0, mRawImages[i], texname); gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_CUBE_MAP, texname); - mImages[i]->setClampCubemap (TRUE, TRUE, TRUE); + mImages[i]->setAddressMode(LLTexUnit::TAM_CLAMP); stop_glerror(); } + gGL.getTexUnit(0)->disable(); } disable(); } @@ -311,8 +312,8 @@ void LLCubeMap::restoreMatrix() void LLCubeMap::setReflection (void) { gGL.getTexUnit(mTextureStage)->bindManual(LLTexUnit::TT_CUBE_MAP, getGLName()); - mImages[0]->setMipFilterNearest (FALSE, FALSE); - mImages[0]->setClampCubemap (TRUE, TRUE); + mImages[0]->setFilteringOption(LLTexUnit::TFO_ANISOTROPIC); + mImages[0]->setAddressMode(LLTexUnit::TAM_CLAMP); } LLVector3 LLCubeMap::map(U8 side, U16 v_val, U16 h_val) const diff --git a/linden/indra/llrender/llcubemap.h b/linden/indra/llrender/llcubemap.h index 8c83e6e..c854485 100644 --- a/linden/indra/llrender/llcubemap.h +++ b/linden/indra/llrender/llcubemap.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llrender/llfont.cpp b/linden/indra/llrender/llfont.cpp index d7310bd..9245803 100644 --- a/linden/indra/llrender/llfont.cpp +++ b/linden/indra/llrender/llfont.cpp @@ -17,7 +17,8 @@ * 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 + * 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, @@ -52,6 +53,8 @@ #include "llmath.h" // Linden math #include "llstring.h" //#include "imdebug.h" +#include "llfontbitmapcache.h" +#include "llgl.h" FT_Render_Mode gFontRenderMode = FT_RENDER_MODE_NORMAL; @@ -124,30 +127,28 @@ void LLFontList::addAtEnd(LLFont *font) this->push_back(font); } -LLFont::LLFont(LLImageRaw *imagep) - : mRawImagep(imagep) +LLFont::LLFont() { + mFontBitmapCachep = new LLFontBitmapCache; + mValid = FALSE; mAscender = 0.f; mDescender = 0.f; mLineHeight = 0.f; - mBitmapWidth = 0; - mBitmapHeight = 0; - mCurrentOffsetX = 1; - mCurrentOffsetY = 1; - mMaxCharWidth = 0; - mMaxCharHeight = 0; - mNumComponents = 0; + mFallbackFontp = NULL; mIsFallback = FALSE; mFTFace = NULL; + + mRenderGlyphCount = 0; + mAddGlyphCount = 0; + + mPointSize = 0; } LLFont::~LLFont() { - mRawImagep = NULL; // dereferences or deletes image - // Clean up freetype libs. if (mFTFace) FT_Done_Face(mFTFace); @@ -155,11 +156,8 @@ LLFont::~LLFont() // Delete glyph info std::for_each(mCharGlyphInfoMap.begin(), mCharGlyphInfoMap.end(), DeletePairedPointer()); -} -void LLFont::setRawImage(LLImageRaw *imagep) -{ - mRawImagep = imagep; // will delete old raw image if we have one and created it + // mFontBitmapCachep will be cleaned up by LLPointer destructor. } // virtual @@ -203,7 +201,6 @@ BOOL LLFont::loadFace(const std::string& filename, const F32 point_size, const F } mIsFallback = is_fallback; - mNumComponents = components; F32 pixels_per_em = (point_size / 72.f)*vert_dpi; // Size in inches * dpi error = FT_Set_Char_Size(mFTFace, /* handle to face object */ @@ -233,8 +230,10 @@ BOOL LLFont::loadFace(const std::string& filename, const F32 point_size, const F mDescender = -mFTFace->descender * pixels_per_unit; mLineHeight = mFTFace->height * pixels_per_unit; - mMaxCharWidth = llround(0.5f + (x_max - x_min)); - mMaxCharHeight = llround(0.5f + (y_max - y_min)); + S32 max_char_width = llround(0.5f + (x_max - x_min)); + S32 max_char_height = llround(0.5f + (y_max - y_min)); + + mFontBitmapCachep->init(components, max_char_width, max_char_height); if (!mFTFace->charmap) { @@ -242,62 +241,20 @@ BOOL LLFont::loadFace(const std::string& filename, const F32 point_size, const F FT_Set_Charmap(mFTFace, mFTFace->charmaps[0]); } - if (mRawImagep.isNull() && !mIsFallback) - { - mRawImagep = new LLImageRaw(); - } - if (!mIsFallback) { - // Place text into bitmap, and generate all necessary positions/ - // offsets for the individual characters. - - // calc width and height for mRawImagep (holds all characters) - // Guess for approximately 20*20 characters - S32 image_width = mMaxCharWidth * 20; - S32 pow_iw = 2; - while (pow_iw < image_width) - { - pow_iw *= 2; - } - image_width = pow_iw; - image_width = llmin(512, image_width); // Don't make bigger than 512x512, ever. - S32 image_height = image_width; - - //llinfos << "Guessing texture size of " << image_width << " pixels square" << llendl; - - mRawImagep->resize(image_width, image_height, components); - - mBitmapWidth = image_width; - mBitmapHeight = image_height; - - switch (components) - { - case 1: - mRawImagep->clear(); - break; - case 2: - mRawImagep->clear(255, 0); - break; - } - - mCurrentOffsetX = 1; - mCurrentOffsetY = 1; - // Add the default glyph addGlyph(0, 0); } mName = filename; + mPointSize = point_size; return TRUE; } - -void LLFont::resetBitmap() +void LLFont::resetBitmapCache() { - llinfos << "Rebuilding bitmap for glyph" << llendl; - // Iterate through glyphs and clear the mIsRendered flag for (char_glyph_info_map_t::iterator iter = mCharGlyphInfoMap.begin(); iter != mCharGlyphInfoMap.end(); ++iter) @@ -307,9 +264,7 @@ void LLFont::resetBitmap() //not just flushing the bitmap iter->second->mMetricsValid = FALSE; } - mRawImagep->clear(255, 0); - mCurrentOffsetX = 1; - mCurrentOffsetY = 1; + mFontBitmapCachep->reset(); // Add the empty glyph`5 addGlyph(0, 0); @@ -340,7 +295,7 @@ BOOL LLFont::hasGlyph(const llwchar wch) const } } -BOOL LLFont::addChar(const llwchar wch) +BOOL LLFont::addChar(const llwchar wch) const { if (mFTFace == NULL) return FALSE; @@ -375,7 +330,6 @@ BOOL LLFont::addChar(const llwchar wch) if (iter == mCharGlyphInfoMap.end() || !(iter->second->mIsRendered)) { BOOL result = addGlyph(wch, glyph_index); - //imdebug("luma b=8 w=%d h=%d t=%s %p", mRawImagep->getWidth(), mRawImagep->getHeight(), mName.c_str(), mRawImagep->getData()); return result; } return FALSE; @@ -395,7 +349,7 @@ void LLFont::insertGlyphInfo(llwchar wch, LLFontGlyphInfo* gi) const } } -BOOL LLFont::addGlyphFromFont(LLFont *fontp, const llwchar wch, const U32 glyph_index) +BOOL LLFont::addGlyphFromFont(const LLFont *fontp, const llwchar wch, const U32 glyph_index) const { if (mFTFace == NULL) return FALSE; @@ -405,35 +359,15 @@ BOOL LLFont::addGlyphFromFont(LLFont *fontp, const llwchar wch, const U32 glyph_ S32 width = fontp->mFTFace->glyph->bitmap.width; S32 height = fontp->mFTFace->glyph->bitmap.rows; - if ((mCurrentOffsetX + width + 1) > mRawImagep->getWidth()) - { - if ((mCurrentOffsetY + 2*mMaxCharHeight + 2) > mBitmapHeight) - { - // We're out of space in this texture - clear it an all of the glyphs - // and start over again. Easier than LRU and should work just as well - // (just slightly slower on the rebuild). As long as the texture has - // enough room to hold all glyphs needed for a particular frame this - // shouldn't be too slow. - - resetBitmap(); - - // Need to rerender the glyph, as it's been overwritten by the default glyph. - fontp->renderGlyph(glyph_index); - width = fontp->mFTFace->glyph->bitmap.width; - height = fontp->mFTFace->glyph->bitmap.rows; - - // We should have a reasonable offset for x and y, no need to check that it's in range - } - else - { - mCurrentOffsetX = 1; - mCurrentOffsetY += mMaxCharHeight + 1; - } - } + S32 pos_x, pos_y; + S32 bitmap_num; + mFontBitmapCachep->nextOpenPos(width, pos_x, pos_y, bitmap_num); + mAddGlyphCount++; LLFontGlyphInfo* gi = new LLFontGlyphInfo(glyph_index); - gi->mXBitmapOffset = mCurrentOffsetX; - gi->mYBitmapOffset = mCurrentOffsetY; + gi->mXBitmapOffset = pos_x; + gi->mYBitmapOffset = pos_y; + gi->mBitmapNum = bitmap_num; gi->mWidth = width; gi->mHeight = height; gi->mXBearing = fontp->mFTFace->glyph->bitmap_left; @@ -482,24 +416,25 @@ BOOL LLFont::addGlyphFromFont(LLFont *fontp, const llwchar wch, const U32 glyph_ buffer_row_stride = width; } - switch (mNumComponents) + switch (mFontBitmapCachep->getNumComponents()) { case 1: - mRawImagep->setSubImage(mCurrentOffsetX, - mCurrentOffsetY, - width, - height, - buffer_data, - buffer_row_stride, - TRUE); + mFontBitmapCachep->getImageRaw(bitmap_num)->setSubImage(pos_x, + pos_y, + width, + height, + buffer_data, + buffer_row_stride, + TRUE); break; case 2: - setSubImageLuminanceAlpha(mCurrentOffsetX, - mCurrentOffsetY, - width, - height, - buffer_data, - buffer_row_stride); + setSubImageLuminanceAlpha(pos_x, + pos_y, + bitmap_num, + width, + height, + buffer_data, + buffer_row_stride); break; default: break; @@ -512,11 +447,10 @@ BOOL LLFont::addGlyphFromFont(LLFont *fontp, const llwchar wch, const U32 glyph_ // omit it from the font-image. } - mCurrentOffsetX += width + 1; return TRUE; } -BOOL LLFont::addGlyph(const llwchar wch, const U32 glyph_index) +BOOL LLFont::addGlyph(const llwchar wch, const U32 glyph_index) const { return addGlyphFromFont(this, wch, glyph_index); } @@ -557,7 +491,7 @@ F32 LLFont::getXAdvance(const llwchar wch) const if (glyph_index) { // This font has this glyph - (const_cast(fontp))->renderGlyph(glyph_index); + fontp->renderGlyph(glyph_index); // Create the entry if it's not there char_glyph_info_map_t::iterator iter2 = mCharGlyphInfoMap.find(wch); @@ -590,11 +524,11 @@ F32 LLFont::getXAdvance(const llwchar wch) const } // Last ditch fallback - no glyphs defined at all. - return (F32)mMaxCharWidth; + return (F32)mFontBitmapCachep->getMaxCharWidth(); } -void LLFont::renderGlyph(const U32 glyph_index) +void LLFont::renderGlyph(const U32 glyph_index) const { if (mFTFace == NULL) return; @@ -603,6 +537,9 @@ void LLFont::renderGlyph(const U32 glyph_index) llassert(!error); error = FT_Render_Glyph(mFTFace->glyph, gFontRenderMode); + + mRenderGlyphCount++; + llassert(!error); } @@ -627,16 +564,20 @@ F32 LLFont::getXKerning(const llwchar char_left, const llwchar char_right) const } void LLFont::setSubImageLuminanceAlpha(const U32 x, - const U32 y, - const U32 width, - const U32 height, - const U8 *data, - S32 stride) + const U32 y, + const U32 bitmap_num, + const U32 width, + const U32 height, + const U8 *data, + S32 stride) const { + LLImageRaw *image_raw = mFontBitmapCachep->getImageRaw(bitmap_num); + llassert(!mIsFallback); - llassert(mRawImagep->getComponents() == 2); + llassert(image_raw && (image_raw->getComponents() == 2)); - U8 *target = mRawImagep->getData(); + + U8 *target = image_raw->getData(); if (!data) { @@ -649,7 +590,7 @@ void LLFont::setSubImageLuminanceAlpha(const U32 x, U32 i, j; U32 to_offset; U32 from_offset; - U32 target_width = mRawImagep->getWidth(); + U32 target_width = image_raw->getWidth(); for (i = 0; i < height; i++) { to_offset = (y + i)*target_width + x; diff --git a/linden/indra/llrender/llfont.h b/linden/indra/llrender/llfont.h index bce8d76..b423f7d 100644 --- a/linden/indra/llrender/llfont.h +++ b/linden/indra/llrender/llfont.h @@ -17,7 +17,8 @@ * 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 + * 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, @@ -37,6 +38,9 @@ #include "llmemory.h" #include "llstl.h" +#include "llimagegl.h" +#include "llfontbitmapcache.h" + class LLImageRaw; class LLFontManager; class LLFont; @@ -80,6 +84,7 @@ public: S32 mYBitmapOffset; // Offset to the origin in the bitmap S32 mXBearing; // Distance from baseline to left in pixels S32 mYBearing; // Distance from baseline to top in pixels + S32 mBitmapNum; // Which bitmap in the bitmap cache contains this glyph }; // Used for lists of fallback fonts @@ -91,14 +96,14 @@ public: void addAtEnd(LLFont *font); }; - class LLFont { public: - LLFont(LLImageRaw *imagep = NULL); + LLFont(); virtual ~LLFont(); - // is_fallback should be true for fallback fonts that aren't used to render directly (Unicode backup, primarily) + // is_fallback should be true for fallback fonts that aren't used + // to render directly (Unicode backup, primarily) virtual BOOL loadFace(const std::string& filename, const F32 point_size, const F32 vert_dpi, @@ -108,7 +113,6 @@ public: void setFallbackFont(LLFontList *fontp) { mFallbackFontp = fontp; } void setCharToGlyphMap(llwchar wch, U32 glyph_index) const; - void setRawImage( LLImageRaw *imagep ); // Global font metrics - in units of pixels virtual F32 getLineHeight() const; @@ -145,31 +149,29 @@ public: const LLFontGlyphInfo &getMetrics(const llwchar wc) const; F32 getXAdvance(const llwchar wc) const; F32 getXKerning(const llwchar char_left, const llwchar char_right) const; // Get the kerning between the two characters + virtual void reset() = 0; + protected: virtual BOOL hasGlyph(const llwchar wch) const; // Has a glyph for this character - virtual BOOL addChar(const llwchar wch); // Add a new character to the font if necessary - virtual BOOL addGlyph(const llwchar wch, const U32 glyph_index); // Add a new glyph to the existing font - virtual BOOL addGlyphFromFont(LLFont *fontp, const llwchar wch, const U32 glyph_index); // Add a glyph from this font to the other (returns the glyph_index, 0 if not found) + virtual BOOL addChar(const llwchar wch) const; // Add a new character to the font if necessary + virtual BOOL addGlyph(const llwchar wch, const U32 glyph_index) const; // Add a new glyph to the existing font + virtual BOOL addGlyphFromFont(const LLFont *fontp, const llwchar wch, const U32 glyph_index) const; // Add a glyph from this font to the other (returns the glyph_index, 0 if not found) virtual LLFontGlyphInfo* getGlyphInfo(const llwchar wch) const; void insertGlyphInfo(llwchar wch, LLFontGlyphInfo* gi) const; - void renderGlyph(const U32 glyph_index); + void renderGlyph(const U32 glyph_index) const; + + void resetBitmapCache(); - void resetBitmap(); // Reset bitmap to contain only the null glyph protected: std::string mName; + F32 mPointSize; F32 mAscender; F32 mDescender; F32 mLineHeight; - S32 mNumComponents; - S32 mBitmapWidth; - S32 mBitmapHeight; - S32 mMaxCharWidth; - S32 mMaxCharHeight; - S32 mCurrentOffsetX; - S32 mCurrentOffsetY; + mutable LLPointer mFontBitmapCachep; LLFT_Face mFTFace; @@ -181,14 +183,14 @@ protected: BOOL mValid; void setSubImageLuminanceAlpha(const U32 x, - const U32 y, - const U32 width, - const U32 height, - const U8 *data, - S32 stride = 0); - -private: - LLPointer mRawImagep; // Bitmaps of glyphs are stored here. + const U32 y, + const U32 bitmap_num, + const U32 width, + const U32 height, + const U8 *data, + S32 stride = 0) const; + mutable S32 mRenderGlyphCount; + mutable S32 mAddGlyphCount; }; #endif // LL_FONT_ diff --git a/linden/indra/llrender/llfontbitmapcache.cpp b/linden/indra/llrender/llfontbitmapcache.cpp new file mode 100644 index 0000000..052510e --- /dev/null +++ b/linden/indra/llrender/llfontbitmapcache.cpp @@ -0,0 +1,169 @@ +/** + * @file llfontbitmapcache.cpp + * @brief Storage for previously rendered glyphs. + * + * $LicenseInfo:firstyear=2008&license=viewergpl$ + * + * Copyright (c) 2008-2009, 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 "llgl.h" +#include "llfontbitmapcache.h" + +LLFontBitmapCache::LLFontBitmapCache(): + mNumComponents(0), + mMaxCharWidth(0), + mMaxCharHeight(0), + mBitmapWidth(0), + mBitmapHeight(0), + mCurrentOffsetX(1), + mCurrentOffsetY(1), + mCurrentBitmapNum(-1) +{ +} + +LLFontBitmapCache::~LLFontBitmapCache() +{ +} + +void LLFontBitmapCache::init(S32 num_components, + S32 max_char_width, + S32 max_char_height) +{ + reset(); + + mNumComponents = num_components; + mMaxCharWidth = max_char_width; + mMaxCharHeight = max_char_height; +} + +LLImageRaw *LLFontBitmapCache::getImageRaw(U32 bitmap_num) const +{ + if ((bitmap_num < 0) || (bitmap_num >= mImageRawVec.size())) + return NULL; + + return mImageRawVec[bitmap_num]; +} + +LLImageGL *LLFontBitmapCache::getImageGL(U32 bitmap_num) const +{ + if ((bitmap_num < 0) || (bitmap_num >= mImageGLVec.size())) + return NULL; + + return mImageGLVec[bitmap_num]; +} + + +BOOL LLFontBitmapCache::nextOpenPos(S32 width, S32 &pos_x, S32 &pos_y, S32& bitmap_num) +{ + if ((mBitmapNum<0) || (mCurrentOffsetX + width + 1) > mBitmapWidth) + { + if ((mBitmapNum<0) || (mCurrentOffsetY + 2*mMaxCharHeight + 2) > mBitmapHeight) + { + // We're out of space in the current image, or no image + // has been allocated yet. Make a new one. + mImageRawVec.push_back(new LLImageRaw); + mBitmapNum = mImageRawVec.size()-1; + LLImageRaw *image_raw = getImageRaw(mBitmapNum); + + // Make corresponding GL image. + mImageGLVec.push_back(new LLImageGL(FALSE)); + LLImageGL *image_gl = getImageGL(mBitmapNum); + + S32 image_width = mMaxCharWidth * 20; + S32 pow_iw = 2; + while (pow_iw < image_width) + { + pow_iw *= 2; + } + image_width = pow_iw; + image_width = llmin(512, image_width); // Don't make bigger than 512x512, ever. + S32 image_height = image_width; + + image_raw->resize(image_width, image_height, mNumComponents); + + mBitmapWidth = image_width; + mBitmapHeight = image_height; + + switch (mNumComponents) + { + case 1: + image_raw->clear(); + break; + case 2: + image_raw->clear(255, 0); + break; + } + + // Start at beginning of the new image. + mCurrentOffsetX = 1; + mCurrentOffsetY = 1; + + // Attach corresponding GL texture. + image_gl->createGLTexture(0, image_raw); + gGL.getTexUnit(0)->bind(image_gl); + image_gl->setFilteringOption(LLTexUnit::TFO_POINT); // was setMipFilterNearest(TRUE, TRUE); + } + else + { + // Move to next row in current image. + mCurrentOffsetX = 1; + mCurrentOffsetY += mMaxCharHeight + 1; + } + } + + pos_x = mCurrentOffsetX; + pos_y = mCurrentOffsetY; + bitmap_num = mBitmapNum; + + mCurrentOffsetX += width + 1; + + return TRUE; +} + +void LLFontBitmapCache::destroyGL() +{ + for (std::vector >::iterator it = mImageGLVec.begin(); + it != mImageGLVec.end(); ++it) + { + (*it)->destroyGLTexture(); + } +} + +void LLFontBitmapCache::reset() +{ + mImageRawVec.clear(); + mImageGLVec.clear(); + + mBitmapWidth = 0, + mBitmapHeight = 0, + mCurrentOffsetX = 0, + mCurrentOffsetY = 0, + mCurrentBitmapNum = -1; +} + diff --git a/linden/indra/llrender/llfontbitmapcache.h b/linden/indra/llrender/llfontbitmapcache.h new file mode 100644 index 0000000..4beea0d --- /dev/null +++ b/linden/indra/llrender/llfontbitmapcache.h @@ -0,0 +1,79 @@ +/** + * @file llfontbitmapcache.h + * @brief Storage for previously rendered glyphs. + * + * $LicenseInfo:firstyear=2008&license=viewergpl$ + * + * Copyright (c) 2008-2009, 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_LLFONTBITMAPCACHE_H +#define LL_LLFONTBITMAPCACHE_H + +#include + +// Maintain a collection of bitmaps containing rendered glyphs. +// Generalizes the single-bitmap logic from LLFont and LLFontGL. +class LLFontBitmapCache: public LLRefCount +{ +public: + LLFontBitmapCache(); + ~LLFontBitmapCache(); + + // Need to call this once, before caching any glyphs. + void init(S32 num_components, + S32 max_char_width, + S32 max_char_height); + + void reset(); + + BOOL nextOpenPos(S32 width, S32 &posX, S32 &posY, S32 &bitmapNum); + + void destroyGL(); + + LLImageRaw *getImageRaw(U32 bitmapNum = 0) const; + LLImageGL *getImageGL(U32 bitmapNum = 0) const; + + S32 getMaxCharWidth() const { return mMaxCharWidth; } + S32 getNumComponents() const { return mNumComponents; } + S32 getBitmapWidth() const { return mBitmapWidth; } + S32 getBitmapHeight() const { return mBitmapHeight; } + +private: + S32 mNumComponents; + S32 mBitmapWidth; + S32 mBitmapHeight; + S32 mBitmapNum; + S32 mMaxCharWidth; + S32 mMaxCharHeight; + S32 mCurrentOffsetX; + S32 mCurrentOffsetY; + S32 mCurrentBitmapNum; + std::vector > mImageRawVec; + std::vector > mImageGLVec; +}; + +#endif //LL_LLFONTBITMAPCACHE_H diff --git a/linden/indra/llrender/llfontgl.cpp b/linden/indra/llrender/llfontgl.cpp index 526f1a9..beecb6b 100644 --- a/linden/indra/llrender/llfontgl.cpp +++ b/linden/indra/llrender/llfontgl.cpp @@ -17,7 +17,8 @@ * 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 + * 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, @@ -35,6 +36,8 @@ #include "llfont.h" #include "llfontgl.h" +#include "llfontbitmapcache.h" +#include "llfontregistry.h" #include "llgl.h" #include "llrender.h" #include "v4color.h" @@ -50,32 +53,19 @@ F32 LLFontGL::sScaleY = 1.f; BOOL LLFontGL::sDisplayFont = TRUE ; std::string LLFontGL::sAppDir; -LLFontGL* LLFontGL::sMonospace = NULL; -LLFontGL* LLFontGL::sSansSerifSmall = NULL; -LLFontGL* LLFontGL::sSansSerif = NULL; -LLFontGL* LLFontGL::sSansSerifBig = NULL; -LLFontGL* LLFontGL::sSansSerifHuge = NULL; -LLFontGL* LLFontGL::sSansSerifBold = NULL; -LLFontList* LLFontGL::sMonospaceFallback = NULL; -LLFontList* LLFontGL::sSSFallback = NULL; -LLFontList* LLFontGL::sSSSmallFallback = NULL; -LLFontList* LLFontGL::sSSBigFallback = NULL; -LLFontList* LLFontGL::sSSHugeFallback = NULL; -LLFontList* LLFontGL::sSSBoldFallback = NULL; LLColor4 LLFontGL::sShadowColor(0.f, 0.f, 0.f, 1.f); +LLFontRegistry* LLFontGL::sFontRegistry = NULL; LLCoordFont LLFontGL::sCurOrigin; std::vector LLFontGL::sOriginStack; -LLFontGL*& gExtCharFont = LLFontGL::sSansSerif; - const F32 EXT_X_BEARING = 1.f; const F32 EXT_Y_BEARING = 0.f; const F32 EXT_KERNING = 1.f; const F32 PIXEL_BORDER_THRESHOLD = 0.0001f; const F32 PIXEL_CORRECTION_DISTANCE = 0.01f; -const F32 PAD_AMT = 0.5f; +const F32 PAD_UVY = 0.5f; // half of vertical padding between glyphs in the glyph texture const F32 DROP_SHADOW_SOFT_STRENGTH = 0.3f; F32 llfont_round_x(F32 x) @@ -126,7 +116,6 @@ U8 LLFontGL::getStyleFromString(const std::string &style) LLFontGL::LLFontGL() : LLFont() { - init(); clearEmbeddedChars(); } @@ -137,32 +126,30 @@ LLFontGL::LLFontGL(const LLFontGL &source) LLFontGL::~LLFontGL() { - mImageGLp = NULL; - mRawImageGLp = NULL; clearEmbeddedChars(); } -void LLFontGL::init() +void LLFontGL::reset() { - if (mImageGLp.isNull()) - { - mImageGLp = new LLImageGL(FALSE); - //RN: use nearest mipmap filtering to obviate the need to do pixel-accurate positioning - gGL.getTexUnit(0)->bind(mImageGLp); - // we allow bilinear filtering to get sub-pixel positioning for drop shadows - //mImageGLp->setMipFilterNearest(TRUE, TRUE); - } - if (mRawImageGLp.isNull()) + if (!mIsFallback) { - mRawImageGLp = new LLImageRaw; // Note LLFontGL owns the image, not LLFont. + // This is the head of the list - need to rebuild ourself and all fallbacks. + loadFace(mName,mPointSize,sVertDPI,sHorizDPI,mFontBitmapCachep->getNumComponents(),mIsFallback); + if (mFallbackFontp==NULL) + { + llwarns << "LLFontGL::reset(), no fallback fonts present" << llendl; + } + else + { + for (LLFontList::iterator it = mFallbackFontp->begin(); + it != mFallbackFontp->end(); + ++it) + { + (*it)->reset(); + } + } } - setRawImage( mRawImageGLp ); -} - -void LLFontGL::reset() -{ - init(); - resetBitmap(); + resetBitmapCache(); } // static @@ -219,243 +206,48 @@ std::string LLFontGL::getFontPathLocal() return local_path; } -//static -bool LLFontGL::loadFaceFallback(LLFontList *fontlistp, const std::string& fontname, const F32 point_size) +bool findOrCreateFont(LLFontGL*& fontp, const LLFontDescriptor& desc) { - 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. - typedef boost::tokenizer > tokenizer; - boost::char_separator sep(";"); - tokenizer tokens(fontname, sep); - tokenizer::iterator token_iter; - - for(token_iter = tokens.begin(); token_iter != tokens.end(); ++token_iter) - { - LLFont *fontp = new LLFont(); - 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; - if (!fontp->loadFace(font_path, point_size, sVertDPI, sHorizDPI, 2, TRUE)) - { - LL_INFOS_ONCE("ViewerImages") << "Couldn't load font " << *token_iter << LL_ENDL; - delete fontp; - fontp = NULL; - } - } - - if(fontp) - { - fontlistp->addAtEnd(fontp); - } - } - - // We want to return true if at least one fallback font loaded correctly. - return (fontlistp->size() > 0); + // Don't delete existing fonts, if any, here, because they've + // already been deleted by LLFontRegistry::clear() + fontp = LLFontGL::getFont(desc); + return (fontp != NULL); } -//static -bool LLFontGL::loadFace(LLFontGL *fontp, const std::string& fontname, const F32 point_size, LLFontList *fallback_fontp) -{ - std::string local_path = getFontPathLocal(); - std::string font_path = local_path + fontname; - if (!fontp->loadFace(font_path, point_size, sVertDPI, sHorizDPI, 2, FALSE)) - { - std::string sys_path = getFontPathSystem(); - font_path = sys_path + fontname; - if (!fontp->loadFace(font_path, point_size, sVertDPI, sHorizDPI, 2, FALSE)) - { - LL_WARNS("ViewerImages") << "Couldn't load font " << fontname << LL_ENDL; - return false; - } - } - - fontp->setFallbackFont(fallback_fontp); - return true; -} - - // static BOOL LLFontGL::initDefaultFonts(F32 screen_dpi, F32 x_scale, F32 y_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 std::string& sansserif_bold_file, F32 bold_size, - const std::string& app_dir) + const std::string& app_dir, + const std::vector& xui_paths) { - BOOL failed = FALSE; + bool succ = true; sVertDPI = (F32)llfloor(screen_dpi * y_scale); sHorizDPI = (F32)llfloor(screen_dpi * x_scale); sScaleX = x_scale; sScaleY = y_scale; sAppDir = app_dir; - // - // Monospace font - // - - if (!sMonospace) + // Font registry init + if (!sFontRegistry) { - sMonospace = new LLFontGL(); + sFontRegistry = new LLFontRegistry(xui_paths); + sFontRegistry->parseFontInfo("fonts.xml"); } else { - sMonospace->reset(); - } - - if (sMonospaceFallback) - { - delete sMonospaceFallback; - } - sMonospaceFallback = new LLFontList(); - if (!loadFaceFallback( - sMonospaceFallback, - sanserif_fallback_file, - monospace_size * ss_fallback_scale)) - { - delete sMonospaceFallback; - sMonospaceFallback = NULL; + sFontRegistry->reset(); } - failed |= !loadFace(sMonospace, monospace_file, monospace_size, sMonospaceFallback); - - // - // Sans-serif fonts - // - if(!sSansSerifHuge) - { - sSansSerifHuge = new LLFontGL(); - } - else - { - sSansSerifHuge->reset(); - } - - if (sSSHugeFallback) - { - delete sSSHugeFallback; - } - sSSHugeFallback = new LLFontList(); - if (!loadFaceFallback( - sSSHugeFallback, - sanserif_fallback_file, - huge_size*ss_fallback_scale)) - { - delete sSSHugeFallback; - sSSHugeFallback = NULL; - } - - failed |= !loadFace(sSansSerifHuge, sansserif_file, huge_size, sSSHugeFallback); - - - if(!sSansSerifBig) - { - sSansSerifBig = new LLFontGL(); - } - else - { - sSansSerifBig->reset(); - } - - if (sSSBigFallback) - { - delete sSSBigFallback; - } - sSSBigFallback = new LLFontList(); - if (!loadFaceFallback( - sSSBigFallback, - sanserif_fallback_file, - big_size*ss_fallback_scale)) - { - delete sSSBigFallback; - sSSBigFallback = NULL; - } - - failed |= !loadFace(sSansSerifBig, sansserif_file, big_size, sSSBigFallback); - - - if(!sSansSerif) - { - sSansSerif = new LLFontGL(); - } - else - { - sSansSerif->reset(); - } - - if (sSSFallback) - { - delete sSSFallback; - } - sSSFallback = new LLFontList(); - if (!loadFaceFallback( - sSSFallback, - sanserif_fallback_file, - medium_size*ss_fallback_scale)) - { - delete sSSFallback; - sSSFallback = NULL; - } - failed |= !loadFace(sSansSerif, sansserif_file, medium_size, sSSFallback); - - - if(!sSansSerifSmall) - { - sSansSerifSmall = new LLFontGL(); - } - else - { - sSansSerifSmall->reset(); - } - - if(sSSSmallFallback) - { - delete sSSSmallFallback; - } - sSSSmallFallback = new LLFontList(); - if (!loadFaceFallback( - sSSSmallFallback, - sanserif_fallback_file, - small_size*ss_fallback_scale)) - { - delete sSSSmallFallback; - sSSSmallFallback = NULL; - } - failed |= !loadFace(sSansSerifSmall, sansserif_file, small_size, sSSSmallFallback); - - - // - // Sans-serif bold - // - if(!sSansSerifBold) - { - sSansSerifBold = new LLFontGL(); - } - else - { - sSansSerifBold->reset(); - } - - if (sSSBoldFallback) - { - delete sSSBoldFallback; - } - sSSBoldFallback = new LLFontList(); - if (!loadFaceFallback( - sSSBoldFallback, - sanserif_fallback_file, - medium_size*ss_fallback_scale)) - { - delete sSSBoldFallback; - sSSBoldFallback = NULL; - } - failed |= !loadFace(sSansSerifBold, sansserif_bold_file, medium_size, sSSBoldFallback); - - return !failed; + // Force standard fonts to get generated up front. + // This is primarily for error detection purposes. + succ &= (NULL != getFontSansSerifSmall()); + succ &= (NULL != getFontSansSerif()); + succ &= (NULL != getFontSansSerifBig()); + succ &= (NULL != getFontSansSerifHuge()); + succ &= (NULL != getFontSansSerifBold()); + succ &= (NULL != getFontMonospace()); + succ &= (NULL != getFontExtChar()); + + return succ; } @@ -463,57 +255,23 @@ BOOL LLFontGL::initDefaultFonts(F32 screen_dpi, F32 x_scale, F32 y_scale, // static void LLFontGL::destroyDefaultFonts() { - delete sMonospace; - sMonospace = NULL; - - delete sSansSerifHuge; - sSansSerifHuge = NULL; - - delete sSansSerifBig; - sSansSerifBig = NULL; - - delete sSansSerif; - sSansSerif = NULL; - - delete sSansSerifSmall; - sSansSerifSmall = NULL; - - delete sSansSerifBold; - sSansSerifBold = NULL; - - delete sMonospaceFallback; - sMonospaceFallback = NULL; - - delete sSSHugeFallback; - sSSHugeFallback = NULL; - - delete sSSBigFallback; - sSSBigFallback = NULL; - - delete sSSFallback; - sSSFallback = NULL; - - delete sSSSmallFallback; - sSSSmallFallback = NULL; - - delete sSSBoldFallback; - sSSBoldFallback = NULL; + // Remove the actual fonts. + delete sFontRegistry; + sFontRegistry = NULL; } //static -void LLFontGL::destroyGL() +void LLFontGL::destroyAllGL() { - if (!sMonospace) + if (sFontRegistry) { - // Already all destroyed. - return; + sFontRegistry->destroyGL(); } - sMonospace->mImageGLp->destroyGLTexture(); - sSansSerifHuge->mImageGLp->destroyGLTexture(); - sSansSerifSmall->mImageGLp->destroyGLTexture(); - sSansSerif->mImageGLp->destroyGLTexture(); - sSansSerifBig->mImageGLp->destroyGLTexture(); - sSansSerifBold->mImageGLp->destroyGLTexture(); +} + +void LLFontGL::destroyGL() +{ + mFontBitmapCachep->destroyGL(); } @@ -532,13 +290,58 @@ BOOL LLFontGL::loadFace(const std::string& filename, { return FALSE; } - mImageGLp->createGLTexture(0, mRawImageGLp); - gGL.getTexUnit(0)->bind(mImageGLp); - mImageGLp->setMipFilterNearest(TRUE, TRUE); return TRUE; } -BOOL LLFontGL::addChar(const llwchar wch) +//static +LLFontGL* LLFontGL::getFontMonospace() +{ + return getFont(LLFontDescriptor("Monospace","Monospace",0)); +} + +//static +LLFontGL* LLFontGL::getFontSansSerifSmall() +{ + return getFont(LLFontDescriptor("SansSerif","Small",0)); +} + +//static +LLFontGL* LLFontGL::getFontSansSerif() +{ + return getFont(LLFontDescriptor("SansSerif","Medium",0)); +} + +//static +LLFontGL* LLFontGL::getFontSansSerifBig() +{ + return getFont(LLFontDescriptor("SansSerif","Large",0)); +} + +//static +LLFontGL* LLFontGL::getFontSansSerifHuge() +{ + return getFont(LLFontDescriptor("SansSerif","Huge",0)); +} + +//static +LLFontGL* LLFontGL::getFontSansSerifBold() +{ + return getFont(LLFontDescriptor("SansSerif","Medium",BOLD)); +} + +//static +LLFontGL* LLFontGL::getFontExtChar() +{ + return getFontSansSerif(); +} + +//static +LLFontGL* LLFontGL::getFont(const LLFontDescriptor& desc) +{ + return sFontRegistry->getFont(desc); +} + +BOOL LLFontGL::addChar(const llwchar wch) const { if (!LLFont::addChar(wch)) { @@ -546,10 +349,12 @@ BOOL LLFontGL::addChar(const llwchar wch) } stop_glerror(); - mImageGLp->setSubImage(mRawImageGLp, 0, 0, mImageGLp->getWidth(), mImageGLp->getHeight()); - gGL.getTexUnit(0)->bind(mImageGLp); - mImageGLp->setMipFilterNearest(TRUE, TRUE); - stop_glerror(); + + LLFontGlyphInfo *glyph_info = getGlyphInfo(wch); + U32 bitmap_num = glyph_info->mBitmapNum; + LLImageGL *image_gl = mFontBitmapCachep->getImageGL(bitmap_num); + LLImageRaw *image_raw = mFontBitmapCachep->getImageRaw(bitmap_num); + image_gl->setSubImage(image_raw, 0, 0, image_gl->getWidth(), image_gl->getHeight()); return TRUE; } @@ -564,7 +369,7 @@ S32 LLFontGL::renderUTF8(const std::string &text, const S32 offset, BOOL use_ellipses) const { LLWString wstr = utf8str_to_wstring(text); - return render(wstr, offset, x, y, color, halign, valign, style, max_chars, max_pixels, right_x, use_ellipses); + return render(wstr, offset, x, y, color, halign, valign, style, max_chars, max_pixels, right_x, FALSE, use_ellipses); } S32 LLFontGL::render(const LLWString &wstr, @@ -583,30 +388,17 @@ S32 LLFontGL::render(const LLWString &wstr, return wstr.length() ; } - gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE); - if (wstr.empty()) { return 0; } + gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE); + S32 scaled_max_pixels = max_pixels == S32_MAX ? S32_MAX : llceil((F32)max_pixels * sScaleX); - // HACK for better bolding - if (style & BOLD) - { - if (this == LLFontGL::sSansSerif) - { - return LLFontGL::sSansSerifBold->render( - wstr, begin_offset, - x, y, - color, - halign, valign, - (style & ~BOLD), - max_chars, max_pixels, - right_x, use_embedded); - } - } + // Strip off any style bits that are already accounted for by the font. + style = style & (~getFontDesc().getStyle()); F32 drop_shadow_strength = 0.f; if (style & (DROP_SHADOW | DROP_SHADOW_SOFT)) @@ -623,25 +415,12 @@ S32 LLFontGL::render(const LLWString &wstr, gGL.pushMatrix(); glLoadIdentity(); gGL.translatef(floorf(sCurOrigin.mX*sScaleX), floorf(sCurOrigin.mY*sScaleY), sCurOrigin.mZ); - //glScalef(sScaleX, sScaleY, 1.0f); - - // avoid half pixels - // RN: if we're going to this trouble, might as well snap to nearest pixel all the time - // but the plan is to get rid of this so that fonts "just work" - //F32 half_pixel_distance = llabs(fmodf(sCurOrigin.mX * sScaleX, 1.f) - 0.5f); - //if (half_pixel_distance < PIXEL_BORDER_THRESHOLD) - //{ - gGL.translatef(PIXEL_CORRECTION_DISTANCE*sScaleX, 0.f, 0.f); - //} - - // this code would just snap to pixel grid, although it seems to introduce more jitter - //F32 pixel_offset_x = llround(sCurOrigin.mX * sScaleX) - (sCurOrigin.mX * sScaleX); - //F32 pixel_offset_y = llround(sCurOrigin.mY * sScaleY) - (sCurOrigin.mY * sScaleY); - //gGL.translatef(-pixel_offset_x, -pixel_offset_y, 0.f); - - // scale back to native pixel size - //glScalef(1.f / sScaleX, 1.f / sScaleY, 1.f); - //glScaled(1.0 / (F64) sScaleX, 1.0 / (F64) sScaleY, 1.0f); + + // this code snaps the text origin to a pixel grid to start with + F32 pixel_offset_x = llround((F32)sCurOrigin.mX) - (sCurOrigin.mX); + F32 pixel_offset_y = llround((F32)sCurOrigin.mY) - (sCurOrigin.mY); + gGL.translatef(-pixel_offset_x, -pixel_offset_y, 0.f); + LLFastTimer t(LLFastTimer::FTM_RENDER_FONTS); gGL.color4fv( color.mV ); @@ -661,10 +440,6 @@ S32 LLFontGL::render(const LLWString &wstr, F32 cur_x, cur_y, cur_render_x, cur_render_y; - // Bind the font texture - - gGL.getTexUnit(0)->bind(mImageGLp); - // Not guaranteed to be set correctly gGL.setSceneBlendType(LLRender::BT_ALPHA); @@ -704,17 +479,13 @@ S32 LLFontGL::render(const LLWString &wstr, break; } - // Round properly. - //cur_render_y = (F32)llfloor(cur_y/sScaleY + 0.5f)*sScaleY; - //cur_render_x = (F32)llfloor(cur_x/sScaleX + 0.5f)*sScaleX; - cur_render_y = cur_y; cur_render_x = cur_x; F32 start_x = cur_x; - F32 inv_width = 1.f / mImageGLp->getWidth(); - F32 inv_height = 1.f / mImageGLp->getHeight(); + F32 inv_width = 1.f / mFontBitmapCachep->getBitmapWidth(); + F32 inv_height = 1.f / mFontBitmapCachep->getBitmapHeight(); const S32 LAST_CHARACTER = LLFont::LAST_CHAR_FULL; @@ -733,6 +504,9 @@ S32 LLFontGL::render(const LLWString &wstr, } + // Remember last-used texture to avoid unnecesssary bind calls. + LLImageGL *last_bound_texture = NULL; + for (i = begin_offset; i < begin_offset + length; i++) { llwchar wch = wstr[i]; @@ -752,7 +526,7 @@ S32 LLFontGL::render(const LLWString &wstr, if (!label.empty()) { - ext_advance += (EXT_X_BEARING + gExtCharFont->getWidthF32( label.c_str() )) * sScaleX; + ext_advance += (EXT_X_BEARING + getFontExtChar()->getWidthF32( label.c_str() )) * sScaleX; } if (start_x + scaled_max_pixels < cur_x + ext_advance) @@ -761,9 +535,15 @@ S32 LLFontGL::render(const LLWString &wstr, break; } - gGL.getTexUnit(0)->bind(ext_image); - const F32 ext_x = cur_render_x + (EXT_X_BEARING * sScaleX); - const F32 ext_y = cur_render_y + (EXT_Y_BEARING * sScaleY + mAscender - mLineHeight); + if (last_bound_texture != ext_image) + { + gGL.getTexUnit(0)->bind(ext_image); + last_bound_texture = ext_image; + } + + // snap origin to whole screen pixel + const F32 ext_x = (F32)llround(cur_render_x + (EXT_X_BEARING * sScaleX)); + const F32 ext_y = (F32)llround(cur_render_y + (EXT_Y_BEARING * sScaleY + mAscender - mLineHeight)); LLRectf uv_rect(0.f, 1.f, 1.f, 0.f); LLRectf screen_rect(ext_x, ext_y + ext_height, ext_x + ext_width, ext_y); @@ -775,7 +555,7 @@ S32 LLFontGL::render(const LLWString &wstr, //glLoadIdentity(); //gGL.translatef(sCurOrigin.mX, sCurOrigin.mY, 0.0f); //glScalef(sScaleX, sScaleY, 1.f); - gExtCharFont->render(label, 0, + getFontExtChar()->render(label, 0, /*llfloor*/((ext_x + (F32)ext_image->getWidth() + EXT_X_BEARING) / sScaleX), /*llfloor*/(cur_y / sScaleY), color, @@ -793,15 +573,12 @@ S32 LLFontGL::render(const LLWString &wstr, cur_x += EXT_KERNING * sScaleX; } cur_render_x = cur_x; - - // Bind the font texture - gGL.getTexUnit(0)->bind(mImageGLp); } else { if (!hasGlyph(wch)) { - (const_cast(this))->addChar(wch); + addChar(wch); } const LLFontGlyphInfo* fgi= getGlyphInfo(wch); @@ -810,6 +587,14 @@ S32 LLFontGL::render(const LLWString &wstr, llerrs << "Missing Glyph Info" << llendl; break; } + // Per-glyph bitmap texture. + LLImageGL *image_gl = mFontBitmapCachep->getImageGL(fgi->mBitmapNum); + if (last_bound_texture != image_gl) + { + gGL.getTexUnit(0)->bind(image_gl); + last_bound_texture = image_gl; + } + if ((start_x + scaled_max_pixels) < (cur_x + fgi->mXBearing + fgi->mWidth)) { // Not enough room for this character. @@ -818,15 +603,16 @@ S32 LLFontGL::render(const LLWString &wstr, // Draw the text at the appropriate location //Specify vertices and texture coordinates - LLRectf uv_rect((fgi->mXBitmapOffset - PAD_AMT) * inv_width, - (fgi->mYBitmapOffset + fgi->mHeight + PAD_AMT) * inv_height, - (fgi->mXBitmapOffset + fgi->mWidth + PAD_AMT) * inv_width, - (fgi->mYBitmapOffset - PAD_AMT) * inv_height); - LLRectf screen_rect(cur_render_x + (F32)fgi->mXBearing - PAD_AMT, - cur_render_y + (F32)fgi->mYBearing + PAD_AMT, - cur_render_x + (F32)fgi->mXBearing + (F32)fgi->mWidth + PAD_AMT, - cur_render_y + (F32)fgi->mYBearing - (F32)fgi->mHeight - PAD_AMT); - + LLRectf uv_rect((fgi->mXBitmapOffset) * inv_width, + (fgi->mYBitmapOffset + fgi->mHeight + PAD_UVY) * inv_height, + (fgi->mXBitmapOffset + fgi->mWidth) * inv_width, + (fgi->mYBitmapOffset - PAD_UVY) * inv_height); + // snap glyph origin to whole screen pixel + LLRectf screen_rect(llround(cur_render_x + (F32)fgi->mXBearing), + llround(cur_render_y + (F32)fgi->mYBearing), + llround(cur_render_x + (F32)fgi->mXBearing) + (F32)fgi->mWidth, + llround(cur_render_y + (F32)fgi->mYBearing) - (F32)fgi->mHeight); + drawGlyph(screen_rect, uv_rect, color, style, drop_shadow_strength); chars_drawn++; @@ -839,7 +625,7 @@ S32 LLFontGL::render(const LLWString &wstr, // Kern this puppy. if (!hasGlyph(next_char)) { - (const_cast(this))->addChar(next_char); + addChar(next_char); } cur_x += getXKerning(wch, next_char); } @@ -896,11 +682,6 @@ S32 LLFontGL::render(const LLWString &wstr, return chars_drawn; } - -LLImageGL *LLFontGL::getImageGL() const -{ - return mImageGLp; -} S32 LLFontGL::getWidth(const std::string& utf8text) const { @@ -1118,59 +899,32 @@ S32 LLFontGL::firstDrawableChar(const llwchar* wchars, F32 max_pixels, S32 text_ llwchar wch = wchars[i]; const embedded_data_t* ext_data = getEmbeddedCharData(wch); - if (ext_data) - { - F32 char_width = getEmbeddedCharAdvance(ext_data); - - if( scaled_max_pixels < (total_width + char_width) ) - { - break; - } + F32 char_width = ext_data ? getEmbeddedCharAdvance(ext_data) : getXAdvance(wch); - total_width += char_width; - - drawable_chars++; - if( max_chars >= 0 && drawable_chars >= max_chars ) - { - break; - } - - if ( i > 0 ) - { - total_width += EXT_KERNING * sScaleX; - } - - // Round after kerning. - total_width = (F32)llfloor(total_width + 0.5f); - } - else + if( scaled_max_pixels < (total_width + char_width) ) { - F32 char_width = getXAdvance(wch); - if( scaled_max_pixels < (total_width + char_width) ) - { - break; - } - - total_width += char_width; + break; + } - drawable_chars++; - if( max_chars >= 0 && drawable_chars >= max_chars ) - { - break; - } + total_width += char_width; + drawable_chars++; - if ( i > 0 ) - { - // Kerning - total_width += getXKerning(wchars[i-1], wch); - } + if( max_chars >= 0 && drawable_chars >= max_chars ) + { + break; + } - // Round after kerning. - total_width = (F32)llfloor(total_width + 0.5f); + if ( i > 0 ) + { + // kerning + total_width += ext_data ? (EXT_KERNING * sScaleX) : getXKerning(wchars[i-1], wch); } + + // Round after kerning. + total_width = llround(total_width); } - return text_len - drawable_chars; + return start_pos - drawable_chars; } @@ -1299,7 +1053,7 @@ F32 LLFontGL::getEmbeddedCharAdvance(const embedded_data_t* ext_data) const F32 ext_width = (F32)ext_image->getWidth(); if( !label.empty() ) { - ext_width += (EXT_X_BEARING + gExtCharFont->getWidthF32(label.c_str())) * sScaleX; + ext_width += (EXT_X_BEARING + getFontExtChar()->getWidthF32(label.c_str())) * sScaleX; } return (EXT_X_BEARING * sScaleX) + ext_width; @@ -1312,19 +1066,19 @@ void LLFontGL::clearEmbeddedChars() mEmbeddedChars.clear(); } -void LLFontGL::addEmbeddedChar( llwchar wc, LLImageGL* image, const std::string& label ) +void LLFontGL::addEmbeddedChar( llwchar wc, LLImageGL* image, const std::string& label ) const { LLWString wlabel = utf8str_to_wstring(label); addEmbeddedChar(wc, image, wlabel); } -void LLFontGL::addEmbeddedChar( llwchar wc, LLImageGL* image, const LLWString& wlabel ) +void LLFontGL::addEmbeddedChar( llwchar wc, LLImageGL* image, const LLWString& wlabel ) const { embedded_data_t* ext_data = new embedded_data_t(image, wlabel); mEmbeddedChars[wc] = ext_data; } -void LLFontGL::removeEmbeddedChar( llwchar wc ) +void LLFontGL::removeEmbeddedChar( llwchar wc ) const { embedded_map_t::iterator iter = mEmbeddedChars.find(wc); if (iter != mEmbeddedChars.end()) @@ -1428,68 +1182,9 @@ void LLFontGL::drawGlyph(const LLRectf& screen_rect, const LLRectf& uv_rect, con gGL.end(); } -// static std::string LLFontGL::nameFromFont(const LLFontGL* fontp) { - if (fontp == sSansSerifHuge) - { - return std::string("SansSerifHuge"); - } - else if (fontp == sSansSerifSmall) - { - return std::string("SansSerifSmall"); - } - else if (fontp == sSansSerif) - { - return std::string("SansSerif"); - } - else if (fontp == sSansSerifBig) - { - return std::string("SansSerifBig"); - } - else if (fontp == sSansSerifBold) - { - return std::string("SansSerifBold"); - } - else if (fontp == sMonospace) - { - return std::string("Monospace"); - } - else - { - return std::string(); - } -} - -// static -LLFontGL* LLFontGL::fontFromName(const std::string& font_name) -{ - LLFontGL* gl_font = NULL; - if (font_name == "SansSerifHuge") - { - gl_font = LLFontGL::sSansSerifHuge; - } - else if (font_name == "SansSerifSmall") - { - gl_font = LLFontGL::sSansSerifSmall; - } - else if (font_name == "SansSerif") - { - gl_font = LLFontGL::sSansSerif; - } - else if (font_name == "SansSerifBig") - { - gl_font = LLFontGL::sSansSerifBig; - } - else if (font_name == "SansSerifBold") - { - gl_font = LLFontGL::sSansSerifBold; - } - else if (font_name == "Monospace") - { - gl_font = LLFontGL::sMonospace; - } - return gl_font; + return fontp->getFontDesc().getName(); } // static diff --git a/linden/indra/llrender/llfontgl.h b/linden/indra/llrender/llfontgl.h index 97bdd1a..6cb1727 100644 --- a/linden/indra/llrender/llfontgl.h +++ b/linden/indra/llrender/llfontgl.h @@ -18,7 +18,8 @@ * 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 + * 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, @@ -39,8 +40,16 @@ #include "llcoord.h" #include "llrect.h" +#include "llfontregistry.h" + class LLColor4; +// Key used to request a font. +class LLFontDescriptor; + +// Structure used to store previously requested fonts. +class LLFontRegistry; + class LLFontGL : public LLFont { public: @@ -85,18 +94,13 @@ public: LLFontGL &operator=(const LLFontGL &source); static BOOL initDefaultFonts(F32 screen_dpi, F32 x_scale, F32 y_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 std::string& sansserif_bold_file, F32 bold_size, - const std::string& app_dir = LLStringUtil::null); + const std::string& app_dir, + const std::vector& xui_paths); static void destroyDefaultFonts(); - static void destroyGL(); + static void destroyAllGL(); + void destroyGL(); - 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); @@ -180,7 +184,7 @@ public: F32* drawn_pixels = NULL) const; // Returns the index of the first complete characters from text that can be drawn in max_pixels - // starting on the right side (at character start_pos). + // given that the character at start_pos should be the last character (or as close to last as possible). virtual S32 firstDrawableChar(const llwchar* wchars, F32 max_pixels, S32 text_len, S32 start_pos=S32_MAX, S32 max_chars = S32_MAX) const; // Returns the index of the character closest to pixel position x (ignoring text to the right of max_pixels and max_chars) @@ -191,12 +195,11 @@ public: LLImageGL *getImageGL() const; - void addEmbeddedChar( llwchar wc, LLImageGL* image, const std::string& label); - void addEmbeddedChar( llwchar wc, LLImageGL* image, const LLWString& label); - void removeEmbeddedChar( llwchar wc ); + void addEmbeddedChar( llwchar wc, LLImageGL* image, const std::string& label) const; + void addEmbeddedChar( llwchar wc, LLImageGL* image, const LLWString& label) const; + void removeEmbeddedChar( llwchar wc ) const; static std::string nameFromFont(const LLFontGL* fontp); - static LLFontGL* fontFromName(const std::string& name); static std::string nameFromHAlign(LLFontGL::HAlign align); static LLFontGL::HAlign hAlignFromName(const std::string& name); @@ -227,20 +230,14 @@ public: static BOOL sDisplayFont ; static std::string sAppDir; // For loading fonts - static LLFontGL* sMonospace; // medium - static LLFontList* sMonospaceFallback; - - static LLFontGL* sSansSerifSmall; // small - static LLFontList* sSSSmallFallback; - static LLFontGL* sSansSerif; // medium - static LLFontList* sSSFallback; - static LLFontGL* sSansSerifBig; // large - static LLFontList* sSSBigFallback; - static LLFontGL* sSansSerifHuge; // very large - static LLFontList* sSSHugeFallback; - - static LLFontGL* sSansSerifBold; // medium, bolded - static LLFontList* sSSBoldFallback; + static LLFontGL* getFontMonospace(); + static LLFontGL* getFontSansSerifSmall(); + static LLFontGL* getFontSansSerif(); + static LLFontGL* getFontSansSerifBig(); + static LLFontGL* getFontSansSerifHuge(); + static LLFontGL* getFontSansSerifBold(); + static LLFontGL* getFontExtChar(); + static LLFontGL* getFont(const LLFontDescriptor& desc); static LLColor4 sShadowColor; @@ -248,19 +245,26 @@ public: friend class LLHUDText; protected: - /*virtual*/ BOOL addChar(const llwchar wch); - static std::string getFontPathLocal(); - static std::string getFontPathSystem(); + /*virtual*/ BOOL addChar(const llwchar wch) const; protected: - LLPointer mRawImageGLp; - LLPointer mImageGLp; typedef std::map embedded_map_t; - embedded_map_t mEmbeddedChars; + mutable embedded_map_t mEmbeddedChars; + LLFontDescriptor mFontDesc; + + // Registry holds all instantiated fonts. + static LLFontRegistry* sFontRegistry; + public: + static std::string getFontPathLocal(); + static std::string getFontPathSystem(); + static LLCoordFont sCurOrigin; static std::vector sOriginStack; + + const LLFontDescriptor &getFontDesc() const { return mFontDesc; } + void setFontDesc(const LLFontDescriptor& font_desc) { mFontDesc = font_desc; } }; #endif diff --git a/linden/indra/llrender/llfontregistry.cpp b/linden/indra/llrender/llfontregistry.cpp new file mode 100644 index 0000000..619228e --- /dev/null +++ b/linden/indra/llrender/llfontregistry.cpp @@ -0,0 +1,651 @@ +/** + * @file llfontregistry.cpp + * @author Brad Payne + * @brief Storage for fonts. + * + * $LicenseInfo:firstyear=2008&license=viewergpl$ + * + * Copyright (c) 2008-2009, 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 "llgl.h" +#include "llfontregistry.h" +#include "llfontgl.h" +#include +#include "llcontrol.h" +#include "lldir.h" +#include "llwindow.h" + +extern LLControlGroup gSavedSettings; + +using std::string; +using std::map; + +bool fontDescInitFromXML(LLXMLNodePtr node, LLFontDescriptor& desc); + +LLFontDescriptor::LLFontDescriptor(): + mStyle(0) +{ +} + +LLFontDescriptor::LLFontDescriptor(const std::string& name, + const std::string& size, + const U8 style, + const string_vec_t& file_names): + mName(name), + mSize(size), + mStyle(style), + mFileNames(file_names) +{ +} + +LLFontDescriptor::LLFontDescriptor(const std::string& name, + const std::string& size, + const U8 style): + mName(name), + mSize(size), + mStyle(style) +{ +} + + +bool LLFontDescriptor::operator<(const LLFontDescriptor& b) const +{ + if (mName < b.mName) + return true; + else if (mName > b.mName) + return false; + + if (mStyle < b.mStyle) + return true; + else if (mStyle > b.mStyle) + return false; + + if (mSize < b.mSize) + return true; + else + return false; +} + +static const std::string s_template_string("TEMPLATE"); + +bool LLFontDescriptor::isTemplate() const +{ + return getSize() == s_template_string; +} + +// Look for substring match and remove substring if matched. +bool removeSubString(std::string& str, const std::string& substr) +{ + size_t pos = str.find(substr); + if (pos != string::npos) + { + str.replace(pos,substr.length(),(const char *)NULL, 0); + return true; + } + return false; +} + +// Check for substring match without modifying the source string. +bool findSubString(std::string& str, const std::string& substr) +{ + size_t pos = str.find(substr); + if (pos != string::npos) + { + return true; + } + return false; +} + + +// Normal form is +// - raw name +// - bold, italic style info reflected in both style and font name. +// - other style info removed. +// - size info moved to mSize, defaults to Medium +// For example, +// - "SansSerifHuge" would normalize to { "SansSerif", "Huge", 0 } +// - "SansSerifBold" would normalize to { "SansSerifBold", "Medium", BOLD } +LLFontDescriptor LLFontDescriptor::normalize() const +{ + std::string new_name(mName); + std::string new_size(mSize); + U8 new_style(mStyle); + + // Only care about style to extent it can be picked up by font. + new_style &= (LLFontGL::BOLD | LLFontGL::ITALIC); + + // All these transformations are to support old-style font specifications. + if (removeSubString(new_name,"Small")) + new_size = "Small"; + if (removeSubString(new_name,"Big")) + new_size = "Large"; + if (removeSubString(new_name,"Medium")) + new_size = "Medium"; + if (removeSubString(new_name,"Large")) + new_size = "Large"; + if (removeSubString(new_name,"Huge")) + new_size = "Huge"; + + // HACK - Monospace is the only one we don't remove, so + // name "Monospace" doesn't get taken down to "" + // For other fonts, there's no ambiguity between font name and size specifier. + if (new_size != s_template_string && new_size.empty() && findSubString(new_name,"Monospace")) + new_size = "Monospace"; + if (new_size.empty()) + new_size = "Medium"; + + if (removeSubString(new_name,"Bold")) + new_style |= LLFontGL::BOLD; + + if (removeSubString(new_name,"Italic")) + new_style |= LLFontGL::ITALIC; + + return LLFontDescriptor(new_name,new_size,new_style,getFileNames()); +} + +LLFontRegistry::LLFontRegistry(const string_vec_t& xui_paths) +{ + // Propagate this down from LLUICtrlFactory so LLRender doesn't + // need an upstream dependency on LLUI. + mXUIPaths = xui_paths; + + // This is potentially a slow directory traversal, so we want to + // cache the result. + mUltimateFallbackList = LLWindow::getDynamicFallbackFontList(); +} + +LLFontRegistry::~LLFontRegistry() +{ + clear(); +} + +bool LLFontRegistry::parseFontInfo(const std::string& xml_filename) +{ + bool success = false; // Succeed if we find at least one XUI file + const string_vec_t& xml_paths = mXUIPaths; + for (string_vec_t::const_iterator path_it = xml_paths.begin(); + path_it != xml_paths.end(); + ++path_it) + { + + LLXMLNodePtr root; + std::string full_filename = gDirUtilp->findSkinnedFilename(*path_it, xml_filename); + bool parsed_file = LLXMLNode::parseFile(full_filename, root, NULL); + + if (!parsed_file) + continue; + + if ( root.isNull() || ! root->hasName( "fonts" ) ) + { + llwarns << "Bad font info file: " + << full_filename << llendl; + continue; + } + + std::string root_name; + root->getAttributeString("name",root_name); + if (root->hasName("fonts")) + { + // Expect a collection of children consisting of "font" or "font_size" entries + bool init_succ = initFromXML(root); + success = success || init_succ; + } + } + if (success) + dump(); + + return success; +} + +std::string currentOsName() +{ +#if LL_WINDOWS + return "Windows"; +#elif LL_DARWIN + return "Mac"; +#elif LL_SDL + return "Linux"; +#else + return ""; +#endif +} + +bool fontDescInitFromXML(LLXMLNodePtr node, LLFontDescriptor& desc) +{ + if (node->hasName("font")) + { + std::string attr_name; + if (node->getAttributeString("name",attr_name)) + { + desc.setName(attr_name); + } + + std::string attr_style; + if (node->getAttributeString("font_style",attr_style)) + { + desc.setStyle(LLFontGL::getStyleFromString(attr_style)); + } + + desc.setSize(s_template_string); + } + + LLXMLNodePtr child; + for (child = node->getFirstChild(); child.notNull(); child = child->getNextSibling()) + { + std::string child_name; + child->getAttributeString("name",child_name); + if (child->hasName("file")) + { + std::string font_file_name = child->getTextContents(); + desc.getFileNames().push_back(font_file_name); + } + else if (child->hasName("os")) + { + if (child_name == currentOsName()) + { + fontDescInitFromXML(child, desc); + } + } + } + return true; +} + +bool LLFontRegistry::initFromXML(LLXMLNodePtr node) +{ + LLXMLNodePtr child; + + for (child = node->getFirstChild(); child.notNull(); child = child->getNextSibling()) + { + std::string child_name; + child->getAttributeString("name",child_name); + if (child->hasName("font")) + { + LLFontDescriptor desc; + bool font_succ = fontDescInitFromXML(child, desc); + LLFontDescriptor norm_desc = desc.normalize(); + if (font_succ) + { + // if this is the first time we've seen this font name, + // create a new template map entry for it. + const LLFontDescriptor *match_desc = getMatchingFontDesc(desc); + if (match_desc == NULL) + { + // Create a new entry (with no corresponding font). + mFontMap[norm_desc] = NULL; + } + // otherwise, find the existing entry and combine data. + else + { + // Prepend files from desc. + // A little roundabout because the map key is const, + // so we have to fetch it, make a new map key, and + // replace the old entry. + string_vec_t match_file_names = match_desc->getFileNames(); + match_file_names.insert(match_file_names.begin(), + desc.getFileNames().begin(), + desc.getFileNames().end()); + LLFontDescriptor new_desc = *match_desc; + new_desc.getFileNames() = match_file_names; + mFontMap.erase(*match_desc); + mFontMap[new_desc] = NULL; + } + } + } + else if (child->hasName("font_size")) + { + std::string size_name; + F32 size_value; + if (child->getAttributeString("name",size_name) && + child->getAttributeF32("size",size_value)) + { + mFontSizes[size_name] = size_value; + } + + } + } + return true; +} + +bool LLFontRegistry::nameToSize(const std::string& size_name, F32& size) +{ + font_size_map_t::iterator it = mFontSizes.find(size_name); + if (it != mFontSizes.end()) + { + size = it->second; + return true; + } + return false; +} + + +LLFontGL *LLFontRegistry::createFont(const LLFontDescriptor& desc) +{ + // Name should hold a font name recognized as a setting; the value + // of the setting should be a list of font files. + // Size should be a recognized string value + // Style should be a set of flags including any implied by the font name. + + // First decipher the requested size. + LLFontDescriptor norm_desc = desc.normalize(); + F32 point_size; + bool found_size = nameToSize(norm_desc.getSize(),point_size); + if (!found_size) + { + llwarns << "createFont unrecognized size " << norm_desc.getSize() << llendl; + return NULL; + } + llinfos << "createFont " << norm_desc.getName() << " size " << norm_desc.getSize() << " style " << ((S32) norm_desc.getStyle()) << llendl; + F32 fallback_scale = 1.0; + + // Find corresponding font template (based on same descriptor with no size specified) + LLFontDescriptor template_desc(norm_desc); + template_desc.setSize(s_template_string); + const LLFontDescriptor *match_desc = getClosestFontTemplate(template_desc); + if (!match_desc) + { + llwarns << "createFont failed, no template found for " + << norm_desc.getName() << " style [" << ((S32)norm_desc.getStyle()) << "]" << llendl; + return NULL; + } + + // See whether this best-match font has already been instantiated in the requested size. + LLFontDescriptor nearest_exact_desc = *match_desc; + nearest_exact_desc.setSize(norm_desc.getSize()); + font_reg_map_t::iterator it = mFontMap.find(nearest_exact_desc); + if (it != mFontMap.end()) + { + llinfos << "-- matching font exists: " << nearest_exact_desc.getName() << " size " << nearest_exact_desc.getSize() << " style " << ((S32) nearest_exact_desc.getStyle()) << llendl; + return it->second; + } + + // Build list of font names to look for. + // Files specified for this font come first, followed by those from the default descriptor. + string_vec_t file_names = match_desc->getFileNames(); + string_vec_t default_file_names; + LLFontDescriptor default_desc("default",s_template_string,0); + const LLFontDescriptor *match_default_desc = getMatchingFontDesc(default_desc); + if (match_default_desc) + { + file_names.insert(file_names.end(), + match_default_desc->getFileNames().begin(), + match_default_desc->getFileNames().end()); + } + + // Add ultimate fallback list - generated dynamically on linux, + // null elsewhere. + file_names.insert(file_names.end(), + getUltimateFallbackList().begin(), + getUltimateFallbackList().end()); + + // Load fonts based on names. + if (file_names.empty()) + { + llwarns << "createFont failed, no file names specified" << llendl; + return NULL; + } + LLFontList *fontlistp = new LLFontList; + LLFontGL *result = NULL; + + // Snarf all fonts we can into fontlistp. First will get pulled + // off the list and become the "head" font, set to non-fallback. + // Rest will consitute the fallback list. + BOOL is_first_found = TRUE; + + std::string local_path = LLFontGL::getFontPathLocal(); + std::string sys_path = LLFontGL::getFontPathSystem(); + + // The fontname string may contain multiple font file names separated by semicolons. + // Break it apart and try loading each one, in order. + for(string_vec_t::iterator file_name_it = file_names.begin(); + file_name_it != file_names.end(); + ++file_name_it) + { + LLFontGL *fontp = new LLFontGL; + std::string font_path = local_path + *file_name_it; + BOOL is_fallback = !is_first_found; + F32 extra_scale = (is_fallback)?fallback_scale:1.0; + if (!fontp->loadFace(font_path, extra_scale * point_size, + LLFontGL::sVertDPI, LLFontGL::sHorizDPI, 2, is_fallback)) + { + font_path = sys_path + *file_name_it; + + if (!fontp->loadFace(font_path, extra_scale * point_size, + LLFontGL::sVertDPI, LLFontGL::sHorizDPI, 2, is_fallback)) + { + LL_INFOS_ONCE("LLFontRegistry") << "Couldn't load font " << *file_name_it << LL_ENDL; + delete fontp; + fontp = NULL; + } + } + + if(fontp) + { + if (is_first_found) + { + result = fontp; + is_first_found = false; + } + else + fontlistp->addAtEnd(fontp); + } + } + if (result && !fontlistp->empty()) + { + result->setFallbackFont(fontlistp); + } + + norm_desc.setStyle(match_desc->getStyle()); + if (result) + result->setFontDesc(norm_desc); + + if (!result) + { + llwarns << "createFont failed in some way" << llendl; + } + mFontMap[norm_desc] = result; + return result; +} + +void LLFontRegistry::reset() +{ + for (font_reg_map_t::iterator it = mFontMap.begin(); + it != mFontMap.end(); + ++it) + { + // Reset the corresponding font but preserve the entry. + if (it->second) + it->second->reset(); + } +} + +void LLFontRegistry::clear() +{ + for (font_reg_map_t::iterator it = mFontMap.begin(); + it != mFontMap.end(); + ++it) + { + LLFontGL *fontp = it->second; + delete fontp; + } + mFontMap.clear(); +} + +void LLFontRegistry::destroyGL() +{ + for (font_reg_map_t::iterator it = mFontMap.begin(); + it != mFontMap.end(); + ++it) + { + // Reset the corresponding font but preserve the entry. + if (it->second) + it->second->destroyGL(); + } +} + +LLFontGL *LLFontRegistry::getFont(const LLFontDescriptor& orig_desc) +{ + LLFontDescriptor norm_desc = orig_desc.normalize(); + + font_reg_map_t::iterator it = mFontMap.find(norm_desc); + if (it != mFontMap.end()) + return it->second; + else + { + LLFontGL *fontp = createFont(orig_desc); + if (!fontp) + { + llwarns << "getFont failed, name " << orig_desc.getName() + <<" style=[" << ((S32) orig_desc.getStyle()) << "]" + << " size=[" << orig_desc.getSize() << "]" << llendl; + } + return fontp; + } +} + +const LLFontDescriptor *LLFontRegistry::getMatchingFontDesc(const LLFontDescriptor& desc) +{ + LLFontDescriptor norm_desc = desc.normalize(); + + font_reg_map_t::iterator it = mFontMap.find(norm_desc); + if (it != mFontMap.end()) + return &(it->first); + else + return NULL; +} + +static U32 bitCount(U8 c) +{ + U32 count = 0; + if (c & 1) + count++; + if (c & 2) + count++; + if (c & 4) + count++; + if (c & 8) + count++; + if (c & 16) + count++; + if (c & 32) + count++; + if (c & 64) + count++; + if (c & 128) + count++; + return count; +} + +// Find nearest match for the requested descriptor. +const LLFontDescriptor *LLFontRegistry::getClosestFontTemplate(const LLFontDescriptor& desc) +{ + const LLFontDescriptor *exact_match_desc = getMatchingFontDesc(desc); + if (exact_match_desc) + { + return exact_match_desc; + } + + LLFontDescriptor norm_desc = desc.normalize(); + + const LLFontDescriptor *best_match_desc = NULL; + for (font_reg_map_t::iterator it = mFontMap.begin(); + it != mFontMap.end(); + ++it) + { + const LLFontDescriptor* curr_desc = &(it->first); + + // Ignore if not a template. + if (!curr_desc->isTemplate()) + continue; + + // Ignore if font name is wrong. + if (curr_desc->getName() != norm_desc.getName()) + continue; + + // Reject font if it matches any bits we don't want + if (curr_desc->getStyle() & ~norm_desc.getStyle()) + { + continue; + } + + // Take if it's the first plausible candidate we've found. + if (!best_match_desc) + { + best_match_desc = curr_desc; + continue; + } + + // Take if it matches more bits than anything before. + U8 best_style_match_bits = + norm_desc.getStyle() & best_match_desc->getStyle(); + U8 curr_style_match_bits = + norm_desc.getStyle() & curr_desc->getStyle(); + if (bitCount(curr_style_match_bits) > bitCount(best_style_match_bits)) + { + best_match_desc = curr_desc; + continue; + } + + // Tie-breaker: take if it matches bold. + if (curr_style_match_bits & LLFontGL::BOLD) // Bold is requested and this descriptor matches it. + { + best_match_desc = curr_desc; + continue; + } + } + + // Nothing matched. + return best_match_desc; +} + +void LLFontRegistry::dump() +{ + llinfos << "LLFontRegistry dump: " << llendl; + for (font_size_map_t::iterator size_it = mFontSizes.begin(); + size_it != mFontSizes.end(); + ++size_it) + { + llinfos << "Size: " << size_it->first << " => " << size_it->second << llendl; + } + for (font_reg_map_t::iterator font_it = mFontMap.begin(); + font_it != mFontMap.end(); + ++font_it) + { + const LLFontDescriptor& desc = font_it->first; + llinfos << "Font: name=" << desc.getName() + << " style=[" << ((S32)desc.getStyle()) << "]" + << " size=[" << desc.getSize() << "]" + << " fileNames=" + << llendl; + for (string_vec_t::const_iterator file_it=desc.getFileNames().begin(); + file_it != desc.getFileNames().end(); + ++file_it) + { + llinfos << " file: " << *file_it < string_vec_t; + +class LLFontDescriptor +{ +public: + LLFontDescriptor(); + LLFontDescriptor(const std::string& name, const std::string& size, const U8 style); + LLFontDescriptor(const std::string& name, const std::string& size, const U8 style, const string_vec_t& file_names); + LLFontDescriptor normalize() const; + + bool operator<(const LLFontDescriptor& b) const; + + bool isTemplate() const; + + const std::string& getName() const { return mName; } + void setName(const std::string& name) { mName = name; } + const std::string& getSize() const { return mSize; } + void setSize(const std::string& size) { mSize = size; } + const std::vector& getFileNames() const { return mFileNames; } + std::vector& getFileNames() { return mFileNames; } + const U8 getStyle() const { return mStyle; } + void setStyle(U8 style) { mStyle = style; } + +private: + std::string mName; + std::string mSize; + string_vec_t mFileNames; + U8 mStyle; +}; + +class LLFontRegistry +{ +public: + LLFontRegistry(const string_vec_t& xui_paths); + ~LLFontRegistry(); + + // Load standard font info from XML file(s). + bool parseFontInfo(const std::string& xml_filename); + bool initFromXML(LLXMLNodePtr node); + + // Clear cached glyphs for all fonts. + void reset(); + + // Destroy all fonts. + void clear(); + + // GL cleanup + void destroyGL(); + + LLFontGL *getFont(const LLFontDescriptor& desc); + const LLFontDescriptor *getMatchingFontDesc(const LLFontDescriptor& desc); + const LLFontDescriptor *getClosestFontTemplate(const LLFontDescriptor& desc); + + bool nameToSize(const std::string& size_name, F32& size); + + void dump(); + + const string_vec_t& getUltimateFallbackList() const { return mUltimateFallbackList; } + +private: + LLFontGL *createFont(const LLFontDescriptor& desc); + typedef std::map font_reg_map_t; + typedef std::map font_size_map_t; + + // Given a descriptor, look up specific font instantiation. + font_reg_map_t mFontMap; + // Given a size name, look up the point size. + font_size_map_t mFontSizes; + + string_vec_t mUltimateFallbackList; + string_vec_t mXUIPaths; +}; + +#endif // LL_LLFONTREGISTRY_H diff --git a/linden/indra/llrender/llgl.cpp b/linden/indra/llrender/llgl.cpp index a9cf073..61194c4 100644 --- a/linden/indra/llrender/llgl.cpp +++ b/linden/indra/llrender/llgl.cpp @@ -17,7 +17,8 @@ * 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 + * 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, @@ -64,7 +65,7 @@ LLMatrix4 gGLObliqueProjectionInverse; LLGLNamePool::pool_list_t LLGLNamePool::sInstances; -#if (LL_WINDOWS || LL_LINUX) && !LL_MESA_HEADLESS +#if (LL_WINDOWS || LL_LINUX || LL_SOLARIS) && !LL_MESA_HEADLESS // ATI prototypes // vertex blending prototypes PFNGLWEIGHTPOINTERARBPROC glWeightPointerARB = NULL; @@ -132,6 +133,15 @@ PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC glFramebufferRenderbufferEXT = NULL; PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC glGetFramebufferAttachmentParameterivEXT = NULL; PFNGLGENERATEMIPMAPEXTPROC glGenerateMipmapEXT = NULL; +// GL_EXT_framebuffer_multisample +PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC glRenderbufferStorageMultisampleEXT = NULL; + +// GL_EXT_framebuffer_blit +PFNGLBLITFRAMEBUFFEREXTPROC glBlitFramebufferEXT = NULL; + +// GL_ARB_draw_buffers +PFNGLDRAWBUFFERSARBPROC glDrawBuffersARB = NULL; + //shader object prototypes PFNGLDELETEOBJECTARBPROC glDeleteObjectARB = NULL; PFNGLGETHANDLEARBPROC glGetHandleARB = NULL; @@ -174,7 +184,7 @@ PFNGLGETUNIFORMIVARBPROC glGetUniformivARB = NULL; PFNGLGETSHADERSOURCEARBPROC glGetShaderSourceARB = NULL; // vertex shader prototypes -#if LL_LINUX +#if LL_LINUX || LL_SOLARIS PFNGLVERTEXATTRIB1DARBPROC glVertexAttrib1dARB = NULL; PFNGLVERTEXATTRIB1DVARBPROC glVertexAttrib1dvARB = NULL; PFNGLVERTEXATTRIB1FARBPROC glVertexAttrib1fARB = NULL; @@ -193,7 +203,7 @@ PFNGLVERTEXATTRIB3FARBPROC glVertexAttrib3fARB = NULL; PFNGLVERTEXATTRIB3FVARBPROC glVertexAttrib3fvARB = NULL; PFNGLVERTEXATTRIB3SARBPROC glVertexAttrib3sARB = NULL; PFNGLVERTEXATTRIB3SVARBPROC glVertexAttrib3svARB = NULL; -#endif // LL_LINUX +#endif // LL_LINUX || LL_SOLARIS PFNGLVERTEXATTRIB4NBVARBPROC glVertexAttrib4nbvARB = NULL; PFNGLVERTEXATTRIB4NIVARBPROC glVertexAttrib4nivARB = NULL; PFNGLVERTEXATTRIB4NSVARBPROC glVertexAttrib4nsvARB = NULL; @@ -201,7 +211,7 @@ PFNGLVERTEXATTRIB4NUBARBPROC glVertexAttrib4nubARB = NULL; PFNGLVERTEXATTRIB4NUBVARBPROC glVertexAttrib4nubvARB = NULL; PFNGLVERTEXATTRIB4NUIVARBPROC glVertexAttrib4nuivARB = NULL; PFNGLVERTEXATTRIB4NUSVARBPROC glVertexAttrib4nusvARB = NULL; -#if LL_LINUX +#if LL_LINUX || LL_SOLARIS PFNGLVERTEXATTRIB4BVARBPROC glVertexAttrib4bvARB = NULL; PFNGLVERTEXATTRIB4DARBPROC glVertexAttrib4dARB = NULL; PFNGLVERTEXATTRIB4DVARBPROC glVertexAttrib4dvARB = NULL; @@ -239,7 +249,7 @@ PFNGLGETVERTEXATTRIBFVARBPROC glGetVertexAttribfvARB = NULL; PFNGLGETVERTEXATTRIBIVARBPROC glGetVertexAttribivARB = NULL; PFNGLGETVERTEXATTRIBPOINTERVARBPROC glGetVertexAttribPointervARB = NULL; PFNGLISPROGRAMARBPROC glIsProgramARB = NULL; -#endif // LL_LINUX +#endif // LL_LINUX || LL_SOLARIS PFNGLBINDATTRIBLOCATIONARBPROC glBindAttribLocationARB = NULL; PFNGLGETACTIVEATTRIBARBPROC glGetActiveAttribARB = NULL; PFNGLGETATTRIBLOCATIONARBPROC glGetAttribLocationARB = NULL; @@ -248,10 +258,12 @@ PFNGLGETATTRIBLOCATIONARBPROC glGetAttribLocationARB = NULL; PFNWGLSWAPINTERVALEXTPROC wglSwapIntervalEXT = NULL; #endif -#if LL_LINUX -PFNGLCOLORTABLEEXTPROC glColorTableEXT = NULL; -#endif // LL_LINUX - +#if LL_LINUX_NV_GL_HEADERS +// linux nvidia headers. these define these differently to mesa's. ugh. +PFNGLACTIVETEXTUREARBPROC glActiveTextureARB = NULL; +PFNGLCLIENTACTIVETEXTUREARBPROC glClientActiveTextureARB = NULL; +PFNGLDRAWRANGEELEMENTSPROC glDrawRangeElements = NULL; +#endif // LL_LINUX_NV_GL_HEADERS #endif LLGLManager gGLManager; @@ -265,6 +277,7 @@ LLGLManager::LLGLManager() : mHasMipMapGeneration(FALSE), mHasCompressedTextures(FALSE), mHasFramebufferObject(FALSE), + mHasFramebufferMultisample(FALSE), mHasVertexBufferObject(FALSE), mHasPBuffer(FALSE), @@ -489,7 +502,7 @@ std::string LLGLManager::getGLInfoString() 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 +#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"); @@ -564,6 +577,16 @@ void LLGLManager::initExtensions() # else mHasFramebufferObject = FALSE; # endif +# if GL_EXT_framebuffer_multisample + mHasFramebufferMultisample = TRUE; +# else + mHasFramebufferMultisample = FALSE; +# endif +# if GL_ARB_draw_buffers + mHasDrawBuffers = TRUE; +#else + mHasDrawBuffers = FALSE; +# endif mHasMipMapGeneration = FALSE; mHasSeparateSpecularColor = FALSE; mHasAnisotropic = FALSE; @@ -587,6 +610,8 @@ void LLGLManager::initExtensions() // 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); + mHasFramebufferMultisample = mHasFramebufferObject && ExtensionExists("GL_EXT_framebuffer_multisample", gGLHExts.mSysExts); + mHasDrawBuffers = ExtensionExists("GL_ARB_draw_buffers", gGLHExts.mSysExts); #if !LL_DARWIN mHasPointParameters = !mIsATI && ExtensionExists("GL_ARB_point_parameters", gGLHExts.mSysExts); #endif @@ -596,7 +621,8 @@ void LLGLManager::initExtensions() mHasFragmentShader = ExtensionExists("GL_ARB_fragment_shader", gGLHExts.mSysExts) && ExtensionExists("GL_ARB_shading_language_100", gGLHExts.mSysExts); #endif -#if LL_LINUX +#if LL_LINUX || LL_SOLARIS + llinfos << "initExtensions() checking shell variables to adjust features..." << llendl; // 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 */ @@ -606,6 +632,8 @@ void LLGLManager::initExtensions() mHasCompressedTextures = FALSE; mHasVertexBufferObject = FALSE; mHasFramebufferObject = FALSE; + mHasFramebufferMultisample = FALSE; + mHasDrawBuffers = FALSE; mHasMipMapGeneration = FALSE; mHasSeparateSpecularColor = FALSE; mHasAnisotropic = FALSE; @@ -655,8 +683,11 @@ void LLGLManager::initExtensions() if (strchr(blacklist,'o')) mHasFragmentShader = FALSE;//S if (strchr(blacklist,'p')) mHasPointParameters = FALSE;//S if (strchr(blacklist,'q')) mHasFramebufferObject = FALSE;//S + if (strchr(blacklist,'r')) mHasDrawBuffers = FALSE;//S + if (strchr(blacklist,'s')) mHasFramebufferMultisample = FALSE; + } -#endif // LL_LINUX +#endif // LL_LINUX || LL_SOLARIS if (!mHasMultitexture) { @@ -719,7 +750,7 @@ void LLGLManager::initExtensions() glGetIntegerv(GL_MAX_ELEMENTS_VERTICES, (GLint*) &mGLMaxVertexRange); glGetIntegerv(GL_MAX_ELEMENTS_INDICES, (GLint*) &mGLMaxIndexRange); -#if (LL_WINDOWS || LL_LINUX) && !LL_MESA_HEADLESS +#if (LL_WINDOWS || LL_LINUX || LL_SOLARIS) && !LL_MESA_HEADLESS LL_DEBUGS("RenderInit") << "GL Probe: Getting symbols" << LL_ENDL; if (mHasVertexBufferObject) { @@ -744,6 +775,7 @@ void LLGLManager::initExtensions() } if (mHasFramebufferObject) { + llinfos << "initExtensions() FramebufferObject-related procs..." << llendl; glIsRenderbufferEXT = (PFNGLISRENDERBUFFEREXTPROC) GLH_EXT_GET_PROC_ADDRESS("glIsRenderbufferEXT"); glBindRenderbufferEXT = (PFNGLBINDRENDERBUFFEREXTPROC) GLH_EXT_GET_PROC_ADDRESS("glBindRenderbufferEXT"); glDeleteRenderbuffersEXT = (PFNGLDELETERENDERBUFFERSEXTPROC) GLH_EXT_GET_PROC_ADDRESS("glDeleteRenderbuffersEXT"); @@ -762,18 +794,33 @@ void LLGLManager::initExtensions() 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 + if (mHasFramebufferMultisample) + { + glRenderbufferStorageMultisampleEXT = (PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC) GLH_EXT_GET_PROC_ADDRESS("glRenderbufferStorageMultisampleEXT"); + glBlitFramebufferEXT = (PFNGLBLITFRAMEBUFFEREXTPROC) GLH_EXT_GET_PROC_ADDRESS("glBlitFramebufferEXT"); + } + if (mHasDrawBuffers) + { + glDrawBuffersARB = (PFNGLDRAWBUFFERSARBPROC) GLH_EXT_GET_PROC_ADDRESS("glDrawBuffersARB"); + } +#if (!LL_LINUX && !LL_SOLARIS) || LL_LINUX_NV_GL_HEADERS + // This is expected to be a static symbol on Linux GL implementations, except if we use the nvidia headers - bah glDrawRangeElements = (PFNGLDRAWRANGEELEMENTSPROC)GLH_EXT_GET_PROC_ADDRESS("glDrawRangeElements"); if (!glDrawRangeElements) { mGLMaxVertexRange = 0; mGLMaxIndexRange = 0; } -#endif // !LL_LINUX +#endif // !LL_LINUX || LL_LINUX_NV_GL_HEADERS +#if LL_LINUX_NV_GL_HEADERS + // nvidia headers are critically different from mesa-esque + glActiveTextureARB = (PFNGLACTIVETEXTUREARBPROC)GLH_EXT_GET_PROC_ADDRESS("glActiveTextureARB"); + glClientActiveTextureARB = (PFNGLCLIENTACTIVETEXTUREARBPROC)GLH_EXT_GET_PROC_ADDRESS("glClientActiveTextureARB"); +#endif // LL_LINUX_NV_GL_HEADERS if (mHasOcclusionQuery) { + llinfos << "initExtensions() OcclusionQuery-related procs..." << llendl; glGenQueriesARB = (PFNGLGENQUERIESARBPROC)GLH_EXT_GET_PROC_ADDRESS("glGenQueriesARB"); glDeleteQueriesARB = (PFNGLDELETEQUERIESARBPROC)GLH_EXT_GET_PROC_ADDRESS("glDeleteQueriesARB"); glIsQueryARB = (PFNGLISQUERYARBPROC)GLH_EXT_GET_PROC_ADDRESS("glIsQueryARB"); @@ -785,6 +832,7 @@ void LLGLManager::initExtensions() } if (mHasPointParameters) { + llinfos << "initExtensions() PointParameters-related procs..." << llendl; glPointParameterfARB = (PFNGLPOINTPARAMETERFARBPROC)GLH_EXT_GET_PROC_ADDRESS("glPointParameterfARB"); glPointParameterfvARB = (PFNGLPOINTPARAMETERFVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glPointParameterfvARB"); } @@ -832,6 +880,7 @@ void LLGLManager::initExtensions() } if (mHasVertexShader) { + llinfos << "initExtensions() VertexShader-related procs..." << llendl; glGetAttribLocationARB = (PFNGLGETATTRIBLOCATIONARBPROC) GLH_EXT_GET_PROC_ADDRESS("glGetAttribLocationARB"); glBindAttribLocationARB = (PFNGLBINDATTRIBLOCATIONARBPROC) GLH_EXT_GET_PROC_ADDRESS("glBindAttribLocationARB"); glGetActiveAttribARB = (PFNGLGETACTIVEATTRIBARBPROC) GLH_EXT_GET_PROC_ADDRESS("glGetActiveAttribARB"); @@ -944,7 +993,7 @@ void assert_glerror() { // 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; + LL_WARNS("RenderState") << "GL Error: UNKNOWN 0x" << std::hex << error << std::dec << LL_ENDL; } error = glGetError(); #endif @@ -980,12 +1029,14 @@ 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. + sStateMap[GL_MULTISAMPLE_ARB] = GL_FALSE; + glDisable(GL_MULTISAMPLE_ARB); + glEnableClientState(GL_VERTEX_ARRAY); } @@ -1038,7 +1089,7 @@ void LLGLState::checkStates(const std::string& msg) 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; + LL_GL_ERRS << "Blend function corrupted: " << std::hex << src << " " << std::hex << dst << " " << msg << std::dec << LL_ENDL; } for (std::map::iterator iter = sStateMap.begin(); @@ -1077,7 +1128,7 @@ void LLGLState::checkTextureChannels(const std::string& msg) if (tex_env_mode != GL_MODULATE) { error = TRUE; - LL_WARNS("RenderState") << "GL_TEXTURE_ENV_MODE invalid: " << std::hex << tex_env_mode << LL_ENDL; + LL_WARNS("RenderState") << "GL_TEXTURE_ENV_MODE invalid: " << std::hex << tex_env_mode << std::dec << LL_ENDL; } } @@ -1093,7 +1144,8 @@ void LLGLState::checkTextureChannels(const std::string& msg) "GL_TEXTURE_GEN_S", "GL_TEXTURE_GEN_T", "GL_TEXTURE_GEN_Q", - "GL_TEXTURE_GEN_R" + "GL_TEXTURE_GEN_R", + "GL_TEXTURE_RECTANGLE_ARB" }; static GLint value[] = @@ -1105,7 +1157,8 @@ void LLGLState::checkTextureChannels(const std::string& msg) GL_TEXTURE_GEN_S, GL_TEXTURE_GEN_T, GL_TEXTURE_GEN_Q, - GL_TEXTURE_GEN_R + GL_TEXTURE_GEN_R, + GL_TEXTURE_RECTANGLE_ARB }; GLint stackDepth = 0; @@ -1133,7 +1186,7 @@ void LLGLState::checkTextureChannels(const std::string& msg) LL_WARNS("RenderState") << "Texture matrix in channel " << i << " corrupt." << LL_ENDL; } - for (S32 j = (i == 0 ? 1 : 0); j < 8; j++) + for (S32 j = (i == 0 ? 1 : 0); j < 9; j++) { if (glIsEnabled(value[j])) { @@ -1141,6 +1194,18 @@ void LLGLState::checkTextureChannels(const std::string& msg) LL_WARNS("RenderState") << "Texture channel " << i << " still has " << label[j] << " enabled." << LL_ENDL; } } + + glh::matrix4f mat; + glh::matrix4f identity; + identity.identity(); + + glGetFloatv(GL_TEXTURE_MATRIX, mat.m); + + if (mat != identity) + { + error = TRUE; + LL_WARNS("RenderState") << "Texture matrix " << i << " is not identity." << LL_ENDL; + } } gGL.getTexUnit(0)->activate(); @@ -1262,6 +1327,22 @@ void LLGLState::checkClientArrays(const std::string& msg, U32 data_mask) glClientActiveTextureARB(GL_TEXTURE0_ARB); gGL.getTexUnit(0)->activate(); + if (gGLManager.mHasVertexShader) + { //make sure vertex attribs are all disabled + GLint count; + glGetIntegerv(GL_MAX_VERTEX_ATTRIBS_ARB, &count); + for (GLint i = 0; i < count; i++) + { + GLint enabled; + glGetVertexAttribivARB((GLuint) i, GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB, &enabled); + if (enabled) + { + error = TRUE; + LL_WARNS("RenderState") << "GL still has vertex attrib array " << i << " enabled." << LL_ENDL; + } + } + } + if (error) { LL_GL_ERRS << "GL client array corruption detected. " << msg << LL_ENDL; @@ -1647,6 +1728,7 @@ void LLGLNamePool::cleanupPools() LLGLDepthTest::LLGLDepthTest(GLboolean depth_enabled, GLboolean write_enabled, GLenum depth_func) : mPrevDepthEnabled(sDepthEnabled), mPrevDepthFunc(sDepthFunc), mPrevWriteEnabled(sWriteEnabled) { + stop_glerror(); if (depth_enabled != sDepthEnabled) { gGL.flush(); diff --git a/linden/indra/llrender/llgl.h b/linden/indra/llrender/llgl.h index 011fd63..00ff1e2 100644 --- a/linden/indra/llrender/llgl.h +++ b/linden/indra/llrender/llgl.h @@ -17,7 +17,8 @@ * 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 + * 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, @@ -76,7 +77,8 @@ public: BOOL mHasMipMapGeneration; BOOL mHasCompressedTextures; BOOL mHasFramebufferObject; - + BOOL mHasFramebufferMultisample; + // ARB Extensions BOOL mHasVertexBufferObject; BOOL mHasPBuffer; @@ -85,6 +87,7 @@ public: BOOL mHasFragmentShader; BOOL mHasOcclusionQuery; BOOL mHasPointParameters; + BOOL mHasDrawBuffers; // Other extensions. BOOL mHasAnisotropic; diff --git a/linden/indra/llrender/llgldbg.cpp b/linden/indra/llrender/llgldbg.cpp index 27b45a9..c54ab18 100644 --- a/linden/indra/llrender/llgldbg.cpp +++ b/linden/indra/llrender/llgldbg.cpp @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llrender/llgldbg.h b/linden/indra/llrender/llgldbg.h index 73ab7fc..d989091 100644 --- a/linden/indra/llrender/llgldbg.h +++ b/linden/indra/llrender/llgldbg.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llrender/llglheaders.h b/linden/indra/llrender/llglheaders.h index 20a420b..c7178a5 100644 --- a/linden/indra/llrender/llglheaders.h +++ b/linden/indra/llrender/llglheaders.h @@ -17,7 +17,8 @@ * 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 + * 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, @@ -32,11 +33,215 @@ #ifndef LL_LLGLHEADERS_H #define LL_LLGLHEADERS_H -#if LL_MESA +#if LL_SOLARIS +# if defined(__sparc) +# define I_NEED_OS2_H // avoiding BOOL conflicts +# endif +# include "GL/gl.h" +# if defined(__sparc) +# undef I_NEED_OS2_H +# ifdef BOOL +# undef BOOL // now get rid of Xmd.h crap +# endif +# endif +# include "GL/glx.h" +# define GL_GLEXT_PROTOTYPES 1 +# include "GL/glext.h" +# include "GL/glu.h" +# include "GL/glx.h" +# define GLX_GLXEXT_PROTOTYPES 1 +# include "GL/glxext.h" +//# define GLH_EXT_GET_PROC_ADDRESS(p) glXGetProcAddressARB((const GLubyte*)(p)) +# define GLH_EXT_GET_PROC_ADDRESS(p) glXGetProcAddress((const GLubyte*)(p)) +// the X headers define 'Status'. Undefine to avoid confusion. +#undef Status + +// The __APPLE__ kludge is to make glh_extensions.h not symbol-clash horribly +// This header is distributed with SL. You'll find it in linden/libraries/include/GL/ +# define __APPLE__ +# include "GL/glh_extensions.h" +# undef __APPLE__ + + +// 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_MESA //---------------------------------------------------------------------------- // MESA headers // quotes so we get libraries/.../GL/ version -#define GL_GLEXT_PROTOTYPES +#define GL_GLEXT_PROTOTYPES 1 #include "GL/gl.h" #include "GL/glext.h" #include "GL/glu.h" @@ -46,7 +251,7 @@ # include "GL/glh_extensions.h" # undef __APPLE__ -#elif LL_LINUX +#elif LL_LINUX //---------------------------------------------------------------------------- // Linux, MESA headers, but not necessarily assuming MESA runtime. // quotes so we get libraries/.../GL/ version @@ -76,6 +281,20 @@ #undef Status #endif // LL_LINUX && !LL_MESA_HEADLESS +#if LL_LINUX && defined(WINGDIAPI) +// WINGDIAPI gets set if we are using the linux nvidia gl.h header which needs +// the functions below setting up. +# define LL_LINUX_NV_GL_HEADERS 1 +#else +# define LL_LINUX_NV_GL_HEADERS 0 +#endif // LL_LINUX && defined(WINGDIAPI) + +#if LL_LINUX_NV_GL_HEADERS +// Missing functions when using nvidia headers: +extern PFNGLACTIVETEXTUREARBPROC glActiveTextureARB; +extern PFNGLCLIENTACTIVETEXTUREARBPROC glClientActiveTextureARB; +extern PFNGLDRAWRANGEELEMENTSPROC glDrawRangeElements; +#endif // LL_LINUX_NV_GL_HEADERS // GL_ARB_vertex_buffer_object extern PFNGLBINDBUFFERARBPROC glBindBufferARB; @@ -230,8 +449,6 @@ extern PFNGLGETATTRIBLOCATIONARBPROC glGetAttribLocationARB; extern PFNGLCOMPRESSEDTEXIMAGE2DARBPROC glCompressedTexImage2DARB; extern PFNGLGETCOMPRESSEDTEXIMAGEARBPROC glGetCompressedTexImageARB; -extern PFNGLCOLORTABLEEXTPROC glColorTableEXT; - //GL_EXT_framebuffer_object extern PFNGLISRENDERBUFFEREXTPROC glIsRenderbufferEXT; extern PFNGLBINDRENDERBUFFEREXTPROC glBindRenderbufferEXT; @@ -251,6 +468,14 @@ extern PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC glFramebufferRenderbufferEXT; extern PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC glGetFramebufferAttachmentParameterivEXT; extern PFNGLGENERATEMIPMAPEXTPROC glGenerateMipmapEXT; +// GL_EXT_framebuffer_multisample +extern PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC glRenderbufferStorageMultisampleEXT; + +// GL_EXT_framebuffer_blit +extern PFNGLBLITFRAMEBUFFEREXTPROC glBlitFramebufferEXT; + +//GL_ARB_draw_buffers +extern PFNGLDRAWBUFFERSARBPROC glDrawBuffersARB; #elif LL_WINDOWS @@ -439,6 +664,14 @@ extern PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC glFramebufferRenderbufferEXT; extern PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC glGetFramebufferAttachmentParameterivEXT; extern PFNGLGENERATEMIPMAPEXTPROC glGenerateMipmapEXT; +// GL_EXT_framebuffer_multisample +extern PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC glRenderbufferStorageMultisampleEXT; + +// GL_EXT_framebuffer_blit +extern PFNGLBLITFRAMEBUFFEREXTPROC glBlitFramebufferEXT; + +//GL_ARB_draw_buffers +extern PFNGLDRAWBUFFERSARBPROC glDrawBuffersARB; #elif LL_DARWIN //---------------------------------------------------------------------------- @@ -475,6 +708,8 @@ extern void glFramebufferRenderbufferEXT(GLenum target, GLenum attachment, GLenu 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; +// GL_ARB_draw_buffers +extern void glDrawBuffersARB(GLsizei n, const GLenum* bufs) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; #ifdef __cplusplus extern "C" { diff --git a/linden/indra/llrender/llglimmediate.cpp b/linden/indra/llrender/llglimmediate.cpp index bade1aa..17c2182 100644 --- a/linden/indra/llrender/llglimmediate.cpp +++ b/linden/indra/llrender/llglimmediate.cpp @@ -1,265 +1 @@ -<<<<<<< .working #error This file has been renamed llrender.cpp -======= -/** - * @file llglimmediate.cpp - * @brief LLGLImmediate implementation - * - * $LicenseInfo:firstyear=2001&license=viewergpl$ - * - * Copyright (c) 2001-2009, 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 690abe0..4a7a0eb 100644 --- a/linden/indra/llrender/llglimmediate.h +++ b/linden/indra/llrender/llglimmediate.h @@ -1,98 +1 @@ -<<<<<<< .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-2009, 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 - { - GLfloat v[3]; - GLubyte c[4]; - GLfloat uv[2]; - } Vertex; - -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 index 6683916..08d6548 100644 --- a/linden/indra/llrender/llglslshader.cpp +++ b/linden/indra/llrender/llglslshader.cpp @@ -17,7 +17,8 @@ * 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 + * 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, @@ -255,6 +256,14 @@ void LLGLSLShader::mapUniform(GLint index, const vector * uniforms) S32 location = glGetUniformLocationARB(mProgramObject, name); if (location != -1) { + //chop off "[0]" so we can always access the first element + //of an array by the array name + char* is_array = strstr(name, "[0]"); + if (is_array) + { + is_array[0] = 0; + } + mUniformMap[name] = location; LL_DEBUGS("ShaderLoading") << "Uniform " << name << " is at location " << location << LL_ENDL; @@ -352,11 +361,17 @@ void LLGLSLShader::unbind() { if (gGLManager.mHasShaderObjects) { - for (U32 i = 0; i < mAttribute.size(); ++i) + stop_glerror(); + if (gGLManager.mIsNVIDIA) { - vertexAttrib4f(i, 0,0,0,1); + for (U32 i = 0; i < mAttribute.size(); ++i) + { + vertexAttrib4f(i, 0,0,0,1); + stop_glerror(); + } } glUseProgramObjectARB(0); + stop_glerror(); } } @@ -389,14 +404,39 @@ S32 LLGLSLShader::disableTexture(S32 uniform, LLTexUnit::eTextureType mode) return -1; } S32 index = mTexture[uniform]; - if (index != -1) + if (index != -1 && gGL.getTexUnit(index)->getCurrType() != LLTexUnit::TT_NONE) { - gGL.getTexUnit(index)->activate(); + if (gDebugGL && gGL.getTexUnit(index)->getCurrType() != mode) + { + llerrs << "Texture channel " << index << " texture type corrupted." << llendl; + } gGL.getTexUnit(index)->disable(); } return index; } +void LLGLSLShader::uniform1i(U32 index, GLint 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) + { + glUniform1iARB(mUniform[index], x); + mValue[mUniform[index]] = LLVector4(x,0.f,0.f,0.f); + } + } + } +} + void LLGLSLShader::uniform1f(U32 index, GLfloat x) { if (mProgramObject > 0) @@ -488,6 +528,29 @@ void LLGLSLShader::uniform4f(U32 index, GLfloat x, GLfloat y, GLfloat z, GLfloat } } +void LLGLSLShader::uniform1iv(U32 index, U32 count, const GLint* 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) + { + glUniform1ivARB(mUniform[index], count, v); + mValue[mUniform[index]] = vec; + } + } + } +} + void LLGLSLShader::uniform1fv(U32 index, U32 count, const GLfloat* v) { if (mProgramObject > 0) @@ -646,6 +709,22 @@ GLint LLGLSLShader::getUniformLocation(const string& uniform) return -1; } +void LLGLSLShader::uniform1i(const string& uniform, GLint 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)) + { + glUniform1iARB(location, v); + mValue[location] = vec; + } + } +} + void LLGLSLShader::uniform1f(const string& uniform, GLfloat v) { GLint location = getUniformLocation(uniform); diff --git a/linden/indra/llrender/llglslshader.h b/linden/indra/llrender/llglslshader.h index 66c53df..166d4af 100644 --- a/linden/indra/llrender/llglslshader.h +++ b/linden/indra/llrender/llglslshader.h @@ -17,7 +17,8 @@ * 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 + * 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, @@ -77,18 +78,22 @@ public: BOOL mapAttributes(const std::vector * attributes); BOOL mapUniforms(const std::vector * uniforms); void mapUniform(GLint index, const std::vector * uniforms); + void uniform1i(U32 index, GLint i); 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 uniform1iv(U32 index, U32 count, const GLint* i); 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 uniform1i(const std::string& uniform, GLint i); 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 uniform1iv(const std::string& uniform, U32 count, const GLint* i); 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); diff --git a/linden/indra/llrender/llglstates.h b/linden/indra/llrender/llglstates.h index 94d136e..4a51cac 100644 --- a/linden/indra/llrender/llglstates.h +++ b/linden/indra/llrender/llglstates.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llrender/llgltypes.h b/linden/indra/llrender/llgltypes.h index 5809b9c..9b0e81f 100644 --- a/linden/indra/llrender/llgltypes.h +++ b/linden/indra/llrender/llgltypes.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llrender/llimagegl.cpp b/linden/indra/llrender/llimagegl.cpp index 6a142a7..cdf626e 100644 --- a/linden/indra/llrender/llimagegl.cpp +++ b/linden/indra/llrender/llimagegl.cpp @@ -17,7 +17,8 @@ * 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 + * 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, @@ -62,7 +63,6 @@ BOOL LLImageGL::sGlobalUseAnisotropic = FALSE; F32 LLImageGL::sLastFrameTime = 0.f; std::set LLImageGL::sImageList; - //************************************************************************************** //below are functions for debug use //do not delete them even though they are not currently being used. @@ -308,21 +308,21 @@ void LLImageGL::init(BOOL usemipmaps) #endif mPickMask = NULL; + mTextureState = NO_DELETE ; mTextureMemory = 0; mLastBindTime = 0.f; mTarget = GL_TEXTURE_2D; mBindTarget = LLTexUnit::TT_TEXTURE; mUseMipMaps = usemipmaps; - mHasMipMaps = FALSE; + mHasMipMaps = false; mAutoGenMips = FALSE; mTexName = 0; mIsResident = 0; - mClampS = FALSE; - mClampT = FALSE; - mClampR = FALSE; - mMagFilterNearest = FALSE; - mMinFilterNearest = FALSE; + + mTexOptionsDirty = true; + mAddressMode = LLTexUnit::TAM_WRAP; + mFilterOption = LLTexUnit::TFO_ANISOTROPIC; mWidth = 0; mHeight = 0; mComponents = 0; @@ -338,6 +338,7 @@ void LLImageGL::init(BOOL usemipmaps) mHasExplicitFormat = FALSE; mGLTextureCreated = FALSE ; + mIsMask = FALSE; } void LLImageGL::cleanup() @@ -468,6 +469,11 @@ bool LLImageGL::bindDefaultImage(const S32 stage) const return false; } +//virtual +void LLImageGL::forceImmediateUpdate() +{ + return ; +} void LLImageGL::setExplicitFormat( LLGLint internal_format, LLGLenum primary_format, LLGLenum type_format, BOOL swap_bytes ) { @@ -497,17 +503,15 @@ void LLImageGL::setImage(const LLImageRaw* imageraw) void LLImageGL::setImage(const U8* data_in, BOOL data_hasmips) { // LLFastTimer t1(LLFastTimer::FTM_TEMP1); - + llpushcallstacks ; bool is_compressed = false; if (mFormatPrimary >= GL_COMPRESSED_RGBA_S3TC_DXT1_EXT && mFormatPrimary <= GL_COMPRESSED_RGBA_S3TC_DXT5_EXT) { is_compressed = true; } - { // LLFastTimer t2(LLFastTimer::FTM_TEMP2); - llverify(gGL.getTexUnit(0)->bind(this)); - } + gGL.getTexUnit(0)->bind(this); if (mUseMipMaps) { @@ -518,6 +522,7 @@ void LLImageGL::setImage(const U8* data_in, BOOL data_hasmips) // are stored BEFORE the largest image for (S32 d=mCurrentDiscardLevel; d<=mMaxDiscardLevel; d++) { + S32 w = getWidth(d); S32 h = getHeight(d); S32 gl_level = d-mCurrentDiscardLevel; @@ -528,7 +533,7 @@ void LLImageGL::setImage(const U8* data_in, BOOL data_hasmips) if (is_compressed) { // LLFastTimer t2(LLFastTimer::FTM_TEMP4); - S32 tex_size = dataFormatBytes(mFormatPrimary, w, h); + S32 tex_size = dataFormatBytes(mFormatPrimary, w, h); glCompressedTexImage2DARB(mTarget, gl_level, mFormatPrimary, w, h, 0, tex_size, (GLvoid *)data_in); stop_glerror(); } @@ -542,7 +547,11 @@ void LLImageGL::setImage(const U8* data_in, BOOL data_hasmips) stop_glerror(); } - glTexImage2D(mTarget, gl_level, mFormatInternal, w, h, 0, mFormatPrimary, GL_UNSIGNED_BYTE, (GLvoid*)data_in); + LLImageGL::setManualImage(mTarget, gl_level, mFormatInternal, w, h, mFormatPrimary, GL_UNSIGNED_BYTE, (GLvoid*)data_in); + if (gl_level == 0) + { + analyzeAlpha(data_in, w, h); + } updatePickMask(w, h, data_in); if(mFormatSwapBytes) @@ -574,10 +583,11 @@ void LLImageGL::setImage(const U8* data_in, BOOL data_hasmips) S32 w = getWidth(mCurrentDiscardLevel); S32 h = getHeight(mCurrentDiscardLevel); - glTexImage2D(mTarget, 0, mFormatInternal, - w, h, 0, + LLImageGL::setManualImage(mTarget, 0, mFormatInternal, + w, h, mFormatPrimary, mFormatType, data_in); + analyzeAlpha(data_in, w, h); stop_glerror(); updatePickMask(w, h, data_in); @@ -629,7 +639,11 @@ void LLImageGL::setImage(const U8* data_in, BOOL data_hasmips) stop_glerror(); } - glTexImage2D(mTarget, m, mFormatInternal, w, h, 0, mFormatPrimary, mFormatType, cur_mip_data); + LLImageGL::setManualImage(mTarget, m, mFormatInternal, w, h, mFormatPrimary, mFormatType, cur_mip_data); + if (m == 0) + { + analyzeAlpha(data_in, w, h); + } stop_glerror(); if (m == 0) { @@ -662,7 +676,7 @@ void LLImageGL::setImage(const U8* data_in, BOOL data_hasmips) { llerrs << "Compressed Image has mipmaps but data does not (can not auto generate compressed mips)" << llendl; } - mHasMipMaps = TRUE; + mHasMipMaps = true; } else { @@ -683,8 +697,10 @@ void LLImageGL::setImage(const U8* data_in, BOOL data_hasmips) stop_glerror(); } - glTexImage2D(mTarget, 0, mFormatInternal, w, h, 0, + LLImageGL::setManualImage(mTarget, 0, mFormatInternal, w, h, mFormatPrimary, mFormatType, (GLvoid *)data_in); + analyzeAlpha(data_in, w, h); + updatePickMask(w, h, data_in); stop_glerror(); @@ -696,14 +712,16 @@ void LLImageGL::setImage(const U8* data_in, BOOL data_hasmips) } } - mHasMipMaps = FALSE; + mHasMipMaps = false; } stop_glerror(); mGLTextureCreated = true; + llpushcallstacks ; } BOOL LLImageGL::setSubImage(const U8* datap, S32 data_width, S32 data_height, S32 x_pos, S32 y_pos, S32 width, S32 height) { + llpushcallstacks ; if (!width || !height) { return TRUE; @@ -779,6 +797,7 @@ BOOL LLImageGL::setSubImage(const U8* datap, S32 data_width, S32 data_height, S3 glTexSubImage2D(mTarget, 0, x_pos, y_pos, width, height, mFormatPrimary, mFormatType, datap); + gGL.getTexUnit(0)->disable(); stop_glerror(); if(mFormatSwapBytes) @@ -791,6 +810,7 @@ BOOL LLImageGL::setSubImage(const U8* datap, S32 data_width, S32 data_height, S3 stop_glerror(); mGLTextureCreated = true; } + llpushcallstacks ; return TRUE; } @@ -815,6 +835,24 @@ BOOL LLImageGL::setSubImageFromFrameBuffer(S32 fb_x, S32 fb_y, S32 x_pos, S32 y_ } } +// static +void LLImageGL::generateTextures(S32 numTextures, U32 *textures) +{ + glGenTextures(numTextures, (GLuint*)textures); +} + +// static +void LLImageGL::deleteTextures(S32 numTextures, U32 *textures) +{ + glDeleteTextures(numTextures, (GLuint*)textures); +} + +// static +void LLImageGL::setManualImage(U32 target, S32 miplevel, S32 intformat, S32 width, S32 height, U32 pixformat, U32 pixtype, const void *pixels) +{ + glTexImage2D(target, miplevel, intformat, width, height, 0, pixformat, pixtype, pixels); +} + //create an empty GL texture: just create a texture name //the texture is assiciate with some image by calling glTexImage outside LLImageGL BOOL LLImageGL::createGLTexture() @@ -847,6 +885,7 @@ BOOL LLImageGL::createGLTexture() BOOL LLImageGL::createGLTexture(S32 discard_level, const LLImageRaw* imageraw, S32 usename/*=0*/) { + llpushcallstacks ; if (gGLManager.mIsDisabled) { llwarns << "Trying to create a texture while GL is disabled!" << llendl; @@ -907,6 +946,7 @@ BOOL LLImageGL::createGLTexture(S32 discard_level, const LLImageRaw* imageraw, S BOOL LLImageGL::createGLTexture(S32 discard_level, const U8* data_in, BOOL data_hasmips, S32 usename) { + llpushcallstacks ; llassert(data_in); if (discard_level < 0) @@ -923,7 +963,7 @@ BOOL LLImageGL::createGLTexture(S32 discard_level, const U8* data_in, BOOL data_ return TRUE; } - GLuint old_name = mTexName; + U32 old_name = mTexName; // S32 old_discard = mCurrentDiscardLevel; if (usename != 0) @@ -932,7 +972,7 @@ BOOL LLImageGL::createGLTexture(S32 discard_level, const U8* data_in, BOOL data_ } else { - glGenTextures(1, (GLuint*)&mTexName); + LLImageGL::generateTextures(1, &mTexName); stop_glerror(); { // LLFastTimer t1(LLFastTimer::FTM_TEMP6); @@ -962,9 +1002,11 @@ BOOL LLImageGL::createGLTexture(S32 discard_level, const U8* data_in, BOOL data_ setImage(data_in, data_hasmips); - setClamp(mClampS, mClampT); - setMipFilterNearest(mMagFilterNearest); - + // Set texture options to our defaults. + gGL.getTexUnit(0)->setHasMipMaps(mHasMipMaps); + gGL.getTexUnit(0)->setTextureAddressMode(mAddressMode); + gGL.getTexUnit(0)->setTextureFilteringOption(mFilterOption); + // things will break if we don't unbind after creation gGL.getTexUnit(0)->unbind(mBindTarget); stop_glerror(); @@ -972,16 +1014,18 @@ BOOL LLImageGL::createGLTexture(S32 discard_level, const U8* data_in, BOOL data_ if (old_name != 0) { sGlobalTextureMemory -= mTextureMemory; - glDeleteTextures(1, &old_name); + LLImageGL::deleteTextures(1, &old_name); stop_glerror(); } mTextureMemory = getMipBytes(discard_level); sGlobalTextureMemory += mTextureMemory; - + setActive() ; + // mark this as bound at this point, so we don't throw it out immediately mLastBindTime = sLastFrameTime; + llpushcallstacks ; return TRUE; } @@ -1054,6 +1098,7 @@ BOOL LLImageGL::isValidForSculpt(S32 discard_level, S32 image_width, S32 image_h BOOL LLImageGL::readBackRaw(S32 discard_level, LLImageRaw* imageraw, bool compressed_ok) { + llpushcallstacks ; if (discard_level < 0) { discard_level = mCurrentDiscardLevel; @@ -1068,7 +1113,7 @@ BOOL LLImageGL::readBackRaw(S32 discard_level, LLImageRaw* imageraw, bool compre //explicitly unbind texture gGL.getTexUnit(0)->unbind(mBindTarget); - llverify(gGL.getTexUnit(0)->bind(this)); + llverify(gGL.getTexUnit(0)->bindManual(mBindTarget, mTexName)); //debug code, leave it there commented. //checkTexSize() ; @@ -1156,7 +1201,7 @@ BOOL LLImageGL::readBackRaw(S32 discard_level, LLImageRaw* imageraw, bool compre return FALSE ; } //----------------------------------------------------------------------------------------------- - + llpushcallstacks ; return TRUE ; } @@ -1178,8 +1223,10 @@ void LLImageGL::destroyGLTexture() sGlobalTextureMemory -= mTextureMemory; mTextureMemory = 0; - glDeleteTextures(1, (GLuint*)&mTexName); + LLImageGL::deleteTextures(1, &mTexName); + mTextureState = DELETED ; mTexName = 0; + mCurrentDiscardLevel = -1 ; //invalidate mCurrentDiscardLevel. mGLTextureCreated = FALSE ; stop_glerror(); } @@ -1187,89 +1234,35 @@ void LLImageGL::destroyGLTexture() //---------------------------------------------------------------------------- -void LLImageGL::glClampCubemap (BOOL clamps, BOOL clampt, BOOL clampr) +void LLImageGL::setAddressMode(LLTexUnit::eTextureAddressMode mode) { - glTexParameteri (GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_WRAP_S, clamps ? GL_CLAMP_TO_EDGE : GL_REPEAT); - glTexParameteri (GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_WRAP_T, clamps ? GL_CLAMP_TO_EDGE : GL_REPEAT); - glTexParameteri (GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_WRAP_R, clamps ? GL_CLAMP_TO_EDGE : GL_REPEAT); -} - -void LLImageGL::glClamp (BOOL clamps, BOOL clampt) -{ - if (mTexName != 0) + if (mAddressMode != mode) { - glTexParameteri (LLTexUnit::getInternalType(mBindTarget), GL_TEXTURE_WRAP_S, clamps ? GL_CLAMP_TO_EDGE : GL_REPEAT); - glTexParameteri (LLTexUnit::getInternalType(mBindTarget), GL_TEXTURE_WRAP_T, clampt ? GL_CLAMP_TO_EDGE : GL_REPEAT); + mTexOptionsDirty = true; + mAddressMode = mode; } -} - -void LLImageGL::setClampCubemap (BOOL clamps, BOOL clampt, BOOL clampr) -{ - mClampS = clamps; - mClampT = clampt; - mClampR = clampr; - glClampCubemap (clamps, clampt, clampr); -} -void LLImageGL::setClamp(BOOL clamps, BOOL clampt) -{ - mClampS = clamps; - mClampT = clampt; - glClamp (clamps, clampt); -} - -void LLImageGL::overrideClamp (BOOL clamps, BOOL clampt) -{ - glClamp (clamps, clampt); -} - -void LLImageGL::restoreClamp (void) -{ - glClamp (mClampS, mClampT); + if (gGL.getTexUnit(gGL.getCurrentTexUnitIndex())->getCurrTexture() == mTexName) + { + gGL.getTexUnit(gGL.getCurrentTexUnitIndex())->setTextureAddressMode(mode); + mTexOptionsDirty = false; + } } -void LLImageGL::setMipFilterNearest(BOOL mag_nearest, BOOL min_nearest) +void LLImageGL::setFilteringOption(LLTexUnit::eTextureFilterOptions option) { - mMagFilterNearest = mag_nearest; - mMinFilterNearest = min_nearest; + if (mFilterOption != option) + { + mTexOptionsDirty = true; + mFilterOption = option; + } - if (mTexName != 0) + if (gGL.getTexUnit(gGL.getCurrentTexUnitIndex())->getCurrTexture() == mTexName) { - if (mMinFilterNearest) - { - glTexParameteri(LLTexUnit::getInternalType(mBindTarget), GL_TEXTURE_MIN_FILTER, GL_NEAREST); - } - else if (mHasMipMaps) - { - glTexParameteri(LLTexUnit::getInternalType(mBindTarget), GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); - } - else - { - glTexParameteri(LLTexUnit::getInternalType(mBindTarget), GL_TEXTURE_MIN_FILTER, GL_LINEAR); - } - if (mMagFilterNearest) - { - glTexParameteri(LLTexUnit::getInternalType(mBindTarget), GL_TEXTURE_MAG_FILTER, GL_NEAREST); - } - else - { - glTexParameteri(LLTexUnit::getInternalType(mBindTarget), GL_TEXTURE_MAG_FILTER, GL_LINEAR); - } - if (gGLManager.mHasAnisotropic) - { - if (sGlobalUseAnisotropic && !mMagFilterNearest) - { - F32 largest_anisotropy; - glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &largest_anisotropy); - glTexParameterf(LLTexUnit::getInternalType(mBindTarget), GL_TEXTURE_MAX_ANISOTROPY_EXT, largest_anisotropy); - } - else - { - glTexParameterf(LLTexUnit::getInternalType(mBindTarget), GL_TEXTURE_MAX_ANISOTROPY_EXT, 1.f); - } - } - stop_glerror(); - } + gGL.getTexUnit(gGL.getCurrentTexUnitIndex())->setTextureFilteringOption(option); + mTexOptionsDirty = false; + } + stop_glerror(); } BOOL LLImageGL::getIsResident(BOOL test_now) @@ -1356,6 +1349,118 @@ void LLImageGL::setTarget(const LLGLenum target, const LLTexUnit::eTextureType b mBindTarget = bind_target; } +void LLImageGL::analyzeAlpha(const void* data_in, S32 w, S32 h) +{ + if (mFormatType != GL_UNSIGNED_BYTE) + { + llwarns << "Cannot analyze alpha for image with format type " << std::hex << mFormatType << std::dec << llendl; + } + + U32 stride = 0; + switch (mFormatPrimary) + { + case GL_LUMINANCE: + case GL_ALPHA: + stride = 1; + break; + case GL_LUMINANCE_ALPHA: + stride = 2; + break; + case GL_RGB: + //no alpha + mIsMask = FALSE; + return; + case GL_RGBA: + stride = 4; + break; + case GL_BGRA_EXT: + stride = 4; + break; + default: + llwarns << "Cannot analyze alpha of image with primary format " << std::hex << mFormatPrimary << std::dec << llendl; + return; + } + + U32 length = w * h; + const GLubyte* current = ((const GLubyte*) data_in)+stride-1; + + S32 sample[16]; + memset(sample, 0, sizeof(S32)*16); + + for (U32 i = 0; i < length; i++) + { + ++sample[*current/16]; + current += stride; + } + + U32 total = 0; + for (U32 i = 4; i < 11; i++) + { + total += sample[i]; + } + + if (total > length/16) + { + mIsMask = FALSE; + } + else + { + mIsMask = TRUE; + } +} + +BOOL LLImageGL::isDeleted() +{ + return mTextureState == DELETED ; +} + +BOOL LLImageGL::isInactive() +{ + return mTextureState == INACTIVE ; +} + +BOOL LLImageGL::isDeletionCandidate() +{ + return mTextureState == DELETION_CANDIDATE ; +} + +void LLImageGL::setDeletionCandidate() +{ + if(mTexName && (mTextureState == INACTIVE)) + { + mTextureState = DELETION_CANDIDATE ; + } +} + +void LLImageGL::forceActive() +{ + mTextureState = ACTIVE ; +} + +void LLImageGL::setActive() +{ + if(mTextureState != NO_DELETE) + { + mTextureState = ACTIVE ; + } +} + +//set the texture inactive +void LLImageGL::setInactive() +{ + if(mTexName && (mTextureState == ACTIVE) && !getBoundRecently()) + { + mTextureState = INACTIVE ; + } +} + +//set the texture to stay in memory +void LLImageGL::setNoDelete() +{ + mTextureState = NO_DELETE ; +} + +//---------------------------------------------------------------------------- void LLImageGL::updatePickMask(S32 width, S32 height, const U8* data_in) { if (mFormatType != GL_UNSIGNED_BYTE || @@ -1468,7 +1573,7 @@ BOOL LLImageGL::getMask(const LLVector2 &tc) llassert(w > 0 && h > 0 && cur_mip_data); U8 test = cur_mip_data[w*h*mComponents-1]; { - glTexImage2D(mTarget, m, mFormatInternal, w, h, 0, mFormatPrimary, mFormatType, cur_mip_data); + LLImageGL::setManualImage(mTarget, m, mFormatInternal, w, h, mFormatPrimary, mFormatType, cur_mip_data); stop_glerror(); } if (prev_mip_data && prev_mip_data != rawdata) diff --git a/linden/indra/llrender/llimagegl.h b/linden/indra/llrender/llimagegl.h index 1965495..4f737bc 100644 --- a/linden/indra/llrender/llimagegl.h +++ b/linden/indra/llrender/llimagegl.h @@ -17,7 +17,8 @@ * 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 + * 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, @@ -45,6 +46,7 @@ class LLImageGL : public LLRefCount { + friend class LLTexUnit; public: // Size calculation static S32 dataFormatBits(S32 dataformat); @@ -79,17 +81,22 @@ public: protected: virtual ~LLImageGL(); -private: - void glClamp (BOOL clamps, BOOL clampt); - void glClampCubemap (BOOL clamps, BOOL clampt, BOOL clampr = FALSE); + void analyzeAlpha(const void* data_in, S32 w, S32 h); public: virtual void dump(); // debugging info to llinfos virtual bool bindError(const S32 stage = 0) const; virtual bool bindDefaultImage(const S32 stage = 0) const; + virtual void forceImmediateUpdate() ; void setSize(S32 width, S32 height, S32 ncomponents); + // These 3 functions currently wrap glGenTextures(), glDeleteTextures(), and glTexImage2D() + // for tracking purposes and will be deprecated in the future + static void generateTextures(S32 numTextures, U32 *textures); + static void deleteTextures(S32 numTextures, U32 *textures); + static void setManualImage(U32 target, S32 miplevel, S32 intformat, S32 width, S32 height, U32 pixformat, U32 pixtype, const void *pixels); + BOOL createGLTexture() ; BOOL createGLTexture(S32 discard_level, const LLImageRaw* imageraw, S32 usename = 0); BOOL createGLTexture(S32 discard_level, const U8* data, BOOL data_hasmips = FALSE, S32 usename = 0); @@ -102,14 +109,9 @@ public: // Read back a raw image for this discard level, if it exists BOOL readBackRaw(S32 discard_level, LLImageRaw* imageraw, bool compressed_ok); void destroyGLTexture(); - - void setClampCubemap (BOOL clamps, BOOL clampt, BOOL clampr = FALSE); - void setClamp(BOOL clamps, BOOL clampt); - void overrideClamp (BOOL clamps, BOOL clampt); - void restoreClamp (void); - void setMipFilterNearest(BOOL mag_nearest, BOOL min_nearest = FALSE); + void setExplicitFormat(LLGLint internal_format, LLGLenum primary_format, LLGLenum type_format = 0, BOOL swap_bytes = FALSE); - void dontDiscard() { mDontDiscard = 1; } + void dontDiscard() { mDontDiscard = 1; mTextureState = NO_DELETE; } S32 getDiscardLevel() const { return mCurrentDiscardLevel; } S32 getMaxDiscardLevel() const { return mMaxDiscardLevel; } @@ -123,15 +125,12 @@ public: S32 getMipBytes(S32 discard_level = -1) const; BOOL getBoundRecently() const; LLGLenum getPrimaryFormat() const { return mFormatPrimary; } - - BOOL getClampS() const { return mClampS; } - BOOL getClampT() const { return mClampT; } - BOOL getClampR() const { return mClampR; } - BOOL getMipFilterNearest() const { return mMagFilterNearest; } - + BOOL getHasGLTexture() const { return mTexName != 0; } LLGLuint getTexName() const { return mTexName; } + BOOL getIsAlphaMask() const { return mIsMask; } + BOOL getIsResident(BOOL test_now = FALSE); // not const void setTarget(const LLGLenum target, const LLTexUnit::eTextureType bind_target); @@ -151,6 +150,27 @@ public: BOOL getMask(const LLVector2 &tc); void checkTexSize() const ; + + // Sets the addressing mode used to sample the texture + // (such as wrapping, mirrored wrapping, and clamp) + // Note: this actually gets set the next time the texture is bound. + void setAddressMode(LLTexUnit::eTextureAddressMode mode); + LLTexUnit::eTextureAddressMode getAddressMode(void) const { return mAddressMode; } + + // Sets the filtering options used to sample the texture + // (such as point sampling, bilinear interpolation, mipmapping, and anisotropic filtering) + // Note: this actually gets set the next time the texture is bound. + void setFilteringOption(LLTexUnit::eTextureFilterOptions option); + LLTexUnit::eTextureFilterOptions getFilteringOption(void) const { return mFilterOption; } + + BOOL isDeleted() ; + BOOL isInactive() ; + BOOL isDeletionCandidate(); + void setDeletionCandidate() ; + void setInactive() ; + void setActive() ; + void forceActive() ; + void setNoDelete() ; protected: void init(BOOL usemipmaps); @@ -165,9 +185,10 @@ private: LLPointer mSaveData; // used for destroyGL/restoreGL U8* mPickMask; //downsampled bitmap approximation of alpha channel. NULL if no alpha channel S8 mUseMipMaps; - S8 mHasMipMaps; S8 mHasExplicitFormat; // If false (default), GL format is f(mComponents) S8 mAutoGenMips; + + BOOL mIsMask; bool mGLTextureCreated ; LLGLuint mTexName; @@ -178,6 +199,7 @@ private: protected: LLGLenum mTarget; // Normally GL_TEXTURE2D, sometimes something else (ex. cube maps) LLTexUnit::eTextureType mBindTarget; // Normally TT_TEXTURE, sometimes something else (ex. cube maps) + bool mHasMipMaps; LLGLboolean mIsResident; @@ -185,17 +207,27 @@ protected: S8 mMaxDiscardLevel; S8 mDontDiscard; // Keep full res version of this image (for UI, etc) - S8 mClampS; // Need to save clamp state - S8 mClampT; - S8 mClampR; - S8 mMagFilterNearest; // if TRUE, set magfilter to GL_NEAREST - S8 mMinFilterNearest; // if TRUE, set minfilter to GL_NEAREST + bool mTexOptionsDirty; + LLTexUnit::eTextureAddressMode mAddressMode; // Defaults to TAM_WRAP + LLTexUnit::eTextureFilterOptions mFilterOption; // Defaults to TFO_TRILINEAR + LLGLint mFormatInternal; // = GL internalformat LLGLenum mFormatPrimary; // = GL format (pixel data format) LLGLenum mFormatType; BOOL mFormatSwapBytes;// if true, use glPixelStorei(GL_UNPACK_SWAP_BYTES, 1) +protected: + typedef enum + { + DELETED = 0, //removed from memory + DELETION_CANDIDATE, //ready to be removed from memory + INACTIVE, //not be used for the last certain period (i.e., 30 seconds). + ACTIVE, //just being used, can become inactive if not being used for a certain time (10 seconds). + NO_DELETE = 99 //stay in memory, can not be removed. + } LLGLTexureState; + LLGLTexureState mTextureState ; + // STATICS public: static std::set sImageList; diff --git a/linden/indra/llrender/llpostprocess.cpp b/linden/indra/llrender/llpostprocess.cpp index 92a0854..7f4be6a 100644 --- a/linden/indra/llrender/llpostprocess.cpp +++ b/linden/indra/llrender/llpostprocess.cpp @@ -17,7 +17,8 @@ * 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 + * 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, @@ -207,7 +208,7 @@ void LLPostProcess::applyShaders(void) /// If any of the above shaders have been called update the frame buffer; if (tweaks.useColorFilter()) { - GLuint tex = mSceneRenderTexture->getTexName() ; + U32 tex = mSceneRenderTexture->getTexName() ; copyFrameBuffer(tex, screenW, screenH); } applyNightVisionShader(); @@ -217,7 +218,7 @@ void LLPostProcess::applyShaders(void) /// If any of the above shaders have been called update the frame buffer; if (tweaks.useColorFilter().asBoolean() || tweaks.useNightVisionShader().asBoolean()) { - GLuint tex = mSceneRenderTexture->getTexName() ; + U32 tex = mSceneRenderTexture->getTexName() ; copyFrameBuffer(tex, screenW, screenH); } applyBloomShader(); @@ -359,7 +360,7 @@ void LLPostProcess::doEffects(void) /// Copy the screen buffer to the render texture { - GLuint tex = mSceneRenderTexture->getTexName() ; + U32 tex = mSceneRenderTexture->getTexName() ; copyFrameBuffer(tex, screenW, screenH); } @@ -385,7 +386,7 @@ void LLPostProcess::doEffects(void) checkError(); } -void LLPostProcess::copyFrameBuffer(GLuint & texture, unsigned int width, unsigned int height) +void LLPostProcess::copyFrameBuffer(U32 & texture, unsigned int width, unsigned int height) { gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_RECT_TEXTURE, texture); glCopyTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGBA, 0, 0, width, height, 0); @@ -502,10 +503,8 @@ void LLPostProcess::createTexture(LLPointer& texture, unsigned int wi gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_RECT_TEXTURE, texture->getTexName()); 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); + gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR); + gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_CLAMP); } } @@ -522,11 +521,9 @@ void LLPostProcess::createNoiseTexture(LLPointer& texture) if(texture->createGLTexture()) { gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, texture->getTexName()); - 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); + LLImageGL::setManualImage(GL_TEXTURE_2D, 0, GL_LUMINANCE, NOISE_SIZE, NOISE_SIZE, GL_LUMINANCE, GL_UNSIGNED_BYTE, &buffer[0]); + gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR); + gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_WRAP); } } diff --git a/linden/indra/llrender/llpostprocess.h b/linden/indra/llrender/llpostprocess.h index b191e9d..009e4bd 100644 --- a/linden/indra/llrender/llpostprocess.h +++ b/linden/indra/llrender/llpostprocess.h @@ -17,7 +17,8 @@ * 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 + * 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, @@ -255,7 +256,7 @@ private: /// OpenGL Helper Functions void getShaderUniforms(glslUniforms & uniforms, GLhandleARB & prog); void createTexture(LLPointer& texture, unsigned int width, unsigned int height); - void copyFrameBuffer(GLuint & texture, unsigned int width, unsigned int height); + void copyFrameBuffer(U32 & texture, unsigned int width, unsigned int height); void createNoiseTexture(LLPointer& texture); bool checkError(void); void checkShaderError(GLhandleARB shader); diff --git a/linden/indra/llrender/llrender.cpp b/linden/indra/llrender/llrender.cpp index ff0a2db..ba95a19 100644 --- a/linden/indra/llrender/llrender.cpp +++ b/linden/indra/llrender/llrender.cpp @@ -17,7 +17,8 @@ * 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 + * 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, @@ -74,7 +75,7 @@ static GLenum sGLCompareFunc[] = GL_GREATER }; -const U32 immediate_mask = LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_COLOR | LLVertexBuffer::MAP_TEXCOORD; +const U32 immediate_mask = LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_COLOR | LLVertexBuffer::MAP_TEXCOORD0; static GLenum sGLBlendFactor[] = { @@ -95,7 +96,8 @@ LLTexUnit::LLTexUnit(S32 index) mCurrColorOp(TBO_MULT), mCurrAlphaOp(TBO_MULT), mCurrColorSrc1(TBS_TEX_COLOR), mCurrColorSrc2(TBS_PREV_COLOR), mCurrAlphaSrc1(TBS_TEX_ALPHA), mCurrAlphaSrc2(TBS_PREV_ALPHA), -mCurrColorScale(1), mCurrAlphaScale(1), mCurrTexture(0) +mCurrColorScale(1), mCurrAlphaScale(1), mCurrTexture(0), +mHasMipMaps(false) { llassert_always(index < LL_NUM_TEXTURE_LAYERS); mIndex = index; @@ -175,8 +177,9 @@ void LLTexUnit::disable(void) } } -bool LLTexUnit::bind(const LLImageGL* texture, bool forceBind) +bool LLTexUnit::bind(LLImageGL* texture, bool forceBind) { + stop_glerror(); if (mIndex < 0) return false; gGL.flush(); @@ -189,14 +192,28 @@ bool LLTexUnit::bind(const LLImageGL* texture, bool forceBind) if (!texture->getTexName()) //if texture does not exist { + //if deleted, will re-generate it immediately + texture->forceImmediateUpdate() ; + return texture->bindDefaultImage(mIndex); } - // Disabled caching of binding state. - activate(); - enable(texture->getTarget()); - mCurrTexture = texture->getTexName(); - glBindTexture(sGLTextureType[texture->getTarget()], mCurrTexture); - texture->updateBindStats(); + + if ((mCurrTexture != texture->getTexName()) || forceBind) + { + activate(); + enable(texture->getTarget()); + mCurrTexture = texture->getTexName(); + glBindTexture(sGLTextureType[texture->getTarget()], mCurrTexture); + texture->updateBindStats(); + texture->setActive() ; + mHasMipMaps = texture->mHasMipMaps; + if (texture->mTexOptionsDirty) + { + texture->mTexOptionsDirty = false; + setTextureAddressMode(texture->mAddressMode); + setTextureFilteringOption(texture->mFilterOption); + } + } return true; } @@ -206,8 +223,13 @@ bool LLTexUnit::bind(LLCubeMap* cubeMap) gGL.flush(); - // Disabled caching of binding state. - if (cubeMap != NULL) + if (cubeMap == NULL) + { + llwarns << "NULL LLTexUnit::bind cubemap" << llendl; + return false; + } + + if (mCurrTexture != cubeMap->mImages[0]->getTexName()) { if (gGLManager.mHasCubeMap && LLCubeMap::sUseCubeMaps) { @@ -215,18 +237,27 @@ bool LLTexUnit::bind(LLCubeMap* cubeMap) enable(LLTexUnit::TT_CUBE_MAP); mCurrTexture = cubeMap->mImages[0]->getTexName(); glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, mCurrTexture); + mHasMipMaps = cubeMap->mImages[0]->mHasMipMaps; cubeMap->mImages[0]->updateBindStats(); - cubeMap->mImages[0]->setMipFilterNearest (FALSE, FALSE); + if (cubeMap->mImages[0]->mTexOptionsDirty) + { + cubeMap->mImages[0]->mTexOptionsDirty = false; + setTextureAddressMode(cubeMap->mImages[0]->mAddressMode); + setTextureFilteringOption(cubeMap->mImages[0]->mFilterOption); + } return true; } else { - llwarns << "Using cube map without extension!" << llendl + llwarns << "Using cube map without extension!" << llendl; + return false; } } - return false; + return true; } +// LLRenderTarget is unavailible on the mapserver since it uses FBOs. +#if !LL_MESA_HEADLESS bool LLTexUnit::bind(LLRenderTarget* renderTarget, bool bindDepth) { if (mIndex < 0) return false; @@ -244,23 +275,26 @@ bool LLTexUnit::bind(LLRenderTarget* renderTarget, bool bindDepth) return true; } +#endif // LL_MESA_HEADLESS -bool LLTexUnit::bindManual(eTextureType type, U32 texture) +bool LLTexUnit::bindManual(eTextureType type, U32 texture, bool hasMips) { - if (mIndex < 0) return false; + if (mIndex < 0 || mCurrTexture == texture) return false; - // Disabled caching of binding state. gGL.flush(); activate(); enable(type); mCurrTexture = texture; glBindTexture(sGLTextureType[type], texture); + mHasMipMaps = hasMips; return true; } void LLTexUnit::unbind(eTextureType type) { + stop_glerror(); + if (mIndex < 0) return; // Disabled caching of binding state. @@ -276,17 +310,57 @@ void LLTexUnit::unbind(eTextureType type) void LLTexUnit::setTextureAddressMode(eTextureAddressMode mode) { - if (mIndex < 0) return; + if (mIndex < 0 || mCurrTexture == 0) return; - if (true) + activate(); + + glTexParameteri (sGLTextureType[mCurrTexType], GL_TEXTURE_WRAP_S, sGLAddressMode[mode]); + glTexParameteri (sGLTextureType[mCurrTexType], GL_TEXTURE_WRAP_T, sGLAddressMode[mode]); + if (mCurrTexType == TT_CUBE_MAP) { - activate(); + glTexParameteri (GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_WRAP_R, sGLAddressMode[mode]); + } +} + +void LLTexUnit::setTextureFilteringOption(LLTexUnit::eTextureFilterOptions option) +{ + if (mIndex < 0 || mCurrTexture == 0) return; - glTexParameteri (sGLTextureType[mCurrTexType], GL_TEXTURE_WRAP_S, sGLAddressMode[mode]); - glTexParameteri (sGLTextureType[mCurrTexType], GL_TEXTURE_WRAP_T, sGLAddressMode[mode]); - if (mCurrTexType == TT_CUBE_MAP) + if (option == TFO_POINT) + { + glTexParameteri(sGLTextureType[mCurrTexType], GL_TEXTURE_MAG_FILTER, GL_NEAREST); + } + else + { + glTexParameteri(sGLTextureType[mCurrTexType], GL_TEXTURE_MAG_FILTER, GL_LINEAR); + } + + if (option >= TFO_TRILINEAR && mHasMipMaps) + { + glTexParameteri(sGLTextureType[mCurrTexType], GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); + } + else if (option >= TFO_BILINEAR) + { + glTexParameteri(sGLTextureType[mCurrTexType], GL_TEXTURE_MIN_FILTER, GL_LINEAR); + } + else + { + glTexParameteri(sGLTextureType[mCurrTexType], GL_TEXTURE_MIN_FILTER, GL_NEAREST); + } + + if (gGLManager.mHasAnisotropic) + { + if (LLImageGL::sGlobalUseAnisotropic && option == TFO_ANISOTROPIC) { - glTexParameteri (GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_WRAP_R, sGLAddressMode[mode]); + if (gGL.mMaxAnisotropy < 1.f) + { + glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &gGL.mMaxAnisotropy); + } + glTexParameterf(sGLTextureType[mCurrTexType], GL_TEXTURE_MAX_ANISOTROPY_EXT, gGL.mMaxAnisotropy); + } + else + { + glTexParameterf(sGLTextureType[mCurrTexType], GL_TEXTURE_MAX_ANISOTROPY_EXT, 1.f); } } } @@ -589,12 +663,13 @@ void LLTexUnit::debugTextureUnit(void) LLRender::LLRender() -: mDirty(false), mCount(0), mMode(LLRender::TRIANGLES) +: mDirty(false), mCount(0), mMode(LLRender::TRIANGLES), + mMaxAnisotropy(0.f) { mBuffer = new LLVertexBuffer(immediate_mask, 0); mBuffer->allocateBuffer(4096, 0, TRUE); mBuffer->getVertexStrider(mVerticesp); - mBuffer->getTexCoordStrider(mTexcoordsp); + mBuffer->getTexCoord0Strider(mTexcoordsp); mBuffer->getColorStrider(mColorsp); mTexUnits.reserve(LL_NUM_TEXTURE_LAYERS); @@ -687,7 +762,10 @@ void LLRender::setColorMask(bool writeColorR, bool writeColorG, bool writeColorB mCurrColorMask[2] = writeColorB; mCurrColorMask[3] = writeAlpha; - glColorMask(writeColorR, writeColorG, writeColorB, writeAlpha); + glColorMask(writeColorR ? GL_TRUE : GL_FALSE, + writeColorG ? GL_TRUE : GL_FALSE, + writeColorB ? GL_TRUE : GL_FALSE, + writeAlpha ? GL_TRUE : GL_FALSE); } void LLRender::setSceneBlendType(eBlendType type) @@ -767,6 +845,14 @@ bool LLRender::verifyTexUnitActive(U32 unitToVerify) } } +void LLRender::clearErrors() +{ + while (glGetError()) + { + //loop until no more error flags left + } +} + void LLRender::begin(const GLuint& mode) { if (mode != mMode) @@ -852,13 +938,14 @@ void LLRender::flush() mBuffer->setBuffer(immediate_mask); mBuffer->drawArrays(mMode, 0, mCount); - + mVerticesp[0] = mVerticesp[mCount]; mTexcoordsp[0] = mTexcoordsp[mCount]; mColorsp[0] = mColorsp[mCount]; mCount = 0; } } + void LLRender::vertex3f(const GLfloat& x, const GLfloat& y, const GLfloat& z) { //the range of mVerticesp, mColorsp and mTexcoordsp is [0, 4095] diff --git a/linden/indra/llrender/llrender.h b/linden/indra/llrender/llrender.h index e949190..437c715 100644 --- a/linden/indra/llrender/llrender.h +++ b/linden/indra/llrender/llrender.h @@ -22,7 +22,8 @@ * 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 + * 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, @@ -70,6 +71,14 @@ public: TAM_CLAMP // No texture type is currently enabled } eTextureAddressMode; + typedef enum + { // Note: If mipmapping or anisotropic are not enabled or supported it should fall back gracefully + TFO_POINT = 0, // Equal to: min=point, mag=point, mip=none. + TFO_BILINEAR, // Equal to: min=linear, mag=linear, mip=point. + TFO_TRILINEAR, // Equal to: min=linear, mag=linear, mip=linear. + TFO_ANISOTROPIC // Equal to: min=anisotropic, max=anisotropic, mip=linear. + } eTextureFilterOptions; + typedef enum { TB_REPLACE = 0, @@ -130,30 +139,43 @@ public: // Sets this tex unit to be the currently active one void activate(void); - // Enables this texture unit for the given texture type (automatically disables any previously enabled texture type) + // Enables this texture unit for the given texture type + // (automatically disables any previously enabled texture type) void enable(eTextureType type); + // Disables the current texture unit void disable(void); // Binds the LLImageGL to this texture unit // (automatically enables the unit for the LLImageGL's texture type) - bool bind(const LLImageGL* texture, bool forceBind = false); + bool bind(LLImageGL* texture, bool forceBind = false); // Binds a cubemap to this texture unit // (automatically enables the texture unit for cubemaps) bool bind(LLCubeMap* cubeMap); - // Binds a render target to this texture unit (automatically enables the texture unit for the RT's texture type) + // Binds a render target to this texture unit + // (automatically enables the texture unit for the RT's texture type) bool bind(LLRenderTarget * renderTarget, bool bindDepth = false); - // Manually binds a texture to the texture unit (automatically enables the tex unit for the given texture type) - bool bindManual(eTextureType type, U32 texture); + // Manually binds a texture to the texture unit + // (automatically enables the tex unit for the given texture type) + bool bindManual(eTextureType type, U32 texture, bool hasMips = false); - // Unbinds the currently bound texture of the given type (only if there's a texture of the given type currently bound) + // Unbinds the currently bound texture of the given type + // (only if there's a texture of the given type currently bound) void unbind(eTextureType type); + // Sets the addressing mode used to sample the texture + // Warning: this stays set for the bound texture forever, + // make sure you want to permanently change the address mode for the bound texture. void setTextureAddressMode(eTextureAddressMode mode); + // Sets the filtering options used to sample the texture + // Warning: this stays set for the bound texture forever, + // make sure you want to permanently change the filtering for the bound texture. + void setTextureFilteringOption(LLTexUnit::eTextureFilterOptions option); + void setTextureBlendType(eTextureBlendType type); inline void setTextureColorBlend(eTextureBlendOp op, eTextureBlendSrc src1, eTextureBlendSrc src2 = TBS_PREV_COLOR) @@ -165,6 +187,12 @@ public: static U32 getInternalType(eTextureType type); + U32 getCurrTexture(void) { return mCurrTexture; } + + eTextureType getCurrType(void) { return mCurrTexType; } + + void setHasMipMaps(bool hasMips) { mHasMipMaps = hasMips; } + protected: S32 mIndex; U32 mCurrTexture; @@ -178,6 +206,7 @@ protected: eTextureBlendSrc mCurrAlphaSrc2; S32 mCurrColorScale; S32 mCurrAlphaScale; + bool mHasMipMaps; void debugTextureUnit(void); void setColorScale(S32 scale); @@ -291,6 +320,8 @@ public: void debugTexUnits(void); + void clearErrors(); + struct Vertex { GLfloat v[3]; @@ -315,6 +346,8 @@ private: LLStrider mColorsp; std::vector mTexUnits; LLTexUnit* mDummyTexUnit; + + F32 mMaxAnisotropy; }; extern F64 gGLModelView[16]; diff --git a/linden/indra/llrender/llrendersphere.cpp b/linden/indra/llrender/llrendersphere.cpp index 6aaa03e..e22b753 100644 --- a/linden/indra/llrender/llrendersphere.cpp +++ b/linden/indra/llrender/llrendersphere.cpp @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llrender/llrendersphere.h b/linden/indra/llrender/llrendersphere.h index d48b917..617ee3e 100644 --- a/linden/indra/llrender/llrendersphere.h +++ b/linden/indra/llrender/llrendersphere.h @@ -2,16 +2,27 @@ * @file llrendersphere.h * @brief interface for the LLRenderSphere class. * - * $LicenseInfo:firstyear=2001&license=internal$ + * $LicenseInfo:firstyear=2001&license=viewergpl$ * * Copyright (c) 2001-2009, 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. + * 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, diff --git a/linden/indra/llrender/llrendertarget.cpp b/linden/indra/llrender/llrendertarget.cpp index 392ec24..b7f3177 100644 --- a/linden/indra/llrender/llrendertarget.cpp +++ b/linden/indra/llrender/llrendertarget.cpp @@ -17,7 +17,8 @@ * 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 + * 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, @@ -36,6 +37,24 @@ #include "llgl.h" +void check_framebuffer_status() +{ + if (gDebugGL) + { + GLenum status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT); + switch (status) + { + case GL_FRAMEBUFFER_COMPLETE_EXT: + break; + case GL_FRAMEBUFFER_UNSUPPORTED_EXT: + llerrs << "WTF?" << llendl; + break; + default: + llerrs << "WTF?" << llendl; + } + } +} + BOOL LLRenderTarget::sUseFBO = FALSE; LLRenderTarget::LLRenderTarget() : @@ -47,7 +66,9 @@ LLRenderTarget::LLRenderTarget() : mStencil(0), mUseDepth(FALSE), mRenderDepth(FALSE), - mUsage(LLTexUnit::TT_TEXTURE) + mUsage(LLTexUnit::TT_TEXTURE), + mSamples(0), + mSampleBuffer(NULL) { } @@ -56,40 +77,26 @@ LLRenderTarget::~LLRenderTarget() release(); } -void LLRenderTarget::allocate(U32 resx, U32 resy, U32 color_fmt, BOOL depth, LLTexUnit::eTextureType usage, BOOL use_fbo) + +void LLRenderTarget::setSampleBuffer(LLMultisampleBuffer* buffer) +{ + mSampleBuffer = buffer; +} + +void LLRenderTarget::allocate(U32 resx, U32 resy, U32 color_fmt, BOOL depth, BOOL stencil, LLTexUnit::eTextureType usage, BOOL use_fbo) { stop_glerror(); mResX = resx; mResY = resy; + mStencil = stencil; mUsage = usage; mUseDepth = depth; - release(); - - glGenTextures(1, (GLuint *) &mTex); - gGL.getTexUnit(0)->bindManual(mUsage, mTex); - glTexImage2D(LLTexUnit::getInternalType(mUsage), 0, color_fmt, mResX, mResY, 0, color_fmt, GL_UNSIGNED_BYTE, NULL); - - glTexParameteri(LLTexUnit::getInternalType(mUsage), GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameteri(LLTexUnit::getInternalType(mUsage), GL_TEXTURE_MIN_FILTER, GL_LINEAR); - - if (mUsage != LLTexUnit::TT_RECT_TEXTURE) - { - glTexParameteri(LLTexUnit::getInternalType(mUsage), GL_TEXTURE_WRAP_S, GL_MIRRORED_REPEAT); - glTexParameteri(LLTexUnit::getInternalType(mUsage), GL_TEXTURE_WRAP_T, GL_MIRRORED_REPEAT); - } - else - { - // ATI doesn't support mirrored repeat for rectangular textures. - glTexParameteri(LLTexUnit::getInternalType(mUsage), GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameteri(LLTexUnit::getInternalType(mUsage), GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - } - stop_glerror(); + release(); if ((sUseFBO || use_fbo) && gGLManager.mHasFramebufferObject) { - if (depth) { stop_glerror(); @@ -99,37 +106,141 @@ void LLRenderTarget::allocate(U32 resx, U32 resy, U32 color_fmt, BOOL depth, LLT glGenFramebuffersEXT(1, (GLuint *) &mFBO); + if (mDepth) + { + glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, mFBO); + if (mStencil) + { + glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, mDepth); + stop_glerror(); + glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_STENCIL_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, mDepth); + stop_glerror(); + } + else + { + glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, LLTexUnit::getInternalType(mUsage), mDepth, 0); + stop_glerror(); + } + glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); + } + stop_glerror(); + } - glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, mFBO); + addColorAttachment(color_fmt); +} - stop_glerror(); +void LLRenderTarget::addColorAttachment(U32 color_fmt) +{ + if (color_fmt == 0) + { + return; + } - if (mDepth) - { - glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, LLTexUnit::getInternalType(mUsage), mDepth, 0); - stop_glerror(); - glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_STENCIL_ATTACHMENT_EXT, LLTexUnit::getInternalType(mUsage), mDepth, 0); - stop_glerror(); - } + U32 offset = mTex.size(); + if (offset >= 4 || + offset > 0 && (mFBO == 0 || !gGLManager.mHasDrawBuffers)) + { + llerrs << "Too many color attachments!" << llendl; + } - glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, - LLTexUnit::getInternalType(mUsage), mTex, 0); - stop_glerror(); + U32 tex; + LLImageGL::generateTextures(1, &tex); + gGL.getTexUnit(0)->bindManual(mUsage, tex); + + stop_glerror(); + + LLImageGL::setManualImage(LLTexUnit::getInternalType(mUsage), 0, color_fmt, mResX, mResY, GL_RGBA, GL_UNSIGNED_BYTE, NULL); + stop_glerror(); + + if (offset == 0) + { + gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR); + } + else + { //don't filter data attachments + gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_POINT); + } + if (mUsage != LLTexUnit::TT_RECT_TEXTURE) + { + gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_MIRROR); + } + else + { + // ATI doesn't support mirrored repeat for rectangular textures. + gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_CLAMP); + } + if (mFBO) + { + glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, mFBO); + glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT+offset, + LLTexUnit::getInternalType(mUsage), tex, 0); + stop_glerror(); + + check_framebuffer_status(); + glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); - stop_glerror(); } + + mTex.push_back(tex); + } void LLRenderTarget::allocateDepth() { - glGenTextures(1, (GLuint *) &mDepth); - gGL.getTexUnit(0)->bindManual(mUsage, mDepth); - U32 internal_type = LLTexUnit::getInternalType(mUsage); - glTexParameteri(internal_type, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameteri(internal_type, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexImage2D(internal_type, 0, GL_DEPTH24_STENCIL8_EXT, mResX, mResY, 0, GL_DEPTH_STENCIL_EXT, GL_UNSIGNED_INT_24_8_EXT, NULL); + if (mStencil) + { + //use render buffers where stencil buffers are in play + glGenRenderbuffersEXT(1, (GLuint *) &mDepth); + glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, mDepth); + glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH24_STENCIL8_EXT, mResX, mResY); + glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, 0); + } + else + { + LLImageGL::generateTextures(1, &mDepth); + gGL.getTexUnit(0)->bindManual(mUsage, mDepth); + U32 internal_type = LLTexUnit::getInternalType(mUsage); + gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_POINT); + LLImageGL::setManualImage(internal_type, 0, GL_DEPTH24_STENCIL8_EXT, mResX, mResY, GL_DEPTH_STENCIL_EXT, GL_UNSIGNED_INT_24_8_EXT, NULL); + } +} + +void LLRenderTarget::shareDepthBuffer(LLRenderTarget& target) +{ + if (!mFBO || !target.mFBO) + { + llerrs << "Cannot share depth buffer between non FBO render targets." << llendl; + } + + if (mDepth) + { + stop_glerror(); + glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, target.mFBO); + stop_glerror(); + + if (mStencil) + { + glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, mDepth); + stop_glerror(); + glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_STENCIL_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, mDepth); + stop_glerror(); + } + else + { + glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, LLTexUnit::getInternalType(mUsage), mDepth, 0); + stop_glerror(); + if (mStencil) + { + glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_STENCIL_ATTACHMENT_EXT, LLTexUnit::getInternalType(mUsage), mDepth, 0); + stop_glerror(); + } + } + glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); + + target.mUseDepth = TRUE; + } } void LLRenderTarget::release() @@ -140,24 +251,63 @@ void LLRenderTarget::release() mFBO = 0; } - if (mTex) + if (mTex.size() > 0) { - glDeleteTextures(1, (GLuint *) &mTex); - mTex = 0; + LLImageGL::deleteTextures(mTex.size(), &mTex[0]); + mTex.clear(); } if (mDepth) { - glDeleteTextures(1, (GLuint *) &mDepth); + if (mStencil) + { + glDeleteRenderbuffersEXT(1, (GLuint*) &mDepth); + stop_glerror(); + } + else + { + LLImageGL::deleteTextures(1, &mDepth); + stop_glerror(); + } mDepth = 0; } + + mSampleBuffer = NULL; } void LLRenderTarget::bindTarget() { if (mFBO) { - glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, mFBO); + stop_glerror(); + if (mSampleBuffer) + { + mSampleBuffer->bindTarget(this); + stop_glerror(); + } + else + { + glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, mFBO); + stop_glerror(); + if (gGLManager.mHasDrawBuffers) + { //setup multiple render targets + GLenum drawbuffers[] = {GL_COLOR_ATTACHMENT0_EXT, + GL_COLOR_ATTACHMENT1_EXT, + GL_COLOR_ATTACHMENT2_EXT, + GL_COLOR_ATTACHMENT3_EXT}; + glDrawBuffersARB(mTex.size(), drawbuffers); + } + + if (mTex.empty()) + { //no color buffer to draw to + glDrawBuffer(GL_NONE); + glReadBuffer(GL_NONE); + } + + check_framebuffer_status(); + + stop_glerror(); + } } glViewport(0, 0, mResX, mResY); @@ -172,7 +322,7 @@ void LLRenderTarget::unbindTarget() } } -void LLRenderTarget::clear() +void LLRenderTarget::clear(U32 mask_in) { U32 mask = GL_COLOR_BUFFER_BIT; if (mUseDepth) @@ -181,15 +331,36 @@ void LLRenderTarget::clear() } if (mFBO) { - glClear(mask); + check_framebuffer_status(); + stop_glerror(); + glClear(mask & mask_in); + stop_glerror(); } else { LLGLEnable scissor(GL_SCISSOR_TEST); glScissor(0, 0, mResX, mResY); stop_glerror(); - glClear(mask); + glClear(mask & mask_in); + } +} + +U32 LLRenderTarget::getTexture(U32 attachment) const +{ + if (attachment > mTex.size()-1) + { + llerrs << "Invalid attachment index." << llendl; + } + return mTex[attachment]; +} + +void LLRenderTarget::bindTexture(U32 index, S32 channel) +{ + if (index > mTex.size()-1) + { + llerrs << "Invalid attachment index." << llendl; } + gGL.getTexUnit(channel)->bindManual(mUsage, mTex[index]); } void LLRenderTarget::flush(BOOL fetch_depth) @@ -210,16 +381,87 @@ void LLRenderTarget::flush(BOOL fetch_depth) gGL.getTexUnit(0)->bind(this, true); glCopyTexImage2D(LLTexUnit::getInternalType(mUsage), 0, GL_DEPTH24_STENCIL8_EXT, 0, 0, mResX, mResY, 0); } + + gGL.getTexUnit(0)->disable(); + } + else + { +#if !LL_DARWIN + + glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); + + if (mSampleBuffer) + { + LLGLEnable multisample(GL_MULTISAMPLE_ARB); + stop_glerror(); + glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, mFBO); + stop_glerror(); + check_framebuffer_status(); + glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, mSampleBuffer->mFBO); + check_framebuffer_status(); + + stop_glerror(); + glBlitFramebufferEXT(0, 0, mResX, mResY, 0, 0, mResX, mResY, GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT, GL_NEAREST); + stop_glerror(); + + if (mTex.size() > 1) + { + for (U32 i = 1; i < mTex.size(); ++i) + { + glFramebufferTexture2DEXT(GL_DRAW_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, + LLTexUnit::getInternalType(mUsage), mTex[i], 0); + stop_glerror(); + glFramebufferRenderbufferEXT(GL_READ_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_RENDERBUFFER_EXT, mSampleBuffer->mTex[i]); + stop_glerror(); + glBlitFramebufferEXT(0, 0, mResX, mResY, 0, 0, mResX, mResY, GL_COLOR_BUFFER_BIT, GL_NEAREST); + stop_glerror(); + } + + for (U32 i = 0; i < mTex.size(); ++i) + { + glFramebufferTexture2DEXT(GL_DRAW_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT+i, + LLTexUnit::getInternalType(mUsage), mTex[i], 0); + stop_glerror(); + glFramebufferRenderbufferEXT(GL_READ_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT+i, GL_RENDERBUFFER_EXT, mSampleBuffer->mTex[i]); + stop_glerror(); + } + } + } +#endif + + glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); + glFlush(); + } +} + +void LLRenderTarget::copyContents(LLRenderTarget& source, S32 srcX0, S32 srcY0, S32 srcX1, S32 srcY1, + S32 dstX0, S32 dstY0, S32 dstX1, S32 dstY1, U32 mask, U32 filter) +{ +#if !LL_DARWIN + if (!source.mFBO || !mFBO) + { + llerrs << "Cannot copy framebuffer contents for non FBO render targets." << llendl; + } + + if (mSampleBuffer) + { + mSampleBuffer->copyContents(source, srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter); } else { + glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, source.mFBO); + glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, mFBO); + + glBlitFramebufferEXT(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter); + glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); } +#endif } BOOL LLRenderTarget::isComplete() const { - return (mTex || mDepth) ? TRUE : FALSE; + return (!mTex.empty() || mDepth) ? TRUE : FALSE; } void LLRenderTarget::getViewport(S32* viewport) @@ -230,3 +472,191 @@ void LLRenderTarget::getViewport(S32* viewport) viewport[3] = mResY; } +//================================================== +// LLMultisampleBuffer implementation +//================================================== +LLMultisampleBuffer::LLMultisampleBuffer() +{ + +} + +LLMultisampleBuffer::~LLMultisampleBuffer() +{ + releaseSampleBuffer(); +} + +void LLMultisampleBuffer::releaseSampleBuffer() +{ + if (mFBO) + { + glDeleteFramebuffersEXT(1, (GLuint *) &mFBO); + mFBO = 0; + } + + if (mTex.size() > 0) + { + glDeleteRenderbuffersEXT(mTex.size(), (GLuint *) &mTex[0]); + mTex.clear(); + } + + if (mDepth) + { + glDeleteRenderbuffersEXT(1, (GLuint *) &mDepth); + mDepth = 0; + } +} + +void LLMultisampleBuffer::bindTarget() +{ + bindTarget(this); +} + +void LLMultisampleBuffer::bindTarget(LLRenderTarget* ref) +{ + if (!ref) + { + ref = this; + } + + glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, mFBO); + if (gGLManager.mHasDrawBuffers) + { //setup multiple render targets + GLenum drawbuffers[] = {GL_COLOR_ATTACHMENT0_EXT, + GL_COLOR_ATTACHMENT1_EXT, + GL_COLOR_ATTACHMENT2_EXT, + GL_COLOR_ATTACHMENT3_EXT}; + glDrawBuffersARB(ref->mTex.size(), drawbuffers); + } + + check_framebuffer_status(); + + glViewport(0, 0, mResX, mResY); + +} + +void LLMultisampleBuffer::allocate(U32 resx, U32 resy, U32 color_fmt, BOOL depth, BOOL stencil, LLTexUnit::eTextureType usage, BOOL use_fbo ) +{ + allocate(resx,resy,color_fmt,depth,stencil,usage,use_fbo,2); +} + +void LLMultisampleBuffer::allocate(U32 resx, U32 resy, U32 color_fmt, BOOL depth, BOOL stencil, LLTexUnit::eTextureType usage, BOOL use_fbo, U32 samples ) +{ + stop_glerror(); + mResX = resx; + mResY = resy; + + mUsage = usage; + mUseDepth = depth; + mStencil = stencil; + + releaseSampleBuffer(); + + if (!gGLManager.mHasFramebufferMultisample) + { + llerrs << "Attempting to allocate unsupported render target type!" << llendl; + } + + mSamples = samples; + + if (mSamples <= 1) + { + llerrs << "Cannot create a multisample buffer with less than 2 samples." << llendl; + } + + stop_glerror(); + + if ((sUseFBO || use_fbo) && gGLManager.mHasFramebufferObject) + { + + if (depth) + { + stop_glerror(); + allocateDepth(); + stop_glerror(); + } + + glGenFramebuffersEXT(1, (GLuint *) &mFBO); + + glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, mFBO); + + if (mDepth) + { + glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, mDepth); + if (mStencil) + { + glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_STENCIL_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, mDepth); + } + glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); + } + + stop_glerror(); + + glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); + stop_glerror(); + } + + addColorAttachment(color_fmt); +} + +void LLMultisampleBuffer::addColorAttachment(U32 color_fmt) +{ +#if !LL_DARWIN + if (color_fmt == 0) + { + return; + } + + U32 offset = mTex.size(); + if (offset >= 4 || + offset > 0 && (mFBO == 0 || !gGLManager.mHasDrawBuffers)) + { + llerrs << "Too many color attachments!" << llendl; + } + + U32 tex; + glGenRenderbuffersEXT(1, &tex); + + glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, tex); + glRenderbufferStorageMultisampleEXT(GL_RENDERBUFFER_EXT, mSamples, color_fmt, mResX, mResY); + stop_glerror(); + + if (mFBO) + { + glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, mFBO); + glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT+offset, GL_RENDERBUFFER_EXT, tex); + stop_glerror(); + GLenum status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT); + switch (status) + { + case GL_FRAMEBUFFER_COMPLETE_EXT: + break; + case GL_FRAMEBUFFER_UNSUPPORTED_EXT: + llerrs << "WTF?" << llendl; + break; + default: + llerrs << "WTF?" << llendl; + } + + glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); + } + + mTex.push_back(tex); +#endif +} + +void LLMultisampleBuffer::allocateDepth() +{ +#if !LL_DARWIN + glGenRenderbuffersEXT(1, (GLuint* ) &mDepth); + glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, mDepth); + if (mStencil) + { + glRenderbufferStorageMultisampleEXT(GL_RENDERBUFFER_EXT, mSamples, GL_DEPTH24_STENCIL8_EXT, mResX, mResY); + } + else + { + glRenderbufferStorageMultisampleEXT(GL_RENDERBUFFER_EXT, mSamples, GL_DEPTH_COMPONENT16_ARB, mResX, mResY); + } +#endif +} + diff --git a/linden/indra/llrender/llrendertarget.h b/linden/indra/llrender/llrendertarget.h index 38a41cb..d5d809b 100644 --- a/linden/indra/llrender/llrendertarget.h +++ b/linden/indra/llrender/llrendertarget.h @@ -17,7 +17,8 @@ * 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 + * 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, @@ -32,6 +33,9 @@ #ifndef LL_LLRENDERTARGET_H #define LL_LLRENDERTARGET_H +// LLRenderTarget is unavailible on the mapserver since it uses FBOs. +#if !LL_MESA_HEADLESS + #include "llgl.h" #include "llrender.h" @@ -59,6 +63,7 @@ */ +class LLMultisampleBuffer; class LLRenderTarget { @@ -67,15 +72,25 @@ public: static BOOL sUseFBO; LLRenderTarget(); - ~LLRenderTarget(); + virtual ~LLRenderTarget(); //allocate resources for rendering //must be called before use //multiple calls will release previously allocated resources - void allocate(U32 resx, U32 resy, U32 color_fmt, BOOL depth, LLTexUnit::eTextureType usage = LLTexUnit::TT_TEXTURE, BOOL use_fbo = FALSE); + void allocate(U32 resx, U32 resy, U32 color_fmt, BOOL depth, BOOL stencil, LLTexUnit::eTextureType usage = LLTexUnit::TT_TEXTURE, BOOL use_fbo = FALSE); + + //provide this render target with a multisample resource. + void setSampleBuffer(LLMultisampleBuffer* buffer); + + //add color buffer attachment + //limit of 4 color attachments per render target + virtual void addColorAttachment(U32 color_fmt); //allocate a depth texture - void allocateDepth(); + virtual void allocateDepth(); + + //share depth buffer with provided render target + virtual void shareDepthBuffer(LLRenderTarget& target); //free any allocated resources //safe to call redundantly @@ -83,14 +98,14 @@ public: //bind target for rendering //applies appropriate viewport - void bindTarget(); + virtual void bindTarget(); //unbind target for rendering static void unbindTarget(); //clear render targer, clears depth buffer if present, //uses scissor rect if in copy-to-texture mode - void clear(); + void clear(U32 mask = 0xFFFFFFFF); //get applied viewport void getViewport(S32* viewport); @@ -103,10 +118,12 @@ public: LLTexUnit::eTextureType getUsage(void) const { return mUsage; } - U32 getTexture(void) const { return mTex; } + U32 getTexture(U32 attachment = 0) const; U32 getDepth(void) const { return mDepth; } + void bindTexture(U32 index, S32 channel); + //flush rendering operations //must be called when rendering is complete //should be used 1:1 with bindTarget @@ -115,23 +132,47 @@ public: // the current depth texture. A depth texture will be allocated if needed. void flush(BOOL fetch_depth = FALSE); + void copyContents(LLRenderTarget& source, S32 srcX0, S32 srcY0, S32 srcX1, S32 srcY1, + S32 dstX0, S32 dstY0, S32 dstX1, S32 dstY1, U32 mask, U32 filter); + //Returns TRUE if target is ready to be rendered into. //That is, if the target has been allocated with at least //one renderable attachment (i.e. color buffer, depth buffer). BOOL isComplete() const; -private: +protected: + friend class LLMultisampleBuffer; U32 mResX; U32 mResY; - U32 mTex; + std::vector mTex; U32 mFBO; U32 mDepth; - U32 mStencil; + BOOL mStencil; BOOL mUseDepth; BOOL mRenderDepth; LLTexUnit::eTextureType mUsage; + U32 mSamples; + LLMultisampleBuffer* mSampleBuffer; }; +class LLMultisampleBuffer : public LLRenderTarget +{ +public: + LLMultisampleBuffer(); + virtual ~LLMultisampleBuffer(); + + void releaseSampleBuffer(); + + virtual void bindTarget(); + void bindTarget(LLRenderTarget* ref); + virtual void allocate(U32 resx, U32 resy, U32 color_fmt, BOOL depth, BOOL stencil, LLTexUnit::eTextureType usage, BOOL use_fbo); + void allocate(U32 resx, U32 resy, U32 color_fmt, BOOL depth, BOOL stencil, LLTexUnit::eTextureType usage, BOOL use_fbo, U32 samples); + virtual void addColorAttachment(U32 color_fmt); + virtual void allocateDepth(); +}; + +#endif //!LL_MESA_HEADLESS + #endif diff --git a/linden/indra/llrender/llshadermgr.cpp b/linden/indra/llrender/llshadermgr.cpp index 3046d19..1286e91 100644 --- a/linden/indra/llrender/llshadermgr.cpp +++ b/linden/indra/llrender/llshadermgr.cpp @@ -17,7 +17,8 @@ * 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 + * 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, @@ -363,7 +364,7 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade //copy file into memory - while(fgets((char *)buff, 1024, file) != NULL && count < (sizeof(buff)/sizeof(buff[0]))) + while( fgets((char *)buff, 1024, file) != NULL && count < LL_ARRAY_SIZE(buff) ) { text[count++] = (GLcharARB *)strdup((char *)buff); } diff --git a/linden/indra/llrender/llshadermgr.h b/linden/indra/llrender/llshadermgr.h index 1f78e30..2488c7a 100644 --- a/linden/indra/llrender/llshadermgr.h +++ b/linden/indra/llrender/llshadermgr.h @@ -17,7 +17,8 @@ * 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 + * 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, diff --git a/linden/indra/llrender/llvertexbuffer.cpp b/linden/indra/llrender/llvertexbuffer.cpp index cb7f352..461edbe 100644 --- a/linden/indra/llrender/llvertexbuffer.cpp +++ b/linden/indra/llrender/llvertexbuffer.cpp @@ -17,7 +17,8 @@ * 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 + * 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, @@ -68,8 +69,10 @@ S32 LLVertexBuffer::sTypeOffsets[LLVertexBuffer::TYPE_MAX] = { sizeof(LLVector3), // TYPE_VERTEX, sizeof(LLVector3), // TYPE_NORMAL, - sizeof(LLVector2), // TYPE_TEXCOORD, + sizeof(LLVector2), // TYPE_TEXCOORD0, + sizeof(LLVector2), // TYPE_TEXCOORD1, sizeof(LLVector2), // TYPE_TEXCOORD2, + sizeof(LLVector2), // TYPE_TEXCOORD3, sizeof(LLColor4U), // TYPE_COLOR, sizeof(LLVector3), // TYPE_BINORMAL, sizeof(F32), // TYPE_WEIGHT, @@ -102,8 +105,8 @@ void LLVertexBuffer::setupClientArrays(U32 data_mask) { MAP_VERTEX, MAP_NORMAL, - MAP_TEXCOORD, - MAP_COLOR + MAP_TEXCOORD0, + MAP_COLOR, }; GLenum array[] = @@ -111,7 +114,7 @@ void LLVertexBuffer::setupClientArrays(U32 data_mask) GL_VERTEX_ARRAY, GL_NORMAL_ARRAY, GL_TEXTURE_COORD_ARRAY, - GL_COLOR_ARRAY + GL_COLOR_ARRAY, }; for (U32 i = 0; i < 4; ++i) @@ -122,7 +125,7 @@ void LLVertexBuffer::setupClientArrays(U32 data_mask) { //needs to be disabled glDisableClientState(array[i]); } - else + else if (gDebugGL) { //needs to be enabled, make sure it was (DEBUG TEMPORARY) if (i > 0 && !glIsEnabled(array[i])) { @@ -136,29 +139,55 @@ void LLVertexBuffer::setupClientArrays(U32 data_mask) { //needs to be enabled glEnableClientState(array[i]); } - else if (glIsEnabled(array[i])) + else if (gDebugGL && glIsEnabled(array[i])) { //needs to be disabled, make sure it was (DEBUG TEMPORARY) llerrs << "Bad client state! " << array[i] << " enabled." << llendl; } } } - if (sLastMask & MAP_TEXCOORD2) + U32 map_tc[] = { - if (!(data_mask & MAP_TEXCOORD2)) + MAP_TEXCOORD1, + MAP_TEXCOORD2, + MAP_TEXCOORD3 + }; + + for (U32 i = 0; i < 3; i++) + { + if (sLastMask & map_tc[i]) { - glClientActiveTextureARB(GL_TEXTURE1_ARB); + if (!(data_mask & map_tc[i])) + { + glClientActiveTextureARB(GL_TEXTURE1_ARB+i); + glDisableClientState(GL_TEXTURE_COORD_ARRAY); + glClientActiveTextureARB(GL_TEXTURE0_ARB); + } + } + else if (data_mask & map_tc[i]) + { + glClientActiveTextureARB(GL_TEXTURE1_ARB+i); + glEnableClientState(GL_TEXTURE_COORD_ARRAY); + glClientActiveTextureARB(GL_TEXTURE0_ARB); + } + } + + if (sLastMask & MAP_BINORMAL) + { + if (!(data_mask & MAP_BINORMAL)) + { + glClientActiveTextureARB(GL_TEXTURE2_ARB); glDisableClientState(GL_TEXTURE_COORD_ARRAY); glClientActiveTextureARB(GL_TEXTURE0_ARB); } } - else if (data_mask & MAP_TEXCOORD2) + else if (data_mask & MAP_BINORMAL) { - glClientActiveTextureARB(GL_TEXTURE1_ARB); + glClientActiveTextureARB(GL_TEXTURE2_ARB); glEnableClientState(GL_TEXTURE_COORD_ARRAY); glClientActiveTextureARB(GL_TEXTURE0_ARB); } - + sLastMask = data_mask; } } @@ -193,6 +222,7 @@ void LLVertexBuffer::drawRange(U32 mode, U32 start, U32 end, U32 count, U32 indi return; } + stop_glerror(); glDrawRangeElements(sGLMode[mode], start, end, count, GL_UNSIGNED_SHORT, ((U16*) getIndicesPointer()) + indices_offset); stop_glerror(); @@ -222,13 +252,14 @@ void LLVertexBuffer::draw(U32 mode, U32 count, U32 indices_offset) const return; } + stop_glerror(); glDrawElements(sGLMode[mode], count, GL_UNSIGNED_SHORT, ((U16*) getIndicesPointer()) + indices_offset); + stop_glerror(); } void LLVertexBuffer::drawArrays(U32 mode, U32 first, U32 count) const { - if (first >= (U32) mRequestedNumVerts || first + count > (U32) mRequestedNumVerts) { @@ -246,6 +277,7 @@ void LLVertexBuffer::drawArrays(U32 mode, U32 first, U32 count) const return; } + stop_glerror(); glDrawArrays(sGLMode[mode], first, count); stop_glerror(); } @@ -766,11 +798,7 @@ U8* LLVertexBuffer::mapBuffer(S32 access) stop_glerror(); mMappedIndexData = (U8*) glMapBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB); stop_glerror(); - /*if (sMapped) - { - llerrs << "Mapped two VBOs at the same time!" << llendl; - } - sMapped = TRUE;*/ + if (!mMappedData) { //-------------------- @@ -895,14 +923,22 @@ bool LLVertexBuffer::getIndexStrider(LLStrider& strider, S32 index) { return VertexBufferStrider::get(*this, strider, index); } -bool LLVertexBuffer::getTexCoordStrider(LLStrider& strider, S32 index) +bool LLVertexBuffer::getTexCoord0Strider(LLStrider& strider, S32 index) +{ + return VertexBufferStrider::get(*this, strider, index); +} +bool LLVertexBuffer::getTexCoord1Strider(LLStrider& strider, S32 index) { - return VertexBufferStrider::get(*this, strider, index); + return VertexBufferStrider::get(*this, strider, index); } -bool LLVertexBuffer::getTexCoord2Strider(LLStrider& strider, S32 index) +/*bool LLVertexBuffer::getTexCoord2Strider(LLStrider& strider, S32 index) { return VertexBufferStrider::get(*this, strider, index); } +bool LLVertexBuffer::getTexCoord3Strider(LLStrider& strider, S32 index) +{ + return VertexBufferStrider::get(*this, strider, index); +}*/ bool LLVertexBuffer::getNormalStrider(LLStrider& strider, S32 index) { return VertexBufferStrider::get(*this, strider, index); @@ -1100,24 +1136,39 @@ void LLVertexBuffer::setupVertexBuffer(U32 data_mask) const { glNormalPointer(GL_FLOAT, stride, (void*)(base + mOffsets[TYPE_NORMAL])); } + if (data_mask & MAP_TEXCOORD3) + { + glClientActiveTextureARB(GL_TEXTURE3_ARB); + glTexCoordPointer(2,GL_FLOAT, stride, (void*)(base + mOffsets[TYPE_TEXCOORD3])); + glClientActiveTextureARB(GL_TEXTURE0_ARB); + } if (data_mask & MAP_TEXCOORD2) { - glClientActiveTextureARB(GL_TEXTURE1_ARB); + glClientActiveTextureARB(GL_TEXTURE2_ARB); glTexCoordPointer(2,GL_FLOAT, stride, (void*)(base + mOffsets[TYPE_TEXCOORD2])); glClientActiveTextureARB(GL_TEXTURE0_ARB); } - if (data_mask & MAP_TEXCOORD) + if (data_mask & MAP_TEXCOORD1) { - glTexCoordPointer(2,GL_FLOAT, stride, (void*)(base + mOffsets[TYPE_TEXCOORD])); + glClientActiveTextureARB(GL_TEXTURE1_ARB); + glTexCoordPointer(2,GL_FLOAT, stride, (void*)(base + mOffsets[TYPE_TEXCOORD1])); + glClientActiveTextureARB(GL_TEXTURE0_ARB); } - if (data_mask & MAP_COLOR) + if (data_mask & MAP_BINORMAL) { - glColorPointer(4, GL_UNSIGNED_BYTE, stride, (void*)(base + mOffsets[TYPE_COLOR])); + glClientActiveTextureARB(GL_TEXTURE2_ARB); + glTexCoordPointer(3,GL_FLOAT, stride, (void*)(base + mOffsets[TYPE_BINORMAL])); + glClientActiveTextureARB(GL_TEXTURE0_ARB); } - if (data_mask & MAP_BINORMAL) + if (data_mask & MAP_TEXCOORD0) { - glVertexAttribPointerARB(6, 3, GL_FLOAT, FALSE, stride, (void*)(base + mOffsets[TYPE_BINORMAL])); + glTexCoordPointer(2,GL_FLOAT, stride, (void*)(base + mOffsets[TYPE_TEXCOORD0])); } + if (data_mask & MAP_COLOR) + { + glColorPointer(4, GL_UNSIGNED_BYTE, stride, (void*)(base + mOffsets[TYPE_COLOR])); + } + if (data_mask & MAP_WEIGHT) { glVertexAttribPointerARB(1, 1, GL_FLOAT, FALSE, stride, (void*)(base + mOffsets[TYPE_WEIGHT])); diff --git a/linden/indra/llrender/llvertexbuffer.h b/linden/indra/llrender/llvertexbuffer.h index aa1aafc..aad948e 100644 --- a/linden/indra/llrender/llvertexbuffer.h +++ b/linden/indra/llrender/llvertexbuffer.h @@ -17,7 +17,8 @@ * 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 + * 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, @@ -99,8 +100,10 @@ public: enum { TYPE_VERTEX, TYPE_NORMAL, - TYPE_TEXCOORD, + TYPE_TEXCOORD0, + TYPE_TEXCOORD1, TYPE_TEXCOORD2, + TYPE_TEXCOORD3, TYPE_COLOR, // These use VertexAttribPointer and should possibly be made generic TYPE_BINORMAL, @@ -112,16 +115,15 @@ public: enum { MAP_VERTEX = (1<unmapBuffer(); bool getVertexStrider(LLStrider& strider, S32 index=0); bool getIndexStrider(LLStrider& strider, S32 index=0); - bool getTexCoordStrider(LLStrider& strider, S32 index=0); - bool getTexCoord2Strider(LLStrider& strider, S32 index=0); + bool getTexCoord0Strider(LLStrider& strider, S32 index=0); + bool getTexCoord1Strider(LLStrider& strider, S32 index=0); bool getNormalStrider(LLStrider& strider, S32 index=0); bool getBinormalStrider(LLStrider& strider, S32 index=0); bool getColorStrider(LLStrider& strider, S32 index=0); diff --git a/linden/indra/llui/CMakeLists.txt b/linden/indra/llui/CMakeLists.txt index 77efec5..32118e8 100644 --- a/linden/indra/llui/CMakeLists.txt +++ b/linden/indra/llui/CMakeLists.txt @@ -36,6 +36,7 @@ set(llui_SOURCE_FILES lleditmenuhandler.cpp llfloater.cpp llfocusmgr.cpp + llfunctorregistry.cpp lliconctrl.cpp llkeywords.cpp lllineeditor.cpp @@ -43,7 +44,9 @@ set(llui_SOURCE_FILES llmodaldialog.cpp llmultislider.cpp llmultisliderctrl.cpp + llnotifications.cpp llpanel.cpp + llprogressbar.cpp llradiogroup.cpp llresizebar.cpp llresizehandle.cpp @@ -61,10 +64,12 @@ set(llui_SOURCE_FILES lltabcontainervertical.cpp lltextbox.cpp lltexteditor.cpp + lltextparser.cpp llui.cpp lluictrl.cpp lluictrlfactory.cpp lluistring.cpp + lluitrans.cpp llundo.cpp llviewborder.cpp llview.cpp @@ -85,6 +90,7 @@ set(llui_HEADER_FILES lleditmenuhandler.h llfloater.h llfocusmgr.h + llfunctorregistry.h llhtmlhelp.h lliconctrl.h llkeywords.h @@ -94,7 +100,9 @@ set(llui_HEADER_FILES llmodaldialog.h llmultisliderctrl.h llmultislider.h + llnotifications.h llpanel.h + llprogressbar.h llradiogroup.h llresizebar.h llresizehandle.h @@ -112,12 +120,14 @@ set(llui_HEADER_FILES lltabcontainervertical.h lltextbox.h lltexteditor.h + lltextparser.h lluiconstants.h lluictrlfactory.h lluictrl.h lluifwd.h llui.h lluistring.h + lluitrans.h lluixmltags.h llundo.h llviewborder.h diff --git a/linden/indra/llui/llalertdialog.cpp b/linden/indra/llui/llalertdialog.cpp index 80e54b6..f321db8 100644 --- a/linden/indra/llui/llalertdialog.cpp +++ b/linden/indra/llui/llalertdialog.cpp @@ -1,5 +1,4 @@ -/** - * @file llalertdialog.cpp +/* @file llalertdialog.cpp * @brief LLAlertDialog base class * * $LicenseInfo:firstyear=2001&license=viewergpl$ @@ -17,7 +16,8 @@ * 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 + * 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, @@ -46,85 +46,55 @@ #include "llxmlnode.h" #include "lllineeditor.h" #include "lluictrlfactory.h" - +#include "llnotifications.h" +#include "llfunctorregistry.h" const S32 MAX_ALLOWED_MSG_WIDTH = 400; const F32 DEFAULT_BUTTON_DELAY = 0.5f; 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*/ LLAlertDialog::display_callback_t LLAlertDialog::sDisplayCallback; -/*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 std::string& xml_desc, - alert_callback_t callback, void *user_data) +void LLAlertDialog::initClass() { - LLStringUtil::format_map_t args; - return createXml(xml_desc, args, callback, user_data); + LLNotificationChannel::buildChannel("Alerts", "Visible", LLNotificationFilters::filterBy(&LLNotification::getType, "alert")); + LLNotificationChannel::buildChannel("AlertModal", "Visible", LLNotificationFilters::filterBy(&LLNotification::getType, "alertmodal")); + LLNotifications::instance().getChannel("Alerts")->connectChanged(boost::bind(&onNewNotification, _1, false)); + LLNotifications::instance().getChannel("AlertModal")->connectChanged(boost::bind(&onNewNotification, _1, true)); } -//static -LLAlertDialog* LLAlertDialog::createXml( const std::string& xml_desc, const LLStringUtil::format_map_t& args, - alert_callback_t callback, void *user_data) +//static +bool LLAlertDialog::onNewNotification(const LLSD& notify, bool is_modal) { - template_map_t::iterator iter = sAlertTemplates.find(xml_desc); - if (iter != sAlertTemplates.end()) - { - LLAlertDialogTemplate* xml_template = iter->second; - // deletes itself - llwarns << "Alert: [" << xml_desc << "] " << llendl; - LLAlertDialog* dialog = new LLAlertDialog( xml_template, args, callback, user_data); - return dialog; - } - else + LLNotificationPtr notification = LLNotifications::instance().find(notify["id"].asUUID()); + + if(notification) { - LLStringUtil::format_map_t args; - args["[ALERT_NAME]"] = xml_desc; - llwarns << "Missing Alert: [" << xml_desc << "]" << llendl; - LLAlertDialog* dialogp = LLAlertDialog::showXml("MissingAlert", args); - if (dialogp == NULL) + if (notify["sigtype"].asString() == "add" || notify["sigtype"].asString() == "load") { - llerrs << "Bad or missing alerts.xml!" << llendl; + LLAlertDialog* dialog = new LLAlertDialog(notification, is_modal); + dialog->show(); + } + else if (notify["sigtype"].asString() == "change") + { + LLAlertDialog* dialog = getInstance(notification->getID()); + if (dialog) + { + dialog->show(); + } + else + { + LLAlertDialog* dialog = new LLAlertDialog(notification, is_modal); + dialog->show(); + } } - return NULL; } -} - -//static -LLAlertDialog* LLAlertDialog::showXml( const std::string& xml_desc, - alert_callback_t callback, void *user_data) -{ - LLStringUtil::format_map_t args; - return showXml(xml_desc, args, callback, user_data); -} -//static -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); - return dialog && dialog->show() ? dialog : NULL; + return false; } -//static -LLAlertDialog* LLAlertDialog::showCritical( const std::string& desc, alert_callback_t callback, void *user_data) -{ - LLAlertDialogTemplate xml_template; - LLStringUtil::format_map_t args; - xml_template.mTitle = "Critical Error"; - xml_template.mMessage = desc; - xml_template.mModal = TRUE; - xml_template.mOptions.push_back("Quit"); - LLAlertDialog* dialog = new LLAlertDialog( &xml_template, args, callback, user_data); - return dialog && dialog->show() ? dialog : NULL; -} //----------------------------------------------------------------------------- // Private methods @@ -132,183 +102,110 @@ LLAlertDialog* LLAlertDialog::showCritical( const std::string& desc, alert_callb static const S32 VPAD = 16; static const S32 HPAD = 25; static const S32 BTN_HPAD = 8; -static const LLFONT_ID font_name = LLFONT_SANSSERIF; - -LLAlertDialog::LLAlertDialog( const LLAlertDialogTemplate* xml_template, - 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 ), - mUserData( user_data ), - mNumOptions( 0 ), +static const LLFONT_ID FONT_NAME = LLFONT_SANSSERIF; + +LLAlertDialog::LLAlertDialog( LLNotificationPtr notification, bool modal) + : LLModalDialog( notification->getLabel(), 100, 100, modal ), // dummy size. Will reshape below. + LLInstanceTracker(notification->getID()), mDefaultOption( 0 ), - mOptionChosen( -1 ), mCheck(NULL), - mCaution(xml_template->mCaution), - mUnique(xml_template->mUnique), - mIgnorable(xml_template->mIgnorable), - mLabel(xml_template->mLabel), - mIgnoreLabel(xml_template->mIgnoreLabel), - mButtonData(NULL), + mCaution(notification->getPriority() >= NOTIFICATION_PRIORITY_HIGH), + mLabel(notification->getName()), mLineEditor(NULL), - mTextCallback(NULL), - mURLOption(0) + mNote(notification) { - mURL = xml_template->mURL; - mURLOption = xml_template->mURLOption; - createDialog(xml_template->mOptions, xml_template->mDefaultOption, - xml_template->mMessage, args, - xml_template->mEditLineText); - setTitle(xml_template->mTitle); - if (xml_template->mIgnorable) - { - if (xml_template->mIgnorable == IGNORE_USE_DEFAULT) - { - setCheckBox(sStringSkipNextTime, xml_template->mIgnoreLabel); - } - else // xml_template->mIgnorable == IGNORE_USE_SAVED - { - setCheckBox(sStringAlwaysChoose, xml_template->mIgnoreLabel); - } - } -} + const LLFontGL* font = LLResMgr::getInstance()->getRes( FONT_NAME ); + const S32 LINE_HEIGHT = llfloor(font->getLineHeight() + 0.99f); + const S32 EDITOR_HEIGHT = 20; -// All logic for deciding not to show an alert is done here, -// so that the alert is valid until show() is called. -bool LLAlertDialog::show() -{ - // If modal, check to see if we are not displaying alerts, - // and do any application logic before showing modal alerts - if (sDisplayCallback) - { - bool show = sDisplayCallback(isModal()); - if (show == false) - { - mOptionChosen = mDefaultOption; - llinfos << "Alert: " << mLabel << llendl; - close(); - return false; - } - } + LLNotificationFormPtr form = mNote->getForm(); + std::string edit_text_name; + std::string edit_text_contents; + bool is_password = false; + + setBackgroundVisible(TRUE); + setBackgroundOpaque(TRUE); - // Check to see if the user wants to ignore this alert - if (mIgnorable > 0) + + typedef std::vector > options_t; + options_t supplied_options; + + // for now, get LLSD to iterator over form elements + LLSD form_sd = form->asLLSD(); + + S32 option_index = 0; + for (LLSD::array_const_iterator it = form_sd.beginArray(); it != form_sd.endArray(); ++it) { - BOOL warn = sSettings->getWarning(mIgnoreLabel); - if (!warn) + std::string type = (*it)["type"].asString(); + if (type == "button") { - switch(mIgnorable) + if((*it)["default"]) { - case IGNORE_USE_DEFAULT: - mOptionChosen = mDefaultOption; - break; - case IGNORE_USE_SAVED: - mOptionChosen = sSettings->getS32("Default" + mIgnoreLabel); - break; - case IGNORE_SHOW_AGAIN: - break; + mDefaultOption = option_index; } - close(); - return false; - } - } - // If this is a caution message, change the color and add an icon. - if (mCaution) - { - setBackgroundColor( LLUI::sColorsGroup->getColor( "AlertCautionBoxColor" ) ); - } - else - { - setBackgroundColor( LLUI::sColorsGroup->getColor( "AlertBoxColor" ) ); - } + supplied_options.push_back(std::make_pair((*it)["name"].asString(), (*it)["text"].asString())); - // Check to see if we are already displaying the alert - if (mUnique) - { - std::map::iterator iter = sUniqueActiveMap.find(mLabel); - if (iter != sUniqueActiveMap.end()) + ButtonData data; + data.mSelf = this; + if (option_index == mNote->getURLOption()) + { + data.mURL = mNote->getURL(); + } + + mButtonData.push_back(data); + option_index++; + } + else if (type == "text") { - gFloaterView->bringToFront(iter->second); - mUnique = FALSE; // don't remove entry from map on destruction - close(); - return false; + edit_text_contents = (*it)["value"].asString(); + edit_text_name = (*it)["name"].asString(); + } + else if (type == "password") + { + edit_text_contents = (*it)["value"].asString(); + edit_text_name = (*it)["name"].asString(); + is_password = true; } - sUniqueActiveMap[mLabel] = this; - } - startModal(); - gFloaterView->adjustToFitScreen(this, FALSE); - open(); /* Flawfinder: ignore */ - setFocus(TRUE); - if (mLineEditor) - { - mLineEditor->setFocus(TRUE); - mLineEditor->selectAll(); - } - if(mDefaultOption >= 0) - { - // delay before enabling default button - mDefaultBtnTimer.start(); - mDefaultBtnTimer.setTimerExpirySec(DEFAULT_BUTTON_DELAY); } - return true; -} - -void LLAlertDialog::format(std::string& msg, const LLStringUtil::format_map_t& args) -{ - // XUI:translate! - LLStringUtil::format_map_t targs = args; - targs["[SECOND_LIFE]"] = "Second Life"; - targs["[_URL]"] = mURL; - LLStringUtil::format(msg, targs); -} -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); - - const LLFontGL* font = LLResMgr::getInstance()->getRes( font_name ); - const S32 LINE_HEIGHT = llfloor(font->getLineHeight() + 0.99f); - const S32 EDITOR_HEIGHT = 20; - - const options_list_t* optionsp = &options_in; - // Buttons - options_list_t default_option_list; - mNumOptions = options_in.size(); - if( 0 == mNumOptions ) + options_t options; + if (supplied_options.empty()) { - default_option_list.push_back("Close"); - optionsp = &default_option_list; - default_option = 0; - mNumOptions = 1; + options.push_back(std::make_pair(std::string("close"), std::string("Close"))); + + // add data for ok button. + ButtonData ok_button; + ok_button.mSelf = this; + + mButtonData.push_back(ok_button); + mDefaultOption = 0; + } + else + { + options = supplied_options; } - const options_list_t& options= *optionsp; - - mButtonData = new ButtonData[mNumOptions]; + S32 num_options = options.size(); // Calc total width of buttons S32 button_width = 0; S32 sp = font->getWidth(std::string("OO")); - for( S32 i = 0; i < mNumOptions; i++ ) + for( S32 i = 0; i < num_options; i++ ) { - S32 w = S32(font->getWidth( options[i] ) + 0.99f) + sp + 2 * LLBUTTON_H_PAD; + S32 w = S32(font->getWidth( options[i].second ) + 0.99f) + sp + 2 * LLBUTTON_H_PAD; button_width = llmax( w, button_width ); } S32 btn_total_width = button_width; - if( mNumOptions > 1 ) + if( num_options > 1 ) { - btn_total_width = (mNumOptions * button_width) + ((mNumOptions - 1) * BTN_HPAD); + btn_total_width = (num_options * button_width) + ((num_options - 1) * BTN_HPAD); } // Message: create text box using raw string, as text has been structure deliberately // Use size of created text box to generate dialog box size - std::string msg = msg_in; - format( msg, args ); + std::string msg = mNote->getMessage(); llwarns << "Alert: " << msg << llendl; LLTextBox* msg_box = new LLTextBox( std::string("Alert message"), msg, (F32)MAX_ALLOWED_MSG_WIDTH, font ); @@ -321,16 +218,19 @@ void LLAlertDialog::createDialog(const options_list_t& options_in, S32 default_o dialog_height += LINE_HEIGHT; // room for title bar } - if (edit_text.size() > 0) + // it's ok for the edit text body to be empty, but we want the name to exist if we're going to draw it + if (!edit_text_name.empty()) { - dialog_width = llmax(dialog_width, S32(font->getWidth( edit_text ) + 0.99f)); - dialog_height += EDITOR_HEIGHT; + dialog_height += EDITOR_HEIGHT + VPAD; + dialog_width = llmax(dialog_width, (S32)(font->getWidth( edit_text_contents ) + 0.99f)); } + if (mCaution) { // Make room for the caution icon. dialog_width += 32 + HPAD; } + reshape( dialog_width, dialog_height, FALSE ); S32 msg_y = getRect().getHeight() - VPAD; @@ -352,6 +252,7 @@ void LLAlertDialog::createDialog(const options_list_t& options_in, S32 default_o { msg_box->setColor( LLUI::sColorsGroup->getColor( "AlertTextColor" ) ); } + LLRect rect; rect.setLeftTopAndSize( msg_x, msg_y, text_rect.getWidth(), text_rect.getHeight() ); msg_box->setRect( rect ); @@ -360,25 +261,26 @@ void LLAlertDialog::createDialog(const options_list_t& options_in, S32 default_o // Buttons S32 button_left = (getRect().getWidth() - btn_total_width) / 2; - for( S32 i = 0; i < mNumOptions; i++ ) + for( S32 i = 0; i < num_options; i++ ) { LLRect button_rect; button_rect.setOriginAndSize( button_left, VPAD, button_width, BTN_HEIGHT ); - 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]); + LLButton* btn = new LLButton( + options[i].first, button_rect, + "","", "", + NULL, NULL, + font, + options[i].second, + options[i].second); - mButtonData[i].mSelf = this; mButtonData[i].mButton = btn; - mButtonData[i].mOption = i; + + btn->setClickedCallback(&LLAlertDialog::onButtonPressed, (void*)(&mButtonData[i])); addChild(btn); - if( i == default_option ) + if( i == mDefaultOption ) { btn->setFocus(TRUE); } @@ -387,21 +289,83 @@ void LLAlertDialog::createDialog(const options_list_t& options_in, S32 default_o } // (Optional) Edit Box - if (edit_text.size() > 0) + if (!edit_text_name.empty()) { S32 y = VPAD + BTN_HEIGHT + VPAD/2; - mLineEditor = new LLLineEditor(std::string("lineeditor"), + mLineEditor = new LLLineEditor(edit_text_name, LLRect( HPAD, y+EDITOR_HEIGHT, dialog_width-HPAD, y), - edit_text, - LLFontGL::sSansSerif, + edit_text_contents, + LLFontGL::getFontSansSerif(), STD_STRING_STR_LEN); + + // make sure all edit keys get handled properly (DEV-22396) + mLineEditor->setHandleEditKeysDirectly(TRUE); + addChild(mLineEditor); } + + if (mLineEditor) + { + mLineEditor->setDrawAsterixes(is_password); + + setEditTextArgs(notification->getSubstitutions()); + } + + std::string ignore_label; + + if (form->getIgnoreType() == LLNotificationForm::IGNORE_WITH_DEFAULT_RESPONSE) + { + setCheckBox(LLNotifications::instance().getGlobalString("skipnexttime"), ignore_label); + } + else if (form->getIgnoreType() == LLNotificationForm::IGNORE_WITH_LAST_RESPONSE) + { + setCheckBox(LLNotifications::instance().getGlobalString("alwayschoose"), ignore_label); + } +} + +// All logic for deciding not to show an alert is done here, +// so that the alert is valid until show() is called. +bool LLAlertDialog::show() +{ + // If this is a caution message, change the color and add an icon. + if (mCaution) + { + setBackgroundColor( LLUI::sColorsGroup->getColor( "AlertCautionBoxColor" ) ); + } + else + { + setBackgroundColor( LLUI::sColorsGroup->getColor( "AlertBoxColor" ) ); + } + + startModal(); + gFloaterView->adjustToFitScreen(this, FALSE); + open(); /* Flawfinder: ignore */ + setFocus(TRUE); + if (mLineEditor) + { + mLineEditor->setFocus(TRUE); + mLineEditor->selectAll(); + } + if(mDefaultOption >= 0) + { + // delay before enabling default button + mDefaultBtnTimer.start(); + mDefaultBtnTimer.setTimerExpirySec(DEFAULT_BUTTON_DELAY); + } + + // attach to floater if necessary + LLUUID context_key = mNote->getPayload()["context"].asUUID(); + LLFloaterNotificationContext* contextp = dynamic_cast(LLNotificationContext::getInstance(context_key)); + if (contextp && contextp->getFloater()) + { + contextp->getFloater()->addDependentFloater(this, FALSE); + } + return true; } bool LLAlertDialog::setCheckBox( const std::string& check_title, const std::string& check_control ) { - const LLFontGL* font = LLResMgr::getInstance()->getRes( font_name ); + const LLFontGL* font = LLResMgr::getInstance()->getRes( FONT_NAME ); const S32 LINE_HEIGHT = llfloor(font->getLineHeight() + 0.99f); // Extend dialog for "check next time" @@ -422,16 +386,9 @@ bool LLAlertDialog::setCheckBox( const std::string& check_title, const std::stri check_rect.setOriginAndSize(msg_x, VPAD+BTN_HEIGHT+LINE_HEIGHT/2, max_msg_width, LINE_HEIGHT); - mCheck = new LLCheckboxCtrl(std::string("check"), check_rect, check_title, font); + mCheck = new LLCheckboxCtrl(std::string("check"), check_rect, check_title, font, onClickIgnore, this); addChild(mCheck); - // mCheck is sometimes "show again" and sometimes "hide" :-( - // If it's "Show Again", and we showed it, it must be checked. JC - if (mIgnorable == IGNORE_SHOW_AGAIN) - { - mCheck->setValue(TRUE); - } - return true; } @@ -449,65 +406,12 @@ void LLAlertDialog::setVisible( BOOL visible ) void LLAlertDialog::onClose(bool app_quitting) { LLModalDialog::onClose(app_quitting); - handleCallbacks(); } LLAlertDialog::~LLAlertDialog() { - delete[] mButtonData; - if (mUnique) - { - sUniqueActiveMap.erase(mLabel); - } } -void LLAlertDialog::handleCallbacks() -{ - if (mOptionChosen >= 0) - { - if (mTextCallback && mLineEditor) - { - mTextCallback(mOptionChosen, mLineEditor->getText(), mUserData); - } - else if (mCallback) - { - mCallback(mOptionChosen, mUserData); - } - - // If we declared a URL and chose the URL option, go to the url - if (mOptionChosen == mURLOption) - { - if (!mURL.empty() && sURLLoader != NULL) - { - sURLLoader->load(mURL); - } - } - - // Only change warn state if we actually warned. - if (mCheck - && sSettings->getWarning(mIgnoreLabel)) - { - // mCheck sometimes means "hide and do the default" and - // other times means "warn me again". Yuck. JC - BOOL check = mCheck->getValue(); - switch(mIgnorable) - { - case IGNORE_USE_DEFAULT: - sSettings->setWarning(mIgnoreLabel, !check); - break; - case IGNORE_USE_SAVED: - sSettings->setWarning(mIgnoreLabel, !check); - sSettings->setS32("Default" + mIgnoreLabel, mOptionChosen); - break; - case IGNORE_SHOW_AGAIN: - sSettings->setWarning(mIgnoreLabel, check); - break; - default: - break; - } - } - } -} BOOL LLAlertDialog::hasTitleBar() const { return (getCurrentTitle() != "" && getCurrentTitle() != " ") // has title @@ -567,33 +471,11 @@ void LLAlertDialog::draw() LLModalDialog::draw(); } -void LLAlertDialog::setOptionEnabled( S32 option, BOOL enable ) -{ - if( (option >= 0) && (option < mNumOptions) ) - { - mButtonData[option].mButton->setEnabled( enable ); - } -} - -void LLAlertDialog::setEditTextCallback(alert_text_callback_t callback, void *user_data) -{ - if (mLineEditor) - { - mTextCallback = callback; - mUserData = user_data; - } - else - { - llwarns << "LLAlertDialog::setEditTextCallback called on dialog with no line editor" << llendl; - } -} - -void LLAlertDialog::setEditTextArgs(const LLStringUtil::format_map_t& edit_args) +void LLAlertDialog::setEditTextArgs(const LLSD& edit_args) { if (mLineEditor) { std::string msg = mLineEditor->getText(); - format(msg, edit_args); mLineEditor->setText(msg); } else @@ -602,268 +484,44 @@ void LLAlertDialog::setEditTextArgs(const LLStringUtil::format_map_t& edit_args) } } -void LLAlertDialog::setDrawAsterixes(BOOL enable) -{ - if (mLineEditor) - { - if (enable) - { - mLineEditor->clear(); - } - mLineEditor->setDrawAsterixes(enable); - } -} - // static void LLAlertDialog::onButtonPressed( void* userdata ) { ButtonData* button_data = (ButtonData*)userdata; LLAlertDialog* self = button_data->mSelf; - self->mOptionChosen = button_data->mOption; - self->close(); // deletes self -} - -//============================================================================= - -//static -const std::string& LLAlertDialog::getTemplateMessage(const std::string& xml_desc) -{ - template_map_t::iterator iter = sAlertTemplates.find(xml_desc); - if (iter != sAlertTemplates.end()) + LLSD response = self->mNote->getResponseTemplate(); + if (self->mLineEditor) { - return iter->second->mMessage; + response[self->mLineEditor->getName()] = self->mLineEditor->getValue(); } - else + response[button_data->mButton->getName()] = true; + + // If we declared a URL and chose the URL option, go to the url + if (!button_data->mURL.empty() && sURLLoader != NULL) { - return xml_desc; + sURLLoader->load(button_data->mURL); } + + self->mNote->respond(response); // new notification reponse + self->close(); // deletes self } -//static -bool LLAlertDialog::parseAlerts(const std::string& xml_filename, LLControlGroup* settings, BOOL settings_only) +//static +void LLAlertDialog::onClickIgnore(LLUICtrl* ctrl, void* user_data) { - LLXMLNodePtr root; - BOOL success = LLUICtrlFactory::getLayeredXMLNode(xml_filename, root); + LLAlertDialog* self = (LLAlertDialog*)user_data; - if (!success || root.isNull() || !root->hasName( "alerts" )) + // checkbox sometimes means "hide and do the default" and + // other times means "warn me again". Yuck. JC + BOOL check = ctrl->getValue(); + if (self->mNote->getForm()->getIgnoreType() == LLNotificationForm::IGNORE_SHOW_AGAIN) { - llerrs << "Problem reading UI Alerts file: " << xml_filename << llendl; - return false; + // question was "show again" so invert value to get "ignore" + check = !check; } - BOOL add_settings = FALSE; - if (settings) - { - sSettings = settings; - add_settings = TRUE; - } - llassert(sSettings); - - for (LLXMLNode* alert = root->getFirstChild(); - alert != NULL; alert = alert->getNextSibling()) - { - if (alert->hasName("global")) - { - std::string global_name; - if (alert->getAttributeString("name", global_name)) - { - if (global_name == "skipnexttime") - { - sStringSkipNextTime = alert->getTextContents(); - } - else if (global_name == "alwayschoose") - { - sStringAlwaysChoose = alert->getTextContents(); - } - } - continue; - } - - if (!alert->hasName("alert")) - { - continue; - } - - LLAlertDialogTemplate* xml_template = settings_only ? NULL : new LLAlertDialogTemplate; - - // name= - std::string alert_name; - if (alert->getAttributeString("name", alert_name)) - { - if (xml_template) - { - xml_template->mLabel = alert_name; - } - } - else - { - llwarns << "Unable to parse alert with no name" << llendl; - delete xml_template; - continue; - } - // title= - std::string title; - if (alert->getAttributeString("title", title)) - { - if (xml_template) - { - xml_template->mTitle = title; - } - } - // modal= - BOOL modal; - if (alert->getAttributeBOOL("modal", modal)) - { - if (xml_template) - { - xml_template->mModal = modal; - } - } - // caution= - BOOL caution; - if (alert->getAttributeBOOL("caution", caution)) - { - if (xml_template) - { - xml_template->mCaution = caution; - } - } - // unique= - BOOL unique; - if (alert->getAttributeBOOL("unique", unique)) - { - if (xml_template) - { - xml_template->mUnique = unique; - } - } - - S32 default_option = 0; - BOOL nodefault; - if (alert->getAttributeBOOL("nodefault", nodefault)) - { - if (nodefault) - { - if (xml_template) - { - xml_template->mDefaultOption = -1; - } - default_option = -1; - } - } - - S32 btn_idx = 0; - for (LLXMLNode* child = alert->getFirstChild(); - child != NULL; child = child->getNextSibling()) - { - // - if (child->hasName("message")) - { - if (xml_template) - { - xml_template->mMessage = child->getTextContents(); - } - } + self->mNote->setIgnored(check); +} - //