From 25c10ed028da5c547b11f1f461916897272b0e6d Mon Sep 17 00:00:00 2001 From: Steven Bennetts Date: Thu, 26 Jun 2008 00:39:00 +0000 Subject: QAR-628 merge string-cleanup-5 -r 90476:90508 -> release dataserver-is-deprecated --- indra/linux_crash_logger/llcrashloggerlinux.cpp | 2 +- indra/linux_crash_logger/llcrashloggerlinux.h | 2 +- indra/llaudio/llaudiodecodemgr.cpp | 12 +- indra/llcharacter/llanimationstates.cpp | 6 +- indra/llcharacter/llanimationstates.h | 2 +- indra/llcharacter/llbvhloader.cpp | 52 +- indra/llcharacter/llcharacter.cpp | 16 +- indra/llcharacter/llgesture.cpp | 18 +- indra/llcharacter/llgesture.h | 2 +- indra/llcharacter/llhandmotion.cpp | 8 +- indra/llcharacter/llhandmotion.h | 4 +- indra/llcharacter/llkeyframemotion.cpp | 6 +- indra/llcharacter/llkeyframemotionparam.cpp | 8 +- indra/llcharacter/llmultigesture.cpp | 10 +- indra/llcharacter/llstatemachine.cpp | 2 +- indra/llcharacter/llstatemachine.h | 2 +- indra/llcharacter/llvisualparam.cpp | 4 +- indra/llcharacter/llvisualparam.h | 24 +- indra/llcommon/llapr.cpp | 24 +- indra/llcommon/llapr.h | 24 +- indra/llcommon/llassettype.cpp | 16 +- indra/llcommon/llassettype.h | 6 +- indra/llcommon/llchat.h | 6 +- indra/llcommon/llcrc.cpp | 4 +- indra/llcommon/llcrc.h | 2 +- indra/llcommon/llerror.cpp | 8 +- indra/llcommon/llevent.cpp | 2 +- indra/llcommon/llfile.cpp | 44 +- indra/llcommon/llfile.h | 74 +- indra/llcommon/llfixedbuffer.cpp | 2 +- indra/llcommon/llfixedbuffer.h | 2 +- indra/llcommon/llliveappconfig.cpp | 2 +- indra/llcommon/lllivefile.cpp | 2 +- indra/llcommon/llprocessor.cpp | 4 +- indra/llcommon/llprocessor.h | 2 +- indra/llcommon/llsd.h | 2 +- indra/llcommon/llsdserialize.cpp | 3 +- indra/llcommon/llsdserialize_xml.cpp | 6 +- indra/llcommon/llsdutil.cpp | 9 +- indra/llcommon/llsecondlifeurls.cpp | 70 +- indra/llcommon/llsecondlifeurls.h | 30 +- indra/llcommon/llstring.cpp | 264 +------ indra/llcommon/llstring.h | 208 +++--- indra/llcommon/llsys.cpp | 56 +- indra/llcommon/llsys.h | 4 +- indra/llcommon/lltimer.cpp | 6 +- indra/llcommon/lltimer.h | 4 +- indra/llcommon/lluuid.cpp | 108 +-- indra/llcommon/lluuid.h | 5 +- indra/llcommon/metapropertyt.h | 13 - indra/llcommon/u64.cpp | 36 +- indra/llcommon/u64.h | 9 +- indra/llcrashlogger/llcrashlogger.cpp | 25 +- indra/llcrashlogger/llcrashlogger.h | 18 +- indra/llimage/llimage.cpp | 48 +- indra/llimage/llimage.h | 20 +- indra/llimage/llimagej2c.cpp | 2 +- indra/llimage/llimagej2c.h | 2 +- indra/llimage/llimagetga.cpp | 12 +- indra/llimage/llimagetga.h | 4 +- indra/llimage/llpngwrapper.cpp | 2 +- indra/llimage/llpngwrapper.h | 4 +- indra/llinventory/llinventory.cpp | 194 +++-- indra/llinventory/llinventory.h | 20 +- indra/llinventory/llinventorytype.cpp | 4 +- indra/llinventory/llinventorytype.h | 2 +- indra/llinventory/llnotecard.cpp | 14 +- indra/llinventory/llnotecard.h | 9 +- indra/llinventory/llparcel.cpp | 274 ++++--- indra/llinventory/llparcel.h | 50 +- indra/llinventory/llpermissions.cpp | 34 +- indra/llinventory/llsaleinfo.cpp | 2 +- indra/llinventory/lltransactionflags.cpp | 35 +- indra/llinventory/lltransactionflags.h | 4 +- indra/llmath/llline.cpp | 2 + indra/llmath/llmath.h | 2 + indra/llmath/llquaternion.cpp | 6 +- indra/llmath/llquaternion.h | 2 +- indra/llmath/llsphere.cpp | 2 + indra/llmath/llvolumemgr.cpp | 3 +- indra/llmath/v3dmath.cpp | 6 +- indra/llmath/v3dmath.h | 2 +- indra/llmath/v3math.cpp | 6 +- indra/llmath/v3math.h | 2 +- indra/llmath/v4color.cpp | 28 +- indra/llmath/v4color.h | 4 +- indra/llmath/v4coloru.cpp | 8 +- indra/llmath/v4coloru.h | 2 +- indra/llmessage/llassetstorage.cpp | 61 +- indra/llmessage/llassetstorage.h | 10 +- indra/llmessage/llcachename.cpp | 80 +-- indra/llmessage/llcachename.h | 6 +- indra/llmessage/llcircuit.cpp | 20 +- indra/llmessage/lldatapacker.cpp | 26 +- indra/llmessage/lldatapacker.h | 8 +- indra/llmessage/lldispatcher.cpp | 3 +- indra/llmessage/llhost.cpp | 72 +- indra/llmessage/llhost.h | 14 +- indra/llmessage/llhttpassetstorage.cpp | 64 +- indra/llmessage/llhttpassetstorage.h | 18 +- indra/llmessage/llhttpclient.cpp | 2 +- indra/llmessage/llhttpsender.cpp | 2 +- indra/llmessage/llhttpsender.h | 2 +- indra/llmessage/llinstantmessage.cpp | 26 +- indra/llmessage/llinstantmessage.h | 10 +- indra/llmessage/lliohttpserver.cpp | 4 +- indra/llmessage/lliosocket.cpp | 6 +- indra/llmessage/llmail.cpp | 2 +- indra/llmessage/llmessageconfig.cpp | 2 +- indra/llmessage/llmessagereader.h | 1 + indra/llmessage/llmessagethrottle.cpp | 4 +- indra/llmessage/llmessagethrottle.h | 4 +- indra/llmessage/llmime.cpp | 6 +- indra/llmessage/llnamevalue.cpp | 2 +- indra/llmessage/llsdmessagereader.cpp | 6 + indra/llmessage/llsdmessagereader.h | 2 + indra/llmessage/llservicebuilder.cpp | 2 +- indra/llmessage/lltemplatemessagereader.cpp | 12 +- indra/llmessage/lltemplatemessagereader.h | 2 + indra/llmessage/lltransfersourcefile.cpp | 8 +- indra/llmessage/lltransfersourcefile.h | 2 +- indra/llmessage/lltransfertargetfile.cpp | 4 +- indra/llmessage/lltransfertargetfile.h | 4 +- indra/llmessage/llurlrequest.cpp | 2 +- indra/llmessage/llxfer.cpp | 18 +- indra/llmessage/llxfer.h | 2 +- indra/llmessage/llxfer_file.cpp | 44 +- indra/llmessage/llxfer_file.h | 20 +- indra/llmessage/llxfer_mem.cpp | 9 +- indra/llmessage/llxfer_mem.h | 2 +- indra/llmessage/llxfer_vfile.cpp | 10 +- indra/llmessage/llxfer_vfile.h | 4 +- indra/llmessage/llxfermanager.cpp | 26 +- indra/llmessage/llxfermanager.h | 6 +- indra/llmessage/mean_collision_data.h | 16 +- indra/llmessage/message.cpp | 146 ++-- indra/llmessage/message.h | 6 +- indra/llprimitive/llmaterialtable.cpp | 29 +- indra/llprimitive/llmaterialtable.h | 20 +- indra/llprimitive/llprimitive.cpp | 65 +- indra/llprimitive/llprimitive.h | 4 +- indra/llrender/llfontgl.cpp | 98 +-- indra/llrender/llfontgl.h | 50 +- indra/llrender/llimagegl.cpp | 2 +- indra/llui/llbutton.cpp | 118 +-- indra/llui/llbutton.h | 72 +- indra/llui/llcallbackmap.h | 2 +- indra/llui/llcheckboxctrl.cpp | 42 +- indra/llui/llcheckboxctrl.h | 12 +- indra/llui/llcombobox.cpp | 102 +-- indra/llui/llcombobox.h | 30 +- indra/llui/llctrlselectioninterface.cpp | 4 +- indra/llui/llctrlselectioninterface.h | 10 +- indra/llui/lldraghandle.cpp | 24 +- indra/llui/lldraghandle.h | 18 +- indra/llui/llfloater.cpp | 119 ++-- indra/llui/llfloater.h | 36 +- indra/llui/llfocusmgr.cpp | 12 +- indra/llui/llfocusmgr.h | 6 +- indra/llui/lliconctrl.cpp | 10 +- indra/llui/lliconctrl.h | 10 +- indra/llui/llkeywords.cpp | 63 +- indra/llui/llkeywords.h | 8 +- indra/llui/lllineeditor.cpp | 108 +-- indra/llui/lllineeditor.h | 34 +- indra/llui/llmenugl.cpp | 212 +++--- indra/llui/llmenugl.h | 86 +-- indra/llui/llmodaldialog.cpp | 4 +- indra/llui/llmodaldialog.h | 2 +- indra/llui/llmultislider.cpp | 32 +- indra/llui/llmultislider.h | 22 +- indra/llui/llmultisliderctrl.cpp | 64 +- indra/llui/llmultisliderctrl.h | 28 +- indra/llui/llpanel.cpp | 128 ++-- indra/llui/llpanel.h | 126 ++-- indra/llui/llradiogroup.cpp | 28 +- indra/llui/llradiogroup.h | 10 +- indra/llui/llresizebar.cpp | 2 +- indra/llui/llresizebar.h | 2 +- indra/llui/llresizehandle.cpp | 2 +- indra/llui/llresizehandle.h | 2 +- indra/llui/llresmgr.cpp | 38 +- indra/llui/llresmgr.h | 12 +- indra/llui/llscrollbar.cpp | 26 +- indra/llui/llscrollbar.h | 4 +- indra/llui/llscrollcontainer.cpp | 18 +- indra/llui/llscrollcontainer.h | 8 +- indra/llui/llscrollingpanellist.cpp | 2 +- indra/llui/llscrollingpanellist.h | 4 +- indra/llui/llscrolllistctrl.cpp | 152 ++-- indra/llui/llscrolllistctrl.h | 52 +- indra/llui/llslider.cpp | 6 +- indra/llui/llslider.h | 4 +- indra/llui/llsliderctrl.cpp | 53 +- indra/llui/llsliderctrl.h | 12 +- indra/llui/llspinctrl.cpp | 52 +- indra/llui/llspinctrl.h | 6 +- indra/llui/llstyle.cpp | 18 +- indra/llui/llstyle.h | 16 +- indra/llui/lltabcontainer.cpp | 92 +-- indra/llui/lltabcontainer.h | 26 +- indra/llui/lltextbox.cpp | 28 +- indra/llui/lltextbox.h | 12 +- indra/llui/lltexteditor.cpp | 110 ++- indra/llui/lltexteditor.h | 53 +- indra/llui/llui.cpp | 25 +- indra/llui/llui.h | 18 +- indra/llui/lluictrl.cpp | 8 +- indra/llui/lluictrl.h | 6 +- indra/llui/lluictrlfactory.cpp | 60 +- indra/llui/lluictrlfactory.h | 23 +- indra/llui/lluistring.cpp | 14 +- indra/llui/lluistring.h | 34 +- indra/llui/llview.cpp | 131 ++-- indra/llui/llview.h | 99 ++- indra/llui/llviewborder.cpp | 8 +- indra/llui/llviewborder.h | 2 +- indra/llvfs/lldir.cpp | 74 +- indra/llvfs/lldir.h | 5 + indra/llvfs/lldir_linux.cpp | 18 +- indra/llvfs/lldir_solaris.cpp | 18 +- indra/llvfs/lldir_win32.cpp | 12 +- indra/llvfs/lllfsthread.cpp | 6 +- indra/llvfs/lllfsthread.h | 10 +- indra/llvfs/llvfs.cpp | 87 +-- indra/llvfs/llvfs.h | 10 +- indra/llvfs/llvfsthread.h | 6 +- indra/llwindow/lldxhardware.cpp | 4 +- indra/llwindow/lldxhardware.h | 4 +- indra/llwindow/llkeyboard.cpp | 26 +- indra/llwindow/llkeyboard.h | 12 +- indra/llwindow/llmousehandler.h | 4 +- indra/llwindow/llwindow.cpp | 14 +- indra/llwindow/llwindow.h | 26 +- indra/llwindow/llwindowheadless.cpp | 2 +- indra/llwindow/llwindowheadless.h | 10 +- indra/llwindow/llwindowmacosx.cpp | 100 +-- indra/llwindow/llwindowmacosx.h | 15 +- indra/llwindow/llwindowmesaheadless.cpp | 2 +- indra/llwindow/llwindowmesaheadless.h | 10 +- indra/llwindow/llwindowsdl.cpp | 145 ++-- indra/llwindow/llwindowsdl.h | 17 +- indra/llwindow/llwindowwin32.cpp | 118 +-- indra/llwindow/llwindowwin32.h | 13 +- indra/llxml/llcontrol.cpp | 156 ++-- indra/llxml/llcontrol.h | 126 ++-- indra/llxml/llxmlnode.cpp | 228 +++--- indra/llxml/llxmlnode.h | 92 +-- indra/llxml/llxmlparser.cpp | 14 +- indra/llxml/llxmlparser.h | 2 +- indra/llxml/llxmltree.cpp | 94 +-- indra/llxml/llxmltree.h | 20 +- indra/lscript/lscript_byteconvert.h | 2 +- indra/lscript/lscript_compile/indra.l | 4 +- indra/lscript/lscript_compile/lscript_tree.cpp | 6 +- indra/lscript/lscript_compile/lscript_tree.h | 2 +- indra/lscript/lscript_execute/lscript_execute.cpp | 7 +- indra/lscript/lscript_library.h | 6 +- indra/lscript/lscript_rt_interface.h | 2 +- indra/mac_crash_logger/llcrashloggermac.cpp | 14 +- indra/mac_crash_logger/llcrashloggermac.h | 2 +- indra/mac_updater/mac_updater.cpp | 2 +- indra/newview/CMakeLists.txt | 2 - indra/newview/llagent.cpp | 60 +- indra/newview/llagent.h | 18 +- indra/newview/llagentpilot.cpp | 18 +- indra/newview/llagentpilot.h | 4 +- indra/newview/llanimstatelabels.cpp | 4 +- indra/newview/llappviewer.cpp | 211 +++--- indra/newview/llappviewer.h | 18 +- indra/newview/llappviewerlinux.cpp | 8 +- indra/newview/llappviewermacosx.cpp | 6 +- indra/newview/llappviewerwin32.cpp | 6 +- indra/newview/llassetuploadresponders.cpp | 39 +- indra/newview/llcallingcard.cpp | 10 +- indra/newview/llcallingcard.h | 2 +- indra/newview/llcaphttpsender.cpp | 2 +- indra/newview/llcaphttpsender.h | 2 +- indra/newview/llchatbar.cpp | 29 +- indra/newview/llchatbar.h | 2 +- indra/newview/llcolorswatch.cpp | 8 +- indra/newview/llcommandlineparser.cpp | 26 +- indra/newview/llcommandlineparser.h | 8 +- indra/newview/llcompilequeue.cpp | 102 ++- indra/newview/llcompilequeue.h | 6 +- indra/newview/llconfirmationmanager.cpp | 6 +- indra/newview/llcurrencyuimanager.cpp | 4 +- indra/newview/llcurrencyuimanager.h | 2 +- indra/newview/lldebugmessagebox.cpp | 22 +- indra/newview/lldebugmessagebox.h | 4 +- indra/newview/lldelayedgestureerror.cpp | 4 +- indra/newview/lldelayedgestureerror.h | 4 +- indra/newview/lldirpicker.cpp | 24 +- indra/newview/lldirpicker.h | 9 +- indra/newview/lldrawpoolbump.cpp | 2 +- indra/newview/lldrawpoolbump.h | 4 +- indra/newview/lldrawpoolwlsky.cpp | 2 +- indra/newview/llemote.h | 2 - indra/newview/lleventinfo.cpp | 53 +- indra/newview/lleventinfo.h | 3 +- indra/newview/lleventnotifier.cpp | 2 +- indra/newview/llfasttimerview.cpp | 24 +- indra/newview/llfeaturemanager.cpp | 48 +- indra/newview/llfeaturemanager.h | 35 +- indra/newview/llfilepicker.cpp | 532 +++++--------- indra/newview/llfilepicker.h | 43 +- indra/newview/llfirstuse.cpp | 14 +- indra/newview/llfirstuse.h | 4 +- indra/newview/llfloaterabout.cpp | 26 +- indra/newview/llfloateranimpreview.cpp | 39 +- indra/newview/llfloateranimpreview.h | 4 +- indra/newview/llfloaterauction.cpp | 16 +- indra/newview/llfloateravatarpicker.cpp | 24 +- indra/newview/llfloateravatartextures.cpp | 4 +- indra/newview/llfloateravatartextures.h | 2 +- indra/newview/llfloaterbuildoptions.cpp | 2 +- indra/newview/llfloaterbump.cpp | 9 +- indra/newview/llfloaterbuy.cpp | 12 +- indra/newview/llfloaterbuycontents.cpp | 8 +- indra/newview/llfloaterbuycurrency.cpp | 10 +- indra/newview/llfloaterbuyland.cpp | 46 +- indra/newview/llfloatercamera.cpp | 20 +- indra/newview/llfloaterchat.cpp | 18 +- indra/newview/llfloaterchat.h | 2 +- indra/newview/llfloatercolorpicker.cpp | 6 +- indra/newview/llfloaterdaycycle.cpp | 52 +- indra/newview/llfloaterdaycycle.h | 10 +- indra/newview/llfloaterenvsettings.cpp | 6 +- indra/newview/llfloaterenvsettings.h | 2 +- indra/newview/llfloaterfriends.cpp | 24 +- indra/newview/llfloaterfriends.h | 4 +- indra/newview/llfloatergesture.cpp | 24 +- indra/newview/llfloatergodtools.cpp | 42 +- indra/newview/llfloatergodtools.h | 12 +- indra/newview/llfloatergroups.cpp | 6 +- indra/newview/llfloaterhardwaresettings.cpp | 2 +- indra/newview/llfloaterhud.cpp | 8 +- indra/newview/llfloaterhud.h | 4 +- indra/newview/llfloaterimagepreview.cpp | 25 +- indra/newview/llfloaterimagepreview.h | 6 +- indra/newview/llfloaterinspect.cpp | 8 +- indra/newview/llfloaterjoystick.cpp | 2 +- indra/newview/llfloaterlagmeter.cpp | 18 +- indra/newview/llfloaterlagmeter.h | 2 +- indra/newview/llfloaterland.cpp | 153 ++-- indra/newview/llfloaterland.h | 2 +- indra/newview/llfloaterlandholdings.cpp | 30 +- indra/newview/llfloaterlandholdings.h | 2 +- indra/newview/llfloatermap.cpp | 6 +- indra/newview/llfloaternamedesc.cpp | 32 +- indra/newview/llfloaternamedesc.h | 4 +- indra/newview/llfloateropenobject.cpp | 6 +- indra/newview/llfloaterpostcard.cpp | 10 +- indra/newview/llfloaterpostcard.h | 2 +- indra/newview/llfloaterpostprocess.cpp | 2 +- indra/newview/llfloaterpreference.cpp | 15 +- indra/newview/llfloaterpreference.h | 10 +- indra/newview/llfloaterproperties.cpp | 6 +- indra/newview/llfloaterregioninfo.cpp | 225 +++--- indra/newview/llfloaterregioninfo.h | 28 +- indra/newview/llfloaterreporter.cpp | 51 +- indra/newview/llfloaterreporter.h | 8 +- indra/newview/llfloaterscriptdebug.cpp | 14 +- indra/newview/llfloaterscriptdebug.h | 2 +- indra/newview/llfloatersellland.cpp | 22 +- indra/newview/llfloatersettingsdebug.cpp | 38 +- indra/newview/llfloatersnapshot.cpp | 14 +- indra/newview/llfloatersnapshot.h | 2 +- indra/newview/llfloatertelehub.cpp | 13 +- indra/newview/llfloatertelehub.h | 2 +- indra/newview/llfloatertools.cpp | 24 +- indra/newview/llfloatertopobjects.cpp | 26 +- indra/newview/llfloatertopobjects.h | 4 +- indra/newview/llfloatertos.cpp | 2 +- indra/newview/llfloatertos.h | 2 +- indra/newview/llfloaterurlentry.cpp | 2 +- indra/newview/llfloatervoicedevicesettings.cpp | 6 +- indra/newview/llfloaterwater.cpp | 38 +- indra/newview/llfloaterwater.h | 4 +- indra/newview/llfloaterwindlight.cpp | 86 +-- indra/newview/llfloaterwindlight.h | 4 +- indra/newview/llfloaterworldmap.cpp | 53 +- indra/newview/llfloaterworldmap.h | 14 +- indra/newview/llfolderview.cpp | 100 +-- indra/newview/llfolderview.h | 67 +- indra/newview/llgesturemgr.cpp | 22 +- indra/newview/llglsandbox.cpp | 2 +- indra/newview/llgroupmgr.cpp | 81 +-- indra/newview/llgroupmgr.h | 2 +- indra/newview/llhudeffectlookat.cpp | 13 +- indra/newview/llhudtext.cpp | 4 +- indra/newview/llimpanel.cpp | 89 ++- indra/newview/llimpanel.h | 44 +- indra/newview/llimview.cpp | 114 ++- indra/newview/llimview.h | 24 +- indra/newview/llinventorybridge.cpp | 365 +++++----- indra/newview/llinventorybridge.h | 102 +-- indra/newview/llinventorymodel.cpp | 95 ++- indra/newview/llinventorymodel.h | 20 +- indra/newview/lljoystickbutton.cpp | 50 +- indra/newview/lljoystickbutton.h | 16 +- indra/newview/lllogchat.cpp | 22 +- indra/newview/lllogchat.h | 10 +- indra/newview/llmanip.cpp | 34 +- indra/newview/llmanip.h | 6 +- indra/newview/llmaniprotate.cpp | 39 +- indra/newview/llmanipscale.cpp | 6 +- indra/newview/llmaniptranslate.cpp | 6 +- indra/newview/llmimetypes.cpp | 48 +- indra/newview/llmimetypes.h | 42 +- indra/newview/llmoveview.cpp | 2 +- indra/newview/llmutelist.cpp | 76 +- indra/newview/llmutelist.h | 22 +- indra/newview/llnamebox.cpp | 24 +- indra/newview/llnamebox.h | 7 +- indra/newview/llnameeditor.cpp | 26 +- indra/newview/llnameeditor.h | 7 +- indra/newview/llnamelistctrl.cpp | 52 +- indra/newview/llnamelistctrl.h | 15 +- indra/newview/llnetmap.cpp | 34 +- indra/newview/llnetmap.h | 2 +- indra/newview/lloverlaybar.cpp | 4 +- indra/newview/llpanelavatar.cpp | 134 ++-- indra/newview/llpanelavatar.h | 14 +- indra/newview/llpanelclassified.cpp | 68 +- indra/newview/llpanelclassified.h | 10 +- indra/newview/llpanelcontents.cpp | 4 +- indra/newview/llpanelgroup.cpp | 28 +- indra/newview/llpanelgroup.h | 22 +- indra/newview/llpanelgroupgeneral.cpp | 25 +- indra/newview/llpanelgroupgeneral.h | 4 +- indra/newview/llpanelgroupinvite.cpp | 10 +- indra/newview/llpanelgrouplandmoney.cpp | 149 ++-- indra/newview/llpanelgrouplandmoney.h | 4 +- indra/newview/llpanelgroupnotices.cpp | 45 +- indra/newview/llpanelgroupnotices.h | 14 +- indra/newview/llpanelgrouproles.cpp | 54 +- indra/newview/llpanelgrouproles.h | 26 +- indra/newview/llpanelland.cpp | 4 +- indra/newview/llpanellandmedia.cpp | 32 +- indra/newview/llpanellandmedia.h | 6 +- indra/newview/llpanellogin.cpp | 50 +- indra/newview/llpanellogin.h | 14 +- indra/newview/llpanelobject.cpp | 10 +- indra/newview/llpanelpermissions.cpp | 58 +- indra/newview/llpanelpick.cpp | 42 +- indra/newview/llpanelpick.h | 2 +- indra/newview/llpanelplace.cpp | 48 +- indra/newview/llpanelvolume.cpp | 2 +- indra/newview/llpolymesh.cpp | 18 +- indra/newview/llpolymesh.h | 12 +- indra/newview/llpolymorph.cpp | 16 +- indra/newview/llpolymorph.h | 13 +- indra/newview/llpreview.cpp | 2 +- indra/newview/llpreviewanim.h | 2 +- indra/newview/llpreviewgesture.cpp | 42 +- indra/newview/llpreviewgesture.h | 2 +- indra/newview/llpreviewnotecard.cpp | 16 +- indra/newview/llpreviewscript.cpp | 192 ++--- indra/newview/llpreviewscript.h | 11 +- indra/newview/llpreviewtexture.cpp | 10 +- indra/newview/llpreviewtexture.h | 2 +- indra/newview/llprogressview.cpp | 23 +- indra/newview/llprogressview.h | 10 +- indra/newview/llselectmgr.cpp | 92 +-- indra/newview/llselectmgr.h | 22 +- indra/newview/llstartup.cpp | 296 ++++---- indra/newview/llstartup.h | 6 +- indra/newview/llstatusbar.cpp | 36 +- indra/newview/llstylemap.cpp | 4 +- indra/newview/lltexlayer.cpp | 24 +- indra/newview/lltexlayer.h | 30 +- indra/newview/lltexturecache.cpp | 18 +- indra/newview/lltexturecache.h | 2 +- indra/newview/lltexturectrl.cpp | 48 +- indra/newview/lltexturectrl.h | 16 +- indra/newview/lltexturefetch.cpp | 12 +- indra/newview/lltexturefetch.h | 2 +- indra/newview/lltextureview.cpp | 58 +- indra/newview/lltool.cpp | 6 +- indra/newview/lltool.h | 10 +- indra/newview/lltoolbar.cpp | 8 +- indra/newview/lltoolbar.h | 2 +- indra/newview/lltoolbrush.cpp | 4 +- indra/newview/lltoolcomp.cpp | 16 +- indra/newview/lltoolcomp.h | 4 +- indra/newview/lltooldraganddrop.cpp | 27 +- indra/newview/lltooldraganddrop.h | 5 +- indra/newview/lltoolface.cpp | 2 +- indra/newview/lltoolfocus.cpp | 2 +- indra/newview/lltoolgrab.cpp | 2 +- indra/newview/lltoolgun.cpp | 3 +- indra/newview/lltoolindividual.cpp | 2 +- indra/newview/lltoolmgr.cpp | 2 +- indra/newview/lltoolobjpicker.cpp | 2 +- indra/newview/lltoolpie.cpp | 18 +- indra/newview/lltoolpipette.cpp | 8 +- indra/newview/lltoolpipette.h | 6 +- indra/newview/lltoolplacer.cpp | 8 +- indra/newview/lltoolplacer.h | 2 +- indra/newview/lltoolselect.cpp | 2 +- indra/newview/lltoolselectland.cpp | 2 +- indra/newview/lltoolview.cpp | 88 +-- indra/newview/lltoolview.h | 2 - indra/newview/lltracker.cpp | 12 +- indra/newview/lltracker.h | 20 +- indra/newview/lluploaddialog.cpp | 9 +- indra/newview/llurldispatcher.cpp | 2 +- indra/newview/llurlhistory.cpp | 12 +- indra/newview/llurlhistory.h | 4 +- indra/newview/llurlwhitelist.cpp | 24 +- indra/newview/llurlwhitelist.h | 12 +- indra/newview/llviewchildren.cpp | 20 +- indra/newview/llviewchildren.h | 16 +- indra/newview/llviewerassetstorage.cpp | 16 +- indra/newview/llviewerassetstorage.h | 2 +- indra/newview/llviewercontrol.cpp | 10 +- indra/newview/llviewercontrol.h | 6 +- indra/newview/llviewerdisplay.cpp | 16 +- indra/newview/llviewergenericmessage.cpp | 4 +- indra/newview/llviewergenericmessage.h | 2 +- indra/newview/llviewergesture.cpp | 8 +- indra/newview/llviewerinventory.cpp | 41 +- indra/newview/llviewerinventory.h | 9 +- indra/newview/llviewerjointmesh.cpp | 2 +- indra/newview/llviewerkeyboard.cpp | 34 +- indra/newview/llviewerkeyboard.h | 12 +- indra/newview/llviewermedia.cpp | 2 +- indra/newview/llviewermenu.cpp | 429 +++++------ indra/newview/llviewermenu.h | 11 +- indra/newview/llviewermenufile.cpp | 256 +++---- indra/newview/llviewermenufile.h | 6 +- indra/newview/llviewermessage.cpp | 828 +++++++++++----------- indra/newview/llviewermessage.h | 33 +- indra/newview/llviewernetwork.cpp | 4 +- indra/newview/llviewerobject.cpp | 53 +- indra/newview/llviewerobject.h | 12 +- indra/newview/llviewerobjectlist.cpp | 20 +- indra/newview/llviewerobjectlist.h | 4 +- indra/newview/llviewerparcelmedia.cpp | 4 +- indra/newview/llviewerparcelmgr.cpp | 37 +- indra/newview/llviewerparcelmgr.h | 2 +- indra/newview/llviewerregion.cpp | 58 +- indra/newview/llviewerregion.h | 18 +- indra/newview/llviewerstats.cpp | 32 +- indra/newview/llviewerstats.h | 2 - indra/newview/llviewertexteditor.cpp | 46 +- indra/newview/llviewertexteditor.h | 20 +- indra/newview/llviewerthrottle.cpp | 2 +- indra/newview/llviewerthrottle.h | 2 +- indra/newview/llviewervisualparam.cpp | 2 +- indra/newview/llviewervisualparam.h | 6 +- indra/newview/llviewerwindow.cpp | 173 ++--- indra/newview/llviewerwindow.h | 34 +- indra/newview/llvoavatar.cpp | 74 +- indra/newview/llvoavatar.h | 34 +- indra/newview/llvograss.cpp | 12 +- indra/newview/llvoiceclient.cpp | 84 +-- indra/newview/llvoiceclient.h | 8 +- indra/newview/llvotree.cpp | 10 +- indra/newview/llvovolume.cpp | 6 +- indra/newview/llwaterparammanager.cpp | 22 +- indra/newview/llwaterparammanager.h | 26 +- indra/newview/llwaterparamset.cpp | 22 +- indra/newview/llwaterparamset.h | 24 +- indra/newview/llwearable.cpp | 69 +- indra/newview/llwearable.h | 27 +- indra/newview/llwearablelist.cpp | 16 +- indra/newview/llwearablelist.h | 4 +- indra/newview/llweb.cpp | 4 +- indra/newview/llweb.h | 2 +- indra/newview/llwindebug.cpp | 9 +- indra/newview/llwindebug.h | 2 +- indra/newview/llwldaycycle.cpp | 25 +- indra/newview/llwldaycycle.h | 12 +- indra/newview/llwlparammanager.cpp | 34 +- indra/newview/llwlparammanager.h | 26 +- indra/newview/llwlparamset.cpp | 20 +- indra/newview/llwlparamset.h | 20 +- indra/newview/llworldmap.cpp | 42 +- indra/newview/llworldmap.h | 4 +- indra/newview/llworldmapview.cpp | 49 +- indra/newview/llworldmapview.h | 10 +- indra/test/llblowfish_tut.cpp | 6 +- indra/test/llmessageconfig_tut.cpp | 8 +- indra/test/llsd_new_tut.cpp | 26 +- indra/test/llsdtraits.h | 4 - indra/test/message_tut.cpp | 8 +- indra/win_crash_logger/llcrashloggerwindows.cpp | 10 +- indra/win_crash_logger/llcrashloggerwindows.h | 2 +- 590 files changed, 8052 insertions(+), 9384 deletions(-) diff --git a/indra/linux_crash_logger/llcrashloggerlinux.cpp b/indra/linux_crash_logger/llcrashloggerlinux.cpp index e0a6e2608e..9a88c32e51 100644 --- a/indra/linux_crash_logger/llcrashloggerlinux.cpp +++ b/indra/linux_crash_logger/llcrashloggerlinux.cpp @@ -132,7 +132,7 @@ bool LLCrashLoggerLinux::mainLoop() return true; } -void LLCrashLoggerLinux::updateApplication(LLString message) +void LLCrashLoggerLinux::updateApplication(const std::string& message) { LLCrashLogger::updateApplication(message); } diff --git a/indra/linux_crash_logger/llcrashloggerlinux.h b/indra/linux_crash_logger/llcrashloggerlinux.h index a84ee00e1c..2f03e55bd2 100644 --- a/indra/linux_crash_logger/llcrashloggerlinux.h +++ b/indra/linux_crash_logger/llcrashloggerlinux.h @@ -42,7 +42,7 @@ public: LLCrashLoggerLinux(void); ~LLCrashLoggerLinux(void); virtual bool mainLoop(); - virtual void updateApplication(LLString message = ""); + virtual void updateApplication(const std::string& = LLStringUtil::null); virtual void gatherPlatformSpecificFiles(); }; diff --git a/indra/llaudio/llaudiodecodemgr.cpp b/indra/llaudio/llaudiodecodemgr.cpp index ed4feff012..d45026c2df 100644 --- a/indra/llaudio/llaudiodecodemgr.cpp +++ b/indra/llaudio/llaudiodecodemgr.cpp @@ -70,7 +70,7 @@ public: LLPointer mDecoder; }; - LLVorbisDecodeState(const LLUUID &uuid, const LLString &out_filename); + LLVorbisDecodeState(const LLUUID &uuid, const std::string &out_filename); BOOL initDecode(); BOOL decodeSection(); // Return TRUE if done. @@ -93,7 +93,7 @@ protected: std::vector mWAVBuffer; #if !defined(USE_WAV_VFILE) - LLString mOutFilename; + std::string mOutFilename; LLLFSThread::handle_t mFileHandle; #endif @@ -166,7 +166,7 @@ long vfs_tell (void *datasource) return file->tell(); } -LLVorbisDecodeState::LLVorbisDecodeState(const LLUUID &uuid, const LLString &out_filename) +LLVorbisDecodeState::LLVorbisDecodeState(const LLUUID &uuid, const std::string &out_filename) { mDone = FALSE; mValid = FALSE; @@ -583,14 +583,14 @@ void LLAudioDecodeMgr::Impl::processQueue(const F32 num_secs) lldebugs << "Decoding " << uuid << " from audio queue!" << llendl; - char uuid_str[64]; /*Flawfinder: ignore*/ - char d_path[LL_MAX_PATH]; /*Flawfinder: ignore*/ + std::string uuid_str; + std::string d_path; LLTimer timer; timer.reset(); uuid.toString(uuid_str); - snprintf(d_path, LL_MAX_PATH, "%s.dsf", gDirUtilp->getExpandedFilename(LL_PATH_CACHE,uuid_str).c_str()); /* Flawfinder: ignore */ + d_path = gDirUtilp->getExpandedFilename(LL_PATH_CACHE,uuid_str) + ".dsf"; mCurrentDecodep = new LLVorbisDecodeState(uuid, d_path); if (!mCurrentDecodep->initDecode()) diff --git a/indra/llcharacter/llanimationstates.cpp b/indra/llcharacter/llanimationstates.cpp index 415b945e88..f41b2038de 100644 --- a/indra/llcharacter/llanimationstates.cpp +++ b/indra/llcharacter/llanimationstates.cpp @@ -228,10 +228,10 @@ const char *LLAnimationLibrary::animStateToString( const LLUUID& state ) //----------------------------------------------------------------------------- // Return the animation state for a given name //----------------------------------------------------------------------------- -LLUUID LLAnimationLibrary::stringToAnimState( const char *name, BOOL allow_ids ) +LLUUID LLAnimationLibrary::stringToAnimState( const std::string& name, BOOL allow_ids ) { - LLString lower_case_name(name); - LLString::toLower(lower_case_name); + std::string lower_case_name(name); + LLStringUtil::toLower(lower_case_name); char *true_name = mAnimStringTable.checkString(lower_case_name.c_str()); diff --git a/indra/llcharacter/llanimationstates.h b/indra/llcharacter/llanimationstates.h index ae3f6894db..abb7578cc9 100644 --- a/indra/llcharacter/llanimationstates.h +++ b/indra/llcharacter/llanimationstates.h @@ -222,7 +222,7 @@ public: // Return the animation state for the given name. // Retun NULL if the name is invalid. //----------------------------------------------------------------------------- - LLUUID stringToAnimState( const char *name, BOOL allow_ids = TRUE ); + LLUUID stringToAnimState( const std::string& name, BOOL allow_ids = TRUE ); }; struct LLAnimStateEntry diff --git a/indra/llcharacter/llbvhloader.cpp b/indra/llcharacter/llbvhloader.cpp index 95147ba842..54b3ec98eb 100644 --- a/indra/llcharacter/llbvhloader.cpp +++ b/indra/llcharacter/llbvhloader.cpp @@ -175,11 +175,7 @@ LLBVHLoader::Status LLBVHLoader::loadTranslationTable(const char *fileName) //-------------------------------------------------------------------- // open file //-------------------------------------------------------------------- - char path[LL_MAX_PATH]; /* Flawfinder: ignore */ - - snprintf( path, sizeof(path), "%s", /* Flawfinder: ignore */ - gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS,fileName).c_str()); - + std::string path = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS,fileName); apr_file_t *fp = ll_apr_file_open(path, LL_APR_R); if (!fp) @@ -243,7 +239,7 @@ LLBVHLoader::Status LLBVHLoader::loadTranslationTable(const char *fileName) //---------------------------------------------------------------- // check for optional emote //---------------------------------------------------------------- - if (loadingGlobals && LLString::compareInsensitive(token, "emote")==0) + if (loadingGlobals && LLStringUtil::compareInsensitive(token, "emote")==0) { char emote_str[1024]; /* Flawfinder: ignore */ if ( sscanf(mLine, " %*s = %1023s", emote_str) != 1 ) /* Flawfinder: ignore */ @@ -258,7 +254,7 @@ LLBVHLoader::Status LLBVHLoader::loadTranslationTable(const char *fileName) //---------------------------------------------------------------- // check for global priority setting //---------------------------------------------------------------- - if (loadingGlobals && LLString::compareInsensitive(token, "priority")==0) + if (loadingGlobals && LLStringUtil::compareInsensitive(token, "priority")==0) { S32 priority; if ( sscanf(mLine, " %*s = %d", &priority) != 1 ) @@ -272,7 +268,7 @@ LLBVHLoader::Status LLBVHLoader::loadTranslationTable(const char *fileName) //---------------------------------------------------------------- // check for global loop setting //---------------------------------------------------------------- - if (loadingGlobals && LLString::compareInsensitive(token, "loop")==0) + if (loadingGlobals && LLStringUtil::compareInsensitive(token, "loop")==0) { char trueFalse[128]; /* Flawfinder: ignore */ trueFalse[0] = '\0'; @@ -286,7 +282,7 @@ LLBVHLoader::Status LLBVHLoader::loadTranslationTable(const char *fileName) } else if ( sscanf(mLine, " %*s = %127s", trueFalse) == 1 ) /* Flawfinder: ignore */ { - mLoop = (LLString::compareInsensitive(trueFalse, "true")==0); + mLoop = (LLStringUtil::compareInsensitive(trueFalse, "true")==0); } else { @@ -302,7 +298,7 @@ LLBVHLoader::Status LLBVHLoader::loadTranslationTable(const char *fileName) //---------------------------------------------------------------- // check for global easeIn setting //---------------------------------------------------------------- - if (loadingGlobals && LLString::compareInsensitive(token, "easein")==0) + if (loadingGlobals && LLStringUtil::compareInsensitive(token, "easein")==0) { F32 duration; char type[128]; /* Flawfinder: ignore */ @@ -316,7 +312,7 @@ LLBVHLoader::Status LLBVHLoader::loadTranslationTable(const char *fileName) //---------------------------------------------------------------- // check for global easeOut setting //---------------------------------------------------------------- - if (loadingGlobals && LLString::compareInsensitive(token, "easeout")==0) + if (loadingGlobals && LLStringUtil::compareInsensitive(token, "easeout")==0) { F32 duration; char type[128]; /* Flawfinder: ignore */ @@ -330,7 +326,7 @@ LLBVHLoader::Status LLBVHLoader::loadTranslationTable(const char *fileName) //---------------------------------------------------------------- // check for global handMorph setting //---------------------------------------------------------------- - if (loadingGlobals && LLString::compareInsensitive(token, "hand")==0) + if (loadingGlobals && LLStringUtil::compareInsensitive(token, "hand")==0) { S32 handMorph; if (sscanf(mLine, " %*s = %d", &handMorph) != 1) @@ -340,7 +336,7 @@ LLBVHLoader::Status LLBVHLoader::loadTranslationTable(const char *fileName) continue; } - if (loadingGlobals && LLString::compareInsensitive(token, "constraint")==0) + if (loadingGlobals && LLStringUtil::compareInsensitive(token, "constraint")==0) { Constraint constraint; @@ -400,7 +396,7 @@ LLBVHLoader::Status LLBVHLoader::loadTranslationTable(const char *fileName) continue; } - if (loadingGlobals && LLString::compareInsensitive(token, "planar_constraint")==0) + if (loadingGlobals && LLStringUtil::compareInsensitive(token, "planar_constraint")==0) { Constraint constraint; @@ -470,20 +466,20 @@ LLBVHLoader::Status LLBVHLoader::loadTranslationTable(const char *fileName) //---------------------------------------------------------------- // check for ignore flag //---------------------------------------------------------------- - if ( LLString::compareInsensitive(token, "ignore")==0 ) + if ( LLStringUtil::compareInsensitive(token, "ignore")==0 ) { char trueFalse[128]; /* Flawfinder: ignore */ if ( sscanf(mLine, " %*s = %127s", trueFalse) != 1 ) /* Flawfinder: ignore */ return ST_NO_XLT_IGNORE; - trans->mIgnore = (LLString::compareInsensitive(trueFalse, "true")==0); + trans->mIgnore = (LLStringUtil::compareInsensitive(trueFalse, "true")==0); continue; } //---------------------------------------------------------------- // check for relativepos flag //---------------------------------------------------------------- - if ( LLString::compareInsensitive(token, "relativepos")==0 ) + if ( LLStringUtil::compareInsensitive(token, "relativepos")==0 ) { F32 x, y, z; char relpos[128]; /* Flawfinder: ignore */ @@ -493,7 +489,7 @@ LLBVHLoader::Status LLBVHLoader::loadTranslationTable(const char *fileName) } else if ( sscanf(mLine, " %*s = %127s", relpos) == 1 ) /* Flawfinder: ignore */ { - if ( LLString::compareInsensitive(relpos, "firstkey")==0 ) + if ( LLStringUtil::compareInsensitive(relpos, "firstkey")==0 ) { trans->mRelativePositionKey = TRUE; } @@ -513,13 +509,13 @@ LLBVHLoader::Status LLBVHLoader::loadTranslationTable(const char *fileName) //---------------------------------------------------------------- // check for relativerot flag //---------------------------------------------------------------- - if ( LLString::compareInsensitive(token, "relativerot")==0 ) + if ( LLStringUtil::compareInsensitive(token, "relativerot")==0 ) { //F32 x, y, z; char relpos[128]; /* Flawfinder: ignore */ if ( sscanf(mLine, " %*s = %127s", relpos) == 1 ) /* Flawfinder: ignore */ { - if ( LLString::compareInsensitive(relpos, "firstkey")==0 ) + if ( LLStringUtil::compareInsensitive(relpos, "firstkey")==0 ) { trans->mRelativeRotationKey = TRUE; } @@ -539,7 +535,7 @@ LLBVHLoader::Status LLBVHLoader::loadTranslationTable(const char *fileName) //---------------------------------------------------------------- // check for outname value //---------------------------------------------------------------- - if ( LLString::compareInsensitive(token, "outname")==0 ) + if ( LLStringUtil::compareInsensitive(token, "outname")==0 ) { char outName[128]; /* Flawfinder: ignore */ if ( sscanf(mLine, " %*s = %127s", outName) != 1 ) /* Flawfinder: ignore */ @@ -552,7 +548,7 @@ LLBVHLoader::Status LLBVHLoader::loadTranslationTable(const char *fileName) //---------------------------------------------------------------- // check for frame matrix value //---------------------------------------------------------------- - if ( LLString::compareInsensitive(token, "frame")==0 ) + if ( LLStringUtil::compareInsensitive(token, "frame")==0 ) { LLMatrix3 fm; if ( sscanf(mLine, " %*s = %f %f %f, %f %f %f, %f %f %f", @@ -568,7 +564,7 @@ LLBVHLoader::Status LLBVHLoader::loadTranslationTable(const char *fileName) //---------------------------------------------------------------- // check for offset matrix value //---------------------------------------------------------------- - if ( LLString::compareInsensitive(token, "offset")==0 ) + if ( LLStringUtil::compareInsensitive(token, "offset")==0 ) { LLMatrix3 om; if ( sscanf(mLine, " %*s = %f %f %f, %f %f %f, %f %f %f", @@ -584,7 +580,7 @@ LLBVHLoader::Status LLBVHLoader::loadTranslationTable(const char *fileName) //---------------------------------------------------------------- // check for mergeparent value //---------------------------------------------------------------- - if ( LLString::compareInsensitive(token, "mergeparent")==0 ) + if ( LLStringUtil::compareInsensitive(token, "mergeparent")==0 ) { char mergeParentName[128]; /* Flawfinder: ignore */ if ( sscanf(mLine, " %*s = %127s", mergeParentName) != 1 ) /* Flawfinder: ignore */ @@ -597,7 +593,7 @@ LLBVHLoader::Status LLBVHLoader::loadTranslationTable(const char *fileName) //---------------------------------------------------------------- // check for mergechild value //---------------------------------------------------------------- - if ( LLString::compareInsensitive(token, "mergechild")==0 ) + if ( LLStringUtil::compareInsensitive(token, "mergechild")==0 ) { char mergeChildName[128]; /* Flawfinder: ignore */ if ( sscanf(mLine, " %*s = %127s", mergeChildName) != 1 ) /* Flawfinder: ignore */ @@ -610,7 +606,7 @@ LLBVHLoader::Status LLBVHLoader::loadTranslationTable(const char *fileName) //---------------------------------------------------------------- // check for per-joint priority //---------------------------------------------------------------- - if ( LLString::compareInsensitive(token, "priority")==0 ) + if ( LLStringUtil::compareInsensitive(token, "priority")==0 ) { S32 priority; if ( sscanf(mLine, " %*s = %d", &priority) != 1 ) @@ -1304,7 +1300,7 @@ BOOL LLBVHLoader::serialize(LLDataPacker& dp) dp.packU16(KEYFRAME_MOTION_SUBVERSION, "sub_version"); dp.packS32(mPriority, "base_priority"); dp.packF32(mDuration, "duration"); - dp.packString(mEmoteName.c_str(), "emote_name"); + dp.packString(mEmoteName, "emote_name"); dp.packF32(mLoopInPoint, "loop_in_point"); dp.packF32(mLoopOutPoint, "loop_out_point"); dp.packS32(mLoop, "loop"); @@ -1325,7 +1321,7 @@ BOOL LLBVHLoader::serialize(LLDataPacker& dp) LLQuaternion first_frame_rot; LLQuaternion fixup_rot; - dp.packString(joint->mOutName.c_str(), "joint_name"); + dp.packString(joint->mOutName, "joint_name"); dp.packS32(joint->mPriority, "joint_priority"); // compute coordinate frame rotation diff --git a/indra/llcharacter/llcharacter.cpp b/indra/llcharacter/llcharacter.cpp index 0b9732a718..033ac16274 100644 --- a/indra/llcharacter/llcharacter.cpp +++ b/indra/llcharacter/llcharacter.cpp @@ -280,8 +280,8 @@ BOOL LLCharacter::setVisualParamWeight(LLVisualParam* which_param, F32 weight, B //----------------------------------------------------------------------------- BOOL LLCharacter::setVisualParamWeight(const char* param_name, F32 weight, BOOL set_by_user) { - LLString tname(param_name); - LLString::toLower(tname); + std::string tname(param_name); + LLStringUtil::toLower(tname); char *tableptr = sVisualParamNames.checkString(tname); VisualParamNameMap_t::iterator name_iter = mVisualParamNameMap.find(tableptr); if (name_iter != mVisualParamNameMap.end()) @@ -331,8 +331,8 @@ F32 LLCharacter::getVisualParamWeight(LLVisualParam *which_param) //----------------------------------------------------------------------------- F32 LLCharacter::getVisualParamWeight(const char* param_name) { - LLString tname(param_name); - LLString::toLower(tname); + std::string tname(param_name); + LLStringUtil::toLower(tname); char *tableptr = sVisualParamNames.checkString(tname); VisualParamNameMap_t::iterator name_iter = mVisualParamNameMap.find(tableptr); if (name_iter != mVisualParamNameMap.end()) @@ -402,8 +402,8 @@ BOOL LLCharacter::visualParamWeightsAreDefault() //----------------------------------------------------------------------------- LLVisualParam* LLCharacter::getVisualParam(const char *param_name) { - LLString tname(param_name); - LLString::toLower(tname); + std::string tname(param_name); + LLStringUtil::toLower(tname); char *tableptr = sVisualParamNames.checkString(tname); VisualParamNameMap_t::iterator name_iter = mVisualParamNameMap.find(tableptr); if (name_iter != mVisualParamNameMap.end()) @@ -460,8 +460,8 @@ void LLCharacter::addVisualParam(LLVisualParam *param) if (param->getInfo()) { // Add name map - LLString tname(param->getName()); - LLString::toLower(tname); + std::string tname(param->getName()); + LLStringUtil::toLower(tname); char *tableptr = sVisualParamNames.addString(tname); std::pair nameres; nameres = mVisualParamNameMap.insert(VisualParamNameMap_t::value_type(tableptr, param)); diff --git a/indra/llcharacter/llgesture.cpp b/indra/llcharacter/llgesture.cpp index 283a06e37f..842fe0a9a8 100644 --- a/indra/llcharacter/llgesture.cpp +++ b/indra/llcharacter/llgesture.cpp @@ -191,11 +191,11 @@ LLGestureList::LLGestureList() mList.put(gesture); gesture = new LLGesture(KEY_F4, MASK_NONE, "/boogie", - LLUUID::null, "dance4", LLString::null ); + LLUUID::null, "dance4", LLStringUtil::null ); mList.put(gesture); gesture = new LLGesture(KEY_F5, MASK_SHIFT, "/tongue", - LLUUID::null, "Express_Tongue_Out", LLString::null ); + LLUUID::null, "Express_Tongue_Out", LLStringUtil::null ); mList.put(gesture); */ } @@ -219,9 +219,9 @@ void LLGestureList::deleteAll() // Iterates through space delimited tokens in string, triggering any gestures found. // Generates a revised string that has the found tokens replaced by their replacement strings // and (as a minor side effect) has multiple spaces in a row replaced by single spaces. -BOOL LLGestureList::triggerAndReviseString(const LLString &string, LLString* revised_string) +BOOL LLGestureList::triggerAndReviseString(const std::string &string, std::string* revised_string) { - LLString tokenized = string; + std::string tokenized = string; BOOL found_gestures = FALSE; BOOL first_token = TRUE; @@ -237,8 +237,8 @@ BOOL LLGestureList::triggerAndReviseString(const LLString &string, LLString* rev if( !found_gestures ) // Only pay attention to the first gesture in the string. { - LLString cur_token_lower = *token_iter; - LLString::toLower(cur_token_lower); + std::string cur_token_lower = *token_iter; + LLStringUtil::toLower(cur_token_lower); for (S32 i = 0; i < mList.count(); i++) { @@ -254,15 +254,15 @@ BOOL LLGestureList::triggerAndReviseString(const LLString &string, LLString* rev // Don't muck with the user's capitalization if we don't have to. const std::string& output = gesture->getOutputString(); - LLString output_lower = LLString(output.c_str()); - LLString::toLower(output_lower); + std::string output_lower = std::string(output.c_str()); + LLStringUtil::toLower(output_lower); if( cur_token_lower == output_lower ) { revised_string->append(*token_iter); } else { - revised_string->append(output.c_str()); + revised_string->append(output); } } diff --git a/indra/llcharacter/llgesture.h b/indra/llcharacter/llgesture.h index bab7fd0cc0..8e5aac94ba 100644 --- a/indra/llcharacter/llgesture.h +++ b/indra/llcharacter/llgesture.h @@ -93,7 +93,7 @@ public: BOOL trigger(KEY key, MASK mask); // Triggers if substring matches and generates revised string. - BOOL triggerAndReviseString(const LLString &string, LLString* revised_string); + BOOL triggerAndReviseString(const std::string &string, std::string* revised_string); // Used for construction from UI S32 count() const { return mList.count(); } diff --git a/indra/llcharacter/llhandmotion.cpp b/indra/llcharacter/llhandmotion.cpp index 511ccc7a88..2ddbaeccf9 100644 --- a/indra/llcharacter/llhandmotion.cpp +++ b/indra/llcharacter/llhandmotion.cpp @@ -201,16 +201,16 @@ void LLHandMotion::onDeactivate() //----------------------------------------------------------------------------- // LLHandMotion::getHandPoseName() //----------------------------------------------------------------------------- -LLString LLHandMotion::getHandPoseName(eHandPose pose) +std::string LLHandMotion::getHandPoseName(eHandPose pose) { if ((S32)pose < LLHandMotion::NUM_HAND_POSES && (S32)pose >= 0) { - return gHandPoseNames[pose]; + return std::string(gHandPoseNames[pose]); } - return ""; + return LLStringUtil::null; } -LLHandMotion::eHandPose LLHandMotion::getHandPose(LLString posename) +LLHandMotion::eHandPose LLHandMotion::getHandPose(std::string posename) { for (S32 pose = 0; pose < LLHandMotion::NUM_HAND_POSES; ++pose) { diff --git a/indra/llcharacter/llhandmotion.h b/indra/llcharacter/llhandmotion.h index 662800784b..8aed2f7101 100644 --- a/indra/llcharacter/llhandmotion.h +++ b/indra/llcharacter/llhandmotion.h @@ -126,8 +126,8 @@ public: virtual BOOL canDeprecate() { return FALSE; } - static LLString getHandPoseName(eHandPose pose); - static eHandPose getHandPose(LLString posename); + static std::string getHandPoseName(eHandPose pose); + static eHandPose getHandPose(std::string posename); public: //------------------------------------------------------------------------- diff --git a/indra/llcharacter/llkeyframemotion.cpp b/indra/llcharacter/llkeyframemotion.cpp index ce59349d55..d9e8407d44 100644 --- a/indra/llcharacter/llkeyframemotion.cpp +++ b/indra/llcharacter/llkeyframemotion.cpp @@ -657,7 +657,7 @@ BOOL LLKeyframeMotion::onActivate() // If the keyframe anim has an associated emote, trigger it. if( mEmoteName.length() > 0 ) { - mCharacter->startMotion( gAnimLibrary.stringToAnimState(mEmoteName.c_str()) ); + mCharacter->startMotion( gAnimLibrary.stringToAnimState(mEmoteName) ); } mLastLoopedTime = 0.f; @@ -1710,7 +1710,7 @@ BOOL LLKeyframeMotion::serialize(LLDataPacker& dp) const success &= dp.packU16(KEYFRAME_MOTION_SUBVERSION, "sub_version"); success &= dp.packS32(mJointMotionList->mBasePriority, "base_priority"); success &= dp.packF32(mJointMotionList->mDuration, "duration"); - success &= dp.packString(mEmoteName.c_str(), "emote_name"); + success &= dp.packString(mEmoteName, "emote_name"); success &= dp.packF32(mJointMotionList->mLoopInPoint, "loop_in_point"); success &= dp.packF32(mJointMotionList->mLoopOutPoint, "loop_out_point"); success &= dp.packS32(mJointMotionList->mLoop, "loop"); @@ -1722,7 +1722,7 @@ BOOL LLKeyframeMotion::serialize(LLDataPacker& dp) const for (U32 i = 0; i < mJointMotionList->getNumJointMotions(); i++) { JointMotion* joint_motionp = mJointMotionList->getJointMotion(i); - success &= dp.packString(joint_motionp->mJointName.c_str(), "joint_name"); + success &= dp.packString(joint_motionp->mJointName, "joint_name"); success &= dp.packS32(joint_motionp->mPriority, "joint_priority"); success &= dp.packS32(joint_motionp->mRotationCurve.mNumKeys, "num_rot_keys"); diff --git a/indra/llcharacter/llkeyframemotionparam.cpp b/indra/llcharacter/llkeyframemotionparam.cpp index 30edc29c6e..513b7688ce 100644 --- a/indra/llcharacter/llkeyframemotionparam.cpp +++ b/indra/llcharacter/llkeyframemotionparam.cpp @@ -345,10 +345,8 @@ BOOL LLKeyframeMotionParam::loadMotions() // Load named file by concatenating the character prefix with the motion name. // Load data into a buffer to be parsed. //------------------------------------------------------------------------- - char path[LL_MAX_PATH]; /* Flawfinder: ignore */ - snprintf( path,sizeof(path), "%s_%s.llp", - gDirUtilp->getExpandedFilename(LL_PATH_MOTIONS,mCharacter->getAnimationPrefix()).c_str(), - getName().c_str() ); + std::string path = gDirUtilp->getExpandedFilename(LL_PATH_MOTIONS,mCharacter->getAnimationPrefix()) + + "_" + getName() + ".llp"; //------------------------------------------------------------------------- // open the file @@ -435,7 +433,7 @@ BOOL LLKeyframeMotionParam::loadMotions() return FALSE; } - addKeyframeMotion(strA, gAnimLibrary.stringToAnimState(strA), strB, floatA); + addKeyframeMotion(strA, gAnimLibrary.stringToAnimState(std::string(strA)), strB, floatA); if (isFirstMotion) { isFirstMotion = FALSE; diff --git a/indra/llcharacter/llmultigesture.cpp b/indra/llcharacter/llmultigesture.cpp index d8db060a0c..0de4612bae 100644 --- a/indra/llcharacter/llmultigesture.cpp +++ b/indra/llcharacter/llmultigesture.cpp @@ -124,8 +124,8 @@ BOOL LLMultiGesture::serialize(LLDataPacker& dp) const dp.packS32(GESTURE_VERSION, "version"); dp.packU8(mKey, "key"); dp.packU32(mMask, "mask"); - dp.packString(mTrigger.c_str(), "trigger"); - dp.packString(mReplaceText.c_str(), "replace"); + dp.packString(mTrigger, "trigger"); + dp.packString(mReplaceText, "replace"); S32 count = (S32)mSteps.size(); dp.packS32(count, "step_count"); @@ -269,7 +269,7 @@ S32 LLGestureStepAnimation::getMaxSerialSize() const BOOL LLGestureStepAnimation::serialize(LLDataPacker& dp) const { - dp.packString(mAnimName.c_str(), "anim_name"); + dp.packString(mAnimName, "anim_name"); dp.packUUID(mAnimAssetID, "asset_id"); dp.packU32(mFlags, "flags"); return TRUE; @@ -344,7 +344,7 @@ S32 LLGestureStepSound::getMaxSerialSize() const BOOL LLGestureStepSound::serialize(LLDataPacker& dp) const { - dp.packString(mSoundName.c_str(), "sound_name"); + dp.packString(mSoundName, "sound_name"); dp.packUUID(mSoundAssetID, "asset_id"); dp.packU32(mFlags, "flags"); return TRUE; @@ -401,7 +401,7 @@ S32 LLGestureStepChat::getMaxSerialSize() const BOOL LLGestureStepChat::serialize(LLDataPacker& dp) const { - dp.packString(mChatText.c_str(), "chat_text"); + dp.packString(mChatText, "chat_text"); dp.packU32(mFlags, "flags"); return TRUE; } diff --git a/indra/llcharacter/llstatemachine.cpp b/indra/llcharacter/llstatemachine.cpp index b3432b2b49..e38f7351d3 100644 --- a/indra/llcharacter/llstatemachine.cpp +++ b/indra/llcharacter/llstatemachine.cpp @@ -206,7 +206,7 @@ LLFSMState* LLStateDiagram::getState(U32 state_id) return NULL; } -BOOL LLStateDiagram::saveDotFile(const char* filename) +BOOL LLStateDiagram::saveDotFile(const std::string& filename) { apr_file_t* dot_file = ll_apr_file_open(filename, LL_APR_W); diff --git a/indra/llcharacter/llstatemachine.h b/indra/llcharacter/llstatemachine.h index 5ae1668a11..cbf1e12adb 100644 --- a/indra/llcharacter/llstatemachine.h +++ b/indra/llcharacter/llstatemachine.h @@ -115,7 +115,7 @@ protected: public: // save the graph in a DOT file for rendering and visualization - BOOL saveDotFile(const char* filename); + BOOL saveDotFile(const std::string& filename); }; class LLStateMachine diff --git a/indra/llcharacter/llvisualparam.cpp b/indra/llcharacter/llvisualparam.cpp index 065bf9fabd..c1a792edc7 100644 --- a/indra/llcharacter/llvisualparam.cpp +++ b/indra/llcharacter/llvisualparam.cpp @@ -89,7 +89,7 @@ BOOL LLVisualParamInfo::parseXml(LLXmlTreeNode *node) } // attribute: sex - LLString sex = "both"; + std::string sex = "both"; static LLStdStringHandle sex_string = LLXmlTree::addAttributeString("sex"); node->getFastAttributeString( sex_string, sex ); // optional if( sex == "both" ) @@ -127,7 +127,7 @@ BOOL LLVisualParamInfo::parseXml(LLXmlTreeNode *node) // JC - make sure the display name includes the capitalization in the XML file, // not the lowercased version. - LLString::toLower(mName); + LLStringUtil::toLower(mName); // attribute: label_min static LLStdStringHandle label_min_string = LLXmlTree::addAttributeString("label_min"); diff --git a/indra/llcharacter/llvisualparam.h b/indra/llcharacter/llvisualparam.h index 43911f4ed7..f2f1d23802 100644 --- a/indra/llcharacter/llvisualparam.h +++ b/indra/llcharacter/llvisualparam.h @@ -71,10 +71,10 @@ public: protected: S32 mID; // ID associated with VisualParam - LLString mName; // name (for internal purposes) - LLString mDisplayName; // name displayed to the user - LLString mMinName; // name associated with minimum value - LLString mMaxName; // name associated with maximum value + std::string mName; // name (for internal purposes) + std::string mDisplayName; // name displayed to the user + std::string mMinName; // name associated with minimum value + std::string mMaxName; // name associated with maximum value EVisualParamGroup mGroup; // morph group for separating UI controls F32 mMinWeight; // minimum weight that can be assigned to this morph target F32 mMaxWeight; // maximum weight that can be assigned to this morph target @@ -114,14 +114,14 @@ public: S32 getID() { return mID; } void setID(S32 id) { llassert(!mInfo); mID = id; } - const LLString& getName() const { return mInfo->mName; } - const LLString& getDisplayName() const { return mInfo->mDisplayName; } - const LLString& getMaxDisplayName() const { return mInfo->mMaxName; } - const LLString& getMinDisplayName() const { return mInfo->mMinName; } - - void setDisplayName(const LLString& s) { mInfo->mDisplayName = s; } - void setMaxDisplayName(const LLString& s) { mInfo->mMaxName = s; } - void setMinDisplayName(const LLString& s) { mInfo->mMinName = s; } + const std::string& getName() const { return mInfo->mName; } + const std::string& getDisplayName() const { return mInfo->mDisplayName; } + const std::string& getMaxDisplayName() const { return mInfo->mMaxName; } + const std::string& getMinDisplayName() const { return mInfo->mMinName; } + + void setDisplayName(const std::string& s) { mInfo->mDisplayName = s; } + void setMaxDisplayName(const std::string& s) { mInfo->mMaxName = s; } + void setMinDisplayName(const std::string& s) { mInfo->mMinName = s; } EVisualParamGroup getGroup() { return mInfo->mGroup; } F32 getMinWeight() { return mInfo->mMinWeight; } diff --git a/indra/llcommon/llapr.cpp b/indra/llcommon/llapr.cpp index 5be3919898..e83473216a 100644 --- a/indra/llcommon/llapr.cpp +++ b/indra/llcommon/llapr.cpp @@ -129,7 +129,7 @@ void ll_apr_assert_status(apr_status_t status) } // File I/O -apr_file_t* ll_apr_file_open(const LLString& filename, apr_int32_t flags, S32* sizep, apr_pool_t* pool) +apr_file_t* ll_apr_file_open(const std::string& filename, apr_int32_t flags, S32* sizep, apr_pool_t* pool) { apr_file_t* apr_file; apr_status_t s; @@ -160,15 +160,15 @@ apr_file_t* ll_apr_file_open(const LLString& filename, apr_int32_t flags, S32* s return apr_file; } -apr_file_t* ll_apr_file_open(const LLString& filename, apr_int32_t flags, S32* sizep) +apr_file_t* ll_apr_file_open(const std::string& filename, apr_int32_t flags, S32* sizep) { return ll_apr_file_open(filename, flags, sizep, NULL); } -apr_file_t* ll_apr_file_open(const LLString& filename, apr_int32_t flags, apr_pool_t* pool) +apr_file_t* ll_apr_file_open(const std::string& filename, apr_int32_t flags, apr_pool_t* pool) { return ll_apr_file_open(filename, flags, NULL, pool); } -apr_file_t* ll_apr_file_open(const LLString& filename, apr_int32_t flags) +apr_file_t* ll_apr_file_open(const std::string& filename, apr_int32_t flags) { return ll_apr_file_open(filename, flags, NULL, NULL); } @@ -188,7 +188,7 @@ S32 ll_apr_file_read(apr_file_t* apr_file, void *buf, S32 nbytes) } } -S32 ll_apr_file_read_ex(const LLString& filename, apr_pool_t* pool, void *buf, S32 offset, S32 nbytes) +S32 ll_apr_file_read_ex(const std::string& filename, apr_pool_t* pool, void *buf, S32 offset, S32 nbytes) { if (pool == NULL) pool = gAPRPoolp; apr_file_t* filep = ll_apr_file_open(filename, APR_READ|APR_BINARY, pool); @@ -230,7 +230,7 @@ S32 ll_apr_file_write(apr_file_t* apr_file, const void *buf, S32 nbytes) } } -S32 ll_apr_file_write_ex(const LLString& filename, apr_pool_t* pool, void *buf, S32 offset, S32 nbytes) +S32 ll_apr_file_write_ex(const std::string& filename, apr_pool_t* pool, void *buf, S32 offset, S32 nbytes) { if (pool == NULL) pool = gAPRPoolp; apr_int32_t flags = APR_CREATE|APR_WRITE|APR_BINARY; @@ -287,7 +287,7 @@ S32 ll_apr_file_seek(apr_file_t* apr_file, apr_seek_where_t where, S32 offset) } } -bool ll_apr_file_remove(const LLString& filename, apr_pool_t* pool) +bool ll_apr_file_remove(const std::string& filename, apr_pool_t* pool) { apr_status_t s; if (pool == NULL) pool = gAPRPoolp; @@ -301,7 +301,7 @@ bool ll_apr_file_remove(const LLString& filename, apr_pool_t* pool) return true; } -bool ll_apr_file_rename(const LLString& filename, const LLString& newname, apr_pool_t* pool) +bool ll_apr_file_rename(const std::string& filename, const std::string& newname, apr_pool_t* pool) { apr_status_t s; if (pool == NULL) pool = gAPRPoolp; @@ -315,7 +315,7 @@ bool ll_apr_file_rename(const LLString& filename, const LLString& newname, apr_p return true; } -bool ll_apr_file_exists(const LLString& filename, apr_pool_t* pool) +bool ll_apr_file_exists(const std::string& filename, apr_pool_t* pool) { apr_file_t* apr_file; apr_status_t s; @@ -332,7 +332,7 @@ bool ll_apr_file_exists(const LLString& filename, apr_pool_t* pool) } } -S32 ll_apr_file_size(const LLString& filename, apr_pool_t* pool) +S32 ll_apr_file_size(const std::string& filename, apr_pool_t* pool) { apr_file_t* apr_file; apr_finfo_t info; @@ -358,7 +358,7 @@ S32 ll_apr_file_size(const LLString& filename, apr_pool_t* pool) } } -bool ll_apr_dir_make(const LLString& dirname, apr_pool_t* pool) +bool ll_apr_dir_make(const std::string& dirname, apr_pool_t* pool) { apr_status_t s; if (pool == NULL) pool = gAPRPoolp; @@ -372,7 +372,7 @@ bool ll_apr_dir_make(const LLString& dirname, apr_pool_t* pool) return true; } -bool ll_apr_dir_remove(const LLString& dirname, apr_pool_t* pool) +bool ll_apr_dir_remove(const std::string& dirname, apr_pool_t* pool) { apr_status_t s; if (pool == NULL) pool = gAPRPoolp; diff --git a/indra/llcommon/llapr.h b/indra/llcommon/llapr.h index 3927d5f014..403d504932 100644 --- a/indra/llcommon/llapr.h +++ b/indra/llcommon/llapr.h @@ -130,24 +130,24 @@ typedef LLAtomic32 LLAtomicS32; #define LL_APR_WB (APR_CREATE|APR_TRUNCATE|APR_WRITE|APR_BINARY) // "wb" #define LL_APR_RPB (APR_READ|APR_WRITE|APR_BINARY) // "r+b" #define LL_APR_WPB (APR_CREATE|APR_TRUNCATE|APR_READ|APR_WRITE|APR_BINARY) // "w+b" -apr_file_t* ll_apr_file_open(const LLString& filename, apr_int32_t flags, S32* sizep, apr_pool_t* pool); -apr_file_t* ll_apr_file_open(const LLString& filename, apr_int32_t flags, S32* sizep); -apr_file_t* ll_apr_file_open(const LLString& filename, apr_int32_t flags, apr_pool_t* pool); -apr_file_t* ll_apr_file_open(const LLString& filename, apr_int32_t flags); +apr_file_t* ll_apr_file_open(const std::string& filename, apr_int32_t flags, S32* sizep, apr_pool_t* pool); +apr_file_t* ll_apr_file_open(const std::string& filename, apr_int32_t flags, S32* sizep); +apr_file_t* ll_apr_file_open(const std::string& filename, apr_int32_t flags, apr_pool_t* pool); +apr_file_t* ll_apr_file_open(const std::string& filename, apr_int32_t flags); // Returns actual offset, -1 if seek fails S32 ll_apr_file_seek(apr_file_t* apr_file, apr_seek_where_t where, S32 offset); // Returns bytes read/written, 0 if read/write fails: S32 ll_apr_file_read(apr_file_t* apr_file, void* buf, S32 nbytes); -S32 ll_apr_file_read_ex(const LLString& filename, apr_pool_t* pool, void *buf, S32 offset, S32 nbytes); +S32 ll_apr_file_read_ex(const std::string& filename, apr_pool_t* pool, void *buf, S32 offset, S32 nbytes); S32 ll_apr_file_write(apr_file_t* apr_file, const void* buf, S32 nbytes); -S32 ll_apr_file_write_ex(const LLString& filename, apr_pool_t* pool, void *buf, S32 offset, S32 nbytes); +S32 ll_apr_file_write_ex(const std::string& filename, apr_pool_t* pool, void *buf, S32 offset, S32 nbytes); // returns false if failure: -bool ll_apr_file_remove(const LLString& filename, apr_pool_t* pool = NULL); -bool ll_apr_file_rename(const LLString& filename, const LLString& newname, apr_pool_t* pool = NULL); -bool ll_apr_file_exists(const LLString& filename, apr_pool_t* pool = NULL); -S32 ll_apr_file_size(const LLString& filename, apr_pool_t* pool = NULL); -bool ll_apr_dir_make(const LLString& dirname, apr_pool_t* pool = NULL); -bool ll_apr_dir_remove(const LLString& dirname, apr_pool_t* pool = NULL); +bool ll_apr_file_remove(const std::string& filename, apr_pool_t* pool = NULL); +bool ll_apr_file_rename(const std::string& filename, const std::string& newname, apr_pool_t* pool = NULL); +bool ll_apr_file_exists(const std::string& filename, apr_pool_t* pool = NULL); +S32 ll_apr_file_size(const std::string& filename, apr_pool_t* pool = NULL); +bool ll_apr_dir_make(const std::string& dirname, apr_pool_t* pool = NULL); +bool ll_apr_dir_remove(const std::string& dirname, apr_pool_t* pool = NULL); /** * @brief Function which approprately logs error or remains quiet on diff --git a/indra/llcommon/llassettype.cpp b/indra/llcommon/llassettype.cpp index 06504b53fd..368c85acb0 100644 --- a/indra/llcommon/llassettype.cpp +++ b/indra/llcommon/llassettype.cpp @@ -75,7 +75,7 @@ asset_info_t asset_types[] = LLAssetType::EType LLAssetType::getType(const std::string& sin) { std::string s = sin; - LLString::toUpper(s); + LLStringUtil::toUpper(s); for (S32 idx = 0; ;idx++) { asset_info_t* info = asset_types + idx; @@ -180,10 +180,15 @@ const char* LLAssetType::lookup( LLAssetType::EType type ) // static LLAssetType::EType LLAssetType::lookup( const char* name ) +{ + return lookup(ll_safe_string(name)); +} + +LLAssetType::EType LLAssetType::lookup( const std::string& name ) { for( S32 i = 0; i < AT_COUNT; i++ ) { - if( 0 == strcmp(name, mAssetTypeNames[i]) ) + if( name == mAssetTypeNames[i] ) { // match return (EType)i; @@ -207,10 +212,15 @@ const char* LLAssetType::lookupHumanReadable(LLAssetType::EType type) // static LLAssetType::EType LLAssetType::lookupHumanReadable( const char* name ) +{ + return lookupHumanReadable(ll_safe_string(name)); +} + +LLAssetType::EType LLAssetType::lookupHumanReadable( const std::string& name ) { for( S32 i = 0; i < AT_COUNT; i++ ) { - if( 0 == strcmp(name, mAssetTypeHumanNames[i]) ) + if( name == mAssetTypeHumanNames[i] ) { // match return (EType)i; diff --git a/indra/llcommon/llassettype.h b/indra/llcommon/llassettype.h index f71e0b98cd..ad254703f0 100644 --- a/indra/llcommon/llassettype.h +++ b/indra/llcommon/llassettype.h @@ -145,11 +145,13 @@ public: }; // machine transation between type and strings - static EType lookup(const char* name); + static EType lookup(const char* name); // safe conversion to std::string, *TODO: deprecate + static EType lookup(const std::string& name); static const char* lookup(EType type); // translation from a type to a human readable form. - static EType lookupHumanReadable( const char* name ); + static EType lookupHumanReadable( const char* name ); // safe conversion to std::string, *TODO: deprecate + static EType lookupHumanReadable( const std::string& name ); static const char* lookupHumanReadable(EType type); static EDragAndDropType lookupDragAndDropType( EType ); diff --git a/indra/llcommon/llchat.h b/indra/llcommon/llchat.h index 0ae16380b4..b6f84b25b5 100644 --- a/indra/llcommon/llchat.h +++ b/indra/llcommon/llchat.h @@ -68,7 +68,7 @@ typedef enum e_chat_audible_level class LLChat { public: - LLChat(const LLString& text = LLString::null) + LLChat(const std::string& text = LLStringUtil::null) : mText(text), mFromName(), mFromID(), @@ -80,8 +80,8 @@ public: mPosAgent() { } - LLString mText; // UTF-8 line of text - LLString mFromName; // agent or object name + std::string mText; // UTF-8 line of text + std::string mFromName; // agent or object name LLUUID mFromID; // agent id or object id EChatSourceType mSourceType; EChatType mChatType; diff --git a/indra/llcommon/llcrc.cpp b/indra/llcommon/llcrc.cpp index 0836ccb66b..ea90b4f22f 100644 --- a/indra/llcommon/llcrc.cpp +++ b/indra/llcommon/llcrc.cpp @@ -163,9 +163,9 @@ void LLCRC::update(const U8* buffer, size_t buffer_size) } } -void LLCRC::update(const char* filename) +void LLCRC::update(const std::string& filename) { - if (!filename) + if (filename.empty()) { llerrs << "No filename specified" << llendl; return; diff --git a/indra/llcommon/llcrc.h b/indra/llcommon/llcrc.h index 287c1fbc41..8eab84799f 100644 --- a/indra/llcommon/llcrc.h +++ b/indra/llcommon/llcrc.h @@ -60,7 +60,7 @@ public: U32 getCRC() const; void update(U8 next_byte); void update(const U8* buffer, size_t buffer_size); - void update(const char *filename); + void update(const std::string& filename); #ifdef _DEBUG // This function runs tests to make sure the crc is diff --git a/indra/llcommon/llerror.cpp b/indra/llcommon/llerror.cpp index 1d85bc0e70..b3d3122397 100644 --- a/indra/llcommon/llerror.cpp +++ b/indra/llcommon/llerror.cpp @@ -102,7 +102,7 @@ namespace { public: RecordToFile(const std::string& filename) { - mFile.open(filename.c_str(), llofstream::out | llofstream::app); + mFile.open(filename, llofstream::out | llofstream::app); if (!mFile) { llinfos << "Error setting log file to " << filename << llendl; @@ -196,7 +196,7 @@ namespace { virtual void recordMessage(LLError::ELevel level, const std::string& message) { - mBuffer.addLine(message.c_str()); + mBuffer.addLine(message); } private: @@ -305,7 +305,7 @@ namespace std::string file = dirBase + "logcontrol-dev.xml"; llstat stat_info; - if (LLFile::stat(file.c_str(), &stat_info)) { + if (LLFile::stat(file, &stat_info)) { // NB: stat returns non-zero if it can't read the file, for example // if it doesn't exist. LLFile has no better abstraction for // testing for file existence. @@ -321,7 +321,7 @@ namespace LLSD configuration; { - llifstream file(filename().c_str()); + llifstream file(filename()); if (file.is_open()) { LLSDSerialize::fromXML(configuration, file); diff --git a/indra/llcommon/llevent.cpp b/indra/llcommon/llevent.cpp index 292d0909a4..4f3962154e 100644 --- a/indra/llcommon/llevent.cpp +++ b/indra/llcommon/llevent.cpp @@ -219,7 +219,7 @@ std::vector LLSimpleDispatcher::getListeners() const bool LLSimpleDispatcher::fireEvent(LLPointer event, LLSD filter) { std::vector::iterator itor; - LLString filter_string = filter.asString(); + std::string filter_string = filter.asString(); for (itor=mListeners.begin(); itor!=mListeners.end(); ++itor) { LLListenerEntry& entry = *itor; diff --git a/indra/llcommon/llfile.cpp b/indra/llcommon/llfile.cpp index 6b8f8e68c5..8f7a8ded63 100644 --- a/indra/llcommon/llfile.cpp +++ b/indra/llcommon/llfile.cpp @@ -44,7 +44,7 @@ using namespace std; // static -int LLFile::mkdir(const char* dirname, int perms) +int LLFile::mkdir(const std::string& dirname, int perms) { #if LL_WINDOWS // permissions are ignored on Windows @@ -52,12 +52,12 @@ int LLFile::mkdir(const char* dirname, int perms) llutf16string utf16dirname = utf8str_to_utf16str(utf8dirname); return _wmkdir(utf16dirname.c_str()); #else - return ::mkdir(dirname, (mode_t)perms); + return ::mkdir(dirname.c_str(), (mode_t)perms); #endif } // static -int LLFile::rmdir(const char* dirname) +int LLFile::rmdir(const std::string& dirname) { #if LL_WINDOWS // permissions are ignored on Windows @@ -65,29 +65,29 @@ int LLFile::rmdir(const char* dirname) llutf16string utf16dirname = utf8str_to_utf16str(utf8dirname); return _wrmdir(utf16dirname.c_str()); #else - return ::rmdir(dirname); + return ::rmdir(dirname.c_str()); #endif } // static -LLFILE* LLFile::fopen(const char* filename, const char* mode) /* Flawfinder: ignore */ +LLFILE* LLFile::fopen(const std::string& filename, const char* mode) /* Flawfinder: ignore */ { #if LL_WINDOWS std::string utf8filename = filename; - std::string utf8mode = mode; + std::string utf8mode = std::string(mode); llutf16string utf16filename = utf8str_to_utf16str(utf8filename); llutf16string utf16mode = utf8str_to_utf16str(utf8mode); return _wfopen(utf16filename.c_str(),utf16mode.c_str()); #else - return ::fopen(filename,mode); /* Flawfinder: ignore */ + return ::fopen(filename.c_str(),mode); /* Flawfinder: ignore */ #endif } -LLFILE* LLFile::_fsopen(const char* filename, const char* mode, int sharingFlag) +LLFILE* LLFile::_fsopen(const std::string& filename, const char* mode, int sharingFlag) { #if LL_WINDOWS std::string utf8filename = filename; - std::string utf8mode = mode; + std::string utf8mode = std::string(mode); llutf16string utf16filename = utf8str_to_utf16str(utf8filename); llutf16string utf16mode = utf8str_to_utf16str(utf8mode); return _wfsopen(utf16filename.c_str(),utf16mode.c_str(),sharingFlag); @@ -97,18 +97,18 @@ LLFILE* LLFile::_fsopen(const char* filename, const char* mode, int sharingFlag) #endif } -int LLFile::remove(const char* filename) +int LLFile::remove(const std::string& filename) { #if LL_WINDOWS std::string utf8filename = filename; llutf16string utf16filename = utf8str_to_utf16str(utf8filename); return _wremove(utf16filename.c_str()); #else - return ::remove(filename); + return ::remove(filename.c_str()); #endif } -int LLFile::rename(const char* filename, const char* newname) +int LLFile::rename(const std::string& filename, const std::string& newname) { #if LL_WINDOWS std::string utf8filename = filename; @@ -117,29 +117,29 @@ int LLFile::rename(const char* filename, const char* newname) llutf16string utf16newname = utf8str_to_utf16str(utf8newname); return _wrename(utf16filename.c_str(),utf16newname.c_str()); #else - return ::rename(filename,newname); + return ::rename(filename.c_str(),newname.c_str()); #endif } -int LLFile::stat(const char* filename, llstat* filestatus) +int LLFile::stat(const std::string& filename, llstat* filestatus) { #if LL_WINDOWS std::string utf8filename = filename; llutf16string utf16filename = utf8str_to_utf16str(utf8filename); return _wstat(utf16filename.c_str(),filestatus); #else - return ::stat(filename,filestatus); + return ::stat(filename.c_str(),filestatus); #endif } -bool LLFile::isdir(const char *filename) +bool LLFile::isdir(const std::string& filename) { llstat st; return stat(filename, &st) == 0 && S_ISDIR(st.st_mode); } -bool LLFile::isfile(const char *filename) +bool LLFile::isfile(const std::string& filename) { llstat st; @@ -181,7 +181,7 @@ const char *LLFile::tmpdir() #if USE_LLFILESTREAMS -LLFILE * LLFile::_Fiopen(const char *filename, std::ios::openmode mode,int) // protection currently unused +LLFILE * LLFile::_Fiopen(const std::string& filename, std::ios::openmode mode,int) // protection currently unused { // open a file static const char *mods[] = { // fopen mode strings corresponding to valid[i] @@ -250,7 +250,7 @@ void llifstream::close() } } -void llifstream::open(const char* _Filename, /* Flawfinder: ignore */ +void llifstream::open(const std::string& _Filename, /* Flawfinder: ignore */ ios_base::openmode _Mode, int _Prot) { // open a C stream with specified mode @@ -282,7 +282,7 @@ llifstream::~llifstream() delete _Filebuffer; } -llifstream::llifstream(const char *_Filename, +llifstream::llifstream(const std::string& _Filename, ios_base::openmode _Mode, int _Prot) : std::basic_istream< char , std::char_traits< char > >(NULL,true),_Filebuffer(NULL),_ShouldClose(false) @@ -301,7 +301,7 @@ bool llofstream::is_open() const return false; } -void llofstream::open(const char* _Filename, /* Flawfinder: ignore */ +void llofstream::open(const std::string& _Filename, /* Flawfinder: ignore */ ios_base::openmode _Mode, int _Prot) { // open a C stream with specified mode @@ -327,7 +327,7 @@ void llofstream::close() } } -llofstream::llofstream(const char *_Filename, +llofstream::llofstream(const std::string& _Filename, std::ios_base::openmode _Mode, int _Prot) : std::basic_ostream >(NULL,true),_Filebuffer(NULL),_ShouldClose(false) diff --git a/indra/llcommon/llfile.h b/indra/llcommon/llfile.h index bd51ac2aa9..a196dad814 100644 --- a/indra/llcommon/llfile.h +++ b/indra/llcommon/llfile.h @@ -67,24 +67,27 @@ typedef struct stat llstat; # define S_ISDIR(x) (((x) & S_IFMT) == S_IFDIR) #endif +#include "llstring.h" // safe char* -> std::string conversion + class LLFile { public: // All these functions take UTF8 path/filenames. - static LLFILE* fopen(const char* filename,const char* accessmode); /* Flawfinder: ignore */ - static LLFILE* _fsopen(const char* filename,const char* accessmode,int sharingFlag); + static LLFILE* fopen(const std::string& filename,const char* accessmode); /* Flawfinder: ignore */ + static LLFILE* _fsopen(const std::string& filename,const char* accessmode,int sharingFlag); // perms is a permissions mask like 0777 or 0700. In most cases it will // be overridden by the user's umask. It is ignored on Windows. - static int mkdir(const char* filename, int perms = 0700); - - static int rmdir(const char* filename); - static int remove(const char* filename); - static int rename(const char* filename,const char* newname); - static int stat(const char* filename,llstat* file_status); - static bool isdir(const char* filename); - static bool isfile(const char* filename); - static LLFILE * _Fiopen(const char *filename, std::ios::openmode mode,int); // protection currently unused + static int mkdir(const std::string& filename, int perms = 0700); + + static int rmdir(const std::string& filename); + static int remove(const std::string& filename); + static int rename(const std::string& filename,const std::string& newname); + static int stat(const std::string& filename,llstat* file_status); + static bool isdir(const std::string& filename); + static bool isfile(const std::string& filename); + static LLFILE * _Fiopen(const std::string& filename, std::ios::openmode mode,int); // protection currently unused + static const char * tmpdir(); }; @@ -104,7 +107,7 @@ public: { // construct unopened } - explicit llifstream(const char *_Filename, + explicit llifstream(const std::string& _Filename, ios_base::openmode _Mode = ios_base::in, int _Prot = (int)ios_base::_Openprot); @@ -121,7 +124,7 @@ public: return _Filebuffer; } bool is_open() const; - void open(const char* _Filename, /* Flawfinder: ignore */ + void open(const std::string& _Filename, /* Flawfinder: ignore */ ios_base::openmode _Mode = ios_base::in, int _Prot = (int)ios_base::_Openprot); void close(); @@ -144,7 +147,7 @@ public: { // construct unopened } - explicit llofstream(const char *_Filename, + explicit llofstream(const std::string& _Filename, std::ios_base::openmode _Mode = ios_base::out, int _Prot = (int)std::ios_base::_Openprot); @@ -165,7 +168,7 @@ public: bool is_open() const; - void open(const char *_Filename,ios_base::openmode _Mode = ios_base::out,int _Prot = (int)ios_base::_Openprot); /* Flawfinder: ignore */ + void open(const std::string& _Filename,ios_base::openmode _Mode = ios_base::out,int _Prot = (int)ios_base::_Openprot); /* Flawfinder: ignore */ void close(); @@ -178,8 +181,45 @@ private: #else //Use standard file streams on non windows platforms -#define llifstream std::ifstream -#define llofstream std::ofstream +//#define llifstream std::ifstream +//#define llofstream std::ofstream + +class llifstream : public std::ifstream +{ +public: + llifstream() : std::ifstream() + { + } + + explicit llifstream(const std::string& _Filename, std::_Ios_Openmode _Mode = in) + : std::ifstream(_Filename.c_str(), _Mode) + { + } + void open(const std::string& _Filename, std::_Ios_Openmode _Mode = in) /* Flawfinder: ignore */ + { + std::ifstream::open(_Filename.c_str(), _Mode); + } +}; + + +class llofstream : public std::ofstream +{ +public: + llofstream() : std::ofstream() + { + } + + explicit llofstream(const std::string& _Filename, std::_Ios_Openmode _Mode = out) + : std::ofstream(_Filename.c_str(), _Mode) + { + } + + void open(const std::string& _Filename, std::_Ios_Openmode _Mode = out) /* Flawfinder: ignore */ + { + std::ofstream::open(_Filename.c_str(), _Mode); + } + +}; #endif diff --git a/indra/llcommon/llfixedbuffer.cpp b/indra/llcommon/llfixedbuffer.cpp index 44bb953f80..fde4db98a1 100644 --- a/indra/llcommon/llfixedbuffer.cpp +++ b/indra/llcommon/llfixedbuffer.cpp @@ -54,7 +54,7 @@ void LLFixedBuffer::clear() } -void LLFixedBuffer::addLine(const LLString& utf8line) +void LLFixedBuffer::addLine(const std::string& utf8line) { LLWString wstring = utf8str_to_wstring(utf8line); LLFixedBuffer::addLine(wstring); diff --git a/indra/llcommon/llfixedbuffer.h b/indra/llcommon/llfixedbuffer.h index 148c0e60db..0a23fb30d1 100644 --- a/indra/llcommon/llfixedbuffer.h +++ b/indra/llcommon/llfixedbuffer.h @@ -52,7 +52,7 @@ public: std::deque mLineLengths; void clear(); // Clear the buffer, and reset it. - virtual void addLine(const LLString& utf8line); + virtual void addLine(const std::string& utf8line); virtual void addLine(const LLWString& line); // Get lines currently in the buffer, up to max_size chars, max_length lines diff --git a/indra/llcommon/llliveappconfig.cpp b/indra/llcommon/llliveappconfig.cpp index 76432770a3..418a34b662 100644 --- a/indra/llcommon/llliveappconfig.cpp +++ b/indra/llcommon/llliveappconfig.cpp @@ -51,7 +51,7 @@ void LLLiveAppConfig::loadFile() { llinfos << "LLLiveAppConfig::loadFile(): reading from " << filename() << llendl; - llifstream file(filename().c_str()); + llifstream file(filename()); LLSD config; if (file.is_open()) { diff --git a/indra/llcommon/lllivefile.cpp b/indra/llcommon/lllivefile.cpp index cb3ce0f8d2..8c625bce90 100644 --- a/indra/llcommon/lllivefile.cpp +++ b/indra/llcommon/lllivefile.cpp @@ -93,7 +93,7 @@ bool LLLiveFile::Impl::check() // Stat the file to see if it exists and when it was last modified. llstat stat_data; - int res = LLFile::stat(mFilename.c_str(), &stat_data); + int res = LLFile::stat(mFilename, &stat_data); if (res) { diff --git a/indra/llcommon/llprocessor.cpp b/indra/llcommon/llprocessor.cpp index 29a3cf32a8..87c6e57fdd 100644 --- a/indra/llcommon/llprocessor.cpp +++ b/indra/llcommon/llprocessor.cpp @@ -2216,12 +2216,12 @@ bool CProcessor::CPUInfoToText(char *strBuffer, unsigned int uiMaxLen) return true; } -// bool CProcessor::WriteInfoTextFile(const char *strFilename) +// bool CProcessor::WriteInfoTextFile(const std::string& strFilename) // =========================================================== // Takes use of CProcessor::CPUInfoToText and saves the string to a // file /////////////////////////////////////////////////////////////////// -bool CProcessor::WriteInfoTextFile(const char *strFilename) +bool CProcessor::WriteInfoTextFile(const std::string& strFilename) { char buf[16384]; /* Flawfinder: ignore */ diff --git a/indra/llcommon/llprocessor.h b/indra/llcommon/llprocessor.h index 6b966c5339..30bc14d6ce 100644 --- a/indra/llcommon/llprocessor.h +++ b/indra/llcommon/llprocessor.h @@ -188,7 +188,7 @@ public: F64 GetCPUFrequency(unsigned int uiMeasureMSecs); const ProcessorInfo *GetCPUInfo(); bool CPUInfoToText(char *strBuffer, unsigned int uiMaxLen); - bool WriteInfoTextFile(const char *strFilename); + bool WriteInfoTextFile(const std::string& strFilename); }; diff --git a/indra/llcommon/llsd.h b/indra/llcommon/llsd.h index 307d73608c..0382fb1360 100644 --- a/indra/llcommon/llsd.h +++ b/indra/llcommon/llsd.h @@ -394,7 +394,7 @@ std::ostream& operator<<(std::ostream& s, const LLSD& llsd); - as UTF8 encoded strings (making not like UUID<->String) - as Base64 or Base96 encoded (making like UUID<->String) - Conversions to std::string and LLUUID do not result in easy assignment - to std::string, LLString or LLUUID due to non-unique conversion paths + to std::string, std::string or LLUUID due to non-unique conversion paths */ #endif // LL_LLSD_NEW_H diff --git a/indra/llcommon/llsdserialize.cpp b/indra/llcommon/llsdserialize.cpp index 6bb75439a2..d496230dd8 100644 --- a/indra/llcommon/llsdserialize.cpp +++ b/indra/llcommon/llsdserialize.cpp @@ -1230,8 +1230,7 @@ void LLSDFormatter::realFormat(const std::string& format) void LLSDFormatter::formatReal(LLSD::Real real, std::ostream& ostr) const { - char buffer[MAX_STRING]; /* Flawfinder: ignore */ - snprintf(buffer, MAX_STRING, mRealFormat.c_str(), real); /* Flawfinder: ignore */ + std::string buffer = llformat(mRealFormat.c_str(), real); ostr << buffer; } diff --git a/indra/llcommon/llsdserialize_xml.cpp b/indra/llcommon/llsdserialize_xml.cpp index 592dfc9bc0..e23f765957 100644 --- a/indra/llcommon/llsdserialize_xml.cpp +++ b/indra/llcommon/llsdserialize_xml.cpp @@ -63,7 +63,7 @@ S32 LLSDXMLFormatter::format(const LLSD& data, std::ostream& ostr, U32 options) { std::streamsize old_precision = ostr.precision(25); - LLString post = ""; + std::string post; if (options & LLSDFormatter::OPTIONS_PRETTY) { post = "\n"; @@ -79,8 +79,8 @@ S32 LLSDXMLFormatter::format(const LLSD& data, std::ostream& ostr, U32 options) S32 LLSDXMLFormatter::format_impl(const LLSD& data, std::ostream& ostr, U32 options, U32 level) const { S32 format_count = 1; - LLString pre = ""; - LLString post = ""; + std::string pre; + std::string post; if (options & LLSDFormatter::OPTIONS_PRETTY) { diff --git a/indra/llcommon/llsdutil.cpp b/indra/llcommon/llsdutil.cpp index 6f26447695..137539cc04 100644 --- a/indra/llcommon/llsdutil.cpp +++ b/indra/llcommon/llsdutil.cpp @@ -145,12 +145,11 @@ LLSD ll_binary_from_string(const LLSD& sd) { std::vector binary_value; - LLString string_value = sd.asString(); - const char* string_p = string_value.c_str(); - while (*string_p) + std::string string_value = sd.asString(); + for (std::string::iterator iter = string_value.begin(); + iter != string_value.end(); ++iter) { - binary_value.push_back(*string_p); - string_p++; + binary_value.push_back(*iter); } binary_value.push_back('\0'); diff --git a/indra/llcommon/llsecondlifeurls.cpp b/indra/llcommon/llsecondlifeurls.cpp index bf09453c16..207d704f2a 100644 --- a/indra/llcommon/llsecondlifeurls.cpp +++ b/indra/llcommon/llsecondlifeurls.cpp @@ -32,56 +32,56 @@ #include "linden_common.h" #include "llsecondlifeurls.h" -const char CREATE_ACCOUNT_URL[] = - "http://secondlife.com/registration/"; +const std::string CREATE_ACCOUNT_URL ( + "http://secondlife.com/registration/"); -const char MANAGE_ACCOUNT[] = - "http://secondlife.com/account/"; +const std::string MANAGE_ACCOUNT ( + "http://secondlife.com/account/"); -const char AUCTION_URL[] = - "http://secondlife.com/auctions/auction-detail.php?id="; +const std::string AUCTION_URL ( + "http://secondlife.com/auctions/auction-detail.php?id="); -const char EVENTS_URL[] = - "http://secondlife.com/events/"; +const std::string EVENTS_URL ( + "http://secondlife.com/events/"); -const char TIER_UP_URL[] = - "http://secondlife.com/app/landtier"; +const std::string TIER_UP_URL ( + "http://secondlife.com/app/landtier"); -const char LAND_URL[] = - "http://secondlife.com/app/landtier"; +const std::string LAND_URL ( + "http://secondlife.com/app/landtier"); -const char UPGRADE_TO_PREMIUM_URL[] = - "http://secondlife.com/app/upgrade/"; +const std::string UPGRADE_TO_PREMIUM_URL ( + "http://secondlife.com/app/upgrade/"); -const char DIRECTX_9_URL[] = - "http://secondlife.com/support/"; +const std::string DIRECTX_9_URL ( + "http://secondlife.com/support/"); -const char AMD_AGP_URL[] = - "http://secondlife.com/support/"; +const std::string AMD_AGP_URL ( + "http://secondlife.com/support/"); -const char VIA_URL[] = - "http://secondlife.com/support/"; +const std::string VIA_URL ( + "http://secondlife.com/support/"); -const char SUPPORT_URL[] = - "http://secondlife.com/support/"; +const std::string SUPPORT_URL ( + "http://secondlife.com/support/"); -const char INTEL_CHIPSET_URL[] = - "http://secondlife.com/support/"; +const std::string INTEL_CHIPSET_URL ( + "http://secondlife.com/support/"); -const char SIS_CHIPSET_URL[] = - "http://secondlife.com/support/"; +const std::string SIS_CHIPSET_URL ( + "http://secondlife.com/support/"); -const char BLOGS_URL[] = - "http://blog.secondlife.com/"; +const std::string BLOGS_URL ( + "http://blog.secondlife.com/"); -const char BUY_CURRENCY_URL[] = - "http://secondlife.com/app/currency/"; +const std::string BUY_CURRENCY_URL ( + "http://secondlife.com/app/currency/"); -const char LSL_DOC_URL[] = - "http://secondlife.com/app/lsldoc/"; +const std::string LSL_DOC_URL ( + "http://secondlife.com/app/lsldoc/"); -const char SL_KB_URL[] = - "http://secondlife.com/knowledgebase/"; +const std::string SL_KB_URL ( + "http://secondlife.com/knowledgebase/"); -const char RELEASE_NOTES[] = "releasenotes.txt"; +const std::string RELEASE_NOTES ( "releasenotes.txt"); diff --git a/indra/llcommon/llsecondlifeurls.h b/indra/llcommon/llsecondlifeurls.h index b8d8aa2402..0847c8378b 100644 --- a/indra/llcommon/llsecondlifeurls.h +++ b/indra/llcommon/llsecondlifeurls.h @@ -33,46 +33,46 @@ #define LL_LLSECONDLIFEURLS_H // Account registration web page -extern const char CREATE_ACCOUNT_URL[]; +extern const std::string CREATE_ACCOUNT_URL; // Manage Account -extern const char MANAGE_ACCOUNT[]; +extern const std::string MANAGE_ACCOUNT; -extern const char AUCTION_URL[]; +extern const std::string AUCTION_URL; -extern const char EVENTS_URL[]; +extern const std::string EVENTS_URL; // Tier up to a new land level. -extern const char TIER_UP_URL[]; +extern const std::string TIER_UP_URL; // Tier up to a new land level. -extern const char LAND_URL[]; +extern const std::string LAND_URL; // Upgrade from basic membership to premium membership -extern const char UPGRADE_TO_PREMIUM_URL[]; +extern const std::string UPGRADE_TO_PREMIUM_URL; // How to get DirectX 9 -extern const char DIRECTX_9_URL[]; +extern const std::string DIRECTX_9_URL; // Out of date VIA chipset -extern const char VIA_URL[]; +extern const std::string VIA_URL; // Support URL -extern const char SUPPORT_URL[]; +extern const std::string SUPPORT_URL; // Linden Blogs page -extern const char BLOGS_URL[]; +extern const std::string BLOGS_URL; // Currency page -extern const char BUY_CURRENCY_URL[]; +extern const std::string BUY_CURRENCY_URL; // LSL script wiki -extern const char LSL_DOC_URL[]; +extern const std::string LSL_DOC_URL; // SL KnowledgeBase page -extern const char SL_KB_URL[]; +extern const std::string SL_KB_URL; // Local Url Release Notes -extern const char RELEASE_NOTES[]; +extern const std::string RELEASE_NOTES; #endif diff --git a/indra/llcommon/llstring.cpp b/indra/llcommon/llstring.cpp index 3a8756a31f..0d50919e26 100644 --- a/indra/llcommon/llstring.cpp +++ b/indra/llcommon/llstring.cpp @@ -1,6 +1,6 @@ /** * @file llstring.cpp - * @brief String utility functions and the LLString class. + * @brief String utility functions and the std::string class. * * $LicenseInfo:firstyear=2001&license=viewergpl$ * @@ -47,6 +47,12 @@ std::string ll_safe_string(const char* in) return std::string(); } +std::string ll_safe_string(const char* in, S32 maxlen) +{ + if(in) return std::string(in, maxlen); + return std::string(); +} + U8 hex_as_nybble(char hex) { if((hex >= '0') && (hex <= '9')) @@ -65,7 +71,7 @@ U8 hex_as_nybble(char hex) } -bool _read_file_into_string(std::string& str, const char* filename) +bool _read_file_into_string(std::string& str, const std::string& filename) { llifstream ifs(filename, llifstream::binary); if (!ifs.is_open()) @@ -174,20 +180,6 @@ S32 utf16chars_to_wchar(const U16* inchars, llwchar* outchar) return inchars - base; } -S32 utf16chars_to_utf8chars(const U16* inchars, char* outchars, S32* nchars8p) -{ - // Get 32 bit char32 - llwchar char32; - S32 nchars16 = utf16chars_to_wchar(inchars, &char32); - // Convert to utf8 - S32 nchars8 = wchar_to_utf8chars(char32, outchars); - if (nchars8p) - { - *nchars8p = nchars8; - } - return nchars16; -} - llutf16string wstring_to_utf16str(const LLWString &utf32str, S32 len) { llutf16string out; @@ -216,7 +208,7 @@ llutf16string wstring_to_utf16str(const LLWString &utf32str) return wstring_to_utf16str(utf32str, len); } -llutf16string utf8str_to_utf16str ( const LLString& utf8str ) +llutf16string utf8str_to_utf16str ( const std::string& utf8str ) { LLWString wstr = utf8str_to_wstring ( utf8str ); return wstring_to_utf16str ( wstr ); @@ -492,210 +484,10 @@ std::string utf16str_to_utf8str(const llutf16string& utf16str, S32 len) return wstring_to_utf8str(utf16str_to_wstring(utf16str, len), len); } - -//LLWString wstring_truncate(const LLWString &wstr, const S32 max_len) -//{ -// return wstr.substr(0, llmin((S32)wstr.length(), max_len)); -//} -// -// -//LLWString wstring_trim(const LLWString &wstr) -//{ -// LLWString outstr; -// outstr = wstring_trimhead(wstr); -// outstr = wstring_trimtail(outstr); -// return outstr; -//} -// -// -//LLWString wstring_trimhead(const LLWString &wstr) -//{ -// if(wstr.empty()) -// { -// return wstr; -// } -// -// S32 i = 0; -// while((i < (S32)wstr.length()) && iswspace(wstr[i])) -// { -// i++; -// } -// return wstr.substr(i, wstr.length() - i); -//} -// -// -//LLWString wstring_trimtail(const LLWString &wstr) -//{ -// if(wstr.empty()) -// { -// return wstr; -// } -// -// S32 len = (S32)wstr.length(); -// -// S32 i = len - 1; -// while (i >= 0 && iswspace(wstr[i])) -// { -// i--; -// } -// -// if (i >= 0) -// { -// return wstr.substr(0, i + 1); -// } -// return wstr; -//} -// -// -//LLWString wstring_copyinto(const LLWString &dest, const LLWString &src, const S32 insert_offset) -//{ -// llassert( insert_offset <= (S32)dest.length() ); -// -// LLWString out_str = dest.substr(0, insert_offset); -// out_str += src; -// LLWString tail = dest.substr(insert_offset); -// out_str += tail; -// -// return out_str; -//} - - -//LLWString wstring_detabify(const LLWString &wstr, const S32 num_spaces) -//{ -// LLWString out_str; -// // Replace tabs with spaces -// for (S32 i = 0; i < (S32)wstr.length(); i++) -// { -// if (wstr[i] == '\t') -// { -// for (S32 j = 0; j < num_spaces; j++) -// out_str += ' '; -// } -// else -// { -// out_str += wstr[i]; -// } -// } -// return out_str; -//} - - -//LLWString wstring_makeASCII(const LLWString &wstr) -//{ -// // Replace non-ASCII chars with replace_char -// LLWString out_str = wstr; -// for (S32 i = 0; i < (S32)out_str.length(); i++) -// { -// if (out_str[i] > 0x7f) -// { -// out_str[i] = LL_UNKNOWN_CHAR; -// } -// } -// return out_str; -//} - - -//LLWString wstring_substChar(const LLWString &wstr, const llwchar target_char, const llwchar replace_char) -//{ -// // Replace all occurences of target_char with replace_char -// LLWString out_str = wstr; -// for (S32 i = 0; i < (S32)out_str.length(); i++) -// { -// if (out_str[i] == target_char) -// { -// out_str[i] = replace_char; -// } -// } -// return out_str; -//} -// -// -//LLWString wstring_tolower(const LLWString &wstr) -//{ -// LLWString out_str = wstr; -// for (S32 i = 0; i < (S32)out_str.length(); i++) -// { -// out_str[i] = towlower(out_str[i]); -// } -// return out_str; -//} -// -// -//LLWString wstring_convert_to_lf(const LLWString &wstr) -//{ -// const llwchar CR = 13; -// // Remove carriage returns from string with CRLF -// LLWString out_str; -// -// for (S32 i = 0; i < (S32)wstr.length(); i++) -// { -// if (wstr[i] != CR) -// { -// out_str += wstr[i]; -// } -// } -// return out_str; -//} -// -// -//LLWString wstring_convert_to_crlf(const LLWString &wstr) -//{ -// const llwchar LF = 10; -// const llwchar CR = 13; -// // Remove carriage returns from string with CRLF -// LLWString out_str; -// -// for (S32 i = 0; i < (S32)wstr.length(); i++) -// { -// if (wstr[i] == LF) -// { -// out_str += CR; -// } -// out_str += wstr[i]; -// } -// return out_str; -//} - - -//S32 wstring_compare_insensitive(const LLWString &lhs, const LLWString &rhs) -//{ -// -// if (lhs == rhs) -// { -// return 0; -// } -// -// if (lhs.empty()) -// { -// return rhs.empty() ? 0 : 1; -// } -// -// if (rhs.empty()) -// { -// return -1; -// } -// -//#ifdef LL_LINUX -// // doesn't work because gcc 2.95 doesn't correctly implement c_str(). Sigh... -// llerrs << "wstring_compare_insensitive doesn't work on Linux!" << llendl; -// return 0; -//#else -// LLWString lhs_lower = lhs; -// LLWString::toLower(lhs_lower); -// std::string lhs_lower = wstring_to_utf8str(lhs_lower); -// LLWString rhs_lower = lhs; -// LLWString::toLower(rhs_lower); -// std::string rhs_lower = wstring_to_utf8str(rhs_lower); -// -// return strcmp(lhs_lower.c_str(), rhs_lower.c_str()); -//#endif -//} - - std::string utf8str_trim(const std::string& utf8str) { LLWString wstr = utf8str_to_wstring(utf8str); - LLWString::trim(wstr); + LLWStringUtil::trim(wstr); return wstring_to_utf8str(wstr); } @@ -703,7 +495,7 @@ std::string utf8str_trim(const std::string& utf8str) std::string utf8str_tolower(const std::string& utf8str) { LLWString out_str = utf8str_to_wstring(utf8str); - LLWString::toLower(out_str); + LLWStringUtil::toLower(out_str); return wstring_to_utf8str(out_str); } @@ -712,7 +504,7 @@ S32 utf8str_compare_insensitive(const std::string& lhs, const std::string& rhs) { LLWString wlhs = utf8str_to_wstring(lhs); LLWString wrhs = utf8str_to_wstring(rhs); - return LLWString::compareInsensitive(wlhs.c_str(), wrhs.c_str()); + return LLWStringUtil::compareInsensitive(wlhs, wrhs); } std::string utf8str_truncate(const std::string& utf8str, const S32 max_len) @@ -756,7 +548,7 @@ std::string utf8str_substChar( const llwchar replace_char) { LLWString wstr = utf8str_to_wstring(utf8str); - LLWString::replaceChar(wstr, target_char, replace_char); + LLWStringUtil::replaceChar(wstr, target_char, replace_char); //wstr = wstring_substChar(wstr, target_char, replace_char); return wstring_to_utf8str(wstr); } @@ -764,7 +556,7 @@ std::string utf8str_substChar( std::string utf8str_makeASCII(const std::string& utf8str) { LLWString wstr = utf8str_to_wstring(utf8str); - LLWString::_makeASCII(wstr); + LLWStringUtil::_makeASCII(wstr); return wstring_to_utf8str(wstr); } @@ -964,19 +756,19 @@ namespace LLStringFn #ifdef _DEBUG template -void LLStringBase::testHarness() +void LLStringUtilBase::testHarness() { - LLString s1; + std::string s1; llassert( s1.c_str() == NULL ); llassert( s1.size() == 0 ); llassert( s1.empty() ); - LLString s2( "hello"); + std::string s2( "hello"); llassert( !strcmp( s2.c_str(), "hello" ) ); llassert( s2.size() == 5 ); llassert( !s2.empty() ); - LLString s3( s2 ); + std::string s3( s2 ); llassert( "hello" == s2 ); llassert( s2 == "hello" ); @@ -985,12 +777,12 @@ void LLStringBase::testHarness() llassert( "gello" != s2 ); llassert( s2 != "gello" ); - LLString s4 = s2; + std::string s4 = s2; llassert( !s4.empty() ); s4.empty(); llassert( s4.empty() ); - LLString s5(""); + std::string s5(""); llassert( s5.empty() ); llassert( isValidIndex(s5, 0) ); @@ -1004,8 +796,8 @@ void LLStringBase::testHarness() llassert( s4 == "hello again!hello again!" ); - LLString s6 = s2 + " " + s2; - LLString s7 = s6; + std::string s6 = s2 + " " + s2; + std::string s7 = s6; llassert( s6 == s7 ); llassert( !( s6 != s7) ); llassert( !(s6 < s7) ); @@ -1028,10 +820,10 @@ void LLStringBase::testHarness() s2.insert( 1, "awn, don't yel"); llassert( s2 == "yawn, don't yell"); - LLString s8 = s2.substr( 6, 5 ); + std::string s8 = s2.substr( 6, 5 ); llassert( s8 == "don't" ); - LLString s9 = " \t\ntest \t\t\n "; + std::string s9 = " \t\ntest \t\t\n "; trim(s9); llassert( s9 == "test" ); @@ -1046,17 +838,17 @@ void LLStringBase::testHarness() llassert( s9 == "abc123&*(abc" ); - LLString s10( 10, 'x' ); + std::string s10( 10, 'x' ); llassert( s10 == "xxxxxxxxxx" ); - LLString s11( "monkey in the middle", 7, 2 ); + std::string s11( "monkey in the middle", 7, 2 ); llassert( s11 == "in" ); - LLString s12; //empty + std::string s12; //empty s12 += "foo"; llassert( s12 == "foo" ); - LLString s13; //empty + std::string s13; //empty s13 += 'f'; llassert( s13 == "f" ); } diff --git a/indra/llcommon/llstring.h b/indra/llcommon/llstring.h index 18cfe4b64c..50681b7967 100644 --- a/indra/llcommon/llstring.h +++ b/indra/llcommon/llstring.h @@ -1,6 +1,6 @@ /** * @file llstring.h - * @brief String utility functions and LLString class. + * @brief String utility functions and std::string class. * * $LicenseInfo:firstyear=2001&license=viewergpl$ * @@ -155,50 +155,19 @@ public: static BOOL isDigit(llwchar a) { return iswdigit(a) != 0; } }; -//RN: I used a templated base class instead of a pure interface class to minimize code duplication -// but it might be worthwhile to just go with two implementations (LLString and LLWString) of -// an interface class, unless we can think of a good reason to have a std::basic_string polymorphic base - -// **************************************************************** -// NOTA BENE: do *NOT* dynamically allocate memory inside of LLStringBase as the {*()^#%*)#%W^*)#%*)STL implentation -// of basic_string doesn't provide a virtual destructor. If we need to allocate resources specific to LLString -// then we should either customize std::basic_string to linden::basic_string or change LLString to be a wrapper -// that contains an instance of std::basic_string. Similarly, overriding methods defined in std::basic_string will *not* -// be called in a polymorphic manner (passing an instance of basic_string to a particular function) -// **************************************************************** - template -class LLStringBase : public std::basic_string +class LLStringUtilBase { public: typedef typename std::basic_string::size_type size_type; - // naming convention follows those set for LLUUID -// static LLStringBase null; // deprecated for std::string compliance -// static LLStringBase zero_length; // deprecated for std::string compliance - - - // standard constructors - LLStringBase() : std::basic_string() {} - LLStringBase(const LLStringBase& s): std::basic_string(s) {} - LLStringBase(const std::basic_string& s) : std::basic_string(s) {} - LLStringBase(const std::basic_string& s, size_type pos, size_type n = std::basic_string::npos) - : std::basic_string(s, pos, n) {} - LLStringBase(size_type count, const T& c) : std::basic_string() { assign(count, c);} - // custom constructors - LLStringBase(const T* s); - LLStringBase(const T* s, size_type n); - LLStringBase(const T* s, size_type pos, size_type n ); - - bool operator==(const T* _Right) const { return _Right ? (std::basic_string::compare(_Right) == 0) : this->empty(); } - public: ///////////////////////////////////////////////////////////////////////////////////////// // Static Utility functions that operate on std::strings - static LLStringBase null; + static std::basic_string null; - typedef std::map format_map_t; + typedef std::map, std::basic_string > format_map_t; static S32 format(std::basic_string& s, const format_map_t& fmt_map); static BOOL isValidIndex(const std::basic_string& string, size_type i) @@ -230,8 +199,8 @@ public: /** * @brief Unsafe way to make ascii characters. You should probably * only call this when interacting with the host operating system. - * The 1 byte LLString does not work correctly. - * The 2 and 4 byte LLString probably work, so LLWString::_makeASCII + * The 1 byte std::string does not work correctly. + * The 2 and 4 byte std::string probably work, so LLWStringUtil::_makeASCII * should work. */ static void _makeASCII(std::basic_string& string); @@ -253,11 +222,13 @@ public: // Like strcmp but also handles empty strings. Uses // current locale. static S32 compareStrings(const T* lhs, const T* rhs); + static S32 compareStrings(const std::basic_string& lhs, const std::basic_string& rhs); // case insensitive version of above. Uses current locale on // Win32, and falls back to a non-locale aware comparison on // Linux. static S32 compareInsensitive(const T* lhs, const T* rhs); + static S32 compareInsensitive(const std::basic_string& lhs, const std::basic_string& rhs); // Case sensitive comparison with good handling of numbers. Does not use current locale. // a.k.a. strdictcmp() @@ -284,21 +255,21 @@ public: }; -template LLStringBase LLStringBase::null; +template std::basic_string LLStringUtilBase::null; -typedef LLStringBase LLString; -typedef LLStringBase LLWString; +typedef LLStringUtilBase LLStringUtil; +typedef LLStringUtilBase LLWStringUtil; +typedef std::basic_string LLWString; //@ Use this where we want to disallow input in the form of "foo" // This is used to catch places where english text is embedded in the code // instead of in a translatable XUI file. -class LLStringExplicit : public LLString +class LLStringExplicit : public std::string { public: - explicit LLStringExplicit(const char* s) : LLString(s) {} - LLStringExplicit(const LLString& s) : LLString(s) {} - LLStringExplicit(const std::string& s) : LLString(s) {} - LLStringExplicit(const std::string& s, size_type pos, size_type n = std::string::npos) : LLString(s, pos, n) {} + explicit LLStringExplicit(const char* s) : std::string(s) {} + LLStringExplicit(const std::string& s) : std::string(s) {} + LLStringExplicit(const std::string& s, size_type pos, size_type n = std::string::npos) : std::string(s, pos, n) {} }; struct LLDictionaryLess @@ -306,7 +277,7 @@ struct LLDictionaryLess public: bool operator()(const std::string& a, const std::string& b) { - return (LLString::precedesDict(a, b) ? true : false); + return (LLStringUtil::precedesDict(a, b) ? true : false); } }; @@ -335,6 +306,7 @@ inline std::string chop_tail_copy( * pointer is NULL. */ std::string ll_safe_string(const char* in); +std::string ll_safe_string(const char* in, S32 maxlen); /** * @brief This translates a nybble stored as a hex value from 0-f back @@ -351,7 +323,7 @@ U8 hex_as_nybble(char hex); * @param filename The full name of the file to read. * @return Returns true on success. If false, str is unmodified. */ -bool _read_file_into_string(std::string& str, const char* filename); +bool _read_file_into_string(std::string& str, const std::string& filename); /** * Unicode support @@ -373,20 +345,17 @@ LLWString utf16str_to_wstring(const llutf16string &utf16str); llutf16string wstring_to_utf16str(const LLWString &utf32str, S32 len); llutf16string wstring_to_utf16str(const LLWString &utf32str); -llutf16string utf8str_to_utf16str ( const LLString& utf8str, S32 len); -llutf16string utf8str_to_utf16str ( const LLString& utf8str ); +llutf16string utf8str_to_utf16str ( const std::string& utf8str, S32 len); +llutf16string utf8str_to_utf16str ( const std::string& utf8str ); LLWString utf8str_to_wstring(const std::string &utf8str, S32 len); LLWString utf8str_to_wstring(const std::string &utf8str); // Same function, better name. JC inline LLWString utf8string_to_wstring(const std::string& utf8_string) { return utf8str_to_wstring(utf8_string); } -// Special hack for llfilepicker.cpp: -S32 utf16chars_to_utf8chars(const U16* inchars, char* outchars, S32* nchars8 = 0); -S32 utf16chars_to_wchar(const U16* inchars, llwchar* outchar); +// S32 wchar_to_utf8chars(llwchar inchar, char* outchars); -// std::string wstring_to_utf8str(const LLWString &utf32str, S32 len); std::string wstring_to_utf8str(const LLWString &utf32str); @@ -448,15 +417,6 @@ std::string mbcsstring_makeASCII(const std::string& str); std::string utf8str_removeCRLF(const std::string& utf8str); -template -std::ostream& operator<<(std::ostream &s, const LLStringBase &str) -{ - s << ((std::basic_string)str); - return s; -} - -std::ostream& operator<<(std::ostream &s, const LLWString &wstr); - #if LL_WINDOWS /* @name Windows string helpers */ @@ -492,7 +452,7 @@ std::string ll_convert_wide_to_string(const wchar_t* in); #endif // LL_WINDOWS /** - * Many of the 'strip' and 'replace' methods of LLStringBase need + * Many of the 'strip' and 'replace' methods of LLStringUtilBase need * specialization to work with the signed char type. * Sadly, it is not possible (AFAIK) to specialize a single method of * a template class. @@ -558,11 +518,12 @@ namespace LLStringFn // static template -S32 LLStringBase::format(std::basic_string& s, const format_map_t& fmt_map) +S32 LLStringUtilBase::format(std::basic_string& s, const format_map_t& fmt_map) { typedef typename std::basic_string::size_type string_size_type_t; + typedef typename format_map_t::const_iterator format_map_const_iterator_t; S32 res = 0; - for (format_map_t::const_iterator iter = fmt_map.begin(); iter != fmt_map.end(); ++iter) + for (format_map_const_iterator_t iter = fmt_map.begin(); iter != fmt_map.end(); ++iter) { U32 fmtlen = iter->first.size(); string_size_type_t n = 0; @@ -584,7 +545,7 @@ S32 LLStringBase::format(std::basic_string& s, const format_map_t& fmt_map // static template -S32 LLStringBase::compareStrings(const T* lhs, const T* rhs) +S32 LLStringUtilBase::compareStrings(const T* lhs, const T* rhs) { S32 result; if( lhs == rhs ) @@ -608,9 +569,16 @@ S32 LLStringBase::compareStrings(const T* lhs, const T* rhs) return result; } +//static +template +S32 LLStringUtilBase::compareStrings(const std::basic_string& lhs, const std::basic_string& rhs) +{ + return LLStringOps::collate(lhs.c_str(), rhs.c_str()); +} + // static template -S32 LLStringBase::compareInsensitive(const T* lhs, const T* rhs ) +S32 LLStringUtilBase::compareInsensitive(const T* lhs, const T* rhs ) { S32 result; if( lhs == rhs ) @@ -629,22 +597,32 @@ S32 LLStringBase::compareInsensitive(const T* lhs, const T* rhs ) } else { - LLStringBase lhs_string(lhs); - LLStringBase rhs_string(rhs); - LLStringBase::toUpper(lhs_string); - LLStringBase::toUpper(rhs_string); + std::basic_string lhs_string(lhs); + std::basic_string rhs_string(rhs); + LLStringUtilBase::toUpper(lhs_string); + LLStringUtilBase::toUpper(rhs_string); result = LLStringOps::collate(lhs_string.c_str(), rhs_string.c_str()); } return result; } +//static +template +S32 LLStringUtilBase::compareInsensitive(const std::basic_string& lhs, const std::basic_string& rhs) +{ + std::basic_string lhs_string(lhs); + std::basic_string rhs_string(rhs); + LLStringUtilBase::toUpper(lhs_string); + LLStringUtilBase::toUpper(rhs_string); + return LLStringOps::collate(lhs_string.c_str(), rhs_string.c_str()); +} // Case sensitive comparison with good handling of numbers. Does not use current locale. // a.k.a. strdictcmp() //static template -S32 LLStringBase::compareDict(const std::basic_string& astr, const std::basic_string& bstr) +S32 LLStringUtilBase::compareDict(const std::basic_string& astr, const std::basic_string& bstr) { const T* a = astr.c_str(); const T* b = bstr.c_str(); @@ -683,8 +661,9 @@ S32 LLStringBase::compareDict(const std::basic_string& astr, const std::ba return ca-cb; } +// static template -S32 LLStringBase::compareDictInsensitive(const std::basic_string& astr, const std::basic_string& bstr) +S32 LLStringUtilBase::compareDictInsensitive(const std::basic_string& astr, const std::basic_string& bstr) { const T* a = astr.c_str(); const T* b = bstr.c_str(); @@ -719,11 +698,11 @@ S32 LLStringBase::compareDictInsensitive(const std::basic_string& astr, co // Puts compareDict() in a form appropriate for LL container classes to use for sorting. // static template -BOOL LLStringBase::precedesDict( const std::basic_string& a, const std::basic_string& b ) +BOOL LLStringUtilBase::precedesDict( const std::basic_string& a, const std::basic_string& b ) { if( a.size() && b.size() ) { - return (LLStringBase::compareDict(a.c_str(), b.c_str()) < 0); + return (LLStringUtilBase::compareDict(a.c_str(), b.c_str()) < 0); } else { @@ -731,28 +710,9 @@ BOOL LLStringBase::precedesDict( const std::basic_string& a, const std::ba } } -// Constructors -template -LLStringBase::LLStringBase(const T* s ) : std::basic_string() -{ - if (s) assign(s); -} - -template -LLStringBase::LLStringBase(const T* s, size_type n ) : std::basic_string() -{ - if (s) assign(s, n); -} - -// Init from a substring -template -LLStringBase::LLStringBase(const T* s, size_type pos, size_type n ) -: std::basic_string( (s ? s : std::basic_string() ), pos, n ) -{ } - //static template -void LLStringBase::toUpper(std::basic_string& string) +void LLStringUtilBase::toUpper(std::basic_string& string) { if( !string.empty() ) { @@ -766,7 +726,7 @@ void LLStringBase::toUpper(std::basic_string& string) //static template -void LLStringBase::toLower(std::basic_string& string) +void LLStringUtilBase::toLower(std::basic_string& string) { if( !string.empty() ) { @@ -780,7 +740,7 @@ void LLStringBase::toLower(std::basic_string& string) //static template -void LLStringBase::trimHead(std::basic_string& string) +void LLStringUtilBase::trimHead(std::basic_string& string) { if( !string.empty() ) { @@ -795,7 +755,7 @@ void LLStringBase::trimHead(std::basic_string& string) //static template -void LLStringBase::trimTail(std::basic_string& string) +void LLStringUtilBase::trimTail(std::basic_string& string) { if( string.size() ) { @@ -814,7 +774,7 @@ void LLStringBase::trimTail(std::basic_string& string) // Replace line feeds with carriage return-line feed pairs. //static template -void LLStringBase::addCRLF(std::basic_string& string) +void LLStringUtilBase::addCRLF(std::basic_string& string) { const T LF = 10; const T CR = 13; @@ -855,7 +815,7 @@ void LLStringBase::addCRLF(std::basic_string& string) // Remove all carriage returns //static template -void LLStringBase::removeCRLF(std::basic_string& string) +void LLStringUtilBase::removeCRLF(std::basic_string& string) { const T CR = 13; @@ -876,7 +836,7 @@ void LLStringBase::removeCRLF(std::basic_string& string) //static template -void LLStringBase::replaceChar( std::basic_string& string, T target, T replacement ) +void LLStringUtilBase::replaceChar( std::basic_string& string, T target, T replacement ) { size_type found_pos = 0; for (found_pos = string.find(target, found_pos); @@ -889,7 +849,7 @@ void LLStringBase::replaceChar( std::basic_string& string, T target, T rep //static template -void LLStringBase::replaceNonstandardASCII( std::basic_string& string, T replacement ) +void LLStringUtilBase::replaceNonstandardASCII( std::basic_string& string, T replacement ) { const char LF = 10; const S8 MIN = 32; @@ -909,12 +869,12 @@ void LLStringBase::replaceNonstandardASCII( std::basic_string& string, T r //static template -void LLStringBase::replaceTabsWithSpaces( std::basic_string& str, size_type spaces_per_tab ) +void LLStringUtilBase::replaceTabsWithSpaces( std::basic_string& str, size_type spaces_per_tab ) { const T TAB = '\t'; const T SPACE = ' '; - LLStringBase out_str; + std::basic_string out_str; // Replace tabs with spaces for (size_type i = 0; i < str.length(); i++) { @@ -933,7 +893,7 @@ void LLStringBase::replaceTabsWithSpaces( std::basic_string& str, size_typ //static template -BOOL LLStringBase::containsNonprintable(const std::basic_string& string) +BOOL LLStringUtilBase::containsNonprintable(const std::basic_string& string) { const char MIN = 32; BOOL rv = FALSE; @@ -950,7 +910,7 @@ BOOL LLStringBase::containsNonprintable(const std::basic_string& string) //static template -void LLStringBase::stripNonprintable(std::basic_string& string) +void LLStringUtilBase::stripNonprintable(std::basic_string& string) { const char MIN = 32; size_type j = 0; @@ -981,7 +941,7 @@ void LLStringBase::stripNonprintable(std::basic_string& string) } template -void LLStringBase::_makeASCII(std::basic_string& string) +void LLStringUtilBase::_makeASCII(std::basic_string& string) { // Replace non-ASCII chars with LL_UNKNOWN_CHAR for (size_type i = 0; i < string.length(); i++) @@ -995,7 +955,7 @@ void LLStringBase::_makeASCII(std::basic_string& string) // static template -void LLStringBase::copy( T* dst, const T* src, size_type dst_size ) +void LLStringUtilBase::copy( T* dst, const T* src, size_type dst_size ) { if( dst_size > 0 ) { @@ -1011,7 +971,7 @@ void LLStringBase::copy( T* dst, const T* src, size_type dst_size ) // static template -void LLStringBase::copyInto(std::basic_string& dst, const std::basic_string& src, size_type offset) +void LLStringUtilBase::copyInto(std::basic_string& dst, const std::basic_string& src, size_type offset) { if ( offset == dst.length() ) { @@ -1032,7 +992,7 @@ void LLStringBase::copyInto(std::basic_string& dst, const std::basic_strin // True if this is the head of s. //static template -BOOL LLStringBase::isHead( const std::basic_string& string, const T* s ) +BOOL LLStringUtilBase::isHead( const std::basic_string& string, const T* s ) { if( string.empty() ) { @@ -1046,14 +1006,14 @@ BOOL LLStringBase::isHead( const std::basic_string& string, const T* s ) } template -BOOL LLStringBase::convertToBOOL(const std::basic_string& string, BOOL& value) +BOOL LLStringUtilBase::convertToBOOL(const std::basic_string& string, BOOL& value) { if( string.empty() ) { return FALSE; } - LLStringBase temp( string ); + std::basic_string temp( string ); trim(temp); if( (temp == "1") || @@ -1083,7 +1043,7 @@ BOOL LLStringBase::convertToBOOL(const std::basic_string& string, BOOL& va } template -BOOL LLStringBase::convertToU8(const std::basic_string& string, U8& value) +BOOL LLStringUtilBase::convertToU8(const std::basic_string& string, U8& value) { S32 value32 = 0; BOOL success = convertToS32(string, value32); @@ -1096,7 +1056,7 @@ BOOL LLStringBase::convertToU8(const std::basic_string& string, U8& value) } template -BOOL LLStringBase::convertToS8(const std::basic_string& string, S8& value) +BOOL LLStringUtilBase::convertToS8(const std::basic_string& string, S8& value) { S32 value32 = 0; BOOL success = convertToS32(string, value32); @@ -1109,7 +1069,7 @@ BOOL LLStringBase::convertToS8(const std::basic_string& string, S8& value) } template -BOOL LLStringBase::convertToS16(const std::basic_string& string, S16& value) +BOOL LLStringUtilBase::convertToS16(const std::basic_string& string, S16& value) { S32 value32 = 0; BOOL success = convertToS32(string, value32); @@ -1122,7 +1082,7 @@ BOOL LLStringBase::convertToS16(const std::basic_string& string, S16& valu } template -BOOL LLStringBase::convertToU16(const std::basic_string& string, U16& value) +BOOL LLStringUtilBase::convertToU16(const std::basic_string& string, U16& value) { S32 value32 = 0; BOOL success = convertToS32(string, value32); @@ -1135,14 +1095,14 @@ BOOL LLStringBase::convertToU16(const std::basic_string& string, U16& valu } template -BOOL LLStringBase::convertToU32(const std::basic_string& string, U32& value) +BOOL LLStringUtilBase::convertToU32(const std::basic_string& string, U32& value) { if( string.empty() ) { return FALSE; } - LLStringBase temp( string ); + std::basic_string temp( string ); trim(temp); U32 v; std::basic_istringstream i_stream((std::basic_string)temp); @@ -1162,14 +1122,14 @@ BOOL LLStringBase::convertToU32(const std::basic_string& string, U32& valu } template -BOOL LLStringBase::convertToS32(const std::basic_string& string, S32& value) +BOOL LLStringUtilBase::convertToS32(const std::basic_string& string, S32& value) { if( string.empty() ) { return FALSE; } - LLStringBase temp( string ); + std::basic_string temp( string ); trim(temp); S32 v; std::basic_istringstream i_stream((std::basic_string)temp); @@ -1189,7 +1149,7 @@ BOOL LLStringBase::convertToS32(const std::basic_string& string, S32& valu } template -BOOL LLStringBase::convertToF32(const std::basic_string& string, F32& value) +BOOL LLStringUtilBase::convertToF32(const std::basic_string& string, F32& value) { F64 value64 = 0.0; BOOL success = convertToF64(string, value64); @@ -1202,14 +1162,14 @@ BOOL LLStringBase::convertToF32(const std::basic_string& string, F32& valu } template -BOOL LLStringBase::convertToF64(const std::basic_string& string, F64& value) +BOOL LLStringUtilBase::convertToF64(const std::basic_string& string, F64& value) { if( string.empty() ) { return FALSE; } - LLStringBase temp( string ); + std::basic_string temp( string ); trim(temp); F64 v; std::basic_istringstream i_stream((std::basic_string)temp); @@ -1229,7 +1189,7 @@ BOOL LLStringBase::convertToF64(const std::basic_string& string, F64& valu } template -void LLStringBase::truncate(std::basic_string& string, size_type count) +void LLStringUtilBase::truncate(std::basic_string& string, size_type count) { size_type cur_size = string.size(); string.resize(count < cur_size ? count : cur_size); diff --git a/indra/llcommon/llsys.cpp b/indra/llcommon/llsys.cpp index 8700d9681e..d78a8591cb 100644 --- a/indra/llcommon/llsys.cpp +++ b/indra/llcommon/llsys.cpp @@ -143,28 +143,22 @@ LLOSInfo::LLOSInfo() : std::string csdversion = utf16str_to_utf8str(osvi.szCSDVersion); // Display version, service pack (if any), and build number. - char tmp[MAX_STRING]; /* Flawfinder: ignore */ + std::string tmpstr; if(osvi.dwMajorVersion <= 4) { - snprintf( /* Flawfinder: ignore */ - tmp, - sizeof(tmp), - "version %d.%d %s (Build %d)", - osvi.dwMajorVersion, - osvi.dwMinorVersion, - csdversion.c_str(), - (osvi.dwBuildNumber & 0xffff)); + tmpstr = llformat("version %d.%d %s (Build %d)", + osvi.dwMajorVersion, + osvi.dwMinorVersion, + csdversion.c_str(), + (osvi.dwBuildNumber & 0xffff)); } else { - snprintf( /* Flawfinder: ignore */ - tmp, - sizeof(tmp), - "%s (Build %d)", - csdversion.c_str(), - (osvi.dwBuildNumber & 0xffff)); + tmpstr = llformat("%s (Build %d)", + csdversion.c_str(), + (osvi.dwBuildNumber & 0xffff)); } - mOSString = mOSStringSimple + tmp; + mOSString = mOSStringSimple + tmpstr; } break; @@ -397,7 +391,7 @@ LLCPUInfo::LLCPUInfo() mCPUString = out.str(); #elif LL_LINUX - std::map< LLString, LLString > cpuinfo; + std::map< std::string, std::string > cpuinfo; LLFILE* cpuinfo_fp = LLFile::fopen(CPUINFO_FILE, "rb"); if(cpuinfo_fp) { @@ -420,21 +414,21 @@ LLCPUInfo::LLCPUInfo() if (nlspot == NULL) nlspot = line + strlen( line ); // Fallback to terminating NUL std::string linename( line, tabspot ); - LLString llinename(linename); - LLString::toLower(llinename); + std::string llinename(linename); + LLStringUtil::toLower(llinename); std::string lineval( spacespot + 1, nlspot ); cpuinfo[ llinename ] = lineval; } fclose(cpuinfo_fp); } # if LL_X86 - LLString flags = " " + cpuinfo["flags"] + " "; - LLString::toLower(flags); + std::string flags = " " + cpuinfo["flags"] + " "; + LLStringUtil::toLower(flags); mHasSSE = ( flags.find( " sse " ) != std::string::npos ); mHasSSE2 = ( flags.find( " sse2 " ) != std::string::npos ); F64 mhz; - if (LLString::convertToF64(cpuinfo["cpu mhz"], mhz) + if (LLStringUtil::convertToF64(cpuinfo["cpu mhz"], mhz) && 200.0 < mhz && mhz < 10000.0) { mCPUMhz = (S32)llrint(mhz); @@ -658,18 +652,17 @@ std::ostream& operator<<(std::ostream& s, const LLMemoryInfo& info) return s; } -BOOL gunzip_file(const char *srcfile, const char *dstfile) +BOOL gunzip_file(const std::string& srcfile, const std::string& dstfile) { - char tmpfile[LL_MAX_PATH]; /* Flawfinder: ignore */ + std::string tmpfile; const S32 UNCOMPRESS_BUFFER_SIZE = 32768; BOOL retval = FALSE; gzFile src = NULL; U8 buffer[UNCOMPRESS_BUFFER_SIZE]; LLFILE *dst = NULL; S32 bytes = 0; - (void *) strcpy(tmpfile, dstfile); /* Flawfinder: ignore */ - (void *) strncat(tmpfile, ".t", sizeof(tmpfile) - strlen(tmpfile) -1); /* Flawfinder: ignore */ - src = gzopen(srcfile, "rb"); + tmpfile = dstfile + ".t"; + src = gzopen(srcfile.c_str(), "rb"); if (! src) goto err; dst = LLFile::fopen(tmpfile, "wb"); /* Flawfinder: ignore */ if (! dst) goto err; @@ -693,18 +686,17 @@ err: return retval; } -BOOL gzip_file(const char *srcfile, const char *dstfile) +BOOL gzip_file(const std::string& srcfile, const std::string& dstfile) { const S32 COMPRESS_BUFFER_SIZE = 32768; - char tmpfile[LL_MAX_PATH]; /* Flawfinder: ignore */ + std::string tmpfile; BOOL retval = FALSE; U8 buffer[COMPRESS_BUFFER_SIZE]; gzFile dst = NULL; LLFILE *src = NULL; S32 bytes = 0; - (void *) strcpy(tmpfile, dstfile); /* Flawfinder: ignore */ - (void *) strncat(tmpfile, ".t", sizeof(tmpfile) - strlen(tmpfile) -1); /* Flawfinder: ignore */ - dst = gzopen(tmpfile, "wb"); /* Flawfinder: ignore */ + tmpfile = dstfile + ".t"; + dst = gzopen(tmpfile.c_str(), "wb"); /* Flawfinder: ignore */ if (! dst) goto err; src = LLFile::fopen(srcfile, "rb"); /* Flawfinder: ignore */ if (! src) goto err; diff --git a/indra/llcommon/llsys.h b/indra/llcommon/llsys.h index 332d62c186..a56ba2bdda 100644 --- a/indra/llcommon/llsys.h +++ b/indra/llcommon/llsys.h @@ -127,9 +127,9 @@ std::ostream& operator<<(std::ostream& s, const LLCPUInfo& info); std::ostream& operator<<(std::ostream& s, const LLMemoryInfo& info); // gunzip srcfile into dstfile. Returns FALSE on error. -BOOL gunzip_file(const char *srcfile, const char *dstfile); +BOOL gunzip_file(const std::string& srcfile, const std::string& dstfile); // gzip srcfile into dstfile. Returns FALSE on error. -BOOL gzip_file(const char *srcfile, const char *dstfile); +BOOL gzip_file(const std::string& srcfile, const std::string& dstfile); extern LLCPUInfo gSysCPU; diff --git a/indra/llcommon/lltimer.cpp b/indra/llcommon/lltimer.cpp index 3d05699cd6..77d683adc0 100644 --- a/indra/llcommon/lltimer.cpp +++ b/indra/llcommon/lltimer.cpp @@ -483,7 +483,7 @@ struct tm* utc_to_pacific_time(time_t utc_time, BOOL pacific_daylight_time) } -void microsecondsToTimecodeString(U64 current_time, char *tcstring) +void microsecondsToTimecodeString(U64 current_time, std::string& tcstring) { U64 hours; U64 minutes; @@ -501,11 +501,11 @@ void microsecondsToTimecodeString(U64 current_time, char *tcstring) subframes = current_time / (U64)42; subframes %= 100; - sprintf(tcstring,"%3.3d:%2.2d:%2.2d:%2.2d.%2.2d",(int)hours,(int)minutes,(int)seconds,(int)frames,(int)subframes); /* Flawfinder: ignore */ + tcstring = llformat("%3.3d:%2.2d:%2.2d:%2.2d.%2.2d",(int)hours,(int)minutes,(int)seconds,(int)frames,(int)subframes); } -void secondsToTimecodeString(F32 current_time, char *tcstring) +void secondsToTimecodeString(F32 current_time, std::string& tcstring) { microsecondsToTimecodeString((U64)((F64)(SEC_TO_MICROSEC*current_time)), tcstring); } diff --git a/indra/llcommon/lltimer.h b/indra/llcommon/lltimer.h index 41562f4a51..d3a83339f0 100644 --- a/indra/llcommon/lltimer.h +++ b/indra/llcommon/lltimer.h @@ -162,8 +162,8 @@ BOOL is_daylight_savings(); // struct tm* internal_time = utc_to_pacific_time(utc_time, gDaylight); struct tm* utc_to_pacific_time(time_t utc_time, BOOL pacific_daylight_time); -void microsecondsToTimecodeString(U64 current_time, char *tcstring); -void secondsToTimecodeString(F32 current_time, char *tcstring); +void microsecondsToTimecodeString(U64 current_time, std::string& tcstring); +void secondsToTimecodeString(F32 current_time, std::string& tcstring); // class for scheduling a function to be called at a given frequency (approximate, inprecise) class LLEventTimer diff --git a/indra/llcommon/lluuid.cpp b/indra/llcommon/lluuid.cpp index 3f86681315..51e27e0708 100644 --- a/indra/llcommon/lluuid.cpp +++ b/indra/llcommon/lluuid.cpp @@ -149,9 +149,9 @@ U32 janky_fast_random_seeded_bytes(U32 seed, U32 val) #endif // Common to all UUID implementations -void LLUUID::toString(char *out) const +void LLUUID::toString(std::string& out) const { - sprintf(out, + out = llformat( "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x", (U8)(mData[0]), (U8)(mData[1]), @@ -171,6 +171,23 @@ void LLUUID::toString(char *out) const (U8)(mData[15])); } +// *TODO: deprecate +void LLUUID::toString(char *out) const +{ + std::string buffer; + toString(buffer); + strcpy(out,buffer.c_str()); /* Flawfinder: ignore */ +} + +void LLUUID::toCompressedString(std::string& out) const +{ + char bytes[UUID_BYTES+1]; + memcpy(bytes, mData, UUID_BYTES); /* Flawfinder: ignore */ + bytes[UUID_BYTES] = '\0'; + out = bytes; +} + +// *TODO: deprecate void LLUUID::toCompressedString(char *out) const { memcpy(out, mData, UUID_BYTES); /* Flawfinder: ignore */ @@ -184,38 +201,32 @@ std::string LLUUID::getString() const std::string LLUUID::asString() const { - char str[UUID_STR_SIZE]; /* Flawfinder: ignore */ + std::string str; toString(str); - return std::string(str); + return str; } -BOOL LLUUID::set(const std::string& in_string, BOOL emit) +BOOL LLUUID::set(const char* in_string, BOOL emit) { - return set(in_string.c_str(), emit); + return set(ll_safe_string(in_string)); } -BOOL LLUUID::set(const char *in_string, BOOL emit) +BOOL LLUUID::set(const std::string& in_string, BOOL emit) { BOOL broken_format = FALSE; - if (!in_string) - { - llerrs << "No string pointer in LLUUID::set!" << llendl; - setNull(); - return FALSE; - } // empty strings should make NULL uuid - if (!in_string[0]) + if (in_string.empty()) { setNull(); return TRUE; } - if (strlen(in_string) != (UUID_STR_LENGTH - 1)) /* Flawfinder: ignore */ + if (in_string.length() != (UUID_STR_LENGTH - 1)) /* Flawfinder: ignore */ { // I'm a moron. First implementation didn't have the right UUID format. // Shouldn't see any of these any more - if (strlen(in_string) == (UUID_STR_LENGTH - 2)) /* Flawfinder: ignore */ + if (in_string.length() == (UUID_STR_LENGTH - 2)) /* Flawfinder: ignore */ { if(emit) { @@ -251,17 +262,17 @@ BOOL LLUUID::set(const char *in_string, BOOL emit) mData[i] = 0; - if ((*(in_string + cur_pos) >= '0') && (*(in_string+cur_pos) <= '9')) + if ((in_string[cur_pos] >= '0') && (in_string[cur_pos] <= '9')) { - mData[i] += (U8)(*(in_string + cur_pos) - '0'); + mData[i] += (U8)(in_string[cur_pos] - '0'); } - else if ((*(in_string + cur_pos) >= 'a') && (*(in_string+cur_pos) <='f')) + else if ((in_string[cur_pos] >= 'a') && (in_string[cur_pos] <='f')) { - mData[i] += (U8)(10 + *(in_string + cur_pos) - 'a'); + mData[i] += (U8)(10 + in_string[cur_pos] - 'a'); } - else if ((*(in_string + cur_pos) >= 'A') && (*(in_string+cur_pos) <='F')) + else if ((in_string[cur_pos] >= 'A') && (in_string[cur_pos] <='F')) { - mData[i] += (U8)(10 + *(in_string + cur_pos) - 'A'); + mData[i] += (U8)(10 + in_string[cur_pos] - 'A'); } else { @@ -276,17 +287,17 @@ BOOL LLUUID::set(const char *in_string, BOOL emit) mData[i] = mData[i] << 4; cur_pos++; - if ((*(in_string + cur_pos) >= '0') && (*(in_string+cur_pos) <= '9')) + if ((in_string[cur_pos] >= '0') && (in_string[cur_pos] <= '9')) { - mData[i] += (U8)(*(in_string + cur_pos) - '0'); + mData[i] += (U8)(in_string[cur_pos] - '0'); } - else if ((*(in_string + cur_pos) >= 'a') && (*(in_string+cur_pos) <='f')) + else if ((in_string[cur_pos] >= 'a') && (in_string[cur_pos] <='f')) { - mData[i] += (U8)(10 + *(in_string + cur_pos) - 'a'); + mData[i] += (U8)(10 + in_string[cur_pos] - 'a'); } - else if ((*(in_string + cur_pos) >= 'A') && (*(in_string+cur_pos) <='F')) + else if ((in_string[cur_pos] >= 'A') && (in_string[cur_pos] <='F')) { - mData[i] += (U8)(10 + *(in_string + cur_pos) - 'A'); + mData[i] += (U8)(10 + in_string[cur_pos] - 'A'); } else { @@ -304,21 +315,12 @@ BOOL LLUUID::set(const char *in_string, BOOL emit) } BOOL LLUUID::validate(const std::string& in_string) -{ - return validate(in_string.c_str()); -} - -BOOL LLUUID::validate(const char *in_string) { BOOL broken_format = FALSE; - if (!in_string) - { - return FALSE; - } - if (strlen(in_string) != (UUID_STR_LENGTH - 1)) /* Flawfinder: ignore */ + if (in_string.length() != (UUID_STR_LENGTH - 1)) /* Flawfinder: ignore */ { // I'm a moron. First implementation didn't have the right UUID format. - if (strlen(in_string) == (UUID_STR_LENGTH - 2)) /* Flawfinder: ignore */ + if (in_string.length() == (UUID_STR_LENGTH - 2)) /* Flawfinder: ignore */ { broken_format = TRUE; } @@ -329,8 +331,7 @@ BOOL LLUUID::validate(const char *in_string) } U8 cur_pos = 0; - U32 i; - for (i = 0; i < 16; i++) + for (U32 i = 0; i < 16; i++) { if ((i == 4) || (i == 6) || (i == 8) || (i == 10)) { @@ -342,13 +343,13 @@ BOOL LLUUID::validate(const char *in_string) } } - if ((*(in_string + cur_pos) >= '0') && (*(in_string+cur_pos) <= '9')) + if ((in_string[cur_pos] >= '0') && (in_string[cur_pos] <= '9')) { } - else if ((*(in_string + cur_pos) >= 'a') && (*(in_string+cur_pos) <='f')) + else if ((in_string[cur_pos] >= 'a') && (in_string[cur_pos] <='f')) { } - else if ((*(in_string + cur_pos) >= 'A') && (*(in_string+cur_pos) <='F')) + else if ((in_string[cur_pos] >= 'A') && (in_string[cur_pos] <='F')) { } else @@ -358,13 +359,13 @@ BOOL LLUUID::validate(const char *in_string) cur_pos++; - if ((*(in_string + cur_pos) >= '0') && (*(in_string+cur_pos) <= '9')) + if ((in_string[cur_pos] >= '0') && (in_string[cur_pos] <= '9')) { } - else if ((*(in_string + cur_pos) >= 'a') && (*(in_string+cur_pos) <='f')) + else if ((in_string[cur_pos] >= 'a') && (in_string[cur_pos] <='f')) { } - else if ((*(in_string + cur_pos) >= 'A') && (*(in_string+cur_pos) <='F')) + else if ((in_string[cur_pos] >= 'A') && (in_string[cur_pos] <='F')) { } else @@ -412,8 +413,7 @@ LLUUID LLUUID::combine(const LLUUID &other) const std::ostream& operator<<(std::ostream& s, const LLUUID &uuid) { - char uuid_str[UUID_STR_LENGTH]; - + std::string uuid_str; uuid.toString(uuid_str); s << uuid_str; return s; @@ -428,7 +428,7 @@ std::istream& operator>>(std::istream &s, LLUUID &uuid) s >> uuid_str[i]; } uuid_str[i] = '\0'; - uuid.set(uuid_str); + uuid.set(std::string(uuid_str)); return s; } @@ -891,15 +891,15 @@ U32 LLUUID::getRandomSeed() return(*(U32 *)seed); } -BOOL LLUUID::parseUUID(const char* buf, LLUUID* value) +BOOL LLUUID::parseUUID(const std::string& buf, LLUUID* value) { - if( buf == NULL || buf[0] == '\0' || value == NULL) + if( buf.empty() || value == NULL) { return FALSE; } - LLString temp( buf ); - LLString::trim(temp); + std::string temp( buf ); + LLStringUtil::trim(temp); if( LLUUID::validate( temp ) ) { value->set( temp ); diff --git a/indra/llcommon/lluuid.h b/indra/llcommon/lluuid.h index 2f82ec9a93..b2fcce5161 100644 --- a/indra/llcommon/lluuid.h +++ b/indra/llcommon/lluuid.h @@ -106,7 +106,9 @@ public: friend std::istream& operator>>(std::istream& s, LLUUID &uuid); void toString(char *out) const; // Does not allocate memory, needs 36 characters (including \0) + void toString(std::string& out) const; void toCompressedString(char *out) const; // Does not allocate memory, needs 17 characters (including \0) + void toCompressedString(std::string& out) const; std::string asString() const; std::string getString() const; @@ -115,14 +117,13 @@ public: U32 getCRC32() const; static BOOL validate(const std::string& in_string); // Validate that the UUID string is legal. - static BOOL validate(const char *in_string); // Validate that the UUID string is legal. static const LLUUID null; static U32 getRandomSeed(); static S32 getNodeID(unsigned char * node_id); - static BOOL parseUUID(const char* buf, LLUUID* value); + static BOOL parseUUID(const std::string& buf, LLUUID* value); U8 mData[UUID_BYTES]; }; diff --git a/indra/llcommon/metapropertyt.h b/indra/llcommon/metapropertyt.h index 488a60c22f..158d0cebec 100644 --- a/indra/llcommon/metapropertyt.h +++ b/indra/llcommon/metapropertyt.h @@ -85,13 +85,6 @@ inline const LLReflective* LLMetaPropertyT::get(const LLReflective* return NULL; } -template <> -inline const LLReflective* LLMetaPropertyT::get(const LLReflective* object) const -{ - checkObjectClass(object); - return NULL; -} - template <> inline const LLReflective* LLMetaPropertyT::get(const LLReflective* object) const { @@ -111,12 +104,6 @@ inline LLSD LLMetaPropertyT::getLLSD(const LLReflective* object) co return *(getProperty(object)); } -template <> -inline LLSD LLMetaPropertyT::getLLSD(const LLReflective* object) const -{ - return *(getProperty(object)); -} - template <> inline LLSD LLMetaPropertyT::getLLSD(const LLReflective* object) const { diff --git a/indra/llcommon/u64.cpp b/indra/llcommon/u64.cpp index f3422770ae..b23c74b79e 100644 --- a/indra/llcommon/u64.cpp +++ b/indra/llcommon/u64.cpp @@ -34,10 +34,10 @@ #include "u64.h" -U64 str_to_U64(const char *str) +U64 str_to_U64(const std::string& str) { U64 result = 0; - const char *aptr = strpbrk(str,"0123456789"); + const char *aptr = strpbrk(str.c_str(),"0123456789"); if (!aptr) { @@ -54,8 +54,9 @@ U64 str_to_U64(const char *str) } -char* U64_to_str(U64 value, char* result, S32 result_size) -{ +std::string U64_to_str(U64 value) +{ + std::string res; U32 part1,part2,part3; part3 = (U32)(value % (U64)10000000); @@ -70,31 +71,26 @@ char* U64_to_str(U64 value, char* result, S32 result_size) if (part1) { - snprintf( /* Flawfinder: ignore */ - result, - result_size, - "%u%07u%07u", - part1,part2,part3); + res = llformat("%u%07u%07u",part1,part2,part3); } else if (part2) { - snprintf( /* Flawfinder: ignore */ - result, - result_size, - "%u%07u", - part2,part3); + res = llformat("%u%07u",part2,part3); } else { - snprintf( /* Flawfinder: ignore */ - result, - result_size, - "%u", - part3); + res = llformat("%u",part3); } - return (result); + return res; } +char* U64_to_str(U64 value, char* result, S32 result_size) +{ + std::string res = U64_to_str(value); + LLStringUtil::copy(result, res.c_str(), result_size); + return result; +} + F64 U64_to_F64(const U64 value) { S64 top_bits = (S64)(value >> 1); diff --git a/indra/llcommon/u64.h b/indra/llcommon/u64.h index f4580513bc..3b833a4587 100644 --- a/indra/llcommon/u64.h +++ b/indra/llcommon/u64.h @@ -38,7 +38,14 @@ * @param str The string to parse. * @return Returns the first U64 value found in the string or 0 on failure. */ -U64 str_to_U64(const char* str); +U64 str_to_U64(const std::string& str); + +/** + * @brief Given a U64 value, return a printable representation. + * @param value The U64 to turn into a printable character array. + * @return Returns the result string. + */ +std::string U64_to_str(U64 value); /** * @brief Given a U64 value, return a printable representation. diff --git a/indra/llcrashlogger/llcrashlogger.cpp b/indra/llcrashlogger/llcrashlogger.cpp index 2640390b9c..32dea6c707 100755 --- a/indra/llcrashlogger/llcrashlogger.cpp +++ b/indra/llcrashlogger/llcrashlogger.cpp @@ -76,7 +76,7 @@ bool LLCrashLoggerText::mainLoop() return true; } -void LLCrashLoggerText::updateApplication(LLString message) +void LLCrashLoggerText::updateApplication(const std::string& message) { LLCrashLogger::updateApplication(message); std::cout << message << std::endl; @@ -120,10 +120,8 @@ void LLCrashLogger::gatherFiles() updateApplication("Gathering logs..."); // Figure out the filename of the debug log - std::string db_file_name = gDirUtilp->getExpandedFilename( - LL_PATH_LOGS, - "debug_info.log"); - llifstream debug_log_file(db_file_name.c_str()); + std::string db_file_name = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,"debug_info.log"); + std::ifstream debug_log_file(db_file_name.c_str()); // Look for it in the debug_info.log file if (debug_log_file.is_open()) @@ -161,12 +159,12 @@ void LLCrashLogger::gatherFiles() updateApplication("Encoding files..."); - for(std::map::iterator itr = mFileMap.begin(); itr != mFileMap.end(); ++itr) + for(std::map::iterator itr = mFileMap.begin(); itr != mFileMap.end(); ++itr) { std::ifstream f((*itr).second.c_str()); if(!f.is_open()) { - std::cout << "Can't find file " << (*itr).second.c_str() << std::endl; + std::cout << "Can't find file " << (*itr).second << std::endl; continue; } std::stringstream s; @@ -212,10 +210,10 @@ bool LLCrashLogger::saveCrashBehaviorSetting(S32 crash_behavior) return true; } -bool LLCrashLogger::runCrashLogPost(LLString host, LLSD data, LLString msg, int retries, int timeout) +bool LLCrashLogger::runCrashLogPost(std::string host, LLSD data, std::string msg, int retries, int timeout) { gBreak = false; - LLString status_message; + std::string status_message; for(int i = 0; i < retries; ++i) { status_message = llformat("%s, try %d...", msg.c_str(), i+1); @@ -251,14 +249,15 @@ bool LLCrashLogger::sendCrashLogs() bool sent = false; + //*TODO: Translate if(mCrashHost != "") { - sent = runCrashLogPost(mCrashHost, post_data, "Sending to server", 3, 5); + sent = runCrashLogPost(mCrashHost, post_data, std::string("Sending to server"), 3, 5); } if(!sent) { - sent = runCrashLogPost(mAltCrashHost, post_data, "Sending to alternate server", 3, 5); + sent = runCrashLogPost(mAltCrashHost, post_data, std::string("Sending to alternate server"), 3, 5); } mSentCrashLogs = sent; @@ -266,7 +265,7 @@ bool LLCrashLogger::sendCrashLogs() return true; } -void LLCrashLogger::updateApplication(LLString message) +void LLCrashLogger::updateApplication(const std::string& message) { gServicePump->pump(); gServicePump->callback(); @@ -319,7 +318,7 @@ bool LLCrashLogger::init() //If we've opened the crash logger, assume we can delete the marker file if it exists if( gDirUtilp ) { - LLString marker_file = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,"SecondLife.exec_marker"); + std::string marker_file = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,"SecondLife.exec_marker"); ll_apr_file_remove( marker_file ); } diff --git a/indra/llcrashlogger/llcrashlogger.h b/indra/llcrashlogger/llcrashlogger.h index c4a583371e..b8856c8872 100755 --- a/indra/llcrashlogger/llcrashlogger.h +++ b/indra/llcrashlogger/llcrashlogger.h @@ -50,23 +50,23 @@ public: bool saveCrashBehaviorSetting(S32 crash_behavior); bool sendCrashLogs(); LLSD constructPostData(); - virtual void updateApplication(LLString message = ""); + virtual void updateApplication(const std::string& message = LLStringUtil::null); virtual bool init(); virtual bool mainLoop() = 0; virtual bool cleanup() { return true; } - void setUserText(LLString& text) { mCrashInfo["UserNotes"] = text; } + void setUserText(const std::string& text) { mCrashInfo["UserNotes"] = text; } S32 getCrashBehavior() { return mCrashBehavior; } - bool runCrashLogPost(LLString host, LLSD data, LLString msg, int retries, int timeout); + bool runCrashLogPost(std::string host, LLSD data, std::string msg, int retries, int timeout); protected: S32 mCrashBehavior; BOOL mCrashInPreviousExec; - std::map mFileMap; - LLString mGridName; + std::map mFileMap; + std::string mGridName; LLControlGroup mCrashSettings; - LLString mProductName; + std::string mProductName; LLSD mCrashInfo; - LLString mCrashHost; - LLString mAltCrashHost; + std::string mCrashHost; + std::string mAltCrashHost; LLSD mDebugLog; bool mSentCrashLogs; }; @@ -78,7 +78,7 @@ public: ~LLCrashLoggerText(void) {} virtual bool mainLoop(); - virtual void updateApplication(LLString message = ""); + virtual void updateApplication(const std::string& message = LLStringUtil::null); }; diff --git a/indra/llimage/llimage.cpp b/indra/llimage/llimage.cpp index 2948675396..66b84c9a08 100644 --- a/indra/llimage/llimage.cpp +++ b/indra/llimage/llimage.cpp @@ -97,15 +97,15 @@ void LLImageBase::sanityCheck() } } -LLString LLImageBase::sLastErrorMessage; +std::string LLImageBase::sLastErrorMessage; BOOL LLImageBase::sSizeOverride = FALSE; -BOOL LLImageBase::setLastError(const LLString& message, const LLString& filename) +BOOL LLImageBase::setLastError(const std::string& message, const std::string& filename) { sLastErrorMessage = message; - if (filename != "") + if (!filename.empty()) { - sLastErrorMessage += LLString(" FILE:"); + sLastErrorMessage += " FILE:"; sLastErrorMessage += filename; } llwarns << sLastErrorMessage << llendl; @@ -250,7 +250,7 @@ LLImageRaw::LLImageRaw(U8 *data, U16 width, U16 height, S8 components) ++sRawImageCount; } -LLImageRaw::LLImageRaw(const LLString &filename, bool j2c_lowest_mip_only) +LLImageRaw::LLImageRaw(const std::string& filename, bool j2c_lowest_mip_only) : LLImageBase() { createFromFile(filename, j2c_lowest_mip_only); @@ -1107,25 +1107,25 @@ file_extensions[] = }; #define NUM_FILE_EXTENSIONS sizeof(file_extensions)/sizeof(file_extensions[0]) -static LLString find_file(LLString &name, S8 *codec) +static std::string find_file(std::string &name, S8 *codec) { - LLString tname; + std::string tname; for (int i=0; i<(int)(NUM_FILE_EXTENSIONS); i++) { - tname = name + "." + LLString(file_extensions[i].exten); - llifstream ifs(tname.c_str(), llifstream::binary); + tname = name + "." + std::string(file_extensions[i].exten); + llifstream ifs(tname, llifstream::binary); if (ifs.is_open()) { ifs.close(); if (codec) *codec = file_extensions[i].codec; - return LLString(file_extensions[i].exten); + return std::string(file_extensions[i].exten); } } - return LLString(""); + return std::string(""); } -EImageCodec LLImageBase::getCodecFromExtension(const LLString& exten) +EImageCodec LLImageBase::getCodecFromExtension(const std::string& exten) { for (int i=0; i<(int)(NUM_FILE_EXTENSIONS); i++) { @@ -1135,19 +1135,19 @@ EImageCodec LLImageBase::getCodecFromExtension(const LLString& exten) return IMG_CODEC_INVALID; } -bool LLImageRaw::createFromFile(const LLString &filename, bool j2c_lowest_mip_only) +bool LLImageRaw::createFromFile(const std::string &filename, bool j2c_lowest_mip_only) { - LLString name = filename; + std::string name = filename; size_t dotidx = name.rfind('.'); S8 codec = IMG_CODEC_INVALID; - LLString exten; + std::string exten; deleteData(); // delete any existing data - if (dotidx != LLString::npos) + if (dotidx != std::string::npos) { exten = name.substr(dotidx+1); - LLString::toLower(exten); + LLStringUtil::toLower(exten); codec = getCodecFromExtension(exten); } else @@ -1160,7 +1160,7 @@ bool LLImageRaw::createFromFile(const LLString &filename, bool j2c_lowest_mip_on return false; // format not recognized } - llifstream ifs(name.c_str(), llifstream::binary); + llifstream ifs(name, llifstream::binary); if (!ifs.is_open()) { // SJB: changed from llinfos to lldebugs to reduce spam @@ -1302,11 +1302,11 @@ LLImageFormatted* LLImageFormatted::createFromType(S8 codec) } // static -LLImageFormatted* LLImageFormatted::createFromExtension(const LLString& instring) +LLImageFormatted* LLImageFormatted::createFromExtension(const std::string& instring) { - LLString exten; + std::string exten; size_t dotidx = instring.rfind('.'); - if (dotidx != LLString::npos) + if (dotidx != std::string::npos) { exten = instring.substr(dotidx+1); } @@ -1463,7 +1463,7 @@ void LLImageFormatted::appendData(U8 *data, S32 size) //---------------------------------------------------------------------------- -BOOL LLImageFormatted::load(const LLString &filename) +BOOL LLImageFormatted::load(const std::string &filename) { resetLastError(); @@ -1500,14 +1500,14 @@ BOOL LLImageFormatted::load(const LLString &filename) return res; } -BOOL LLImageFormatted::save(const LLString &filename) +BOOL LLImageFormatted::save(const std::string &filename) { resetLastError(); apr_file_t* apr_file = ll_apr_file_open(filename, LL_APR_WB); if (!apr_file) { - setLastError("Unable to open file for reading", filename); + setLastError("Unable to open file for writing", filename); return FALSE; } diff --git a/indra/llimage/llimage.h b/indra/llimage/llimage.h index ee29e5c4a4..98a86ad755 100644 --- a/indra/llimage/llimage.h +++ b/indra/llimage/llimage.h @@ -113,9 +113,9 @@ protected: void setDataAndSize(U8 *data, S32 size) { mData = data; mDataSize = size; }; public: - static const LLString& getLastError() {return sLastErrorMessage;}; - static void resetLastError() {sLastErrorMessage = LLString("No Error"); }; - static BOOL setLastError(const LLString& message, const LLString& filename = LLString()); // returns FALSE + static const std::string& getLastError() {return sLastErrorMessage;}; + static void resetLastError() {sLastErrorMessage = "No Error"; }; + static BOOL setLastError(const std::string& message, const std::string& filename = std::string()); // returns FALSE static void generateMip(const U8 *indata, U8* mipdata, int width, int height, S32 nchannels); @@ -125,7 +125,7 @@ public: static void setSizeOverride(BOOL enabled) { sSizeOverride = enabled; } - static EImageCodec getCodecFromExtension(const LLString& exten); + static EImageCodec getCodecFromExtension(const std::string& exten); private: U8 *mData; @@ -141,7 +141,7 @@ private: public: S16 mMemType; // debug - static LLString sLastErrorMessage; + static std::string sLastErrorMessage; static BOOL sSizeOverride; }; @@ -157,7 +157,7 @@ public: LLImageRaw(U16 width, U16 height, S8 components); LLImageRaw(U8 *data, U16 width, U16 height, S8 components); // Construct using createFromFile (used by tools) - LLImageRaw(const LLString& filename, bool j2c_lowest_mip_only = false); + LLImageRaw(const std::string& filename, bool j2c_lowest_mip_only = false); /*virtual*/ void deleteData(); /*virtual*/ U8* allocateData(S32 size = -1); @@ -218,7 +218,7 @@ public: protected: // Create an image from a local file (generally used in tools) - bool createFromFile(const LLString& filename, bool j2c_lowest_mip_only = false); + bool createFromFile(const std::string& filename, bool j2c_lowest_mip_only = false); void copyLineScaled( U8* in, U8* out, S32 in_pixel_len, S32 out_pixel_len, S32 in_pixel_step, S32 out_pixel_step ); void compositeRowScaled4onto3( U8* in, U8* out, S32 in_pixel_len, S32 out_pixel_len ); @@ -236,7 +236,7 @@ class LLImageFormatted : public LLImageBase { public: static LLImageFormatted* createFromType(S8 codec); - static LLImageFormatted* createFromExtension(const LLString& instring); + static LLImageFormatted* createFromExtension(const std::string& instring); protected: /*virtual*/ ~LLImageFormatted(); @@ -265,8 +265,8 @@ public: // getRawDiscardLevel()by default returns mDiscardLevel, but may be overridden (LLImageJ2C) virtual S8 getRawDiscardLevel() { return mDiscardLevel; } - BOOL load(const LLString& filename); - BOOL save(const LLString& filename); + BOOL load(const std::string& filename); + BOOL save(const std::string& filename); virtual BOOL updateData() = 0; // pure virtual void setData(U8 *data, S32 size); diff --git a/indra/llimage/llimagej2c.cpp b/indra/llimage/llimagej2c.cpp index 3a6fd2db18..73c5b111c3 100644 --- a/indra/llimage/llimagej2c.cpp +++ b/indra/llimage/llimagej2c.cpp @@ -374,7 +374,7 @@ void LLImageJ2C::setReversible(const BOOL reversible) } -BOOL LLImageJ2C::loadAndValidate(const LLString &filename) +BOOL LLImageJ2C::loadAndValidate(const std::string &filename) { resetLastError(); diff --git a/indra/llimage/llimagej2c.h b/indra/llimage/llimagej2c.h index 6c720df586..8d01eceb54 100644 --- a/indra/llimage/llimagej2c.h +++ b/indra/llimage/llimagej2c.h @@ -58,7 +58,7 @@ public: BOOL encode(const LLImageRaw *raw_imagep, const char* comment_text, F32 encode_time=0.0); BOOL validate(U8 *data, U32 file_size); - BOOL loadAndValidate(const LLString &filename); + BOOL loadAndValidate(const std::string &filename); // Encode accessors void setReversible(const BOOL reversible); // Use non-lossy? diff --git a/indra/llimage/llimagetga.cpp b/indra/llimage/llimagetga.cpp index a9fc02bf8d..c8689f6669 100644 --- a/indra/llimage/llimagetga.cpp +++ b/indra/llimage/llimagetga.cpp @@ -30,6 +30,7 @@ #include "linden_common.h" +#include "lldir.h" #include "llimagetga.h" #include "llerror.h" #include "llmath.h" @@ -90,7 +91,7 @@ LLImageTGA::LLImageTGA() { } -LLImageTGA::LLImageTGA(const LLString& file_name) +LLImageTGA::LLImageTGA(const std::string& file_name) : LLImageFormatted(IMG_CODEC_TGA), mColorMap( NULL ), mColorMapStart( 0 ), @@ -1136,7 +1137,7 @@ BOOL LLImageTGA::decodeAndProcess( LLImageRaw* raw_image, F32 domain, F32 weight } // Reads a .tga file and creates an LLImageTGA with its data. -bool LLImageTGA::loadFile( const LLString& path ) +bool LLImageTGA::loadFile( const std::string& path ) { S32 len = path.size(); if( len < 5 ) @@ -1144,14 +1145,13 @@ bool LLImageTGA::loadFile( const LLString& path ) return false; } - LLString extension = path.substr( len - 4, 4 ); - LLString::toLower(extension); - if( ".tga" != extension ) + std::string extension = gDirUtilp->getExtension(path); + if( "tga" != extension ) { return false; } - LLFILE* file = LLFile::fopen(path.c_str(), "rb"); /* Flawfinder: ignore */ + LLFILE* file = LLFile::fopen(path, "rb"); /* Flawfinder: ignore */ if( !file ) { llwarns << "Couldn't open file " << path << llendl; diff --git a/indra/llimage/llimagetga.h b/indra/llimage/llimagetga.h index 3bfe4e6e21..d1178ffb73 100644 --- a/indra/llimage/llimagetga.h +++ b/indra/llimage/llimagetga.h @@ -43,7 +43,7 @@ protected: public: LLImageTGA(); - LLImageTGA(const LLString& file_name); + LLImageTGA(const std::string& file_name); /*virtual*/ BOOL updateData(); /*virtual*/ BOOL decode(LLImageRaw* raw_image, F32 decode_time=0.0); @@ -70,7 +70,7 @@ private: void decodeColorMapPixel24(U8* dst, const U8* src); void decodeColorMapPixel32(U8* dst, const U8* src); - bool loadFile(const LLString& file_name); + bool loadFile(const std::string& file_name); private: // Class specific data diff --git a/indra/llimage/llpngwrapper.cpp b/indra/llimage/llpngwrapper.cpp index 7b0c1ea931..2cced39a6f 100644 --- a/indra/llimage/llpngwrapper.cpp +++ b/indra/llimage/llpngwrapper.cpp @@ -389,7 +389,7 @@ U32 LLPngWrapper::getFinalSize() } // Get last error message, if any -LLString LLPngWrapper::getErrorMessage() +const std::string& LLPngWrapper::getErrorMessage() { return mErrorMessage; } diff --git a/indra/llimage/llpngwrapper.h b/indra/llimage/llpngwrapper.h index fd21ae697f..6528fa4480 100644 --- a/indra/llimage/llpngwrapper.h +++ b/indra/llimage/llpngwrapper.h @@ -52,7 +52,7 @@ public: BOOL readPng(U8* src, LLImageRaw* rawImage, ImageInfo *infop = NULL); BOOL writePng(const LLImageRaw* rawImage, U8* dst); U32 getFinalSize(); - LLString getErrorMessage(); + const std::string& getErrorMessage(); protected: void normalizeImage(); @@ -98,7 +98,7 @@ private: F64 mGamma; - LLString mErrorMessage; + std::string mErrorMessage; }; #endif diff --git a/indra/llinventory/llinventory.cpp b/indra/llinventory/llinventory.cpp index 7dbc72e7a5..0cdc445069 100644 --- a/indra/llinventory/llinventory.cpp +++ b/indra/llinventory/llinventory.cpp @@ -78,16 +78,16 @@ LLInventoryObject::LLInventoryObject( const LLUUID& uuid, const LLUUID& parent_uuid, LLAssetType::EType type, - const LLString& name) : + const std::string& name) : mUUID(uuid), mParentUUID(parent_uuid), mType(type), mName(name) { - LLString::replaceNonstandardASCII(mName, ' '); - LLString::replaceChar(mName, '|', ' '); - LLString::trim(mName); - LLString::truncate(mName, DB_INV_ITEM_NAME_STR_LEN); + LLStringUtil::replaceNonstandardASCII(mName, ' '); + LLStringUtil::replaceChar(mName, '|', ' '); + LLStringUtil::trim(mName); + LLStringUtil::truncate(mName, DB_INV_ITEM_NAME_STR_LEN); } LLInventoryObject::LLInventoryObject() : @@ -117,7 +117,7 @@ const LLUUID& LLInventoryObject::getParentUUID() const return mParentUUID; } -const LLString& LLInventoryObject::getName() const +const std::string& LLInventoryObject::getName() const { return mName; } @@ -132,13 +132,13 @@ void LLInventoryObject::setUUID(const LLUUID& new_uuid) mUUID = new_uuid; } -void LLInventoryObject::rename(const LLString& n) +void LLInventoryObject::rename(const std::string& n) { - LLString new_name(n); - LLString::replaceNonstandardASCII(new_name, ' '); - LLString::replaceChar(new_name, '|', ' '); - LLString::trim(new_name); - LLString::truncate(new_name, DB_INV_ITEM_NAME_STR_LEN); + std::string new_name(n); + LLStringUtil::replaceNonstandardASCII(new_name, ' '); + LLStringUtil::replaceChar(new_name, '|', ' '); + LLStringUtil::trim(new_name); + LLStringUtil::truncate(new_name, DB_INV_ITEM_NAME_STR_LEN); if( new_name != mName ) { @@ -201,10 +201,10 @@ BOOL LLInventoryObject::importLegacyStream(std::istream& input_stream) " %254s %254[^|]", keyword, valuestr); mName.assign(valuestr); - LLString::replaceNonstandardASCII(mName, ' '); - LLString::replaceChar(mName, '|', ' '); - LLString::trim(mName); - LLString::truncate(mName, DB_INV_ITEM_NAME_STR_LEN); + LLStringUtil::replaceNonstandardASCII(mName, ' '); + LLStringUtil::replaceChar(mName, '|', ' '); + LLStringUtil::trim(mName); + LLStringUtil::truncate(mName, DB_INV_ITEM_NAME_STR_LEN); } else { @@ -219,12 +219,12 @@ BOOL LLInventoryObject::importLegacyStream(std::istream& input_stream) // not sure whether exportLegacyStream(llofstream(fp)) would work, fp may need to get icramented... BOOL LLInventoryObject::exportFile(LLFILE* fp, BOOL) const { - char uuid_str[UUID_STR_LENGTH]; /* Flawfinder: ignore */ + std::string uuid_str; fprintf(fp, "\tinv_object\t0\n\t{\n"); mUUID.toString(uuid_str); - fprintf(fp, "\t\tobj_id\t%s\n", uuid_str); + fprintf(fp, "\t\tobj_id\t%s\n", uuid_str.c_str()); mParentUUID.toString(uuid_str); - fprintf(fp, "\t\tparent_id\t%s\n", uuid_str); + fprintf(fp, "\t\tparent_id\t%s\n", uuid_str.c_str()); fprintf(fp, "\t\ttype\t%s\n", LLAssetType::lookup(mType)); fprintf(fp, "\t\tname\t%s|\n", mName.c_str()); fprintf(fp,"\t}\n"); @@ -233,7 +233,7 @@ BOOL LLInventoryObject::exportFile(LLFILE* fp, BOOL) const BOOL LLInventoryObject::exportLegacyStream(std::ostream& output_stream, BOOL) const { - char uuid_str[UUID_STR_LENGTH]; /* Flawfinder: ignore */ + std::string uuid_str; output_stream << "\tinv_object\t0\n\t{\n"; mUUID.toString(uuid_str); output_stream << "\t\tobj_id\t" << uuid_str << "\n"; @@ -276,8 +276,8 @@ LLInventoryItem::LLInventoryItem( const LLUUID& asset_uuid, LLAssetType::EType type, LLInventoryType::EType inv_type, - const LLString& name, - const LLString& desc, + const std::string& name, + const std::string& desc, const LLSaleInfo& sale_info, U32 flags, S32 creation_date_utc) : @@ -290,8 +290,8 @@ LLInventoryItem::LLInventoryItem( mFlags(flags), mCreationDate(creation_date_utc) { - LLString::replaceNonstandardASCII(mDescription, ' '); - LLString::replaceChar(mDescription, '|', ' '); + LLStringUtil::replaceNonstandardASCII(mDescription, ' '); + LLStringUtil::replaceChar(mDescription, '|', ' '); } LLInventoryItem::LLInventoryItem() : @@ -359,7 +359,7 @@ void LLInventoryItem::setAssetUUID(const LLUUID& asset_id) } -const LLString& LLInventoryItem::getDescription() const +const std::string& LLInventoryItem::getDescription() const { return mDescription; } @@ -396,11 +396,11 @@ U32 LLInventoryItem::getCRC32() const } -void LLInventoryItem::setDescription(const LLString& d) +void LLInventoryItem::setDescription(const std::string& d) { - LLString new_desc(d); - LLString::replaceNonstandardASCII(new_desc, ' '); - LLString::replaceChar(new_desc, '|', ' '); + std::string new_desc(d); + LLStringUtil::replaceNonstandardASCII(new_desc, ' '); + LLStringUtil::replaceChar(new_desc, '|', ' '); if( new_desc != mDescription ) { mDescription = new_desc; @@ -486,15 +486,11 @@ BOOL LLInventoryItem::unpackMessage(LLMessageSystem* msg, const char* block, S32 mSaleInfo.unpackMultiMessage(msg, block, block_num); - char name[DB_INV_ITEM_NAME_BUF_SIZE]; /* Flawfinder: ignore */ - msg->getStringFast(block, _PREHASH_Name, DB_INV_ITEM_NAME_BUF_SIZE, name, block_num); - mName.assign(name); - LLString::replaceNonstandardASCII(mName, ' '); + msg->getStringFast(block, _PREHASH_Name, mName, block_num); + LLStringUtil::replaceNonstandardASCII(mName, ' '); - char desc[DB_INV_ITEM_DESC_BUF_SIZE]; /* Flawfinder: ignore */ - msg->getStringFast(block, _PREHASH_Description, DB_INV_ITEM_DESC_BUF_SIZE, desc, block_num); - mDescription.assign(desc); - LLString::replaceNonstandardASCII(mDescription, ' '); + msg->getStringFast(block, _PREHASH_Description, mDescription, block_num); + LLStringUtil::replaceNonstandardASCII(mDescription, ' '); S32 date; msg->getS32(block, "CreationDate", date, block_num); @@ -604,7 +600,7 @@ BOOL LLInventoryItem::importFile(LLFILE* fp) } else if(0 == strcmp("inv_type", keyword)) { - mInventoryType = LLInventoryType::lookup(valuestr); + mInventoryType = LLInventoryType::lookup(std::string(valuestr)); } else if(0 == strcmp("flags", keyword)) { @@ -626,8 +622,8 @@ BOOL LLInventoryItem::importFile(LLFILE* fp) } mName.assign(valuestr); - LLString::replaceNonstandardASCII(mName, ' '); - LLString::replaceChar(mName, '|', ' '); + LLStringUtil::replaceNonstandardASCII(mName, ' '); + LLStringUtil::replaceChar(mName, '|', ' '); } else if(0 == strcmp("desc", keyword)) { @@ -644,7 +640,7 @@ BOOL LLInventoryItem::importFile(LLFILE* fp) } mDescription.assign(valuestr); - LLString::replaceNonstandardASCII(mDescription, ' '); + LLStringUtil::replaceNonstandardASCII(mDescription, ' '); /* TODO -- ask Ian about this code const char *donkey = mDescription.c_str(); if (donkey[0] == '|') @@ -680,12 +676,12 @@ BOOL LLInventoryItem::importFile(LLFILE* fp) BOOL LLInventoryItem::exportFile(LLFILE* fp, BOOL include_asset_key) const { - char uuid_str[UUID_STR_LENGTH]; /* Flawfinder: ignore */ + std::string uuid_str; fprintf(fp, "\tinv_item\t0\n\t{\n"); mUUID.toString(uuid_str); - fprintf(fp, "\t\titem_id\t%s\n", uuid_str); + fprintf(fp, "\t\titem_id\t%s\n", uuid_str.c_str()); mParentUUID.toString(uuid_str); - fprintf(fp, "\t\tparent_id\t%s\n", uuid_str); + fprintf(fp, "\t\tparent_id\t%s\n", uuid_str.c_str()); mPermissions.exportFile(fp); // Check for permissions to see the asset id, and if so write it @@ -697,7 +693,7 @@ BOOL LLInventoryItem::exportFile(LLFILE* fp, BOOL include_asset_key) const || (mAssetUUID.isNull())) { mAssetUUID.toString(uuid_str); - fprintf(fp, "\t\tasset_id\t%s\n", uuid_str); + fprintf(fp, "\t\tasset_id\t%s\n", uuid_str.c_str()); } else { @@ -705,13 +701,13 @@ BOOL LLInventoryItem::exportFile(LLFILE* fp, BOOL include_asset_key) const LLXORCipher cipher(MAGIC_ID.mData, UUID_BYTES); cipher.encrypt(shadow_id.mData, UUID_BYTES); shadow_id.toString(uuid_str); - fprintf(fp, "\t\tshadow_id\t%s\n", uuid_str); + fprintf(fp, "\t\tshadow_id\t%s\n", uuid_str.c_str()); } } else { LLUUID::null.toString(uuid_str); - fprintf(fp, "\t\tasset_id\t%s\n", uuid_str); + fprintf(fp, "\t\tasset_id\t%s\n", uuid_str.c_str()); } fprintf(fp, "\t\ttype\t%s\n", LLAssetType::lookup(mType)); const char* inv_type_str = LLInventoryType::lookup(mInventoryType); @@ -807,7 +803,7 @@ BOOL LLInventoryItem::importLegacyStream(std::istream& input_stream) } else if(0 == strcmp("inv_type", keyword)) { - mInventoryType = LLInventoryType::lookup(valuestr); + mInventoryType = LLInventoryType::lookup(std::string(valuestr)); } else if(0 == strcmp("flags", keyword)) { @@ -829,8 +825,8 @@ BOOL LLInventoryItem::importLegacyStream(std::istream& input_stream) } mName.assign(valuestr); - LLString::replaceNonstandardASCII(mName, ' '); - LLString::replaceChar(mName, '|', ' '); + LLStringUtil::replaceNonstandardASCII(mName, ' '); + LLStringUtil::replaceChar(mName, '|', ' '); } else if(0 == strcmp("desc", keyword)) { @@ -847,7 +843,7 @@ BOOL LLInventoryItem::importLegacyStream(std::istream& input_stream) } mDescription.assign(valuestr); - LLString::replaceNonstandardASCII(mDescription, ' '); + LLStringUtil::replaceNonstandardASCII(mDescription, ' '); /* TODO -- ask Ian about this code const char *donkey = mDescription.c_str(); if (donkey[0] == '|') @@ -883,7 +879,7 @@ BOOL LLInventoryItem::importLegacyStream(std::istream& input_stream) BOOL LLInventoryItem::exportLegacyStream(std::ostream& output_stream, BOOL include_asset_key) const { - char uuid_str[UUID_STR_LENGTH]; /* Flawfinder: ignore */ + std::string uuid_str; output_stream << "\tinv_item\t0\n\t{\n"; mUUID.toString(uuid_str); output_stream << "\t\titem_id\t" << uuid_str << "\n"; @@ -920,8 +916,8 @@ BOOL LLInventoryItem::exportLegacyStream(std::ostream& output_stream, BOOL inclu const char* inv_type_str = LLInventoryType::lookup(mInventoryType); if(inv_type_str) output_stream << "\t\tinv_type\t" << inv_type_str << "\n"; - char buffer[32]; /* Flawfinder: ignore */ - snprintf(buffer, sizeof(buffer), "\t\tflags\t%08x\n", mFlags); /* Flawfinder: ignore */ + std::string buffer; + buffer = llformat( "\t\tflags\t%08x\n", mFlags); output_stream << buffer; mSaleInfo.exportLegacyStream(output_stream); output_stream << "\t\tname\t" << mName.c_str() << "|\n"; @@ -1030,12 +1026,12 @@ bool LLInventoryItem::fromLLSD(LLSD& sd) w = INV_ASSET_TYPE_LABEL; if (sd.has(w)) { - mType = LLAssetType::lookup(sd[w].asString().c_str()); + mType = LLAssetType::lookup(sd[w].asString()); } w = INV_INVENTORY_TYPE_LABEL; if (sd.has(w)) { - mInventoryType = LLInventoryType::lookup(sd[w].asString().c_str()); + mInventoryType = LLInventoryType::lookup(sd[w].asString()); } w = INV_FLAGS_LABEL; if (sd.has(w)) @@ -1046,14 +1042,14 @@ bool LLInventoryItem::fromLLSD(LLSD& sd) if (sd.has(w)) { mName = sd[w].asString(); - LLString::replaceNonstandardASCII(mName, ' '); - LLString::replaceChar(mName, '|', ' '); + LLStringUtil::replaceNonstandardASCII(mName, ' '); + LLStringUtil::replaceChar(mName, '|', ' '); } w = INV_DESC_LABEL; if (sd.has(w)) { mDescription = sd[w].asString(); - LLString::replaceNonstandardASCII(mDescription, ' '); + LLStringUtil::replaceNonstandardASCII(mDescription, ' '); } w = INV_CREATION_DATE_LABEL; if (sd.has(w)) @@ -1107,21 +1103,21 @@ LLXMLNode *LLInventoryItem::exportFileXML(BOOL include_asset_key) const } } - LLString type_str = LLAssetType::lookup(mType); - LLString inv_type_str = LLInventoryType::lookup(mInventoryType); + std::string type_str = LLAssetType::lookup(mType); + std::string inv_type_str = LLInventoryType::lookup(mInventoryType); - ret->createChild("asset_type", FALSE)->setStringValue(1, &type_str); - ret->createChild("inventory_type", FALSE)->setStringValue(1, &inv_type_str); + ret->createChild("asset_type", FALSE)->setStringValue(type_str); + ret->createChild("inventory_type", FALSE)->setStringValue(inv_type_str); S32 tmp_flags = (S32) mFlags; ret->createChild("flags", FALSE)->setByteValue(4, (U8*)(&tmp_flags), LLXMLNode::ENCODING_HEX); mSaleInfo.exportFileXML()->setParent(ret); - LLString temp; + std::string temp; temp.assign(mName); - ret->createChild("name", FALSE)->setStringValue(1, &temp); + ret->createChild("name", FALSE)->setStringValue(temp); temp.assign(mDescription); - ret->createChild("description", FALSE)->setStringValue(1, &temp); + ret->createChild("description", FALSE)->setStringValue(temp); S32 date = mCreationDate; ret->createChild("creation_date", FALSE)->setIntValue(1, &date); @@ -1150,9 +1146,9 @@ BOOL LLInventoryItem::importXML(LLXMLNode* node) cipher.decrypt(mAssetUUID.mData, UUID_BYTES); } if (node->getChild("asset_type", sub_node)) - mType = LLAssetType::lookup(sub_node->getValue().c_str()); + mType = LLAssetType::lookup(sub_node->getValue()); if (node->getChild("inventory_type", sub_node)) - mInventoryType = LLInventoryType::lookup(sub_node->getValue().c_str()); + mInventoryType = LLInventoryType::lookup(sub_node->getValue()); if (node->getChild("flags", sub_node)) { S32 tmp_flags = 0; @@ -1198,32 +1194,32 @@ S32 LLInventoryItem::packBinaryBucket(U8* bin_bucket, LLPermissions* perm_overri // describe the inventory item char* buffer = (char*) bin_bucket; - char creator_id_str[UUID_STR_LENGTH]; /* Flawfinder: ignore */ + std::string creator_id_str; perm.getCreator().toString(creator_id_str); - char owner_id_str[UUID_STR_LENGTH]; /* Flawfinder: ignore */ + std::string owner_id_str; perm.getOwner().toString(owner_id_str); - char last_owner_id_str[UUID_STR_LENGTH]; /* Flawfinder: ignore */ + std::string last_owner_id_str; perm.getLastOwner().toString(last_owner_id_str); - char group_id_str[UUID_STR_LENGTH]; /* Flawfinder: ignore */ + std::string group_id_str; perm.getGroup().toString(group_id_str); - char asset_id_str[UUID_STR_LENGTH]; /* Flawfinder: ignore */ + std::string asset_id_str; getAssetUUID().toString(asset_id_str); S32 size = sprintf(buffer, /* Flawfinder: ignore */ "%d|%d|%s|%s|%s|%s|%s|%x|%x|%x|%x|%x|%s|%s|%d|%d|%x", getType(), getInventoryType(), getName().c_str(), - creator_id_str, - owner_id_str, - last_owner_id_str, - group_id_str, + creator_id_str.c_str(), + owner_id_str.c_str(), + last_owner_id_str.c_str(), + group_id_str.c_str(), perm.getMaskBase(), perm.getMaskOwner(), perm.getMaskGroup(), perm.getMaskEveryone(), perm.getMaskNextOwner(), - asset_id_str, + asset_id_str.c_str(), getDescription().c_str(), getSaleInfo().getSaleType(), getSaleInfo().getSalePrice(), @@ -1274,7 +1270,7 @@ void LLInventoryItem::unpackBinaryBucket(U8* bin_bucket, S32 bin_bucket_size) inv_type = (LLInventoryType::EType)(atoi((*(iter++)).c_str())); setInventoryType( inv_type ); - LLString name((*(iter++)).c_str()); + std::string name((*(iter++)).c_str()); rename( name ); LLUUID creator_id((*(iter++)).c_str()); @@ -1295,7 +1291,7 @@ void LLInventoryItem::unpackBinaryBucket(U8* bin_bucket, S32 bin_bucket_size) LLUUID asset_id((*(iter++)).c_str()); setAssetUUID(asset_id); - LLString desc((*(iter++)).c_str()); + std::string desc((*(iter++)).c_str()); setDescription(desc); LLSaleInfo::EForSale sale_type; @@ -1314,7 +1310,7 @@ void LLInventoryItem::unpackBinaryBucket(U8* bin_bucket, S32 bin_bucket_size) // returns TRUE if a should appear before b BOOL item_dictionary_sort( LLInventoryItem* a, LLInventoryItem* b ) { - return (LLString::compareDict( a->getName().c_str(), b->getName().c_str() ) < 0); + return (LLStringUtil::compareDict( a->getName().c_str(), b->getName().c_str() ) < 0); } // returns TRUE if a should appear before b @@ -1332,7 +1328,7 @@ LLInventoryCategory::LLInventoryCategory( const LLUUID& uuid, const LLUUID& parent_uuid, LLAssetType::EType preferred_type, - const LLString& name) : + const std::string& name) : LLInventoryObject(uuid, parent_uuid, LLAssetType::AT_CATEGORY, name), mPreferredType(preferred_type) { @@ -1418,8 +1414,8 @@ bool LLInventoryCategory::fromLLSD(LLSD& sd) if (sd.has(w)) { mName = sd[w].asString(); - LLString::replaceNonstandardASCII(mName, ' '); - LLString::replaceChar(mName, '|', ' '); + LLStringUtil::replaceNonstandardASCII(mName, ' '); + LLStringUtil::replaceChar(mName, '|', ' '); } return true; } @@ -1434,10 +1430,8 @@ void LLInventoryCategory::unpackMessage(LLMessageSystem* msg, S8 type; msg->getS8Fast(block, _PREHASH_Type, type, block_num); mPreferredType = static_cast(type); - char name[DB_INV_ITEM_NAME_BUF_SIZE]; /* Flawfinder: ignore */ - msg->getStringFast(block, _PREHASH_Name, DB_INV_ITEM_NAME_BUF_SIZE, name, block_num); - mName.assign(name); - LLString::replaceNonstandardASCII(mName, ' '); + msg->getStringFast(block, _PREHASH_Name, mName, block_num); + LLStringUtil::replaceNonstandardASCII(mName, ' '); } // virtual @@ -1495,8 +1489,8 @@ BOOL LLInventoryCategory::importFile(LLFILE* fp) " %254s %254[^|]", keyword, valuestr); mName.assign(valuestr); - LLString::replaceNonstandardASCII(mName, ' '); - LLString::replaceChar(mName, '|', ' '); + LLStringUtil::replaceNonstandardASCII(mName, ' '); + LLStringUtil::replaceChar(mName, '|', ' '); } else { @@ -1509,12 +1503,12 @@ BOOL LLInventoryCategory::importFile(LLFILE* fp) BOOL LLInventoryCategory::exportFile(LLFILE* fp, BOOL) const { - char uuid_str[UUID_STR_LENGTH]; /* Flawfinder: ignore */ + std::string uuid_str; fprintf(fp, "\tinv_category\t0\n\t{\n"); mUUID.toString(uuid_str); - fprintf(fp, "\t\tcat_id\t%s\n", uuid_str); + fprintf(fp, "\t\tcat_id\t%s\n", uuid_str.c_str()); mParentUUID.toString(uuid_str); - fprintf(fp, "\t\tparent_id\t%s\n", uuid_str); + fprintf(fp, "\t\tparent_id\t%s\n", uuid_str.c_str()); fprintf(fp, "\t\ttype\t%s\n", LLAssetType::lookup(mType)); fprintf(fp, "\t\tpref_type\t%s\n", LLAssetType::lookup(mPreferredType)); fprintf(fp, "\t\tname\t%s|\n", mName.c_str()); @@ -1574,8 +1568,8 @@ BOOL LLInventoryCategory::importLegacyStream(std::istream& input_stream) " %254s %254[^|]", keyword, valuestr); mName.assign(valuestr); - LLString::replaceNonstandardASCII(mName, ' '); - LLString::replaceChar(mName, '|', ' '); + LLStringUtil::replaceNonstandardASCII(mName, ' '); + LLStringUtil::replaceChar(mName, '|', ' '); } else { @@ -1588,7 +1582,7 @@ BOOL LLInventoryCategory::importLegacyStream(std::istream& input_stream) BOOL LLInventoryCategory::exportLegacyStream(std::ostream& output_stream, BOOL) const { - char uuid_str[UUID_STR_LENGTH]; /* Flawfinder: ignore */ + std::string uuid_str; output_stream << "\tinv_category\t0\n\t{\n"; mUUID.toString(uuid_str); output_stream << "\t\tcat_id\t" << uuid_str << "\n"; @@ -1638,7 +1632,7 @@ LLPointer ll_create_item_from_sd(const LLSD& sd_item) rv->setParent(sd_item[INV_PARENT_ID_LABEL].asUUID()); rv->rename(sd_item[INV_NAME_LABEL].asString()); rv->setType( - LLAssetType::lookup(sd_item[INV_ASSET_TYPE_LABEL].asString().c_str())); + LLAssetType::lookup(sd_item[INV_ASSET_TYPE_LABEL].asString())); if (sd_item.has("shadow_id")) { LLUUID asset_id = sd_item["shadow_id"]; @@ -1655,7 +1649,7 @@ LLPointer ll_create_item_from_sd(const LLSD& sd_item) rv->setPermissions(ll_permissions_from_sd(sd_item[INV_PERMISSIONS_LABEL])); rv->setInventoryType( LLInventoryType::lookup( - sd_item[INV_INVENTORY_TYPE_LABEL].asString().c_str())); + sd_item[INV_INVENTORY_TYPE_LABEL].asString())); rv->setFlags((U32)(sd_item[INV_FLAGS_LABEL].asInteger())); rv->setCreationDate(sd_item[INV_CREATION_DATE_LABEL].asInteger()); return rv; @@ -1690,9 +1684,9 @@ LLPointer ll_create_category_from_sd(const LLSD& sd_cat) rv->setParent(sd_cat[INV_PARENT_ID_LABEL].asUUID()); rv->rename(sd_cat[INV_NAME_LABEL].asString()); rv->setType( - LLAssetType::lookup(sd_cat[INV_ASSET_TYPE_LABEL].asString().c_str())); + LLAssetType::lookup(sd_cat[INV_ASSET_TYPE_LABEL].asString())); rv->setPreferredType( LLAssetType::lookup( - sd_cat[INV_PREFERRED_TYPE_LABEL].asString().c_str())); + sd_cat[INV_PREFERRED_TYPE_LABEL].asString())); return rv; } diff --git a/indra/llinventory/llinventory.h b/indra/llinventory/llinventory.h index 6655d6f215..af4b85e9a1 100644 --- a/indra/llinventory/llinventory.h +++ b/indra/llinventory/llinventory.h @@ -75,7 +75,7 @@ protected: LLUUID mUUID; LLUUID mParentUUID; LLAssetType::EType mType; - LLString mName; + std::string mName; protected: virtual ~LLInventoryObject( void ); @@ -83,19 +83,19 @@ protected: public: MEM_TYPE_NEW(LLMemType::MTYPE_INVENTORY); LLInventoryObject(const LLUUID& uuid, const LLUUID& parent_uuid, - LLAssetType::EType type, const LLString& name); + LLAssetType::EType type, const std::string& name); LLInventoryObject(); void copyObject(const LLInventoryObject* other); // LLRefCount requires custom copy // accessors const LLUUID& getUUID() const; const LLUUID& getParentUUID() const; - const LLString& getName() const; + const std::string& getName() const; LLAssetType::EType getType() const; // mutators - will not call updateServer(); void setUUID(const LLUUID& new_uuid); - void rename(const LLString& new_name); + void rename(const std::string& new_name); void setParent(const LLUUID& new_parent); void setType(LLAssetType::EType type); @@ -128,7 +128,7 @@ public: protected: LLPermissions mPermissions; LLUUID mAssetUUID; - LLString mDescription; + std::string mDescription; LLSaleInfo mSaleInfo; LLInventoryType::EType mInventoryType; U32 mFlags; @@ -212,8 +212,8 @@ public: const LLUUID& asset_uuid, LLAssetType::EType type, LLInventoryType::EType inv_type, - const LLString& name, - const LLString& desc, + const std::string& name, + const std::string& desc, const LLSaleInfo& sale_info, U32 flags, S32 creation_date_utc); @@ -233,7 +233,7 @@ public: const LLPermissions& getPermissions() const; const LLUUID& getCreatorUUID() const; const LLUUID& getAssetUUID() const; - const LLString& getDescription() const; + const std::string& getDescription() const; const LLSaleInfo& getSaleInfo() const; LLInventoryType::EType getInventoryType() const; U32 getFlags() const; @@ -243,7 +243,7 @@ public: // mutators - will not call updateServer(), and will never fail // (though it may correct to sane values) void setAssetUUID(const LLUUID& asset_id); - void setDescription(const LLString& new_desc); + void setDescription(const std::string& new_desc); void setSaleInfo(const LLSaleInfo& sale_info); void setPermissions(const LLPermissions& perm); void setInventoryType(LLInventoryType::EType inv_type); @@ -303,7 +303,7 @@ public: MEM_TYPE_NEW(LLMemType::MTYPE_INVENTORY); LLInventoryCategory(const LLUUID& uuid, const LLUUID& parent_uuid, LLAssetType::EType preferred_type, - const LLString& name); + const std::string& name); LLInventoryCategory(); LLInventoryCategory(const LLInventoryCategory* other); void copyCategory(const LLInventoryCategory* other); // LLRefCount requires custom copy diff --git a/indra/llinventory/llinventorytype.cpp b/indra/llinventory/llinventorytype.cpp index ac16cea499..1ffda0b059 100644 --- a/indra/llinventory/llinventorytype.cpp +++ b/indra/llinventory/llinventorytype.cpp @@ -162,12 +162,12 @@ const char* LLInventoryType::lookup(EType type) } // static -LLInventoryType::EType LLInventoryType::lookup(const char* name) +LLInventoryType::EType LLInventoryType::lookup(const std::string& name) { for(S32 i = 0; i < IT_COUNT; ++i) { if((INVENTORY_TYPE_NAMES[i]) - && (0 == strcmp(name, INVENTORY_TYPE_NAMES[i]))) + && (name == INVENTORY_TYPE_NAMES[i])) { // match return (EType)i; diff --git a/indra/llinventory/llinventorytype.h b/indra/llinventory/llinventorytype.h index dcc25028ae..15dfa08203 100644 --- a/indra/llinventory/llinventorytype.h +++ b/indra/llinventory/llinventorytype.h @@ -72,7 +72,7 @@ public: }; // machine transation between type and strings - static EType lookup(const char* name); + static EType lookup(const std::string& name); static const char* lookup(EType type); // translation from a type to a human readable form. diff --git a/indra/llinventory/llnotecard.cpp b/indra/llinventory/llnotecard.cpp index 733a5673c5..60eba2decd 100644 --- a/indra/llinventory/llnotecard.cpp +++ b/indra/llinventory/llnotecard.cpp @@ -222,7 +222,7 @@ bool LLNotecard::importStream(std::istream& str) if(success) { // Actually set the text - mText = text; + mText = std::string(text); } delete[] text; @@ -281,22 +281,12 @@ bool LLNotecard::exportStream( std::ostream& out_stream ) //////////////////////////////////////////////////////////////////////////// -const std::vector >& LLNotecard::getItems() const -{ - return mItems; -} - -LLString& LLNotecard::getText() -{ - return mText; -} - void LLNotecard::setItems(const std::vector >& items) { mItems = items; } -void LLNotecard::setText(const LLString& text) +void LLNotecard::setText(const std::string& text) { mText = text; } diff --git a/indra/llinventory/llnotecard.h b/indra/llinventory/llnotecard.h index 369bf784a1..9940a4ca69 100644 --- a/indra/llinventory/llnotecard.h +++ b/indra/llinventory/llnotecard.h @@ -52,11 +52,12 @@ public: bool importStream(std::istream& str); bool exportStream(std::ostream& str); - const std::vector >& getItems() const; - LLString& getText(); + const std::vector >& getItems() const { return mItems; } + const std::string& getText() const { return mText; } + std::string& getText() { return mText; } void setItems(const std::vector >& items); - void setText(const LLString& text); + void setText(const std::string& text); S32 getVersion() { return mVersion; } S32 getEmbeddedVersion() { return mEmbeddedVersion; } @@ -64,7 +65,7 @@ private: bool importEmbeddedItemsStream(std::istream& str); bool exportEmbeddedItemsStream(std::ostream& str); std::vector > mItems; - LLString mText; + std::string mText; S32 mMaxText; S32 mVersion; S32 mEmbeddedVersion; diff --git a/indra/llinventory/llparcel.cpp b/indra/llinventory/llparcel.cpp index 0b11b6009e..ecf013f042 100644 --- a/indra/llinventory/llparcel.cpp +++ b/indra/llinventory/llparcel.cpp @@ -48,17 +48,18 @@ static const F32 SOME_BIG_NUMBER = 1000.0f; static const F32 SOME_BIG_NEG_NUMBER = -1000.0f; -static const char* PARCEL_OWNERSHIP_STATUS_STRING[LLParcel::OS_COUNT] = +static const std::string PARCEL_OWNERSHIP_STATUS_STRING[LLParcel::OS_COUNT+1] = { "leased", "lease_pending", - "abandoned" + "abandoned", + "none" }; // NOTE: Adding parcel categories also requires updating: // * newview/app_settings/floater_directory.xml category combobox // * Web site "create event" tools -static const char* PARCEL_CATEGORY_STRING[LLParcel::C_COUNT] = +static const std::string PARCEL_CATEGORY_STRING[LLParcel::C_COUNT] = { "none", "linden", @@ -75,7 +76,7 @@ static const char* PARCEL_CATEGORY_STRING[LLParcel::C_COUNT] = "stage", "other", }; -static const char* PARCEL_CATEGORY_UI_STRING[LLParcel::C_COUNT + 1] = +static const std::string PARCEL_CATEGORY_UI_STRING[LLParcel::C_COUNT + 1] = { "None", "Linden Location", @@ -94,7 +95,7 @@ static const char* PARCEL_CATEGORY_UI_STRING[LLParcel::C_COUNT + 1] = "Any", // valid string for parcel searches }; -static const char* PARCEL_ACTION_STRING[LLParcel::A_COUNT + 1] = +static const std::string PARCEL_ACTION_STRING[LLParcel::A_COUNT + 1] = { "create", "release", @@ -132,14 +133,14 @@ const U64 SEVEN_DAYS_IN_USEC = U64L(604800000000); const S32 EXTEND_GRACE_IF_MORE_THAN_SEC = 100000; -const char* ownership_status_to_string(LLParcel::EOwnershipStatus status); -LLParcel::EOwnershipStatus ownership_string_to_status(const char* s); +const std::string& ownership_status_to_string(LLParcel::EOwnershipStatus status); +LLParcel::EOwnershipStatus ownership_string_to_status(const std::string& s); //const char* revert_action_to_string(LLParcel::ESaleTimerExpireAction action); //LLParcel::ESaleTimerExpireAction revert_string_to_action(const char* s); -const char* category_to_string(LLParcel::ECategory category); -const char* category_to_ui_string(LLParcel::ECategory category); -LLParcel::ECategory category_string_to_category(const char* s); -LLParcel::ECategory category_ui_string_to_category(const char* s); +const std::string& category_to_string(LLParcel::ECategory category); +const std::string& category_to_ui_string(LLParcel::ECategory category); +LLParcel::ECategory category_string_to_category(const std::string& s); +LLParcel::ECategory category_ui_string_to_category(const std::string& s); LLParcel::LLParcel() { @@ -207,12 +208,12 @@ void LLParcel::init(const LLUUID &owner_id, setParcelFlag(PF_ALLOW_DAMAGE, damage); mSalePrice = 10000; - setName(NULL); - setDesc(NULL); - setMusicURL(NULL); - setMediaURL(NULL); - setMediaDesc(NULL); - setMediaType(NULL); + setName(LLStringUtil::null); + setDesc(LLStringUtil::null); + setMusicURL(LLStringUtil::null); + setMediaURL(LLStringUtil::null); + setMediaDesc(LLStringUtil::null); + setMediaType(LLStringUtil::null); mMediaID.setNull(); mMediaAutoScale = 0; mMediaLoop = TRUE; @@ -271,22 +272,7 @@ void LLParcel::overrideParcelFlags(U32 flags) { mParcelFlags = flags; } -void set_std_string(const char* src, std::string& dest) -{ - if(src) - { - dest.assign(src); - } - else - { -#if (LL_LINUX && __GNUC__ < 3) - dest.assign(std::string("")); -#else - dest.clear(); -#endif - } -} -void LLParcel::setName(const LLString& name) +void LLParcel::setName(const std::string& name) { // The escaping here must match the escaping in the database // abstraction layer. @@ -294,7 +280,7 @@ void LLParcel::setName(const LLString& name) LLStringFn::replace_nonprintable(mName, LL_UNKNOWN_CHAR); } -void LLParcel::setDesc(const LLString& desc) +void LLParcel::setDesc(const std::string& desc) { // The escaping here must match the escaping in the database // abstraction layer. @@ -302,7 +288,7 @@ void LLParcel::setDesc(const LLString& desc) mDesc = rawstr_to_utf8(mDesc); } -void LLParcel::setMusicURL(const LLString& url) +void LLParcel::setMusicURL(const std::string& url) { mMusicURL = url; // The escaping here must match the escaping in the database @@ -312,7 +298,7 @@ void LLParcel::setMusicURL(const LLString& url) LLStringFn::replace_nonprintable(mMusicURL, LL_UNKNOWN_CHAR); } -void LLParcel::setMediaURL(const LLString& url) +void LLParcel::setMediaURL(const std::string& url) { mMediaURL = url; // The escaping here must match the escaping in the database @@ -322,24 +308,24 @@ void LLParcel::setMediaURL(const LLString& url) LLStringFn::replace_nonprintable(mMediaURL, LL_UNKNOWN_CHAR); } -void LLParcel::setMediaDesc(const char* desc) +void LLParcel::setMediaDesc(const std::string& desc) { // The escaping here must match the escaping in the database // abstraction layer. - set_std_string(desc, mMediaDesc); + mMediaDesc = desc; mMediaDesc = rawstr_to_utf8(mMediaDesc); } -void LLParcel::setMediaType(const char* type) +void LLParcel::setMediaType(const std::string& type) { // The escaping here must match the escaping in the database // abstraction layer. - set_std_string(type, mMediaType); + mMediaType = type; mMediaType = rawstr_to_utf8(mMediaType); // This code attempts to preserve legacy movie functioning if(mMediaType.empty() && ! mMediaURL.empty()) { - setMediaType("video/vnd.secondlife.qt.legacy"); + setMediaType(std::string("video/vnd.secondlife.qt.legacy")); } } void LLParcel::setMediaWidth(S32 width) @@ -578,7 +564,7 @@ BOOL LLParcel::importStream(std::istream& input_stream) while (input_stream.good()) { skip_comments_and_emptyspace(input_stream); - LLString line, keyword, value; + std::string line, keyword, value; get_line(line, input_stream, MAX_STRING); get_keyword_and_value(keyword, value, line); @@ -588,19 +574,19 @@ BOOL LLParcel::importStream(std::istream& input_stream) } else if ("parcel_id" == keyword) { - mID.set(value.c_str()); + mID.set(value); } else if ("status" == keyword) { - mStatus = ownership_string_to_status(value.c_str()); + mStatus = ownership_string_to_status(value); } else if ("category" == keyword) { - mCategory = category_string_to_category(value.c_str()); + mCategory = category_string_to_category(value); } else if ("local_id" == keyword) { - LLString::convertToS32(value, mLocalID); + LLStringUtil::convertToS32(value, mLocalID); } else if ("name" == keyword) { @@ -620,65 +606,65 @@ BOOL LLParcel::importStream(std::istream& input_stream) } else if ("media_desc" == keyword) { - setMediaDesc( value.c_str() ); + setMediaDesc( value ); } else if ("media_type" == keyword) { - setMediaType( value.c_str() ); + setMediaType( value ); } else if ("media_width" == keyword) { S32 width; - LLString::convertToS32(value, width); + LLStringUtil::convertToS32(value, width); setMediaWidth( width ); } else if ("media_height" == keyword) { S32 height; - LLString::convertToS32(value, height); + LLStringUtil::convertToS32(value, height); setMediaHeight( height ); } else if ("media_id" == keyword) { - mMediaID.set( value.c_str() ); + mMediaID.set( value ); } else if ("media_auto_scale" == keyword) { - LLString::convertToU8(value, mMediaAutoScale); + LLStringUtil::convertToU8(value, mMediaAutoScale); } else if ("media_loop" == keyword) { - LLString::convertToU8(value, mMediaLoop); + LLStringUtil::convertToU8(value, mMediaLoop); } else if ("obscure_media" == keyword) { - LLString::convertToU8(value, mObscureMedia); + LLStringUtil::convertToU8(value, mObscureMedia); } else if ("obscure_music" == keyword) { - LLString::convertToU8(value, mObscureMusic); + LLStringUtil::convertToU8(value, mObscureMusic); } else if ("owner_id" == keyword) { - mOwnerID.set( value.c_str() ); + mOwnerID.set( value ); } else if ("group_owned" == keyword) { - LLString::convertToBOOL(value, mGroupOwned); + LLStringUtil::convertToBOOL(value, mGroupOwned); } else if ("clean_other_time" == keyword) { S32 time; - LLString::convertToS32(value, time); + LLStringUtil::convertToS32(value, time); setCleanOtherTime(time); } else if ("auth_buyer_id" == keyword) { - mAuthBuyerID.set(value.c_str()); + mAuthBuyerID.set(value); } else if ("snapshot_id" == keyword) { - mSnapshotID.set(value.c_str()); + mSnapshotID.set(value); } else if ("user_location" == keyword) { @@ -697,7 +683,7 @@ BOOL LLParcel::importStream(std::istream& input_stream) else if ("landing_type" == keyword) { S32 landing_type = 0; - LLString::convertToS32(value, landing_type); + LLStringUtil::convertToS32(value, landing_type); mLandingType = (ELandingType) landing_type; } else if ("join_neighbors" == keyword) @@ -706,7 +692,7 @@ BOOL LLParcel::importStream(std::istream& input_stream) } else if ("revert_sale" == keyword) { - LLString::convertToS32(value, secs_until_revert); + LLStringUtil::convertToS32(value, secs_until_revert); if (secs_until_revert > 0) { mSaleTimerExpires.start(); @@ -715,7 +701,7 @@ BOOL LLParcel::importStream(std::istream& input_stream) } else if("extended_grace" == keyword) { - LLString::convertToS32(value, mGraceExtension); + LLStringUtil::convertToS32(value, mGraceExtension); } else if ("user_list_type" == keyword) { @@ -723,147 +709,147 @@ BOOL LLParcel::importStream(std::istream& input_stream) } else if("auction_id" == keyword) { - LLString::convertToU32(value, mAuctionID); + LLStringUtil::convertToU32(value, mAuctionID); } else if ("allow_modify" == keyword) { - LLString::convertToU32(value, setting); + LLStringUtil::convertToU32(value, setting); setParcelFlag(PF_CREATE_OBJECTS, setting); } else if ("allow_group_modify" == keyword) { - LLString::convertToU32(value, setting); + LLStringUtil::convertToU32(value, setting); setParcelFlag(PF_CREATE_GROUP_OBJECTS, setting); } else if ("allow_all_object_entry" == keyword) { - LLString::convertToU32(value, setting); + LLStringUtil::convertToU32(value, setting); setParcelFlag(PF_ALLOW_ALL_OBJECT_ENTRY, setting); } else if ("allow_group_object_entry" == keyword) { - LLString::convertToU32(value, setting); + LLStringUtil::convertToU32(value, setting); setParcelFlag(PF_ALLOW_GROUP_OBJECT_ENTRY, setting); } else if ("allow_deed_to_group" == keyword) { - LLString::convertToU32(value, setting); + LLStringUtil::convertToU32(value, setting); setParcelFlag(PF_ALLOW_DEED_TO_GROUP, setting); } else if("contribute_with_deed" == keyword) { - LLString::convertToU32(value, setting); + LLStringUtil::convertToU32(value, setting); setParcelFlag(PF_CONTRIBUTE_WITH_DEED, setting); } else if ("allow_terraform" == keyword) { - LLString::convertToU32(value, setting); + LLStringUtil::convertToU32(value, setting); setParcelFlag(PF_ALLOW_TERRAFORM, setting); } else if ("allow_damage" == keyword) { - LLString::convertToU32(value, setting); + LLStringUtil::convertToU32(value, setting); setParcelFlag(PF_ALLOW_DAMAGE, setting); } else if ("allow_fly" == keyword) { - LLString::convertToU32(value, setting); + LLStringUtil::convertToU32(value, setting); setParcelFlag(PF_ALLOW_FLY, setting); } else if ("allow_landmark" == keyword) { - LLString::convertToU32(value, setting); + LLStringUtil::convertToU32(value, setting); setParcelFlag(PF_ALLOW_LANDMARK, setting); } else if ("sound_local" == keyword) { - LLString::convertToU32(value, setting); + LLStringUtil::convertToU32(value, setting); setParcelFlag(PF_SOUND_LOCAL, setting); } else if ("allow_group_scripts" == keyword) { - LLString::convertToU32(value, setting); + LLStringUtil::convertToU32(value, setting); setParcelFlag(PF_ALLOW_GROUP_SCRIPTS, setting); } else if ("allow_voice_chat" == keyword) { - LLString::convertToU32(value, setting); + LLStringUtil::convertToU32(value, setting); setParcelFlag(PF_ALLOW_VOICE_CHAT, setting); } else if ("use_estate_voice_chan" == keyword) { - LLString::convertToU32(value, setting); + LLStringUtil::convertToU32(value, setting); setParcelFlag(PF_USE_ESTATE_VOICE_CHAN, setting); } else if ("allow_scripts" == keyword) { - LLString::convertToU32(value, setting); + LLStringUtil::convertToU32(value, setting); setParcelFlag(PF_ALLOW_OTHER_SCRIPTS, setting); } else if ("for_sale" == keyword) { - LLString::convertToU32(value, setting); + LLStringUtil::convertToU32(value, setting); setParcelFlag(PF_FOR_SALE, setting); } else if ("sell_w_objects" == keyword) { - LLString::convertToU32(value, setting); + LLStringUtil::convertToU32(value, setting); setParcelFlag(PF_SELL_PARCEL_OBJECTS, setting); } else if ("use_pass_list" == keyword) { - LLString::convertToU32(value, setting); + LLStringUtil::convertToU32(value, setting); setParcelFlag(PF_USE_PASS_LIST, setting); } else if ("show_directory" == keyword) { - LLString::convertToU32(value, setting); + LLStringUtil::convertToU32(value, setting); setParcelFlag(PF_SHOW_DIRECTORY, setting); } else if ("allow_publish" == keyword) { - LLString::convertToU32(value, setting); + LLStringUtil::convertToU32(value, setting); setParcelFlag(PF_ALLOW_PUBLISH, setting); } else if ("mature_publish" == keyword) { - LLString::convertToU32(value, setting); + LLStringUtil::convertToU32(value, setting); setParcelFlag(PF_MATURE_PUBLISH, setting); } else if ("claim_date" == keyword) { // BUG: This will fail when time rolls over in 2038. S32 time; - LLString::convertToS32(value, time); + LLStringUtil::convertToS32(value, time); mClaimDate = time; } else if ("claim_price" == keyword) { - LLString::convertToS32(value, mClaimPricePerMeter); + LLStringUtil::convertToS32(value, mClaimPricePerMeter); } else if ("rent_price" == keyword) { - LLString::convertToS32(value, mRentPricePerMeter); + LLStringUtil::convertToS32(value, mRentPricePerMeter); } else if ("discount_rate" == keyword) { - LLString::convertToF32(value, mDiscountRate); + LLStringUtil::convertToF32(value, mDiscountRate); } else if ("draw_distance" == keyword) { - LLString::convertToF32(value, mDrawDistance); + LLStringUtil::convertToF32(value, mDrawDistance); } else if ("sale_price" == keyword) { - LLString::convertToS32(value, mSalePrice); + LLStringUtil::convertToS32(value, mSalePrice); } else if ("pass_price" == keyword) { - LLString::convertToS32(value, mPassPrice); + LLStringUtil::convertToS32(value, mPassPrice); } else if ("pass_hours" == keyword) { - LLString::convertToF32(value, mPassHours); + LLStringUtil::convertToF32(value, mPassHours); } else if ("box" == keyword) { @@ -876,17 +862,17 @@ BOOL LLParcel::importStream(std::istream& input_stream) } else if ("use_access_group" == keyword) { - LLString::convertToU32(value, setting); + LLStringUtil::convertToU32(value, setting); setParcelFlag(PF_USE_ACCESS_GROUP, setting); } else if ("use_access_list" == keyword) { - LLString::convertToU32(value, setting); + LLStringUtil::convertToU32(value, setting); setParcelFlag(PF_USE_ACCESS_LIST, setting); } else if ("use_ban_list" == keyword) { - LLString::convertToU32(value, setting); + LLStringUtil::convertToU32(value, setting); setParcelFlag(PF_USE_BAN_LIST, setting); } else if ("group_name" == keyword) @@ -895,7 +881,7 @@ BOOL LLParcel::importStream(std::istream& input_stream) } else if ("group_id" == keyword) { - mGroupID.set( value.c_str() ); + mGroupID.set( value ); } // TODO: DEPRECATED FLAG // Flag removed from simstate files in 1.11.1 @@ -903,7 +889,7 @@ BOOL LLParcel::importStream(std::istream& input_stream) // no longer exists anywhere in simstate files. else if ("require_identified" == keyword) { - // LLString::convertToU32(value, setting); + // LLStringUtil::convertToU32(value, setting); // setParcelFlag(PF_DENY_ANONYMOUS, setting); } // TODO: DEPRECATED FLAG @@ -912,39 +898,39 @@ BOOL LLParcel::importStream(std::istream& input_stream) // no longer exists anywhere in simstate files. else if ("require_transacted" == keyword) { - // LLString::convertToU32(value, setting); + // LLStringUtil::convertToU32(value, setting); // setParcelFlag(PF_DENY_ANONYMOUS, setting); // setParcelFlag(PF_DENY_IDENTIFIED, setting); } else if ("restrict_pushobject" == keyword) { - LLString::convertToU32(value, setting); + LLStringUtil::convertToU32(value, setting); setParcelFlag(PF_RESTRICT_PUSHOBJECT, setting); } else if ("deny_anonymous" == keyword) { - LLString::convertToU32(value, setting); + LLStringUtil::convertToU32(value, setting); setParcelFlag(PF_DENY_ANONYMOUS, setting); } else if ("deny_identified" == keyword) { -// LLString::convertToU32(value, setting); +// LLStringUtil::convertToU32(value, setting); // setParcelFlag(PF_DENY_IDENTIFIED, setting); } else if ("deny_transacted" == keyword) { -// LLString::convertToU32(value, setting); +// LLStringUtil::convertToU32(value, setting); // setParcelFlag(PF_DENY_TRANSACTED, setting); } else if ("deny_age_unverified" == keyword) { - LLString::convertToU32(value, setting); + LLStringUtil::convertToU32(value, setting); setParcelFlag(PF_DENY_AGEUNVERIFIED, setting); } else if ("access_list" == keyword) { S32 entry_count = 0; - LLString::convertToS32(value, entry_count); + LLStringUtil::convertToS32(value, entry_count); for (S32 i = 0; i < entry_count; i++) { LLAccessEntry entry; @@ -957,7 +943,7 @@ BOOL LLParcel::importStream(std::istream& input_stream) else if ("ban_list" == keyword) { S32 entry_count = 0; - LLString::convertToS32(value, entry_count); + LLStringUtil::convertToS32(value, entry_count); for (S32 i = 0; i < entry_count; i++) { LLAccessEntry entry; @@ -971,7 +957,7 @@ BOOL LLParcel::importStream(std::istream& input_stream) { /* S32 entry_count = 0; - LLString::convertToS32(value, entry_count); + LLStringUtil::convertToS32(value, entry_count); for (S32 i = 0; i < entry_count; i++) { LLAccessEntry entry; @@ -985,7 +971,7 @@ BOOL LLParcel::importStream(std::istream& input_stream) { // legacy - put into access list S32 entry_count = 0; - LLString::convertToS32(value, entry_count); + LLStringUtil::convertToS32(value, entry_count); for (S32 i = 0; i < entry_count; i++) { LLAccessEntry entry; @@ -1061,7 +1047,7 @@ BOOL LLParcel::importAccessEntry(std::istream& input_stream, LLAccessEntry* entr while (input_stream.good()) { skip_comments_and_emptyspace(input_stream); - LLString line, keyword, value; + std::string line, keyword, value; get_line(line, input_stream, MAX_STRING); get_keyword_and_value(keyword, value, line); @@ -1071,7 +1057,7 @@ BOOL LLParcel::importAccessEntry(std::istream& input_stream, LLAccessEntry* entr } else if ("id" == keyword) { - entry->mID.set( value.c_str() ); + entry->mID.set( value ); } else if ("name" == keyword) { @@ -1080,13 +1066,13 @@ BOOL LLParcel::importAccessEntry(std::istream& input_stream, LLAccessEntry* entr else if ("time" == keyword) { S32 when; - LLString::convertToS32(value, when); + LLStringUtil::convertToS32(value, when); entry->mTime = when; } else if ("flags" == keyword) { U32 setting; - LLString::convertToU32(value, setting); + LLStringUtil::convertToU32(value, setting); entry->mFlags = setting; } else @@ -1101,7 +1087,7 @@ BOOL LLParcel::importAccessEntry(std::istream& input_stream, LLAccessEntry* entr BOOL LLParcel::exportStream(std::ostream& output_stream) { S32 setting; - char id_string[MAX_STRING]; /* Flawfinder: ignore */ + std::string id_string; std::ios::fmtflags old_flags = output_stream.flags(); output_stream.setf(std::ios::showpoint); @@ -1377,17 +1363,17 @@ void LLParcel::packMessage(LLSD& msg) void LLParcel::unpackMessage(LLMessageSystem* msg) { - char buffer[256]; /* Flawfinder: ignore */ + std::string buffer; msg->getU32Fast( _PREHASH_ParcelData,_PREHASH_ParcelFlags, mParcelFlags ); msg->getS32Fast( _PREHASH_ParcelData,_PREHASH_SalePrice, mSalePrice ); - msg->getStringFast( _PREHASH_ParcelData,_PREHASH_Name, 256, buffer ); + msg->getStringFast( _PREHASH_ParcelData,_PREHASH_Name, buffer ); setName(buffer); - msg->getStringFast( _PREHASH_ParcelData,_PREHASH_Desc, 256, buffer ); + msg->getStringFast( _PREHASH_ParcelData,_PREHASH_Desc, buffer ); setDesc(buffer); - msg->getStringFast( _PREHASH_ParcelData,_PREHASH_MusicURL, 256, buffer ); + msg->getStringFast( _PREHASH_ParcelData,_PREHASH_MusicURL, buffer ); setMusicURL(buffer); - msg->getStringFast( _PREHASH_ParcelData,_PREHASH_MediaURL, 256, buffer ); + msg->getStringFast( _PREHASH_ParcelData,_PREHASH_MediaURL, buffer ); setMediaURL(buffer); // non-optimized version @@ -1412,9 +1398,9 @@ void LLParcel::unpackMessage(LLMessageSystem* msg) // Note: the message has been converted to TCP if(msg->getNumberOfBlocks("MediaData") > 0) { - msg->getString("MediaData", "MediaDesc", 256, buffer); + msg->getString("MediaData", "MediaDesc", buffer); setMediaDesc(buffer); - msg->getString("MediaData", "MediaType", 256, buffer); + msg->getString("MediaData", "MediaType", buffer); setMediaType(buffer); msg->getS32("MediaData", "MediaWidth", mMediaWidth); msg->getS32("MediaData", "MediaHeight", mMediaHeight); @@ -1424,8 +1410,8 @@ void LLParcel::unpackMessage(LLMessageSystem* msg) } else { - setMediaType("video/vnd.secondlife.qt.legacy"); - setMediaDesc("No Description available without Server Upgrade"); + setMediaType(std::string("video/vnd.secondlife.qt.legacy")); + setMediaDesc(std::string("No Description available without Server Upgrade")); mMediaLoop = true; mObscureMedia = true; mObscureMusic = true; @@ -1688,37 +1674,37 @@ BOOL LLParcel::removeFromBanList(const LLUUID& agent_id) } // static -const char* LLParcel::getOwnershipStatusString(EOwnershipStatus status) +const std::string& LLParcel::getOwnershipStatusString(EOwnershipStatus status) { return ownership_status_to_string(status); } // static -const char* LLParcel::getCategoryString(ECategory category) +const std::string& LLParcel::getCategoryString(ECategory category) { return category_to_string(category); } // static -const char* LLParcel::getCategoryUIString(ECategory category) +const std::string& LLParcel::getCategoryUIString(ECategory category) { return category_to_ui_string(category); } // static -LLParcel::ECategory LLParcel::getCategoryFromString(const char* string) +LLParcel::ECategory LLParcel::getCategoryFromString(const std::string& string) { return category_string_to_category(string); } // static -LLParcel::ECategory LLParcel::getCategoryFromUIString(const char* string) +LLParcel::ECategory LLParcel::getCategoryFromUIString(const std::string& string) { return category_ui_string_to_category(string); } // static -const char* LLParcel::getActionString(LLParcel::EAction action) +const std::string& LLParcel::getActionString(LLParcel::EAction action) { S32 index = 0; if((action >= 0) && (action < LLParcel::A_COUNT)) @@ -1851,19 +1837,19 @@ BOOL LLParcel::isBuyerAuthorized(const LLUUID& buyer_id) const void LLParcel::clearParcel() { overrideParcelFlags(PF_DEFAULT); - setName(NULL); - setDesc(NULL); - setMediaURL(NULL); - setMediaType(NULL); + setName(LLStringUtil::null); + setDesc(LLStringUtil::null); + setMediaURL(LLStringUtil::null); + setMediaType(LLStringUtil::null); setMediaID(LLUUID::null); - setMediaDesc(NULL); + setMediaDesc(LLStringUtil::null); setMediaAutoScale(0); setMediaLoop(TRUE); mObscureMedia = 1; mObscureMusic = 1; mMediaWidth = 0; mMediaHeight = 0; - setMusicURL(NULL); + setMusicURL(LLStringUtil::null); setInEscrow(FALSE); setAuthorizedBuyerID(LLUUID::null); setCategory(C_NONE); @@ -1887,20 +1873,20 @@ void LLParcel::dump() llinfos << " desc <" << mDesc << ">" << llendl; } -const char* ownership_status_to_string(LLParcel::EOwnershipStatus status) +const std::string& ownership_status_to_string(LLParcel::EOwnershipStatus status) { if(status >= 0 && status < LLParcel::OS_COUNT) { return PARCEL_OWNERSHIP_STATUS_STRING[status]; } - return "none"; + return PARCEL_OWNERSHIP_STATUS_STRING[LLParcel::OS_COUNT]; } -LLParcel::EOwnershipStatus ownership_string_to_status(const char* s) +LLParcel::EOwnershipStatus ownership_string_to_status(const std::string& s) { for(S32 i = 0; i < LLParcel::OS_COUNT; ++i) { - if(0 == strcmp(s, PARCEL_OWNERSHIP_STATUS_STRING[i])) + if(s == PARCEL_OWNERSHIP_STATUS_STRING[i]) { return (LLParcel::EOwnershipStatus)i; } @@ -1930,7 +1916,7 @@ LLParcel::EOwnershipStatus ownership_string_to_status(const char* s) // return LLParcel::STEA_REVERT; //} -const char* category_to_string(LLParcel::ECategory category) +const std::string& category_to_string(LLParcel::ECategory category) { S32 index = 0; if((category >= 0) && (category < LLParcel::C_COUNT)) @@ -1940,7 +1926,7 @@ const char* category_to_string(LLParcel::ECategory category) return PARCEL_CATEGORY_STRING[index]; } -const char* category_to_ui_string(LLParcel::ECategory category) +const std::string& category_to_ui_string(LLParcel::ECategory category) { S32 index = 0; if((category >= 0) && (category < LLParcel::C_COUNT)) @@ -1955,11 +1941,11 @@ const char* category_to_ui_string(LLParcel::ECategory category) return PARCEL_CATEGORY_UI_STRING[index]; } -LLParcel::ECategory category_string_to_category(const char* s) +LLParcel::ECategory category_string_to_category(const std::string& s) { for(S32 i = 0; i < LLParcel::C_COUNT; ++i) { - if(0 == strcmp(s, PARCEL_CATEGORY_STRING[i])) + if(s == PARCEL_CATEGORY_STRING[i]) { return (LLParcel::ECategory)i; } @@ -1968,11 +1954,11 @@ LLParcel::ECategory category_string_to_category(const char* s) return LLParcel::C_NONE; } -LLParcel::ECategory category_ui_string_to_category(const char* s) +LLParcel::ECategory category_ui_string_to_category(const std::string& s) { for(S32 i = 0; i < LLParcel::C_COUNT; ++i) { - if(0 == strcmp(s, PARCEL_CATEGORY_UI_STRING[i])) + if(s == PARCEL_CATEGORY_UI_STRING[i]) { return (LLParcel::ECategory)i; } diff --git a/indra/llinventory/llparcel.h b/indra/llinventory/llparcel.h index 5d3a2b01ec..716802b2dc 100644 --- a/indra/llinventory/llparcel.h +++ b/indra/llinventory/llparcel.h @@ -207,12 +207,12 @@ public: // MANIPULATORS void generateNewID() { mID.generate(); } - void setName(const LLString& name); - void setDesc(const LLString& desc); - void setMusicURL(const LLString& url); - void setMediaURL(const LLString& url); - void setMediaType(const char* type); - void setMediaDesc(const char* desc); + void setName(const std::string& name); + void setDesc(const std::string& desc); + void setMusicURL(const std::string& url); + void setMediaURL(const std::string& url); + void setMediaType(const std::string& type); + void setMediaDesc(const std::string& desc); void setMediaID(const LLUUID& id) { mMediaID = id; } void setMediaAutoScale ( U8 flagIn ) { mMediaAutoScale = flagIn; } void setMediaLoop (U8 loop) { mMediaLoop = loop; } @@ -266,7 +266,7 @@ public: void setDrawDistance(F32 dist) { mDrawDistance = dist; } void setSalePrice(S32 price) { mSalePrice = price; } void setGroupID(const LLUUID& id) { mGroupID = id; } - //void setGroupName(const LLString& s) { mGroupName.assign(s); } + //void setGroupName(const std::string& s) { mGroupName.assign(s); } void setPassPrice(S32 price) { mPassPrice = price; } void setPassHours(F32 hours) { mPassHours = hours; } @@ -303,12 +303,12 @@ public: // ACCESSORS const LLUUID& getID() const { return mID; } - const LLString& getName() const { return mName; } - const LLString& getDesc() const { return mDesc; } - const LLString& getMusicURL() const { return mMusicURL; } - const LLString& getMediaURL() const { return mMediaURL; } - const char* getMediaDesc() const { return mMediaDesc.c_str(); } - const char* getMediaType() const { return mMediaType.c_str(); } + const std::string& getName() const { return mName; } + const std::string& getDesc() const { return mDesc; } + const std::string& getMusicURL() const { return mMusicURL; } + const std::string& getMediaURL() const { return mMediaURL; } + const std::string& getMediaDesc() const { return mMediaDesc; } + const std::string& getMediaType() const { return mMediaType; } const LLUUID& getMediaID() const { return mMediaID; } S32 getMediaWidth() const { return mMediaWidth; } S32 getMediaHeight() const { return mMediaHeight; } @@ -351,18 +351,18 @@ public: // functions to deal with ownership status. EOwnershipStatus getOwnershipStatus() const { return mStatus; } - static const char* getOwnershipStatusString(EOwnershipStatus status); + static const std::string& getOwnershipStatusString(EOwnershipStatus status); void setOwnershipStatus(EOwnershipStatus status) { mStatus = status; } // dealing with parcel category information ECategory getCategory() const {return mCategory; } - static const char* getCategoryString(ECategory category); - static const char* getCategoryUIString(ECategory category); - static ECategory getCategoryFromString(const char* string); - static ECategory getCategoryFromUIString(const char* string); + static const std::string& getCategoryString(ECategory category); + static const std::string& getCategoryUIString(ECategory category); + static ECategory getCategoryFromString(const std::string& string); + static ECategory getCategoryFromUIString(const std::string& string); // functions for parcel action (used for logging) - static const char* getActionString(EAction action); + static const std::string& getActionString(EAction action); // dealing with sales and parcel conversion. // @@ -587,12 +587,12 @@ protected: F32 mDrawDistance; U32 mParcelFlags; S32 mSalePrice; // linden dollars - LLString mName; - LLString mDesc; - LLString mMusicURL; - LLString mMediaURL; - std::string mMediaDesc; - std::string mMediaType; + std::string mName; + std::string mDesc; + std::string mMusicURL; + std::string mMediaURL; + std::string mMediaDesc; + std::string mMediaType; S32 mMediaWidth; S32 mMediaHeight; U8 mMediaAutoScale; diff --git a/indra/llinventory/llpermissions.cpp b/indra/llinventory/llpermissions.cpp index b137eeff33..cf9937629a 100644 --- a/indra/llinventory/llpermissions.cpp +++ b/indra/llinventory/llpermissions.cpp @@ -650,7 +650,7 @@ BOOL LLPermissions::importFile(LLFILE* fp) BOOL LLPermissions::exportFile(LLFILE* fp) const { - char uuid_str[256]; /* Flawfinder: ignore */ + std::string uuid_str; fprintf(fp, "\tpermissions 0\n"); fprintf(fp, "\t{\n"); @@ -662,16 +662,16 @@ BOOL LLPermissions::exportFile(LLFILE* fp) const fprintf(fp, "\t\tnext_owner_mask\t%08x\n", mMaskNextOwner); mCreator.toString(uuid_str); - fprintf(fp, "\t\tcreator_id\t%s\n", uuid_str); + fprintf(fp, "\t\tcreator_id\t%s\n", uuid_str.c_str()); mOwner.toString(uuid_str); - fprintf(fp, "\t\towner_id\t%s\n", uuid_str); + fprintf(fp, "\t\towner_id\t%s\n", uuid_str.c_str()); mLastOwner.toString(uuid_str); - fprintf(fp, "\t\tlast_owner_id\t%s\n", uuid_str); + fprintf(fp, "\t\tlast_owner_id\t%s\n", uuid_str.c_str()); mGroup.toString(uuid_str); - fprintf(fp, "\t\tgroup_id\t%s\n", uuid_str); + fprintf(fp, "\t\tgroup_id\t%s\n", uuid_str.c_str()); if(mIsGroupOwned) { @@ -784,21 +784,21 @@ BOOL LLPermissions::importLegacyStream(std::istream& input_stream) BOOL LLPermissions::exportLegacyStream(std::ostream& output_stream) const { - char uuid_str[256]; /* Flawfinder: ignore */ + std::string uuid_str; output_stream << "\tpermissions 0\n"; output_stream << "\t{\n"; - char buffer[256]; /* Flawfinder: ignore */ - snprintf(buffer, sizeof(buffer), "\t\tbase_mask\t%08x\n", mMaskBase); /* Flawfinder: ignore */ + std::string buffer; + buffer = llformat( "\t\tbase_mask\t%08x\n", mMaskBase); output_stream << buffer; - snprintf(buffer, sizeof(buffer), "\t\towner_mask\t%08x\n", mMaskOwner); /* Flawfinder: ignore */ + buffer = llformat( "\t\towner_mask\t%08x\n", mMaskOwner); output_stream << buffer; - snprintf(buffer, sizeof(buffer), "\t\tgroup_mask\t%08x\n", mMaskGroup); /* Flawfinder: ignore */ + buffer = llformat( "\t\tgroup_mask\t%08x\n", mMaskGroup); output_stream << buffer; - snprintf(buffer, sizeof(buffer), "\t\teveryone_mask\t%08x\n", mMaskEveryone); /* Flawfinder: ignore */ + buffer = llformat( "\t\teveryone_mask\t%08x\n", mMaskEveryone); output_stream << buffer; - snprintf(buffer, sizeof(buffer), "\t\tnext_owner_mask\t%08x\n", mMaskNextOwner); /* Flawfinder: ignore */ + buffer = llformat( "\t\tnext_owner_mask\t%08x\n", mMaskNextOwner); output_stream << buffer; mCreator.toString(uuid_str); @@ -1118,12 +1118,12 @@ void LLAggregatePermissions::unpackMessage(LLMessageSystem* msg, const char* blo mBits[PI_TRANSFER] = bits & TWO_BITS; } -const LLString AGGREGATE_VALUES[4] = +const std::string AGGREGATE_VALUES[4] = { - LLString( "Empty" ), - LLString( "None" ), - LLString( "Some" ), - LLString( "All" ) + std::string( "Empty" ), + std::string( "None" ), + std::string( "Some" ), + std::string( "All" ) }; std::ostream& operator<<(std::ostream &s, const LLAggregatePermissions &perm) diff --git a/indra/llinventory/llsaleinfo.cpp b/indra/llinventory/llsaleinfo.cpp index 0c2ba82302..111167ae27 100644 --- a/indra/llinventory/llsaleinfo.cpp +++ b/indra/llinventory/llsaleinfo.cpp @@ -128,7 +128,7 @@ bool LLSaleInfo::fromLLSD(LLSD& sd, BOOL& has_perm_mask, U32& perm_mask) LLXMLNode *LLSaleInfo::exportFileXML() const { LLXMLNode *ret = new LLXMLNode("sale_info", FALSE); - LLString type_str = lookup(mSaleType); + std::string type_str = ll_safe_string( lookup(mSaleType)); ret->createChild("type", TRUE)->setStringValue(1, &type_str); ret->createChild("price", TRUE)->setIntValue(1, &mSalePrice); return ret; diff --git a/indra/llinventory/lltransactionflags.cpp b/indra/llinventory/lltransactionflags.cpp index 6b90fbdc5a..3f82ad46ae 100644 --- a/indra/llinventory/lltransactionflags.cpp +++ b/indra/llinventory/lltransactionflags.cpp @@ -69,12 +69,12 @@ BOOL is_tf_owner_group(TransactionFlags flags) void append_reason( std::ostream& ostr, S32 transaction_type, - const char* description) + const std::string& description) { switch( transaction_type ) { case TRANS_OBJECT_SALE: - ostr << " for " << (description ? description : ""); + ostr << " for " << (description.length() > 0 ? description : std::string("")); break; case TRANS_LAND_SALE: ostr << " for a parcel of land"; @@ -95,16 +95,21 @@ std::string build_transfer_message_to_source( const LLUUID& dest_id, const std::string& dest_name, S32 transaction_type, - const char* desc) + const std::string& description) { - std::string description(ll_safe_string(desc)); lldebugs << "build_transfer_message_to_source: " << amount << " " << source_id << " " << dest_id << " " << dest_name << " " << transaction_type << " " - << (description.empty()?"(no desc)":description.c_str()) + << (description.empty() ? "(no desc)" : description) << llendl; - if(source_id.isNull()) return description; - if((0 == amount) && description.empty()) return description; + if(source_id.isNull()) + { + return description; + } + if((0 == amount) && description.empty()) + { + return description; + } std::ostringstream ostr; if(dest_id.isNull()) { @@ -127,7 +132,7 @@ std::string build_transfer_message_to_source( else { ostr << "You paid " << dest_name << " L$" << amount; - append_reason(ostr, transaction_type, description.c_str()); + append_reason(ostr, transaction_type, description); } ostr << "."; return ostr.str(); @@ -139,14 +144,20 @@ std::string build_transfer_message_to_destination( const LLUUID& source_id, const std::string& source_name, S32 transaction_type, - const char* description) + const std::string& description) { lldebugs << "build_transfer_message_to_dest: " << amount << " " << dest_id << " " << source_id << " " << source_name << " " - << transaction_type << " " << (description?description:"(no desc)") + << transaction_type << " " << (description.empty() ? "(no desc)" : description) << llendl; - if(0 == amount) return std::string(); - if(dest_id.isNull()) return ll_safe_string(description); + if(0 == amount) + { + return std::string(); + } + if(dest_id.isNull()) + { + return description; + } std::ostringstream ostr; ostr << source_name << " paid you L$" << amount; append_reason(ostr, transaction_type, description); diff --git a/indra/llinventory/lltransactionflags.h b/indra/llinventory/lltransactionflags.h index 3bf08af282..4fe1503ff0 100644 --- a/indra/llinventory/lltransactionflags.h +++ b/indra/llinventory/lltransactionflags.h @@ -57,7 +57,7 @@ std::string build_transfer_message_to_source( const LLUUID& dest_id, const std::string& dest_name, S32 transaction_type, - const char* description); + const std::string& description); std::string build_transfer_message_to_destination( S32 amount, @@ -65,6 +65,6 @@ std::string build_transfer_message_to_destination( const LLUUID& source_id, const std::string& source_name, S32 transaction_type, - const char* description); + const std::string& description); #endif // LL_LLTRANSACTIONFLAGS_H diff --git a/indra/llmath/llline.cpp b/indra/llmath/llline.cpp index b62631072b..749e3bcdd0 100644 --- a/indra/llmath/llline.cpp +++ b/indra/llmath/llline.cpp @@ -7,6 +7,8 @@ * $License$ */ +#include "linden_common.h" + #include "llline.h" #include "llrand.h" diff --git a/indra/llmath/llmath.h b/indra/llmath/llmath.h index 9d31df12e2..fde210ef50 100644 --- a/indra/llmath/llmath.h +++ b/indra/llmath/llmath.h @@ -35,6 +35,8 @@ #include #include #include "lldefs.h" +#include "llstl.h" // *TODO: Remove when LLString is gone +#include "llstring.h" // *TODO: Remove when LLString is gone // work around for Windows & older gcc non-standard function names. #if LL_WINDOWS diff --git a/indra/llmath/llquaternion.cpp b/indra/llmath/llquaternion.cpp index 7711d0881d..79b93e6a46 100644 --- a/indra/llmath/llquaternion.cpp +++ b/indra/llmath/llquaternion.cpp @@ -937,15 +937,15 @@ void LLQuaternion::unpackFromVector3( const LLVector3& vec ) } } -BOOL LLQuaternion::parseQuat(const char* buf, LLQuaternion* value) +BOOL LLQuaternion::parseQuat(const std::string& buf, LLQuaternion* value) { - if( buf == NULL || buf[0] == '\0' || value == NULL) + if( buf.empty() || value == NULL) { return FALSE; } LLQuaternion quat; - S32 count = sscanf( buf, "%f %f %f %f", quat.mQ + 0, quat.mQ + 1, quat.mQ + 2, quat.mQ + 3 ); + S32 count = sscanf( buf.c_str(), "%f %f %f %f", quat.mQ + 0, quat.mQ + 1, quat.mQ + 2, quat.mQ + 3 ); if( 4 == count ) { value->set( quat ); diff --git a/indra/llmath/llquaternion.h b/indra/llmath/llquaternion.h index a088d70674..34a02f6e76 100644 --- a/indra/llmath/llquaternion.h +++ b/indra/llmath/llquaternion.h @@ -158,7 +158,7 @@ public: friend const char *OrderToString( const Order order ); friend Order StringToOrder( const char *str ); - static BOOL parseQuat(const char* buf, LLQuaternion* value); + static BOOL parseQuat(const std::string& buf, LLQuaternion* value); // For debugging, only //static U32 mMultCount; diff --git a/indra/llmath/llsphere.cpp b/indra/llmath/llsphere.cpp index 3428dc1487..be4df39443 100644 --- a/indra/llmath/llsphere.cpp +++ b/indra/llmath/llsphere.cpp @@ -7,6 +7,8 @@ * $License$ */ +#include "linden_common.h" + #include "llsphere.h" LLSphere::LLSphere() diff --git a/indra/llmath/llvolumemgr.cpp b/indra/llmath/llvolumemgr.cpp index c4f10467a9..8a34d9d33b 100644 --- a/indra/llmath/llvolumemgr.cpp +++ b/indra/llmath/llvolumemgr.cpp @@ -376,7 +376,6 @@ F32 LLVolumeLODGroup::getVolumeScaleFromDetail(const S32 detail) F32 LLVolumeLODGroup::dump() { - char dump_str[255]; /* Flawfinder: ignore */ F32 usage = 0.f; for (S32 i = 0; i < NUM_LODS; i++) { @@ -387,7 +386,7 @@ F32 LLVolumeLODGroup::dump() } usage = usage / (F32)NUM_LODS; - snprintf(dump_str, sizeof(dump_str), "%.3f %d %d %d %d", usage, mAccessCount[0], mAccessCount[1], mAccessCount[2], mAccessCount[3]); /* Flawfinder: ignore */ + std::string dump_str = llformat("%.3f %d %d %d %d", usage, mAccessCount[0], mAccessCount[1], mAccessCount[2], mAccessCount[3]); llinfos << dump_str << llendl; return usage; diff --git a/indra/llmath/v3dmath.cpp b/indra/llmath/v3dmath.cpp index efe1274cbe..41f26c10d7 100644 --- a/indra/llmath/v3dmath.cpp +++ b/indra/llmath/v3dmath.cpp @@ -132,15 +132,15 @@ const LLVector3d& LLVector3d::rotVec(F64 angle, F64 x, F64 y, F64 z) } -BOOL LLVector3d::parseVector3d(const char* buf, LLVector3d* value) +BOOL LLVector3d::parseVector3d(const std::string& buf, LLVector3d* value) { - if( buf == NULL || buf[0] == '\0' || value == NULL) + if( buf.empty() || value == NULL) { return FALSE; } LLVector3d v; - S32 count = sscanf( buf, "%lf %lf %lf", v.mdV + 0, v.mdV + 1, v.mdV + 2 ); + S32 count = sscanf( buf.c_str(), "%lf %lf %lf", v.mdV + 0, v.mdV + 1, v.mdV + 2 ); if( 3 == count ) { value->setVec( v ); diff --git a/indra/llmath/v3dmath.h b/indra/llmath/v3dmath.h index d5e5223571..36a28e25e6 100644 --- a/indra/llmath/v3dmath.h +++ b/indra/llmath/v3dmath.h @@ -132,7 +132,7 @@ class LLVector3d friend std::ostream& operator<<(std::ostream& s, const LLVector3d &a); // Stream a - static BOOL parseVector3d(const char* buf, LLVector3d* value); + static BOOL parseVector3d(const std::string& buf, LLVector3d* value); }; diff --git a/indra/llmath/v3math.cpp b/indra/llmath/v3math.cpp index 6299bbd1b7..166761e550 100644 --- a/indra/llmath/v3math.cpp +++ b/indra/llmath/v3math.cpp @@ -326,15 +326,15 @@ const LLVector3& operator*=(LLVector3 &a, const LLQuaternion &rot) } // static -BOOL LLVector3::parseVector3(const char* buf, LLVector3* value) +BOOL LLVector3::parseVector3(const std::string& buf, LLVector3* value) { - if( buf == NULL || buf[0] == '\0' || value == NULL) + if( buf.empty() || value == NULL) { return FALSE; } LLVector3 v; - S32 count = sscanf( buf, "%f %f %f", v.mV + 0, v.mV + 1, v.mV + 2 ); + S32 count = sscanf( buf.c_str(), "%f %f %f", v.mV + 0, v.mV + 1, v.mV + 2 ); if( 3 == count ) { value->setVec( v ); diff --git a/indra/llmath/v3math.h b/indra/llmath/v3math.h index d8f3bec193..051d5376b7 100644 --- a/indra/llmath/v3math.h +++ b/indra/llmath/v3math.h @@ -148,7 +148,7 @@ class LLVector3 friend std::ostream& operator<<(std::ostream& s, const LLVector3 &a); // Stream a - static BOOL parseVector3(const char* buf, LLVector3* value); + static BOOL parseVector3(const std::string& buf, LLVector3* value); }; typedef LLVector3 LLSimLocalVec; diff --git a/indra/llmath/v4color.cpp b/indra/llmath/v4color.cpp index 21166472e4..8ba329eaf2 100644 --- a/indra/llmath/v4color.cpp +++ b/indra/llmath/v4color.cpp @@ -286,16 +286,14 @@ void LLColor4::calcHSL(F32* hue, F32* saturation, F32* luminance) const } // static -BOOL LLColor4::parseColor(const char* buf, LLColor4* color) +BOOL LLColor4::parseColor(const std::string& buf, LLColor4* color) { - if( buf == NULL || buf[0] == '\0' || color == NULL) + if( buf.empty() || color == NULL) { return FALSE; } - LLString full_string(buf); - - boost_tokenizer tokens(full_string, boost::char_separator(", ")); + boost_tokenizer tokens(buf, boost::char_separator(", ")); boost_tokenizer::iterator token_iter = tokens.begin(); if (token_iter == tokens.end()) { @@ -304,15 +302,15 @@ BOOL LLColor4::parseColor(const char* buf, LLColor4* color) // Grab the first token into a string, since we don't know // if this is a float or a color name. - LLString color_name( (*token_iter) ); + std::string color_name( (*token_iter) ); ++token_iter; if (token_iter != tokens.end()) { // There are more tokens to read. This must be a vector. LLColor4 v; - LLString::convertToF32( color_name, v.mV[VX] ); - LLString::convertToF32( *token_iter, v.mV[VY] ); + LLStringUtil::convertToF32( color_name, v.mV[VX] ); + LLStringUtil::convertToF32( *token_iter, v.mV[VY] ); v.mV[VZ] = 0.0f; v.mV[VW] = 1.0f; @@ -320,18 +318,18 @@ BOOL LLColor4::parseColor(const char* buf, LLColor4* color) if (token_iter == tokens.end()) { // This is a malformed vector. - llwarns << "LLColor4::parseColor() malformed color " << full_string << llendl; + llwarns << "LLColor4::parseColor() malformed color " << buf << llendl; } else { // There is a z-component. - LLString::convertToF32( *token_iter, v.mV[VZ] ); + LLStringUtil::convertToF32( *token_iter, v.mV[VZ] ); ++token_iter; if (token_iter != tokens.end()) { // There is an alpha component. - LLString::convertToF32( *token_iter, v.mV[VW] ); + LLStringUtil::convertToF32( *token_iter, v.mV[VW] ); } } @@ -615,19 +613,19 @@ BOOL LLColor4::parseColor(const char* buf, LLColor4* color) } // static -BOOL LLColor4::parseColor4(const char* buf, LLColor4* value) +BOOL LLColor4::parseColor4(const std::string& buf, LLColor4* value) { - if( buf == NULL || buf[0] == '\0' || value == NULL) + if( buf.empty() || value == NULL) { return FALSE; } LLColor4 v; - S32 count = sscanf( buf, "%f, %f, %f, %f", v.mV + 0, v.mV + 1, v.mV + 2, v.mV + 3 ); + S32 count = sscanf( buf.c_str(), "%f, %f, %f, %f", v.mV + 0, v.mV + 1, v.mV + 2, v.mV + 3 ); if (1 == count ) { // try this format - count = sscanf( buf, "%f %f %f %f", v.mV + 0, v.mV + 1, v.mV + 2, v.mV + 3 ); + count = sscanf( buf.c_str(), "%f %f %f %f", v.mV + 0, v.mV + 1, v.mV + 2, v.mV + 3 ); } if( 4 == count ) { diff --git a/indra/llmath/v4color.h b/indra/llmath/v4color.h index bd990444b5..62c0b663b8 100644 --- a/indra/llmath/v4color.h +++ b/indra/llmath/v4color.h @@ -211,8 +211,8 @@ class LLColor4 static LLColor4 cyan5; static LLColor4 cyan6; - static BOOL parseColor(const char* buf, LLColor4* color); - static BOOL parseColor4(const char* buf, LLColor4* color); + static BOOL parseColor(const std::string& buf, LLColor4* color); + static BOOL parseColor4(const std::string& buf, LLColor4* color); inline void clamp(); }; diff --git a/indra/llmath/v4coloru.cpp b/indra/llmath/v4coloru.cpp index 6f6900b6c2..26f3804209 100644 --- a/indra/llmath/v4coloru.cpp +++ b/indra/llmath/v4coloru.cpp @@ -93,19 +93,19 @@ std::ostream& operator<<(std::ostream& s, const LLColor4U &a) } // static -BOOL LLColor4U::parseColor4U(const char* buf, LLColor4U* value) +BOOL LLColor4U::parseColor4U(const std::string& buf, LLColor4U* value) { - if( buf == NULL || buf[0] == '\0' || value == NULL) + if( buf.empty() || value == NULL) { return FALSE; } U32 v[4]; - S32 count = sscanf( buf, "%u, %u, %u, %u", v + 0, v + 1, v + 2, v + 3 ); + S32 count = sscanf( buf.c_str(), "%u, %u, %u, %u", v + 0, v + 1, v + 2, v + 3 ); if (1 == count ) { // try this format - count = sscanf( buf, "%u %u %u %u", v + 0, v + 1, v + 2, v + 3 ); + count = sscanf( buf.c_str(), "%u %u %u %u", v + 0, v + 1, v + 2, v + 3 ); } if( 4 != count ) { diff --git a/indra/llmath/v4coloru.h b/indra/llmath/v4coloru.h index fc7845ad15..1d3f31e968 100644 --- a/indra/llmath/v4coloru.h +++ b/indra/llmath/v4coloru.h @@ -127,7 +127,7 @@ public: inline void setVecScaleClamp(const LLColor3 &color); inline void setVecScaleClamp(const LLColor4 &color); - static BOOL parseColor4U(const char* buf, LLColor4U* value); + static BOOL parseColor4U(const std::string& buf, LLColor4U* value); static LLColor4U white; static LLColor4U black; diff --git a/indra/llmessage/llassetstorage.cpp b/indra/llmessage/llassetstorage.cpp index 9d32afc2f0..af149d0f62 100644 --- a/indra/llmessage/llassetstorage.cpp +++ b/indra/llmessage/llassetstorage.cpp @@ -59,7 +59,7 @@ LLAssetStorage *gAssetStorage = NULL; LLMetrics *LLAssetStorage::metric_recipient = NULL; -const LLUUID CATEGORIZE_LOST_AND_FOUND_ID("00000000-0000-0000-0000-000000000010"); +const LLUUID CATEGORIZE_LOST_AND_FOUND_ID(std::string("00000000-0000-0000-0000-000000000010")); const U64 TOXIC_ASSET_LIFETIME = (120 * 1000000); // microseconds @@ -137,20 +137,20 @@ void LLAssetInfo::setFromNameValue( const LLNameValue& nv ) str.assign( nv.mName ); pos1 = str.find('|'); buf.assign( str, 0, pos1++ ); - mType = LLAssetType::lookup( buf.c_str() ); + mType = LLAssetType::lookup( buf ); buf.assign( str, pos1, std::string::npos ); - mUuid.set( buf.c_str() ); + mUuid.set( buf ); // convert the value to useful information str.assign( nv.getAsset() ); pos1 = str.find('|'); buf.assign( str, 0, pos1++ ); - mCreatorID.set( buf.c_str() ); + mCreatorID.set( buf ); pos2 = str.find( '|', pos1 ); buf.assign( str, pos1, (pos2++) - pos1 ); - setName( buf.c_str() ); + setName( buf ); buf.assign( str, pos2, std::string::npos ); - setDescription( buf.c_str() ); + setDescription( buf ); llinfos << "uuid: " << mUuid << llendl; llinfos << "creator: " << mCreatorID << llendl; } @@ -1238,7 +1238,7 @@ void LLAssetStorage::getAssetData(const LLUUID uuid, LLAssetType::EType type, vo void LLAssetStorage::legacyGetDataCallback(LLVFS *vfs, const LLUUID &uuid, LLAssetType::EType type, void *user_data, S32 status, LLExtStat ext_status) { LLLegacyAssetRequest *legacy = (LLLegacyAssetRequest *)user_data; - char filename[LL_MAX_PATH] = ""; /* Flawfinder: ignore */ + std::string filename; // Check if the asset is marked toxic, and don't load bad stuff BOOL toxic = gAssetStorage->isAssetToxic( uuid ); @@ -1248,10 +1248,10 @@ void LLAssetStorage::legacyGetDataCallback(LLVFS *vfs, const LLUUID &uuid, LLAss { LLVFile file(vfs, uuid, type); - char uuid_str[UUID_STR_LENGTH]; /* Flawfinder: ignore */ + std::string uuid_str; uuid.toString(uuid_str); - snprintf(filename,sizeof(filename),"%s.%s",gDirUtilp->getExpandedFilename(LL_PATH_CACHE,uuid_str).c_str(),LLAssetType::lookup(type)); /* Flawfinder: ignore */ + filename = llformat("%s.%s",gDirUtilp->getExpandedFilename(LL_PATH_CACHE,uuid_str).c_str(),LLAssetType::lookup(type)); LLFILE* fp = LLFile::fopen(filename, "wb"); /* Flawfinder: ignore */ if (fp) @@ -1275,7 +1275,7 @@ void LLAssetStorage::legacyGetDataCallback(LLVFS *vfs, const LLUUID &uuid, LLAss } } - legacy->mDownCallback(filename, uuid, legacy->mUserData, status, ext_status); + legacy->mDownCallback(filename.c_str(), uuid, legacy->mUserData, status, ext_status); delete legacy; } @@ -1294,7 +1294,7 @@ void LLAssetStorage::storeAssetData( { llwarns << "storeAssetData: wrong version called" << llendl; // LLAssetStorage metric: Virtual base call - reportMetric( LLUUID::null, asset_type, NULL, LLUUID::null, 0, MR_BAD_FUNCTION, __FILE__, __LINE__, "Illegal call to base: LLAssetStorage::storeAssetData 1" ); + reportMetric( LLUUID::null, asset_type, LLStringUtil::null, LLUUID::null, 0, MR_BAD_FUNCTION, __FILE__, __LINE__, "Illegal call to base: LLAssetStorage::storeAssetData 1" ); } // virtual @@ -1313,13 +1313,13 @@ void LLAssetStorage::storeAssetData( { llwarns << "storeAssetData: wrong version called" << llendl; // LLAssetStorage metric: Virtual base call - reportMetric( asset_id, asset_type, NULL, requesting_agent_id, 0, MR_BAD_FUNCTION, __FILE__, __LINE__, "Illegal call to base: LLAssetStorage::storeAssetData 2" ); + reportMetric( asset_id, asset_type, LLStringUtil::null, requesting_agent_id, 0, MR_BAD_FUNCTION, __FILE__, __LINE__, "Illegal call to base: LLAssetStorage::storeAssetData 2" ); } // virtual // this does nothing, viewer and sim both override this. void LLAssetStorage::storeAssetData( - const char* filename, + const std::string& filename, const LLUUID& asset_id, LLAssetType::EType asset_type, LLStoreAssetCallback callback, @@ -1331,13 +1331,13 @@ void LLAssetStorage::storeAssetData( { llwarns << "storeAssetData: wrong version called" << llendl; // LLAssetStorage metric: Virtual base call - reportMetric( asset_id, asset_type, NULL, LLUUID::null, 0, MR_BAD_FUNCTION, __FILE__, __LINE__, "Illegal call to base: LLAssetStorage::storeAssetData 3" ); + reportMetric( asset_id, asset_type, LLStringUtil::null, LLUUID::null, 0, MR_BAD_FUNCTION, __FILE__, __LINE__, "Illegal call to base: LLAssetStorage::storeAssetData 3" ); } // virtual // this does nothing, viewer and sim both override this. void LLAssetStorage::storeAssetData( - const char* filename, + const std::string& filename, const LLTransactionID &transactoin_id, LLAssetType::EType asset_type, LLStoreAssetCallback callback, @@ -1349,7 +1349,7 @@ void LLAssetStorage::storeAssetData( { llwarns << "storeAssetData: wrong version called" << llendl; // LLAssetStorage metric: Virtual base call - reportMetric( LLUUID::null, asset_type, NULL, LLUUID::null, 0, MR_BAD_FUNCTION, __FILE__, __LINE__, "Illegal call to base: LLAssetStorage::storeAssetData 4" ); + reportMetric( LLUUID::null, asset_type, LLStringUtil::null, LLUUID::null, 0, MR_BAD_FUNCTION, __FILE__, __LINE__, "Illegal call to base: LLAssetStorage::storeAssetData 4" ); } // static @@ -1396,9 +1396,9 @@ void LLAssetStorage::clearTempAssetData() { } // static -void LLAssetStorage::reportMetric( const LLUUID& asset_id, const LLAssetType::EType asset_type, const char *filename, +void LLAssetStorage::reportMetric( const LLUUID& asset_id, const LLAssetType::EType asset_type, const std::string& in_filename, const LLUUID& agent_id, S32 asset_size, EMetricResult result, - const char *file, const S32 line, const char *message ) + const char *file, const S32 line, const std::string& in_message ) { if( !metric_recipient ) { @@ -1406,18 +1406,13 @@ void LLAssetStorage::reportMetric( const LLUUID& asset_id, const LLAssetType::ET return; } - filename = filename ? filename : ""; - file = file ? file : ""; - - // Create revised message - message = "message :: file:line" - std::string new_message; //( message ); - new_message = message; // << " " << file << " " << line; - new_message += " :: "; - new_message += filename; - char line_string[16]; - sprintf( line_string, ":%d", line ); - new_message += line_string; - message = new_message.c_str(); + std::string filename(in_filename); + if (filename.empty()) + filename = ll_safe_string(file); + + // Create revised message - new_message = "in_message :: file:line" + std::stringstream new_message; + new_message << in_message << " :: " << filename << ":" << line; // Change always_report to true if debugging... do not check it in this way static bool always_report = false; @@ -1430,16 +1425,16 @@ void LLAssetStorage::reportMetric( const LLUUID& asset_id, const LLAssetType::ET LLSD stats; stats["asset_id"] = asset_id; stats["asset_type"] = asset_type; - stats["filename"] = filename? filename : ""; + stats["filename"] = filename; stats["agent_id"] = agent_id; stats["asset_size"] = (S32)asset_size; stats["result"] = (S32)result; - metric_recipient->recordEventDetails( metric_name, message, success, stats); + metric_recipient->recordEventDetails( metric_name, new_message.str(), success, stats); } else { - metric_recipient->recordEvent(metric_name, message, success); + metric_recipient->recordEvent(metric_name, new_message.str(), success); } } diff --git a/indra/llmessage/llassetstorage.h b/indra/llmessage/llassetstorage.h index b1007e83c6..1b83d17c8f 100644 --- a/indra/llmessage/llassetstorage.h +++ b/indra/llmessage/llassetstorage.h @@ -378,7 +378,7 @@ public: * AssetID version. */ virtual void storeAssetData( - const char* filename, + const std::string& filename, const LLUUID& asset_id, LLAssetType::EType type, LLStoreAssetCallback callback, @@ -392,7 +392,7 @@ public: * TransactionID version */ virtual void storeAssetData( - const char * filename, + const std::string& filename, const LLTransactionID &transaction_id, LLAssetType::EType type, LLStoreAssetCallback callback, @@ -451,9 +451,9 @@ protected: static class LLMetrics *metric_recipient; - static void reportMetric( const LLUUID& asset_id, const LLAssetType::EType asset_type, const char *filename, - const LLUUID& agent_id, S32 asset_size, EMetricResult result, - const char *file, const S32 line, const char *message ); + static void reportMetric( const LLUUID& asset_id, const LLAssetType::EType asset_type, const std::string& filename, + const LLUUID& agent_id, S32 asset_size, EMetricResult result, + const char* file, const S32 line, const std::string& message ); public: static void setMetricRecipient( LLMetrics *recip ) { diff --git a/indra/llmessage/llcachename.cpp b/indra/llmessage/llcachename.cpp index 1ad5179455..2cc82f7c23 100644 --- a/indra/llmessage/llcachename.cpp +++ b/indra/llmessage/llcachename.cpp @@ -43,10 +43,9 @@ #include "message.h" // Constants -// probably need a setUIString() call in the interface -const char* const CN_WAITING = "(Loading...)"; // *TODO: translate -const char* const CN_NOBODY = "(nobody)"; // *TODO: translate -const char* const CN_NONE = "(none)"; // *TODO: translate +static const std::string CN_WAITING("(Loading...)"); // *TODO: translate +static const std::string CN_NOBODY("(nobody)"); // *TODO: translate +static const std::string CN_NONE("(none)"); // *TODO: translate // llsd serialization constants static const std::string AGENTS("agents"); @@ -78,16 +77,13 @@ public: public: bool mIsGroup; U32 mCreateTime; // unix time_t - char mFirstName[DB_FIRST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/ - char mLastName[DB_LAST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/ - char mGroupName[DB_GROUP_NAME_BUF_SIZE]; /*Flawfinder: ignore*/ + std::string mFirstName; + std::string mLastName; + std::string mGroupName; }; LLCacheNameEntry::LLCacheNameEntry() { - mFirstName[0] = '\0'; - mLastName[0] = '\0'; - mGroupName[0] = '\0'; } @@ -235,7 +231,7 @@ public: static void handleUUIDGroupNameRequest(LLMessageSystem* msg, void** userdata); static void handleUUIDGroupNameReply(LLMessageSystem* msg, void** userdata); - void notifyObservers(const LLUUID& id, const char* first, const char* last, BOOL group); + void notifyObservers(const LLUUID& id, const std::string& first, const std::string& last, BOOL group); }; @@ -390,8 +386,8 @@ void LLCacheName::importFile(LLFILE* fp) LLCacheNameEntry* entry = new LLCacheNameEntry(); entry->mIsGroup = false; entry->mCreateTime = create_time; - LLString::copy(entry->mFirstName, firstname, DB_FIRST_NAME_BUF_SIZE); - LLString::copy(entry->mLastName, lastname, DB_LAST_NAME_BUF_SIZE); + entry->mFirstName = firstname; + entry->mLastName = lastname; impl.mCache[id] = entry; count++; @@ -426,12 +422,8 @@ bool LLCacheName::importFile(std::istream& istr) LLCacheNameEntry* entry = new LLCacheNameEntry(); entry->mIsGroup = false; entry->mCreateTime = ctime; - std::string first = agent[FIRST].asString(); - first.copy(entry->mFirstName, DB_FIRST_NAME_BUF_SIZE, 0); - entry->mFirstName[llmin(first.size(),(std::string::size_type)DB_FIRST_NAME_BUF_SIZE-1)] = '\0'; - std::string last = agent[LAST].asString(); - last.copy(entry->mLastName, DB_LAST_NAME_BUF_SIZE, 0); - entry->mLastName[llmin(last.size(),(std::string::size_type)DB_LAST_NAME_BUF_SIZE-1)] = '\0'; + entry->mFirstName = agent[FIRST].asString(); + entry->mLastName = agent[LAST].asString(); impl.mCache[id] = entry; ++count; } @@ -451,9 +443,7 @@ bool LLCacheName::importFile(std::istream& istr) LLCacheNameEntry* entry = new LLCacheNameEntry(); entry->mIsGroup = true; entry->mCreateTime = ctime; - std::string name = group[NAME].asString(); - name.copy(entry->mGroupName, DB_GROUP_NAME_BUF_SIZE, 0); - entry->mGroupName[llmin(name.size(), (std::string::size_type)DB_GROUP_NAME_BUF_SIZE-1)] = '\0'; + entry->mGroupName = group[NAME].asString(); impl.mCache[id] = entry; ++count; } @@ -471,8 +461,8 @@ void LLCacheName::exportFile(std::ostream& ostr) // Only write entries for which we have valid data. LLCacheNameEntry* entry = iter->second; if(!entry - || (NULL != strchr(entry->mFirstName, '?')) - || (NULL != strchr(entry->mGroupName, '?'))) + || (std::string::npos != entry->mFirstName.find('?')) + || (std::string::npos != entry->mGroupName.find('?'))) { continue; } @@ -480,13 +470,13 @@ void LLCacheName::exportFile(std::ostream& ostr) // store it LLUUID id = iter->first; std::string id_str = id.asString(); - if(entry->mFirstName[0] && entry->mLastName[0]) + if(!entry->mFirstName.empty() && !entry->mLastName.empty()) { data[AGENTS][id_str][FIRST] = entry->mFirstName; data[AGENTS][id_str][LAST] = entry->mLastName; data[AGENTS][id_str][CTIME] = (S32)entry->mCreateTime; } - else if(entry->mIsGroup && entry->mGroupName[0]) + else if(entry->mIsGroup && !entry->mGroupName.empty()) { data[GROUPS][id_str][NAME] = entry->mGroupName; data[GROUPS][id_str][CTIME] = (S32)entry->mCreateTime; @@ -534,16 +524,6 @@ BOOL LLCacheName::getFullName(const LLUUID& id, std::string& fullname) return res; } -// *TODO: Deprecate -BOOL LLCacheName::getName(const LLUUID& id, char* first, char* last) -{ - std::string first_name, last_name; - BOOL res = getName(id, first_name, last_name); - strcpy(first, first_name.c_str()); - strcpy(last, last_name.c_str()); - return res; -} - BOOL LLCacheName::getGroupName(const LLUUID& id, std::string& group) { if(id.isNull()) @@ -553,7 +533,7 @@ BOOL LLCacheName::getGroupName(const LLUUID& id, std::string& group) } LLCacheNameEntry* entry = get_ptr_in_map(impl.mCache,id); - if (entry && !entry->mGroupName[0]) + if (entry && entry->mGroupName.empty()) { // COUNTER-HACK to combat James' HACK in exportFile()... // this group name was loaded from a name cache that did not @@ -578,16 +558,6 @@ BOOL LLCacheName::getGroupName(const LLUUID& id, std::string& group) } } -// *TODO: Deprecate -BOOL LLCacheName::getGroupName(const LLUUID& id, char* group) -{ - std::string group_name; - BOOL res = getGroupName(id, group_name); - strcpy(group, group_name.c_str()); - return res; -} - - // TODO: Make the cache name callback take a SINGLE std::string, // not a separate first and last name. void LLCacheName::get(const LLUUID& id, BOOL is_group, LLCacheNameCallback callback, void* user_data) @@ -716,9 +686,9 @@ void LLCacheName::dumpStats() } //static -LLString LLCacheName::getDefaultName() +std::string LLCacheName::getDefaultName() { - return LLString(CN_WAITING); + return CN_WAITING; } void LLCacheName::Impl::processPendingAsks() @@ -813,7 +783,7 @@ void LLCacheName::Impl::sendRequest( } void LLCacheName::Impl::notifyObservers(const LLUUID& id, - const char* first, const char* last, BOOL is_group) + const std::string& first, const std::string& last, BOOL is_group) { for (Observers::const_iterator i = mObservers.begin(), end = mObservers.end(); @@ -917,19 +887,17 @@ void LLCacheName::Impl::processUUIDReply(LLMessageSystem* msg, bool isGroup) entry->mCreateTime = (U32)time(NULL); if (!isGroup) { - msg->getStringFast(_PREHASH_UUIDNameBlock, _PREHASH_FirstName, DB_FIRST_NAME_BUF_SIZE, entry->mFirstName, i); - msg->getStringFast(_PREHASH_UUIDNameBlock, _PREHASH_LastName, DB_LAST_NAME_BUF_SIZE, entry->mLastName, i); + msg->getStringFast(_PREHASH_UUIDNameBlock, _PREHASH_FirstName, entry->mFirstName, i); + msg->getStringFast(_PREHASH_UUIDNameBlock, _PREHASH_LastName, entry->mLastName, i); } else { - msg->getStringFast(_PREHASH_UUIDNameBlock, _PREHASH_GroupName, DB_GROUP_NAME_BUF_SIZE, entry->mGroupName, i); + msg->getStringFast(_PREHASH_UUIDNameBlock, _PREHASH_GroupName, entry->mGroupName, i); } if (!isGroup) { - notifyObservers(id, - entry->mFirstName, entry->mLastName, - FALSE); + notifyObservers(id, entry->mFirstName, entry->mLastName, FALSE); } else { diff --git a/indra/llmessage/llcachename.h b/indra/llmessage/llcachename.h index 5dfde80622..879eb5fadb 100644 --- a/indra/llmessage/llcachename.h +++ b/indra/llmessage/llcachename.h @@ -37,7 +37,7 @@ class LLHost; class LLUUID; // agent_id/group_id, first_name, last_name, is_group, user_data -typedef void (*LLCacheNameCallback)(const LLUUID&, const char*, const char*, BOOL, void*); +typedef void (*LLCacheNameCallback)(const LLUUID&, const std::string&, const std::string&, BOOL, void*); // Here's the theory: // If you request a name that isn't in the cache, it returns "waiting" @@ -75,7 +75,6 @@ public: // last must be at least DB_LAST_NAME_BUF_SIZE characters. // If not available, copies the string "waiting". // Returns TRUE iff available. - BOOL getName(const LLUUID& id, char* first, char* last); BOOL getName(const LLUUID& id, std::string& first, std::string& last); BOOL getFullName(const LLUUID& id, std::string& fullname); @@ -83,7 +82,6 @@ public: // provided. The caller must allocate at least // DB_GROUP_NAME_BUF_SIZE characters. If not available, this // method copies the string "waiting". Returns TRUE iff available. - BOOL getGroupName(const LLUUID& id, char* group); BOOL getGroupName(const LLUUID& id, std::string& group); // Call the callback with the group or avatar name. @@ -107,7 +105,7 @@ public: void dump(); // Dumps the contents of the cache void dumpStats(); // Dumps the sizes of the cache and associated queues. - static LLString getDefaultName(); + static std::string getDefaultName(); private: diff --git a/indra/llmessage/llcircuit.cpp b/indra/llmessage/llcircuit.cpp index 0db9f8e2f1..431fe802f6 100644 --- a/indra/llmessage/llcircuit.cpp +++ b/indra/llmessage/llcircuit.cpp @@ -184,7 +184,7 @@ LLCircuitData::~LLCircuitData() std::ostream_iterator append(str, " "); str << "MSG: -> " << mHost << "\tABORTING RELIABLE:\t"; std::copy(doomed.begin(), doomed.end(), append); - llinfos << str.str().c_str() << llendl; + llinfos << str.str() << llendl; } } @@ -204,7 +204,7 @@ void LLCircuitData::ackReliablePacket(TPACKETID packet_num) std::ostringstream str; str << "MSG: <- " << packetp->mHost << "\tRELIABLE ACKED:\t" << packetp->mPacketID; - llinfos << str.str().c_str() << llendl; + llinfos << str.str() << llendl; } if (packetp->mCallback) { @@ -238,7 +238,7 @@ void LLCircuitData::ackReliablePacket(TPACKETID packet_num) std::ostringstream str; str << "MSG: <- " << packetp->mHost << "\tRELIABLE ACKED:\t" << packetp->mPacketID; - llinfos << str.str().c_str() << llendl; + llinfos << str.str() << llendl; } if (packetp->mCallback) { @@ -342,7 +342,7 @@ S32 LLCircuitData::resendUnackedPackets(const F64 now) std::ostringstream str; str << "MSG: -> " << packetp->mHost << "\tRESENDING RELIABLE:\t" << packetp->mPacketID; - llinfos << str.str().c_str() << llendl; + llinfos << str.str() << llendl; } packetp->mBuffer[0] |= LL_RESENT_FLAG; // tag packet id as being a resend @@ -403,7 +403,7 @@ S32 LLCircuitData::resendUnackedPackets(const F64 now) std::ostringstream str; str << "MSG: -> " << packetp->mHost << "\tABORTING RELIABLE:\t" << packetp->mPacketID; - llinfos << str.str().c_str() << llendl; + llinfos << str.str() << llendl; } if (packetp->mCallback) @@ -710,7 +710,7 @@ void LLCircuitData::checkPacketInID(TPACKETID id, BOOL receive_resent) { std::ostringstream str; str << "MSG: <- " << mHost << "\tRECOVERING LOST:\t" << id; - llinfos << str.str().c_str() << llendl; + llinfos << str.str() << llendl; } // llinfos << "removing potential lost: " << id << llendl; mPotentialLostPackets.erase(id); @@ -729,7 +729,7 @@ void LLCircuitData::checkPacketInID(TPACKETID id, BOOL receive_resent) std::ostringstream str; str << "MSG: <- " << mHost << "\tPACKET GAP:\t" << index; - llinfos << str.str().c_str() << llendl; + llinfos << str.str() << llendl; } // llinfos << "adding potential lost: " << index << llendl; @@ -747,7 +747,7 @@ void LLCircuitData::checkPacketInID(TPACKETID id, BOOL receive_resent) std::ostringstream str; str << "MSG: <- " << mHost << "\tPACKET GAP:\t" << id << " expected " << index; - llinfos << str.str().c_str() << llendl; + llinfos << str.str() << llendl; } } @@ -969,7 +969,7 @@ BOOL LLCircuitData::updateWatchDogTimers(LLMessageSystem *msgsys) std::ostringstream str; str << "MSG: <- " << mHost << "\tLOST PACKET:\t" << (*it).first; - llinfos << str.str().c_str() << llendl; + llinfos << str.str() << llendl; } mPotentialLostPackets.erase(it++); } @@ -1114,7 +1114,7 @@ void LLCircuit::sendAcks() str << "MSG: -> " << cd->mHost << "\tPACKET ACKS:\t"; std::ostream_iterator append(str, " "); std::copy(cd->mAcks.begin(), cd->mAcks.end(), append); - llinfos << str.str().c_str() << llendl; + llinfos << str.str() << llendl; } // empty out the acks list diff --git a/indra/llmessage/lldatapacker.cpp b/indra/llmessage/lldatapacker.cpp index 2ebd1b7176..83fb0b85cd 100644 --- a/indra/llmessage/lldatapacker.cpp +++ b/indra/llmessage/lldatapacker.cpp @@ -170,16 +170,16 @@ BOOL LLDataPacker::unpackFixed(F32 &value, const char *name, // LLDataPackerBinaryBuffer implementation //--------------------------------------------------------------------------- -BOOL LLDataPackerBinaryBuffer::packString(const char *value, const char *name) +BOOL LLDataPackerBinaryBuffer::packString(const std::string& value, const char *name) { BOOL success = TRUE; - S32 length = (S32)strlen(value) + 1; /*Flawfinder: ignore*/ + S32 length = value.length()+1; success &= verifyLength(length, name); if (mWriteEnabled) { - htonmemcpy(mCurBufferp, value, MVT_VARIABLE, length); + htonmemcpy(mCurBufferp, value.c_str(), MVT_VARIABLE, length); } mCurBufferp += length; return success; @@ -577,18 +577,18 @@ void LLDataPackerBinaryBuffer::dumpBufferToLog() //--------------------------------------------------------------------------- // LLDataPackerAsciiBuffer implementation //--------------------------------------------------------------------------- -BOOL LLDataPackerAsciiBuffer::packString(const char *value, const char *name) +BOOL LLDataPackerAsciiBuffer::packString(const std::string& value, const char *name) { BOOL success = TRUE; writeIndentedName(name); int numCopied = 0; if (mWriteEnabled) { - numCopied = snprintf(mCurBufferp,getBufferSize()-getCurrentSize(),"%s\n", value); /* Flawfinder: ignore */ + numCopied = snprintf(mCurBufferp,getBufferSize()-getCurrentSize(),"%s\n", value.c_str()); /* Flawfinder: ignore */ } else { - numCopied = (S32)strlen(value) + 1; /*Flawfinder: ignore*/ + numCopied = value.length() + 1; /*Flawfinder: ignore*/ } // snprintf returns number of bytes that would have been written @@ -1242,9 +1242,9 @@ BOOL LLDataPackerAsciiBuffer::packUUID(const LLUUID &value, const char *name) int numCopied = 0; if (mWriteEnabled) { - char tmp_str[64]; /* Flawfinder: ignore */ + std::string tmp_str; value.toString(tmp_str); - numCopied = snprintf(mCurBufferp,getBufferSize()-getCurrentSize(),"%s\n", tmp_str); /* Flawfinder: ignore */ + numCopied = snprintf(mCurBufferp,getBufferSize()-getCurrentSize(),"%s\n", tmp_str.c_str()); /* Flawfinder: ignore */ } else { @@ -1376,13 +1376,13 @@ std::string convertF32ToString(F32 val) //--------------------------------------------------------------------------- // LLDataPackerAsciiFile implementation //--------------------------------------------------------------------------- -BOOL LLDataPackerAsciiFile::packString(const char *value, const char *name) +BOOL LLDataPackerAsciiFile::packString(const std::string& value, const char *name) { BOOL success = TRUE; writeIndentedName(name); if (mFP) { - fprintf(mFP,"%s\n", value); + fprintf(mFP,"%s\n", value.c_str()); } else if (mOutputStream) { @@ -1829,11 +1829,11 @@ BOOL LLDataPackerAsciiFile::packUUID(const LLUUID &value, const char *name) { BOOL success = TRUE; writeIndentedName(name); - char tmp_str[64]; /*Flawfinder: ignore */ + std::string tmp_str; value.toString(tmp_str); if (mFP) { - fprintf(mFP,"%s\n", tmp_str); + fprintf(mFP,"%s\n", tmp_str.c_str()); } else if (mOutputStream) { @@ -1877,7 +1877,7 @@ void LLDataPackerAsciiFile::writeIndentedName(const char *name) } else if (mOutputStream) { - *mOutputStream << indent_buf.c_str() << name << "\t"; + *mOutputStream << indent_buf << name << "\t"; } } diff --git a/indra/llmessage/lldatapacker.h b/indra/llmessage/lldatapacker.h index d6d1f5c1da..eac70e8c78 100644 --- a/indra/llmessage/lldatapacker.h +++ b/indra/llmessage/lldatapacker.h @@ -49,7 +49,7 @@ public: virtual BOOL hasNext() const = 0; - virtual BOOL packString(const char *value, const char *name) = 0; + virtual BOOL packString(const std::string& value, const char *name) = 0; virtual BOOL unpackString(std::string& value, const char *name) = 0; virtual BOOL packBinaryData(const U8 *value, S32 size, const char *name) = 0; @@ -127,7 +127,7 @@ public: { } - /*virtual*/ BOOL packString(const char *value, const char *name); + /*virtual*/ BOOL packString(const std::string& value, const char *name); /*virtual*/ BOOL unpackString(std::string& value, const char *name); /*virtual*/ BOOL packBinaryData(const U8 *value, S32 size, const char *name); @@ -229,7 +229,7 @@ public: mWriteEnabled = FALSE; } - /*virtual*/ BOOL packString(const char *value, const char *name); + /*virtual*/ BOOL packString(const std::string& value, const char *name); /*virtual*/ BOOL unpackString(std::string& value, const char *name); /*virtual*/ BOOL packBinaryData(const U8 *value, S32 size, const char *name); @@ -358,7 +358,7 @@ public: { } - /*virtual*/ BOOL packString(const char *value, const char *name); + /*virtual*/ BOOL packString(const std::string& value, const char *name); /*virtual*/ BOOL unpackString(std::string& value, const char *name); /*virtual*/ BOOL packBinaryData(const U8 *value, S32 size, const char *name); diff --git a/indra/llmessage/lldispatcher.cpp b/indra/llmessage/lldispatcher.cpp index d0e1e68b8a..64bfb04ea7 100644 --- a/indra/llmessage/lldispatcher.cpp +++ b/indra/llmessage/lldispatcher.cpp @@ -111,8 +111,7 @@ bool LLDispatcher::unpackMessage( LLDispatcher::sparam_t& parameters) { char buf[MAX_STRING]; /*Flawfinder: ignore*/ - msg->getStringFast(_PREHASH_MethodData, _PREHASH_Method, MAX_STRING, buf); - method.assign(buf); + msg->getStringFast(_PREHASH_MethodData, _PREHASH_Method, method); msg->getUUIDFast(_PREHASH_MethodData, _PREHASH_Invoice, invoice); S32 size; S32 count = msg->getNumberOfBlocksFast(_PREHASH_ParamList); diff --git a/indra/llmessage/llhost.cpp b/indra/llmessage/llhost.cpp index 4d10f06051..48666ffde7 100644 --- a/indra/llmessage/llhost.cpp +++ b/indra/llmessage/llhost.cpp @@ -66,34 +66,15 @@ LLHost::LLHost(const std::string& ip_and_port) } } -void LLHost::getString(char* buffer, S32 length) const +std::string LLHost::getString() const { - if (((U32) length) < MAXADDRSTR + 1 + 5) - { - llerrs << "LLHost::getString - string too short" << llendl; - return; - } - - snprintf(buffer, length, "%s:%u", u32_to_ip_string(mIP), mPort); /* Flawfinder: ignore */ -} - -void LLHost::getIPString(char* buffer, S32 length) const -{ - if ( ((U32) length) < MAXADDRSTR) - { - llerrs << "LLHost::getIPString - string too short" << llendl; - return; - } - - snprintf(buffer, length, "%s", u32_to_ip_string(mIP)); /* Flawfinder: ignore */ + return llformat("%s:%u", u32_to_ip_string(mIP), mPort); } std::string LLHost::getIPandPort() const { - char buffer[MAXADDRSTR + 1 + 5]; /*Flawfinder: ignore*/ - getString(buffer, sizeof(buffer)); - return buffer; + return getString(); } @@ -103,35 +84,6 @@ std::string LLHost::getIPString() const } -void LLHost::getHostName(char *buf, S32 len) const -{ - hostent *he; - - if (INVALID_HOST_IP_ADDRESS == mIP) - { - llwarns << "LLHost::getHostName() : Invalid IP address" << llendl; - buf[0] = '\0'; - return; - } - he = gethostbyaddr((char *)&mIP, sizeof(mIP), AF_INET); - if (!he) - { -#if LL_WINDOWS - llwarns << "LLHost::getHostName() : Couldn't find host name for address " << mIP << ", Error: " - << WSAGetLastError() << llendl; -#else - llwarns << "LLHost::getHostName() : Couldn't find host name for address " << mIP << ", Error: " - << h_errno << llendl; -#endif - buf[0] = '\0'; - } - else - { - strncpy(buf, he->h_name, len); /*Flawfinder: ignore*/ - buf[len-1] = '\0'; - } -} - std::string LLHost::getHostName() const { hostent* he; @@ -158,28 +110,20 @@ std::string LLHost::getHostName() const } } -BOOL LLHost::setHostByName(const char *string) +BOOL LLHost::setHostByName(const std::string& hostname) { hostent *he; - char local_name[MAX_STRING]; /*Flawfinder: ignore*/ - - if (strlen(string)+1 > MAX_STRING) /*Flawfinder: ignore*/ - { - llerrs << "LLHost::setHostByName() : Address string is too long: " - << string << llendl; - } + std::string local_name(hostname); - strncpy(local_name, string,MAX_STRING); /*Flawfinder: ignore*/ - local_name[MAX_STRING-1] = '\0'; #if LL_WINDOWS // We may need an equivalent for Linux, but not sure - djs - _strupr(local_name); + LLStringUtil::toUpper(local_name); #endif - he = gethostbyname(local_name); + he = gethostbyname(local_name.c_str()); if(!he) { - U32 ip_address = inet_addr(string); + U32 ip_address = inet_addr(hostname.c_str()); he = gethostbyaddr((char *)&ip_address, sizeof(ip_address), AF_INET); } diff --git a/indra/llmessage/llhost.h b/indra/llmessage/llhost.h index a865ad616c..516150540f 100644 --- a/indra/llmessage/llhost.h +++ b/indra/llmessage/llhost.h @@ -61,10 +61,10 @@ public: mIP = ipv4_addr; } - LLHost( const char *ipv4_addr, U32 port ) + LLHost( const std::string& ipv4_addr, U32 port ) : mPort( port ) { - mIP = ip_string_to_u32(ipv4_addr); + mIP = ip_string_to_u32(ipv4_addr.c_str()); } explicit LLHost(const U64 ip_port) @@ -82,11 +82,11 @@ public: // MANIPULATORS void set( U32 ip, U32 port ) { mIP = ip; mPort = port; } - void set( const char* ipstr, U32 port ) { mIP = ip_string_to_u32(ipstr); mPort = port; } - void setAddress( const char* ipstr ) { mIP = ip_string_to_u32(ipstr); } + void set( const std::string& ipstr, U32 port ) { mIP = ip_string_to_u32(ipstr.c_str()); mPort = port; } + void setAddress( const std::string& ipstr ) { mIP = ip_string_to_u32(ipstr.c_str()); } void setAddress( U32 ip ) { mIP = ip; } void setPort( U32 port ) { mPort = port; } - BOOL setHostByName(const char *hname); + BOOL setHostByName(const std::string& hname); LLHost& operator=(const LLHost &rhs); void invalidate() { mIP = INVALID_HOST_IP_ADDRESS; mPort = INVALID_PORT;}; @@ -96,10 +96,8 @@ public: U32 getPort() const { return mPort; } BOOL isOk() const { return (mIP != INVALID_HOST_IP_ADDRESS) && (mPort != INVALID_PORT); } size_t hash() const { return (mIP << 16) | (mPort & 0xffff); } - void getString(char* buffer, S32 length) const; // writes IP:port into buffer - void getIPString(char* buffer, S32 length) const; // writes IP into buffer + std::string getString() const; std::string getIPString() const; - void getHostName(char *buf, S32 len) const; std::string getHostName() const; std::string getIPandPort() const; diff --git a/indra/llmessage/llhttpassetstorage.cpp b/indra/llmessage/llhttpassetstorage.cpp index e5254bbc0f..6332c247a9 100644 --- a/indra/llmessage/llhttpassetstorage.cpp +++ b/indra/llmessage/llhttpassetstorage.cpp @@ -81,8 +81,8 @@ class LLHTTPAssetRequest : public LLAssetRequest { public: LLHTTPAssetRequest(LLHTTPAssetStorage *asp, const LLUUID &uuid, - LLAssetType::EType type, LLAssetStorage::ERequestType rt, - const char *url, CURLM *curl_multi); + LLAssetType::EType type, LLAssetStorage::ERequestType rt, + const std::string& url, CURLM *curl_multi); virtual ~LLHTTPAssetRequest(); void setupCurlHandle(); @@ -103,7 +103,7 @@ public: CURL *mCurlHandle; CURLM *mCurlMultiHandle; - char *mURLBuffer; + std::string mURLBuffer; struct curl_slist *mHTTPHeaders; LLVFile *mVFile; LLUUID mTmpUUID; @@ -122,7 +122,7 @@ LLHTTPAssetRequest::LLHTTPAssetRequest(LLHTTPAssetStorage *asp, const LLUUID &uuid, LLAssetType::EType type, LLAssetStorage::ERequestType rt, - const char *url, + const std::string& url, CURLM *curl_multi) : LLAssetRequest(uuid, type), mZInitialized(false) @@ -137,11 +137,7 @@ LLHTTPAssetRequest::LLHTTPAssetRequest(LLHTTPAssetStorage *asp, mZInputBuffer = NULL; mZInputExhausted = false; - mURLBuffer = new char[strlen(url) + 1]; /*Flawfinder: ignore*/ - if (mURLBuffer) - { - strcpy(mURLBuffer, url); /*Flawfinder: ignore*/ - } + mURLBuffer = url; } LLHTTPAssetRequest::~LLHTTPAssetRequest() @@ -156,7 +152,6 @@ LLHTTPAssetRequest::~LLHTTPAssetRequest() { curl_slist_free_all(mHTTPHeaders); } - delete[] mURLBuffer; delete mVFile; finishCompressedUpload(); } @@ -242,7 +237,7 @@ void LLHTTPAssetRequest::setupCurlHandle() mCurlHandle = curl_easy_init(); curl_easy_setopt(mCurlHandle, CURLOPT_NOSIGNAL, 1); curl_easy_setopt(mCurlHandle, CURLOPT_NOPROGRESS, 1); - curl_easy_setopt(mCurlHandle, CURLOPT_URL, mURLBuffer); + curl_easy_setopt(mCurlHandle, CURLOPT_URL, mURLBuffer.c_str()); curl_easy_setopt(mCurlHandle, CURLOPT_PRIVATE, this); if (LLAssetStorage::RT_DOWNLOAD == mRequestType) { @@ -400,9 +395,9 @@ size_t LLHTTPAssetRequest::curlCompressedUploadCallback( LLHTTPAssetStorage::LLHTTPAssetStorage(LLMessageSystem *msg, LLXferManager *xfer, LLVFS *vfs, const LLHost &upstream_host, - const char *web_host, - const char *local_web_host, - const char *host_name) + const std::string& web_host, + const std::string& local_web_host, + const std::string& host_name) : LLAssetStorage(msg, xfer, vfs, upstream_host) { _init(web_host, local_web_host, host_name); @@ -410,15 +405,15 @@ LLHTTPAssetStorage::LLHTTPAssetStorage(LLMessageSystem *msg, LLXferManager *xfer LLHTTPAssetStorage::LLHTTPAssetStorage(LLMessageSystem *msg, LLXferManager *xfer, LLVFS *vfs, - const char *web_host, - const char *local_web_host, - const char *host_name) + const std::string& web_host, + const std::string& local_web_host, + const std::string& host_name) : LLAssetStorage(msg, xfer, vfs) { _init(web_host, local_web_host, host_name); } -void LLHTTPAssetStorage::_init(const char *web_host, const char *local_web_host, const char* host_name) +void LLHTTPAssetStorage::_init(const std::string& web_host, const std::string& local_web_host, const std::string& host_name) { mBaseURL = web_host; mLocalBaseURL = local_web_host; @@ -470,7 +465,7 @@ void LLHTTPAssetStorage::storeAssetData( { message = "Added to upload queue"; } - reportMetric( uuid, type, NULL, requesting_agent_id, size, MR_OKAY, __FILE__, __LINE__, message ); + reportMetric( uuid, type, LLStringUtil::null, requesting_agent_id, size, MR_OKAY, __FILE__, __LINE__, message ); // this will get picked up and transmitted in checkForTimeouts if(store_local) @@ -492,7 +487,7 @@ void LLHTTPAssetStorage::storeAssetData( if (callback) { // LLAssetStorage metric: Zero size VFS - reportMetric( uuid, type, NULL, requesting_agent_id, 0, MR_ZERO_SIZE, __FILE__, __LINE__, "The file didn't exist or was zero length (VFS - can't tell which)" ); + reportMetric( uuid, type, LLStringUtil::null, requesting_agent_id, 0, MR_ZERO_SIZE, __FILE__, __LINE__, "The file didn't exist or was zero length (VFS - can't tell which)" ); callback(uuid, user_data, LL_ERR_ASSET_REQUEST_NONEXISTENT_FILE, LL_EXSTAT_NONEXISTENT_FILE); } } @@ -500,7 +495,7 @@ void LLHTTPAssetStorage::storeAssetData( // virtual void LLHTTPAssetStorage::storeAssetData( - const char* filename, + const std::string& filename, const LLUUID& asset_id, LLAssetType::EType asset_type, LLStoreAssetCallback callback, @@ -597,7 +592,7 @@ LLSD LLHTTPAssetStorage::getPendingDetails(LLAssetStorage::ERequestType rt, LLSD& pending = sd["requests"][i]; // See if this pending request is running. const LLAssetRequest* req = findRequest(running, - LLAssetType::lookup(pending["type"].asString().c_str()), + LLAssetType::lookup(pending["type"].asString()), pending["asset_id"]); if (req) { @@ -768,11 +763,11 @@ void LLHTTPAssetStorage::checkForTimeouts() // Setup this curl download request // We need to generate a new request here // since the one in the list could go away - char tmp_url[MAX_STRING]; /*Flawfinder: ignore*/ - char uuid_str[UUID_STR_LENGTH]; /*Flawfinder: ignore*/ + std::string tmp_url; + std::string uuid_str; req->getUUID().toString(uuid_str); std::string base_url = getBaseURL(req->getUUID(), req->getType()); - snprintf(tmp_url, sizeof(tmp_url), "%s/%36s.%s", base_url.c_str() , uuid_str, LLAssetType::lookup(req->getType())); /* Flawfinder: ignore */ + tmp_url = llformat("%s/%36s.%s", base_url.c_str() , uuid_str.c_str(), LLAssetType::lookup(req->getType())); LLHTTPAssetRequest *new_req = new LLHTTPAssetRequest(this, req->getUUID(), req->getType(), RT_DOWNLOAD, tmp_url, mCurlMultiHandle); @@ -805,12 +800,11 @@ void LLHTTPAssetStorage::checkForTimeouts() bool do_compress = req->getType() == LLAssetType::AT_OBJECT; - char tmp_url[MAX_STRING];/*Flawfinder: ignore*/ - char uuid_str[UUID_STR_LENGTH];/*Flawfinder: ignore*/ + std::string tmp_url; + std::string uuid_str; req->getUUID().toString(uuid_str); - snprintf(tmp_url, sizeof(tmp_url), /* Flawfinder: ignore */ - do_compress ? "%s/%s.%s.gz" : "%s/%s.%s", - mBaseURL.c_str(), uuid_str, LLAssetType::lookup(req->getType())); + tmp_url = mBaseURL + "/" + uuid_str + "." + LLAssetType::lookup(req->getType()); + if (do_compress) tmp_url += ".gz"; LLHTTPAssetRequest *new_req = new LLHTTPAssetRequest(this, req->getUUID(), req->getType(), RT_UPLOAD, tmp_url, mCurlMultiHandle); @@ -876,12 +870,12 @@ void LLHTTPAssetStorage::checkForTimeouts() // setup this curl upload request LLVFile file(mVFS, req->getUUID(), req->getType()); - char tmp_url[MAX_STRING]; /*Flawfinder: ignore*/ - char uuid_str[UUID_STR_LENGTH]; /*Flawfinder: ignore*/ + std::string tmp_url; + std::string uuid_str; req->getUUID().toString(uuid_str); // KLW - All temporary uploads are saved locally "http://localhost:12041/asset" - snprintf(tmp_url, sizeof(tmp_url), "%s/%36s.%s", mLocalBaseURL.c_str(), uuid_str, LLAssetType::lookup(req->getType())); /* Flawfinder: ignore */ + tmp_url = llformat("%s/%36s.%s", mLocalBaseURL.c_str(), uuid_str.c_str(), LLAssetType::lookup(req->getType())); LLHTTPAssetRequest *new_req = new LLHTTPAssetRequest(this, req->getUUID(), req->getType(), RT_LOCALUPLOAD, tmp_url, mCurlMultiHandle); @@ -1160,7 +1154,7 @@ size_t LLHTTPAssetStorage::nullOutputCallback(void *data, size_t size, size_t nm // blocking asset fetch which bypasses the VFS // this is a very limited function for use by the simstate loader and other one-offs -S32 LLHTTPAssetStorage::getURLToFile(const LLUUID& uuid, LLAssetType::EType asset_type, const LLString &url, const char *filename, progress_callback callback, void *userdata) +S32 LLHTTPAssetStorage::getURLToFile(const LLUUID& uuid, LLAssetType::EType asset_type, const std::string &url, const std::string& filename, progress_callback callback, void *userdata) { // *NOTE: There is no guarantee that the uuid and the asset_type match // - not that it matters. - Doug @@ -1174,7 +1168,7 @@ S32 LLHTTPAssetStorage::getURLToFile(const LLUUID& uuid, LLAssetType::EType asse } // make sure we use the normal curl setup, even though we don't really need a request object - LLHTTPAssetRequest req(this, uuid, asset_type, RT_DOWNLOAD, url.c_str(), mCurlMultiHandle); + LLHTTPAssetRequest req(this, uuid, asset_type, RT_DOWNLOAD, url, mCurlMultiHandle); req.mFP = fp; req.setupCurlHandle(); diff --git a/indra/llmessage/llhttpassetstorage.h b/indra/llmessage/llhttpassetstorage.h index e6ec39e27e..91876eb969 100644 --- a/indra/llmessage/llhttpassetstorage.h +++ b/indra/llmessage/llhttpassetstorage.h @@ -48,15 +48,15 @@ class LLHTTPAssetStorage : public LLAssetStorage public: LLHTTPAssetStorage(LLMessageSystem *msg, LLXferManager *xfer, LLVFS *vfs, const LLHost &upstream_host, - const char *web_host, - const char *local_web_host, - const char *host_name); + const std::string& web_host, + const std::string& local_web_host, + const std::string& host_name); LLHTTPAssetStorage(LLMessageSystem *msg, LLXferManager *xfer, LLVFS *vfs, - const char *web_host, - const char *local_web_host, - const char *host_name); + const std::string& web_host, + const std::string& local_web_host, + const std::string& host_name); virtual ~LLHTTPAssetStorage(); @@ -74,7 +74,7 @@ public: F64 timeout=LL_ASSET_STORAGE_TIMEOUT); virtual void storeAssetData( - const char* filename, + const std::string& filename, const LLUUID& asset_id, LLAssetType::EType atype, LLStoreAssetCallback callback, @@ -99,7 +99,7 @@ public: // Hack. One off curl download an URL to a file. Probably should be elsewhere. // Only used by lldynamicstate. The API is broken, and should be replaced with // a generic HTTP file fetch - Doug 9/25/06 - S32 getURLToFile(const LLUUID& uuid, LLAssetType::EType asset_type, const LLString &url, const char *filename, progress_callback callback, void *userdata); + S32 getURLToFile(const LLUUID& uuid, LLAssetType::EType asset_type, const std::string &url, const std::string& filename, progress_callback callback, void *userdata); LLAssetRequest* findNextRequest(request_list_t& pending, request_list_t& running); @@ -135,7 +135,7 @@ protected: void *user_data, BOOL duplicate, BOOL is_priority); private: - void _init(const char *web_host, const char *local_web_host, const char* host_name); + void _init(const std::string& web_host, const std::string& local_web_host, const std::string& host_name); // This will return the correct base URI for any http asset request std::string getBaseURL(const LLUUID& asset_id, LLAssetType::EType asset_type); diff --git a/indra/llmessage/llhttpclient.cpp b/indra/llmessage/llhttpclient.cpp index 52cb8fe1c3..2937edd853 100644 --- a/indra/llmessage/llhttpclient.cpp +++ b/indra/llmessage/llhttpclient.cpp @@ -152,7 +152,7 @@ namespace { LLBufferStream ostream(channels, buffer.get()); - llifstream fstream(mFilename.c_str(), std::iostream::binary | std::iostream::out); + llifstream fstream(mFilename, std::iostream::binary | std::iostream::out); fstream.seekg(0, std::ios::end); U32 fileSize = fstream.tellg(); fstream.seekg(0, std::ios::beg); diff --git a/indra/llmessage/llhttpsender.cpp b/indra/llmessage/llhttpsender.cpp index 096bc73e0b..6e86947e6a 100644 --- a/indra/llmessage/llhttpsender.cpp +++ b/indra/llmessage/llhttpsender.cpp @@ -52,7 +52,7 @@ LLHTTPSender::~LLHTTPSender() } //virtual -void LLHTTPSender::send(const LLHost& host, const char* name, +void LLHTTPSender::send(const LLHost& host, const std::string& name, const LLSD& body, LLHTTPClient::ResponderPtr response) const { diff --git a/indra/llmessage/llhttpsender.h b/indra/llmessage/llhttpsender.h index 3a6cd681fa..e555b4485c 100644 --- a/indra/llmessage/llhttpsender.h +++ b/indra/llmessage/llhttpsender.h @@ -45,7 +45,7 @@ class LLHTTPSender /** @brief Send message to host with body, call response when done */ virtual void send(const LLHost& host, - const char* message, const LLSD& body, + const std::string& message, const LLSD& body, LLHTTPClient::ResponderPtr response) const; /** @brief Set sender for host, takes ownership of sender. */ diff --git a/indra/llmessage/llinstantmessage.cpp b/indra/llmessage/llinstantmessage.cpp index 04af44fe26..a7fac2dfc3 100644 --- a/indra/llmessage/llinstantmessage.cpp +++ b/indra/llmessage/llinstantmessage.cpp @@ -59,7 +59,7 @@ const S32 VOTE_UNANIMOUS = 2; const char EMPTY_BINARY_BUCKET[] = ""; const S32 EMPTY_BINARY_BUCKET_SIZE = 1; const U32 NO_TIMESTAMP = 0; -const char SYSTEM_FROM[] = "Second Life"; +const std::string SYSTEM_FROM("Second Life"); const S32 IM_TTL = 1; @@ -144,8 +144,8 @@ void LLIMInfo::packMessageBlock(LLMessageSystem* msg) const mFromGroup, LLUUID::null, mToID, - mName.c_str(), - mMessage.c_str(), + mName, + mMessage, mOffline, mIMType, mID, @@ -163,8 +163,8 @@ void pack_instant_message( BOOL from_group, const LLUUID& session_id, const LLUUID& to_id, - const char* name, - const char* message, + const std::string& name, + const std::string& message, U8 offline, EInstantMessage dialog, const LLUUID& id, @@ -202,8 +202,8 @@ void pack_instant_message_block( BOOL from_group, const LLUUID& session_id, const LLUUID& to_id, - const char* name, - const char* message, + const std::string& name, + const std::string& message, U8 offline, EInstantMessage dialog, const LLUUID& id, @@ -229,10 +229,10 @@ void pack_instant_message_block( msg->addU32Fast(_PREHASH_Timestamp, timestamp); msg->addStringFast(_PREHASH_FromAgentName, name); S32 bytes_left = MTUBYTES; - if(message) + if(!message.empty()) { char buffer[MTUBYTES]; - int num_written = snprintf(buffer, MTUBYTES, "%s", message); /* Flawfinder: ignore */ + int num_written = snprintf(buffer, MTUBYTES, "%s", message.c_str()); /* Flawfinder: ignore */ // snprintf returns number of bytes that would have been written // had the output not being truncated. In that case, it will // return either -1 or value >= passed in size value . So a check needs to be added @@ -281,13 +281,9 @@ void LLIMInfo::unpackMessageBlock(LLMessageSystem* msg) mIMType = (EInstantMessage) dialog; msg->getUUIDFast(_PREHASH_MessageBlock, _PREHASH_ID, mID); msg->getU32Fast(_PREHASH_MessageBlock, _PREHASH_Timestamp, mTimeStamp); - char name[DB_FULL_NAME_BUF_SIZE]; /*Flawfinder: ignore*/ - msg->getStringFast(_PREHASH_MessageBlock, _PREHASH_FromAgentName, DB_FULL_NAME_BUF_SIZE, name); - mName.assign(name); + msg->getStringFast(_PREHASH_MessageBlock, _PREHASH_FromAgentName, mName); - char message[DB_IM_MSG_BUF_SIZE]; /*Flawfinder: ignore*/ - msg->getStringFast(_PREHASH_MessageBlock, _PREHASH_Message, DB_IM_MSG_BUF_SIZE, message); - mMessage.assign(message); + msg->getStringFast(_PREHASH_MessageBlock, _PREHASH_Message, mMessage); S32 binary_bucket_size = llmin( MTUBYTES, diff --git a/indra/llmessage/llinstantmessage.h b/indra/llmessage/llinstantmessage.h index 9645d4a763..251c1bc85c 100644 --- a/indra/llmessage/llinstantmessage.h +++ b/indra/llmessage/llinstantmessage.h @@ -222,7 +222,7 @@ extern const char EMPTY_BINARY_BUCKET[]; extern const S32 EMPTY_BINARY_BUCKET_SIZE; extern const U32 NO_TIMESTAMP; -extern const char SYSTEM_FROM[]; +extern const std::string SYSTEM_FROM; // Number of retry attempts on sending the im. extern const S32 IM_TTL; @@ -289,8 +289,8 @@ void pack_instant_message( BOOL from_group, const LLUUID& session_id, const LLUUID& to_id, - const char* name, - const char* message, + const std::string& name, + const std::string& message, U8 offline = IM_ONLINE, EInstantMessage dialog = IM_NOTHING_SPECIAL, const LLUUID& id = LLUUID::null, @@ -307,8 +307,8 @@ void pack_instant_message_block( BOOL from_group, const LLUUID& session_id, const LLUUID& to_id, - const char* name, - const char* message, + const std::string& name, + const std::string& message, U8 offline = IM_ONLINE, EInstantMessage dialog = IM_NOTHING_SPECIAL, const LLUUID& id = LLUUID::null, diff --git a/indra/llmessage/lliohttpserver.cpp b/indra/llmessage/lliohttpserver.cpp index 90f8ef7638..a2e0325ae7 100644 --- a/indra/llmessage/lliohttpserver.cpp +++ b/indra/llmessage/lliohttpserver.cpp @@ -707,7 +707,7 @@ LLIOPipe::EStatus LLHTTPResponder::process_impl( read_next_line = true; std::string name(buf, pos_colon - buf); std::string value(pos_colon + 2); - LLString::toLower(name); + LLStringUtil::toLower(name); if("content-length" == name) { lldebugs << "Content-Length: " << value << llendl; @@ -715,7 +715,7 @@ LLIOPipe::EStatus LLHTTPResponder::process_impl( } else { - LLString::trimTail(value); + LLStringUtil::trimTail(value); mHeaders[name] = value; } } diff --git a/indra/llmessage/lliosocket.cpp b/indra/llmessage/lliosocket.cpp index ff7c32aee8..ad309434ac 100644 --- a/indra/llmessage/lliosocket.cpp +++ b/indra/llmessage/lliosocket.cpp @@ -220,11 +220,11 @@ bool LLSocket::blockingConnect(const LLHost& host) { if(!mSocket) return false; apr_sockaddr_t* sa = NULL; - char ip_address[MAXADDRSTR]; /*Flawfinder: ignore*/ - host.getIPString(ip_address, MAXADDRSTR); + std::string ip_address; + ip_address = host.getIPString(); if(ll_apr_warn_status(apr_sockaddr_info_get( &sa, - ip_address, + ip_address.c_str(), APR_UNSPEC, host.getPort(), 0, diff --git a/indra/llmessage/llmail.cpp b/indra/llmessage/llmail.cpp index 1a076b7281..6a8931cf73 100644 --- a/indra/llmessage/llmail.cpp +++ b/indra/llmessage/llmail.cpp @@ -365,7 +365,7 @@ std::string LLMail::encryptIMEmailAddress(const LLUUID& from_agent_id, std::string address = LLBase32::encode(encrypted, encrypted_size); // Make it more pretty for humans. - LLString::toLower(address); + LLStringUtil::toLower(address); delete [] encrypted; diff --git a/indra/llmessage/llmessageconfig.cpp b/indra/llmessage/llmessageconfig.cpp index 259daada77..0159eb3562 100644 --- a/indra/llmessage/llmessageconfig.cpp +++ b/indra/llmessage/llmessageconfig.cpp @@ -97,7 +97,7 @@ void LLMessageConfigFile::loadFile() { LLSD data; { - llifstream file(filename().c_str()); + llifstream file(filename()); if (file.is_open()) { diff --git a/indra/llmessage/llmessagereader.h b/indra/llmessage/llmessagereader.h index 4687191494..3de94a1d8f 100644 --- a/indra/llmessage/llmessagereader.h +++ b/indra/llmessage/llmessagereader.h @@ -69,6 +69,7 @@ class LLMessageReader virtual void getIPAddr(const char *block, const char *var, U32 &ip, S32 blocknum = 0) = 0; virtual void getIPPort(const char *block, const char *var, U16 &port, S32 blocknum = 0) = 0; virtual void getString(const char *block, const char *var, S32 buffer_size, char *buffer, S32 blocknum = 0) = 0; + virtual void getString(const char *block, const char *var, std::string& outstr, S32 blocknum = 0) = 0; virtual S32 getNumberOfBlocks(const char *blockname) = 0; virtual S32 getSize(const char *blockname, const char *varname) = 0; diff --git a/indra/llmessage/llmessagethrottle.cpp b/indra/llmessage/llmessagethrottle.cpp index 912980d738..846d4067ad 100644 --- a/indra/llmessage/llmessagethrottle.cpp +++ b/indra/llmessage/llmessagethrottle.cpp @@ -110,7 +110,7 @@ void LLMessageThrottle::pruneEntries() } } -BOOL LLMessageThrottle::addViewerAlert(const LLUUID& to, const char* mesg) +BOOL LLMessageThrottle::addViewerAlert(const LLUUID& to, const std::string& mesg) { message_list_t* message_list = &(mMessageList[MTC_VIEWER_ALERT]); @@ -144,7 +144,7 @@ BOOL LLMessageThrottle::addViewerAlert(const LLUUID& to, const char* mesg) } } -BOOL LLMessageThrottle::addAgentAlert(const LLUUID& agent, const LLUUID& task, const char* mesg) +BOOL LLMessageThrottle::addAgentAlert(const LLUUID& agent, const LLUUID& task, const std::string& mesg) { message_list_t* message_list = &(mMessageList[MTC_AGENT_ALERT]); diff --git a/indra/llmessage/llmessagethrottle.h b/indra/llmessage/llmessagethrottle.h index a3267e7d9d..43c0809d94 100644 --- a/indra/llmessage/llmessagethrottle.h +++ b/indra/llmessage/llmessagethrottle.h @@ -64,8 +64,8 @@ public: LLMessageThrottle(); ~LLMessageThrottle(); - BOOL addViewerAlert (const LLUUID& to, const char* mesg); - BOOL addAgentAlert (const LLUUID& agent, const LLUUID& task, const char* mesg); + BOOL addViewerAlert (const LLUUID& to, const std::string& mesg); + BOOL addAgentAlert (const LLUUID& agent, const LLUUID& task, const std::string& mesg); void pruneEntries(); diff --git a/indra/llmessage/llmime.cpp b/indra/llmessage/llmime.cpp index 7d43f38e9a..de46a50bd9 100644 --- a/indra/llmessage/llmime.cpp +++ b/indra/llmessage/llmime.cpp @@ -439,9 +439,7 @@ bool LLMimeParser::Impl::parseHeaders( std::string value(colon); for(S32 ii = 0; ii < KNOWN_HEADER_COUNT; ++ii) { - if(0 == LLString::compareInsensitive( - name.c_str(), - KNOWN_HEADER[ii].c_str())) + if(0 == LLStringUtil::compareInsensitive(name, KNOWN_HEADER[ii])) { name = KNOWN_HEADER[ii]; break; @@ -525,7 +523,7 @@ void LLMimeParser::Impl::scanPastSeparator( { mContinue = false; } - if(0 == LLString::compareStrings(mBuffer, separator.c_str())) + if(0 == LLStringUtil::compareStrings(std::string(mBuffer), separator)) { found_separator = true; } diff --git a/indra/llmessage/llnamevalue.cpp b/indra/llmessage/llnamevalue.cpp index 3503458a3b..13dca3e51f 100644 --- a/indra/llmessage/llnamevalue.cpp +++ b/indra/llmessage/llnamevalue.cpp @@ -155,7 +155,7 @@ void LLNameValue::init(const char *name, const char *data, const char *type, con else if (!strcmp(mStringType, "U64")) { mType = NVT_U64; - mNameValueReference.u64 = new U64(str_to_U64(data)); + mNameValueReference.u64 = new U64(str_to_U64(ll_safe_string(data))); } else if (!strcmp(mStringType, "VEC3")) { diff --git a/indra/llmessage/llsdmessagereader.cpp b/indra/llmessage/llsdmessagereader.cpp index 4ca7895613..b7d0267423 100755 --- a/indra/llmessage/llsdmessagereader.cpp +++ b/indra/llmessage/llsdmessagereader.cpp @@ -243,6 +243,12 @@ void LLSDMessageReader::getString(const char *block, const char *var, buffer[data_size] = '\0'; } +//virtual +void LLSDMessageReader::getString(const char *block, const char *var, + std::string& outstr, S32 blocknum) +{ + outstr = getLLSD(mMessage, block, var, blocknum).asString(); +} //virtual S32 LLSDMessageReader::getNumberOfBlocks(const char *blockname) diff --git a/indra/llmessage/llsdmessagereader.h b/indra/llmessage/llsdmessagereader.h index 66ac1d14ad..bfb0b31218 100755 --- a/indra/llmessage/llsdmessagereader.h +++ b/indra/llmessage/llsdmessagereader.h @@ -87,6 +87,8 @@ public: S32 blocknum = 0); virtual void getString(const char *block, const char *var, S32 buffer_size, char *buffer, S32 blocknum = 0); + virtual void getString(const char *block, const char *var, std::string& outstr, + S32 blocknum = 0); virtual S32 getNumberOfBlocks(const char *blockname); virtual S32 getSize(const char *blockname, const char *varname); diff --git a/indra/llmessage/llservicebuilder.cpp b/indra/llmessage/llservicebuilder.cpp index 6442767ebd..c262515e74 100644 --- a/indra/llmessage/llservicebuilder.cpp +++ b/indra/llmessage/llservicebuilder.cpp @@ -39,7 +39,7 @@ void LLServiceBuilder::loadServiceDefinitionsFromFile( const std::string& service_filename) { - llifstream service_file(service_filename.c_str(), std::ios::binary); + llifstream service_file(service_filename, std::ios::binary); if(service_file.is_open()) { LLSD service_data; diff --git a/indra/llmessage/lltemplatemessagereader.cpp b/indra/llmessage/lltemplatemessagereader.cpp index f9b703b52a..b1395b0b70 100644 --- a/indra/llmessage/lltemplatemessagereader.cpp +++ b/indra/llmessage/lltemplatemessagereader.cpp @@ -171,9 +171,6 @@ S32 LLTemplateMessageReader::getNumberOfBlocks(const char *blockname) if (iter == mCurrentRMessageData->mMemberBlocks.end()) { -// sprintf(errmsg, "Block %s not in message %s", bnamep, mCurrentRMessageData->mName); -// llerrs << errmsg << llendl; -// return -1; return 0; } @@ -433,6 +430,15 @@ inline void LLTemplateMessageReader::getString(const char *block, const char *va s[buffer_size - 1] = '\0'; } +inline void LLTemplateMessageReader::getString(const char *block, const char *var, std::string& outstr, S32 blocknum ) +{ + char s[MTUBYTES]; + s[0] = '\0'; + getData(block, var, s, 0, blocknum, MTUBYTES); + s[MTUBYTES - 1] = '\0'; + outstr = s; +} + //virtual S32 LLTemplateMessageReader::getMessageSize() const { diff --git a/indra/llmessage/lltemplatemessagereader.h b/indra/llmessage/lltemplatemessagereader.h index 42cd90ea94..ea3ec9a3d8 100644 --- a/indra/llmessage/lltemplatemessagereader.h +++ b/indra/llmessage/lltemplatemessagereader.h @@ -88,6 +88,8 @@ public: S32 blocknum = 0); virtual void getString(const char *block, const char *var, S32 buffer_size, char *buffer, S32 blocknum = 0); + virtual void getString(const char *block, const char *var, std::string& outstr, + S32 blocknum = 0); virtual S32 getNumberOfBlocks(const char *blockname); virtual S32 getSize(const char *blockname, const char *varname); diff --git a/indra/llmessage/lltransfersourcefile.cpp b/indra/llmessage/lltransfersourcefile.cpp index 268421627e..5088b33e0e 100644 --- a/indra/llmessage/lltransfersourcefile.cpp +++ b/indra/llmessage/lltransfersourcefile.cpp @@ -67,7 +67,7 @@ void LLTransferSourceFile::initTransfer() return; } // Look for the file. - mFP = LLFile::fopen(mParams.getFilename().c_str(), "rb"); /* Flawfinder: ignore */ + mFP = LLFile::fopen(mParams.getFilename(), "rb"); /* Flawfinder: ignore */ if (!mFP) { sendTransferStatus(LLTS_ERROR); @@ -134,9 +134,9 @@ void LLTransferSourceFile::completionCallback(const LLTSCode status) } // Delete the file iff the filename begins with "TEMP" - if (mParams.getDeleteOnCompletion() && memcmp(mParams.getFilename().c_str(), "TEMP", 4) == 0) + if (mParams.getDeleteOnCompletion() && mParams.getFilename().substr(0, 4) == "TEMP") { - LLFile::remove(mParams.getFilename().c_str()); + LLFile::remove(mParams.getFilename()); } } @@ -162,7 +162,7 @@ LLTransferSourceParamsFile::LLTransferSourceParamsFile() : void LLTransferSourceParamsFile::packParams(LLDataPacker &dp) const { - dp.packString(mFilename.c_str(), "Filename"); + dp.packString(mFilename, "Filename"); dp.packU8((U8)mDeleteOnCompletion, "Delete"); } diff --git a/indra/llmessage/lltransfersourcefile.h b/indra/llmessage/lltransfersourcefile.h index 84a6bd259f..0aa0eb8458 100644 --- a/indra/llmessage/lltransfersourcefile.h +++ b/indra/llmessage/lltransfersourcefile.h @@ -42,7 +42,7 @@ public: /*virtual*/ void packParams(LLDataPacker &dp) const; /*virtual*/ BOOL unpackParams(LLDataPacker &dp); - void setFilename(const LLString &filename) { mFilename = filename; } + void setFilename(const std::string &filename) { mFilename = filename; } std::string getFilename() const { return mFilename; } void setDeleteOnCompletion(BOOL enabled) { mDeleteOnCompletion = enabled; } diff --git a/indra/llmessage/lltransfertargetfile.cpp b/indra/llmessage/lltransfertargetfile.cpp index d05f80834a..64c001ed6e 100644 --- a/indra/llmessage/lltransfertargetfile.cpp +++ b/indra/llmessage/lltransfertargetfile.cpp @@ -80,7 +80,7 @@ LLTSCode LLTransferTargetFile::dataCallback(const S32 packet_id, U8 *in_datap, c if (!mFP) { - mFP = LLFile::fopen(mParams.mFilename.c_str(), "wb"); /* Flawfinder: ignore */ + mFP = LLFile::fopen(mParams.mFilename, "wb"); /* Flawfinder: ignore */ if (!mFP) { @@ -122,7 +122,7 @@ void LLTransferTargetFile::completionCallback(const LLTSCode status) if (mFP) { // Only need to remove file if we successfully opened it. - LLFile::remove(mParams.mFilename.c_str()); + LLFile::remove(mParams.mFilename); } default: break; diff --git a/indra/llmessage/lltransfertargetfile.h b/indra/llmessage/lltransfertargetfile.h index 6b837f4890..ba34ba1123 100644 --- a/indra/llmessage/lltransfertargetfile.h +++ b/indra/llmessage/lltransfertargetfile.h @@ -40,12 +40,12 @@ class LLTransferTargetParamsFile : public LLTransferTargetParams { public: LLTransferTargetParamsFile() : LLTransferTargetParams(LLTTT_FILE) {} - void setFilename(const LLString& filename) { mFilename = filename; } + void setFilename(const std::string& filename) { mFilename = filename; } void setCallback(LLTTFCompleteCallback cb, void *user_data) { mCompleteCallback = cb; mUserData = user_data; } friend class LLTransferTargetFile; protected: - LLString mFilename; + std::string mFilename; LLTTFCompleteCallback mCompleteCallback; void * mUserData; }; diff --git a/indra/llmessage/llurlrequest.cpp b/indra/llmessage/llurlrequest.cpp index e7be235221..5ac55bc83d 100644 --- a/indra/llmessage/llurlrequest.cpp +++ b/indra/llmessage/llurlrequest.cpp @@ -542,7 +542,7 @@ LLIOPipe::EStatus LLContextURLExtractor::process_impl( // find the context url if(context.has(CONTEXT_DEST_URI_SD_LABEL)) { - mRequest->setURL(context[CONTEXT_DEST_URI_SD_LABEL]); + mRequest->setURL(context[CONTEXT_DEST_URI_SD_LABEL].asString()); return STATUS_DONE; } return STATUS_ERROR; diff --git a/indra/llmessage/llxfer.cpp b/indra/llmessage/llxfer.cpp index fefb6f9c63..5682b1c454 100644 --- a/indra/llmessage/llxfer.cpp +++ b/indra/llmessage/llxfer.cpp @@ -103,7 +103,7 @@ void LLXfer::free () S32 LLXfer::startSend (U64 xfer_id, const LLHost &remote_host) { - llwarns << "undifferentiated LLXfer::startSend for " << getName() << llendl; + llwarns << "undifferentiated LLXfer::startSend for " << getFileName() << llendl; return (-1); } @@ -119,7 +119,7 @@ void LLXfer::setXferSize (S32 xfer_size) S32 LLXfer::startDownload() { - llwarns << "undifferentiated LLXfer::startDownload for " << getName() + llwarns << "undifferentiated LLXfer::startDownload for " << getFileName() << llendl; return (-1); } @@ -293,13 +293,13 @@ S32 LLXfer::processEOF() if (LL_ERR_NOERR == mCallbackResult) { - llinfos << "xfer from " << mRemoteHost << " complete: " << getName() + llinfos << "xfer from " << mRemoteHost << " complete: " << getFileName() << llendl; } else { llinfos << "xfer from " << mRemoteHost << " failed, code " - << mCallbackResult << ": " << getName() << llendl; + << mCallbackResult << ": " << getFileName() << llendl; } if (mCallback) @@ -327,7 +327,7 @@ void LLXfer::abort (S32 result_code) { mCallbackResult = result_code; - llinfos << "Aborting xfer from " << mRemoteHost << " named " << getName() + llinfos << "Aborting xfer from " << mRemoteHost << " named " << getFileName() << " - error: " << result_code << llendl; gMessageSystem->newMessageFast(_PREHASH_AbortXfer); @@ -343,11 +343,9 @@ void LLXfer::abort (S32 result_code) /////////////////////////////////////////////////////////// -const char * LLXfer::getName() +std::string LLXfer::getFileName() { - static char tmp_str[256]; /* Flawfinder: ignore */ - - return (U64_to_str(mID, tmp_str, sizeof(tmp_str))); + return U64_to_str(mID); } /////////////////////////////////////////////////////////// @@ -367,7 +365,7 @@ S32 LLXfer::getMaxBufferSize () std::ostream& operator<< (std::ostream& os, LLXfer &hh) { - os << hh.getName() ; + os << hh.getFileName() ; return os; } diff --git a/indra/llmessage/llxfer.h b/indra/llmessage/llxfer.h index 017a521b81..57abc28960 100644 --- a/indra/llmessage/llxfer.h +++ b/indra/llmessage/llxfer.h @@ -106,7 +106,7 @@ class LLXfer virtual void setXferSize (S32 data_size); virtual S32 getMaxBufferSize(); - virtual const char *getName(); + virtual std::string getFileName(); virtual U32 getXferTypeTag(); diff --git a/indra/llmessage/llxfer_file.cpp b/indra/llmessage/llxfer_file.cpp index 6b71e7db8f..3643c4880d 100644 --- a/indra/llmessage/llxfer_file.cpp +++ b/indra/llmessage/llxfer_file.cpp @@ -47,17 +47,17 @@ const U32 LL_MAX_XFER_FILE_BUFFER = 65536; // local function to copy a file -S32 copy_file(const char* from, const char* to); +S32 copy_file(const std::string& from, const std::string& to); /////////////////////////////////////////////////////////// LLXfer_File::LLXfer_File (S32 chunk_size) : LLXfer(chunk_size) { - init(LLString::null, FALSE, chunk_size); + init(LLStringUtil::null, FALSE, chunk_size); } -LLXfer_File::LLXfer_File (const LLString& local_filename, BOOL delete_local_on_completion, S32 chunk_size) +LLXfer_File::LLXfer_File (const std::string& local_filename, BOOL delete_local_on_completion, S32 chunk_size) : LLXfer(chunk_size) { init(local_filename, delete_local_on_completion, chunk_size); @@ -72,24 +72,24 @@ LLXfer_File::~LLXfer_File () /////////////////////////////////////////////////////////// -void LLXfer_File::init (const LLString& local_filename, BOOL delete_local_on_completion, S32 chunk_size) +void LLXfer_File::init (const std::string& local_filename, BOOL delete_local_on_completion, S32 chunk_size) { mFp = NULL; - mLocalFilename[0] = 0; - mRemoteFilename[0] = 0; + mLocalFilename.clear(); + mRemoteFilename.clear(); mRemotePath = LL_PATH_NONE; - mTempFilename[0] = 0; + mTempFilename.clear(); mDeleteLocalOnCompletion = FALSE; mDeleteRemoteOnCompletion = FALSE; if (!local_filename.empty()) { - strncpy(mLocalFilename, local_filename.c_str(), LL_MAX_PATH-1); - mLocalFilename[LL_MAX_PATH-1] = '\0'; // stupid strncpy. + mLocalFilename = local_filename.substr(0,LL_MAX_PATH-1); // You can only automatically delete .tmp file as a safeguard against nasty messages. - mDeleteLocalOnCompletion = (delete_local_on_completion && (strstr(mLocalFilename,".tmp") == &mLocalFilename[strlen(mLocalFilename)-4])); /* Flawfinder : ignore */ + std::string exten = mLocalFilename.substr(mLocalFilename.length()-4, 4); + mDeleteLocalOnCompletion = (delete_local_on_completion && exten == ".tmp"); } } @@ -121,8 +121,8 @@ void LLXfer_File::free () /////////////////////////////////////////////////////////// S32 LLXfer_File::initializeRequest(U64 xfer_id, - const LLString& local_filename, - const LLString& remote_filename, + const std::string& local_filename, + const std::string& remote_filename, ELLPath remote_path, const LLHost& remote_host, BOOL delete_remote_on_completion, @@ -132,15 +132,13 @@ S32 LLXfer_File::initializeRequest(U64 xfer_id, S32 retval = 0; // presume success mID = xfer_id; - strncpy(mLocalFilename, local_filename.c_str(), LL_MAX_PATH-1); - mLocalFilename[LL_MAX_PATH-1] = '\0'; // stupid strncpy. - strncpy(mRemoteFilename,remote_filename.c_str(), LL_MAX_PATH-1); - mRemoteFilename[LL_MAX_PATH-1] = '\0'; // stupid strncpy. + mLocalFilename = local_filename; + mRemoteFilename = remote_filename; mRemotePath = remote_path; mRemoteHost = remote_host; mDeleteRemoteOnCompletion = delete_remote_on_completion; - snprintf(mTempFilename, sizeof(mTempFilename), "%s",gDirUtilp->getTempFilename().c_str()); /* Flawfinder: ignore */ + mTempFilename = gDirUtilp->getTempFilename(); mCallback = callback; mCallbackDataHandle = user_data; @@ -343,7 +341,7 @@ S32 LLXfer_File::processEOF() if(copy_file(mTempFilename, mLocalFilename) == 0) { llinfos << "Rename across mounts; copying+unlinking the file instead." << llendl; - unlink(mTempFilename); + unlink(mTempFilename.c_str()); } else { @@ -384,14 +382,14 @@ S32 LLXfer_File::processEOF() /////////////////////////////////////////////////////////// -BOOL LLXfer_File::matchesLocalFilename(const LLString& filename) +BOOL LLXfer_File::matchesLocalFilename(const std::string& filename) { return (filename == mLocalFilename); } /////////////////////////////////////////////////////////// -BOOL LLXfer_File::matchesRemoteFilename(const LLString& filename, ELLPath remote_path) +BOOL LLXfer_File::matchesRemoteFilename(const std::string& filename, ELLPath remote_path) { return ((filename == mRemoteFilename) && (remote_path == mRemotePath)); } @@ -399,9 +397,9 @@ BOOL LLXfer_File::matchesRemoteFilename(const LLString& filename, ELLPath remote /////////////////////////////////////////////////////////// -const char * LLXfer_File::getName() +std::string LLXfer_File::getFileName() { - return (mLocalFilename); + return mLocalFilename; } /////////////////////////////////////////////////////////// @@ -421,7 +419,7 @@ U32 LLXfer_File::getXferTypeTag() // function. It does not really spam enough information, but is useful // for this cpp file, because this should never be called in a // production environment. -S32 copy_file(const char* from, const char* to) +S32 copy_file(const std::string& from, const std::string& to) { S32 rv = 0; LLFILE* in = LLFile::fopen(from, "rb"); /*Flawfinder: ignore*/ diff --git a/indra/llmessage/llxfer_file.h b/indra/llmessage/llxfer_file.h index 5302302e54..04336c75fe 100644 --- a/indra/llmessage/llxfer_file.h +++ b/indra/llmessage/llxfer_file.h @@ -39,25 +39,25 @@ class LLXfer_File : public LLXfer { protected: LLFILE *mFp; - char mLocalFilename[LL_MAX_PATH]; /* Flawfinder : ignore */ - char mRemoteFilename[LL_MAX_PATH]; /* Flawfinder : ignore */ + std::string mLocalFilename; + std::string mRemoteFilename; ELLPath mRemotePath; - char mTempFilename[LL_MAX_PATH]; /* Flawfinder : ignore */ + std::string mTempFilename; BOOL mDeleteLocalOnCompletion; BOOL mDeleteRemoteOnCompletion; public: LLXfer_File (S32 chunk_size); - LLXfer_File (const LLString& local_filename, BOOL delete_local_on_completion, S32 chunk_size); + LLXfer_File (const std::string& local_filename, BOOL delete_local_on_completion, S32 chunk_size); virtual ~LLXfer_File(); - virtual void init(const LLString& local_filename, BOOL delete_local_on_completion, S32 chunk_size); + virtual void init(const std::string& local_filename, BOOL delete_local_on_completion, S32 chunk_size); virtual void free(); virtual S32 initializeRequest(U64 xfer_id, - const LLString& local_filename, - const LLString& remote_filename, + const std::string& local_filename, + const std::string& remote_filename, ELLPath remote_path, const LLHost& remote_host, BOOL delete_remote_on_completion, @@ -72,14 +72,14 @@ class LLXfer_File : public LLXfer virtual S32 suck(S32 start_position); virtual S32 flush(); - virtual BOOL matchesLocalFilename(const LLString& filename); - virtual BOOL matchesRemoteFilename(const LLString& filename, ELLPath remote_path); + virtual BOOL matchesLocalFilename(const std::string& filename); + virtual BOOL matchesRemoteFilename(const std::string& filename, ELLPath remote_path); virtual S32 getMaxBufferSize(); virtual U32 getXferTypeTag(); - virtual const char *getName(); + virtual std::string getFileName(); }; #endif diff --git a/indra/llmessage/llxfer_mem.cpp b/indra/llmessage/llxfer_mem.cpp index 4c3b1bbebb..dbaa3aebed 100644 --- a/indra/llmessage/llxfer_mem.cpp +++ b/indra/llmessage/llxfer_mem.cpp @@ -55,7 +55,7 @@ LLXfer_Mem::~LLXfer_Mem () void LLXfer_Mem::init () { - mRemoteFilename[0] = '\0'; + mRemoteFilename.clear(); mRemotePath = LL_PATH_NONE; mDeleteRemoteOnCompletion = FALSE; } @@ -120,7 +120,7 @@ S32 LLXfer_Mem::startSend (U64 xfer_id, const LLHost &remote_host) mID = xfer_id; mPacketNum = -1; -// cout << "Sending file: " << getName() << endl; +// cout << "Sending file: " << getFileName() << endl; mStatus = e_LL_XFER_PENDING; @@ -135,7 +135,7 @@ S32 LLXfer_Mem::processEOF() mStatus = e_LL_XFER_COMPLETE; - llinfos << "xfer complete: " << getName() << llendl; + llinfos << "xfer complete: " << getFileName() << llendl; if (mCallback) { @@ -165,8 +165,7 @@ S32 LLXfer_Mem::initializeRequest(U64 xfer_id, mCallbackDataHandle = user_data; mCallbackResult = LL_ERR_NOERR; - strncpy(mRemoteFilename, remote_filename.c_str(), LL_MAX_PATH-1); - mRemoteFilename[LL_MAX_PATH-1] = '\0'; // stupid strncpy. + mRemoteFilename = remote_filename; mRemotePath = remote_path; mDeleteRemoteOnCompletion = delete_remote_on_completion; diff --git a/indra/llmessage/llxfer_mem.h b/indra/llmessage/llxfer_mem.h index 858b8d1323..a6b95c0fcf 100644 --- a/indra/llmessage/llxfer_mem.h +++ b/indra/llmessage/llxfer_mem.h @@ -42,7 +42,7 @@ class LLXfer_Mem : public LLXfer private: protected: void (*mCallback)(void *, S32, void **, S32, LLExtStat); - char mRemoteFilename[LL_MAX_PATH]; /* Flawfinder : ignore */ + std::string mRemoteFilename; ELLPath mRemotePath; BOOL mDeleteRemoteOnCompletion; diff --git a/indra/llmessage/llxfer_vfile.cpp b/indra/llmessage/llxfer_vfile.cpp index b870e5369d..6dd683043b 100644 --- a/indra/llmessage/llxfer_vfile.cpp +++ b/indra/llmessage/llxfer_vfile.cpp @@ -74,10 +74,10 @@ void LLXfer_VFile::init (LLVFS *vfs, const LLUUID &local_id, LLAssetType::EType mVFile = NULL; - char id_string[UUID_STR_LENGTH]; /* Flawfinder : ignore */ + std::string id_string; mLocalID.toString(id_string); - snprintf(mName, sizeof(mName), "VFile %s:%s", id_string, LLAssetType::lookup(mType)); /* Flawfinder : ignore */ + mName = llformat("VFile %s:%s", id_string.c_str(), LLAssetType::lookup(mType)); } /////////////////////////////////////////////////////////// @@ -118,10 +118,10 @@ S32 LLXfer_VFile::initializeRequest(U64 xfer_id, mCallbackDataHandle = user_data; mCallbackResult = LL_ERR_NOERR; - char id_string[UUID_STR_LENGTH]; /* Flawfinder : ignore */ + std::string id_string; mLocalID.toString(id_string); - snprintf(mName, sizeof(mName), "VFile %s:%s", id_string, LLAssetType::lookup(mType)); /* Flawfinder : ignore */ + mName = llformat("VFile %s:%s", id_string.c_str(), LLAssetType::lookup(mType)); llinfos << "Requesting " << mName << llendl; @@ -328,7 +328,7 @@ BOOL LLXfer_VFile::matchesRemoteFile(const LLUUID &id, LLAssetType::EType type) ////////////////////////////////////////////////////////// -const char * LLXfer_VFile::getName() +std::string LLXfer_VFile::getFileName() { return mName; } diff --git a/indra/llmessage/llxfer_vfile.h b/indra/llmessage/llxfer_vfile.h index 5d57b08e3c..84457edf26 100644 --- a/indra/llmessage/llxfer_vfile.h +++ b/indra/llmessage/llxfer_vfile.h @@ -50,7 +50,7 @@ class LLXfer_VFile : public LLXfer LLVFS *mVFS; - char mName[MAX_STRING]; /* Flawfinder : ignore */ + std::string mName; public: LLXfer_VFile (); @@ -85,7 +85,7 @@ class LLXfer_VFile : public LLXfer virtual U32 getXferTypeTag(); - virtual const char *getName(); + virtual std::string getFileName(); }; #endif diff --git a/indra/llmessage/llxfermanager.cpp b/indra/llmessage/llxfermanager.cpp index fc75b3ae75..a94f982b8d 100644 --- a/indra/llmessage/llxfermanager.cpp +++ b/indra/llmessage/llxfermanager.cpp @@ -406,8 +406,8 @@ U64 LLXferManager::registerXfer(const void *datap, const S32 length) /////////////////////////////////////////////////////////// -void LLXferManager::requestFile(const char* local_filename, - const char* remote_filename, +void LLXferManager::requestFile(const std::string& local_filename, + const std::string& remote_filename, ELLPath remote_path, const LLHost& remote_host, BOOL delete_remote_on_completion, @@ -444,7 +444,7 @@ void LLXferManager::requestFile(const char* local_filename, // Note: according to AaronB, this is here to deal with locks on files that were // in transit during a crash, if(delete_remote_on_completion && - (strstr(remote_filename,".tmp") == &remote_filename[strlen(remote_filename)-4])) /* Flawfinder : ignore */ + (remote_filename.substr(remote_filename.length()-4) == ".tmp")) { LLFile::remove(local_filename); } @@ -464,7 +464,7 @@ void LLXferManager::requestFile(const char* local_filename, } } -void LLXferManager::requestFile(const char* remote_filename, +void LLXferManager::requestFile(const std::string& remote_filename, ELLPath remote_path, const LLHost& remote_host, BOOL delete_remote_on_completion, @@ -540,7 +540,7 @@ void LLXferManager::requestVFile(const LLUUID& local_id, /* void LLXferManager::requestXfer( - const char *local_filename, + const std::string& local_filename, BOOL delete_remote_on_completion, U64 xfer_id, const LLHost &remote_host, @@ -634,11 +634,11 @@ void LLXferManager::processReceiveData (LLMessageSystem *mesgsys, void ** /*user // confirm it if it was a resend of the last one, since the confirmation might have gotten dropped if (decodePacketNum(packetnum) == (xferp->mPacketNum - 1)) { - llinfos << "Reconfirming xfer " << xferp->mRemoteHost << ":" << xferp->getName() << " packet " << packetnum << llendl; sendConfirmPacket(mesgsys, id, decodePacketNum(packetnum), mesgsys->getSender()); + llinfos << "Reconfirming xfer " << xferp->mRemoteHost << ":" << xferp->getFileName() << " packet " << packetnum << llendl; sendConfirmPacket(mesgsys, id, decodePacketNum(packetnum), mesgsys->getSender()); } else { - llinfos << "Ignoring xfer " << xferp->mRemoteHost << ":" << xferp->getName() << " recv'd packet " << packetnum << "; expecting " << xferp->mPacketNum << llendl; + llinfos << "Ignoring xfer " << xferp->mRemoteHost << ":" << xferp->getFileName() << " recv'd packet " << packetnum << "; expecting " << xferp->mPacketNum << llendl; } return; } @@ -717,7 +717,7 @@ void LLXferManager::processFileRequest (LLMessageSystem *mesgsys, void ** /*user { U64 id; - char local_filename[MAX_STRING]; /* Flawfinder : ignore */ + std::string local_filename; ELLPath local_path = LL_PATH_NONE; S32 result = LL_ERR_NOERR; LLUUID uuid; @@ -732,7 +732,7 @@ void LLXferManager::processFileRequest (LLMessageSystem *mesgsys, void ** /*user llinfos << "xfer request id: " << U64_to_str(id, U64_BUF, sizeof(U64_BUF)) << " to " << mesgsys->getSender() << llendl; - mesgsys->getStringFast(_PREHASH_XferID, _PREHASH_Filename, MAX_STRING, local_filename); + mesgsys->getStringFast(_PREHASH_XferID, _PREHASH_Filename, local_filename); U8 local_path_u8; mesgsys->getU8("XferID", "FilePath", local_path_u8); @@ -780,7 +780,7 @@ void LLXferManager::processFileRequest (LLMessageSystem *mesgsys, void ** /*user llerrs << "Xfer allcoation error" << llendl; } } - else if (strlen(local_filename)) /* Flawfinder : ignore */ + else if (!local_filename.empty()) { std::string expanded_filename = gDirUtilp->getExpandedFilename( local_path, local_filename ); llinfos << "starting file transfer: " << expanded_filename << " to " << mesgsys->getSender() << llendl; @@ -923,7 +923,7 @@ void LLXferManager::retransmitUnackedPackets () { if (xferp->mRetries > LL_PACKET_RETRY_LIMIT) { - llinfos << "dropping xfer " << xferp->mRemoteHost << ":" << xferp->getName() << " packet retransmit limit exceeded, xfer dropped" << llendl; + llinfos << "dropping xfer " << xferp->mRemoteHost << ":" << xferp->getFileName() << " packet retransmit limit exceeded, xfer dropped" << llendl; xferp->abort(LL_ERR_TCP_TIMEOUT); delp = xferp; xferp = xferp->mNext; @@ -931,7 +931,7 @@ void LLXferManager::retransmitUnackedPackets () } else { - llinfos << "resending xfer " << xferp->mRemoteHost << ":" << xferp->getName() << " packet unconfirmed after: "<< et << " sec, packet " << xferp->mPacketNum << llendl; + llinfos << "resending xfer " << xferp->mRemoteHost << ":" << xferp->getFileName() << " packet unconfirmed after: "<< et << " sec, packet " << xferp->mPacketNum << llendl; xferp->resendLastPacket(); xferp = xferp->mNext; } @@ -946,7 +946,7 @@ void LLXferManager::retransmitUnackedPackets () } else if (xferp->mStatus == e_LL_XFER_ABORTED) { - llwarns << "Removing aborted xfer " << xferp->mRemoteHost << ":" << xferp->getName() << llendl; + llwarns << "Removing aborted xfer " << xferp->mRemoteHost << ":" << xferp->getFileName() << llendl; delp = xferp; xferp = xferp->mNext; removeXfer(delp,&mSendList); diff --git a/indra/llmessage/llxfermanager.h b/indra/llmessage/llxfermanager.h index c4af8fe937..dff8181584 100644 --- a/indra/llmessage/llxfermanager.h +++ b/indra/llmessage/llxfermanager.h @@ -143,8 +143,8 @@ class LLXferManager // file requesting routines // .. to file - virtual void requestFile(const char* local_filename, - const char* remote_filename, + virtual void requestFile(const std::string& local_filename, + const std::string& remote_filename, ELLPath remote_path, const LLHost& remote_host, BOOL delete_remote_on_completion, @@ -153,7 +153,7 @@ class LLXferManager BOOL use_big_packets = FALSE); // .. to memory - virtual void requestFile(const char* remote_filename, + virtual void requestFile(const std::string& remote_filename, ELLPath remote_path, const LLHost &remote_host, BOOL delete_remote_on_completion, diff --git a/indra/llmessage/mean_collision_data.h b/indra/llmessage/mean_collision_data.h index 1643c30594..7ee539720f 100644 --- a/indra/llmessage/mean_collision_data.h +++ b/indra/llmessage/mean_collision_data.h @@ -55,15 +55,13 @@ class LLMeanCollisionData public: LLMeanCollisionData(const LLUUID &victim, const LLUUID &perp, time_t time, EMeanCollisionType type, F32 mag) : mVictim(victim), mPerp(perp), mTime(time), mType(type), mMag(mag) - { mFirstName[0] = 0; mLastName[0] = 0; } + { + } LLMeanCollisionData(LLMeanCollisionData *mcd) - : mVictim(mcd->mVictim), mPerp(mcd->mPerp), mTime(mcd->mTime), mType(mcd->mType), mMag(mcd->mMag) - { - strncpy(mFirstName, mcd->mFirstName, sizeof(mFirstName) -1); /* Flawfinder: Ignore */ - mFirstName[sizeof(mFirstName) -1] = '\0'; - strncpy(mLastName, mcd->mLastName, sizeof(mLastName) -1); /* Flawfinder: Ignore */ - mLastName[sizeof(mLastName) -1] = '\0'; + : mVictim(mcd->mVictim), mPerp(mcd->mPerp), mTime(mcd->mTime), mType(mcd->mType), mMag(mcd->mMag), + mFirstName(mcd->mFirstName), mLastName(mcd->mLastName) + { } friend std::ostream& operator<<(std::ostream& s, const LLMeanCollisionData &a) @@ -96,8 +94,8 @@ public: time_t mTime; EMeanCollisionType mType; F32 mMag; - char mFirstName[DB_FIRST_NAME_BUF_SIZE]; /* Flawfinder: Ignore */ - char mLastName[DB_LAST_NAME_BUF_SIZE]; /* Flawfinder: Ignore */ + std::string mFirstName; + std::string mLastName; }; diff --git a/indra/llmessage/message.cpp b/indra/llmessage/message.cpp index c1731532ca..290682f7ce 100644 --- a/indra/llmessage/message.cpp +++ b/indra/llmessage/message.cpp @@ -286,7 +286,7 @@ void LLMessageSystem::init() } // Read file and build message templates -LLMessageSystem::LLMessageSystem(const char *filename, U32 port, +LLMessageSystem::LLMessageSystem(const std::string& filename, U32 port, S32 version_major, S32 version_minor, S32 version_patch, @@ -366,10 +366,9 @@ LLMessageSystem::LLMessageSystem(const char *filename, U32 port, // Read file and build message templates -void LLMessageSystem::loadTemplateFile(const char* filename, - bool failure_is_fatal) +void LLMessageSystem::loadTemplateFile(const std::string& filename, bool failure_is_fatal) { - if(!filename) + if(filename.empty()) { LL_ERRS("Messaging") << "No template filename specified" << llendl; mbError = TRUE; @@ -692,9 +691,9 @@ BOOL LLMessageSystem::checkMessages( S64 frame_count ) { std::ostringstream str; str << "MSG: <- " << host; - char buffer[MAX_STRING]; /* Flawfinder: ignore*/ - snprintf(buffer, MAX_STRING, "\t%6d\t%6d\t%6d ", receive_size, (mIncomingCompressedSize ? mIncomingCompressedSize : receive_size), mCurrentRecvPacketID); /* Flawfinder: ignore */ - str << buffer << "(unknown)" + std::string tbuf; + tbuf = llformat( "\t%6d\t%6d\t%6d ", receive_size, (mIncomingCompressedSize ? mIncomingCompressedSize : receive_size), mCurrentRecvPacketID); + str << tbuf << "(unknown)" << (recv_reliable ? " reliable" : "") << " resent " << ((acks > 0) ? "acks" : "") @@ -822,10 +821,9 @@ BOOL LLMessageSystem::checkMessages( S64 frame_count ) LLMsgBlkData *msg_block_data = mCurrentRMessageData->mMemberBlocks[bnamep]; - char errmsg[1024]; if (!msg_block_data) { - sprintf(errmsg, "Block %s #%d not in message %s", block_name, blocknum, mCurrentRMessageData->mName); + std::string errmsg = llformat("Block %s #%d not in message %s", block_name, blocknum, mCurrentRMessageData->mName); LL_ERRS("Messaging") << errmsg << llendl; } @@ -833,7 +831,7 @@ BOOL LLMessageSystem::checkMessages( S64 frame_count ) if (!vardata.getName()) { - sprintf(errmsg, "Variable %s not in message %s block %s", vnamep, mCurrentRMessageData->mName, bnamep); + std::string errmsg = llformat("Variable %s not in message %s block %s", vnamep, mCurrentRMessageData->mName, bnamep); LL_ERRS("Messaging") << errmsg << llendl; } @@ -1384,8 +1382,8 @@ S32 LLMessageSystem::sendMessage(const LLHost &host) { std::ostringstream str; str << "MSG: -> " << host; - char buffer[MAX_STRING]; /* Flawfinder: ignore */ - snprintf(buffer, MAX_STRING, "\t%6d\t%6d\t%6d ", mSendSize, buffer_length, cdp->getPacketOutID()); /* Flawfinder: ignore */ + std::string buffer; + buffer = llformat( "\t%6d\t%6d\t%6d ", mSendSize, buffer_length, cdp->getPacketOutID()); str << buffer << mMessageBuilder->getMessageName() << (mSendReliable ? " reliable " : ""); @@ -1413,8 +1411,8 @@ void LLMessageSystem::logMsgFromInvalidCircuit( const LLHost& host, BOOL recv_re { std::ostringstream str; str << "MSG: <- " << host; - char buffer[MAX_STRING]; /* Flawfinder: ignore */ - snprintf(buffer, MAX_STRING, "\t%6d\t%6d\t%6d ", mMessageReader->getMessageSize(), (mIncomingCompressedSize ? mIncomingCompressedSize: mMessageReader->getMessageSize()), mCurrentRecvPacketID); /* Flawfinder: ignore */ + std::string buffer; + buffer = llformat( "\t%6d\t%6d\t%6d ", mMessageReader->getMessageSize(), (mIncomingCompressedSize ? mIncomingCompressedSize: mMessageReader->getMessageSize()), mCurrentRecvPacketID); str << buffer << nullToEmpty(mMessageReader->getMessageName()) << (recv_reliable ? " reliable" : "") @@ -1518,8 +1516,8 @@ void LLMessageSystem::logValidMsg(LLCircuitData *cdp, const LLHost& host, BOOL r { std::ostringstream str; str << "MSG: <- " << host; - char buffer[MAX_STRING]; /* Flawfinder: ignore */ - snprintf(buffer, MAX_STRING, "\t%6d\t%6d\t%6d ", mMessageReader->getMessageSize(), (mIncomingCompressedSize ? mIncomingCompressedSize : mMessageReader->getMessageSize()), mCurrentRecvPacketID); /* Flawfinder: ignore */ + std::string buffer; + buffer = llformat( "\t%6d\t%6d\t%6d ", mMessageReader->getMessageSize(), (mIncomingCompressedSize ? mIncomingCompressedSize : mMessageReader->getMessageSize()), mCurrentRecvPacketID); str << buffer << nullToEmpty(mMessageReader->getMessageName()) << (recv_reliable ? " reliable" : "") @@ -2092,20 +2090,18 @@ void LLMessageSystem::processUseCircuitCode(LLMessageSystem* msg, // static void LLMessageSystem::processError(LLMessageSystem* msg, void**) { - char buffer[MTUBYTES]; S32 error_code = 0; msg->getS32("Data", "Code", error_code); std::string error_token; - msg->getString("Data", "Token", MTUBYTES, buffer); - error_token.assign(buffer); + msg->getString("Data", "Token", error_token); + LLUUID error_id; msg->getUUID("Data", "ID", error_id); std::string error_system; - msg->getString("Data", "System", MTUBYTES, buffer); - error_system.assign(buffer); + msg->getString("Data", "System", error_system); + std::string error_message; - msg->getString("Data", "Message", MTUBYTES, buffer); - error_message.assign(buffer); + msg->getString("Data", "Message", error_message); LL_WARNS("Messaging") << "Message error from " << msg->getSender() << " - " << error_code << " " << error_token << " " << error_id << " \"" @@ -2421,7 +2417,8 @@ void process_deny_trusted_circuit(LLMessageSystem *msg, void **) void dump_prehash_files() { U32 i; - LLFILE* fp = LLFile::fopen("../../indra/llmessage/message_prehash.h", "w"); /* Flawfinder: ignore */ + std::string filename("../../indra/llmessage/message_prehash.h"); + LLFILE* fp = LLFile::fopen(filename, "w"); /* Flawfinder: ignore */ if (fp) { fprintf( @@ -2451,7 +2448,8 @@ void dump_prehash_files() fprintf(fp, "\n\n#endif\n"); fclose(fp); } - fp = LLFile::fopen("../../indra/llmessage/message_prehash.cpp", "w"); /* Flawfinder: ignore */ + filename = std::string("../../indra/llmessage/message_prehash.cpp"); + fp = LLFile::fopen(filename, "w"); /* Flawfinder: ignore */ if (fp) { fprintf( @@ -2493,7 +2491,7 @@ bool start_messaging_system( bool failure_is_fatal) { gMessageSystem = new LLMessageSystem( - template_name.c_str(), + template_name, port, version_major, version_minor, @@ -2587,79 +2585,79 @@ void LLMessageSystem::stopLogging() void LLMessageSystem::summarizeLogs(std::ostream& str) { - char buffer[MAX_STRING]; /* Flawfinder: ignore */ - char tmp_str[MAX_STRING]; /* Flawfinder: ignore */ + std::string buffer; + std::string tmp_str; F32 run_time = mMessageSystemTimer.getElapsedTimeF32(); str << "START MESSAGE LOG SUMMARY" << std::endl; - snprintf(buffer, MAX_STRING, "Run time: %12.3f seconds", run_time); /* Flawfinder: ignore */ + buffer = llformat( "Run time: %12.3f seconds", run_time); // Incoming str << buffer << std::endl << "Incoming:" << std::endl; - U64_to_str(mTotalBytesIn, tmp_str, sizeof(tmp_str)); - snprintf(buffer, MAX_STRING, "Total bytes received: %20s (%5.2f kbits per second)", tmp_str, ((F32)mTotalBytesIn * 0.008f) / run_time); /* Flawfinder: ignore */ + tmp_str = U64_to_str(mTotalBytesIn); + buffer = llformat( "Total bytes received: %20s (%5.2f kbits per second)", tmp_str.c_str(), ((F32)mTotalBytesIn * 0.008f) / run_time); str << buffer << std::endl; - U64_to_str(mPacketsIn, tmp_str, sizeof(tmp_str)); - snprintf(buffer, MAX_STRING, "Total packets received: %20s (%5.2f packets per second)", tmp_str, ((F32) mPacketsIn / run_time)); /* Flawfinder: ignore */ + tmp_str = U64_to_str(mPacketsIn); + buffer = llformat( "Total packets received: %20s (%5.2f packets per second)", tmp_str.c_str(), ((F32) mPacketsIn / run_time)); str << buffer << std::endl; - snprintf(buffer, MAX_STRING, "Average packet size: %20.0f bytes", (F32)mTotalBytesIn / (F32)mPacketsIn); /* Flawfinder: ignore */ + buffer = llformat( "Average packet size: %20.0f bytes", (F32)mTotalBytesIn / (F32)mPacketsIn); str << buffer << std::endl; - U64_to_str(mReliablePacketsIn, tmp_str, sizeof(tmp_str)); - snprintf(buffer, MAX_STRING, "Total reliable packets: %20s (%5.2f%%)", tmp_str, 100.f * ((F32) mReliablePacketsIn)/((F32) mPacketsIn + 1)); /* Flawfinder: ignore */ + tmp_str = U64_to_str(mReliablePacketsIn); + buffer = llformat( "Total reliable packets: %20s (%5.2f%%)", tmp_str.c_str(), 100.f * ((F32) mReliablePacketsIn)/((F32) mPacketsIn + 1)); str << buffer << std::endl; - U64_to_str(mCompressedPacketsIn, tmp_str, sizeof(tmp_str)); - snprintf(buffer, MAX_STRING, "Total compressed packets: %20s (%5.2f%%)", tmp_str, 100.f * ((F32) mCompressedPacketsIn)/((F32) mPacketsIn + 1)); /* Flawfinder: ignore */ + tmp_str = U64_to_str(mCompressedPacketsIn); + buffer = llformat( "Total compressed packets: %20s (%5.2f%%)", tmp_str.c_str(), 100.f * ((F32) mCompressedPacketsIn)/((F32) mPacketsIn + 1)); str << buffer << std::endl; S64 savings = mUncompressedBytesIn - mCompressedBytesIn; - U64_to_str(savings, tmp_str, sizeof(tmp_str)); - snprintf(buffer, MAX_STRING, "Total compression savings: %20s bytes", tmp_str); /* Flawfinder: ignore */ + tmp_str = U64_to_str(savings); + buffer = llformat( "Total compression savings: %20s bytes", tmp_str.c_str()); str << buffer << std::endl; - U64_to_str(savings/(mCompressedPacketsIn +1), tmp_str, sizeof(tmp_str)); - snprintf(buffer, MAX_STRING, "Avg comp packet savings: %20s (%5.2f : 1)", tmp_str, ((F32) mUncompressedBytesIn)/((F32) mCompressedBytesIn+1)); /* Flawfinder: ignore */ + tmp_str = U64_to_str(savings/(mCompressedPacketsIn +1)); + buffer = llformat( "Avg comp packet savings: %20s (%5.2f : 1)", tmp_str.c_str(), ((F32) mUncompressedBytesIn)/((F32) mCompressedBytesIn+1)); str << buffer << std::endl; - U64_to_str(savings/(mPacketsIn+1), tmp_str, sizeof(tmp_str)); - snprintf(buffer, MAX_STRING, "Avg overall comp savings: %20s (%5.2f : 1)", tmp_str, ((F32) mTotalBytesIn + (F32) savings)/((F32) mTotalBytesIn + 1.f)); /* Flawfinder: ignore */ + tmp_str = U64_to_str(savings/(mPacketsIn+1)); + buffer = llformat( "Avg overall comp savings: %20s (%5.2f : 1)", tmp_str.c_str(), ((F32) mTotalBytesIn + (F32) savings)/((F32) mTotalBytesIn + 1.f)); // Outgoing str << buffer << std::endl << std::endl << "Outgoing:" << std::endl; - U64_to_str(mTotalBytesOut, tmp_str, sizeof(tmp_str)); - snprintf(buffer, MAX_STRING, "Total bytes sent: %20s (%5.2f kbits per second)", tmp_str, ((F32)mTotalBytesOut * 0.008f) / run_time ); /* Flawfinder: ignore */ + tmp_str = U64_to_str(mTotalBytesOut); + buffer = llformat( "Total bytes sent: %20s (%5.2f kbits per second)", tmp_str.c_str(), ((F32)mTotalBytesOut * 0.008f) / run_time ); str << buffer << std::endl; - U64_to_str(mPacketsOut, tmp_str, sizeof(tmp_str)); - snprintf(buffer, MAX_STRING, "Total packets sent: %20s (%5.2f packets per second)", tmp_str, ((F32)mPacketsOut / run_time)); /* Flawfinder: ignore */ + tmp_str = U64_to_str(mPacketsOut); + buffer = llformat( "Total packets sent: %20s (%5.2f packets per second)", tmp_str.c_str(), ((F32)mPacketsOut / run_time)); str << buffer << std::endl; - snprintf(buffer, MAX_STRING, "Average packet size: %20.0f bytes", (F32)mTotalBytesOut / (F32)mPacketsOut); /* Flawfinder: ignore */ + buffer = llformat( "Average packet size: %20.0f bytes", (F32)mTotalBytesOut / (F32)mPacketsOut); str << buffer << std::endl; - U64_to_str(mReliablePacketsOut, tmp_str, sizeof(tmp_str)); - snprintf(buffer, MAX_STRING, "Total reliable packets: %20s (%5.2f%%)", tmp_str, 100.f * ((F32) mReliablePacketsOut)/((F32) mPacketsOut + 1)); /* Flawfinder: ignore */ + tmp_str = U64_to_str(mReliablePacketsOut); + buffer = llformat( "Total reliable packets: %20s (%5.2f%%)", tmp_str.c_str(), 100.f * ((F32) mReliablePacketsOut)/((F32) mPacketsOut + 1)); str << buffer << std::endl; - U64_to_str(mCompressedPacketsOut, tmp_str, sizeof(tmp_str)); - snprintf(buffer, MAX_STRING, "Total compressed packets: %20s (%5.2f%%)", tmp_str, 100.f * ((F32) mCompressedPacketsOut)/((F32) mPacketsOut + 1)); /* Flawfinder: ignore */ + tmp_str = U64_to_str(mCompressedPacketsOut); + buffer = llformat( "Total compressed packets: %20s (%5.2f%%)", tmp_str.c_str(), 100.f * ((F32) mCompressedPacketsOut)/((F32) mPacketsOut + 1)); str << buffer << std::endl; savings = mUncompressedBytesOut - mCompressedBytesOut; - U64_to_str(savings, tmp_str, sizeof(tmp_str)); - snprintf(buffer, MAX_STRING, "Total compression savings: %20s bytes", tmp_str); /* Flawfinder: ignore */ + tmp_str = U64_to_str(savings); + buffer = llformat( "Total compression savings: %20s bytes", tmp_str.c_str()); str << buffer << std::endl; - U64_to_str(savings/(mCompressedPacketsOut +1), tmp_str, sizeof(tmp_str)); - snprintf(buffer, MAX_STRING, "Avg comp packet savings: %20s (%5.2f : 1)", tmp_str, ((F32) mUncompressedBytesOut)/((F32) mCompressedBytesOut+1)); /* Flawfinder: ignore */ + tmp_str = U64_to_str(savings/(mCompressedPacketsOut +1)); + buffer = llformat( "Avg comp packet savings: %20s (%5.2f : 1)", tmp_str.c_str(), ((F32) mUncompressedBytesOut)/((F32) mCompressedBytesOut+1)); str << buffer << std::endl; - U64_to_str(savings/(mPacketsOut+1), tmp_str, sizeof(tmp_str)); - snprintf(buffer, MAX_STRING, "Avg overall comp savings: %20s (%5.2f : 1)", tmp_str, ((F32) mTotalBytesOut + (F32) savings)/((F32) mTotalBytesOut + 1.f)); /* Flawfinder: ignore */ + tmp_str = U64_to_str(savings/(mPacketsOut+1)); + buffer = llformat( "Avg overall comp savings: %20s (%5.2f : 1)", tmp_str.c_str(), ((F32) mTotalBytesOut + (F32) savings)/((F32) mTotalBytesOut + 1.f)); str << buffer << std::endl << std::endl; - snprintf(buffer, MAX_STRING, "SendPacket failures: %20d", mSendPacketFailureCount); /* Flawfinder: ignore */ + buffer = llformat( "SendPacket failures: %20d", mSendPacketFailureCount); str << buffer << std::endl; - snprintf(buffer, MAX_STRING, "Dropped packets: %20d", mDroppedPackets); /* Flawfinder: ignore */ + buffer = llformat( "Dropped packets: %20d", mDroppedPackets); str << buffer << std::endl; - snprintf(buffer, MAX_STRING, "Resent packets: %20d", mResentPackets); /* Flawfinder: ignore */ + buffer = llformat( "Resent packets: %20d", mResentPackets); str << buffer << std::endl; - snprintf(buffer, MAX_STRING, "Failed reliable resends: %20d", mFailedResendPackets); /* Flawfinder: ignore */ + buffer = llformat( "Failed reliable resends: %20d", mFailedResendPackets); str << buffer << std::endl; - snprintf(buffer, MAX_STRING, "Off-circuit rejected packets: %17d", mOffCircuitPackets); /* Flawfinder: ignore */ + buffer = llformat( "Off-circuit rejected packets: %17d", mOffCircuitPackets); str << buffer << std::endl; - snprintf(buffer, MAX_STRING, "On-circuit invalid packets: %17d", mInvalidOnCircuitPackets); /* Flawfinder: ignore */ + buffer = llformat( "On-circuit invalid packets: %17d", mInvalidOnCircuitPackets); str << buffer << std::endl << std::endl; str << "Decoding: " << std::endl; - snprintf(buffer, MAX_STRING, "%35s%10s%10s%10s%10s", "Message", "Count", "Time", "Max", "Avg"); /* Flawfinder: ignore */ + buffer = llformat( "%35s%10s%10s%10s%10s", "Message", "Count", "Time", "Max", "Avg"); str << buffer << std:: endl; F32 avg; for (message_template_name_map_t::const_iterator iter = mMessageTemplates.begin(), @@ -2670,7 +2668,7 @@ void LLMessageSystem::summarizeLogs(std::ostream& str) if(mt->mTotalDecoded > 0) { avg = mt->mTotalDecodeTime / (F32)mt->mTotalDecoded; - snprintf(buffer, MAX_STRING, "%35s%10u%10f%10f%10f", mt->mName, mt->mTotalDecoded, mt->mTotalDecodeTime, mt->mMaxDecodeTimePerMsg, avg); /* Flawfinder: ignore */ + buffer = llformat( "%35s%10u%10f%10f%10f", mt->mName, mt->mTotalDecoded, mt->mTotalDecodeTime, mt->mMaxDecodeTimePerMsg, avg); str << buffer << std::endl; } } @@ -3936,6 +3934,20 @@ void LLMessageSystem::getString(const char *block, const char *var, blocknum); } +void LLMessageSystem::getStringFast(const char *block, const char *var, + std::string& outstr, S32 blocknum) +{ + mMessageReader->getString(block, var, outstr, blocknum); +} + +void LLMessageSystem::getString(const char *block, const char *var, + std::string& outstr, S32 blocknum ) +{ + getStringFast(LLMessageStringTable::getInstance()->getString(block), + LLMessageStringTable::getInstance()->getString(var), outstr, + blocknum); +} + S32 LLMessageSystem::getNumberOfBlocksFast(const char *blockname) { return mMessageReader->getNumberOfBlocks(blockname); diff --git a/indra/llmessage/message.h b/indra/llmessage/message.h index 7462e1b1df..e2d2ed46e2 100644 --- a/indra/llmessage/message.h +++ b/indra/llmessage/message.h @@ -283,7 +283,7 @@ public: public: // Read file and build message templates - LLMessageSystem(const char *filename, U32 port, S32 version_major, + LLMessageSystem(const std::string& filename, U32 port, S32 version_major, S32 version_minor, S32 version_patch, bool failure_is_fatal = true); @@ -295,7 +295,7 @@ public: // Read file and build message templates filename must point to a // valid string which specifies the path of a valid linden // template. - void loadTemplateFile(const char* filename, bool failure_is_fatal); + void loadTemplateFile(const std::string& filename, bool failure_is_fatal); // methods for building, sending, receiving, and handling messages @@ -516,6 +516,8 @@ public: void getIPPort( const char *block, const char *var, U16 &port, S32 blocknum = 0); void getStringFast( const char *block, const char *var, S32 buffer_size, char *buffer, S32 blocknum = 0); void getString( const char *block, const char *var, S32 buffer_size, char *buffer, S32 blocknum = 0); + void getStringFast( const char *block, const char *var, std::string& outstr, S32 blocknum = 0); + void getString( const char *block, const char *var, std::string& outstr, S32 blocknum = 0); // Utility functions to generate a replay-resistant digest check diff --git a/indra/llprimitive/llmaterialtable.cpp b/indra/llprimitive/llmaterialtable.cpp index 61c9849144..b3addc720f 100644 --- a/indra/llprimitive/llmaterialtable.cpp +++ b/indra/llprimitive/llmaterialtable.cpp @@ -125,14 +125,15 @@ LLMaterialTable::~LLMaterialTable() void LLMaterialTable::initBasicTable() { - add(LL_MCODE_STONE,"Stone", LL_DEFAULT_STONE_UUID); - add(LL_MCODE_METAL,"Metal", LL_DEFAULT_METAL_UUID); - add(LL_MCODE_GLASS,"Glass", LL_DEFAULT_GLASS_UUID); - add(LL_MCODE_WOOD,"Wood", LL_DEFAULT_WOOD_UUID); - add(LL_MCODE_FLESH,"Flesh", LL_DEFAULT_FLESH_UUID); - add(LL_MCODE_PLASTIC,"Plastic", LL_DEFAULT_PLASTIC_UUID); - add(LL_MCODE_RUBBER,"Rubber", LL_DEFAULT_RUBBER_UUID); - add(LL_MCODE_LIGHT,"Light", LL_DEFAULT_LIGHT_UUID); + // *TODO: Translate + add(LL_MCODE_STONE,std::string("Stone"), LL_DEFAULT_STONE_UUID); + add(LL_MCODE_METAL,std::string("Metal"), LL_DEFAULT_METAL_UUID); + add(LL_MCODE_GLASS,std::string("Glass"), LL_DEFAULT_GLASS_UUID); + add(LL_MCODE_WOOD,std::string("Wood"), LL_DEFAULT_WOOD_UUID); + add(LL_MCODE_FLESH,std::string("Flesh"), LL_DEFAULT_FLESH_UUID); + add(LL_MCODE_PLASTIC,std::string("Plastic"), LL_DEFAULT_PLASTIC_UUID); + add(LL_MCODE_RUBBER,std::string("Rubber"), LL_DEFAULT_RUBBER_UUID); + add(LL_MCODE_LIGHT,std::string("Light"), LL_DEFAULT_LIGHT_UUID); // specify densities for these materials. . . // these were taken from http://www.mcelwee.net/html/densities_of_various_materials.html @@ -331,7 +332,7 @@ void LLMaterialTable::initBasicTable() } } -BOOL LLMaterialTable::add(U8 mcode, const char* name, const LLUUID &uuid) +BOOL LLMaterialTable::add(U8 mcode, const std::string& name, const LLUUID &uuid) { LLMaterialInfo *infop; @@ -466,13 +467,13 @@ BOOL LLMaterialTable::addDamageAndEnergy(U8 mcode, const F32 &hp_mod, const F32 return FALSE; } -LLUUID LLMaterialTable::getDefaultTextureID(char* name) +LLUUID LLMaterialTable::getDefaultTextureID(const std::string& name) { for (info_list_t::iterator iter = mMaterialInfoList.begin(); iter != mMaterialInfoList.end(); ++iter) { LLMaterialInfo *infop = *iter; - if (!strcmp(name, infop->mName)) + if (name == infop->mName) { return infop->mDefaultTextureID; } @@ -499,13 +500,13 @@ LLUUID LLMaterialTable::getDefaultTextureID(U8 mcode) } -U8 LLMaterialTable::getMCode(const char* name) +U8 LLMaterialTable::getMCode(const std::string& name) { for (info_list_t::iterator iter = mMaterialInfoList.begin(); iter != mMaterialInfoList.end(); ++iter) { LLMaterialInfo *infop = *iter; - if (!strcmp(name, infop->mName)) + if (name == infop->mName) { return infop->mMCode; } @@ -515,7 +516,7 @@ U8 LLMaterialTable::getMCode(const char* name) } -char* LLMaterialTable::getName(U8 mcode) +std::string LLMaterialTable::getName(U8 mcode) { mcode &= LL_MCODE_MASK; for (info_list_t::iterator iter = mMaterialInfoList.begin(); diff --git a/indra/llprimitive/llmaterialtable.h b/indra/llprimitive/llmaterialtable.h index 7dbe7de917..225d1976c0 100644 --- a/indra/llprimitive/llmaterialtable.h +++ b/indra/llprimitive/llmaterialtable.h @@ -67,7 +67,7 @@ class LLMaterialInfo { public: U8 mMCode; - char mName[LLMATERIAL_INFO_NAME_LENGTH]; /* Flawfinder: ignore */ + std::string mName; LLUUID mDefaultTextureID; LLUUID mShatterSoundID; F32 mDensity; // kg/m^3 @@ -79,24 +79,20 @@ public: F32 mDamageModifier; // modifier on KE based damage F32 mEPModifier; // modifier on mass based EP total - LLMaterialInfo(U8 mcode, const char* name, const LLUUID &uuid) + LLMaterialInfo(U8 mcode, const std::string& name, const LLUUID &uuid) { init(mcode,name,uuid); }; - void init(U8 mcode, const char* name, const LLUUID &uuid) + void init(U8 mcode, const std::string& name, const LLUUID &uuid) { - mName[0] = 0; mDensity = 1000.f; // default to 1000.0 (water) mHPModifier = 1.f; mDamageModifier = 1.f; mEPModifier = 1.f; mMCode = mcode; - if (name) - { - LLString::copy(mName,name,LLMATERIAL_INFO_NAME_LENGTH); - } + mName = name; mDefaultTextureID = uuid; }; @@ -150,7 +146,7 @@ public: void initBasicTable(); - BOOL add(U8 mcode, const char* name, const LLUUID &uuid); + BOOL add(U8 mcode, const std::string& name, const LLUUID &uuid); BOOL addCollisionSound(U8 mcode, U8 mcode2, const LLUUID &uuid); BOOL addSlidingSound(U8 mcode, U8 mcode2, const LLUUID &uuid); BOOL addRollingSound(U8 mcode, U8 mcode2, const LLUUID &uuid); @@ -160,10 +156,10 @@ public: BOOL addRestitution(U8 mcode, const F32 &restitution); BOOL addDamageAndEnergy(U8 mcode, const F32 &hp_mod, const F32 &damage_mod, const F32 &ep_mod); - LLUUID getDefaultTextureID(char* name); // LLUUID::null if not found + LLUUID getDefaultTextureID(const std::string& name); // LLUUID::null if not found LLUUID getDefaultTextureID(U8 mcode); // LLUUID::null if not found - U8 getMCode(const char* name); // 0 if not found - char* getName(U8 mcode); + U8 getMCode(const std::string& name); // 0 if not found + std::string getName(U8 mcode); F32 getDensity(U8 mcode); // kg/m^3, 0 if not found F32 getFriction(U8 mcode); // physics values diff --git a/indra/llprimitive/llprimitive.cpp b/indra/llprimitive/llprimitive.cpp index ff69cacf0f..90292d8f78 100644 --- a/indra/llprimitive/llprimitive.cpp +++ b/indra/llprimitive/llprimitive.cpp @@ -760,15 +760,14 @@ U8 LLPrimitive::pCodeToLegacy(const LLPCode pcode) // static // Don't crash or llerrs here! This function is used for debug strings. -const char * LLPrimitive::pCodeToString(const LLPCode pcode) +std::string LLPrimitive::pCodeToString(const LLPCode pcode) { - static char pcode_string[255]; /* Flawfinder: ignore */ + std::string pcode_string; U8 base_code = pcode & LL_PCODE_BASE_MASK; - pcode_string[0] = 0; if (!pcode) { - snprintf(pcode_string, sizeof(pcode_string), "null"); /* Flawfinder: ignore */ + pcode_string = "null"; } else if ((base_code) == LL_PCODE_LEGACY) { @@ -776,66 +775,66 @@ const char * LLPrimitive::pCodeToString(const LLPCode pcode) switch (pcode) { case LL_PCODE_LEGACY_GRASS: - snprintf(pcode_string, sizeof(pcode_string), "grass"); /* Flawfinder: ignore */ + pcode_string = "grass"; break; case LL_PCODE_LEGACY_PART_SYS: - snprintf(pcode_string, sizeof(pcode_string), "particle system"); /* Flawfinder: ignore */ + pcode_string = "particle system"; break; case LL_PCODE_LEGACY_AVATAR: - snprintf(pcode_string, sizeof(pcode_string), "avatar"); /* Flawfinder: ignore */ + pcode_string = "avatar"; break; case LL_PCODE_LEGACY_TEXT_BUBBLE: - snprintf(pcode_string, sizeof(pcode_string), "text bubble"); /* Flawfinder: ignore */ + pcode_string = "text bubble"; break; case LL_PCODE_LEGACY_TREE: - snprintf(pcode_string, sizeof(pcode_string), "tree"); /* Flawfinder: ignore */ + pcode_string = "tree"; break; case LL_PCODE_TREE_NEW: - snprintf(pcode_string, sizeof(pcode_string), "tree_new"); /* Flawfinder: ignore */ + pcode_string = "tree_new"; break; default: - snprintf(pcode_string, sizeof(pcode_string), "unknown legacy pcode %i",(U32)pcode); /* Flawfinder: ignore */ + pcode_string = llformat( "unknown legacy pcode %i",(U32)pcode); } } else { - char shape[32]; /* Flawfinder: ignore */ - char mask[32]; /* Flawfinder: ignore */ + std::string shape; + std::string mask; if (base_code == LL_PCODE_CUBE) { - snprintf(shape, sizeof(shape), "cube"); /* Flawfinder: ignore */ + shape = "cube"; } else if (base_code == LL_PCODE_CYLINDER) { - snprintf(shape, sizeof(shape), "cylinder"); /* Flawfinder: ignore */ + shape = "cylinder"; } else if (base_code == LL_PCODE_CONE) { - snprintf(shape, sizeof(shape), "cone"); /* Flawfinder: ignore */ + shape = "cone"; } else if (base_code == LL_PCODE_PRISM) { - snprintf(shape, sizeof(shape), "prism"); /* Flawfinder: ignore */ + shape = "prism"; } else if (base_code == LL_PCODE_PYRAMID) { - snprintf(shape, sizeof(shape), "pyramid"); /* Flawfinder: ignore */ + shape = "pyramid"; } else if (base_code == LL_PCODE_SPHERE) { - snprintf(shape, sizeof(shape), "sphere"); /* Flawfinder: ignore */ + shape = "sphere"; } else if (base_code == LL_PCODE_TETRAHEDRON) { - snprintf(shape, sizeof(shape), "tetrahedron"); /* Flawfinder: ignore */ + shape = "tetrahedron"; } else if (base_code == LL_PCODE_VOLUME) { - snprintf(shape, sizeof(shape), "volume"); /* Flawfinder: ignore */ + shape = "volume"; } else if (base_code == LL_PCODE_APP) { - snprintf(shape, sizeof(shape), "app"); /* Flawfinder: ignore */ + shape = "app"; } else { @@ -845,35 +844,27 @@ const char * LLPrimitive::pCodeToString(const LLPCode pcode) U8 mask_code = pcode & (~LL_PCODE_BASE_MASK); if (base_code == LL_PCODE_APP) { - snprintf(mask, sizeof(mask), "%x", mask_code); /* Flawfinder: ignore */ + mask = llformat( "%x", mask_code); } else if (mask_code & LL_PCODE_HEMI_MASK) { - snprintf(mask, sizeof(mask), "hemi"); /* Flawfinder: ignore */ + mask = "hemi"; } else { - snprintf(mask, sizeof(mask), "%x", mask_code); /* Flawfinder: ignore */ + mask = llformat( "%x", mask_code); } - // extra sanity against snprintf() being naturally crap - mask[sizeof(mask)-1] = '\0'; - shape[sizeof(shape)-1] = '\0'; - if (mask[0]) { - snprintf(pcode_string, sizeof(pcode_string), "%s-%s", shape, mask); /* Flawfinder: ignore */ + pcode_string = llformat( "%s-%s", shape.c_str(), mask.c_str()); } else { - snprintf(pcode_string, sizeof(pcode_string), "%s", shape); /* Flawfinder: ignore */ + pcode_string = llformat( "%s", shape.c_str()); } } - // Be really sure that pcode_string is nul-terminated after we've - // been using crappy snprintf() to build it. - pcode_string[sizeof(pcode_string)-1] = '\0'; - return pcode_string; } @@ -993,7 +984,7 @@ BOOL LLPrimitive::setVolume(const LLVolumeParams &volume_params, const S32 detai S32 i; /* - LLString old_mask_string; + std::string old_mask_string; for (i = 0; i < 9; i++) { if (old_face_mask & (1 << i)) @@ -1005,7 +996,7 @@ BOOL LLPrimitive::setVolume(const LLVolumeParams &volume_params, const S32 detai old_mask_string.append("0"); } } - LLString new_mask_string; + std::string new_mask_string; for (i = 0; i < 9; i++) { if (new_face_mask & (1 << i)) diff --git a/indra/llprimitive/llprimitive.h b/indra/llprimitive/llprimitive.h index 2b738f8d29..e243ea623f 100644 --- a/indra/llprimitive/llprimitive.h +++ b/indra/llprimitive/llprimitive.h @@ -378,7 +378,7 @@ public: #endif LLPCode getPCode() const { return mPrimitiveCode; } - const char * getPCodeString() const { return pCodeToString(mPrimitiveCode); } + std::string getPCodeString() const { return pCodeToString(mPrimitiveCode); } const LLVector3& getAngularVelocity() const { return mAngularVelocity; } const LLVector3& getVelocity() const { return mVelocity; } const LLVector3& getAcceleration() const { return mAcceleration; } @@ -400,7 +400,7 @@ public: void removeFlags(U32 flags) { mMiscFlags &= ~flags; } U32 getFlags() const { return mMiscFlags; } - static const char *pCodeToString(const LLPCode pcode); + static std::string pCodeToString(const LLPCode pcode); static LLPCode legacyToPCode(const U8 legacy); static U8 pCodeToLegacy(const LLPCode pcode); static bool getTESTAxes(const U8 face, U32* s_axis, U32* t_axis); diff --git a/indra/llrender/llfontgl.cpp b/indra/llrender/llfontgl.cpp index 1e0d9767ca..02e1663513 100644 --- a/indra/llrender/llfontgl.cpp +++ b/indra/llrender/llfontgl.cpp @@ -48,7 +48,7 @@ F32 LLFontGL::sHorizDPI = 96.f; F32 LLFontGL::sScaleX = 1.f; F32 LLFontGL::sScaleY = 1.f; BOOL LLFontGL::sDisplayFont = TRUE ; -LLString LLFontGL::sAppDir; +std::string LLFontGL::sAppDir; LLFontGL* LLFontGL::sMonospace = NULL; LLFontGL* LLFontGL::sSansSerifSmall = NULL; @@ -93,7 +93,7 @@ F32 llfont_round_y(F32 y) } // static -U8 LLFontGL::getStyleFromString(const LLString &style) +U8 LLFontGL::getStyleFromString(const std::string &style) { S32 ret = 0; if (style.find("NORMAL") != style.npos) @@ -166,9 +166,9 @@ void LLFontGL::reset() } // static -LLString LLFontGL::getFontPathSystem() +std::string LLFontGL::getFontPathSystem() { - LLString system_path; + std::string system_path; // Try to figure out where the system's font files are stored. char *system_root = NULL; @@ -199,9 +199,9 @@ LLString LLFontGL::getFontPathSystem() // static -LLString LLFontGL::getFontPathLocal() +std::string LLFontGL::getFontPathLocal() { - LLString local_path; + std::string local_path; // Backup files if we can't load from system fonts directory. // We could store this in an end-user writable directory to allow @@ -220,10 +220,10 @@ LLString LLFontGL::getFontPathLocal() } //static -bool LLFontGL::loadFaceFallback(LLFontList *fontlistp, const LLString& fontname, const F32 point_size) +bool LLFontGL::loadFaceFallback(LLFontList *fontlistp, const std::string& fontname, const F32 point_size) { - LLString local_path = getFontPathLocal(); - LLString sys_path = getFontPathSystem(); + std::string local_path = getFontPathLocal(); + std::string sys_path = getFontPathSystem(); // The fontname string may contain multiple font file names separated by semicolons. // Break it apart and try loading each one, in order. @@ -235,7 +235,7 @@ bool LLFontGL::loadFaceFallback(LLFontList *fontlistp, const LLString& fontname, for(token_iter = tokens.begin(); token_iter != tokens.end(); ++token_iter) { LLFont *fontp = new LLFont(); - LLString font_path = local_path + *token_iter; + std::string font_path = local_path + *token_iter; if (!fontp->loadFace(font_path, point_size, sVertDPI, sHorizDPI, 2, TRUE)) { font_path = sys_path + *token_iter; @@ -258,13 +258,13 @@ bool LLFontGL::loadFaceFallback(LLFontList *fontlistp, const LLString& fontname, } //static -bool LLFontGL::loadFace(LLFontGL *fontp, const LLString& fontname, const F32 point_size, LLFontList *fallback_fontp) +bool LLFontGL::loadFace(LLFontGL *fontp, const std::string& fontname, const F32 point_size, LLFontList *fallback_fontp) { - LLString local_path = getFontPathLocal(); - LLString font_path = local_path + fontname; + std::string local_path = getFontPathLocal(); + std::string font_path = local_path + fontname; if (!fontp->loadFace(font_path, point_size, sVertDPI, sHorizDPI, 2, FALSE)) { - LLString sys_path = getFontPathSystem(); + std::string sys_path = getFontPathSystem(); font_path = sys_path + fontname; if (!fontp->loadFace(font_path, point_size, sVertDPI, sHorizDPI, 2, FALSE)) { @@ -280,12 +280,12 @@ bool LLFontGL::loadFace(LLFontGL *fontp, const LLString& fontname, const F32 poi // static BOOL LLFontGL::initDefaultFonts(F32 screen_dpi, F32 x_scale, F32 y_scale, - const LLString& monospace_file, F32 monospace_size, - const LLString& sansserif_file, - const LLString& sanserif_fallback_file, F32 ss_fallback_scale, + const std::string& monospace_file, F32 monospace_size, + const std::string& sansserif_file, + const std::string& sanserif_fallback_file, F32 ss_fallback_scale, F32 small_size, F32 medium_size, F32 big_size, F32 huge_size, - const LLString& sansserif_bold_file, F32 bold_size, - const LLString& app_dir) + const std::string& sansserif_bold_file, F32 bold_size, + const std::string& app_dir) { BOOL failed = FALSE; sVertDPI = (F32)llfloor(screen_dpi * y_scale); @@ -554,7 +554,7 @@ BOOL LLFontGL::addChar(const llwchar wch) } -S32 LLFontGL::renderUTF8(const LLString &text, const S32 offset, +S32 LLFontGL::renderUTF8(const std::string &text, const S32 offset, const F32 x, const F32 y, const LLColor4 &color, const HAlign halign, const VAlign valign, @@ -726,7 +726,7 @@ S32 LLFontGL::render(const LLWString &wstr, if (getWidthF32(wstr.c_str(), 0, max_chars) * sScaleX > scaled_max_pixels) { // use four dots for ellipsis width to generate padding - const LLWString dots(utf8str_to_wstring(LLString("...."))); + const LLWString dots(utf8str_to_wstring(std::string("...."))); scaled_max_pixels = llmax(0, scaled_max_pixels - llround(getWidthF32(dots.c_str()))); draw_ellipses = TRUE; } @@ -879,7 +879,7 @@ S32 LLFontGL::render(const LLWString &wstr, //glLoadIdentity(); //gGL.translatef(sCurOrigin.mX, sCurOrigin.mY, 0.0f); //glScalef(sScaleX, sScaleY, 1.f); - renderUTF8("...", + renderUTF8(std::string("..."), 0, cur_x / sScaleX, (F32)y, color, @@ -902,7 +902,7 @@ LLImageGL *LLFontGL::getImageGL() const return mImageGLp; } -S32 LLFontGL::getWidth(const LLString& utf8text) const +S32 LLFontGL::getWidth(const std::string& utf8text) const { LLWString wtext = utf8str_to_wstring(utf8text); return getWidth(wtext.c_str(), 0, S32_MAX); @@ -913,7 +913,7 @@ S32 LLFontGL::getWidth(const llwchar* wchars) const return getWidth(wchars, 0, S32_MAX); } -S32 LLFontGL::getWidth(const LLString& utf8text, const S32 begin_offset, const S32 max_chars) const +S32 LLFontGL::getWidth(const std::string& utf8text, const S32 begin_offset, const S32 max_chars) const { LLWString wtext = utf8str_to_wstring(utf8text); return getWidth(wtext.c_str(), begin_offset, max_chars); @@ -925,7 +925,7 @@ S32 LLFontGL::getWidth(const llwchar* wchars, const S32 begin_offset, const S32 return llround(width); } -F32 LLFontGL::getWidthF32(const LLString& utf8text) const +F32 LLFontGL::getWidthF32(const std::string& utf8text) const { LLWString wtext = utf8str_to_wstring(utf8text); return getWidthF32(wtext.c_str(), 0, S32_MAX); @@ -936,7 +936,7 @@ F32 LLFontGL::getWidthF32(const llwchar* wchars) const return getWidthF32(wchars, 0, S32_MAX); } -F32 LLFontGL::getWidthF32(const LLString& utf8text, const S32 begin_offset, const S32 max_chars ) const +F32 LLFontGL::getWidthF32(const std::string& utf8text, const S32 begin_offset, const S32 max_chars ) const { LLWString wtext = utf8str_to_wstring(utf8text); return getWidthF32(wtext.c_str(), begin_offset, max_chars); @@ -1312,7 +1312,7 @@ void LLFontGL::clearEmbeddedChars() mEmbeddedChars.clear(); } -void LLFontGL::addEmbeddedChar( llwchar wc, LLImageGL* image, const LLString& label ) +void LLFontGL::addEmbeddedChar( llwchar wc, LLImageGL* image, const std::string& label ) { LLWString wlabel = utf8str_to_wstring(label); addEmbeddedChar(wc, image, wlabel); @@ -1429,40 +1429,40 @@ void LLFontGL::drawGlyph(const LLRectf& screen_rect, const LLRectf& uv_rect, con } // static -LLString LLFontGL::nameFromFont(const LLFontGL* fontp) +std::string LLFontGL::nameFromFont(const LLFontGL* fontp) { if (fontp == sSansSerifHuge) { - return LLString("SansSerifHuge"); + return std::string("SansSerifHuge"); } else if (fontp == sSansSerifSmall) { - return LLString("SansSerifSmall"); + return std::string("SansSerifSmall"); } else if (fontp == sSansSerif) { - return LLString("SansSerif"); + return std::string("SansSerif"); } else if (fontp == sSansSerifBig) { - return LLString("SansSerifBig"); + return std::string("SansSerifBig"); } else if (fontp == sSansSerifBold) { - return LLString("SansSerifBold"); + return std::string("SansSerifBold"); } else if (fontp == sMonospace) { - return LLString("Monospace"); + return std::string("Monospace"); } else { - return LLString(); + return std::string(); } } // static -LLFontGL* LLFontGL::fontFromName(const LLString& font_name) +LLFontGL* LLFontGL::fontFromName(const std::string& font_name) { LLFontGL* gl_font = NULL; if (font_name == "SansSerifHuge") @@ -1493,16 +1493,16 @@ LLFontGL* LLFontGL::fontFromName(const LLString& font_name) } // static -LLString LLFontGL::nameFromHAlign(LLFontGL::HAlign align) +std::string LLFontGL::nameFromHAlign(LLFontGL::HAlign align) { - if (align == LEFT) return LLString("left"); - else if (align == RIGHT) return LLString("right"); - else if (align == HCENTER) return LLString("center"); - else return LLString(); + if (align == LEFT) return std::string("left"); + else if (align == RIGHT) return std::string("right"); + else if (align == HCENTER) return std::string("center"); + else return std::string(); } // static -LLFontGL::HAlign LLFontGL::hAlignFromName(const LLString& name) +LLFontGL::HAlign LLFontGL::hAlignFromName(const std::string& name) { LLFontGL::HAlign gl_hfont_align = LLFontGL::LEFT; if (name == "left") @@ -1522,17 +1522,17 @@ LLFontGL::HAlign LLFontGL::hAlignFromName(const LLString& name) } // static -LLString LLFontGL::nameFromVAlign(LLFontGL::VAlign align) +std::string LLFontGL::nameFromVAlign(LLFontGL::VAlign align) { - if (align == TOP) return LLString("top"); - else if (align == VCENTER) return LLString("center"); - else if (align == BASELINE) return LLString("baseline"); - else if (align == BOTTOM) return LLString("bottom"); - else return LLString(); + if (align == TOP) return std::string("top"); + else if (align == VCENTER) return std::string("center"); + else if (align == BASELINE) return std::string("baseline"); + else if (align == BOTTOM) return std::string("bottom"); + else return std::string(); } // static -LLFontGL::VAlign LLFontGL::vAlignFromName(const LLString& name) +LLFontGL::VAlign LLFontGL::vAlignFromName(const std::string& name) { LLFontGL::VAlign gl_vfont_align = LLFontGL::BASELINE; if (name == "top") diff --git a/indra/llrender/llfontgl.h b/indra/llrender/llfontgl.h index e49a9fc296..e319ac95da 100644 --- a/indra/llrender/llfontgl.h +++ b/indra/llrender/llfontgl.h @@ -73,7 +73,7 @@ public: }; // Takes a string with potentially several flags, i.e. "NORMAL|BOLD|ITALIC" - static U8 getStyleFromString(const LLString &style); + static U8 getStyleFromString(const std::string &style); LLFontGL(); LLFontGL(const LLFontGL &source); @@ -85,24 +85,24 @@ public: LLFontGL &operator=(const LLFontGL &source); static BOOL initDefaultFonts(F32 screen_dpi, F32 x_scale, F32 y_scale, - const LLString& monospace_file, F32 monospace_size, - const LLString& sansserif_file, - const LLString& sansserif_fallback_file, F32 ss_fallback_scale, + const std::string& monospace_file, F32 monospace_size, + const std::string& sansserif_file, + const std::string& sansserif_fallback_file, F32 ss_fallback_scale, F32 small_size, F32 medium_size, F32 large_size, F32 huge_size, - const LLString& sansserif_bold_file, F32 bold_size, - const LLString& app_dir = LLString::null); + const std::string& sansserif_bold_file, F32 bold_size, + const std::string& app_dir = LLStringUtil::null); static void destroyDefaultFonts(); static void destroyGL(); - static bool loadFaceFallback(LLFontList *fontp, const LLString& fontname, const F32 point_size); - static bool loadFace(LLFontGL *fontp, const LLString& fontname, const F32 point_size, LLFontList *fallback_fontp); + static bool loadFaceFallback(LLFontList *fontp, const std::string& fontname, const F32 point_size); + static bool loadFace(LLFontGL *fontp, const std::string& fontname, const F32 point_size, LLFontList *fallback_fontp); /* virtual*/ BOOL loadFace(const std::string& filename, const F32 point_size, const F32 vert_dpi, const F32 horz_dpi, const S32 components, BOOL is_fallback); - S32 renderUTF8(const LLString &text, const S32 begin_offset, + S32 renderUTF8(const std::string &text, const S32 begin_offset, S32 x, S32 y, const LLColor4 &color) const { @@ -111,7 +111,7 @@ public: S32_MAX, S32_MAX, NULL, FALSE); } - S32 renderUTF8(const LLString &text, const S32 begin_offset, + S32 renderUTF8(const std::string &text, const S32 begin_offset, S32 x, S32 y, const LLColor4 &color, HAlign halign, VAlign valign, U8 style = NORMAL) const @@ -122,7 +122,7 @@ public: } // renderUTF8 does a conversion, so is slower! - S32 renderUTF8(const LLString &text, + S32 renderUTF8(const std::string &text, S32 begin_offset, F32 x, F32 y, const LLColor4 &color, @@ -162,14 +162,14 @@ public: /*virtual*/ F32 getAscenderHeight() const { return (F32)llround(mAscender / sScaleY); } /*virtual*/ F32 getDescenderHeight() const { return (F32)llround(mDescender / sScaleY); } - virtual S32 getWidth(const LLString& utf8text) const; + virtual S32 getWidth(const std::string& utf8text) const; virtual S32 getWidth(const llwchar* wchars) const; - virtual S32 getWidth(const LLString& utf8text, const S32 offset, const S32 max_chars ) const; + virtual S32 getWidth(const std::string& utf8text, const S32 offset, const S32 max_chars ) const; virtual S32 getWidth(const llwchar* wchars, const S32 offset, const S32 max_chars, BOOL use_embedded = FALSE) const; - virtual F32 getWidthF32(const LLString& utf8text) const; + virtual F32 getWidthF32(const std::string& utf8text) const; virtual F32 getWidthF32(const llwchar* wchars) const; - virtual F32 getWidthF32(const LLString& text, const S32 offset, const S32 max_chars ) const; + virtual F32 getWidthF32(const std::string& text, const S32 offset, const S32 max_chars ) const; virtual F32 getWidthF32(const llwchar* wchars, const S32 offset, const S32 max_chars, BOOL use_embedded = FALSE ) const; // The following are called often, frequently with large buffers, so do not use a string interface @@ -191,18 +191,18 @@ public: LLImageGL *getImageGL() const; - void addEmbeddedChar( llwchar wc, LLImageGL* image, const LLString& label); + void addEmbeddedChar( llwchar wc, LLImageGL* image, const std::string& label); void addEmbeddedChar( llwchar wc, LLImageGL* image, const LLWString& label); void removeEmbeddedChar( llwchar wc ); - static LLString nameFromFont(const LLFontGL* fontp); - static LLFontGL* fontFromName(const LLString& name); + static std::string nameFromFont(const LLFontGL* fontp); + static LLFontGL* fontFromName(const std::string& name); - static LLString nameFromHAlign(LLFontGL::HAlign align); - static LLFontGL::HAlign hAlignFromName(const LLString& name); + static std::string nameFromHAlign(LLFontGL::HAlign align); + static LLFontGL::HAlign hAlignFromName(const std::string& name); - static LLString nameFromVAlign(LLFontGL::VAlign align); - static LLFontGL::VAlign vAlignFromName(const LLString& name); + static std::string nameFromVAlign(LLFontGL::VAlign align); + static LLFontGL::VAlign vAlignFromName(const std::string& name); static void setFontDisplay(BOOL flag) { sDisplayFont = flag ; } @@ -225,7 +225,7 @@ public: static F32 sScaleX; static F32 sScaleY; static BOOL sDisplayFont ; - static LLString sAppDir; // For loading fonts + static std::string sAppDir; // For loading fonts static LLFontGL* sMonospace; // medium static LLFontList* sMonospaceFallback; @@ -249,8 +249,8 @@ public: protected: /*virtual*/ BOOL addChar(const llwchar wch); - static LLString getFontPathLocal(); - static LLString getFontPathSystem(); + static std::string getFontPathLocal(); + static std::string getFontPathSystem(); protected: LLPointer mRawImageGLp; diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp index dd9f22361f..f020730d4a 100644 --- a/indra/llrender/llimagegl.cpp +++ b/indra/llrender/llimagegl.cpp @@ -842,7 +842,7 @@ BOOL LLImageGL::createGLTexture(S32 discard_level, const LLImageRaw* imageraw, S llwarns << "Trying to create a texture while GL is disabled!" << llendl; return FALSE; } - llassert(gGLManager.mInited || gNoRender); + llassert(gGLManager.mInited); stop_glerror(); if (discard_level < 0) diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp index 7d54aeb950..4f5f630fcd 100644 --- a/indra/llui/llbutton.cpp +++ b/indra/llui/llbutton.cpp @@ -59,7 +59,7 @@ S32 BTN_HEIGHT = 0; S32 BTN_GRID = 12; S32 BORDER_SIZE = 1; -LLButton::LLButton( const LLString& name, const LLRect& rect, const LLString& control_name, void (*click_callback)(void*), void *callback_data) +LLButton::LLButton( const std::string& name, const LLRect& rect, const std::string& control_name, void (*click_callback)(void*), void *callback_data) : LLUICtrl(name, rect, TRUE, NULL, NULL), mClickedCallback( click_callback ), mMouseDownCallback( NULL ), @@ -93,10 +93,10 @@ LLButton::LLButton( const LLString& name, const LLRect& rect, const LLString& co mUnselectedLabel = name; mSelectedLabel = name; - setImageUnselected("button_enabled_32x128.tga"); - setImageSelected("button_enabled_selected_32x128.tga"); - setImageDisabled("button_disabled_32x128.tga"); - setImageDisabledSelected("button_disabled_32x128.tga"); + setImageUnselected(std::string("button_enabled_32x128.tga")); + setImageSelected(std::string("button_enabled_selected_32x128.tga")); + setImageDisabled(std::string("button_disabled_32x128.tga")); + setImageDisabledSelected(std::string("button_disabled_32x128.tga")); mImageColor = LLUI::sColorsGroup->getColor( "ButtonImageColor" ); mDisabledImageColor = LLUI::sColorsGroup->getColor( "ButtonImageColor" ); @@ -105,15 +105,15 @@ LLButton::LLButton( const LLString& name, const LLRect& rect, const LLString& co } -LLButton::LLButton(const LLString& name, const LLRect& rect, - const LLString &unselected_image_name, - const LLString &selected_image_name, - const LLString& control_name, +LLButton::LLButton(const std::string& name, const LLRect& rect, + const std::string &unselected_image_name, + const std::string &selected_image_name, + const std::string& control_name, void (*click_callback)(void*), void *callback_data, const LLFontGL *font, - const LLString& unselected_label, - const LLString& selected_label ) + const std::string& unselected_label, + const std::string& selected_label ) : LLUICtrl(name, rect, TRUE, NULL, NULL), mClickedCallback( click_callback ), mMouseDownCallback( NULL ), @@ -162,8 +162,8 @@ LLButton::LLButton(const LLString& name, const LLRect& rect, } else { - setImageUnselected("button_enabled_32x128.tga"); - setImageDisabled("button_disabled_32x128.tga"); + setImageUnselected(std::string("button_enabled_32x128.tga")); + setImageDisabled(std::string("button_disabled_32x128.tga")); } if( selected_image_name != "" ) @@ -177,19 +177,19 @@ LLButton::LLButton(const LLString& name, const LLRect& rect, } else { - setImageSelected("button_enabled_selected_32x128.tga"); - setImageDisabledSelected("button_disabled_32x128.tga"); + setImageSelected(std::string("button_enabled_selected_32x128.tga")); + setImageDisabledSelected(std::string("button_disabled_32x128.tga")); } init(click_callback, callback_data, font, control_name); } -void LLButton::init(void (*click_callback)(void*), void *callback_data, const LLFontGL* font, const LLString& control_name) +void LLButton::init(void (*click_callback)(void*), void *callback_data, const LLFontGL* font, const std::string& control_name) { mGLFont = ( font ? font : LLFontGL::sSansSerif); // Hack to make sure there is space for at least one character - if (getRect().getWidth() - (mRightHPad + mLeftHPad) < mGLFont->getWidth(" ")) + if (getRect().getWidth() - (mRightHPad + mLeftHPad) < mGLFont->getWidth(std::string(" "))) { // Use old defaults mLeftHPad = LLBUTTON_ORIG_H_PAD; @@ -667,7 +667,7 @@ void LLButton::draw() // Draw label if( !label.empty() ) { - LLWString::trim(label); + LLWStringUtil::trim(label); S32 x; switch( mHAlign ) @@ -774,7 +774,7 @@ void LLButton::setLabel( const LLStringExplicit& label ) } //virtual -BOOL LLButton::setLabelArg( const LLString& key, const LLStringExplicit& text ) +BOOL LLButton::setLabelArg( const std::string& key, const LLStringExplicit& text ) { mUnselectedLabel.setArg(key, text); mSelectedLabel.setArg(key, text); @@ -806,7 +806,7 @@ void LLButton::setImageUnselected(LLPointer image) mImageUnselected = image; } -void LLButton::setImages( const LLString &image_name, const LLString &selected_name ) +void LLButton::setImages( const std::string &image_name, const std::string &selected_name ) { setImageUnselected(image_name); setImageSelected(selected_name); @@ -843,7 +843,7 @@ void LLButton::setImageDisabledSelected(LLPointer image) mDisabledImageColor.mV[VALPHA] *= 0.5f; } -void LLButton::setDisabledImages( const LLString &image_name, const LLString &selected_name, const LLColor4& c ) +void LLButton::setDisabledImages( const std::string &image_name, const std::string &selected_name, const LLColor4& c ) { setImageDisabled(image_name); setImageDisabledSelected(selected_name); @@ -855,7 +855,7 @@ void LLButton::setImageHoverSelected(LLPointer image) mImageHoverSelected = image; } -void LLButton::setDisabledImages( const LLString &image_name, const LLString &selected_name) +void LLButton::setDisabledImages( const std::string &image_name, const std::string &selected_name) { LLColor4 clr = mImageColor; clr.mV[VALPHA] *= .5f; @@ -867,13 +867,13 @@ void LLButton::setImageHoverUnselected(LLPointer image) mImageHoverUnselected = image; } -void LLButton::setHoverImages( const LLString& image_name, const LLString& selected_name ) +void LLButton::setHoverImages( const std::string& image_name, const std::string& selected_name ) { setImageHoverUnselected(image_name); setImageHoverSelected(selected_name); } -void LLButton::setImageOverlay(const LLString &image_name, LLFontGL::HAlign alignment, const LLColor4& color) +void LLButton::setImageOverlay(const std::string& image_name, LLFontGL::HAlign alignment, const LLColor4& color) { if (image_name.empty()) { @@ -912,54 +912,54 @@ S32 round_up(S32 grid, S32 value) } } -void LLButton::setImageUnselected(const LLString &image_name) +void LLButton::setImageUnselected(const std::string &image_name) { setImageUnselected(LLUI::getUIImage(image_name)); mImageUnselectedName = image_name; } -void LLButton::setImageSelected(const LLString &image_name) +void LLButton::setImageSelected(const std::string &image_name) { setImageSelected(LLUI::getUIImage(image_name)); mImageSelectedName = image_name; } -void LLButton::setImageHoverSelected(const LLString &image_name) +void LLButton::setImageHoverSelected(const std::string &image_name) { setImageHoverSelected(LLUI::getUIImage(image_name)); mImageHoverSelectedName = image_name; } -void LLButton::setImageHoverUnselected(const LLString &image_name) +void LLButton::setImageHoverUnselected(const std::string &image_name) { setImageHoverUnselected(LLUI::getUIImage(image_name)); mImageHoverUnselectedName = image_name; } -void LLButton::setImageDisabled(const LLString &image_name) +void LLButton::setImageDisabled(const std::string &image_name) { setImageDisabled(LLUI::getUIImage(image_name)); mImageDisabledName = image_name; } -void LLButton::setImageDisabledSelected(const LLString &image_name) +void LLButton::setImageDisabledSelected(const std::string &image_name) { setImageDisabledSelected(LLUI::getUIImage(image_name)); mImageDisabledSelectedName = image_name; } void LLButton::addImageAttributeToXML(LLXMLNodePtr node, - const LLString& image_name, + const std::string& image_name, const LLUUID& image_id, - const LLString& xml_tag_name) const + const std::string& xml_tag_name) const { if( !image_name.empty() ) { - node->createChild(xml_tag_name, TRUE)->setStringValue(image_name); + node->createChild(xml_tag_name.c_str(), TRUE)->setStringValue(image_name); } else if( image_id != LLUUID::null ) { - node->createChild(xml_tag_name + "_id", TRUE)->setUUIDValue(image_id); + node->createChild((xml_tag_name + "_id").c_str(), TRUE)->setUUIDValue(image_id); } } @@ -973,12 +973,12 @@ LLXMLNodePtr LLButton::getXML(bool save_children) const node->createChild("font", TRUE)->setStringValue(LLFontGL::nameFromFont(mGLFont)); node->createChild("halign", TRUE)->setStringValue(LLFontGL::nameFromHAlign(mHAlign)); - addImageAttributeToXML(node,mImageUnselectedName,mImageUnselectedID,"image_unselected"); - addImageAttributeToXML(node,mImageSelectedName,mImageSelectedID,"image_selected"); - addImageAttributeToXML(node,mImageHoverSelectedName,mImageHoverSelectedID,"image_hover_selected"); - addImageAttributeToXML(node,mImageHoverUnselectedName,mImageHoverUnselectedID,"image_hover_unselected"); - addImageAttributeToXML(node,mImageDisabledName,mImageDisabledID,"image_disabled"); - addImageAttributeToXML(node,mImageDisabledSelectedName,mImageDisabledSelectedID,"image_disabled_selected"); + addImageAttributeToXML(node,mImageUnselectedName,mImageUnselectedID,std::string("image_unselected")); + addImageAttributeToXML(node,mImageSelectedName,mImageSelectedID,std::string("image_selected")); + addImageAttributeToXML(node,mImageHoverSelectedName,mImageHoverSelectedID,std::string("image_hover_selected")); + addImageAttributeToXML(node,mImageHoverUnselectedName,mImageHoverUnselectedID,std::string("image_hover_unselected")); + addImageAttributeToXML(node,mImageDisabledName,mImageDisabledID,std::string("image_disabled")); + addImageAttributeToXML(node,mImageDisabledSelectedName,mImageDisabledSelectedID,std::string("image_disabled_selected")); node->createChild("scale_image", TRUE)->setBoolValue(mScaleImage); @@ -1001,40 +1001,40 @@ void clicked_help(void* data) // static LLView* LLButton::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory) { - LLString name("button"); + std::string name("button"); node->getAttributeString("name", name); - LLString label = name; + std::string label = name; node->getAttributeString("label", label); - LLString label_selected = label; + std::string label_selected = label; node->getAttributeString("label_selected", label_selected); LLFontGL* font = selectFont(node); - LLString image_unselected; + std::string image_unselected; if (node->hasAttribute("image_unselected")) node->getAttributeString("image_unselected",image_unselected); - LLString image_selected; + std::string image_selected; if (node->hasAttribute("image_selected")) node->getAttributeString("image_selected",image_selected); - LLString image_hover_selected; + std::string image_hover_selected; if (node->hasAttribute("image_hover_selected")) node->getAttributeString("image_hover_selected",image_hover_selected); - LLString image_hover_unselected; + std::string image_hover_unselected; if (node->hasAttribute("image_hover_unselected")) node->getAttributeString("image_hover_unselected",image_hover_unselected); - LLString image_disabled_selected; + std::string image_disabled_selected; if (node->hasAttribute("image_disabled_selected")) node->getAttributeString("image_disabled_selected",image_disabled_selected); - LLString image_disabled; + std::string image_disabled; if (node->hasAttribute("image_disabled")) node->getAttributeString("image_disabled",image_disabled); - LLString image_overlay; + std::string image_overlay; node->getAttributeString("image_overlay", image_overlay); LLFontGL::HAlign image_overlay_alignment = LLFontGL::HCENTER; - LLString image_overlay_alignment_string; + std::string image_overlay_alignment_string; if (node->hasAttribute("image_overlay_alignment")) { node->getAttributeString("image_overlay_alignment", image_overlay_alignment_string); @@ -1046,7 +1046,7 @@ LLView* LLButton::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *fa LLRect(), image_unselected, image_selected, - "", + LLStringUtil::null, NULL, parent, font, @@ -1060,15 +1060,15 @@ LLView* LLButton::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *fa node->getAttributeBOOL("toggle", is_toggle); button->setIsToggle(is_toggle); - if(image_hover_selected != LLString::null) button->setImageHoverSelected(image_hover_selected); + if(image_hover_selected != LLStringUtil::null) button->setImageHoverSelected(image_hover_selected); - if(image_hover_unselected != LLString::null) button->setImageHoverUnselected(image_hover_unselected); + if(image_hover_unselected != LLStringUtil::null) button->setImageHoverUnselected(image_hover_unselected); - if(image_disabled_selected != LLString::null) button->setImageDisabledSelected(image_disabled_selected ); + if(image_disabled_selected != LLStringUtil::null) button->setImageDisabledSelected(image_disabled_selected ); - if(image_disabled != LLString::null) button->setImageDisabled(image_disabled); + if(image_disabled != LLStringUtil::null) button->setImageDisabled(image_disabled); - if(image_overlay != LLString::null) button->setImageOverlay(image_overlay, image_overlay_alignment); + if(image_overlay != LLStringUtil::null) button->setImageOverlay(image_overlay, image_overlay_alignment); if (node->hasAttribute("halign")) { @@ -1094,7 +1094,7 @@ LLView* LLButton::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *fa if (node->hasAttribute("help_url")) { - LLString help_url; + std::string help_url; node->getAttributeString("help_url",help_url); button->setHelpURLCallback(help_url); } @@ -1104,7 +1104,7 @@ LLView* LLButton::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *fa return button; } -void LLButton::setHelpURLCallback(const LLString &help_url) +void LLButton::setHelpURLCallback(const std::string &help_url) { mHelpURL = help_url; setClickedCallback(clicked_help,this); diff --git a/indra/llui/llbutton.h b/indra/llui/llbutton.h index 6357e27bb7..9e24376938 100644 --- a/indra/llui/llbutton.h +++ b/indra/llui/llbutton.h @@ -72,25 +72,25 @@ class LLButton { public: // simple button with text label - LLButton(const LLString& name, const LLRect &rect, const LLString& control_name = LLString(), + LLButton(const std::string& name, const LLRect &rect, const std::string& control_name = std::string(), void (*on_click)(void*) = NULL, void *data = NULL); - LLButton(const LLString& name, const LLRect& rect, - const LLString &unselected_image, - const LLString &selected_image, - const LLString& control_name, + LLButton(const std::string& name, const LLRect& rect, + const std::string &unselected_image, + const std::string &selected_image, + const std::string& control_name, void (*click_callback)(void*), void *callback_data = NULL, const LLFontGL* mGLFont = NULL, - const LLString& unselected_label = LLString::null, - const LLString& selected_label = LLString::null ); + const std::string& unselected_label = LLStringUtil::null, + const std::string& selected_label = LLStringUtil::null ); virtual ~LLButton(); - void init(void (*click_callback)(void*), void *callback_data, const LLFontGL* font, const LLString& control_name); + void init(void (*click_callback)(void*), void *callback_data, const LLFontGL* font, const std::string& control_name); - void addImageAttributeToXML(LLXMLNodePtr node, const LLString& imageName, - const LLUUID& imageID,const LLString& xmlTagName) const; + void addImageAttributeToXML(LLXMLNodePtr node, const std::string& imageName, + const LLUUID& imageID,const std::string& xmlTagName) const; virtual LLXMLNodePtr getXML(bool save_children = true) const; static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory); @@ -130,24 +130,24 @@ public: void setLeftHPad( S32 pad ) { mLeftHPad = pad; } void setRightHPad( S32 pad ) { mRightHPad = pad; } - const LLString getLabelUnselected() const { return wstring_to_utf8str(mUnselectedLabel); } - const LLString getLabelSelected() const { return wstring_to_utf8str(mSelectedLabel); } + const std::string getLabelUnselected() const { return wstring_to_utf8str(mUnselectedLabel); } + const std::string getLabelSelected() const { return wstring_to_utf8str(mSelectedLabel); } - void setImageColor(const LLString& color_control); + void setImageColor(const std::string& color_control); void setImageColor(const LLColor4& c); virtual void setColor(const LLColor4& c); - void setImages(const LLString &image_name, const LLString &selected_name); - void setDisabledImages(const LLString &image_name, const LLString &selected_name); - void setDisabledImages(const LLString &image_name, const LLString &selected_name, const LLColor4& c); + void setImages(const std::string &image_name, const std::string &selected_name); + void setDisabledImages(const std::string &image_name, const std::string &selected_name); + void setDisabledImages(const std::string &image_name, const std::string &selected_name, const LLColor4& c); - void setHoverImages(const LLString &image_name, const LLString &selected_name); + void setHoverImages(const std::string &image_name, const std::string &selected_name); void setDisabledImageColor(const LLColor4& c) { mDisabledImageColor = c; } void setDisabledSelectedLabelColor( const LLColor4& c ) { mDisabledSelectedLabelColor = c; } - void setImageOverlay(const LLString &image_name, LLFontGL::HAlign alignment = LLFontGL::HCENTER, const LLColor4& color = LLColor4::white); + void setImageOverlay(const std::string& image_name, LLFontGL::HAlign alignment = LLFontGL::HCENTER, const LLColor4& color = LLColor4::white); LLPointer getImageOverlay() { return mImageOverlay; } @@ -155,7 +155,7 @@ public: virtual LLSD getValue() const; void setLabel( const LLStringExplicit& label); - virtual BOOL setLabelArg( const LLString& key, const LLStringExplicit& text ); + virtual BOOL setLabelArg( const std::string& key, const LLStringExplicit& text ); void setLabelUnselected(const LLStringExplicit& label); void setLabelSelected(const LLStringExplicit& label); void setDisabledLabel(const LLStringExplicit& disabled_label); @@ -175,14 +175,14 @@ public: void setHoverGlowStrength(F32 strength) { mHoverGlowStrength = strength; } - void setImageUnselected(const LLString &image_name); - const LLString& getImageUnselectedName() const { return mImageUnselectedName; } - void setImageSelected(const LLString &image_name); - const LLString& getImageSelectedName() const { return mImageSelectedName; } - void setImageHoverSelected(const LLString &image_name); - void setImageHoverUnselected(const LLString &image_name); - void setImageDisabled(const LLString &image_name); - void setImageDisabledSelected(const LLString &image_name); + void setImageUnselected(const std::string &image_name); + const std::string& getImageUnselectedName() const { return mImageUnselectedName; } + void setImageSelected(const std::string &image_name); + const std::string& getImageSelectedName() const { return mImageSelectedName; } + void setImageHoverSelected(const std::string &image_name); + void setImageHoverUnselected(const std::string &image_name); + void setImageDisabled(const std::string &image_name); + void setImageDisabledSelected(const std::string &image_name); void setImageUnselected(LLPointer image); void setImageSelected(LLPointer image); @@ -194,8 +194,8 @@ public: void setCommitOnReturn(BOOL commit) { mCommitOnReturn = commit; } BOOL getCommitOnReturn() const { return mCommitOnReturn; } - void setHelpURLCallback(const LLString &help_url); - const LLString& getHelpURL() const { return mHelpURL; } + void setHelpURLCallback(const std::string &help_url); + const std::string& getHelpURL() const { return mHelpURL; } protected: @@ -257,12 +257,12 @@ private: LLUUID mImageHoverUnselectedID; LLUUID mImageDisabledID; LLUUID mImageDisabledSelectedID; - LLString mImageUnselectedName; - LLString mImageSelectedName; - LLString mImageHoverSelectedName; - LLString mImageHoverUnselectedName; - LLString mImageDisabledName; - LLString mImageDisabledSelectedName; + std::string mImageUnselectedName; + std::string mImageSelectedName; + std::string mImageHoverSelectedName; + std::string mImageHoverUnselectedName; + std::string mImageDisabledName; + std::string mImageDisabledSelectedName; LLColor4 mHighlightColor; LLColor4 mUnselectedBgColor; @@ -291,7 +291,7 @@ private: BOOL mNeedsHighlight; BOOL mCommitOnReturn; - LLString mHelpURL; + std::string mHelpURL; LLPointer mImagep; diff --git a/indra/llui/llcallbackmap.h b/indra/llui/llcallbackmap.h index 496d7225f8..148993b1b1 100644 --- a/indra/llui/llcallbackmap.h +++ b/indra/llui/llcallbackmap.h @@ -41,7 +41,7 @@ public: // callback definition. typedef void* (*callback_t)(void* data); - typedef std::map map_t; + typedef std::map map_t; typedef map_t::iterator map_iter_t; typedef map_t::const_iterator map_const_iter_t; diff --git a/indra/llui/llcheckboxctrl.cpp b/indra/llui/llcheckboxctrl.cpp index 4d65047c36..0eab8f27a6 100644 --- a/indra/llui/llcheckboxctrl.cpp +++ b/indra/llui/llcheckboxctrl.cpp @@ -51,14 +51,14 @@ const U32 MAX_STRING_LENGTH = 10; static LLRegisterWidget r("check_box"); -LLCheckBoxCtrl::LLCheckBoxCtrl(const LLString& name, const LLRect& rect, - const LLString& label, +LLCheckBoxCtrl::LLCheckBoxCtrl(const std::string& name, const LLRect& rect, + const std::string& label, const LLFontGL* font, void (*commit_callback)(LLUICtrl* ctrl, void* userdata), void* callback_user_data, BOOL initial_value, BOOL use_radio_style, - const LLString& control_which) + const std::string& control_which) : LLUICtrl(name, rect, TRUE, commit_callback, callback_user_data, FOLLOWS_LEFT | FOLLOWS_TOP), mTextEnabledColor( LLUI::sColorsGroup->getColor( "LabelTextColor" ) ), mTextDisabledColor( LLUI::sColorsGroup->getColor( "LabelDisabledColor" ) ), @@ -93,13 +93,13 @@ LLCheckBoxCtrl::LLCheckBoxCtrl(const LLString& name, const LLRect& rect, // *HACK Get rid of this with SL-55508... // this allows blank check boxes and radio boxes for now - LLString local_label = label; + std::string local_label = label; if(local_label.empty()) { local_label = " "; } - mLabel = new LLTextBox( "CheckboxCtrl Label", label_rect, local_label.c_str(), mFont ); + mLabel = new LLTextBox( std::string("CheckboxCtrl Label"), label_rect, local_label, mFont ); mLabel->setFollowsLeft(); mLabel->setFollowsBottom(); addChild(mLabel); @@ -112,18 +112,17 @@ LLCheckBoxCtrl::LLCheckBoxCtrl(const LLString& name, const LLRect& rect, LLCHECKBOXCTRL_VPAD, LLCHECKBOXCTRL_BTN_SIZE + LLCHECKBOXCTRL_SPACING + text_width + LLCHECKBOXCTRL_HPAD, llmax( text_height, LLCHECKBOXCTRL_BTN_SIZE ) + LLCHECKBOXCTRL_VPAD); - LLString active_true_id, active_false_id; - LLString inactive_true_id, inactive_false_id; + std::string active_true_id, active_false_id; + std::string inactive_true_id, inactive_false_id; if (mRadioStyle) { active_true_id = "UIImgRadioActiveSelectedUUID"; active_false_id = "UIImgRadioActiveUUID"; inactive_true_id = "UIImgRadioInactiveSelectedUUID"; inactive_false_id = "UIImgRadioInactiveUUID"; - mButton = new LLButton( - "Radio control button", btn_rect, - active_false_id, active_true_id, control_which, - &LLCheckBoxCtrl::onButtonPress, this, LLFontGL::sSansSerif ); + mButton = new LLButton(std::string("Radio control button"), btn_rect, + active_false_id, active_true_id, control_which, + &LLCheckBoxCtrl::onButtonPress, this, LLFontGL::sSansSerif ); mButton->setDisabledImages( inactive_false_id, inactive_true_id ); mButton->setHoverGlowStrength(0.35f); } @@ -133,10 +132,9 @@ LLCheckBoxCtrl::LLCheckBoxCtrl(const LLString& name, const LLRect& rect, active_true_id = "UIImgCheckboxActiveSelectedUUID"; inactive_true_id = "UIImgCheckboxInactiveSelectedUUID"; inactive_false_id = "UIImgCheckboxInactiveUUID"; - mButton = new LLButton( - "Checkbox control button", btn_rect, - active_false_id, active_true_id, control_which, - &LLCheckBoxCtrl::onButtonPress, this, LLFontGL::sSansSerif ); + mButton = new LLButton(std::string("Checkbox control button"), btn_rect, + active_false_id, active_true_id, control_which, + &LLCheckBoxCtrl::onButtonPress, this, LLFontGL::sSansSerif ); mButton->setDisabledImages( inactive_false_id, inactive_true_id ); mButton->setHoverGlowStrength(0.35f); } @@ -253,12 +251,12 @@ void LLCheckBoxCtrl::setLabel( const LLStringExplicit& label ) reshape(getRect().getWidth(), getRect().getHeight(), FALSE); } -LLString LLCheckBoxCtrl::getLabel() const +std::string LLCheckBoxCtrl::getLabel() const { return mLabel->getText(); } -BOOL LLCheckBoxCtrl::setLabelArg( const LLString& key, const LLStringExplicit& text ) +BOOL LLCheckBoxCtrl::setLabelArg( const std::string& key, const LLStringExplicit& text ) { BOOL res = mLabel->setTextArg(key, text); reshape(getRect().getWidth(), getRect().getHeight(), FALSE); @@ -266,13 +264,13 @@ BOOL LLCheckBoxCtrl::setLabelArg( const LLString& key, const LLStringExplicit& t } //virtual -LLString LLCheckBoxCtrl::getControlName() const +std::string LLCheckBoxCtrl::getControlName() const { return mButton->getControlName(); } // virtual -void LLCheckBoxCtrl::setControlName(const LLString& control_name, LLView* context) +void LLCheckBoxCtrl::setControlName(const std::string& control_name, LLView* context) { mButton->setControlName(control_name, context); } @@ -307,7 +305,7 @@ LLXMLNodePtr LLCheckBoxCtrl::getXML(bool save_children) const node->createChild("label", TRUE)->setStringValue(mLabel->getText()); - LLString control_name = mButton->getControlName(); + std::string control_name = mButton->getControlName(); node->createChild("initial_value", TRUE)->setBoolValue(mInitialValue); @@ -321,10 +319,10 @@ LLXMLNodePtr LLCheckBoxCtrl::getXML(bool save_children) const // static LLView* LLCheckBoxCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory) { - LLString name("checkbox"); + std::string name("checkbox"); node->getAttributeString("name", name); - LLString label(""); + std::string label(""); node->getAttributeString("label", label); LLFontGL* font = LLView::selectFont(node); diff --git a/indra/llui/llcheckboxctrl.h b/indra/llui/llcheckboxctrl.h index 6e1ab322af..b78bf135f7 100644 --- a/indra/llui/llcheckboxctrl.h +++ b/indra/llui/llcheckboxctrl.h @@ -65,13 +65,13 @@ class LLCheckBoxCtrl : public LLUICtrl { public: - LLCheckBoxCtrl(const LLString& name, const LLRect& rect, const LLString& label, + LLCheckBoxCtrl(const std::string& name, const LLRect& rect, const std::string& label, const LLFontGL* font = NULL, void (*commit_callback)(LLUICtrl*, void*) = NULL, void* callback_userdata = NULL, BOOL initial_value = FALSE, BOOL use_radio_style = FALSE, // if true, draw radio button style icons - const LLString& control_which = LLString::null); + const std::string& control_which = LLStringUtil::null); virtual ~LLCheckBoxCtrl(); // LLView interface @@ -93,7 +93,7 @@ public: virtual void setTentative(BOOL b) { mButton->setTentative(b); } virtual BOOL getTentative() const { return mButton->getTentative(); } - virtual BOOL setLabelArg( const LLString& key, const LLStringExplicit& text ); + virtual BOOL setLabelArg( const std::string& key, const LLStringExplicit& text ); virtual void clear(); virtual void onCommit(); @@ -105,10 +105,10 @@ public: void setDisabledColor( const LLColor4 &color ) { mTextDisabledColor = color; } void setLabel( const LLStringExplicit& label ); - LLString getLabel() const; + std::string getLabel() const; - virtual void setControlName(const LLString& control_name, LLView* context); - virtual LLString getControlName() const; + virtual void setControlName(const std::string& control_name, LLView* context); + virtual std::string getControlName() const; static void onButtonPress(void *userdata); diff --git a/indra/llui/llcombobox.cpp b/indra/llui/llcombobox.cpp index 98a79fa650..8d8487f612 100644 --- a/indra/llui/llcombobox.cpp +++ b/indra/llui/llcombobox.cpp @@ -59,7 +59,7 @@ S32 MAX_COMBO_WIDTH = 500; static LLRegisterWidget r1("combo_box"); -LLComboBox::LLComboBox( const LLString& name, const LLRect &rect, const LLString& label, +LLComboBox::LLComboBox( const std::string& name, const LLRect &rect, const std::string& label, void (*commit_callback)(LLUICtrl*,void*), void *callback_userdata ) @@ -78,12 +78,12 @@ LLComboBox::LLComboBox( const LLString& name, const LLRect &rect, const LLString // Text label button mButton = new LLButton(label, LLRect(), - LLString::null, + LLStringUtil::null, NULL, this); - mButton->setImageUnselected("square_btn_32x128.tga"); - mButton->setImageSelected("square_btn_selected_32x128.tga"); - mButton->setImageDisabled("square_btn_32x128.tga"); - mButton->setImageDisabledSelected("square_btn_selected_32x128.tga"); + mButton->setImageUnselected(std::string("square_btn_32x128.tga")); + mButton->setImageSelected(std::string("square_btn_selected_32x128.tga")); + mButton->setImageDisabled(std::string("square_btn_32x128.tga")); + mButton->setImageDisabledSelected(std::string("square_btn_selected_32x128.tga")); mButton->setScaleImage(TRUE); mButton->setMouseDownCallback(onButtonDown); @@ -94,9 +94,8 @@ LLComboBox::LLComboBox( const LLString& name, const LLRect &rect, const LLString addChild(mButton); // disallow multiple selection - mList = new LLScrollListCtrl( - "ComboBox", LLRect(), - &LLComboBox::onItemSelected, this, FALSE); + mList = new LLScrollListCtrl(std::string("ComboBox"), LLRect(), + &LLComboBox::onItemSelected, this, FALSE); mList->setVisible(FALSE); mList->setBgWriteableColor( LLColor4(1,1,1,1) ); mList->setCommitOnKeyboardMovement(FALSE); @@ -149,10 +148,10 @@ LLXMLNodePtr LLComboBox::getXML(bool save_children) const // static LLView* LLComboBox::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory) { - LLString name("combo_box"); + std::string name("combo_box"); node->getAttributeString("name", name); - LLString label(""); + std::string label(""); node->getAttributeString("label", label); LLRect rect; @@ -175,7 +174,7 @@ LLView* LLComboBox::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory * combo_box->initFromXML(node, parent); - const LLString& contents = node->getValue(); + const std::string& contents = node->getValue(); if (contents.find_first_not_of(" \n\t") != contents.npos) { @@ -188,9 +187,9 @@ LLView* LLComboBox::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory * { if (child->hasName("combo_item")) { - LLString label = child->getTextContents(); + std::string label = child->getTextContents(); - LLString value = label; + std::string value = label; child->getAttributeString("value", value); combo_box->add(label, LLSD(value) ); @@ -213,12 +212,12 @@ void LLComboBox::clear() { if (mTextEntry) { - mTextEntry->setText(LLString::null); + mTextEntry->setText(LLStringUtil::null); } - mButton->setLabelSelected(LLString::null); - mButton->setLabelUnselected(LLString::null); - mButton->setDisabledLabel(LLString::null); - mButton->setDisabledSelectedLabel(LLString::null); + mButton->setLabelSelected(LLStringUtil::null); + mButton->setLabelUnselected(LLStringUtil::null); + mButton->setDisabledLabel(LLStringUtil::null); + mButton->setDisabledSelectedLabel(LLStringUtil::null); mList->deselectAllItems(); } @@ -256,7 +255,7 @@ void LLComboBox::resetDirty() // add item "name" to menu -LLScrollListItem* LLComboBox::add(const LLString& name, EAddPosition pos, BOOL enabled) +LLScrollListItem* LLComboBox::add(const std::string& name, EAddPosition pos, BOOL enabled) { LLScrollListItem* item = mList->addSimpleElement(name, pos); item->setEnabled(enabled); @@ -265,7 +264,7 @@ LLScrollListItem* LLComboBox::add(const LLString& name, EAddPosition pos, BOOL e } // add item "name" with a unique id to menu -LLScrollListItem* LLComboBox::add(const LLString& name, const LLUUID& id, EAddPosition pos, BOOL enabled ) +LLScrollListItem* LLComboBox::add(const std::string& name, const LLUUID& id, EAddPosition pos, BOOL enabled ) { LLScrollListItem* item = mList->addSimpleElement(name, pos, id); item->setEnabled(enabled); @@ -274,7 +273,7 @@ LLScrollListItem* LLComboBox::add(const LLString& name, const LLUUID& id, EAddPo } // add item "name" with attached userdata -LLScrollListItem* LLComboBox::add(const LLString& name, void* userdata, EAddPosition pos, BOOL enabled ) +LLScrollListItem* LLComboBox::add(const std::string& name, void* userdata, EAddPosition pos, BOOL enabled ) { LLScrollListItem* item = mList->addSimpleElement(name, pos); item->setEnabled(enabled); @@ -284,7 +283,7 @@ LLScrollListItem* LLComboBox::add(const LLString& name, void* userdata, EAddPosi } // add item "name" with attached generic data -LLScrollListItem* LLComboBox::add(const LLString& name, LLSD value, EAddPosition pos, BOOL enabled ) +LLScrollListItem* LLComboBox::add(const std::string& name, LLSD value, EAddPosition pos, BOOL enabled ) { LLScrollListItem* item = mList->addSimpleElement(name, pos, value); item->setEnabled(enabled); @@ -299,7 +298,7 @@ LLScrollListItem* LLComboBox::addSeparator(EAddPosition pos) void LLComboBox::sortByName() { - mList->sortByColumn(0, TRUE); + mList->sortByColumnIndex(0, TRUE); } @@ -331,9 +330,9 @@ void LLComboBox::setValue(const LLSD& value) } } -const LLString LLComboBox::getSimple() const +const std::string LLComboBox::getSimple() const { - const LLString res = mList->getSelectedItemLabel(); + const std::string res = mList->getSelectedItemLabel(); if (res.empty() && mAllowTextEntry) { return mTextEntry->getText(); @@ -344,7 +343,7 @@ const LLString LLComboBox::getSimple() const } } -const LLString LLComboBox::getSelectedItemLabel(S32 column) const +const std::string LLComboBox::getSelectedItemLabel(S32 column) const { return mList->getSelectedItemLabel(column); } @@ -392,7 +391,7 @@ void LLComboBox::setLabel(const LLStringExplicit& name) } -BOOL LLComboBox::remove(const LLString& name) +BOOL LLComboBox::remove(const std::string& name) { BOOL found = mList->selectItemByLabel(name); @@ -495,10 +494,10 @@ void LLComboBox::updateLayout() LLRect text_entry_rect(0, getRect().getHeight(), getRect().getWidth(), 0); text_entry_rect.mRight -= llmax(8,mArrowImage->getWidth()) + 2 * LLUI::sConfigGroup->getS32("DropShadowButton"); // clear label on button - LLString cur_label = mButton->getLabelSelected(); - mTextEntry = new LLLineEditor("combo_text_entry", + std::string cur_label = mButton->getLabelSelected(); + mTextEntry = new LLLineEditor(std::string("combo_text_entry"), text_entry_rect, - "", + LLStringUtil::null, LLFontGL::sSansSerifSmall, mMaxChars, onTextCommit, @@ -520,7 +519,7 @@ void LLComboBox::updateLayout() } // clear label on button - setLabel(LLString::null); + setLabel(LLStringUtil::null); mButton->setFollows(FOLLOWS_BOTTOM | FOLLOWS_TOP | FOLLOWS_RIGHT); } @@ -647,7 +646,7 @@ void LLComboBox::showList() void LLComboBox::hideList() { //*HACK: store the original value explicitly somewhere, not just in label - LLString orig_selection = mAllowTextEntry ? mTextEntry->getText() : mButton->getLabelSelected(); + std::string orig_selection = mAllowTextEntry ? mTextEntry->getText() : mButton->getLabelSelected(); // assert selection in list mList->selectItemByLabel(orig_selection, FALSE); @@ -712,7 +711,7 @@ void LLComboBox::onItemSelected(LLUICtrl* item, void *userdata) // Note: item is the LLScrollListCtrl LLComboBox *self = (LLComboBox *) userdata; - const LLString name = self->mList->getSelectedItemLabel(); + const std::string name = self->mList->getSelectedItemLabel(); S32 cur_id = self->getCurrentIndex(); if (cur_id != -1) @@ -733,9 +732,9 @@ void LLComboBox::onItemSelected(LLUICtrl* item, void *userdata) self->onCommit(); } -BOOL LLComboBox::handleToolTip(S32 x, S32 y, LLString& msg, LLRect* sticky_rect_screen) +BOOL LLComboBox::handleToolTip(S32 x, S32 y, std::string& msg, LLRect* sticky_rect_screen) { - LLString tool_tip; + std::string tool_tip; if(LLUICtrl::handleToolTip(x, y, msg, sticky_rect_screen)) { @@ -925,7 +924,7 @@ void LLComboBox::updateSelection() // user-entered portion of string, based on assumption that any selected // text was a result of auto-completion LLWString user_wstring = mTextEntry->hasSelection() ? left_wstring : mTextEntry->getWText(); - LLString full_string = mTextEntry->getText(); + std::string full_string = mTextEntry->getText(); // go ahead and arrange drop down list on first typed character, even // though we aren't showing it... some code relies on prearrange @@ -963,7 +962,7 @@ void LLComboBox::updateSelection() void LLComboBox::onTextCommit(LLUICtrl* caller, void* user_data) { LLComboBox* self = (LLComboBox*)user_data; - LLString text = self->mTextEntry->getText(); + std::string text = self->mTextEntry->getText(); self->setSimple(text); self->onCommit(); self->mTextEntry->selectAll(); @@ -1002,7 +1001,7 @@ void LLComboBox::clearColumns() mList->clearColumns(); } -void LLComboBox::setColumnLabel(const LLString& column, const LLString& label) +void LLComboBox::setColumnLabel(const std::string& column, const std::string& label) { mList->setColumnLabel(column, label); } @@ -1012,7 +1011,7 @@ LLScrollListItem* LLComboBox::addElement(const LLSD& value, EAddPosition pos, vo return mList->addElement(value, pos, userdata); } -LLScrollListItem* LLComboBox::addSimpleElement(const LLString& value, EAddPosition pos, const LLSD& id) +LLScrollListItem* LLComboBox::addSimpleElement(const std::string& value, EAddPosition pos, const LLSD& id) { return mList->addSimpleElement(value, pos, id); } @@ -1022,8 +1021,9 @@ void LLComboBox::clearRows() mList->clearRows(); } -void LLComboBox::sortByColumn(LLString name, BOOL ascending) +void LLComboBox::sortByColumn(const std::string& name, BOOL ascending) { + mList->sortByColumn(name, ascending); } //============================================================================ @@ -1100,19 +1100,19 @@ static LLRegisterWidget r2("flyout_button"); const S32 FLYOUT_BUTTON_ARROW_WIDTH = 24; LLFlyoutButton::LLFlyoutButton( - const LLString& name, + const std::string& name, const LLRect &rect, - const LLString& label, + const std::string& label, void (*commit_callback)(LLUICtrl*, void*) , void *callback_userdata) -: LLComboBox(name, rect, LLString::null, commit_callback, callback_userdata), +: LLComboBox(name, rect, LLStringUtil::null, commit_callback, callback_userdata), mToggleState(FALSE), mActionButton(NULL) { // Always use text box // Text label button mActionButton = new LLButton(label, - LLRect(), LLString::null, NULL, this); + LLRect(), LLStringUtil::null, NULL, this); mActionButton->setScaleImage(TRUE); mActionButton->setClickedCallback(onActionButtonClick); @@ -1145,10 +1145,10 @@ LLFlyoutButton::LLFlyoutButton( //static LLView* LLFlyoutButton::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory) { - LLString name = "flyout_button"; + std::string name = "flyout_button"; node->getAttributeString("name", name); - LLString label(""); + std::string label(""); node->getAttributeString("label", label); LLRect rect; @@ -1162,7 +1162,7 @@ LLView* LLFlyoutButton::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFacto callback, NULL); - LLString list_position; + std::string list_position; node->getAttributeString("list_position", list_position); if (list_position == "below") { @@ -1181,9 +1181,9 @@ LLView* LLFlyoutButton::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFacto { if (child->hasName("flyout_button_item")) { - LLString label = child->getTextContents(); + std::string label = child->getTextContents(); - LLString value = label; + std::string value = label; child->getAttributeString("value", value); flyout_button->add(label, LLSD(value) ); @@ -1225,7 +1225,7 @@ void LLFlyoutButton::draw() //FIXME: this should be an attribute of comboboxes, whether they have a distinct label or // the label reflects the last selected item, for now we have to manually remove the label - mButton->setLabel(LLString::null); + mButton->setLabel(LLStringUtil::null); LLComboBox::draw(); } diff --git a/indra/llui/llcombobox.h b/indra/llui/llcombobox.h index 09e8a0e0f4..ce923e277d 100644 --- a/indra/llui/llcombobox.h +++ b/indra/llui/llcombobox.h @@ -64,9 +64,9 @@ public: } EPreferredPosition; LLComboBox( - const LLString& name, + const std::string& name, const LLRect &rect, - const LLString& label, + const std::string& label, void (*commit_callback)(LLUICtrl*, void*) = NULL, void *callback_userdata = NULL ); @@ -83,7 +83,7 @@ public: virtual void setEnabled(BOOL enabled); - virtual BOOL handleToolTip(S32 x, S32 y, LLString& msg, LLRect* sticky_rect); + virtual BOOL handleToolTip(S32 x, S32 y, std::string& msg, LLRect* sticky_rect); virtual BOOL handleKeyHere(KEY key, MASK mask); virtual BOOL handleUnicodeCharHere(llwchar uni_char); @@ -107,10 +107,10 @@ public: void setAllowTextEntry(BOOL allow, S32 max_chars = 50, BOOL make_tentative = TRUE); void setTextEntry(const LLStringExplicit& text); - LLScrollListItem* add(const LLString& name, EAddPosition pos = ADD_BOTTOM, BOOL enabled = TRUE); // add item "name" to menu - LLScrollListItem* add(const LLString& name, const LLUUID& id, EAddPosition pos = ADD_BOTTOM, BOOL enabled = TRUE); - LLScrollListItem* add(const LLString& name, void* userdata, EAddPosition pos = ADD_BOTTOM, BOOL enabled = TRUE); - LLScrollListItem* add(const LLString& name, LLSD value, EAddPosition pos = ADD_BOTTOM, BOOL enabled = TRUE); + LLScrollListItem* add(const std::string& name, EAddPosition pos = ADD_BOTTOM, BOOL enabled = TRUE); // add item "name" to menu + LLScrollListItem* add(const std::string& name, const LLUUID& id, EAddPosition pos = ADD_BOTTOM, BOOL enabled = TRUE); + LLScrollListItem* add(const std::string& name, void* userdata, EAddPosition pos = ADD_BOTTOM, BOOL enabled = TRUE); + LLScrollListItem* add(const std::string& name, LLSD value, EAddPosition pos = ADD_BOTTOM, BOOL enabled = TRUE); LLScrollListItem* addSeparator(EAddPosition pos = ADD_BOTTOM); BOOL remove( S32 index ); // remove item by index, return TRUE if found and removed void removeall() { clearRows(); } @@ -120,15 +120,15 @@ public: // Select current item by name using selectItemByLabel. Returns FALSE if not found. BOOL setSimple(const LLStringExplicit& name); // Get name of current item. Returns an empty string if not found. - const LLString getSimple() const; + const std::string getSimple() const; // Get contents of column x of selected row - const LLString getSelectedItemLabel(S32 column = 0) const; + const std::string getSelectedItemLabel(S32 column = 0) const; // Sets the label, which doesn't have to exist in the label. // This is probably a UI abuse. void setLabel(const LLStringExplicit& name); - BOOL remove(const LLString& name); // remove item "name", return TRUE if found and removed + BOOL remove(const std::string& name); // remove item "name", return TRUE if found and removed BOOL setCurrentByIndex( S32 index ); S32 getCurrentIndex() const; @@ -145,11 +145,11 @@ public: // Overwrites the default column (See LLScrollListCtrl for format) virtual void addColumn(const LLSD& column, EAddPosition pos = ADD_BOTTOM); virtual void clearColumns(); - virtual void setColumnLabel(const LLString& column, const LLString& label); + virtual void setColumnLabel(const std::string& column, const std::string& label); virtual LLScrollListItem* addElement(const LLSD& value, EAddPosition pos = ADD_BOTTOM, void* userdata = NULL); - virtual LLScrollListItem* addSimpleElement(const LLString& value, EAddPosition pos = ADD_BOTTOM, const LLSD& id = LLSD()); + virtual LLScrollListItem* addSimpleElement(const std::string& value, EAddPosition pos = ADD_BOTTOM, const LLSD& id = LLSD()); virtual void clearRows(); - virtual void sortByColumn(LLString name, BOOL ascending); + virtual void sortByColumn(const std::string& name, BOOL ascending); // LLCtrlSelectionInterface functions virtual BOOL getCanSelect() const { return TRUE; } @@ -203,9 +203,9 @@ class LLFlyoutButton : public LLComboBox { public: LLFlyoutButton( - const LLString& name, + const std::string& name, const LLRect &rect, - const LLString& label, + const std::string& label, void (*commit_callback)(LLUICtrl*, void*) = NULL, void *callback_userdata = NULL); diff --git a/indra/llui/llctrlselectioninterface.cpp b/indra/llui/llctrlselectioninterface.cpp index 3dd401973b..589040f345 100644 --- a/indra/llui/llctrlselectioninterface.cpp +++ b/indra/llui/llctrlselectioninterface.cpp @@ -53,12 +53,12 @@ BOOL LLCtrlSelectionInterface::deselectByValue(LLSD value) LLCtrlListInterface::~LLCtrlListInterface() { } -LLScrollListItem* LLCtrlListInterface::addSimpleElement(const LLString& value) +LLScrollListItem* LLCtrlListInterface::addSimpleElement(const std::string& value) { return addSimpleElement(value, ADD_BOTTOM, LLSD()); } -LLScrollListItem* LLCtrlListInterface::addSimpleElement(const LLString& value, EAddPosition pos) +LLScrollListItem* LLCtrlListInterface::addSimpleElement(const std::string& value, EAddPosition pos) { return addSimpleElement(value, pos, LLSD()); } diff --git a/indra/llui/llctrlselectioninterface.h b/indra/llui/llctrlselectioninterface.h index eb89a0833d..2b386e98bb 100644 --- a/indra/llui/llctrlselectioninterface.h +++ b/indra/llui/llctrlselectioninterface.h @@ -84,16 +84,16 @@ public: virtual void addColumn(const LLSD& column, EAddPosition pos = ADD_BOTTOM) = 0; virtual void clearColumns() = 0; - virtual void setColumnLabel(const LLString& column, const LLString& label) = 0; + virtual void setColumnLabel(const std::string& column, const std::string& label) = 0; // TomY TODO: Document this virtual LLScrollListItem* addElement(const LLSD& value, EAddPosition pos = ADD_BOTTOM, void* userdata = NULL) = 0; - LLScrollListItem* addSimpleElement(const LLString& value); // defaults to bottom - LLScrollListItem* addSimpleElement(const LLString& value, EAddPosition pos); // defaults to no LLSD() id - virtual LLScrollListItem* addSimpleElement(const LLString& value, EAddPosition pos, const LLSD& id) = 0; + LLScrollListItem* addSimpleElement(const std::string& value); // defaults to bottom + LLScrollListItem* addSimpleElement(const std::string& value, EAddPosition pos); // defaults to no LLSD() id + virtual LLScrollListItem* addSimpleElement(const std::string& value, EAddPosition pos, const LLSD& id) = 0; virtual void clearRows() = 0; - virtual void sortByColumn(LLString name, BOOL ascending) = 0; + virtual void sortByColumn(const std::string& name, BOOL ascending) = 0; }; class LLCtrlScrollInterface diff --git a/indra/llui/lldraghandle.cpp b/indra/llui/lldraghandle.cpp index 75e4ad5c08..9538a3f3ae 100644 --- a/indra/llui/lldraghandle.cpp +++ b/indra/llui/lldraghandle.cpp @@ -55,7 +55,7 @@ const S32 RIGHT_PAD = BORDER_PAD + 32; // HACK: space for close btn and minimize S32 LLDragHandle::sSnapMargin = 5; -LLDragHandle::LLDragHandle( const LLString& name, const LLRect& rect, const LLString& title ) +LLDragHandle::LLDragHandle( const std::string& name, const LLRect& rect, const std::string& title ) : LLView( name, rect, TRUE ), mDragLastScreenX( 0 ), mDragLastScreenY( 0 ), @@ -94,27 +94,27 @@ void LLDragHandle::setTitleBox(LLTextBox* titlebox) } } -LLDragHandleTop::LLDragHandleTop(const LLString& name, const LLRect &rect, const LLString& title) +LLDragHandleTop::LLDragHandleTop(const std::string& name, const LLRect &rect, const std::string& title) : LLDragHandle(name, rect, title) { setFollowsAll(); setTitle( title ); } -LLDragHandleLeft::LLDragHandleLeft(const LLString& name, const LLRect &rect, const LLString& title) +LLDragHandleLeft::LLDragHandleLeft(const std::string& name, const LLRect &rect, const std::string& title) : LLDragHandle(name, rect, title) { setFollowsAll(); setTitle( title ); } -void LLDragHandleTop::setTitle(const LLString& title) +void LLDragHandleTop::setTitle(const std::string& title) { - LLString trimmed_title = title; - LLString::trim(trimmed_title); + std::string trimmed_title = title; + LLStringUtil::trim(trimmed_title); const LLFontGL* font = LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF ); - LLTextBox* titlebox = new LLTextBox( "Drag Handle Title", getRect(), trimmed_title, font ); + LLTextBox* titlebox = new LLTextBox( std::string("Drag Handle Title"), getRect(), trimmed_title, font ); titlebox->setFollows(FOLLOWS_TOP | FOLLOWS_LEFT | FOLLOWS_RIGHT); titlebox->setFontStyle(LLFontGL::DROP_SHADOW_SOFT); @@ -123,22 +123,22 @@ void LLDragHandleTop::setTitle(const LLString& title) } -const LLString& LLDragHandleTop::getTitle() const +const std::string& LLDragHandleTop::getTitle() const { - return getTitleBox() == NULL ? LLString::null : getTitleBox()->getText(); + return getTitleBox() == NULL ? LLStringUtil::null : getTitleBox()->getText(); } -void LLDragHandleLeft::setTitle(const LLString& ) +void LLDragHandleLeft::setTitle(const std::string& ) { setTitleBox(NULL); /* no title on left edge */ } -const LLString& LLDragHandleLeft::getTitle() const +const std::string& LLDragHandleLeft::getTitle() const { - return LLString::null; + return LLStringUtil::null; } diff --git a/indra/llui/lldraghandle.h b/indra/llui/lldraghandle.h index 3635409ec8..c44d2a3568 100644 --- a/indra/llui/lldraghandle.h +++ b/indra/llui/lldraghandle.h @@ -44,7 +44,7 @@ class LLTextBox; class LLDragHandle : public LLView { public: - LLDragHandle(const LLString& name, const LLRect& rect, const LLString& title ); + LLDragHandle(const std::string& name, const LLRect& rect, const std::string& title ); virtual ~LLDragHandle() { setTitleBox(NULL); } virtual void setValue(const LLSD& value); @@ -55,8 +55,8 @@ public: S32 getMaxTitleWidth() const { return mMaxTitleWidth; } void setTitleVisible(BOOL visible); - virtual void setTitle( const LLString& title ) = 0; - virtual const LLString& getTitle() const = 0; + virtual void setTitle( const std::string& title ) = 0; + virtual const std::string& getTitle() const = 0; virtual BOOL handleHover(S32 x, S32 y, MASK mask); virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); @@ -88,10 +88,10 @@ class LLDragHandleTop : public LLDragHandle { public: - LLDragHandleTop(const LLString& name, const LLRect& rect, const LLString& title ); + LLDragHandleTop(const std::string& name, const LLRect& rect, const std::string& title ); - virtual void setTitle( const LLString& title ); - virtual const LLString& getTitle() const; + virtual void setTitle( const std::string& title ); + virtual const std::string& getTitle() const; virtual void draw(); virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); @@ -105,10 +105,10 @@ class LLDragHandleLeft : public LLDragHandle { public: - LLDragHandleLeft(const LLString& name, const LLRect& rect, const LLString& title ); + LLDragHandleLeft(const std::string& name, const LLRect& rect, const std::string& title ); - virtual void setTitle( const LLString& title ); - virtual const LLString& getTitle() const; + virtual void setTitle( const std::string& title ); + virtual const std::string& getTitle() const; virtual void draw(); virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index 7bb79d4973..18ffbdfbcd 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -56,14 +56,12 @@ #include "lltabcontainer.h" #include "v2math.h" -extern BOOL gNoRender; - const S32 MINIMIZED_WIDTH = 160; const S32 CLOSE_BOX_FROM_TOP = 1; // use this to control "jumping" behavior when Ctrl-Tabbing const S32 TABBED_FLOATER_OFFSET = 0; -LLString LLFloater::sButtonActiveImageNames[BUTTON_COUNT] = +std::string LLFloater::sButtonActiveImageNames[BUTTON_COUNT] = { "UIImgBtnCloseActiveUUID", //BUTTON_CLOSE "UIImgBtnRestoreActiveUUID", //BUTTON_RESTORE @@ -72,7 +70,7 @@ LLString LLFloater::sButtonActiveImageNames[BUTTON_COUNT] = "UIImgBtnCloseActiveUUID", //BUTTON_EDIT }; -LLString LLFloater::sButtonInactiveImageNames[BUTTON_COUNT] = +std::string LLFloater::sButtonInactiveImageNames[BUTTON_COUNT] = { "UIImgBtnCloseInactiveUUID", //BUTTON_CLOSE "UIImgBtnRestoreInactiveUUID", //BUTTON_RESTORE @@ -81,7 +79,7 @@ LLString LLFloater::sButtonInactiveImageNames[BUTTON_COUNT] = "UIImgBtnCloseInactiveUUID", //BUTTON_EDIT }; -LLString LLFloater::sButtonPressedImageNames[BUTTON_COUNT] = +std::string LLFloater::sButtonPressedImageNames[BUTTON_COUNT] = { "UIImgBtnClosePressedUUID", //BUTTON_CLOSE "UIImgBtnRestorePressedUUID", //BUTTON_RESTORE @@ -90,7 +88,7 @@ LLString LLFloater::sButtonPressedImageNames[BUTTON_COUNT] = "UIImgBtnClosePressedUUID", //BUTTON_EDIT }; -LLString LLFloater::sButtonNames[BUTTON_COUNT] = +std::string LLFloater::sButtonNames[BUTTON_COUNT] = { "llfloater_close_btn", //BUTTON_CLOSE "llfloater_restore_btn", //BUTTON_RESTORE @@ -99,7 +97,7 @@ LLString LLFloater::sButtonNames[BUTTON_COUNT] = "llfloater_edit_btn", //BUTTON_EDIT }; -LLString LLFloater::sButtonToolTips[BUTTON_COUNT] = +std::string LLFloater::sButtonToolTips[BUTTON_COUNT] = { #ifdef LL_DARWIN "Close (Cmd-W)", //BUTTON_CLOSE @@ -145,7 +143,7 @@ LLFloater::LLFloater() : mHandle.bind(this); } -LLFloater::LLFloater(const LLString& name) +LLFloater::LLFloater(const std::string& name) : LLPanel(name), mAutoFocus(TRUE) // automatically take focus when opened { for (S32 i = 0; i < BUTTON_COUNT; i++) @@ -153,12 +151,12 @@ LLFloater::LLFloater(const LLString& name) mButtonsEnabled[i] = FALSE; mButtons[i] = NULL; } - LLString title; // null string + std::string title; // null string initFloater(title, FALSE, DEFAULT_MIN_WIDTH, DEFAULT_MIN_HEIGHT, FALSE, TRUE, TRUE); // defaults } -LLFloater::LLFloater(const LLString& name, const LLRect& rect, const LLString& title, +LLFloater::LLFloater(const std::string& name, const LLRect& rect, const std::string& title, BOOL resizable, S32 min_width, S32 min_height, @@ -176,7 +174,7 @@ LLFloater::LLFloater(const LLString& name, const LLRect& rect, const LLString& t initFloater( title, resizable, min_width, min_height, drag_on_left, minimizable, close_btn); } -LLFloater::LLFloater(const LLString& name, const LLString& rect_control, const LLString& title, +LLFloater::LLFloater(const std::string& name, const std::string& rect_control, const std::string& title, BOOL resizable, S32 min_width, S32 min_height, @@ -196,7 +194,7 @@ LLFloater::LLFloater(const LLString& name, const LLString& rect_control, const L // Note: Floaters constructed from XML call init() twice! -void LLFloater::initFloater(const LLString& title, +void LLFloater::initFloater(const std::string& title, BOOL resizable, S32 min_width, S32 min_height, BOOL drag_on_left, BOOL minimizable, BOOL close_btn) { @@ -291,12 +289,12 @@ void LLFloater::initFloater(const LLString& title, 0, 0, DRAG_HANDLE_WIDTH, getRect().getHeight() - LLPANEL_BORDER_WIDTH - close_box_size); - mDragHandle = new LLDragHandleLeft("drag", drag_handle_rect, title ); + mDragHandle = new LLDragHandleLeft(std::string("drag"), drag_handle_rect, title ); } else // drag on top { LLRect drag_handle_rect( 0, getRect().getHeight(), getRect().getWidth(), 0 ); - mDragHandle = new LLDragHandleTop( "Drag Handle", drag_handle_rect, title ); + mDragHandle = new LLDragHandleTop( std::string("Drag Handle"), drag_handle_rect, title ); } addChild(mDragHandle); @@ -310,28 +308,28 @@ void LLFloater::initFloater(const LLString& title, // Resize bars (sides) const S32 RESIZE_BAR_THICKNESS = 3; mResizeBar[LLResizeBar::LEFT] = new LLResizeBar( - "resizebar_left", + std::string("resizebar_left"), this, LLRect( 0, getRect().getHeight(), RESIZE_BAR_THICKNESS, 0), min_width, S32_MAX, LLResizeBar::LEFT ); addChild( mResizeBar[0] ); mResizeBar[LLResizeBar::TOP] = new LLResizeBar( - "resizebar_top", + std::string("resizebar_top"), this, LLRect( 0, getRect().getHeight(), getRect().getWidth(), getRect().getHeight() - RESIZE_BAR_THICKNESS), min_height, S32_MAX, LLResizeBar::TOP ); addChild( mResizeBar[1] ); mResizeBar[LLResizeBar::RIGHT] = new LLResizeBar( - "resizebar_right", + std::string("resizebar_right"), this, LLRect( getRect().getWidth() - RESIZE_BAR_THICKNESS, getRect().getHeight(), getRect().getWidth(), 0), min_width, S32_MAX, LLResizeBar::RIGHT ); addChild( mResizeBar[2] ); mResizeBar[LLResizeBar::BOTTOM] = new LLResizeBar( - "resizebar_bottom", + std::string("resizebar_bottom"), this, LLRect( 0, RESIZE_BAR_THICKNESS, getRect().getWidth(), 0), min_height, S32_MAX, LLResizeBar::BOTTOM ); @@ -340,28 +338,29 @@ void LLFloater::initFloater(const LLString& title, // Resize handles (corners) mResizeHandle[0] = new LLResizeHandle( - "Resize Handle", + std::string("Resize Handle"), LLRect( getRect().getWidth() - RESIZE_HANDLE_WIDTH, RESIZE_HANDLE_HEIGHT, getRect().getWidth(), 0), min_width, min_height, LLResizeHandle::RIGHT_BOTTOM); addChild(mResizeHandle[0]); - mResizeHandle[1] = new LLResizeHandle( "resize", + mResizeHandle[1] = new LLResizeHandle( + std::string("resize"), LLRect( getRect().getWidth() - RESIZE_HANDLE_WIDTH, getRect().getHeight(), getRect().getWidth(), getRect().getHeight() - RESIZE_HANDLE_HEIGHT), min_width, min_height, LLResizeHandle::RIGHT_TOP ); addChild(mResizeHandle[1]); - mResizeHandle[2] = new LLResizeHandle( "resize", - LLRect( 0, RESIZE_HANDLE_HEIGHT, RESIZE_HANDLE_WIDTH, 0 ), - min_width, - min_height, - LLResizeHandle::LEFT_BOTTOM ); + mResizeHandle[2] = new LLResizeHandle( std::string("resize"), + LLRect( 0, RESIZE_HANDLE_HEIGHT, RESIZE_HANDLE_WIDTH, 0 ), + min_width, + min_height, + LLResizeHandle::LEFT_BOTTOM ); addChild(mResizeHandle[2]); - mResizeHandle[3] = new LLResizeHandle( "resize", + mResizeHandle[3] = new LLResizeHandle( std::string("resize"), LLRect( 0, getRect().getHeight(), RESIZE_HANDLE_WIDTH, getRect().getHeight() - RESIZE_HANDLE_HEIGHT ), min_width, min_height, @@ -650,7 +649,7 @@ void LLFloater::applyRectControl() } } -void LLFloater::setTitle( const LLString& title ) +void LLFloater::setTitle( const std::string& title ) { if (gNoRender) { @@ -660,21 +659,21 @@ void LLFloater::setTitle( const LLString& title ) mDragHandle->setTitle( title ); } -const LLString& LLFloater::getTitle() const +const std::string& LLFloater::getTitle() const { - return mDragHandle ? mDragHandle->getTitle() : LLString::null; + return mDragHandle ? mDragHandle->getTitle() : LLStringUtil::null; } -void LLFloater::setShortTitle( const LLString& short_title ) +void LLFloater::setShortTitle( const std::string& short_title ) { mShortTitle = short_title; } -LLString LLFloater::getShortTitle() +std::string LLFloater::getShortTitle() { if (mShortTitle.empty()) { - return mDragHandle ? mDragHandle->getTitle() : LLString::null; + return mDragHandle ? mDragHandle->getTitle() : LLStringUtil::null; } else { @@ -841,7 +840,7 @@ void LLFloater::setMinimized(BOOL minimize) mResizeHandle[i]->setEnabled(FALSE); } } - + mMinimized = TRUE; // Reshape *after* setting mMinimized @@ -890,7 +889,7 @@ void LLFloater::setMinimized(BOOL minimize) mResizeHandle[i]->setEnabled(isResizable()); } } - + mMinimized = FALSE; // Reshape *after* setting mMinimized @@ -1484,28 +1483,28 @@ void LLFloater::setCanResize(BOOL can_resize) // Resize bars (sides) const S32 RESIZE_BAR_THICKNESS = 3; mResizeBar[0] = new LLResizeBar( - "resizebar_left", + std::string("resizebar_left"), this, LLRect( 0, getRect().getHeight(), RESIZE_BAR_THICKNESS, 0), mMinWidth, S32_MAX, LLResizeBar::LEFT ); addChild( mResizeBar[0] ); mResizeBar[1] = new LLResizeBar( - "resizebar_top", + std::string("resizebar_top"), this, LLRect( 0, getRect().getHeight(), getRect().getWidth(), getRect().getHeight() - RESIZE_BAR_THICKNESS), mMinHeight, S32_MAX, LLResizeBar::TOP ); addChild( mResizeBar[1] ); mResizeBar[2] = new LLResizeBar( - "resizebar_right", + std::string("resizebar_right"), this, LLRect( getRect().getWidth() - RESIZE_BAR_THICKNESS, getRect().getHeight(), getRect().getWidth(), 0), mMinWidth, S32_MAX, LLResizeBar::RIGHT ); addChild( mResizeBar[2] ); mResizeBar[3] = new LLResizeBar( - "resizebar_bottom", + std::string("resizebar_bottom"), this, LLRect( 0, RESIZE_BAR_THICKNESS, getRect().getWidth(), 0), mMinHeight, S32_MAX, LLResizeBar::BOTTOM ); @@ -1514,28 +1513,28 @@ void LLFloater::setCanResize(BOOL can_resize) // Resize handles (corners) mResizeHandle[0] = new LLResizeHandle( - "Resize Handle", + std::string("Resize Handle"), LLRect( getRect().getWidth() - RESIZE_HANDLE_WIDTH, RESIZE_HANDLE_HEIGHT, getRect().getWidth(), 0), mMinWidth, mMinHeight, LLResizeHandle::RIGHT_BOTTOM); addChild(mResizeHandle[0]); - mResizeHandle[1] = new LLResizeHandle( "resize", + mResizeHandle[1] = new LLResizeHandle( std::string("resize"), LLRect( getRect().getWidth() - RESIZE_HANDLE_WIDTH, getRect().getHeight(), getRect().getWidth(), getRect().getHeight() - RESIZE_HANDLE_HEIGHT), mMinWidth, mMinHeight, LLResizeHandle::RIGHT_TOP ); addChild(mResizeHandle[1]); - mResizeHandle[2] = new LLResizeHandle( "resize", - LLRect( 0, RESIZE_HANDLE_HEIGHT, RESIZE_HANDLE_WIDTH, 0 ), - mMinWidth, - mMinHeight, - LLResizeHandle::LEFT_BOTTOM ); + mResizeHandle[2] = new LLResizeHandle( std::string("resize"), + LLRect( 0, RESIZE_HANDLE_HEIGHT, RESIZE_HANDLE_WIDTH, 0 ), + mMinWidth, + mMinHeight, + LLResizeHandle::LEFT_BOTTOM ); addChild(mResizeHandle[2]); - mResizeHandle[3] = new LLResizeHandle( "resize", + mResizeHandle[3] = new LLResizeHandle( std::string("resize"), LLRect( 0, getRect().getHeight(), RESIZE_HANDLE_WIDTH, getRect().getHeight() - RESIZE_HANDLE_HEIGHT ), mMinWidth, mMinHeight, @@ -1633,7 +1632,7 @@ void LLFloater::buildButtons() btn_rect, sButtonActiveImageNames[i], sButtonPressedImageNames[i], - "", + LLStringUtil::null, sButtonCallbacks[i], this, LLFontGL::sSansSerif); @@ -1657,7 +1656,7 @@ void LLFloater::buildButtons() ///////////////////////////////////////////////////// // LLFloaterView -LLFloaterView::LLFloaterView( const LLString& name, const LLRect& rect ) +LLFloaterView::LLFloaterView( const std::string& name, const LLRect& rect ) : LLUICtrl( name, rect, FALSE, NULL, NULL, FOLLOWS_ALL ), mFocusCycleMode(FALSE), mSnapOffsetBottom(0) @@ -2377,7 +2376,7 @@ LLMultiFloater::LLMultiFloater(LLTabContainer::TabPosition tab_pos) : } -LLMultiFloater::LLMultiFloater(const LLString &name) : +LLMultiFloater::LLMultiFloater(const std::string &name) : LLFloater(name), mTabContainer(NULL), mTabPos(LLTabContainer::TOP), @@ -2388,7 +2387,7 @@ LLMultiFloater::LLMultiFloater(const LLString &name) : } LLMultiFloater::LLMultiFloater( - const LLString& name, + const std::string& name, const LLRect& rect, LLTabContainer::TabPosition tab_pos, BOOL auto_resize) : @@ -2399,7 +2398,7 @@ LLMultiFloater::LLMultiFloater( mOrigMinWidth(0), mOrigMinHeight(0) { - mTabContainer = new LLTabContainer("Preview Tabs", + mTabContainer = new LLTabContainer(std::string("Preview Tabs"), LLRect(LLPANEL_BORDER_WIDTH, getRect().getHeight() - LLFLOATER_HEADER_SIZE, getRect().getWidth() - LLPANEL_BORDER_WIDTH, 0), mTabPos, FALSE, @@ -2414,8 +2413,8 @@ LLMultiFloater::LLMultiFloater( } LLMultiFloater::LLMultiFloater( - const LLString& name, - const LLString& rect_control, + const std::string& name, + const std::string& rect_control, LLTabContainer::TabPosition tab_pos, BOOL auto_resize) : LLFloater(name, rect_control, name), @@ -2425,7 +2424,7 @@ LLMultiFloater::LLMultiFloater( mOrigMinWidth(0), mOrigMinHeight(0) { - mTabContainer = new LLTabContainer("Preview Tabs", + mTabContainer = new LLTabContainer(std::string("Preview Tabs"), LLRect(LLPANEL_BORDER_WIDTH, getRect().getHeight() - LLFLOATER_HEADER_SIZE, getRect().getWidth() - LLPANEL_BORDER_WIDTH, 0), mTabPos, FALSE, @@ -2885,12 +2884,12 @@ LLXMLNodePtr LLFloater::getXML(bool save_children) const // static LLView* LLFloater::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory) { - LLString name("floater"); + std::string name("floater"); node->getAttributeString("name", name); LLFloater *floaterp = new LLFloater(name); - LLString filename; + std::string filename; node->getAttributeString("filename", filename); if (filename.empty()) @@ -2909,10 +2908,10 @@ LLView* LLFloater::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *f void LLFloater::initFloaterXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory, BOOL open) /* Flawfinder: ignore */ { - LLString name(getName()); - LLString title(getTitle()); - LLString short_title(getShortTitle()); - LLString rect_control(""); + std::string name(getName()); + std::string title(getTitle()); + std::string short_title(getShortTitle()); + std::string rect_control(""); BOOL resizable = isResizable(); S32 min_width = getMinWidth(); S32 min_height = getMinHeight(); diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h index 4e8b86d2de..cb21036ef4 100644 --- a/indra/llui/llfloater.h +++ b/indra/llui/llfloater.h @@ -86,8 +86,8 @@ public: }; LLFloater(); - LLFloater(const LLString& name); //simple constructor for data-driven initialization - LLFloater( const LLString& name, const LLRect& rect, const LLString& title, + LLFloater(const std::string& name); //simple constructor for data-driven initialization + LLFloater( const std::string& name, const LLRect& rect, const std::string& title, BOOL resizable = FALSE, S32 min_width = DEFAULT_MIN_WIDTH, S32 min_height = DEFAULT_MIN_HEIGHT, @@ -96,7 +96,7 @@ public: BOOL close_btn = TRUE, BOOL bordered = BORDER_NO); - LLFloater( const LLString& name, const LLString& rect_control, const LLString& title, + LLFloater( const std::string& name, const std::string& rect_control, const std::string& title, BOOL resizable = FALSE, S32 min_width = DEFAULT_MIN_WIDTH, S32 min_height = DEFAULT_MIN_HEIGHT, @@ -119,7 +119,7 @@ public: // Can be called multiple times to reset floater parameters. // Deletes all children of the floater. - virtual void initFloater(const LLString& title, BOOL resizable, + virtual void initFloater(const std::string& title, BOOL resizable, S32 min_width, S32 min_height, BOOL drag_on_left, BOOL minimizable, BOOL close_btn); @@ -142,10 +142,10 @@ public: LLMultiFloater* getHost() { return (LLMultiFloater*)mHostHandle.get(); } - void setTitle( const LLString& title ); - const LLString& getTitle() const; - void setShortTitle( const LLString& short_title ); - LLString getShortTitle(); + void setTitle( const std::string& title ); + const std::string& getTitle() const; + void setShortTitle( const std::string& short_title ); + std::string getShortTitle(); void setTitleVisible(bool visible); virtual void setMinimized(BOOL b); void moveResizeHandlesToFront(); @@ -246,7 +246,7 @@ private: BOOL mMinimized; BOOL mForeground; LLHandle mDependeeHandle; - LLString mShortTitle; + std::string mShortTitle; BOOL mFirstLook; // TRUE if the _next_ time this floater is visible will be the first time in the session that it is visible. @@ -272,11 +272,11 @@ private: static LLMultiFloater* sHostp; static BOOL sEditModeEnabled; - static LLString sButtonActiveImageNames[BUTTON_COUNT]; - static LLString sButtonInactiveImageNames[BUTTON_COUNT]; - static LLString sButtonPressedImageNames[BUTTON_COUNT]; - static LLString sButtonNames[BUTTON_COUNT]; - static LLString sButtonToolTips[BUTTON_COUNT]; + static std::string sButtonActiveImageNames[BUTTON_COUNT]; + static std::string sButtonInactiveImageNames[BUTTON_COUNT]; + static std::string sButtonPressedImageNames[BUTTON_COUNT]; + static std::string sButtonNames[BUTTON_COUNT]; + static std::string sButtonToolTips[BUTTON_COUNT]; typedef void (*click_callback)(void *); static click_callback sButtonCallbacks[BUTTON_COUNT]; @@ -301,7 +301,7 @@ private: class LLFloaterView : public LLUICtrl { public: - LLFloaterView( const LLString& name, const LLRect& rect ); + LLFloaterView( const std::string& name, const LLRect& rect ); /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); void reshapeFloater(S32 width, S32 height, BOOL called_from_parent, BOOL adjust_vertical); @@ -361,9 +361,9 @@ class LLMultiFloater : public LLFloater public: LLMultiFloater(); LLMultiFloater(LLTabContainer::TabPosition tab_pos); - LLMultiFloater(const LLString& name); - LLMultiFloater(const LLString& name, const LLRect& rect, LLTabContainer::TabPosition tab_pos = LLTabContainer::TOP, BOOL auto_resize = TRUE); - LLMultiFloater(const LLString& name, const LLString& rect_control, LLTabContainer::TabPosition tab_pos = LLTabContainer::TOP, BOOL auto_resize = TRUE); + LLMultiFloater(const std::string& name); + LLMultiFloater(const std::string& name, const LLRect& rect, LLTabContainer::TabPosition tab_pos = LLTabContainer::TOP, BOOL auto_resize = TRUE); + LLMultiFloater(const std::string& name, const std::string& rect_control, LLTabContainer::TabPosition tab_pos = LLTabContainer::TOP, BOOL auto_resize = TRUE); virtual ~LLMultiFloater() {}; virtual BOOL postBuild(); diff --git a/indra/llui/llfocusmgr.cpp b/indra/llui/llfocusmgr.cpp index 621b01ad82..fce84eb2e8 100644 --- a/indra/llui/llfocusmgr.cpp +++ b/indra/llui/llfocusmgr.cpp @@ -120,7 +120,7 @@ void LLFocusMgr::setKeyboardFocus(LLUICtrl* new_focus, BOOL lock, BOOL keystroke mFocusTimer.reset(); #ifdef _DEBUG - mKeyboardFocusName = new_focus ? new_focus->getName() : "none"; + mKeyboardFocusName = new_focus ? new_focus->getName() : std::string("none"); #endif // If we've got a default keyboard focus, and the caller is @@ -202,7 +202,7 @@ void LLFocusMgr::removeKeyboardFocusWithoutCallback( const LLView* focus ) { mKeyboardFocus = NULL; #ifdef _DEBUG - mKeyboardFocusName = "none"; + mKeyboardFocusName = std::string("none"); #endif } } @@ -243,7 +243,7 @@ void LLFocusMgr::setMouseCapture( LLMouseHandler* new_captor ) } #ifdef _DEBUG - mMouseCaptorName = new_captor ? new_captor->getName() : "none"; + mMouseCaptorName = new_captor ? new_captor->getName() : std::string("none"); #endif } } @@ -258,7 +258,7 @@ void LLFocusMgr::removeMouseCaptureWithoutCallback( const LLMouseHandler* captor { mMouseCaptor = NULL; #ifdef _DEBUG - mMouseCaptorName = "none"; + mMouseCaptorName = std::string("none"); #endif } } @@ -289,7 +289,7 @@ void LLFocusMgr::setTopCtrl( LLUICtrl* new_top ) mTopCtrl = new_top; #ifdef _DEBUG - mTopCtrlName = new_top ? new_top->getName() : "none"; + mTopCtrlName = new_top ? new_top->getName() : std::string("none"); #endif if (old_top) @@ -305,7 +305,7 @@ void LLFocusMgr::removeTopCtrlWithoutCallback( const LLUICtrl* top_view ) { mTopCtrl = NULL; #ifdef _DEBUG - mTopCtrlName = "none"; + mTopCtrlName = std::string("none"); #endif } } diff --git a/indra/llui/llfocusmgr.h b/indra/llui/llfocusmgr.h index 34651160f1..3cb45b73ca 100644 --- a/indra/llui/llfocusmgr.h +++ b/indra/llui/llfocusmgr.h @@ -114,9 +114,9 @@ private: focus_history_map_t mFocusHistory; #ifdef _DEBUG - LLString mMouseCaptorName; - LLString mKeyboardFocusName; - LLString mTopCtrlName; + std::string mMouseCaptorName; + std::string mKeyboardFocusName; + std::string mTopCtrlName; #endif }; diff --git a/indra/llui/lliconctrl.cpp b/indra/llui/lliconctrl.cpp index df37532d60..2638bdc3e5 100644 --- a/indra/llui/lliconctrl.cpp +++ b/indra/llui/lliconctrl.cpp @@ -44,7 +44,7 @@ const F32 RESOLUTION_BUMP = 1.f; static LLRegisterWidget r("icon"); -LLIconCtrl::LLIconCtrl(const LLString& name, const LLRect &rect, const LLUUID &image_id) +LLIconCtrl::LLIconCtrl(const std::string& name, const LLRect &rect, const LLUUID &image_id) : LLUICtrl(name, rect, FALSE, // mouse opaque @@ -56,7 +56,7 @@ LLIconCtrl::LLIconCtrl(const LLString& name, const LLRect &rect, const LLUUID &i setTabStop(FALSE); } -LLIconCtrl::LLIconCtrl(const LLString& name, const LLRect &rect, const LLString &image_name) +LLIconCtrl::LLIconCtrl(const std::string& name, const LLRect &rect, const std::string &image_name) : LLUICtrl(name, rect, FALSE, // mouse opaque @@ -76,7 +76,7 @@ LLIconCtrl::~LLIconCtrl() } -void LLIconCtrl::setImage(const LLString& image_name) +void LLIconCtrl::setImage(const std::string& image_name) { //RN: support UUIDs masquerading as strings if (LLUUID::validate(image_name)) @@ -148,13 +148,13 @@ LLXMLNodePtr LLIconCtrl::getXML(bool save_children) const LLView* LLIconCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory) { - LLString name("icon"); + std::string name("icon"); node->getAttributeString("name", name); LLRect rect; createRect(node, rect, parent, LLRect()); - LLString image_name; + std::string image_name; if (node->hasAttribute("image_name")) { node->getAttributeString("image_name", image_name); diff --git a/indra/llui/lliconctrl.h b/indra/llui/lliconctrl.h index 33429c580e..f1b3a7e03f 100644 --- a/indra/llui/lliconctrl.h +++ b/indra/llui/lliconctrl.h @@ -48,17 +48,17 @@ class LLIconCtrl : public LLUICtrl { public: - LLIconCtrl(const LLString& name, const LLRect &rect, const LLUUID &image_id); - LLIconCtrl(const LLString& name, const LLRect &rect, const LLString &image_name); + LLIconCtrl(const std::string& name, const LLRect &rect, const LLUUID &image_id); + LLIconCtrl(const std::string& name, const LLRect &rect, const std::string &image_name); virtual ~LLIconCtrl(); // llview overrides virtual void draw(); - void setImage(const LLString& image_name); + void setImage(const std::string& image_name); void setImage(const LLUUID& image_name); const LLUUID &getImage() const { return mImageID; } - LLString getImageName() const { return mImageName; } + std::string getImageName() const { return mImageName; } // Takes a UUID, wraps get/setImage virtual void setValue(const LLSD& value ); @@ -71,7 +71,7 @@ public: private: LLColor4 mColor; - LLString mImageName; + std::string mImageName; LLUUID mImageID; LLPointer mImagep; }; diff --git a/indra/llui/llkeywords.cpp b/indra/llui/llkeywords.cpp index a81e26f880..e6a87b496c 100644 --- a/indra/llui/llkeywords.cpp +++ b/indra/llui/llkeywords.cpp @@ -69,7 +69,7 @@ LLKeywords::~LLKeywords() std::for_each(mDelimiterTokenList.begin(), mDelimiterTokenList.end(), DeletePointer()); } -BOOL LLKeywords::loadFromFile( const LLString& filename ) +BOOL LLKeywords::loadFromFile( const std::string& filename ) { mLoaded = FALSE; @@ -80,7 +80,7 @@ BOOL LLKeywords::loadFromFile( const LLString& filename ) char buffer[BUFFER_SIZE]; /* Flawfinder: ignore */ llifstream file; - file.open(filename.c_str()); /* Flawfinder: ignore */ + file.open(filename); /* Flawfinder: ignore */ if( file.fail() ) { llinfos << "LLKeywords::loadFromFile() Unable to open file: " << filename << llendl; @@ -106,52 +106,51 @@ BOOL LLKeywords::loadFromFile( const LLString& filename ) } // start of line (SOL) - const char SOL_COMMENT[] = "#"; - const char SOL_WORD[] = "[word "; - const char SOL_LINE[] = "[line "; - const char SOL_ONE_SIDED_DELIMITER[] = "[one_sided_delimiter "; - const char SOL_TWO_SIDED_DELIMITER[] = "[two_sided_delimiter "; + std::string SOL_COMMENT("#"); + std::string SOL_WORD("[word "); + std::string SOL_LINE("[line "); + std::string SOL_ONE_SIDED_DELIMITER("[one_sided_delimiter "); + std::string SOL_TWO_SIDED_DELIMITER("[two_sided_delimiter "); LLColor3 cur_color( 1, 0, 0 ); LLKeywordToken::TOKEN_TYPE cur_type = LLKeywordToken::WORD; while (!file.eof()) { + buffer[0] = 0; file.getline( buffer, BUFFER_SIZE ); - if( !strncmp( buffer, SOL_COMMENT, strlen(SOL_COMMENT) ) ) /* Flawfinder: ignore */ + std::string line(buffer); + if( line.find(SOL_COMMENT) == 0 ) { continue; } - else - if( !strncmp( buffer, SOL_WORD, strlen(SOL_WORD) ) ) /* Flawfinder: ignore */ + else if( line.find(SOL_WORD) == 0 ) { - cur_color = readColor( buffer + strlen(SOL_WORD) ); /* Flawfinder: ignore */ + cur_color = readColor( line.substr(SOL_WORD.size()) ); cur_type = LLKeywordToken::WORD; continue; } - else - if( !strncmp( buffer, SOL_LINE, strlen(SOL_LINE) ) ) /* Flawfinder: ignore */ + else if( line.find(SOL_LINE) == 0 ) { - cur_color = readColor( buffer + strlen(SOL_LINE) ); /* Flawfinder: ignore */ + cur_color = readColor( line.substr(SOL_LINE.size()) ); cur_type = LLKeywordToken::LINE; continue; } - else - if( !strncmp( buffer, SOL_TWO_SIDED_DELIMITER, strlen(SOL_TWO_SIDED_DELIMITER) ) ) /* Flawfinder: ignore */ + else if( line.find(SOL_TWO_SIDED_DELIMITER) == 0 ) { - cur_color = readColor( buffer + strlen(SOL_TWO_SIDED_DELIMITER) ); /* Flawfinder: ignore */ + cur_color = readColor( line.substr(SOL_TWO_SIDED_DELIMITER.size()) ); cur_type = LLKeywordToken::TWO_SIDED_DELIMITER; continue; } - if( !strncmp( buffer, SOL_ONE_SIDED_DELIMITER, strlen(SOL_ONE_SIDED_DELIMITER) ) ) /* Flawfinder: ignore */ + else if( line.find(SOL_ONE_SIDED_DELIMITER) == 0 ) { - cur_color = readColor( buffer + strlen(SOL_ONE_SIDED_DELIMITER) ); /* Flawfinder: ignore */ + cur_color = readColor( line.substr(SOL_ONE_SIDED_DELIMITER.size()) ); cur_type = LLKeywordToken::ONE_SIDED_DELIMITER; continue; } - LLString token_buffer( buffer ); - LLString::trim(token_buffer); + std::string token_buffer( line ); + LLStringUtil::trim(token_buffer); typedef boost::tokenizer > tokenizer; boost::char_separator sep_word("", " \t"); @@ -161,26 +160,26 @@ BOOL LLKeywords::loadFromFile( const LLString& filename ) if( !token_buffer.empty() && token_word_iter != word_tokens.end() ) { // first word is keyword - LLString keyword = (*token_word_iter); - LLString::trim(keyword); + std::string keyword = (*token_word_iter); + LLStringUtil::trim(keyword); // following words are tooltip - LLString tool_tip; + std::string tool_tip; while (++token_word_iter != word_tokens.end()) { tool_tip += (*token_word_iter); } - LLString::trim(tool_tip); + LLStringUtil::trim(tool_tip); if( !tool_tip.empty() ) { // Replace : with \n for multi-line tool tips. - LLString::replaceChar( tool_tip, ':', '\n' ); + LLStringUtil::replaceChar( tool_tip, ':', '\n' ); addToken(cur_type, keyword, cur_color, tool_tip ); } else { - addToken(cur_type, keyword, cur_color, NULL ); + addToken(cur_type, keyword, cur_color, LLStringUtil::null ); } } } @@ -193,9 +192,9 @@ BOOL LLKeywords::loadFromFile( const LLString& filename ) // Add the token as described void LLKeywords::addToken(LLKeywordToken::TOKEN_TYPE type, - const LLString& key_in, + const std::string& key_in, const LLColor3& color, - const LLString& tool_tip_in ) + const std::string& tool_tip_in ) { LLWString key = utf8str_to_wstring(key_in); LLWString tool_tip = utf8str_to_wstring(tool_tip_in); @@ -219,7 +218,7 @@ void LLKeywords::addToken(LLKeywordToken::TOKEN_TYPE type, } } -LLColor3 LLKeywords::readColor( const LLString& s ) +LLColor3 LLKeywords::readColor( const std::string& s ) { F32 r, g, b; r = g = b = 0.0f; @@ -296,7 +295,6 @@ void LLKeywords::findSegments(std::vector* seg_list, const LLWS } S32 seg_end = cur - base; - //llinfos << "Seg: [" << (char*)LLString( base, seg_start, seg_end-seg_start) << "]" << llendl; LLTextSegment* text_segment = new LLTextSegment( cur_token->getColor(), seg_start, seg_end ); text_segment->setToken( cur_token ); insertSegment( seg_list, text_segment, text_len, defaultColor); @@ -406,7 +404,6 @@ void LLKeywords::findSegments(std::vector* seg_list, const LLWS } - //llinfos << "Seg: [" << (char*)LLString( base, seg_start, seg_end-seg_start ) << "]" << llendl; LLTextSegment* text_segment = new LLTextSegment( cur_delimiter->getColor(), seg_start, seg_end ); text_segment->setToken( cur_delimiter ); insertSegment( seg_list, text_segment, text_len, defaultColor); @@ -518,7 +515,7 @@ void LLKeywordToken::dump() mColor.mV[VX] << ", " << mColor.mV[VY] << ", " << mColor.mV[VZ] << "] [" << - mToken.c_str() << "]" << + wstring_to_utf8str(mToken) << "]" << llendl; } diff --git a/indra/llui/llkeywords.h b/indra/llui/llkeywords.h index fe36d7cbf6..ec01db76a8 100644 --- a/indra/llui/llkeywords.h +++ b/indra/llui/llkeywords.h @@ -80,16 +80,16 @@ public: LLKeywords(); ~LLKeywords(); - BOOL loadFromFile(const LLString& filename); + BOOL loadFromFile(const std::string& filename); BOOL isLoaded() const { return mLoaded; } void findSegments(std::vector *seg_list, const LLWString& text, const LLColor4 &defaultColor ); // Add the token as described void addToken(LLKeywordToken::TOKEN_TYPE type, - const LLString& key, + const std::string& key, const LLColor3& color, - const LLString& tool_tip = LLString::null); + const std::string& tool_tip = LLStringUtil::null); typedef std::map word_token_map_t; typedef word_token_map_t::const_iterator keyword_iterator_t; @@ -101,7 +101,7 @@ public: #endif private: - LLColor3 readColor(const LLString& s); + LLColor3 readColor(const std::string& s); void insertSegment(std::vector *seg_list, LLTextSegment* new_segment, S32 text_len, const LLColor4 &defaultColor); BOOL mLoaded; diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp index 96039ce943..2655918169 100644 --- a/indra/llui/lllineeditor.cpp +++ b/indra/llui/lllineeditor.cpp @@ -87,8 +87,8 @@ static LLRegisterWidget r1("line_editor"); // Member functions // -LLLineEditor::LLLineEditor(const LLString& name, const LLRect& rect, - const LLString& default_text, const LLFontGL* font, +LLLineEditor::LLLineEditor(const std::string& name, const LLRect& rect, + const std::string& default_text, const LLFontGL* font, S32 max_length_bytes, void (*commit_callback)(LLUICtrl* caller, void* user_data ), void (*keystroke_callback)(LLLineEditor* caller, void* user_data ), @@ -166,7 +166,7 @@ LLLineEditor::LLLineEditor(const LLString& name, const LLRect& rect, // Scalable UI somehow made these rectangles off-by-one. // I don't know why. JC LLRect border_rect(0, getRect().getHeight()-1, getRect().getWidth()-1, 0); - mBorder = new LLViewBorder( "line ed border", border_rect, border_bevel, border_style, mBorderThickness ); + mBorder = new LLViewBorder( std::string("line ed border"), border_rect, border_bevel, border_style, mBorderThickness ); addChild( mBorder ); mBorder->setFollows(FOLLOWS_LEFT|FOLLOWS_RIGHT|FOLLOWS_TOP|FOLLOWS_BOTTOM); @@ -298,7 +298,7 @@ void LLLineEditor::setText(const LLStringExplicit &new_text) // also consider entire string selected when mSelectAllonFocusReceived is set on an empty, focused line editor all_selected = all_selected || (len == 0 && hasFocus() && mSelectAllonFocusReceived); - LLString truncated_utf8 = new_text; + std::string truncated_utf8 = new_text; if (truncated_utf8.size() > (U32)mMaxLengthBytes) { truncated_utf8 = utf8str_truncate(new_text, mMaxLengthBytes); @@ -959,9 +959,9 @@ void LLLineEditor::paste() // Clean up string (replace tabs and returns and remove characters that our fonts don't support.) LLWString clean_string(paste); - LLWString::replaceTabsWithSpaces(clean_string, 1); + LLWStringUtil::replaceTabsWithSpaces(clean_string, 1); //clean_string = wstring_detabify(paste, 1); - LLWString::replaceChar(clean_string, '\n', mReplaceNewlinesWithSpaces ? ' ' : 182); // 182 == paragraph character + LLWStringUtil::replaceChar(clean_string, '\n', mReplaceNewlinesWithSpaces ? ' ' : 182); // 182 == paragraph character // Insert the string @@ -1395,11 +1395,11 @@ void LLLineEditor::draw() { S32 text_len = mText.length(); - LLString saved_text; + std::string saved_text; if (mDrawAsterixes) { saved_text = mText.getString(); - LLString text; + std::string text; for (S32 i = 0; i < mText.length(); i++) { text += '*'; @@ -1594,7 +1594,7 @@ void LLLineEditor::draw() S32 cursor_right = cursor_left + UI_LINEEDITOR_CURSOR_THICKNESS; if (LL_KIM_OVERWRITE == gKeyboard->getInsertMode() && !hasSelection()) { - const LLWString space(utf8str_to_wstring(LLString(" "))); + const LLWString space(utf8str_to_wstring(std::string(" "))); S32 wswidth = mGLFont->getWidth(space.c_str()); S32 width = mGLFont->getWidth(mText.getWString().c_str(), getCursor(), 1) + 1; cursor_right = cursor_left + llmax(wswidth, width); @@ -1771,7 +1771,7 @@ BOOL LLLineEditor::prevalidateFloat(const LLWString &str) BOOL success = TRUE; LLWString trimmed = str; - LLWString::trim(trimmed); + LLWStringUtil::trim(trimmed); S32 len = trimmed.length(); if( 0 < len ) { @@ -1803,7 +1803,7 @@ BOOL LLLineEditor::prevalidateFloat(const LLWString &str) BOOL LLLineEditor::isPartOfWord(llwchar c) { return (c == '_') || isalnum(c); } // static -BOOL LLLineEditor::postvalidateFloat(const LLString &str) +BOOL LLLineEditor::postvalidateFloat(const std::string &str) { LLLocale locale(LLLocale::USER_LOCALE); @@ -1812,7 +1812,7 @@ BOOL LLLineEditor::postvalidateFloat(const LLString &str) BOOL has_digit = FALSE; LLWString trimmed = utf8str_to_wstring(str); - LLWString::trim(trimmed); + LLWStringUtil::trim(trimmed); S32 len = trimmed.length(); if( 0 < len ) { @@ -1872,7 +1872,7 @@ BOOL LLLineEditor::prevalidateInt(const LLWString &str) BOOL success = TRUE; LLWString trimmed = str; - LLWString::trim(trimmed); + LLWStringUtil::trim(trimmed); S32 len = trimmed.length(); if( 0 < len ) { @@ -1903,7 +1903,7 @@ BOOL LLLineEditor::prevalidatePositiveS32(const LLWString &str) LLLocale locale(LLLocale::USER_LOCALE); LLWString trimmed = str; - LLWString::trim(trimmed); + LLWStringUtil::trim(trimmed); S32 len = trimmed.length(); BOOL success = TRUE; if(0 < len) @@ -1937,7 +1937,7 @@ BOOL LLLineEditor::prevalidateNonNegativeS32(const LLWString &str) LLLocale locale(LLLocale::USER_LOCALE); LLWString trimmed = str; - LLWString::trim(trimmed); + LLWStringUtil::trim(trimmed); S32 len = trimmed.length(); BOOL success = TRUE; if(0 < len) @@ -2092,7 +2092,7 @@ LLXMLNodePtr LLLineEditor::getXML(bool save_children) const if (mBorder) { - LLString bevel; + std::string bevel; switch(mBorder->getBevel()) { default: @@ -2103,7 +2103,7 @@ LLXMLNodePtr LLLineEditor::getXML(bool save_children) const } node->createChild("bevel_style", TRUE)->setStringValue(bevel); - LLString style; + std::string style; switch(mBorder->getStyle()) { default: @@ -2140,7 +2140,7 @@ LLXMLNodePtr LLLineEditor::getXML(bool save_children) const // static LLView* LLLineEditor::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory) { - LLString name("line_editor"); + std::string name("line_editor"); node->getAttributeString("name", name); LLRect rect; @@ -2151,15 +2151,15 @@ LLView* LLLineEditor::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory LLFontGL* font = LLView::selectFont(node); - LLString text = node->getTextContents().substr(0, max_text_length - 1); + std::string text = node->getTextContents().substr(0, max_text_length - 1); LLViewBorder::EBevel bevel_style = LLViewBorder::BEVEL_IN; LLViewBorder::getBevelFromAttribute(node, bevel_style); LLViewBorder::EStyle border_style = LLViewBorder::STYLE_LINE; - LLString border_string; + std::string border_string; node->getAttributeString("border_style", border_string); - LLString::toLower(border_string); + LLStringUtil::toLower(border_string); if (border_string == "texture") { @@ -2185,7 +2185,7 @@ LLView* LLLineEditor::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory border_style, border_thickness); - LLString label; + std::string label; if(node->getAttributeString("label", label)) { line_editor->setLabel(label); @@ -2215,10 +2215,10 @@ LLView* LLLineEditor::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory line_editor->setSelectAllonFocusReceived(selectall); } - LLString prevalidate; + std::string prevalidate; if(node->getAttributeString("prevalidate", prevalidate)) { - LLString::toLower(prevalidate); + LLStringUtil::toLower(prevalidate); if ("ascii" == prevalidate) { @@ -2270,11 +2270,11 @@ void LLLineEditor::cleanupClass() } /* static */ -LLPointer LLLineEditor::parseImage(LLString name, LLXMLNodePtr from, LLPointer def) +LLPointer LLLineEditor::parseImage(std::string name, LLXMLNodePtr from, LLPointer def) { - LLString xml_name; - if (from->hasAttribute(name)) from->getAttributeString(name, xml_name); - if (xml_name == LLString::null) return def; + std::string xml_name; + if (from->hasAttribute(name.c_str())) from->getAttributeString(name.c_str(), xml_name); + if (xml_name == LLStringUtil::null) return def; LLPointer image = LLUI::getUIImage(xml_name); return image.isNull() ? def : image; } @@ -2282,7 +2282,7 @@ LLPointer LLLineEditor::parseImage(LLString name, LLXMLNodePtr from, void LLLineEditor::setColorParameters(LLXMLNodePtr node) { // overrides default image if supplied. - mImage = parseImage("image", node, mImage); + mImage = parseImage(std::string("image"), node, mImage); LLColor4 color; if (LLUICtrlFactory::getAttributeColor(node,"cursor_color", color)) @@ -2315,13 +2315,13 @@ void LLLineEditor::setColorParameters(LLXMLNodePtr node) } } -BOOL LLLineEditor::setTextArg( const LLString& key, const LLStringExplicit& text ) +BOOL LLLineEditor::setTextArg( const std::string& key, const LLStringExplicit& text ) { mText.setArg(key, text); return TRUE; } -BOOL LLLineEditor::setLabelArg( const LLString& key, const LLStringExplicit& text ) +BOOL LLLineEditor::setLabelArg( const std::string& key, const LLStringExplicit& text ) { mLabel.setArg(key, text); return TRUE; @@ -2555,25 +2555,25 @@ void LLLineEditor::setReplaceNewlinesWithSpaces(BOOL replace) static LLRegisterWidget r2("search_editor"); -LLSearchEditor::LLSearchEditor(const LLString& name, +LLSearchEditor::LLSearchEditor(const std::string& name, const LLRect& rect, S32 max_length_bytes, - void (*search_callback)(const LLString& search_string, void* user_data), + void (*search_callback)(const std::string& search_string, void* user_data), void* userdata) : LLUICtrl(name, rect, TRUE, NULL, userdata), mSearchCallback(search_callback) { LLRect search_edit_rect(0, getRect().getHeight(), getRect().getWidth(), 0); - mSearchEdit = new LLLineEditor("search edit", - search_edit_rect, - LLString::null, - NULL, - max_length_bytes, - NULL, - onSearchEdit, - NULL, - this); + mSearchEdit = new LLLineEditor(std::string("search edit"), + search_edit_rect, + LLStringUtil::null, + NULL, + max_length_bytes, + NULL, + onSearchEdit, + NULL, + this); mSearchEdit->setFollowsAll(); mSearchEdit->setSelectAllonFocusReceived(TRUE); @@ -2582,15 +2582,15 @@ LLSearchEditor::LLSearchEditor(const LLString& name, S32 btn_width = rect.getHeight(); // button is square, and as tall as search editor LLRect clear_btn_rect(rect.getWidth() - btn_width, rect.getHeight(), rect.getWidth(), 0); - mClearSearchButton = new LLButton("clear search", + mClearSearchButton = new LLButton(std::string("clear search"), clear_btn_rect, - "icn_clear_lineeditor.tga", - "UIImgBtnCloseInactiveUUID", - LLString::null, + std::string("icn_clear_lineeditor.tga"), + std::string("UIImgBtnCloseInactiveUUID"), + LLStringUtil::null, onClearSearch, this, NULL, - LLString::null); + LLStringUtil::null); mClearSearchButton->setFollowsRight(); mClearSearchButton->setFollowsTop(); mClearSearchButton->setImageColor(LLUI::sColorsGroup->getColor("TextFgTentativeColor")); @@ -2614,13 +2614,13 @@ LLSD LLSearchEditor::getValue() const } //virtual -BOOL LLSearchEditor::setTextArg( const LLString& key, const LLStringExplicit& text ) +BOOL LLSearchEditor::setTextArg( const std::string& key, const LLStringExplicit& text ) { return mSearchEdit->setTextArg(key, text); } //virtual -BOOL LLSearchEditor::setLabelArg( const LLString& key, const LLStringExplicit& text ) +BOOL LLSearchEditor::setLabelArg( const std::string& key, const LLStringExplicit& text ) { return mSearchEdit->setLabelArg(key, text); } @@ -2657,17 +2657,17 @@ void LLSearchEditor::onClearSearch(void* user_data) { LLSearchEditor* search_editor = (LLSearchEditor*)user_data; - search_editor->setText(LLString::null); + search_editor->setText(LLStringUtil::null); if (search_editor->mSearchCallback) { - search_editor->mSearchCallback(LLString::null, search_editor->mCallbackUserData); + search_editor->mSearchCallback(LLStringUtil::null, search_editor->mCallbackUserData); } } // static LLView* LLSearchEditor::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory) { - LLString name("search_editor"); + std::string name("search_editor"); node->getAttributeString("name", name); LLRect rect; @@ -2676,14 +2676,14 @@ LLView* LLSearchEditor::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFacto S32 max_text_length = 128; node->getAttributeS32("max_length", max_text_length); - LLString text = node->getValue().substr(0, max_text_length - 1); + std::string text = node->getValue().substr(0, max_text_length - 1); LLSearchEditor* search_editor = new LLSearchEditor(name, rect, max_text_length, NULL, NULL); - LLString label; + std::string label; if(node->getAttributeString("label", label)) { search_editor->mSearchEdit->setLabel(label); diff --git a/indra/llui/lllineeditor.h b/indra/llui/lllineeditor.h index 8b41dd1d87..8bf7613c79 100644 --- a/indra/llui/lllineeditor.h +++ b/indra/llui/lllineeditor.h @@ -63,9 +63,9 @@ class LLLineEditor { public: - LLLineEditor(const LLString& name, + LLLineEditor(const std::string& name, const LLRect& rect, - const LLString& default_text = LLString::null, + const std::string& default_text = LLStringUtil::null, const LLFontGL* glfont = NULL, S32 max_length_bytes = 254, void (*commit_callback)(LLUICtrl* caller, void* user_data) = NULL, @@ -132,13 +132,13 @@ public: // assumes UTF8 text virtual void setValue(const LLSD& value ) { setText(value.asString()); } virtual LLSD getValue() const { return LLSD(getText()); } - virtual BOOL setTextArg( const LLString& key, const LLStringExplicit& text ); - virtual BOOL setLabelArg( const LLString& key, const LLStringExplicit& text ); + virtual BOOL setTextArg( const std::string& key, const LLStringExplicit& text ); + virtual BOOL setLabelArg( const std::string& key, const LLStringExplicit& text ); void setLabel(const LLStringExplicit &new_label) { mLabel = new_label; } void setText(const LLStringExplicit &new_text); - const LLString& getText() const { return mText.getString(); } + const std::string& getText() const { return mText.getString(); } const LLWString& getWText() const { return mText.getWString(); } S32 getLength() const { return mText.length(); } @@ -205,7 +205,7 @@ public: static BOOL prevalidatePrintableNoSpace(const LLWString &str); static BOOL prevalidateASCII(const LLWString &str); - static BOOL postvalidateFloat(const LLString &str); + static BOOL postvalidateFloat(const std::string &str); // line history support: void setEnableLineHistory( BOOL enabled ) { mHaveHistory = enabled; } // switches line history on or off @@ -242,12 +242,12 @@ private: protected: LLUIString mText; // The string being edited. - LLString mPrevText; // Saved string for 'ESC' revert + std::string mPrevText; // Saved string for 'ESC' revert LLUIString mLabel; // text label that is visible when no user text provided // line history support: BOOL mHaveHistory; // flag for enabled line history - std::vector mLineHistory; // line history storage + std::vector mLineHistory; // line history storage U32 mCurrentHistoryLine; // currently browsed history line LLViewBorder* mBorder; @@ -307,7 +307,7 @@ protected: private: // Utility on top of LLUI::getUIImage, looks up a named image in a given XML node and returns it if possible // or returns a given default image if anything in the process fails. - static LLPointer parseImage(LLString name, LLXMLNodePtr from, LLPointer def); + static LLPointer parseImage(std::string name, LLXMLNodePtr from, LLPointer def); // Global instance used as default for member instance below. static LLPointer sImage; // Instances that by default point to the statics but can be overidden in XML. @@ -341,10 +341,10 @@ private: ed->mPrevText = mText; } - LLString getText() { return mText; } + std::string getText() { return mText; } private: - LLString mText; + std::string mText; S32 mCursorPos; S32 mScrollHPos; BOOL mIsSelecting; @@ -362,10 +362,10 @@ private: class LLSearchEditor : public LLUICtrl { public: - LLSearchEditor(const LLString& name, + LLSearchEditor(const std::string& name, const LLRect& rect, S32 max_length_bytes, - void (*search_callback)(const LLString& search_string, void* user_data), + void (*search_callback)(const std::string& search_string, void* user_data), void* userdata); virtual ~LLSearchEditor() {} @@ -376,13 +376,13 @@ public: void setText(const LLStringExplicit &new_text) { mSearchEdit->setText(new_text); } - void setSearchCallback(void (*search_callback)(const LLString& search_string, void* user_data), void* data) { mSearchCallback = search_callback; mCallbackUserData = data; } + void setSearchCallback(void (*search_callback)(const std::string& search_string, void* user_data), void* data) { mSearchCallback = search_callback; mCallbackUserData = data; } // LLUICtrl interface virtual void setValue(const LLSD& value ); virtual LLSD getValue() const; - virtual BOOL setTextArg( const LLString& key, const LLStringExplicit& text ); - virtual BOOL setLabelArg( const LLString& key, const LLStringExplicit& text ); + virtual BOOL setTextArg( const std::string& key, const LLStringExplicit& text ); + virtual BOOL setLabelArg( const std::string& key, const LLStringExplicit& text ); virtual void clear(); private: @@ -391,7 +391,7 @@ private: LLLineEditor* mSearchEdit; class LLButton* mClearSearchButton; - void (*mSearchCallback)(const LLString& search_string, void* user_data); + void (*mSearchCallback)(const std::string& search_string, void* user_data); }; diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp index 62b86a6ad7..fba0984dce 100644 --- a/indra/llui/llmenugl.cpp +++ b/indra/llui/llmenugl.cpp @@ -74,10 +74,10 @@ S32 MENU_BAR_WIDTH = 0; /// Local function declarations, constants, enums, and typedefs ///============================================================================ -const LLString SEPARATOR_NAME("separator"); -const LLString TEAROFF_SEPARATOR_LABEL( "~~~~~~~~~~~" ); -const LLString SEPARATOR_LABEL( "-----------" ); -const LLString VERTICAL_SEPARATOR_LABEL( "|" ); +const std::string SEPARATOR_NAME("separator"); +const std::string TEAROFF_SEPARATOR_LABEL( "~~~~~~~~~~~" ); +const std::string SEPARATOR_LABEL( "-----------" ); +const std::string VERTICAL_SEPARATOR_LABEL( "|" ); const S32 LABEL_BOTTOM_PAD_PIXELS = 2; @@ -98,10 +98,10 @@ const U32 SEPARATOR_HEIGHT_PIXELS = 8; const S32 TEAROFF_SEPARATOR_HEIGHT_PIXELS = 10; const S32 MENU_ITEM_PADDING = 4; -const LLString BOOLEAN_TRUE_PREFIX( "X" ); -const LLString BRANCH_SUFFIX( ">" ); -const LLString ARROW_UP ("^^^^^^^"); -const LLString ARROW_DOWN("vvvvvvv"); +const std::string BOOLEAN_TRUE_PREFIX( "X" ); +const std::string BRANCH_SUFFIX( ">" ); +const std::string ARROW_UP ("^^^^^^^"); +const std::string ARROW_DOWN("vvvvvvv"); const F32 MAX_MOUSE_SLOPE_SUB_MENU = 0.9f; @@ -130,7 +130,7 @@ const F32 ACTIVATE_HIGHLIGHT_TIME = 0.3f; ///============================================================================ // Default constructor -LLMenuItemGL::LLMenuItemGL( const LLString& name, const LLString& label, KEY key, MASK mask ) : +LLMenuItemGL::LLMenuItemGL( const std::string& name, const std::string& label, KEY key, MASK mask ) : LLView( name, TRUE ), mJumpKey(KEY_NONE), mAcceleratorKey( key ), @@ -220,7 +220,7 @@ BOOL LLMenuItemGL::addToAcceleratorList(std::list *listp) // *NOTE: get calling code to throw up warning or route // warning messages back to app-provided output - // LLString warning; + // std::string warning; // warning.append("Duplicate key binding <"); // appendAcceleratorString( warning ); // warning.append("> for menu items:\n "); @@ -250,7 +250,7 @@ BOOL LLMenuItemGL::addToAcceleratorList(std::list *listp) // This function appends the character string representation of // the current accelerator key and mask to the provided string. -void LLMenuItemGL::appendAcceleratorString( LLString& st ) const +void LLMenuItemGL::appendAcceleratorString( std::string& st ) const { // break early if this is a silly thing to do. if( KEY_NONE == mAcceleratorKey ) @@ -286,7 +286,7 @@ void LLMenuItemGL::appendAcceleratorString( LLString& st ) const st.append( "Shift-" ); #endif - LLString keystr = LLKeyboard::stringFromKey( mAcceleratorKey ); + std::string keystr = LLKeyboard::stringFromKey( mAcceleratorKey ); if ((mAcceleratorMask & MASK_NORMALKEYS) && (keystr[0] == '-' || keystr[0] == '=')) { @@ -334,7 +334,7 @@ U32 LLMenuItemGL::getNominalWidth( void ) const if( KEY_NONE != mAcceleratorKey ) { width += ACCEL_PAD_PIXELS; - LLString temp; + std::string temp; appendAcceleratorString( temp ); width += mFont->getWidth( temp ); } @@ -346,7 +346,7 @@ U32 LLMenuItemGL::getNominalWidth( void ) const void LLMenuItemGL::buildDrawLabel( void ) { mDrawAccelLabel.clear(); - LLString st = mDrawAccelLabel.getString(); + std::string st = mDrawAccelLabel.getString(); appendAcceleratorString( st ); mDrawAccelLabel = st; } @@ -491,8 +491,8 @@ void LLMenuItemGL::draw( void ) // underline "jump" key only when keyboard navigation has been initiated if (getMenu()->jumpKeysActive() && LLMenuGL::getKeyboardMode()) { - LLString upper_case_label = mLabel.getString(); - LLString::toUpper(upper_case_label); + std::string upper_case_label = mLabel.getString(); + LLStringUtil::toUpper(upper_case_label); std::string::size_type offset = upper_case_label.find(mJumpKey); if (offset != std::string::npos) { @@ -506,7 +506,7 @@ void LLMenuItemGL::draw( void ) setHover(FALSE); } -BOOL LLMenuItemGL::setLabelArg( const LLString& key, const LLStringExplicit& text ) +BOOL LLMenuItemGL::setLabelArg( const std::string& key, const LLStringExplicit& text ) { mLabel.setArg(key, text); return TRUE; @@ -521,9 +521,9 @@ BOOL LLMenuItemGL::setLabelArg( const LLString& key, const LLStringExplicit& tex class LLMenuItemSeparatorGL : public LLMenuItemGL { public: - LLMenuItemSeparatorGL( const LLString &name = SEPARATOR_NAME ); + LLMenuItemSeparatorGL( const std::string &name = SEPARATOR_NAME ); - virtual LLString getType() const { return "separator"; } + virtual std::string getType() const { return "separator"; } // doIt() - do the primary funcationality of the menu item. virtual void doIt( void ) {} @@ -536,7 +536,7 @@ public: virtual U32 getNominalHeight( void ) const { return SEPARATOR_HEIGHT_PIXELS; } }; -LLMenuItemSeparatorGL::LLMenuItemSeparatorGL( const LLString &name ) : +LLMenuItemSeparatorGL::LLMenuItemSeparatorGL( const std::string &name ) : LLMenuItemGL( name, SEPARATOR_LABEL ) { } @@ -615,7 +615,7 @@ LLMenuItemVerticalSeparatorGL::LLMenuItemVerticalSeparatorGL( void ) // Class LLMenuItemTearOffGL //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ LLMenuItemTearOffGL::LLMenuItemTearOffGL(LLHandle parent_floater_handle) : - LLMenuItemGL("tear off", TEAROFF_SEPARATOR_LABEL), + LLMenuItemGL(std::string("tear off"), TEAROFF_SEPARATOR_LABEL), mParentHandle(parent_floater_handle) { } @@ -694,7 +694,7 @@ U32 LLMenuItemTearOffGL::getNominalHeight( void ) const class LLMenuItemBlankGL : public LLMenuItemGL { public: - LLMenuItemBlankGL( void ) : LLMenuItemGL( "", "" ) + LLMenuItemBlankGL( void ) : LLMenuItemGL( LLStringUtil::null, LLStringUtil::null ) { setEnabled(FALSE); } @@ -707,8 +707,8 @@ public: /// Class LLMenuItemCallGL ///============================================================================ -LLMenuItemCallGL::LLMenuItemCallGL( const LLString& name, - const LLString& label, +LLMenuItemCallGL::LLMenuItemCallGL( const std::string& name, + const std::string& label, menu_callback clicked_cb, enabled_callback enabled_cb, void* user_data, @@ -725,7 +725,7 @@ LLMenuItemCallGL::LLMenuItemCallGL( const LLString& name, if(!enabled) setEnabled(FALSE); } -LLMenuItemCallGL::LLMenuItemCallGL( const LLString& name, +LLMenuItemCallGL::LLMenuItemCallGL( const std::string& name, menu_callback clicked_cb, enabled_callback enabled_cb, void* user_data, @@ -742,8 +742,8 @@ LLMenuItemCallGL::LLMenuItemCallGL( const LLString& name, if(!enabled) setEnabled(FALSE); } -LLMenuItemCallGL::LLMenuItemCallGL(const LLString& name, - const LLString& label, +LLMenuItemCallGL::LLMenuItemCallGL(const std::string& name, + const std::string& label, menu_callback clicked_cb, enabled_callback enabled_cb, label_callback label_cb, @@ -761,7 +761,7 @@ LLMenuItemCallGL::LLMenuItemCallGL(const LLString& name, if(!enabled) setEnabled(FALSE); } -LLMenuItemCallGL::LLMenuItemCallGL(const LLString& name, +LLMenuItemCallGL::LLMenuItemCallGL(const std::string& name, menu_callback clicked_cb, enabled_callback enabled_cb, label_callback label_cb, @@ -779,7 +779,7 @@ LLMenuItemCallGL::LLMenuItemCallGL(const LLString& name, if(!enabled) setEnabled(FALSE); } -void LLMenuItemCallGL::setEnabledControl(LLString enabled_control, LLView *context) +void LLMenuItemCallGL::setEnabledControl(std::string enabled_control, LLView *context) { // Register new listener if (!enabled_control.empty()) @@ -796,7 +796,7 @@ void LLMenuItemCallGL::setEnabledControl(LLString enabled_control, LLView *conte } } -void LLMenuItemCallGL::setVisibleControl(LLString visible_control, LLView *context) +void LLMenuItemCallGL::setVisibleControl(std::string visible_control, LLView *context) { // Register new listener if (!visible_control.empty()) @@ -824,7 +824,7 @@ LLXMLNodePtr LLMenuItemCallGL::getXML(bool save_children) const std::vector::iterator itor; for (itor = listeners.begin(); itor != listeners.end(); ++itor) { - LLString listener_name = findEventListener((LLSimpleListener*)itor->listener); + std::string listener_name = findEventListener((LLSimpleListener*)itor->listener); if (!listener_name.empty()) { LLXMLNodePtr child_node = node->createChild("on_click", FALSE); @@ -862,7 +862,7 @@ void LLMenuItemCallGL::buildDrawLabel( void ) } if(mLabelCallback) { - LLString label; + std::string label; mLabelCallback(label, mUserData); mLabel = label; } @@ -894,8 +894,8 @@ BOOL LLMenuItemCallGL::handleAcceleratorKey( KEY key, MASK mask ) /// Class LLMenuItemCheckGL ///============================================================================ -LLMenuItemCheckGL::LLMenuItemCheckGL ( const LLString& name, - const LLString& label, +LLMenuItemCheckGL::LLMenuItemCheckGL ( const std::string& name, + const std::string& label, menu_callback clicked_cb, enabled_callback enabled_cb, check_callback check_cb, @@ -907,7 +907,7 @@ LLMenuItemCheckGL::LLMenuItemCheckGL ( const LLString& name, { } -LLMenuItemCheckGL::LLMenuItemCheckGL ( const LLString& name, +LLMenuItemCheckGL::LLMenuItemCheckGL ( const std::string& name, menu_callback clicked_cb, enabled_callback enabled_cb, check_callback check_cb, @@ -919,11 +919,11 @@ LLMenuItemCheckGL::LLMenuItemCheckGL ( const LLString& name, { } -LLMenuItemCheckGL::LLMenuItemCheckGL ( const LLString& name, - const LLString& label, +LLMenuItemCheckGL::LLMenuItemCheckGL ( const std::string& name, + const std::string& label, menu_callback clicked_cb, enabled_callback enabled_cb, - LLString control_name, + std::string control_name, LLView *context, void* user_data, KEY key, MASK mask ) : @@ -947,7 +947,7 @@ void LLMenuItemCheckGL::setValue(const LLSD& value) } } -void LLMenuItemCheckGL::setCheckedControl(LLString checked_control, LLView *context) +void LLMenuItemCheckGL::setCheckedControl(std::string checked_control, LLView *context) { // Register new listener if (!checked_control.empty()) @@ -990,14 +990,14 @@ void LLMenuItemCheckGL::buildDrawLabel( void ) /// Class LLMenuItemToggleGL ///============================================================================ -LLMenuItemToggleGL::LLMenuItemToggleGL( const LLString& name, const LLString& label, BOOL* toggle, +LLMenuItemToggleGL::LLMenuItemToggleGL( const std::string& name, const std::string& label, BOOL* toggle, KEY key, MASK mask ) : LLMenuItemGL( name, label, key, mask ), mToggle( toggle ) { } -LLMenuItemToggleGL::LLMenuItemToggleGL( const LLString& name, BOOL* toggle, +LLMenuItemToggleGL::LLMenuItemToggleGL( const std::string& name, BOOL* toggle, KEY key, MASK mask ) : LLMenuItemGL( name, name, key, mask ), mToggle( toggle ) @@ -1017,7 +1017,7 @@ void LLMenuItemToggleGL::buildDrawLabel( void ) mDrawBoolLabel.clear(); } mDrawAccelLabel.clear(); - LLString st = mDrawAccelLabel; + std::string st = mDrawAccelLabel; appendAcceleratorString( st ); mDrawAccelLabel = st; } @@ -1033,7 +1033,7 @@ void LLMenuItemToggleGL::doIt( void ) } -LLMenuItemBranchGL::LLMenuItemBranchGL( const LLString& name, const LLString& label, LLMenuGL* branch, +LLMenuItemBranchGL::LLMenuItemBranchGL( const std::string& name, const std::string& label, LLMenuGL* branch, KEY key, MASK mask ) : LLMenuItemGL( name, label, key, mask ), mBranch( branch ) @@ -1043,7 +1043,7 @@ LLMenuItemBranchGL::LLMenuItemBranchGL( const LLString& name, const LLString& la } // virtual -LLView* LLMenuItemBranchGL::getChildView(const LLString& name, BOOL recurse, BOOL create_if_missing) const +LLView* LLMenuItemBranchGL::getChildView(const std::string& name, BOOL recurse, BOOL create_if_missing) const { // richard: this is redundant with parent, remove if (mBranch->getName() == name) @@ -1109,7 +1109,7 @@ BOOL LLMenuItemBranchGL::addToAcceleratorList(std::list *listp) void LLMenuItemBranchGL::buildDrawLabel( void ) { mDrawAccelLabel.clear(); - LLString st = mDrawAccelLabel; + std::string st = mDrawAccelLabel; appendAcceleratorString( st ); mDrawAccelLabel = st; mDrawBranchLabel = BRANCH_SUFFIX; @@ -1325,10 +1325,10 @@ class LLMenuItemBranchDownGL : public LLMenuItemBranchGL protected: public: - LLMenuItemBranchDownGL( const LLString& name, const LLString& label, LLMenuGL* branch, + LLMenuItemBranchDownGL( const std::string& name, const std::string& label, LLMenuGL* branch, KEY key = KEY_NONE, MASK mask = MASK_NONE ); - virtual LLString getType() const { return "menu"; } + virtual std::string getType() const { return "menu"; } // returns the normal width of this control in pixels - this is // used for calculating the widest item, as well as for horizontal @@ -1356,8 +1356,8 @@ public: virtual BOOL handleAcceleratorKey(KEY key, MASK mask); }; -LLMenuItemBranchDownGL::LLMenuItemBranchDownGL( const LLString& name, - const LLString& label, +LLMenuItemBranchDownGL::LLMenuItemBranchDownGL( const std::string& name, + const std::string& label, LLMenuGL* branch, KEY key, MASK mask ) : LLMenuItemBranchGL( name, label, branch, key, mask ) @@ -1378,7 +1378,7 @@ U32 LLMenuItemBranchDownGL::getNominalWidth( void ) const void LLMenuItemBranchDownGL::buildDrawLabel( void ) { mDrawAccelLabel.clear(); - LLString st = mDrawAccelLabel; + std::string st = mDrawAccelLabel; appendAcceleratorString( st ); mDrawAccelLabel = st; } @@ -1591,8 +1591,8 @@ void LLMenuItemBranchDownGL::draw( void ) // underline navigation key only when keyboard navigation has been initiated if (getMenu()->jumpKeysActive() && LLMenuGL::getKeyboardMode()) { - LLString upper_case_label = mLabel.getString(); - LLString::toUpper(upper_case_label); + std::string upper_case_label = mLabel.getString(); + LLStringUtil::toUpper(upper_case_label); std::string::size_type offset = upper_case_label.find(getJumpKey()); if (offset != std::string::npos) { @@ -1615,7 +1615,7 @@ void LLMenuItemBranchDownGL::draw( void ) static LLRegisterWidget r1("menu"); // Default constructor -LLMenuGL::LLMenuGL( const LLString& name, const LLString& label, LLHandle parent_floater_handle ) +LLMenuGL::LLMenuGL( const std::string& name, const std::string& label, LLHandle parent_floater_handle ) : LLUICtrl( name, LLRect(), FALSE, NULL, NULL ), mBackgroundColor( sDefaultBackgroundColor ), mBgVisible( TRUE ), @@ -1640,7 +1640,7 @@ LLMenuGL::LLMenuGL( const LLString& name, const LLString& label, LLHandle parent_floater_handle ) +LLMenuGL::LLMenuGL( const std::string& label, LLHandle parent_floater_handle ) : LLUICtrl( label, LLRect(), FALSE, NULL, NULL ), mBackgroundColor( sDefaultBackgroundColor ), mBgVisible( TRUE ), @@ -1749,10 +1749,10 @@ void LLMenuGL::parseChildXML(LLXMLNodePtr child, LLView *parent, LLUICtrlFactory { LLMenuItemGL *item = NULL; - LLString type; - LLString item_name; - LLString source_label; - LLString item_label; + std::string type; + std::string item_name; + std::string source_label; + std::string item_label; KEY jump_key = KEY_NONE; child->getAttributeString("type", type); @@ -1794,7 +1794,7 @@ void LLMenuGL::parseChildXML(LLXMLNodePtr child, LLView *parent, LLUICtrlFactory child->getAttributeBOOL("useMacCtrl", useMacCtrl); #endif // LL_DARWIN - LLString shortcut; + std::string shortcut; child->getAttributeString("shortcut", shortcut); if (shortcut.find("control") != shortcut.npos) { @@ -1815,7 +1815,7 @@ void LLMenuGL::parseChildXML(LLXMLNodePtr child, LLView *parent, LLUICtrlFactory mask |= MASK_SHIFT; } S32 pipe_pos = shortcut.rfind("|"); - LLString key_str = shortcut.substr(pipe_pos+1); + std::string key_str = shortcut.substr(pipe_pos+1); KEY key = KEY_NONE; LLKeyboard::keyFromString(key_str, &key); @@ -1825,7 +1825,7 @@ void LLMenuGL::parseChildXML(LLXMLNodePtr child, LLView *parent, LLUICtrlFactory if (child->hasName(LL_MENU_ITEM_CHECK_GL_TAG)) { - LLString control_name; + std::string control_name; child->getAttributeString("control_name", control_name); new_item = new LLMenuItemCheckGL(item_name, item_label, 0, 0, control_name, parent, 0, key, mask); @@ -1834,15 +1834,15 @@ void LLMenuGL::parseChildXML(LLXMLNodePtr child, LLView *parent, LLUICtrlFactory { if (call_child->hasName("on_check")) { - LLString callback_name; - LLString control_name = ""; + std::string callback_name; + std::string control_name; if (call_child->hasAttribute("function")) { call_child->getAttributeString("function", callback_name); control_name = callback_name; - LLString callback_data = item_name; + std::string callback_data = item_name; if (call_child->hasAttribute("userdata")) { call_child->getAttributeString("userdata", callback_data); @@ -1888,10 +1888,10 @@ void LLMenuGL::parseChildXML(LLXMLNodePtr child, LLView *parent, LLUICtrlFactory { if (call_child->hasName("on_click")) { - LLString callback_name; + std::string callback_name; call_child->getAttributeString("function", callback_name); - LLString callback_data = item_name; + std::string callback_data = item_name; if (call_child->hasAttribute("userdata")) { call_child->getAttributeString("userdata", callback_data); @@ -1905,15 +1905,15 @@ void LLMenuGL::parseChildXML(LLXMLNodePtr child, LLView *parent, LLUICtrlFactory } if (call_child->hasName("on_enable")) { - LLString callback_name; - LLString control_name = ""; + std::string callback_name; + std::string control_name; if (call_child->hasAttribute("function")) { call_child->getAttributeString("function", callback_name); control_name = callback_name; - LLString callback_data = ""; + std::string callback_data; if (call_child->hasAttribute("userdata")) { call_child->getAttributeString("userdata", callback_data); @@ -1945,15 +1945,15 @@ void LLMenuGL::parseChildXML(LLXMLNodePtr child, LLView *parent, LLUICtrlFactory } if (call_child->hasName("on_visible")) { - LLString callback_name; - LLString control_name = ""; + std::string callback_name; + std::string control_name; if (call_child->hasAttribute("function")) { call_child->getAttributeString("function", callback_name); control_name = callback_name; - LLString callback_data = ""; + std::string callback_data; if (call_child->hasAttribute("userdata")) { call_child->getAttributeString("userdata", callback_data); @@ -2045,14 +2045,14 @@ BOOL LLMenuGL::isOpen() // static LLView* LLMenuGL::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory) { - LLString name("menu"); + std::string name("menu"); node->getAttributeString("name", name); - LLString label = name; + std::string label = name; node->getAttributeString("label", label); // parse jump key out of label - LLString new_menu_label; + std::string new_menu_label; typedef boost::tokenizer > tokenizer; boost::char_separator sep("_"); @@ -2132,7 +2132,7 @@ void LLMenuGL::arrange( void ) U32 max_width = getTornOff() ? U32_MAX : menu_region_rect.getWidth(); U32 max_height = getTornOff() ? U32_MAX : menu_region_rect.getHeight(); // *FIX: create the item first and then ask for its dimensions? - S32 spillover_item_width = PLAIN_PAD_PIXELS + LLFontGL::sSansSerif->getWidth( "More" ); + S32 spillover_item_width = PLAIN_PAD_PIXELS + LLFontGL::sSansSerif->getWidth( std::string("More") ); S32 spillover_item_height = llround(LLFontGL::sSansSerif->getLineHeight()) + MENU_ITEM_PADDING; if (mHorizontalLayout) @@ -2249,13 +2249,13 @@ void LLMenuGL::createSpilloverBranch() delete mSpilloverMenu; // technically, you can't tear off spillover menus, but we're passing the handle // along just to be safe - mSpilloverMenu = new LLMenuGL("More", "More", mParentFloaterHandle); + mSpilloverMenu = new LLMenuGL(std::string("More"), std::string("More"), mParentFloaterHandle); mSpilloverMenu->updateParent(LLMenuGL::sMenuContainer); // Inherit colors mSpilloverMenu->setBackgroundColor( mBackgroundColor ); mSpilloverMenu->setCanTearOff(FALSE); - mSpilloverBranch = new LLMenuItemBranchGL("More", "More", mSpilloverMenu); + mSpilloverBranch = new LLMenuItemBranchGL(std::string("More"), std::string("More"), mSpilloverMenu); mSpilloverBranch->setFontStyle(LLFontGL::ITALIC); } } @@ -2295,8 +2295,8 @@ void LLMenuGL::createJumpKeys() { mJumpKeys.clear(); - std::set unique_words; - std::set shared_words; + std::set unique_words; + std::set shared_words; item_list_t::iterator item_it; typedef boost::tokenizer > tokenizer; @@ -2304,8 +2304,8 @@ void LLMenuGL::createJumpKeys() for(item_it = mItems.begin(); item_it != mItems.end(); ++item_it) { - LLString uppercase_label = (*item_it)->getLabel(); - LLString::toUpper(uppercase_label); + std::string uppercase_label = (*item_it)->getLabel(); + LLStringUtil::toUpper(uppercase_label); tokenizer tokens(uppercase_label, sep); tokenizer::iterator token_iter; @@ -2350,8 +2350,8 @@ void LLMenuGL::createJumpKeys() { continue; } - LLString uppercase_label = (*item_it)->getLabel(); - LLString::toUpper(uppercase_label); + std::string uppercase_label = (*item_it)->getLabel(); + LLStringUtil::toUpper(uppercase_label); tokenizer tokens(uppercase_label, sep); tokenizer::iterator token_iter; @@ -2359,7 +2359,7 @@ void LLMenuGL::createJumpKeys() BOOL found_key = FALSE; for( token_iter = tokens.begin(); token_iter != tokens.end(); ++token_iter) { - LLString uppercase_word = *token_iter; + std::string uppercase_word = *token_iter; // this word is not shared with other menu entries... if (shared_words.find(*token_iter) == shared_words.end()) @@ -2439,9 +2439,13 @@ BOOL LLMenuGL::append( LLMenuItemGL* item ) } // add a separator to this menu -BOOL LLMenuGL::appendSeparator( const LLString &separator_name ) +BOOL LLMenuGL::appendSeparator( const std::string &separator_name ) { - LLMenuItemGL* separator = new LLMenuItemSeparatorGL(separator_name); + LLMenuItemGL* separator; + if (separator_name.empty()) + separator = new LLMenuItemSeparatorGL(std::string("separator")); + else + separator = new LLMenuItemSeparatorGL(separator_name); return append( separator ); } @@ -2478,7 +2482,7 @@ void LLMenuGL::setEnabledSubMenus(BOOL enable) // setItemEnabled() - pass the label and the enable flag for a menu // item. TRUE will make sure it's enabled, FALSE will disable it. -void LLMenuGL::setItemEnabled( const LLString& name, BOOL enable ) +void LLMenuGL::setItemEnabled( const std::string& name, BOOL enable ) { item_list_t::iterator item_iter; for (item_iter = mItems.begin(); item_iter != mItems.end(); ++item_iter) @@ -2492,7 +2496,7 @@ void LLMenuGL::setItemEnabled( const LLString& name, BOOL enable ) } } -void LLMenuGL::setItemVisible( const LLString& name, BOOL visible ) +void LLMenuGL::setItemVisible( const std::string& name, BOOL visible ) { item_list_t::iterator item_iter; for (item_iter = mItems.begin(); item_iter != mItems.end(); ++item_iter) @@ -2871,7 +2875,7 @@ void LLMenuGL::setVisible(BOOL visible) } } -LLMenuGL* LLMenuGL::getChildMenuByName(const LLString& name, BOOL recurse) const +LLMenuGL* LLMenuGL::getChildMenuByName(const std::string& name, BOOL recurse) const { LLView* view = getChildView(name, recurse, FALSE); if (view) @@ -2963,7 +2967,7 @@ void LLMenuGL::showPopup(LLView* spawning_view, LLMenuGL* menu, S32 x, S32 y) class LLPieMenuBranch : public LLMenuItemGL { public: - LLPieMenuBranch(const LLString& name, const LLString& label, LLPieMenu* branch); + LLPieMenuBranch(const std::string& name, const std::string& label, LLPieMenu* branch); // called to rebuild the draw label virtual void buildDrawLabel( void ); @@ -2977,8 +2981,8 @@ protected: LLPieMenu* mBranch; }; -LLPieMenuBranch::LLPieMenuBranch(const LLString& name, - const LLString& label, +LLPieMenuBranch::LLPieMenuBranch(const std::string& name, + const std::string& label, LLPieMenu* branch) : LLMenuItemGL( name, label, KEY_NONE, MASK_NONE ), mBranch( branch ) @@ -3011,7 +3015,7 @@ void LLPieMenuBranch::buildDrawLabel( void ) } mDrawAccelLabel.clear(); - LLString st = mDrawAccelLabel; + std::string st = mDrawAccelLabel; appendAcceleratorString( st ); mDrawAccelLabel = st; @@ -3037,7 +3041,7 @@ void LLPieMenuBranch::doIt( void ) // class LLPieMenu // A circular menu of items, icons, etc. //----------------------------------------------------------------------------- -LLPieMenu::LLPieMenu(const LLString& name, const LLString& label) +LLPieMenu::LLPieMenu(const std::string& name, const std::string& label) : LLMenuGL(name, label), mFirstMouseDown(FALSE), mUseInfiniteRadius(FALSE), @@ -3052,7 +3056,7 @@ LLPieMenu::LLPieMenu(const LLString& name, const LLString& label) setCanTearOff(FALSE); } -LLPieMenu::LLPieMenu(const LLString& name) +LLPieMenu::LLPieMenu(const std::string& name) : LLMenuGL(name, name), mFirstMouseDown(FALSE), mUseInfiniteRadius(FALSE), @@ -3076,9 +3080,9 @@ void LLPieMenu::initXML(LLXMLNodePtr node, LLView *context, LLUICtrlFactory *fac if (child->hasName(LL_PIE_MENU_TAG)) { // SUBMENU - LLString name("menu"); + std::string name("menu"); child->getAttributeString("name", name); - LLString label(name); + std::string label(name); child->getAttributeString("label", label); LLPieMenu *submenu = new LLPieMenu(name, label); @@ -3456,7 +3460,7 @@ BOOL LLPieMenu::append(LLMenuItemGL *item) } // virtual -BOOL LLPieMenu::appendSeparator(const LLString &separator_name) +BOOL LLPieMenu::appendSeparator(const std::string &separator_name) { LLMenuItemGL* separator = new LLMenuItemBlankGL(); separator->setFont( LLFontGL::sSansSerifSmall ); @@ -3737,7 +3741,7 @@ void LLPieMenu::hide(BOOL item_selected) static LLRegisterWidget r2("menu_bar"); // Default constructor -LLMenuBarGL::LLMenuBarGL( const LLString& name ) : LLMenuGL ( name, name ) +LLMenuBarGL::LLMenuBarGL( const std::string& name ) : LLMenuGL ( name, name ) { mHorizontalLayout = TRUE; setCanTearOff(FALSE); @@ -3782,7 +3786,7 @@ LLXMLNodePtr LLMenuBarGL::getXML(bool save_children) const LLView* LLMenuBarGL::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory) { - LLString name("menu"); + std::string name("menu"); node->getAttributeString("name", name); BOOL opaque = FALSE; @@ -4039,7 +4043,7 @@ S32 LLMenuBarGL::getRightmostMenuEdge() } // add a vertical separator to this menu -BOOL LLMenuBarGL::appendSeparator( const LLString &separator_name ) +BOOL LLMenuBarGL::appendSeparator( const std::string &separator_name ) { LLMenuItemGL* separator = new LLMenuItemVerticalSeparatorGL(); return append( separator ); @@ -4138,14 +4142,14 @@ BOOL LLMenuBarGL::handleHover( S32 x, S32 y, MASK mask ) /// Class LLMenuHolderGL ///============================================================================ LLMenuHolderGL::LLMenuHolderGL() -: LLPanel("Menu Holder") + : LLPanel(std::string("Menu Holder")) { setMouseOpaque(FALSE); sItemActivationTimer.stop(); mCanHide = TRUE; } -LLMenuHolderGL::LLMenuHolderGL(const LLString& name, const LLRect& rect, BOOL mouse_opaque, U32 follows) +LLMenuHolderGL::LLMenuHolderGL(const std::string& name, const LLRect& rect, BOOL mouse_opaque, U32 follows) : LLPanel(name, rect, FALSE) { setMouseOpaque(mouse_opaque); diff --git a/indra/llui/llmenugl.h b/indra/llui/llmenugl.h index 16ab61c607..0125f954e5 100644 --- a/indra/llui/llmenugl.h +++ b/indra/llui/llmenugl.h @@ -67,7 +67,7 @@ typedef BOOL (*check_callback)(void*); // This callback is potentially used by LLMenuItemCallGL. If provided, // this function is called whenever it's time to determine the label's // contents. Put the contents of the label in the provided parameter. -typedef void (*label_callback)(LLString&,void*); +typedef void (*label_callback)(std::string&,void*); //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Class LLMenuItemGL @@ -88,13 +88,13 @@ public: static void setHighlightFGColor( const LLColor4& color ) { sHighlightForeground = color; } static const LLColor4& getHighlightFGColor() { return sHighlightForeground; } - LLMenuItemGL( const LLString& name, const LLString& label, KEY key = KEY_NONE, MASK = MASK_NONE ); + LLMenuItemGL( const std::string& name, const std::string& label, KEY key = KEY_NONE, MASK = MASK_NONE ); virtual void setValue(const LLSD& value) { setLabel(value.asString()); } virtual LLXMLNodePtr getXML(bool save_children = true) const; - virtual LLString getType() const { return "item"; } + virtual std::string getType() const { return "item"; } virtual BOOL handleHover(S32 x, S32 y, MASK mask); @@ -122,8 +122,8 @@ public: // change the label void setLabel( const LLStringExplicit& label ) { mLabel = label; } - LLString getLabel( void ) const { return mLabel.getString(); } - virtual BOOL setLabelArg( const LLString& key, const LLStringExplicit& text ); + std::string getLabel( void ) const { return mLabel.getString(); } + virtual BOOL setLabelArg( const std::string& key, const LLStringExplicit& text ); // Get the parent menu for this item virtual class LLMenuGL* getMenu(); @@ -177,7 +177,7 @@ protected: // This function appends the character string representation of // the current accelerator key and mask to the provided string. - void appendAcceleratorString( LLString& st ) const; + void appendAcceleratorString( std::string& st ) const; KEY mAcceleratorKey; MASK mAcceleratorMask; @@ -226,15 +226,15 @@ class LLMenuItemCallGL : public LLMenuItemGL, public LLObservable { public: // normal constructor - LLMenuItemCallGL( const LLString& name, + LLMenuItemCallGL( const std::string& name, menu_callback clicked_cb, enabled_callback enabled_cb = NULL, void* user_data = NULL, KEY key = KEY_NONE, MASK mask = MASK_NONE, BOOL enabled = TRUE, on_disabled_callback on_disabled_cb = NULL); - LLMenuItemCallGL( const LLString& name, - const LLString& label, + LLMenuItemCallGL( const std::string& name, + const std::string& label, menu_callback clicked_cb, enabled_callback enabled_cb = NULL, void* user_data = NULL, @@ -243,8 +243,8 @@ public: on_disabled_callback on_disabled_cb = NULL); // constructor for when you want to trap the arrange method. - LLMenuItemCallGL( const LLString& name, - const LLString& label, + LLMenuItemCallGL( const std::string& name, + const std::string& label, menu_callback clicked_cb, enabled_callback enabled_cb, label_callback label_cb, @@ -252,7 +252,7 @@ public: KEY key = KEY_NONE, MASK mask = MASK_NONE, BOOL enabled = TRUE, on_disabled_callback on_disabled_c = NULL); - LLMenuItemCallGL( const LLString& name, + LLMenuItemCallGL( const std::string& name, menu_callback clicked_cb, enabled_callback enabled_cb, label_callback label_cb, @@ -262,11 +262,11 @@ public: on_disabled_callback on_disabled_c = NULL); virtual LLXMLNodePtr getXML(bool save_children = true) const; - virtual LLString getType() const { return "call"; } + virtual std::string getType() const { return "call"; } - void setEnabledControl(LLString enabled_control, LLView *context); - void setVisibleControl(LLString enabled_control, LLView *context); + void setEnabledControl(std::string enabled_control, LLView *context); + void setVisibleControl(std::string enabled_control, LLView *context); void setMenuCallback(menu_callback callback, void* data) { mCallback = callback; mUserData = data; }; menu_callback getMenuCallback() const { return mCallback; } @@ -310,34 +310,34 @@ class LLMenuItemCheckGL : public LLMenuItemCallGL { public: - LLMenuItemCheckGL( const LLString& name, - const LLString& label, + LLMenuItemCheckGL( const std::string& name, + const std::string& label, menu_callback callback, enabled_callback enabled_cb, check_callback check, void* user_data, KEY key = KEY_NONE, MASK mask = MASK_NONE ); - LLMenuItemCheckGL( const LLString& name, + LLMenuItemCheckGL( const std::string& name, menu_callback callback, enabled_callback enabled_cb, check_callback check, void* user_data, KEY key = KEY_NONE, MASK mask = MASK_NONE ); - LLMenuItemCheckGL( const LLString& name, - const LLString& label, + LLMenuItemCheckGL( const std::string& name, + const std::string& label, menu_callback callback, enabled_callback enabled_cb, - LLString control_name, + std::string control_name, LLView *context, void* user_data, KEY key = KEY_NONE, MASK mask = MASK_NONE ); virtual LLXMLNodePtr getXML(bool save_children = true) const; - void setCheckedControl(LLString checked_control, LLView *context); + void setCheckedControl(std::string checked_control, LLView *context); virtual void setValue(const LLSD& value); - virtual LLString getType() const { return "check"; } + virtual std::string getType() const { return "check"; } // called to rebuild the draw label virtual void buildDrawLabel( void ); @@ -358,15 +358,15 @@ private: class LLMenuItemToggleGL : public LLMenuItemGL { public: - LLMenuItemToggleGL( const LLString& name, const LLString& label, + LLMenuItemToggleGL( const std::string& name, const std::string& label, BOOL* toggle, KEY key = KEY_NONE, MASK mask = MASK_NONE ); - LLMenuItemToggleGL( const LLString& name, + LLMenuItemToggleGL( const std::string& name, BOOL* toggle, KEY key = KEY_NONE, MASK mask = MASK_NONE ); - virtual LLString getType() const { return "toggle"; } + virtual std::string getType() const { return "toggle"; } // called to rebuild the draw label virtual void buildDrawLabel( void ); @@ -401,8 +401,8 @@ class LLMenuGL // let branching menu items use my protected traversal methods friend class LLMenuItemBranchGL; public: - LLMenuGL( const LLString& name, const LLString& label, LLHandle parent_floater = LLHandle()); - LLMenuGL( const LLString& label, LLHandle parent_floater = LLHandle() ); + LLMenuGL( const std::string& name, const std::string& label, LLHandle parent_floater = LLHandle()); + LLMenuGL( const std::string& label, LLHandle parent_floater = LLHandle() ); virtual ~LLMenuGL( void ); virtual LLXMLNodePtr getXML(bool save_children = true) const; static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory); @@ -419,12 +419,12 @@ public: virtual BOOL handleAcceleratorKey(KEY key, MASK mask); - LLMenuGL* getChildMenuByName(const LLString& name, BOOL recurse) const; + LLMenuGL* getChildMenuByName(const std::string& name, BOOL recurse) const; BOOL clearHoverItem(); // return the name label - const LLString& getLabel( void ) const { return mLabel.getString(); } + const std::string& getLabel( void ) const { return mLabel.getString(); } void setLabel(const LLStringExplicit& label) { mLabel = label; } // background colors @@ -438,7 +438,7 @@ public: virtual BOOL append( LLMenuItemGL* item ); // add a separator to this menu - virtual BOOL appendSeparator( const LLString &separator_name = "separator" ); + virtual BOOL appendSeparator( const std::string &separator_name = LLStringUtil::null ); // add a menu - this will create a cascading menu virtual BOOL appendMenu( LLMenuGL* menu ); @@ -449,12 +449,12 @@ public: // setItemEnabled() - pass the name and the enable flag for a // menu item. TRUE will make sure it's enabled, FALSE will disable // it. - void setItemEnabled( const LLString& name, BOOL enable ); + void setItemEnabled( const std::string& name, BOOL enable ); // propagate message to submenus void setEnabledSubMenus(BOOL enable); - void setItemVisible( const LLString& name, BOOL visible); + void setItemVisible( const std::string& name, BOOL visible); // sets the left,bottom corner of menu, useful for popups void setLeftAndBottom(S32 left, S32 bottom); @@ -561,11 +561,11 @@ private: class LLMenuItemBranchGL : public LLMenuItemGL { public: - LLMenuItemBranchGL( const LLString& name, const LLString& label, LLMenuGL* branch, + LLMenuItemBranchGL( const std::string& name, const std::string& label, LLMenuGL* branch, KEY key = KEY_NONE, MASK mask = MASK_NONE ); virtual LLXMLNodePtr getXML(bool save_children = true) const; - virtual LLString getType() const { return "menu"; } + virtual std::string getType() const { return "menu"; } virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); @@ -606,7 +606,7 @@ public: virtual void openMenu(); - virtual LLView* getChildView(const LLString& name, BOOL recurse = TRUE, BOOL create_if_missing = TRUE) const; + virtual LLView* getChildView(const std::string& name, BOOL recurse = TRUE, BOOL create_if_missing = TRUE) const; private: LLMenuGL* mBranch; @@ -623,8 +623,8 @@ class LLPieMenu : public LLMenuGL { public: - LLPieMenu(const LLString& name, const LLString& label); - LLPieMenu(const LLString& name); + LLPieMenu(const std::string& name, const std::string& label); + LLPieMenu(const std::string& name); virtual ~LLPieMenu() {} void initXML(LLXMLNodePtr node, LLView *context, LLUICtrlFactory *factory); @@ -642,7 +642,7 @@ public: virtual void drawBackground(LLMenuItemGL* itemp, LLColor4& color); virtual BOOL append(LLMenuItemGL* item); - virtual BOOL appendSeparator( const LLString &separator_name = "separator" ); + virtual BOOL appendSeparator( const std::string &separator_name = LLStringUtil::null ); BOOL appendPieMenu(LLPieMenu *menu); @@ -682,7 +682,7 @@ private: class LLMenuBarGL : public LLMenuGL { public: - LLMenuBarGL( const LLString& name ); + LLMenuBarGL( const std::string& name ); virtual ~LLMenuBarGL(); virtual LLXMLNodePtr getXML(bool save_children = true) const; static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory); @@ -700,7 +700,7 @@ public: virtual BOOL jumpKeysActive(); // add a vertical separator to this menu - virtual BOOL appendSeparator( const LLString &separator_name = "separator" ); + virtual BOOL appendSeparator( const std::string &separator_name = LLStringUtil::null ); // add a menu - this will create a drop down menu. virtual BOOL appendMenu( LLMenuGL* menu ); @@ -729,7 +729,7 @@ class LLMenuHolderGL : public LLPanel { public: LLMenuHolderGL(); - LLMenuHolderGL(const LLString& name, const LLRect& rect, BOOL mouse_opaque, U32 follows = FOLLOWS_NONE); + LLMenuHolderGL(const std::string& name, const LLRect& rect, BOOL mouse_opaque, U32 follows = FOLLOWS_NONE); virtual ~LLMenuHolderGL() {} virtual BOOL hideMenus(); @@ -791,7 +791,7 @@ class LLMenuItemTearOffGL : public LLMenuItemGL public: LLMenuItemTearOffGL( LLHandle parent_floater_handle = LLHandle()); - virtual LLString getType() const { return "tearoff_menu"; } + virtual std::string getType() const { return "tearoff_menu"; } virtual void doIt(void); virtual void draw(void); diff --git a/indra/llui/llmodaldialog.cpp b/indra/llui/llmodaldialog.cpp index 878c57b8b3..03dccdaf1f 100644 --- a/indra/llui/llmodaldialog.cpp +++ b/indra/llui/llmodaldialog.cpp @@ -43,8 +43,8 @@ // static std::list LLModalDialog::sModalStack; -LLModalDialog::LLModalDialog( const LLString& title, S32 width, S32 height, BOOL modal ) - : LLFloater( "modal container", +LLModalDialog::LLModalDialog( const std::string& title, S32 width, S32 height, BOOL modal ) + : LLFloater( std::string("modal container"), LLRect( 0, height, width, 0 ), title, FALSE, // resizable diff --git a/indra/llui/llmodaldialog.h b/indra/llui/llmodaldialog.h index 887239b18d..bb32950522 100644 --- a/indra/llui/llmodaldialog.h +++ b/indra/llui/llmodaldialog.h @@ -44,7 +44,7 @@ class LLModalDialog; class LLModalDialog : public LLFloater { public: - LLModalDialog( const LLString& title, S32 width, S32 height, BOOL modal = true ); + LLModalDialog( const std::string& title, S32 width, S32 height, BOOL modal = true ); /*virtual*/ ~LLModalDialog(); /*virtual*/ void open(); /* Flawfinder: ignore */ diff --git a/indra/llui/llmultislider.cpp b/indra/llui/llmultislider.cpp index c5c0e1c8b1..1663312c6f 100644 --- a/indra/llui/llmultislider.cpp +++ b/indra/llui/llmultislider.cpp @@ -54,7 +54,7 @@ const S32 EXTRA_TRIANGLE_HEIGHT = -2; S32 LLMultiSlider::mNameCounter = 0; LLMultiSlider::LLMultiSlider( - const LLString& name, + const std::string& name, const LLRect& rect, void (*on_commit_callback)(LLUICtrl* ctrl, void* userdata), void* callback_userdata, @@ -66,7 +66,7 @@ LLMultiSlider::LLMultiSlider( BOOL allow_overlap, BOOL draw_track, BOOL use_triangle, - const LLString& control_name) + const std::string& control_name) : LLUICtrl( name, rect, TRUE, on_commit_callback, callback_userdata, FOLLOWS_LEFT | FOLLOWS_TOP), @@ -91,7 +91,7 @@ LLMultiSlider::LLMultiSlider( mMouseUpCallback( NULL ) { mValue.emptyMap(); - mCurSlider = LLString::null; + mCurSlider = LLStringUtil::null; // properly handle setting the starting thumb rect // do it this way to handle both the operating-on-settings @@ -100,7 +100,7 @@ LLMultiSlider::LLMultiSlider( setValue(getValue()); } -void LLMultiSlider::setSliderValue(const LLString& name, F32 value, BOOL from_event) +void LLMultiSlider::setSliderValue(const std::string& name, F32 value, BOOL from_event) { // exit if not there if(!mValue.has(name)) { @@ -174,30 +174,30 @@ void LLMultiSlider::setValue(const LLSD& value) } } -F32 LLMultiSlider::getSliderValue(const LLString& name) const +F32 LLMultiSlider::getSliderValue(const std::string& name) const { return (F32)mValue[name].asReal(); } -void LLMultiSlider::setCurSlider(const LLString& name) +void LLMultiSlider::setCurSlider(const std::string& name) { if(mValue.has(name)) { mCurSlider = name; } } -const LLString& LLMultiSlider::addSlider() +const std::string& LLMultiSlider::addSlider() { return addSlider(mInitialValue); } -const LLString& LLMultiSlider::addSlider(F32 val) +const std::string& LLMultiSlider::addSlider(F32 val) { std::stringstream newName; F32 initVal = val; if(mValue.size() >= mMaxNumSliders) { - return LLString::null; + return LLStringUtil::null; } // create a new name @@ -206,7 +206,7 @@ const LLString& LLMultiSlider::addSlider(F32 val) bool foundOne = findUnusedValue(initVal); if(!foundOne) { - return LLString::null; + return LLStringUtil::null; } // add a new thumb rect @@ -269,7 +269,7 @@ bool LLMultiSlider::findUnusedValue(F32& initVal) } -void LLMultiSlider::deleteSlider(const LLString& name) +void LLMultiSlider::deleteSlider(const std::string& name) { // can't delete last slider if(mValue.size() <= 0) { @@ -282,7 +282,7 @@ void LLMultiSlider::deleteSlider(const LLString& name) // set to the last created if(mValue.size() > 0) { - std::map::iterator mIt = mThumbRects.end(); + std::map::iterator mIt = mThumbRects.end(); mIt--; mCurSlider = mIt->first; } @@ -365,7 +365,7 @@ BOOL LLMultiSlider::handleMouseDown(S32 x, S32 y, MASK mask) else { // scroll through thumbs to see if we have a new one selected and select that one - std::map::iterator mIt = mThumbRects.begin(); + std::map::iterator mIt = mThumbRects.begin(); for(; mIt != mThumbRects.end(); mIt++) { // check if inside. If so, set current slider and continue @@ -425,8 +425,8 @@ void LLMultiSlider::draw() { LLColor4 curThumbColor; - std::map::iterator mIt; - std::map::iterator curSldrIt; + std::map::iterator mIt; + std::map::iterator curSldrIt; // Draw background and thumb. @@ -582,7 +582,7 @@ LLXMLNodePtr LLMultiSlider::getXML(bool save_children) const //static LLView* LLMultiSlider::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory) { - LLString name("multi_slider_bar"); + std::string name("multi_slider_bar"); node->getAttributeString("name", name); LLRect rect; diff --git a/indra/llui/llmultislider.h b/indra/llui/llmultislider.h index 1eb7764c3c..7e0e483e61 100644 --- a/indra/llui/llmultislider.h +++ b/indra/llui/llmultislider.h @@ -41,7 +41,7 @@ class LLMultiSlider : public LLUICtrl { public: LLMultiSlider( - const LLString& name, + const std::string& name, const LLRect& rect, void (*on_commit_callback)(LLUICtrl* ctrl, void* userdata), void* callback_userdata, @@ -53,17 +53,17 @@ public: BOOL allow_overlap, BOOL draw_track, BOOL use_triangle, - const LLString& control_name = LLString::null ); + const std::string& control_name = LLStringUtil::null ); virtual LLXMLNodePtr getXML(bool save_children = true) const; static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory); - void setSliderValue(const LLString& name, F32 value, BOOL from_event = FALSE); - F32 getSliderValue(const LLString& name) const; + void setSliderValue(const std::string& name, F32 value, BOOL from_event = FALSE); + F32 getSliderValue(const std::string& name) const; - const LLString& getCurSlider() const { return mCurSlider; } + const std::string& getCurSlider() const { return mCurSlider; } F32 getCurSliderValue() const { return getSliderValue(mCurSlider); } - void setCurSlider(const LLString& name); + void setCurSlider(const std::string& name); void setCurSliderValue(F32 val, BOOL from_event = false) { setSliderValue(mCurSlider, val, from_event); } virtual void setValue(const LLSD& value); @@ -83,9 +83,9 @@ public: void setMouseUpCallback( void (*cb)(LLUICtrl* ctrl, void* userdata) ) { mMouseUpCallback = cb; } bool findUnusedValue(F32& initVal); - const LLString& addSlider(); - const LLString& addSlider(F32 val); - void deleteSlider(const LLString& name); + const std::string& addSlider(); + const std::string& addSlider(F32 val); + void deleteSlider(const std::string& name); void deleteCurSlider() { deleteSlider(mCurSlider); } void clear(); @@ -101,7 +101,7 @@ protected: F32 mMinValue; F32 mMaxValue; F32 mIncrement; - LLString mCurSlider; + std::string mCurSlider; static S32 mNameCounter; S32 mMaxNumSliders; @@ -112,7 +112,7 @@ protected: S32 mMouseOffset; LLRect mDragStartThumbRect; - std::map mThumbRects; + std::map mThumbRects; LLColor4 mTrackColor; LLColor4 mThumbOutlineColor; LLColor4 mThumbCenterColor; diff --git a/indra/llui/llmultisliderctrl.cpp b/indra/llui/llmultisliderctrl.cpp index e2b1e410fa..f6ad18f4b6 100644 --- a/indra/llui/llmultisliderctrl.cpp +++ b/indra/llui/llmultisliderctrl.cpp @@ -55,8 +55,8 @@ static LLRegisterWidget r("multi_slider"); const U32 MAX_STRING_LENGTH = 10; -LLMultiSliderCtrl::LLMultiSliderCtrl(const LLString& name, const LLRect& rect, - const LLString& label, +LLMultiSliderCtrl::LLMultiSliderCtrl(const std::string& name, const LLRect& rect, + const std::string& label, const LLFontGL* font, S32 label_width, S32 text_left, @@ -68,7 +68,7 @@ LLMultiSliderCtrl::LLMultiSliderCtrl(const LLString& name, const LLRect& rect, S32 max_sliders, BOOL allow_overlap, BOOL draw_track, BOOL use_triangle, - const LLString& control_which) + const std::string& control_which) : LLUICtrl(name, rect, TRUE, commit_callback, callback_user_data ), mFont(font), mShowText( show_text ), @@ -96,7 +96,7 @@ LLMultiSliderCtrl::LLMultiSliderCtrl(const LLString& name, const LLRect& rect, label_width = font->getWidth(label); } LLRect label_rect( left, top, label_width, bottom ); - mLabelBox = new LLTextBox( "MultiSliderCtrl Label", label_rect, label.c_str(), font ); + mLabelBox = new LLTextBox( std::string("MultiSliderCtrl Label"), label_rect, label, font ); addChild(mLabelBox); } @@ -109,7 +109,7 @@ LLMultiSliderCtrl::LLMultiSliderCtrl(const LLString& name, const LLRect& rect, S32 slider_left = label_width ? label_width + MULTI_SLIDERCTRL_SPACING : 0; LLRect slider_rect( slider_left, top, slider_right, bottom ); mMultiSlider = new LLMultiSlider( - "multi_slider", + std::string("multi_slider"), slider_rect, LLMultiSliderCtrl::onSliderCommit, this, initial_value, min_value, max_value, increment, @@ -124,8 +124,8 @@ LLMultiSliderCtrl::LLMultiSliderCtrl(const LLString& name, const LLRect& rect, LLRect text_rect( text_left, top, getRect().getWidth(), bottom ); if( can_edit_text ) { - mEditor = new LLLineEditor( "MultiSliderCtrl Editor", text_rect, - "", font, + mEditor = new LLLineEditor( std::string("MultiSliderCtrl Editor"), text_rect, + LLStringUtil::null, font, MAX_STRING_LENGTH, &LLMultiSliderCtrl::onEditorCommit, NULL, NULL, this, &LLLineEditor::prevalidateFloat ); @@ -140,7 +140,7 @@ LLMultiSliderCtrl::LLMultiSliderCtrl(const LLString& name, const LLRect& rect, } else { - mTextBox = new LLTextBox( "MultiSliderCtrl Text", text_rect, "", font); + mTextBox = new LLTextBox( std::string("MultiSliderCtrl Text"), text_rect, LLStringUtil::null, font); mTextBox->setFollowsLeft(); mTextBox->setFollowsBottom(); addChild(mTextBox); @@ -172,20 +172,20 @@ void LLMultiSliderCtrl::setValue(const LLSD& value) updateText(); } -void LLMultiSliderCtrl::setSliderValue(const LLString& name, F32 v, BOOL from_event) +void LLMultiSliderCtrl::setSliderValue(const std::string& name, F32 v, BOOL from_event) { mMultiSlider->setSliderValue(name, v, from_event ); mCurValue = mMultiSlider->getCurSliderValue(); updateText(); } -void LLMultiSliderCtrl::setCurSlider(const LLString& name) +void LLMultiSliderCtrl::setCurSlider(const std::string& name) { mMultiSlider->setCurSlider(name); mCurValue = mMultiSlider->getCurSliderValue(); } -BOOL LLMultiSliderCtrl::setLabelArg( const LLString& key, const LLStringExplicit& text ) +BOOL LLMultiSliderCtrl::setLabelArg( const std::string& key, const LLStringExplicit& text ) { BOOL res = FALSE; if (mLabelBox) @@ -210,13 +210,13 @@ BOOL LLMultiSliderCtrl::setLabelArg( const LLString& key, const LLStringExplicit return res; } -const LLString& LLMultiSliderCtrl::addSlider() +const std::string& LLMultiSliderCtrl::addSlider() { - const LLString& name = mMultiSlider->addSlider(); + const std::string& name = mMultiSlider->addSlider(); // if it returns null, pass it on - if(name == LLString::null) { - return LLString::null; + if(name == LLStringUtil::null) { + return LLStringUtil::null; } // otherwise, update stuff @@ -225,13 +225,13 @@ const LLString& LLMultiSliderCtrl::addSlider() return name; } -const LLString& LLMultiSliderCtrl::addSlider(F32 val) +const std::string& LLMultiSliderCtrl::addSlider(F32 val) { - const LLString& name = mMultiSlider->addSlider(val); + const std::string& name = mMultiSlider->addSlider(val); // if it returns null, pass it on - if(name == LLString::null) { - return LLString::null; + if(name == LLStringUtil::null) { + return LLStringUtil::null; } // otherwise, update stuff @@ -240,7 +240,7 @@ const LLString& LLMultiSliderCtrl::addSlider(F32 val) return name; } -void LLMultiSliderCtrl::deleteSlider(const LLString& name) +void LLMultiSliderCtrl::deleteSlider(const std::string& name) { mMultiSlider->deleteSlider(name); mCurValue = mMultiSlider->getCurSliderValue(); @@ -253,11 +253,11 @@ void LLMultiSliderCtrl::clear() setCurSliderValue(0.0f); if( mEditor ) { - mEditor->setText(LLString("")); + mEditor->setText(std::string("")); } if( mTextBox ) { - mTextBox->setText(LLString("")); + mTextBox->setText(std::string("")); } // get rid of sliders @@ -279,8 +279,8 @@ void LLMultiSliderCtrl::updateText() // Don't display very small negative values as -0.000 F32 displayed_value = (F32)(floor(getCurSliderValue() * pow(10.0, (F64)mPrecision) + 0.5) / pow(10.0, (F64)mPrecision)); - LLString format = llformat("%%.%df", mPrecision); - LLString text = llformat(format.c_str(), displayed_value); + std::string format = llformat("%%.%df", mPrecision); + std::string text = llformat(format.c_str(), displayed_value); if( mEditor ) { mEditor->setText( text ); @@ -302,7 +302,7 @@ void LLMultiSliderCtrl::onEditorCommit( LLUICtrl* caller, void *userdata ) F32 val = self->mCurValue; F32 saved_val = self->mCurValue; - LLString text = self->mEditor->getText(); + std::string text = self->mEditor->getText(); if( LLLineEditor::postvalidateFloat( text ) ) { LLLocale locale(LLLocale::USER_LOCALE); @@ -484,13 +484,13 @@ void LLMultiSliderCtrl::reportInvalidData() } //virtual -LLString LLMultiSliderCtrl::getControlName() const +std::string LLMultiSliderCtrl::getControlName() const { return mMultiSlider->getControlName(); } // virtual -void LLMultiSliderCtrl::setControlName(const LLString& control_name, LLView* context) +void LLMultiSliderCtrl::setControlName(const std::string& control_name, LLView* context) { mMultiSlider->setControlName(control_name, context); } @@ -529,10 +529,10 @@ LLXMLNodePtr LLMultiSliderCtrl::getXML(bool save_children) const LLView* LLMultiSliderCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory) { - LLString name("multi_slider"); + std::string name("multi_slider"); node->getAttributeString("name", name); - LLString label; + std::string label; node->getAttributeString("label", label); LLRect rect; @@ -588,13 +588,13 @@ LLView* LLMultiSliderCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFa { // calculate the size of the text box (log max_value is number of digits - 1 so plus 1) if ( max_value ) - text_left = font->getWidth("0") * ( static_cast < S32 > ( log10 ( max_value ) ) + precision + 1 ); + text_left = font->getWidth(std::string("0")) * ( static_cast < S32 > ( log10 ( max_value ) ) + precision + 1 ); if ( increment < 1.0f ) - text_left += font->getWidth("."); // (mostly) take account of decimal point in value + text_left += font->getWidth(std::string(".")); // (mostly) take account of decimal point in value if ( min_value < 0.0f || max_value < 0.0f ) - text_left += font->getWidth("-"); // (mostly) take account of minus sign + text_left += font->getWidth(std::string("-")); // (mostly) take account of minus sign // padding to make things look nicer text_left += 8; diff --git a/indra/llui/llmultisliderctrl.h b/indra/llui/llmultisliderctrl.h index bbc3955f58..fc82a5501b 100644 --- a/indra/llui/llmultisliderctrl.h +++ b/indra/llui/llmultisliderctrl.h @@ -55,9 +55,9 @@ class LLSlider; class LLMultiSliderCtrl : public LLUICtrl { public: - LLMultiSliderCtrl(const LLString& name, + LLMultiSliderCtrl(const std::string& name, const LLRect& rect, - const LLString& label, + const std::string& label, const LLFontGL* font, S32 slider_left, S32 text_left, @@ -68,22 +68,22 @@ public: F32 initial_value, F32 min_value, F32 max_value, F32 increment, S32 max_sliders, BOOL allow_overlap, BOOL draw_track, BOOL use_triangle, - const LLString& control_which = LLString::null ); + const std::string& control_which = LLStringUtil::null ); virtual ~LLMultiSliderCtrl(); virtual LLXMLNodePtr getXML(bool save_children = true) const; static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory); - F32 getSliderValue(const LLString& name) const; - void setSliderValue(const LLString& name, F32 v, BOOL from_event = FALSE); + F32 getSliderValue(const std::string& name) const; + void setSliderValue(const std::string& name, F32 v, BOOL from_event = FALSE); virtual void setValue(const LLSD& value ); virtual LLSD getValue() const { return mMultiSlider->getValue(); } - virtual BOOL setLabelArg( const LLString& key, const LLStringExplicit& text ); + virtual BOOL setLabelArg( const std::string& key, const LLStringExplicit& text ); - const LLString& getCurSlider() const { return mMultiSlider->getCurSlider(); } + const std::string& getCurSlider() const { return mMultiSlider->getCurSlider(); } F32 getCurSliderValue() const { return mCurValue; } - void setCurSlider(const LLString& name); + void setCurSlider(const std::string& name); void setCurSliderValue(F32 val, BOOL from_event = false) { setSliderValue(mMultiSlider->getCurSlider(), val, from_event); } virtual void setMinValue(LLSD min_value) { setMinValue((F32)min_value.asReal()); } @@ -99,15 +99,15 @@ public: void setIncrement(F32 increment) {mMultiSlider->setIncrement(increment);} /// for adding and deleting sliders - const LLString& addSlider(); - const LLString& addSlider(F32 val); - void deleteSlider(const LLString& name); + const std::string& addSlider(); + const std::string& addSlider(F32 val); + void deleteSlider(const std::string& name); void deleteCurSlider() { deleteSlider(mMultiSlider->getCurSlider()); } F32 getMinValue() { return mMultiSlider->getMinValue(); } F32 getMaxValue() { return mMultiSlider->getMaxValue(); } - void setLabel(const LLString& label) { if (mLabelBox) mLabelBox->setText(label); } + void setLabel(const std::string& label) { if (mLabelBox) mLabelBox->setText(label); } void setLabelColor(const LLColor4& c) { mTextEnabledColor = c; } void setDisabledLabelColor(const LLColor4& c) { mTextDisabledColor = c; } @@ -119,8 +119,8 @@ public: virtual void setTentative(BOOL b); // marks value as tentative virtual void onCommit(); // mark not tentative, then commit - virtual void setControlName(const LLString& control_name, LLView* context); - virtual LLString getControlName() const; + virtual void setControlName(const std::string& control_name, LLView* context); + virtual std::string getControlName() const; static void onSliderCommit(LLUICtrl* caller, void* userdata); static void onSliderMouseDown(LLUICtrl* caller,void* userdata); diff --git a/indra/llui/llpanel.cpp b/indra/llui/llpanel.cpp index fb14470612..700558094b 100644 --- a/indra/llui/llpanel.cpp +++ b/indra/llui/llpanel.cpp @@ -86,10 +86,10 @@ LLPanel::LLPanel() : mRectControl() { init(); - setName("panel"); + setName(std::string("panel")); } -LLPanel::LLPanel(const LLString& name) +LLPanel::LLPanel(const std::string& name) : LLUICtrl(name, LLRect(0, 0, 0, 0), TRUE, NULL, NULL), mRectControl() { @@ -97,7 +97,7 @@ LLPanel::LLPanel(const LLString& name) } -LLPanel::LLPanel(const LLString& name, const LLRect& rect, BOOL bordered) +LLPanel::LLPanel(const std::string& name, const LLRect& rect, BOOL bordered) : LLUICtrl(name, rect, TRUE, NULL, NULL), mRectControl() { @@ -109,7 +109,7 @@ LLPanel::LLPanel(const LLString& name, const LLRect& rect, BOOL bordered) } -LLPanel::LLPanel(const LLString& name, const LLString& rect_control, BOOL bordered) +LLPanel::LLPanel(const std::string& name, const std::string& rect_control, BOOL bordered) : LLUICtrl(name, LLUI::sConfigGroup->getRect(rect_control), TRUE, NULL, NULL), mRectControl( rect_control ) { @@ -141,7 +141,7 @@ void LLPanel::addBorder(LLViewBorder::EBevel border_bevel, LLViewBorder::EStyle border_style, S32 border_thickness) { removeBorder(); - mBorder = new LLViewBorder( "panel border", + mBorder = new LLViewBorder( std::string("panel border"), LLRect(0, getRect().getHeight(), getRect().getWidth(), 0), border_bevel, border_style, border_thickness ); mBorder->setSaveToXML(false); @@ -246,7 +246,7 @@ void LLPanel::setDefaultBtn(LLButton* btn) } } -void LLPanel::setDefaultBtn(const LLString& id) +void LLPanel::setDefaultBtn(const std::string& id) { LLButton *button = getChild(id); if (button) @@ -344,14 +344,14 @@ BOOL LLPanel::checkRequirements() { if (!mRequirementsError.empty()) { - LLString::format_map_t args; + LLStringUtil::format_map_t args; args["[COMPONENTS]"] = mRequirementsError; args["[FLOATER]"] = getName(); llwarns << getName() << " failed requirements check on: \n" << mRequirementsError << llendl; - alertXml("FailedRequirementsCheck", args); + alertXml(std::string("FailedRequirementsCheck"), args); mRequirementsError.clear(); return FALSE; } @@ -360,7 +360,7 @@ BOOL LLPanel::checkRequirements() } //static -void LLPanel::alertXml(LLString label, LLString::format_map_t args) +void LLPanel::alertXml(const std::string& label, LLStringUtil::format_map_t args) { sAlertQueue.push(LLAlertInfo(label,args)); } @@ -460,7 +460,7 @@ LLXMLNodePtr LLPanel::getXML(bool save_children) const LLView* LLPanel::fromXML(LLXMLNodePtr node, LLView* parent, LLUICtrlFactory *factory) { - LLString name("panel"); + std::string name("panel"); node->getAttributeString("name", name); LLPanel* panelp = factory->createFactoryPanel(name); @@ -489,7 +489,7 @@ LLView* LLPanel::fromXML(LLXMLNodePtr node, LLView* parent, LLUICtrlFactory *fac BOOL LLPanel::initPanelXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory) { - LLString name = getName(); + std::string name = getName(); node->getAttributeString("name", name); setName(name); @@ -497,7 +497,7 @@ BOOL LLPanel::initPanelXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *f initChildrenXML(node, factory); - LLString xml_filename; + std::string xml_filename; node->getAttributeString("filename", xml_filename); BOOL didPost; @@ -536,7 +536,7 @@ void LLPanel::initChildrenXML(LLXMLNodePtr node, LLUICtrlFactory* factory) // look for string declarations for programmatic text if (child->hasName("string")) { - LLString string_name; + std::string string_name; child->getAttributeString("name", string_name); if (!string_name.empty()) { @@ -564,9 +564,9 @@ void LLPanel::setPanelParameters(LLXMLNodePtr node, LLView* parent) LLViewBorder::getBevelFromAttribute(node, bevel_style); LLViewBorder::EStyle border_style = LLViewBorder::STYLE_LINE; - LLString border_string; + std::string border_string; node->getAttributeString("border_style", border_string); - LLString::toLower(border_string); + LLStringUtil::toLower(border_string); if (border_string == "texture") { @@ -601,12 +601,12 @@ void LLPanel::setPanelParameters(LLXMLNodePtr node, LLView* parent) LLUICtrlFactory::getAttributeColor(node,"bg_alpha_color", color); setTransparentColor(color); - LLString label = getLabel(); + std::string label = getLabel(); node->getAttributeString("label", label); setLabel(label); } -LLString LLPanel::getString(const LLString& name, const LLString::format_map_t& args) const +std::string LLPanel::getString(const std::string& name, const LLStringUtil::format_map_t& args) const { ui_string_map_t::const_iterator found_it = mUIStrings.find(name); if (found_it != mUIStrings.end()) @@ -616,7 +616,7 @@ LLString LLPanel::getString(const LLString& name, const LLString::format_map_t& formatted_string.setArgList(args); return formatted_string.getString(); } - LLString err_str("Failed to find string " + name + " in panel " + getName()); + std::string err_str("Failed to find string " + name + " in panel " + getName()); //*TODO: Translate // *TODO: once the QAR-369 ui-cleanup work on settings is in we need to change the following line to be //if(LLUI::sConfigGroup->getBOOL("QAMode")) if(LLUI::sQAMode) @@ -627,10 +627,10 @@ LLString LLPanel::getString(const LLString& name, const LLString::format_map_t& { llwarns << err_str << llendl; } - return LLString::null; + return LLStringUtil::null; } -LLUIString LLPanel::getUIString(const LLString& name) const +LLUIString LLPanel::getUIString(const std::string& name) const { ui_string_map_t::const_iterator found_it = mUIStrings.find(name); if (found_it != mUIStrings.end()) @@ -638,11 +638,11 @@ LLUIString LLPanel::getUIString(const LLString& name) const return found_it->second; } llerrs << "Failed to find string " << name << " in panel " << getName() << llendl; - return LLUIString(LLString::null); + return LLUIString(LLStringUtil::null); } -void LLPanel::childSetVisible(const LLString& id, bool visible) +void LLPanel::childSetVisible(const std::string& id, bool visible) { LLView* child = getChild(id); if (child) @@ -651,7 +651,7 @@ void LLPanel::childSetVisible(const LLString& id, bool visible) } } -bool LLPanel::childIsVisible(const LLString& id) const +bool LLPanel::childIsVisible(const std::string& id) const { LLView* child = getChild(id); if (child) @@ -661,7 +661,7 @@ bool LLPanel::childIsVisible(const LLString& id) const return false; } -void LLPanel::childSetEnabled(const LLString& id, bool enabled) +void LLPanel::childSetEnabled(const std::string& id, bool enabled) { LLView* child = getChild(id); if (child) @@ -670,7 +670,7 @@ void LLPanel::childSetEnabled(const LLString& id, bool enabled) } } -void LLPanel::childSetTentative(const LLString& id, bool tentative) +void LLPanel::childSetTentative(const std::string& id, bool tentative) { LLView* child = getChild(id); if (child) @@ -679,7 +679,7 @@ void LLPanel::childSetTentative(const LLString& id, bool tentative) } } -bool LLPanel::childIsEnabled(const LLString& id) const +bool LLPanel::childIsEnabled(const std::string& id) const { LLView* child = getChild(id); if (child) @@ -690,7 +690,7 @@ bool LLPanel::childIsEnabled(const LLString& id) const } -void LLPanel::childSetToolTip(const LLString& id, const LLString& msg) +void LLPanel::childSetToolTip(const std::string& id, const std::string& msg) { LLView* child = getChild(id); if (child) @@ -699,7 +699,7 @@ void LLPanel::childSetToolTip(const LLString& id, const LLString& msg) } } -void LLPanel::childSetRect(const LLString& id, const LLRect& rect) +void LLPanel::childSetRect(const std::string& id, const LLRect& rect) { LLView* child = getChild(id); if (child) @@ -708,7 +708,7 @@ void LLPanel::childSetRect(const LLString& id, const LLRect& rect) } } -bool LLPanel::childGetRect(const LLString& id, LLRect& rect) const +bool LLPanel::childGetRect(const std::string& id, LLRect& rect) const { LLView* child = getChild(id); if (child) @@ -719,7 +719,7 @@ bool LLPanel::childGetRect(const LLString& id, LLRect& rect) const return false; } -void LLPanel::childSetFocus(const LLString& id, BOOL focus) +void LLPanel::childSetFocus(const std::string& id, BOOL focus) { LLUICtrl* child = getChild(id, true); if (child) @@ -728,7 +728,7 @@ void LLPanel::childSetFocus(const LLString& id, BOOL focus) } } -BOOL LLPanel::childHasFocus(const LLString& id) +BOOL LLPanel::childHasFocus(const std::string& id) { LLUICtrl* child = getChild(id, true); if (child) @@ -743,7 +743,7 @@ BOOL LLPanel::childHasFocus(const LLString& id) } -void LLPanel::childSetFocusChangedCallback(const LLString& id, void (*cb)(LLFocusableElement*, void*), void* user_data) +void LLPanel::childSetFocusChangedCallback(const std::string& id, void (*cb)(LLFocusableElement*, void*), void* user_data) { LLUICtrl* child = getChild(id, true); if (child) @@ -752,7 +752,7 @@ void LLPanel::childSetFocusChangedCallback(const LLString& id, void (*cb)(LLFocu } } -void LLPanel::childSetCommitCallback(const LLString& id, void (*cb)(LLUICtrl*, void*), void *userdata ) +void LLPanel::childSetCommitCallback(const std::string& id, void (*cb)(LLUICtrl*, void*), void *userdata ) { LLUICtrl* child = getChild(id, true); if (child) @@ -762,7 +762,7 @@ void LLPanel::childSetCommitCallback(const LLString& id, void (*cb)(LLUICtrl*, v } } -void LLPanel::childSetDoubleClickCallback(const LLString& id, void (*cb)(void*), void *userdata ) +void LLPanel::childSetDoubleClickCallback(const std::string& id, void (*cb)(void*), void *userdata ) { LLUICtrl* child = getChild(id, true); if (child) @@ -775,7 +775,7 @@ void LLPanel::childSetDoubleClickCallback(const LLString& id, void (*cb)(void*), } } -void LLPanel::childSetValidate(const LLString& id, BOOL (*cb)(LLUICtrl*, void*)) +void LLPanel::childSetValidate(const std::string& id, BOOL (*cb)(LLUICtrl*, void*)) { LLUICtrl* child = getChild(id, true); if (child) @@ -784,7 +784,7 @@ void LLPanel::childSetValidate(const LLString& id, BOOL (*cb)(LLUICtrl*, void*)) } } -void LLPanel::childSetUserData(const LLString& id, void* userdata) +void LLPanel::childSetUserData(const std::string& id, void* userdata) { LLUICtrl* child = getChild(id, true); if (child) @@ -793,7 +793,7 @@ void LLPanel::childSetUserData(const LLString& id, void* userdata) } } -void LLPanel::childSetColor(const LLString& id, const LLColor4& color) +void LLPanel::childSetColor(const std::string& id, const LLColor4& color) { LLUICtrl* child = getChild(id, true); if (child) @@ -802,7 +802,7 @@ void LLPanel::childSetColor(const LLString& id, const LLColor4& color) } } -LLCtrlSelectionInterface* LLPanel::childGetSelectionInterface(const LLString& id) const +LLCtrlSelectionInterface* LLPanel::childGetSelectionInterface(const std::string& id) const { LLUICtrl* child = getChild(id, true); if (child) @@ -812,7 +812,7 @@ LLCtrlSelectionInterface* LLPanel::childGetSelectionInterface(const LLString& id return NULL; } -LLCtrlListInterface* LLPanel::childGetListInterface(const LLString& id) const +LLCtrlListInterface* LLPanel::childGetListInterface(const std::string& id) const { LLUICtrl* child = getChild(id, true); if (child) @@ -822,7 +822,7 @@ LLCtrlListInterface* LLPanel::childGetListInterface(const LLString& id) const return NULL; } -LLCtrlScrollInterface* LLPanel::childGetScrollInterface(const LLString& id) const +LLCtrlScrollInterface* LLPanel::childGetScrollInterface(const std::string& id) const { LLUICtrl* child = getChild(id, true); if (child) @@ -832,7 +832,7 @@ LLCtrlScrollInterface* LLPanel::childGetScrollInterface(const LLString& id) cons return NULL; } -void LLPanel::childSetValue(const LLString& id, LLSD value) +void LLPanel::childSetValue(const std::string& id, LLSD value) { LLView* child = getChild(id, true); if (child) @@ -841,7 +841,7 @@ void LLPanel::childSetValue(const LLString& id, LLSD value) } } -LLSD LLPanel::childGetValue(const LLString& id) const +LLSD LLPanel::childGetValue(const std::string& id) const { LLView* child = getChild(id, true); if (child) @@ -852,7 +852,7 @@ LLSD LLPanel::childGetValue(const LLString& id) const return LLSD(); } -BOOL LLPanel::childSetTextArg(const LLString& id, const LLString& key, const LLStringExplicit& text) +BOOL LLPanel::childSetTextArg(const std::string& id, const std::string& key, const LLStringExplicit& text) { LLUICtrl* child = getChild(id, true); if (child) @@ -862,7 +862,7 @@ BOOL LLPanel::childSetTextArg(const LLString& id, const LLString& key, const LLS return FALSE; } -BOOL LLPanel::childSetLabelArg(const LLString& id, const LLString& key, const LLStringExplicit& text) +BOOL LLPanel::childSetLabelArg(const std::string& id, const std::string& key, const LLStringExplicit& text) { LLView* child = getChild(id); if (child) @@ -872,7 +872,7 @@ BOOL LLPanel::childSetLabelArg(const LLString& id, const LLString& key, const LL return FALSE; } -BOOL LLPanel::childSetToolTipArg(const LLString& id, const LLString& key, const LLStringExplicit& text) +BOOL LLPanel::childSetToolTipArg(const std::string& id, const std::string& key, const LLStringExplicit& text) { LLView* child = getChildView(id, true, FALSE); if (child) @@ -882,7 +882,7 @@ BOOL LLPanel::childSetToolTipArg(const LLString& id, const LLString& key, const return FALSE; } -void LLPanel::childSetMinValue(const LLString& id, LLSD min_value) +void LLPanel::childSetMinValue(const std::string& id, LLSD min_value) { LLUICtrl* child = getChild(id, true); if (child) @@ -891,7 +891,7 @@ void LLPanel::childSetMinValue(const LLString& id, LLSD min_value) } } -void LLPanel::childSetMaxValue(const LLString& id, LLSD max_value) +void LLPanel::childSetMaxValue(const std::string& id, LLSD max_value) { LLUICtrl* child = getChild(id, true); if (child) @@ -900,7 +900,7 @@ void LLPanel::childSetMaxValue(const LLString& id, LLSD max_value) } } -void LLPanel::childShowTab(const LLString& id, const LLString& tabname, bool visible) +void LLPanel::childShowTab(const std::string& id, const std::string& tabname, bool visible) { LLTabContainer* child = getChild(id); if (child) @@ -909,7 +909,7 @@ void LLPanel::childShowTab(const LLString& id, const LLString& tabname, bool vis } } -LLPanel *LLPanel::childGetVisibleTab(const LLString& id) const +LLPanel *LLPanel::childGetVisibleTab(const std::string& id) const { LLTabContainer* child = getChild(id); if (child) @@ -919,7 +919,7 @@ LLPanel *LLPanel::childGetVisibleTab(const LLString& id) const return NULL; } -void LLPanel::childSetTabChangeCallback(const LLString& id, const LLString& tabname, void (*on_tab_clicked)(void*, bool), void *userdata) +void LLPanel::childSetTabChangeCallback(const std::string& id, const std::string& tabname, void (*on_tab_clicked)(void*, bool), void *userdata) { LLTabContainer* child = getChild(id); if (child) @@ -933,7 +933,7 @@ void LLPanel::childSetTabChangeCallback(const LLString& id, const LLString& tabn } } -void LLPanel::childSetKeystrokeCallback(const LLString& id, void (*keystroke_callback)(LLLineEditor* caller, void* user_data), void *user_data) +void LLPanel::childSetKeystrokeCallback(const std::string& id, void (*keystroke_callback)(LLLineEditor* caller, void* user_data), void *user_data) { LLLineEditor* child = getChild(id); if (child) @@ -946,7 +946,7 @@ void LLPanel::childSetKeystrokeCallback(const LLString& id, void (*keystroke_cal } } -void LLPanel::childSetPrevalidate(const LLString& id, BOOL (*func)(const LLWString &) ) +void LLPanel::childSetPrevalidate(const std::string& id, BOOL (*func)(const LLWString &) ) { LLLineEditor* child = getChild(id); if (child) @@ -955,7 +955,7 @@ void LLPanel::childSetPrevalidate(const LLString& id, BOOL (*func)(const LLWStri } } -void LLPanel::childSetWrappedText(const LLString& id, const LLString& text, bool visible) +void LLPanel::childSetWrappedText(const std::string& id, const std::string& text, bool visible) { LLTextBox* child = getChild(id); if (child) @@ -965,7 +965,7 @@ void LLPanel::childSetWrappedText(const LLString& id, const LLString& text, bool } } -void LLPanel::childSetAction(const LLString& id, void(*function)(void*), void* value) +void LLPanel::childSetAction(const std::string& id, void(*function)(void*), void* value) { LLButton* button = getChild(id); if (button) @@ -974,7 +974,7 @@ void LLPanel::childSetAction(const LLString& id, void(*function)(void*), void* v } } -void LLPanel::childSetActionTextbox(const LLString& id, void(*function)(void*)) +void LLPanel::childSetActionTextbox(const std::string& id, void(*function)(void*)) { LLTextBox* textbox = getChild(id); if (textbox) @@ -983,7 +983,7 @@ void LLPanel::childSetActionTextbox(const LLString& id, void(*function)(void*)) } } -void LLPanel::childSetControlName(const LLString& id, const LLString& control_name) +void LLPanel::childSetControlName(const std::string& id, const std::string& control_name) { LLView* view = getChild(id); if (view) @@ -993,7 +993,7 @@ void LLPanel::childSetControlName(const LLString& id, const LLString& control_na } //virtual -LLView* LLPanel::getChildView(const LLString& name, BOOL recurse, BOOL create_if_missing) const +LLView* LLPanel::getChildView(const std::string& name, BOOL recurse, BOOL create_if_missing) const { // just get child, don't try to create a dummy one LLView* view = LLUICtrl::getChildView(name, recurse, FALSE); @@ -1008,7 +1008,7 @@ LLView* LLPanel::getChildView(const LLString& name, BOOL recurse, BOOL create_if return view; } -void LLPanel::childNotFound(const LLString& id) const +void LLPanel::childNotFound(const std::string& id) const { if (mExpectedMembers.find(id) == mExpectedMembers.end()) { @@ -1022,7 +1022,7 @@ void LLPanel::childDisplayNotFound() { return; } - LLString msg; + std::string msg; expected_members_list_t::iterator itor; for (itor=mNewExpectedMembers.begin(); itor!=mNewExpectedMembers.end(); ++itor) { @@ -1031,7 +1031,7 @@ void LLPanel::childDisplayNotFound() mExpectedMembers.insert(*itor); } mNewExpectedMembers.clear(); - LLString::format_map_t args; + LLStringUtil::format_map_t args; args["[CONTROLS]"] = msg; LLAlertDialog::showXml("FloaterNotFound", args); } @@ -1071,7 +1071,7 @@ struct LLLayoutStack::LLEmbeddedPanel { min_dim = mMinWidth; } - mResizeBar = new LLResizeBar("resizer", mPanel, LLRect(), min_dim, S32_MAX, side); + mResizeBar = new LLResizeBar(std::string("resizer"), mPanel, LLRect(), min_dim, S32_MAX, side); mResizeBar->setEnableSnapping(FALSE); // panels initialized as hidden should not start out partially visible if (!mPanel->getVisible()) @@ -1166,7 +1166,7 @@ LLXMLNodePtr LLLayoutStack::getXML(bool save_children) const //static LLView* LLLayoutStack::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory) { - LLString orientation_string("vertical"); + std::string orientation_string("vertical"); node->getAttributeString("orientation", orientation_string); eLayoutOrientation orientation = VERTICAL; @@ -1190,7 +1190,7 @@ LLView* LLLayoutStack::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactor // don't allow negative spacing values layout_stackp->mPanelSpacing = llmax(layout_stackp->mPanelSpacing, 0); - LLString name("stack"); + std::string name("stack"); node->getAttributeString("name", name); layout_stackp->setName(name); @@ -1223,7 +1223,7 @@ LLView* LLLayoutStack::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactor BOOL user_resize = FALSE; child->getAttributeBOOL("user_resize", user_resize); - LLPanel* panelp = new LLPanel("auto_panel"); + LLPanel* panelp = new LLPanel(std::string("auto_panel")); LLView* new_child = factory->createWidget(panelp, child); if (new_child) { diff --git a/indra/llui/llpanel.h b/indra/llui/llpanel.h index 0485274055..1fe6a5679e 100644 --- a/indra/llui/llpanel.h +++ b/indra/llui/llpanel.h @@ -51,10 +51,10 @@ const BOOL BORDER_NO = FALSE; struct LLAlertInfo { - LLString mLabel; - LLString::format_map_t mArgs; + std::string mLabel; + LLStringUtil::format_map_t mArgs; - LLAlertInfo(LLString label, LLString::format_map_t args) : mLabel(label), mArgs(args) { } + LLAlertInfo(std::string label, LLStringUtil::format_map_t args) : mLabel(label), mArgs(args) { } LLAlertInfo(){} }; @@ -71,13 +71,13 @@ public: // minimal constructor for data-driven initialization LLPanel(); - LLPanel(const LLString& name); + LLPanel(const std::string& name); // Position and size not saved - LLPanel(const LLString& name, const LLRect& rect, BOOL bordered = TRUE); + LLPanel(const std::string& name, const LLRect& rect, BOOL bordered = TRUE); // Position and size are saved to rect_control - LLPanel(const LLString& name, const LLString& rect_control, BOOL bordered = TRUE); + LLPanel(const std::string& name, const std::string& rect_control, BOOL bordered = TRUE); /*virtual*/ ~LLPanel(); @@ -87,7 +87,7 @@ public: /*virtual*/ BOOL handleKeyHere( KEY key, MASK mask ); /*virtual*/ LLXMLNodePtr getXML(bool save_children = true) const; // Override to set not found list: - virtual LLView* getChildView(const LLString& name, BOOL recurse = TRUE, BOOL create_if_missing = TRUE) const; + virtual LLView* getChildView(const std::string& name, BOOL recurse = TRUE, BOOL create_if_missing = TRUE) const; // From LLFocusableElement /*virtual*/ void setFocus( BOOL b ); @@ -105,7 +105,7 @@ public: BOOL hasBorder() const { return mBorder != NULL; } void setBorderVisible( BOOL b ); - template void requires(LLString name) + template void requires(const std::string& name) { // check for widget with matching type and name if (LLView::getChild(name) == NULL) @@ -115,7 +115,7 @@ public: } // requires LLView by default - void requires(LLString name) + void requires(const std::string& name) { requires(name); } @@ -130,13 +130,13 @@ public: void setBackgroundOpaque(BOOL b) { mBgOpaque = b; } BOOL isBackgroundOpaque() const { return mBgOpaque; } void setDefaultBtn(LLButton* btn = NULL); - void setDefaultBtn(const LLString& id); + void setDefaultBtn(const std::string& id); void updateDefaultBtn(); void setLabel(const LLStringExplicit& label) { mLabel = label; } - LLString getLabel() const { return mLabel; } + std::string getLabel() const { return mLabel; } - void setRectControl(const LLString& rect_control) { mRectControl.assign(rect_control); } - const LLString& getRectControl() const { return mRectControl; } + void setRectControl(const std::string& rect_control) { mRectControl.assign(rect_control); } + const std::string& getRectControl() const { return mRectControl; } void storeRectControl(); void setCtrlsEnabled(BOOL b); @@ -151,83 +151,83 @@ public: void initChildrenXML(LLXMLNodePtr node, LLUICtrlFactory* factory); void setPanelParameters(LLXMLNodePtr node, LLView *parentp); - LLString getString(const LLString& name, const LLString::format_map_t& args = LLUIString::sNullArgs) const; - LLUIString getUIString(const LLString& name) const; + std::string getString(const std::string& name, const LLStringUtil::format_map_t& args = LLUIString::sNullArgs) const; + LLUIString getUIString(const std::string& name) const; // ** Wrappers for setting child properties by name ** -TomY // LLView - void childSetVisible(const LLString& name, bool visible); - void childShow(const LLString& name) { childSetVisible(name, true); } - void childHide(const LLString& name) { childSetVisible(name, false); } - bool childIsVisible(const LLString& id) const; - void childSetTentative(const LLString& name, bool tentative); + void childSetVisible(const std::string& name, bool visible); + void childShow(const std::string& name) { childSetVisible(name, true); } + void childHide(const std::string& name) { childSetVisible(name, false); } + bool childIsVisible(const std::string& id) const; + void childSetTentative(const std::string& name, bool tentative); - void childSetEnabled(const LLString& name, bool enabled); - void childEnable(const LLString& name) { childSetEnabled(name, true); } - void childDisable(const LLString& name) { childSetEnabled(name, false); }; - bool childIsEnabled(const LLString& id) const; + void childSetEnabled(const std::string& name, bool enabled); + void childEnable(const std::string& name) { childSetEnabled(name, true); } + void childDisable(const std::string& name) { childSetEnabled(name, false); }; + bool childIsEnabled(const std::string& id) const; - void childSetToolTip(const LLString& id, const LLString& msg); - void childSetRect(const LLString& id, const LLRect &rect); - bool childGetRect(const LLString& id, LLRect& rect) const; + void childSetToolTip(const std::string& id, const std::string& msg); + void childSetRect(const std::string& id, const LLRect &rect); + bool childGetRect(const std::string& id, LLRect& rect) const; // LLUICtrl - void childSetFocus(const LLString& id, BOOL focus = TRUE); - BOOL childHasFocus(const LLString& id); - void childSetFocusChangedCallback(const LLString& id, void (*cb)(LLFocusableElement*, void*), void* user_data = NULL); + void childSetFocus(const std::string& id, BOOL focus = TRUE); + BOOL childHasFocus(const std::string& id); + void childSetFocusChangedCallback(const std::string& id, void (*cb)(LLFocusableElement*, void*), void* user_data = NULL); - void childSetCommitCallback(const LLString& id, void (*cb)(LLUICtrl*, void*), void* userdata = NULL ); - void childSetDoubleClickCallback(const LLString& id, void (*cb)(void*), void* userdata = NULL ); - void childSetValidate(const LLString& id, BOOL (*cb)(LLUICtrl*, void*) ); - void childSetUserData(const LLString& id, void* userdata); + void childSetCommitCallback(const std::string& id, void (*cb)(LLUICtrl*, void*), void* userdata = NULL ); + void childSetDoubleClickCallback(const std::string& id, void (*cb)(void*), void* userdata = NULL ); + void childSetValidate(const std::string& id, BOOL (*cb)(LLUICtrl*, void*) ); + void childSetUserData(const std::string& id, void* userdata); - void childSetColor(const LLString& id, const LLColor4& color); + void childSetColor(const std::string& id, const LLColor4& color); - LLCtrlSelectionInterface* childGetSelectionInterface(const LLString& id) const; - LLCtrlListInterface* childGetListInterface(const LLString& id) const; - LLCtrlScrollInterface* childGetScrollInterface(const LLString& id) const; + LLCtrlSelectionInterface* childGetSelectionInterface(const std::string& id) const; + LLCtrlListInterface* childGetListInterface(const std::string& id) const; + LLCtrlScrollInterface* childGetScrollInterface(const std::string& id) const; // This is the magic bullet for data-driven UI - void childSetValue(const LLString& id, LLSD value); - LLSD childGetValue(const LLString& id) const; + void childSetValue(const std::string& id, LLSD value); + LLSD childGetValue(const std::string& id) const; // For setting text / label replacement params, e.g. "Hello [NAME]" // Not implemented for all types, defaults to noop, returns FALSE if not applicaple - BOOL childSetTextArg(const LLString& id, const LLString& key, const LLStringExplicit& text); - BOOL childSetLabelArg(const LLString& id, const LLString& key, const LLStringExplicit& text); - BOOL childSetToolTipArg(const LLString& id, const LLString& key, const LLStringExplicit& text); + BOOL childSetTextArg(const std::string& id, const std::string& key, const LLStringExplicit& text); + BOOL childSetLabelArg(const std::string& id, const std::string& key, const LLStringExplicit& text); + BOOL childSetToolTipArg(const std::string& id, const std::string& key, const LLStringExplicit& text); // LLSlider / LLMultiSlider / LLSpinCtrl - void childSetMinValue(const LLString& id, LLSD min_value); - void childSetMaxValue(const LLString& id, LLSD max_value); + void childSetMinValue(const std::string& id, LLSD min_value); + void childSetMaxValue(const std::string& id, LLSD max_value); // LLTabContainer - void childShowTab(const LLString& id, const LLString& tabname, bool visible = true); - LLPanel *childGetVisibleTab(const LLString& id) const; - void childSetTabChangeCallback(const LLString& id, const LLString& tabname, void (*on_tab_clicked)(void*, bool), void *userdata); + void childShowTab(const std::string& id, const std::string& tabname, bool visible = true); + LLPanel *childGetVisibleTab(const std::string& id) const; + void childSetTabChangeCallback(const std::string& id, const std::string& tabname, void (*on_tab_clicked)(void*, bool), void *userdata); // LLTextBox - void childSetWrappedText(const LLString& id, const LLString& text, bool visible = true); + void childSetWrappedText(const std::string& id, const std::string& text, bool visible = true); // LLTextBox/LLTextEditor/LLLineEditor - void childSetText(const LLString& id, const LLStringExplicit& text) { childSetValue(id, LLSD(text)); } - LLString childGetText(const LLString& id) const { return childGetValue(id).asString(); } + void childSetText(const std::string& id, const LLStringExplicit& text) { childSetValue(id, LLSD(text)); } + std::string childGetText(const std::string& id) const { return childGetValue(id).asString(); } // LLLineEditor - void childSetKeystrokeCallback(const LLString& id, void (*keystroke_callback)(LLLineEditor* caller, void* user_data), void *user_data); - void childSetPrevalidate(const LLString& id, BOOL (*func)(const LLWString &) ); + void childSetKeystrokeCallback(const std::string& id, void (*keystroke_callback)(LLLineEditor* caller, void* user_data), void *user_data); + void childSetPrevalidate(const std::string& id, BOOL (*func)(const LLWString &) ); // LLButton - void childSetAction(const LLString& id, void(*function)(void*), void* value); - void childSetActionTextbox(const LLString& id, void(*function)(void*)); - void childSetControlName(const LLString& id, const LLString& control_name); + void childSetAction(const std::string& id, void(*function)(void*), void* value); + void childSetActionTextbox(const std::string& id, void(*function)(void*)); + void childSetControlName(const std::string& id, const std::string& control_name); // Error reporting - void childNotFound(const LLString& id) const; + void childNotFound(const std::string& id) const; void childDisplayNotFound(); - static void alertXml(LLString label, LLString::format_map_t args = LLString::format_map_t()); + static void alertXml(const std::string& label, LLStringUtil::format_map_t args = LLStringUtil::format_map_t()); static BOOL nextAlert(LLAlertInfo &alert); static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory); @@ -245,11 +245,11 @@ private: virtual void addCtrlAtEnd( LLUICtrl* ctrl, S32 tab_group); // Unified error reporting for the child* functions - typedef std::set expected_members_list_t; + typedef std::set expected_members_list_t; mutable expected_members_list_t mExpectedMembers; mutable expected_members_list_t mNewExpectedMembers; - LLString mRectControl; + std::string mRectControl; LLColor4 mBgColorAlpha; LLColor4 mBgColorOpaque; LLColor4 mDefaultBtnHighlight; @@ -257,14 +257,14 @@ private: BOOL mBgOpaque; LLViewBorder* mBorder; LLButton* mDefaultBtn; - LLString mLabel; + std::string mLabel; S32 mLastTabGroup; LLRootHandle mPanelHandle; - typedef std::map ui_string_map_t; + typedef std::map ui_string_map_t; ui_string_map_t mUIStrings; - LLString mRequirementsError; + std::string mRequirementsError; typedef std::queue alert_queue_t; static alert_queue_t sAlertQueue; diff --git a/indra/llui/llradiogroup.cpp b/indra/llui/llradiogroup.cpp index 6d496b391f..b8f06e53ee 100644 --- a/indra/llui/llradiogroup.cpp +++ b/indra/llui/llradiogroup.cpp @@ -44,8 +44,8 @@ static LLRegisterWidget r("radio_group"); -LLRadioGroup::LLRadioGroup(const LLString& name, const LLRect& rect, - const LLString& control_name, +LLRadioGroup::LLRadioGroup(const std::string& name, const LLRect& rect, + const std::string& control_name, LLUICtrlCallback callback, void* userdata, BOOL border) @@ -56,7 +56,7 @@ LLRadioGroup::LLRadioGroup(const LLString& name, const LLRect& rect, init(border); } -LLRadioGroup::LLRadioGroup(const LLString& name, const LLRect& rect, +LLRadioGroup::LLRadioGroup(const std::string& name, const LLRect& rect, S32 initial_index, LLUICtrlCallback callback, void* userdata, @@ -71,7 +71,7 @@ void LLRadioGroup::init(BOOL border) { if (border) { - addChild( new LLViewBorder( "radio group border", + addChild( new LLViewBorder( std::string("radio group border"), LLRect(0, getRect().getHeight(), getRect().getWidth(), 0), LLViewBorder::BEVEL_NONE, LLViewBorder::STYLE_LINE, @@ -252,7 +252,7 @@ void LLRadioGroup::draw() // When adding a button, we need to ensure that the radio // group gets a message when the button is clicked. -LLRadioCtrl* LLRadioGroup::addRadioButton(const LLString& name, const LLString& label, const LLRect& rect, const LLFontGL* font ) +LLRadioCtrl* LLRadioGroup::addRadioButton(const std::string& name, const std::string& label, const LLRect& rect, const LLFontGL* font ) { // Highlight will get fixed in draw method above LLRadioCtrl* radio = new LLRadioCtrl(name, rect, label, font, @@ -298,7 +298,7 @@ void LLRadioGroup::onClickButton(LLUICtrl* ui_ctrl, void* userdata) void LLRadioGroup::setValue( const LLSD& value ) { - LLString value_name = value.asString(); + std::string value_name = value.asString(); int idx = 0; for (button_list_t::const_iterator iter = mRadioButtons.begin(); iter != mRadioButtons.end(); ++iter) @@ -357,7 +357,7 @@ LLXMLNodePtr LLRadioGroup::getXML(bool save_children) const LLXMLNodePtr child_node = radio->LLView::getXML(); child_node->setStringValue(radio->getLabel()); - child_node->setName("radio_item"); + child_node->setName(std::string("radio_item")); node->addChild(child_node); } @@ -368,7 +368,7 @@ LLXMLNodePtr LLRadioGroup::getXML(bool save_children) const // static LLView* LLRadioGroup::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory) { - LLString name("radio_group"); + std::string name("radio_group"); node->getAttributeString("name", name); U32 initial_value = 0; @@ -387,7 +387,7 @@ LLView* LLRadioGroup::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory NULL, draw_border); - const LLString& contents = node->getValue(); + const std::string& contents = node->getValue(); LLRect group_rect = radio_group->getRect(); @@ -406,10 +406,10 @@ LLView* LLRadioGroup::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory while(token_iter != tokens.end()) { - const char* line = token_iter->c_str(); + const std::string& line = *token_iter; LLRect rect(HPAD, cur_y, group_rect.getWidth() - (2 * HPAD), cur_y - 15); cur_y -= VPAD + 15; - radio_group->addRadioButton("radio", line, rect, font); + radio_group->addRadioButton(std::string("radio"), line, rect, font); ++token_iter; } llwarns << "Legacy radio group format used! Please convert to use tags!" << llendl; @@ -425,10 +425,10 @@ LLView* LLRadioGroup::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory LLRect item_rect; createRect(child, item_rect, radio_group, rect); - LLString radioname("radio"); + std::string radioname("radio"); child->getAttributeString("name", radioname); - LLString item_label = child->getTextContents(); - LLRadioCtrl* radio = radio_group->addRadioButton(radioname, item_label.c_str(), item_rect, font); + std::string item_label = child->getTextContents(); + LLRadioCtrl* radio = radio_group->addRadioButton(radioname, item_label, item_rect, font); radio->initFromXML(child, radio_group); } diff --git a/indra/llui/llradiogroup.h b/indra/llui/llradiogroup.h index b9e2167446..fce467872a 100644 --- a/indra/llui/llradiogroup.h +++ b/indra/llui/llradiogroup.h @@ -43,7 +43,7 @@ class LLRadioCtrl : public LLCheckBoxCtrl { public: - LLRadioCtrl(const LLString& name, const LLRect& rect, const LLString& label, const LLFontGL* font = NULL, + LLRadioCtrl(const std::string& name, const LLRect& rect, const std::string& label, const LLFontGL* font = NULL, void (*commit_callback)(LLUICtrl*, void*) = NULL, void* callback_userdata = NULL) : LLCheckBoxCtrl(name, rect, label, font, commit_callback, callback_userdata, FALSE, RADIO_STYLE) { @@ -67,15 +67,15 @@ public: // Build a radio group. The number (0...n-1) of the currently selected // element will be stored in the named control. After the control is // changed the callback will be called. - LLRadioGroup(const LLString& name, const LLRect& rect, - const LLString& control_name, + LLRadioGroup(const std::string& name, const LLRect& rect, + const std::string& control_name, LLUICtrlCallback callback = NULL, void* userdata = NULL, BOOL border = TRUE); // Another radio group constructor, but this one doesn't rely on // needing a control - LLRadioGroup(const LLString& name, const LLRect& rect, + LLRadioGroup(const std::string& name, const LLRect& rect, S32 initial_index, LLUICtrlCallback callback = NULL, void* userdata = NULL, @@ -106,7 +106,7 @@ public: // You must use this method to add buttons to a radio group. // Don't use addChild -- it won't set the callback function // correctly. - LLRadioCtrl* addRadioButton(const LLString& name, const LLString& label, const LLRect& rect, const LLFontGL* font); + LLRadioCtrl* addRadioButton(const std::string& name, const std::string& label, const LLRect& rect, const LLFontGL* font); LLRadioCtrl* getRadioButton(const S32& index) { return mRadioButtons[index]; } // Update the control as needed. Userdata must be a pointer to the button. static void onClickButton(LLUICtrl* radio, void* userdata); diff --git a/indra/llui/llresizebar.cpp b/indra/llui/llresizebar.cpp index 82be9672b6..d69145d24e 100644 --- a/indra/llui/llresizebar.cpp +++ b/indra/llui/llresizebar.cpp @@ -39,7 +39,7 @@ #include "llfocusmgr.h" #include "llwindow.h" -LLResizeBar::LLResizeBar( const LLString& name, LLView* resizing_view, const LLRect& rect, S32 min_size, S32 max_size, Side side ) +LLResizeBar::LLResizeBar( const std::string& name, LLView* resizing_view, const LLRect& rect, S32 min_size, S32 max_size, Side side ) : LLView( name, rect, TRUE ), mDragLastScreenX( 0 ), diff --git a/indra/llui/llresizebar.h b/indra/llui/llresizebar.h index b760abf13d..bc7fdffc41 100644 --- a/indra/llui/llresizebar.h +++ b/indra/llui/llresizebar.h @@ -40,7 +40,7 @@ class LLResizeBar : public LLView public: enum Side { LEFT, TOP, RIGHT, BOTTOM }; - LLResizeBar(const LLString& name, LLView* resizing_view, const LLRect& rect, S32 min_size, S32 max_size, Side side ); + LLResizeBar(const std::string& name, LLView* resizing_view, const LLRect& rect, S32 min_size, S32 max_size, Side side ); // virtual void draw(); No appearance virtual BOOL handleHover(S32 x, S32 y, MASK mask); diff --git a/indra/llui/llresizehandle.cpp b/indra/llui/llresizehandle.cpp index 4da2d4fca1..096aa91c81 100644 --- a/indra/llui/llresizehandle.cpp +++ b/indra/llui/llresizehandle.cpp @@ -43,7 +43,7 @@ const S32 RESIZE_BORDER_WIDTH = 3; -LLResizeHandle::LLResizeHandle( const LLString& name, const LLRect& rect, S32 min_width, S32 min_height, ECorner corner ) +LLResizeHandle::LLResizeHandle( const std::string& name, const LLRect& rect, S32 min_width, S32 min_height, ECorner corner ) : LLView( name, rect, TRUE ), mDragLastScreenX( 0 ), diff --git a/indra/llui/llresizehandle.h b/indra/llui/llresizehandle.h index 15336948e2..8054806e40 100644 --- a/indra/llui/llresizehandle.h +++ b/indra/llui/llresizehandle.h @@ -44,7 +44,7 @@ public: enum ECorner { LEFT_TOP, LEFT_BOTTOM, RIGHT_TOP, RIGHT_BOTTOM }; - LLResizeHandle(const LLString& name, const LLRect& rect, S32 min_width, S32 min_height, ECorner corner = RIGHT_BOTTOM ); + LLResizeHandle(const std::string& name, const LLRect& rect, S32 min_width, S32 min_height, ECorner corner = RIGHT_BOTTOM ); virtual void draw(); virtual BOOL handleHover(S32 x, S32 y, MASK mask); diff --git a/indra/llui/llresmgr.cpp b/indra/llui/llresmgr.cpp index 6cfc6a924b..cb4d8c3373 100644 --- a/indra/llui/llresmgr.cpp +++ b/indra/llui/llresmgr.cpp @@ -292,7 +292,7 @@ std::string LLResMgr::getMonetaryString( S32 input ) const BOOL negative_before = negative && (conv->n_sign_posn != 2); BOOL negative_after = negative && (conv->n_sign_posn == 2); - LLString digits = llformat("%u", abs(input)); + std::string digits = llformat("%u", abs(input)); if( !grouping || !grouping[0] ) { if( negative_before ) @@ -378,10 +378,10 @@ std::string LLResMgr::getMonetaryString( S32 input ) const return output; } -void LLResMgr::getIntegerString( LLString& output, S32 input ) const +void LLResMgr::getIntegerString( std::string& output, S32 input ) const { S32 fraction = 0; - LLString fraction_string; + std::string fraction_string; S32 remaining_count = input; while(remaining_count > 0) { @@ -415,16 +415,16 @@ void LLResMgr::getIntegerString( LLString& output, S32 input ) const } } -const LLString LLFONT_ID_NAMES[] = +const std::string LLFONT_ID_NAMES[] = { - LLString("OCRA"), - LLString("SANSSERIF"), - LLString("SANSSERIF_SMALL"), - LLString("SANSSERIF_BIG"), - LLString("SMALL"), + std::string("OCRA"), + std::string("SANSSERIF"), + std::string("SANSSERIF_SMALL"), + std::string("SANSSERIF_BIG"), + std::string("SMALL"), }; -const LLFontGL* LLResMgr::getRes( LLString font_id ) const +const LLFontGL* LLResMgr::getRes( std::string font_id ) const { for (S32 i=0; isetFollowsRight(); @@ -130,10 +129,9 @@ LLScrollbar::LLScrollbar( line_up_btn->setTabStop(FALSE); addChild(line_up_btn); - LLButton* line_down_btn = new LLButton( - "Line Down", line_down_rect, - line_down_img, line_down_selected_img, "", - &LLScrollbar::onLineDownBtnPressed, this, LLFontGL::sSansSerif ); + LLButton* line_down_btn = new LLButton(std::string("Line Down"), line_down_rect, + line_down_img, line_down_selected_img, LLStringUtil::null, + &LLScrollbar::onLineDownBtnPressed, this, LLFontGL::sSansSerif ); line_down_btn->setFollowsRight(); line_down_btn->setFollowsBottom(); line_down_btn->setHeldDownCallback( &LLScrollbar::onLineDownBtnPressed ); @@ -417,7 +415,7 @@ BOOL LLScrollbar::handleScrollWheel(S32 x, S32 y, S32 clicks) } BOOL LLScrollbar::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, - EDragAndDropType cargo_type, void *cargo_data, EAcceptance *accept, LLString &tooltip_msg) + EDragAndDropType cargo_type, void *cargo_data, EAcceptance *accept, std::string &tooltip_msg) { // enable this to get drag and drop to control scrollbars //if (!drop) diff --git a/indra/llui/llscrollbar.h b/indra/llui/llscrollbar.h index 4d3b711b1a..d35dc10bd4 100644 --- a/indra/llui/llscrollbar.h +++ b/indra/llui/llscrollbar.h @@ -51,7 +51,7 @@ class LLScrollbar public: enum ORIENTATION { HORIZONTAL, VERTICAL }; - LLScrollbar(const LLString& name, LLRect rect, + LLScrollbar(const std::string& name, LLRect rect, ORIENTATION orientation, S32 doc_size, S32 doc_pos, S32 page_size, void(*change_callback)( S32 new_pos, LLScrollbar* self, void* userdata ), @@ -69,7 +69,7 @@ public: virtual BOOL handleHover(S32 x, S32 y, MASK mask); virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks); virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, - EDragAndDropType cargo_type, void *cargo_data, EAcceptance *accept, LLString &tooltip_msg); + EDragAndDropType cargo_type, void *cargo_data, EAcceptance *accept, std::string &tooltip_msg); virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); diff --git a/indra/llui/llscrollcontainer.cpp b/indra/llui/llscrollcontainer.cpp index 3cb4ecc172..8bb051f3f5 100644 --- a/indra/llui/llscrollcontainer.cpp +++ b/indra/llui/llscrollcontainer.cpp @@ -60,7 +60,7 @@ static const F32 AUTO_SCROLL_RATE_ACCEL = 120.f; static LLRegisterWidget r("scroll_container"); // Default constructor -LLScrollableContainerView::LLScrollableContainerView( const LLString& name, +LLScrollableContainerView::LLScrollableContainerView( const std::string& name, const LLRect& rect, LLView* scrolled_view, BOOL is_opaque, @@ -82,7 +82,7 @@ LLScrollableContainerView::LLScrollableContainerView( const LLString& name, } // LLUICtrl constructor -LLScrollableContainerView::LLScrollableContainerView( const LLString& name, const LLRect& rect, +LLScrollableContainerView::LLScrollableContainerView( const std::string& name, const LLRect& rect, LLUICtrl* scrolled_ctrl, BOOL is_opaque, const LLColor4& bg_color) : LLUICtrl( name, rect, FALSE, NULL, NULL ), @@ -104,7 +104,7 @@ LLScrollableContainerView::LLScrollableContainerView( const LLString& name, cons void LLScrollableContainerView::init() { LLRect border_rect( 0, getRect().getHeight(), getRect().getWidth(), 0 ); - mBorder = new LLViewBorder( "scroll border", border_rect, LLViewBorder::BEVEL_IN ); + mBorder = new LLViewBorder( std::string("scroll border"), border_rect, LLViewBorder::BEVEL_IN ); addChild( mBorder ); mInnerRect.set( 0, getRect().getHeight(), getRect().getWidth(), 0 ); @@ -112,7 +112,7 @@ void LLScrollableContainerView::init() LLRect vertical_scroll_rect = mInnerRect; vertical_scroll_rect.mLeft = vertical_scroll_rect.mRight - SCROLLBAR_SIZE; - mScrollbar[VERTICAL] = new LLScrollbar( "scrollable vertical", + mScrollbar[VERTICAL] = new LLScrollbar( std::string("scrollable vertical"), vertical_scroll_rect, LLScrollbar::VERTICAL, mInnerRect.getHeight(), @@ -128,7 +128,7 @@ void LLScrollableContainerView::init() LLRect horizontal_scroll_rect = mInnerRect; horizontal_scroll_rect.mTop = horizontal_scroll_rect.mBottom + SCROLLBAR_SIZE; - mScrollbar[HORIZONTAL] = new LLScrollbar( "scrollable horizontal", + mScrollbar[HORIZONTAL] = new LLScrollbar( std::string("scrollable horizontal"), horizontal_scroll_rect, LLScrollbar::HORIZONTAL, mInnerRect.getWidth(), @@ -264,7 +264,7 @@ BOOL LLScrollableContainerView::handleDragAndDrop(S32 x, S32 y, MASK mask, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, - LLString& tooltip_msg) + std::string& tooltip_msg) { // Scroll folder view if needed. Never accepts a drag or drop. *accept = ACCEPT_NO; @@ -336,7 +336,7 @@ BOOL LLScrollableContainerView::handleDragAndDrop(S32 x, S32 y, MASK mask, } -BOOL LLScrollableContainerView::handleToolTip(S32 x, S32 y, LLString& msg, LLRect* sticky_rect) +BOOL LLScrollableContainerView::handleToolTip(S32 x, S32 y, std::string& msg, LLRect* sticky_rect) { S32 local_x, local_y; for( S32 i = 0; i < SCROLLBAR_COUNT; i++ ) @@ -700,7 +700,7 @@ LLXMLNodePtr LLScrollableContainerView::getXML(bool save_children) const LLView* LLScrollableContainerView::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory) { - LLString name("scroll_container"); + std::string name("scroll_container"); node->getAttributeString("name", name); LLRect rect; @@ -738,7 +738,7 @@ LLView* LLScrollableContainerView::fromXML(LLXMLNodePtr node, LLView *parent, LL if (panelp == NULL) { - panelp = new LLPanel("dummy", LLRect::null, FALSE); + panelp = new LLPanel(std::string("dummy"), LLRect::null, FALSE); } ret->mScrolledView = panelp; diff --git a/indra/llui/llscrollcontainer.h b/indra/llui/llscrollcontainer.h index 64be2169ad..f3da92cc88 100644 --- a/indra/llui/llscrollcontainer.h +++ b/indra/llui/llscrollcontainer.h @@ -59,10 +59,10 @@ public: // scrollbars have priority for mouse and keyboard events. enum SCROLL_ORIENTATION { VERTICAL, HORIZONTAL, SCROLLBAR_COUNT }; - LLScrollableContainerView( const LLString& name, const LLRect& rect, + LLScrollableContainerView( const std::string& name, const LLRect& rect, LLView* scrolled_view, BOOL is_opaque = FALSE, const LLColor4& bg_color = LLColor4(0,0,0,0) ); - LLScrollableContainerView( const LLString& name, const LLRect& rect, + LLScrollableContainerView( const std::string& name, const LLRect& rect, LLUICtrl* scrolled_ctrl, BOOL is_opaque = FALSE, const LLColor4& bg_color = LLColor4(0,0,0,0) ); virtual ~LLScrollableContainerView( void ); @@ -94,9 +94,9 @@ public: EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, - LLString& tooltip_msg); + std::string& tooltip_msg); - virtual BOOL handleToolTip(S32 x, S32 y, LLString& msg, LLRect* sticky_rect); + virtual BOOL handleToolTip(S32 x, S32 y, std::string& msg, LLRect* sticky_rect); virtual void draw(); virtual LLXMLNodePtr getXML(bool save_children = true) const; diff --git a/indra/llui/llscrollingpanellist.cpp b/indra/llui/llscrollingpanellist.cpp index 28755ed30f..c05dacf4d8 100644 --- a/indra/llui/llscrollingpanellist.cpp +++ b/indra/llui/llscrollingpanellist.cpp @@ -141,7 +141,7 @@ void LLScrollingPanelList::draw() // static LLView* LLScrollingPanelList::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory) { - LLString name("scrolling_panel_list"); + std::string name("scrolling_panel_list"); node->getAttributeString("name", name); LLRect rect; diff --git a/indra/llui/llscrollingpanellist.h b/indra/llui/llscrollingpanellist.h index dc0dcbd460..406c832383 100644 --- a/indra/llui/llscrollingpanellist.h +++ b/indra/llui/llscrollingpanellist.h @@ -41,7 +41,7 @@ class LLScrollingPanel : public LLPanel { public: - LLScrollingPanel(const LLString& name, const LLRect& rect) : LLPanel(name, rect) { } + LLScrollingPanel(const std::string& name, const LLRect& rect) : LLPanel(name, rect) { } virtual void updatePanel(BOOL allow_modify) = 0; }; @@ -52,7 +52,7 @@ public: class LLScrollingPanelList : public LLUICtrl { public: - LLScrollingPanelList(const LLString& name, const LLRect& rect) + LLScrollingPanelList(const std::string& name, const LLRect& rect) : LLUICtrl(name, rect, TRUE, NULL, NULL, FOLLOWS_LEFT | FOLLOWS_BOTTOM ) {} virtual void setValue(const LLSD& value) {}; diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp index b4a2ed874a..681c5ce5da 100644 --- a/indra/llui/llscrolllistctrl.cpp +++ b/indra/llui/llscrolllistctrl.cpp @@ -83,7 +83,7 @@ struct SortScrollListItem S32 order = sort_ascending ? 1 : -1; // ascending or descending sort for this column? if (cell1 && cell2) { - sort_result = order * LLString::compareDict(cell1->getValue().asString(), cell2->getValue().asString()); + sort_result = order * LLStringUtil::compareDict(cell1->getValue().asString(), cell2->getValue().asString()); if (sort_result != 0) { break; // we have a sort order! @@ -131,7 +131,7 @@ void LLScrollListIcon::setValue(const LLSD& value) } else { - LLString value_string = value.asString(); + std::string value_string = value.asString(); if (LLUUID::validate(value_string)) { setValue(LLUUID(value_string)); @@ -237,7 +237,7 @@ void LLScrollListSeparator::draw(const LLColor4& color, const LLColor4& highligh // U32 LLScrollListText::sCount = 0; -LLScrollListText::LLScrollListText( const LLString& text, const LLFontGL* font, S32 width, U8 font_style, LLFontGL::HAlign font_alignment, LLColor4& color, BOOL use_color, BOOL visible) +LLScrollListText::LLScrollListText( const std::string& text, const LLFontGL* font, S32 width, U8 font_style, LLFontGL::HAlign font_alignment, LLColor4& color, BOOL use_color, BOOL visible) : LLScrollListCell(width), mText( text ), mFont( font ), @@ -416,9 +416,9 @@ void LLScrollListItem::setColumn( S32 column, LLScrollListCell *cell ) } } -LLString LLScrollListItem::getContentsCSV() const +std::string LLScrollListItem::getContentsCSV() const { - LLString ret; + std::string ret; S32 count = getNumColumns(); for (S32 i=0; isetFollowsRight(); mScrollbar->setFollowsTop(); mScrollbar->setFollowsBottom(); @@ -621,7 +621,7 @@ LLScrollListCtrl::LLScrollListCtrl(const LLString& name, const LLRect& rect, if (show_border) { LLRect border_rect( 0, getRect().getHeight(), getRect().getWidth(), 0 ); - mBorder = new LLViewBorder( "dlg border", border_rect, LLViewBorder::BEVEL_IN, LLViewBorder::STYLE_LINE, 1 ); + mBorder = new LLViewBorder( std::string("dlg border"), border_rect, LLViewBorder::BEVEL_IN, LLViewBorder::STYLE_LINE, 1 ); addChild(mBorder); } @@ -756,7 +756,7 @@ std::vector LLScrollListCtrl::getAllData() const // returns first matching item LLScrollListItem* LLScrollListCtrl::getItem(const LLSD& sd) const { - LLString string_val = sd.asString(); + std::string string_val = sd.asString(); item_list::const_iterator iter; for(iter = mItemList.begin(); iter != mItemList.end(); iter++) @@ -1398,7 +1398,7 @@ void LLScrollListCtrl::deselectAllItems(BOOL no_commit_on_change) /////////////////////////////////////////////////////////////////////////////////////////////////// // Use this to add comment text such as "Searching", which ignores column settings of list -LLScrollListItem* LLScrollListCtrl::addCommentText(const LLString& comment_text, EAddPosition pos) +LLScrollListItem* LLScrollListCtrl::addCommentText(const std::string& comment_text, EAddPosition pos) { LLScrollListItem* item = NULL; if (getItemCount() < mMaxItemCount) @@ -1419,7 +1419,7 @@ LLScrollListItem* LLScrollListCtrl::addSeparator(EAddPosition pos) // Selects first enabled item of the given name. // Returns false if item not found. -BOOL LLScrollListCtrl::selectItemByLabel(const LLString& label, BOOL case_sensitive) +BOOL LLScrollListCtrl::selectItemByLabel(const std::string& label, BOOL case_sensitive) { // ensure that no stale items are selected, even if we don't find a match deselectAllItems(TRUE); @@ -1429,10 +1429,10 @@ BOOL LLScrollListCtrl::selectItemByLabel(const LLString& label, BOOL case_sensit return FALSE; } - LLString target_text = label; + std::string target_text = label; if (!case_sensitive) { - LLString::toLower(target_text); + LLStringUtil::toLower(target_text); } BOOL found = FALSE; @@ -1443,10 +1443,10 @@ BOOL LLScrollListCtrl::selectItemByLabel(const LLString& label, BOOL case_sensit { LLScrollListItem* item = *iter; // Only select enabled items with matching names - LLString item_text = item->getColumn(0)->getValue().asString(); + std::string item_text = item->getColumn(0)->getValue().asString(); if (!case_sensitive) { - LLString::toLower(item_text); + LLStringUtil::toLower(item_text); } BOOL select = !found && item->getEnabled() && item_text == target_text; if (select) @@ -1466,7 +1466,7 @@ BOOL LLScrollListCtrl::selectItemByLabel(const LLString& label, BOOL case_sensit } -BOOL LLScrollListCtrl::selectItemByPrefix(const LLString& target, BOOL case_sensitive) +BOOL LLScrollListCtrl::selectItemByPrefix(const std::string& target, BOOL case_sensitive) { return selectItemByPrefix(utf8str_to_wstring(target), case_sensitive); } @@ -1503,7 +1503,7 @@ BOOL LLScrollListCtrl::selectItemByPrefix(const LLWString& target, BOOL case_sen if (!case_sensitive) { // do comparisons in lower case - LLWString::toLower(target_trimmed); + LLWStringUtil::toLower(target_trimmed); } for (item_list::iterator iter = mItemList.begin(); iter != mItemList.end(); iter++) @@ -1519,11 +1519,11 @@ BOOL LLScrollListCtrl::selectItemByPrefix(const LLWString& target, BOOL case_sen LLWString item_label = utf8str_to_wstring(cellp->getValue().asString()); if (!case_sensitive) { - LLWString::toLower(item_label); + LLWStringUtil::toLower(item_label); } // remove extraneous whitespace from searchable label LLWString trimmed_label = item_label; - LLWString::trim(trimmed_label); + LLWStringUtil::trim(trimmed_label); BOOL select = item->getEnabled() && trimmed_label.compare(0, target_trimmed.size(), target_trimmed) == 0; @@ -1547,7 +1547,7 @@ BOOL LLScrollListCtrl::selectItemByPrefix(const LLWString& target, BOOL case_sen return found; } -const LLString LLScrollListCtrl::getSelectedItemLabel(S32 column) const +const std::string LLScrollListCtrl::getSelectedItemLabel(S32 column) const { LLScrollListItem* item; @@ -1557,14 +1557,14 @@ const LLString LLScrollListCtrl::getSelectedItemLabel(S32 column) const return item->getColumn(column)->getValue().asString(); } - return LLString::null; + return LLStringUtil::null; } /////////////////////////////////////////////////////////////////////////////////////////////////// // "StringUUID" interface: use this when you're creating a list that contains non-unique strings each of which // has an associated, unique UUID, and only one of which can be selected at a time. -LLScrollListItem* LLScrollListCtrl::addStringUUIDItem(const LLString& item_text, const LLUUID& id, EAddPosition pos, BOOL enabled, S32 column_width) +LLScrollListItem* LLScrollListCtrl::addStringUUIDItem(const std::string& item_text, const LLUUID& id, EAddPosition pos, BOOL enabled, S32 column_width) { LLScrollListItem* item = NULL; if (getItemCount() < mMaxItemCount) @@ -1792,7 +1792,7 @@ BOOL LLScrollListCtrl::handleScrollWheel(S32 x, S32 y, S32 clicks) return handled; } -BOOL LLScrollListCtrl::handleToolTip(S32 x, S32 y, LLString& msg, LLRect* sticky_rect_screen) +BOOL LLScrollListCtrl::handleToolTip(S32 x, S32 y, std::string& msg, LLRect* sticky_rect_screen) { S32 column_index = getColumnIndexFromOffset(x); LLScrollListColumn* columnp = getColumn(column_index); @@ -2532,7 +2532,7 @@ void LLScrollListCtrl::onScrollChange( S32 new_pos, LLScrollbar* scrollbar, void } -void LLScrollListCtrl::sortByColumn(LLString name, BOOL ascending) +void LLScrollListCtrl::sortByColumn(const std::string& name, BOOL ascending) { if (name.empty()) { @@ -2540,15 +2540,15 @@ void LLScrollListCtrl::sortByColumn(LLString name, BOOL ascending) return; } - std::map::iterator itor = mColumns.find(name); + std::map::iterator itor = mColumns.find(name); if (itor != mColumns.end()) { - sortByColumn((*itor).second.mIndex, ascending); + sortByColumnIndex((*itor).second.mIndex, ascending); } } // First column is column 0 -void LLScrollListCtrl::sortByColumn(U32 column, BOOL ascending) +void LLScrollListCtrl::sortByColumnIndex(U32 column, BOOL ascending) { if (setSort(column, ascending)) { @@ -2575,7 +2575,7 @@ void LLScrollListCtrl::dirtyColumns() // just in case someone indexes into it immediately mColumnsIndexed.resize(mColumns.size()); - std::map::iterator column_itor; + std::map::iterator column_itor; for (column_itor = mColumns.begin(); column_itor != mColumns.end(); ++column_itor) { LLScrollListColumn *column = &column_itor->second; @@ -2664,7 +2664,7 @@ LLXMLNodePtr LLScrollListCtrl::getXML(bool save_children) const // Contents - std::map::const_iterator itor; + std::map::const_iterator itor; std::vector sorted_list; sorted_list.resize(mColumns.size()); for (itor = mColumns.begin(); itor != mColumns.end(); ++itor) @@ -2756,7 +2756,7 @@ void LLScrollListCtrl::setScrollListParameters(LLXMLNodePtr node) // static LLView* LLScrollListCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory) { - LLString name("scroll_list"); + std::string name("scroll_list"); node->getAttributeString("name", name); LLRect rect; @@ -2806,7 +2806,7 @@ LLView* LLScrollListCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFac if (sort_column >= 0) { - scroll_list->sortByColumn(sort_column, sort_ascending); + scroll_list->sortByColumnIndex(sort_column, sort_ascending); } LLSD columns; @@ -2817,19 +2817,19 @@ LLView* LLScrollListCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFac { if (child->hasName("column")) { - LLString labelname(""); + std::string labelname(""); child->getAttributeString("label", labelname); - LLString columnname(labelname); + std::string columnname(labelname); child->getAttributeString("name", columnname); - LLString sortname(columnname); + std::string sortname(columnname); child->getAttributeString("sort", sortname); BOOL sort_ascending = TRUE; child->getAttributeBOOL("sort_ascending", sort_ascending); - LLString imagename; + std::string imagename; child->getAttributeString("image", imagename); BOOL columndynamicwidth = FALSE; @@ -2838,7 +2838,7 @@ LLView* LLScrollListCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFac S32 columnwidth = -1; child->getAttributeS32("width", columnwidth); - LLString tooltip; + std::string tooltip; child->getAttributeString("tool_tip", tooltip); if(!columndynamicwidth) total_static += llmax(0, columnwidth); @@ -2883,15 +2883,15 @@ LLView* LLScrollListCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFac { if (row_child->hasName("column")) { - LLString value = row_child->getTextContents(); + std::string value = row_child->getTextContents(); - LLString columnname(""); + std::string columnname(""); row_child->getAttributeString("name", columnname); - LLString font(""); + std::string font(""); row_child->getAttributeString("font", font); - LLString font_style(""); + std::string font_style(""); row_child->getAttributeString("font-style", font_style); row["columns"][column_idx]["column"] = columnname; @@ -2905,7 +2905,7 @@ LLView* LLScrollListCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFac } } - LLString contents = node->getTextContents(); + std::string contents = node->getTextContents(); if (!contents.empty()) { typedef boost::tokenizer > tokenizer; @@ -2915,7 +2915,7 @@ LLView* LLScrollListCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFac while(token_iter != tokens.end()) { - const char* line = token_iter->c_str(); + const std::string& line = *token_iter; scroll_list->addSimpleElement(line); ++token_iter; } @@ -2929,7 +2929,7 @@ LLView* LLScrollListCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFac // virtual void LLScrollListCtrl::copy() { - LLString buffer; + std::string buffer; std::vector items = getAllSelected(); std::vector::iterator itor; @@ -2999,7 +2999,7 @@ BOOL LLScrollListCtrl::canDeselect() const void LLScrollListCtrl::addColumn(const LLSD& column, EAddPosition pos) { - LLString name = column["name"].asString(); + std::string name = column["name"].asString(); // if no column name provided, just use ordinal as name if (name.empty()) { @@ -3030,7 +3030,7 @@ void LLScrollListCtrl::addColumn(const LLSD& column, EAddPosition pos) S32 top = mItemListRect.mTop; S32 left = mItemListRect.mLeft; { - std::map::iterator itor; + std::map::iterator itor; for (itor = mColumns.begin(); itor != mColumns.end(); ++itor) { if (itor->second.mIndex < new_column->mIndex && @@ -3040,7 +3040,7 @@ void LLScrollListCtrl::addColumn(const LLSD& column, EAddPosition pos) } } } - LLString button_name = "btn_" + name; + std::string button_name = "btn_" + name; S32 right = left+new_column->mWidth; if (new_column->mIndex != (S32)mColumns.size()-1) { @@ -3101,7 +3101,7 @@ void LLScrollListCtrl::onClickColumn(void *userdata) ascending = !parent->mSortColumns.back().second; } - parent->sortByColumn(column_index, ascending); + parent->sortByColumnIndex(column_index, ascending); if (parent->mOnSortChangedCallback) { @@ -3124,7 +3124,7 @@ BOOL LLScrollListCtrl::needsSorting() void LLScrollListCtrl::clearColumns() { - std::map::iterator itor; + std::map::iterator itor; for (itor = mColumns.begin(); itor != mColumns.end(); ++itor) { LLColumnHeader *header = itor->second.mHeader; @@ -3138,9 +3138,9 @@ void LLScrollListCtrl::clearColumns() mSortColumns.clear(); } -void LLScrollListCtrl::setColumnLabel(const LLString& column, const LLString& label) +void LLScrollListCtrl::setColumnLabel(const std::string& column, const std::string& label) { - std::map::iterator itor = mColumns.find(column); + std::map::iterator itor = mColumns.find(column); if (itor != mColumns.end()) { itor->second.mLabel = label; @@ -3194,7 +3194,7 @@ LLScrollListItem* LLScrollListCtrl::addElement(const LLSD& value, EAddPosition p // skip unused columns in item passed in continue; } - LLString column = (*itor)["column"].asString(); + std::string column = (*itor)["column"].asString(); LLScrollListColumn* columnp = NULL; @@ -3206,7 +3206,7 @@ LLScrollListItem* LLScrollListCtrl::addElement(const LLSD& value, EAddPosition p column = new_name.str(); } - std::map::iterator column_itor; + std::map::iterator column_itor; column_itor = mColumns.find(column); if (column_itor != mColumns.end()) { @@ -3239,9 +3239,9 @@ LLScrollListItem* LLScrollListCtrl::addElement(const LLSD& value, EAddPosition p LLFontGL::HAlign font_alignment = columnp->mFontAlignment; LLSD value = (*itor)["value"]; - LLString fontname = (*itor)["font"].asString(); - LLString fontstyle = (*itor)["font-style"].asString(); - LLString type = (*itor)["type"].asString(); + std::string fontname = (*itor)["font"].asString(); + std::string fontstyle = (*itor)["font-style"].asString(); + std::string type = (*itor)["type"].asString(); BOOL has_color = (*itor).has("color"); LLColor4 color = ((*itor)["color"]); BOOL enabled = !(*itor).has("enabled") || (*itor)["enabled"].asBoolean() == true; @@ -3264,8 +3264,8 @@ LLScrollListItem* LLScrollListCtrl::addElement(const LLSD& value, EAddPosition p } else if (type == "checkbox") { - LLCheckBoxCtrl* ctrl = new LLCheckBoxCtrl("check", - LLRect(0, width, width, 0), " "); + LLCheckBoxCtrl* ctrl = new LLCheckBoxCtrl(std::string("check"), + LLRect(0, width, width, 0), std::string(" ")); ctrl->setEnabled(enabled); ctrl->setValue(value); LLScrollListCheck* cell = new LLScrollListCheck(ctrl,width); @@ -3308,7 +3308,7 @@ LLScrollListItem* LLScrollListCtrl::addElement(const LLSD& value, EAddPosition p if (new_item->getColumn(column_idx) == NULL) { LLScrollListColumn* column_ptr = &column_it->second; - new_item->setColumn(column_idx, new LLScrollListText("", LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF_SMALL ), column_ptr->mWidth, LLFontGL::NORMAL)); + new_item->setColumn(column_idx, new LLScrollListText(LLStringUtil::null, LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF_SMALL ), column_ptr->mWidth, LLFontGL::NORMAL)); } } @@ -3317,7 +3317,7 @@ LLScrollListItem* LLScrollListCtrl::addElement(const LLSD& value, EAddPosition p return new_item; } -LLScrollListItem* LLScrollListCtrl::addSimpleElement(const LLString& value, EAddPosition pos, const LLSD& id) +LLScrollListItem* LLScrollListCtrl::addSimpleElement(const std::string& value, EAddPosition pos, const LLSD& id) { LLSD entry_id = id; @@ -3434,7 +3434,7 @@ void LLScrollListCtrl::onFocusLost() LLUICtrl::onFocusLost(); } -LLColumnHeader::LLColumnHeader(const LLString& label, const LLRect &rect, LLScrollListColumn* column, const LLFontGL* fontp) : +LLColumnHeader::LLColumnHeader(const std::string& label, const LLRect &rect, LLScrollListColumn* column, const LLFontGL* fontp) : LLComboBox(label, rect, label, NULL, NULL), mColumn(column), mOrigLabel(label), @@ -3453,15 +3453,15 @@ LLColumnHeader::LLColumnHeader(const LLString& label, const LLRect &rect, LLScro mButton->setCallbackUserData(this); - mAscendingText = "[LOW]...[HIGH](Ascending)"; - mDescendingText = "[HIGH]...[LOW](Descending)"; + mAscendingText = std::string("[LOW]...[HIGH](Ascending)"); // *TODO: Translate + mDescendingText = std::string("[HIGH]...[LOW](Descending)"); // *TODO: Translate mList->reshape(llmax(mList->getRect().getWidth(), 110, getRect().getWidth()), mList->getRect().getHeight()); // resize handles on left and right const S32 RESIZE_BAR_THICKNESS = 3; mResizeBar = new LLResizeBar( - "resizebar", + std::string("resizebar"), this, LLRect( getRect().getWidth() - RESIZE_BAR_THICKNESS, getRect().getHeight(), getRect().getWidth(), 0), MIN_COLUMN_WIDTH, S32_MAX, LLResizeBar::RIGHT ); @@ -3514,7 +3514,7 @@ BOOL LLColumnHeader::handleDoubleClick(S32 x, S32 y, MASK mask) return TRUE; } -void LLColumnHeader::setImage(const LLString &image_name) +void LLColumnHeader::setImage(const std::string &image_name) { if (mButton) { @@ -3567,8 +3567,8 @@ void LLColumnHeader::showList() // move sort column over to this column and do initial sort mColumn->mParentCtrl->sortByColumn(mColumn->mSortingColumn, mColumn->mParentCtrl->getSortAscending()); - LLString low_item_text; - LLString high_item_text; + std::string low_item_text; + std::string high_item_text; LLScrollListItem* itemp = mColumn->mParentCtrl->getFirstData(); if (itemp) @@ -3604,11 +3604,11 @@ void LLColumnHeader::showList() } } - LLString::truncate(low_item_text, 3); - LLString::truncate(high_item_text, 3); + LLStringUtil::truncate(low_item_text, 3); + LLStringUtil::truncate(high_item_text, 3); - LLString ascending_string; - LLString descending_string; + std::string ascending_string; + std::string descending_string; if (low_item_text.empty() || high_item_text.empty()) { diff --git a/indra/llui/llscrolllistctrl.h b/indra/llui/llscrolllistctrl.h index 04a6a181eb..05ef69c9a4 100644 --- a/indra/llui/llscrolllistctrl.h +++ b/indra/llui/llscrolllistctrl.h @@ -65,7 +65,7 @@ public: virtual S32 getWidth() const {return mWidth;} virtual S32 getContentWidth() const { return 0; } virtual S32 getHeight() const = 0; - virtual const LLSD getValue() const { return LLString::null; } + virtual const LLSD getValue() const { return LLStringUtil::null; } virtual void setValue(const LLSD& value) { } virtual BOOL getVisible() const { return TRUE; } virtual void setWidth(S32 width) { mWidth = width; } @@ -100,7 +100,7 @@ public: class LLScrollListText : public LLScrollListCell { public: - LLScrollListText( const LLString& text, const LLFontGL* font, S32 width = 0, U8 font_style = LLFontGL::NORMAL, LLFontGL::HAlign font_alignment = LLFontGL::LEFT, LLColor4& color = LLColor4::black, BOOL use_color = FALSE, BOOL visible = TRUE); + LLScrollListText( const std::string& text, const LLFontGL* font, S32 width = 0, U8 font_style = LLFontGL::NORMAL, LLFontGL::HAlign font_alignment = LLFontGL::LEFT, LLColor4& color = LLColor4::black, BOOL use_color = FALSE, BOOL visible = TRUE); /*virtual*/ ~LLScrollListText(); virtual void draw(const LLColor4& color, const LLColor4& highlight_color) const; @@ -145,7 +145,7 @@ public: virtual void draw(const LLColor4& color, const LLColor4& highlight_color) const; virtual S32 getWidth() const; virtual S32 getHeight() const { return mIcon ? mIcon->getHeight() : 0; } - virtual const LLSD getValue() const { return mIcon.isNull() ? LLString::null : mIcon->getName(); } + virtual const LLSD getValue() const { return mIcon.isNull() ? LLStringUtil::null : mIcon->getName(); } virtual void setColor(const LLColor4&); virtual BOOL isText()const { return FALSE; } virtual void setValue(const LLSD& value); @@ -201,7 +201,7 @@ public: mFontAlignment(LLFontGL::LEFT) { } - LLScrollListColumn(LLString name, LLString label, S32 width, F32 relwidth) : + LLScrollListColumn(std::string name, std::string label, S32 width, F32 relwidth) : mName(name), mSortingColumn(name), mSortAscending(TRUE), @@ -267,10 +267,10 @@ public: // Public data is fine so long as this remains a simple struct-like data class. // If it ever gets any smarter than that, these should all become private // with protected or public accessor methods added as needed. -MG - LLString mName; - LLString mSortingColumn; + std::string mName; + std::string mSortingColumn; BOOL mSortAscending; - LLString mLabel; + std::string mLabel; S32 mWidth; F32 mRelWidth; BOOL mDynamicWidth; @@ -284,7 +284,7 @@ public: class LLColumnHeader : public LLComboBox { public: - LLColumnHeader(const LLString& label, const LLRect &rect, LLScrollListColumn* column, const LLFontGL *font = NULL); + LLColumnHeader(const std::string& label, const LLRect &rect, LLScrollListColumn* column, const LLFontGL *font = NULL); ~LLColumnHeader(); /*virtual*/ void draw(); @@ -294,12 +294,12 @@ public: /*virtual*/ LLView* findSnapEdge(S32& new_edge_val, const LLCoordGL& mouse_dir, ESnapEdge snap_edge, ESnapType snap_type, S32 threshold, S32 padding); /*virtual*/ void userSetShape(const LLRect& new_rect); - void setImage(const LLString &image_name); + void setImage(const std::string &image_name); LLScrollListColumn* getColumn() { return mColumn; } void setHasResizableElement(BOOL resizable); BOOL canResize(); void enableResizeBar(BOOL enable); - LLString getLabel() { return mOrigLabel; } + std::string getLabel() { return mOrigLabel; } static void onSelectSort(LLUICtrl* ctrl, void* user_data); static void onClick(void* user_data); @@ -309,7 +309,7 @@ public: private: LLScrollListColumn* mColumn; LLResizeBar* mResizeBar; - LLString mOrigLabel; + std::string mOrigLabel; LLUIString mAscendingText; LLUIString mDescendingText; BOOL mShowSortOptions; @@ -340,7 +340,7 @@ public: // If width = 0, just use the width of the text. Otherwise override with // specified width in pixels. - void addColumn( const LLString& text, const LLFontGL* font, S32 width = 0 , U8 font_style = LLFontGL::NORMAL, LLFontGL::HAlign font_alignment = LLFontGL::LEFT, BOOL visible = TRUE) + void addColumn( const std::string& text, const LLFontGL* font, S32 width = 0 , U8 font_style = LLFontGL::NORMAL, LLFontGL::HAlign font_alignment = LLFontGL::LEFT, BOOL visible = TRUE) { mColumns.push_back( new LLScrollListText(text, font, width, font_style, font_alignment, LLColor4::black, FALSE, visible) ); } void addColumn( LLUIImagePtr icon, S32 width = 0 ) @@ -357,7 +357,7 @@ public: LLScrollListCell *getColumn(const S32 i) const { if (0 <= i && i < (S32)mColumns.size()) { return mColumns[i]; } return NULL; } - LLString getContentsCSV() const; + std::string getContentsCSV() const; virtual void draw(const LLRect& rect, const LLColor4& fg_color, const LLColor4& bg_color, const LLColor4& highlight_color, S32 column_padding); @@ -377,7 +377,7 @@ private: class LLScrollListItemComment : public LLScrollListItem { public: - LLScrollListItemComment(const LLString& comment_string, const LLColor4& color); + LLScrollListItemComment(const std::string& comment_string, const LLColor4& color); /*virtual*/ void draw(const LLRect& rect, const LLColor4& fg_color, const LLColor4& bg_color, const LLColor4& highlight_color, S32 column_padding); private: @@ -397,7 +397,7 @@ class LLScrollListCtrl : public LLUICtrl, public LLEditMenuHandler, { public: LLScrollListCtrl( - const LLString& name, + const std::string& name, const LLRect& rect, void (*commit_callback)(LLUICtrl*, void*), void* callback_userdata, @@ -416,14 +416,14 @@ public: // Sets an array of column descriptors void setColumnHeadings(LLSD headings); - void sortByColumn(U32 column, BOOL ascending); + void sortByColumnIndex(U32 column, BOOL ascending); // LLCtrlListInterface functions virtual S32 getItemCount() const; // Adds a single column descriptor: ["name" : string, "label" : string, "width" : integer, "relwidth" : integer ] virtual void addColumn(const LLSD& column, EAddPosition pos = ADD_BOTTOM); virtual void clearColumns(); - virtual void setColumnLabel(const LLString& column, const LLString& label); + virtual void setColumnLabel(const std::string& column, const std::string& label); virtual LLScrollListColumn* getColumn(S32 index); virtual S32 getNumColumns() const { return mColumnsIndexed.size(); } @@ -435,7 +435,7 @@ public: // Simple add element. Takes a single array of: // [ "value" => value, "font" => font, "font-style" => style ] virtual void clearRows(); // clears all elements - virtual void sortByColumn(LLString name, BOOL ascending); + virtual void sortByColumn(const std::string& name, BOOL ascending); // These functions take and return an array of arrays of elements, as above virtual void setValue(const LLSD& value ); @@ -490,24 +490,24 @@ public: S32 getItemIndex( LLScrollListItem* item ) const; S32 getItemIndex( const LLUUID& item_id ) const; - LLScrollListItem* addCommentText( const LLString& comment_text, EAddPosition pos = ADD_BOTTOM); + LLScrollListItem* addCommentText( const std::string& comment_text, EAddPosition pos = ADD_BOTTOM); LLScrollListItem* addSeparator(EAddPosition pos); // "Simple" interface: use this when you're creating a list that contains only unique strings, only // one of which can be selected at a time. - virtual LLScrollListItem* addSimpleElement(const LLString& value, EAddPosition pos = ADD_BOTTOM, const LLSD& id = LLSD()); + virtual LLScrollListItem* addSimpleElement(const std::string& value, EAddPosition pos = ADD_BOTTOM, const LLSD& id = LLSD()); - BOOL selectItemByLabel( const LLString& item, BOOL case_sensitive = TRUE ); // FALSE if item not found - BOOL selectItemByPrefix(const LLString& target, BOOL case_sensitive = TRUE); + BOOL selectItemByLabel( const std::string& item, BOOL case_sensitive = TRUE ); // FALSE if item not found + BOOL selectItemByPrefix(const std::string& target, BOOL case_sensitive = TRUE); BOOL selectItemByPrefix(const LLWString& target, BOOL case_sensitive = TRUE); - const LLString getSelectedItemLabel(S32 column = 0) const; + const std::string getSelectedItemLabel(S32 column = 0) const; LLSD getSelectedValue(); // DEPRECATED: Use LLSD versions of addCommentText() and getSelectedValue(). // "StringUUID" interface: use this when you're creating a list that contains non-unique strings each of which // has an associated, unique UUID, and only one of which can be selected at a time. - LLScrollListItem* addStringUUIDItem(const LLString& item_text, const LLUUID& id, EAddPosition pos = ADD_BOTTOM, BOOL enabled = TRUE, S32 column_width = 0); + LLScrollListItem* addStringUUIDItem(const std::string& item_text, const LLUUID& id, EAddPosition pos = ADD_BOTTOM, BOOL enabled = TRUE, S32 column_width = 0); LLUUID getStringUUIDSelectedItem() const; LLScrollListItem* getFirstSelected() const; @@ -565,7 +565,7 @@ public: /*virtual*/ BOOL handleKeyHere(KEY key, MASK mask); /*virtual*/ BOOL handleUnicodeCharHere(llwchar uni_char); /*virtual*/ BOOL handleScrollWheel(S32 x, S32 y, S32 clicks); - /*virtual*/ BOOL handleToolTip(S32 x, S32 y, LLString& msg, LLRect* sticky_rect); + /*virtual*/ BOOL handleToolTip(S32 x, S32 y, std::string& msg, LLRect* sticky_rect); /*virtual*/ void setEnabled(BOOL enabled); /*virtual*/ void setFocus( BOOL b ); /*virtual*/ void onFocusReceived(); @@ -716,7 +716,7 @@ private: BOOL mSorted; - typedef std::map column_map_t; + typedef std::map column_map_t; column_map_t mColumns; BOOL mDirty; diff --git a/indra/llui/llslider.cpp b/indra/llui/llslider.cpp index d53e957c9c..28058d0005 100644 --- a/indra/llui/llslider.cpp +++ b/indra/llui/llslider.cpp @@ -46,7 +46,7 @@ static LLRegisterWidget r2("volume_slider"); LLSlider::LLSlider( - const LLString& name, + const std::string& name, const LLRect& rect, void (*on_commit_callback)(LLUICtrl* ctrl, void* userdata), void* callback_userdata, @@ -55,7 +55,7 @@ LLSlider::LLSlider( F32 max_value, F32 increment, BOOL volume, - const LLString& control_name) + const std::string& control_name) : LLUICtrl( name, rect, TRUE, on_commit_callback, callback_userdata, FOLLOWS_LEFT | FOLLOWS_TOP), @@ -303,7 +303,7 @@ LLXMLNodePtr LLSlider::getXML(bool save_children) const //static LLView* LLSlider::fromXML(LLXMLNodePtr node, LLView *parent, class LLUICtrlFactory *factory) { - LLString name("slider_bar"); + std::string name("slider_bar"); node->getAttributeString("name", name); LLRect rect; diff --git a/indra/llui/llslider.h b/indra/llui/llslider.h index ba0fac1465..a0fa543e98 100644 --- a/indra/llui/llslider.h +++ b/indra/llui/llslider.h @@ -41,7 +41,7 @@ class LLSlider : public LLUICtrl { public: LLSlider( - const LLString& name, + const std::string& name, const LLRect& rect, void (*on_commit_callback)(LLUICtrl* ctrl, void* userdata), void* callback_userdata, @@ -50,7 +50,7 @@ public: F32 max_value, F32 increment, BOOL volume, //TODO: create a "volume" slider sub-class or just use image art, no? -MG - const LLString& control_name = LLString::null ); + const std::string& control_name = LLStringUtil::null ); virtual LLXMLNodePtr getXML(bool save_children = true) const; static LLView* fromXML(LLXMLNodePtr node, LLView *parent, class LLUICtrlFactory *factory); diff --git a/indra/llui/llsliderctrl.cpp b/indra/llui/llsliderctrl.cpp index a2b0718c50..41ca6f6319 100644 --- a/indra/llui/llsliderctrl.cpp +++ b/indra/llui/llsliderctrl.cpp @@ -53,8 +53,8 @@ const U32 MAX_STRING_LENGTH = 10; static LLRegisterWidget r("slider"); -LLSliderCtrl::LLSliderCtrl(const LLString& name, const LLRect& rect, - const LLString& label, +LLSliderCtrl::LLSliderCtrl(const std::string& name, const LLRect& rect, + const std::string& label, const LLFontGL* font, S32 label_width, S32 text_left, @@ -64,7 +64,7 @@ LLSliderCtrl::LLSliderCtrl(const LLString& name, const LLRect& rect, void (*commit_callback)(LLUICtrl*, void*), void* callback_user_data, F32 initial_value, F32 min_value, F32 max_value, F32 increment, - const LLString& control_which) + const std::string& control_which) : LLUICtrl(name, rect, TRUE, commit_callback, callback_user_data ), mFont(font), mShowText( show_text ), @@ -93,7 +93,7 @@ LLSliderCtrl::LLSliderCtrl(const LLString& name, const LLRect& rect, label_width = font->getWidth(label); } LLRect label_rect( left, top, label_width, bottom ); - mLabelBox = new LLTextBox( "SliderCtrl Label", label_rect, label.c_str(), font ); + mLabelBox = new LLTextBox( std::string("SliderCtrl Label"), label_rect, label, font ); addChild(mLabelBox); } @@ -105,12 +105,11 @@ LLSliderCtrl::LLSliderCtrl(const LLString& name, const LLRect& rect, S32 slider_left = label_width ? label_width + SLIDERCTRL_SPACING : 0; LLRect slider_rect( slider_left, top, slider_right, bottom ); - mSlider = new LLSlider( - "slider", - slider_rect, - LLSliderCtrl::onSliderCommit, this, - initial_value, min_value, max_value, increment, volume, - control_which ); + mSlider = new LLSlider(std::string("slider"), + slider_rect, + LLSliderCtrl::onSliderCommit, this, + initial_value, min_value, max_value, increment, volume, + control_which ); addChild( mSlider ); if( show_text ) @@ -118,11 +117,11 @@ LLSliderCtrl::LLSliderCtrl(const LLString& name, const LLRect& rect, LLRect text_rect( text_left, top, getRect().getWidth(), bottom ); if( can_edit_text ) { - mEditor = new LLLineEditor( "SliderCtrl Editor", text_rect, - "", font, - MAX_STRING_LENGTH, - &LLSliderCtrl::onEditorCommit, NULL, NULL, this, - &LLLineEditor::prevalidateFloat ); + mEditor = new LLLineEditor( std::string("SliderCtrl Editor"), text_rect, + LLStringUtil::null, font, + MAX_STRING_LENGTH, + &LLSliderCtrl::onEditorCommit, NULL, NULL, this, + &LLLineEditor::prevalidateFloat ); mEditor->setFollowsLeft(); mEditor->setFollowsBottom(); mEditor->setFocusReceivedCallback( &LLSliderCtrl::onEditorGainFocus, this ); @@ -134,7 +133,7 @@ LLSliderCtrl::LLSliderCtrl(const LLString& name, const LLRect& rect, } else { - mTextBox = new LLTextBox( "SliderCtrl Text", text_rect, "", font); + mTextBox = new LLTextBox( std::string("SliderCtrl Text"), text_rect, LLStringUtil::null, font); mTextBox->setFollowsLeft(); mTextBox->setFollowsBottom(); addChild(mTextBox); @@ -162,7 +161,7 @@ void LLSliderCtrl::setValue(F32 v, BOOL from_event) updateText(); } -BOOL LLSliderCtrl::setLabelArg( const LLString& key, const LLStringExplicit& text ) +BOOL LLSliderCtrl::setLabelArg( const std::string& key, const LLStringExplicit& text ) { BOOL res = FALSE; if (mLabelBox) @@ -192,11 +191,11 @@ void LLSliderCtrl::clear() setValue(0.0f); if( mEditor ) { - mEditor->setText( LLString::null ); + mEditor->setText( LLStringUtil::null ); } if( mTextBox ) { - mTextBox->setText( LLString::null ); + mTextBox->setText( LLStringUtil::null ); } } @@ -210,8 +209,8 @@ void LLSliderCtrl::updateText() // Don't display very small negative values as -0.000 F32 displayed_value = (F32)(floor(getValueF32() * pow(10.0, (F64)mPrecision) + 0.5) / pow(10.0, (F64)mPrecision)); - LLString format = llformat("%%.%df", mPrecision); - LLString text = llformat(format.c_str(), displayed_value); + std::string format = llformat("%%.%df", mPrecision); + std::string text = llformat(format.c_str(), displayed_value); if( mEditor ) { mEditor->setText( text ); @@ -233,7 +232,7 @@ void LLSliderCtrl::onEditorCommit( LLUICtrl* caller, void *userdata ) F32 val = self->mValue; F32 saved_val = self->mValue; - LLString text = self->mEditor->getText(); + std::string text = self->mEditor->getText(); if( LLLineEditor::postvalidateFloat( text ) ) { LLLocale locale(LLLocale::USER_LOCALE); @@ -450,10 +449,10 @@ LLXMLNodePtr LLSliderCtrl::getXML(bool save_children) const LLView* LLSliderCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory) { - LLString name("slider"); + std::string name("slider"); node->getAttributeString("name", name); - LLString label; + std::string label; node->getAttributeString("label", label); LLRect rect; @@ -499,13 +498,13 @@ LLView* LLSliderCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory { // calculate the size of the text box (log max_value is number of digits - 1 so plus 1) if ( max_value ) - text_left = font->getWidth("0") * ( static_cast < S32 > ( log10 ( max_value ) ) + precision + 1 ); + text_left = font->getWidth(std::string("0")) * ( static_cast < S32 > ( log10 ( max_value ) ) + precision + 1 ); if ( increment < 1.0f ) - text_left += font->getWidth("."); // (mostly) take account of decimal point in value + text_left += font->getWidth(std::string(".")); // (mostly) take account of decimal point in value if ( min_value < 0.0f || max_value < 0.0f ) - text_left += font->getWidth("-"); // (mostly) take account of minus sign + text_left += font->getWidth(std::string("-")); // (mostly) take account of minus sign // padding to make things look nicer text_left += 8; diff --git a/indra/llui/llsliderctrl.h b/indra/llui/llsliderctrl.h index 992fbafe38..4e7fe36bb4 100644 --- a/indra/llui/llsliderctrl.h +++ b/indra/llui/llsliderctrl.h @@ -48,9 +48,9 @@ const S32 SLIDERCTRL_HEIGHT = 16; class LLSliderCtrl : public LLUICtrl { public: - LLSliderCtrl(const LLString& name, + LLSliderCtrl(const std::string& name, const LLRect& rect, - const LLString& label, + const std::string& label, const LLFontGL* font, S32 slider_left, S32 text_left, @@ -60,7 +60,7 @@ public: void (*commit_callback)(LLUICtrl*, void*), void* callback_userdata, F32 initial_value, F32 min_value, F32 max_value, F32 increment, - const LLString& control_which = LLString::null ); + const std::string& control_which = LLStringUtil::null ); virtual ~LLSliderCtrl() {} // Children all cleaned up by default view destructor. @@ -72,7 +72,7 @@ public: virtual void setValue(const LLSD& value) { setValue((F32)value.asReal(), TRUE); } virtual LLSD getValue() const { return LLSD(getValueF32()); } - virtual BOOL setLabelArg( const LLString& key, const LLStringExplicit& text ); + virtual BOOL setLabelArg( const std::string& key, const LLStringExplicit& text ); virtual void setMinValue(LLSD min_value) { setMinValue((F32)min_value.asReal()); } virtual void setMaxValue(LLSD max_value) { setMaxValue((F32)max_value.asReal()); } @@ -101,13 +101,13 @@ public: virtual void setTentative(BOOL b); // marks value as tentative virtual void onCommit(); // mark not tentative, then commit - virtual void setControlName(const LLString& control_name, LLView* context) + virtual void setControlName(const std::string& control_name, LLView* context) { LLView::setControlName(control_name, context); mSlider->setControlName(control_name, context); } - virtual LLString getControlName() const { return mSlider->getControlName(); } + virtual std::string getControlName() const { return mSlider->getControlName(); } static void onSliderCommit(LLUICtrl* caller, void* userdata); static void onSliderMouseDown(LLUICtrl* caller,void* userdata); diff --git a/indra/llui/llspinctrl.cpp b/indra/llui/llspinctrl.cpp index c577b35e19..e7fc10912e 100644 --- a/indra/llui/llspinctrl.cpp +++ b/indra/llui/llspinctrl.cpp @@ -53,11 +53,11 @@ const U32 MAX_STRING_LENGTH = 32; static LLRegisterWidget r2("spinner"); -LLSpinCtrl::LLSpinCtrl( const LLString& name, const LLRect& rect, const LLString& label, const LLFontGL* font, +LLSpinCtrl::LLSpinCtrl( const std::string& name, const LLRect& rect, const std::string& label, const LLFontGL* font, void (*commit_callback)(LLUICtrl*, void*), void* callback_user_data, F32 initial_value, F32 min_value, F32 max_value, F32 increment, - const LLString& control_name, + const std::string& control_name, S32 label_width) : LLUICtrl(name, rect, TRUE, commit_callback, callback_user_data, FOLLOWS_LEFT | FOLLOWS_TOP ), @@ -82,7 +82,7 @@ LLSpinCtrl::LLSpinCtrl( const LLString& name, const LLRect& rect, const LLString if( !label.empty() ) { LLRect label_rect( 0, centered_top, label_width, centered_bottom ); - mLabelBox = new LLTextBox( "SpinCtrl Label", label_rect, label.c_str(), font ); + mLabelBox = new LLTextBox( std::string("SpinCtrl Label"), label_rect, label, font ); addChild(mLabelBox); btn_left += label_rect.mRight + SPINCTRL_SPACING; @@ -92,14 +92,13 @@ LLSpinCtrl::LLSpinCtrl( const LLString& name, const LLRect& rect, const LLString // Spin buttons LLRect up_rect( btn_left, top, btn_right, top - SPINCTRL_BTN_HEIGHT ); - LLString out_id = "UIImgBtnSpinUpOutUUID"; - LLString in_id = "UIImgBtnSpinUpInUUID"; - mUpBtn = new LLButton( - "SpinCtrl Up", up_rect, - out_id, - in_id, - "", - &LLSpinCtrl::onUpBtn, this, LLFontGL::sSansSerif ); + std::string out_id = "UIImgBtnSpinUpOutUUID"; + std::string in_id = "UIImgBtnSpinUpInUUID"; + mUpBtn = new LLButton(std::string("SpinCtrl Up"), up_rect, + out_id, + in_id, + LLStringUtil::null, + &LLSpinCtrl::onUpBtn, this, LLFontGL::sSansSerif ); mUpBtn->setFollowsLeft(); mUpBtn->setFollowsBottom(); mUpBtn->setHeldDownCallback( &LLSpinCtrl::onUpBtn ); @@ -109,12 +108,11 @@ LLSpinCtrl::LLSpinCtrl( const LLString& name, const LLRect& rect, const LLString LLRect down_rect( btn_left, top - SPINCTRL_BTN_HEIGHT, btn_right, bottom ); out_id = "UIImgBtnSpinDownOutUUID"; in_id = "UIImgBtnSpinDownInUUID"; - mDownBtn = new LLButton( - "SpinCtrl Down", down_rect, - out_id, - in_id, - "", - &LLSpinCtrl::onDownBtn, this, LLFontGL::sSansSerif ); + mDownBtn = new LLButton(std::string("SpinCtrl Down"), down_rect, + out_id, + in_id, + LLStringUtil::null, + &LLSpinCtrl::onDownBtn, this, LLFontGL::sSansSerif ); mDownBtn->setFollowsLeft(); mDownBtn->setFollowsBottom(); mDownBtn->setHeldDownCallback( &LLSpinCtrl::onDownBtn ); @@ -122,10 +120,10 @@ LLSpinCtrl::LLSpinCtrl( const LLString& name, const LLRect& rect, const LLString addChild(mDownBtn); LLRect editor_rect( btn_right + 1, centered_top, getRect().getWidth(), centered_bottom ); - mEditor = new LLLineEditor( "SpinCtrl Editor", editor_rect, "", font, - MAX_STRING_LENGTH, - &LLSpinCtrl::onEditorCommit, NULL, NULL, this, - &LLLineEditor::prevalidateFloat ); + mEditor = new LLLineEditor( std::string("SpinCtrl Editor"), editor_rect, LLStringUtil::null, font, + MAX_STRING_LENGTH, + &LLSpinCtrl::onEditorCommit, NULL, NULL, this, + &LLLineEditor::prevalidateFloat ); mEditor->setFollowsLeft(); mEditor->setFollowsBottom(); mEditor->setFocusReceivedCallback( &LLSpinCtrl::onEditorGainFocus, this ); @@ -282,8 +280,8 @@ void LLSpinCtrl::updateEditor() // displayed_value = 0.f; // } - LLString format = llformat("%%.%df", mPrecision); - LLString text = llformat(format.c_str(), displayed_value); + std::string format = llformat("%%.%df", mPrecision); + std::string text = llformat(format.c_str(), displayed_value); mEditor->setText( text ); } @@ -294,7 +292,7 @@ void LLSpinCtrl::onEditorCommit( LLUICtrl* caller, void *userdata ) LLSpinCtrl* self = (LLSpinCtrl*) userdata; llassert( caller == self->mEditor ); - LLString text = self->mEditor->getText(); + std::string text = self->mEditor->getText(); if( LLLineEditor::postvalidateFloat( text ) ) { LLLocale locale(LLLocale::USER_LOCALE); @@ -493,10 +491,10 @@ LLXMLNodePtr LLSpinCtrl::getXML(bool save_children) const LLView* LLSpinCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory) { - LLString name("spinner"); + std::string name("spinner"); node->getAttributeString("name", name); - LLString label; + std::string label; node->getAttributeString("label", label); LLRect rect; @@ -539,7 +537,7 @@ LLView* LLSpinCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory * min_value, max_value, increment, - "", + LLStringUtil::null, label_width); spinner->setPrecision(precision); diff --git a/indra/llui/llspinctrl.h b/indra/llui/llspinctrl.h index eb9c60d442..1ed9462f00 100644 --- a/indra/llui/llspinctrl.h +++ b/indra/llui/llspinctrl.h @@ -52,13 +52,13 @@ class LLSpinCtrl : public LLUICtrl { public: - LLSpinCtrl(const LLString& name, const LLRect& rect, - const LLString& label, + LLSpinCtrl(const std::string& name, const LLRect& rect, + const std::string& label, const LLFontGL* font, void (*commit_callback)(LLUICtrl*, void*), void* callback_userdata, F32 initial_value, F32 min_value, F32 max_value, F32 increment, - const LLString& control_name = LLString(), + const std::string& control_name = std::string(), S32 label_width = SPINCTRL_DEFAULT_LABEL_WIDTH ); virtual ~LLSpinCtrl() {} // Children all cleaned up by default view destructor. diff --git a/indra/llui/llstyle.cpp b/indra/llui/llstyle.cpp index 38608745c1..0bdc208a9e 100644 --- a/indra/llui/llstyle.cpp +++ b/indra/llui/llstyle.cpp @@ -39,7 +39,7 @@ LLStyle::LLStyle() { - init(TRUE, LLColor4(0,0,0,1),""); + init(TRUE, LLColor4(0,0,0,1),LLStringUtil::null); } LLStyle::LLStyle(const LLStyle &style) @@ -62,21 +62,21 @@ LLStyle::LLStyle(const LLStyle &style) } else { - init(TRUE, LLColor4(0,0,0,1),""); + init(TRUE, LLColor4(0,0,0,1),LLStringUtil::null); } } -LLStyle::LLStyle(BOOL is_visible, const LLColor4 &color, const LLString& font_name) +LLStyle::LLStyle(BOOL is_visible, const LLColor4 &color, const std::string& font_name) { init(is_visible, color, font_name); } -void LLStyle::init(BOOL is_visible, const LLColor4 &color, const LLString& font_name) +void LLStyle::init(BOOL is_visible, const LLColor4 &color, const std::string& font_name) { mVisible = is_visible; mColor = color; setFontName(font_name); - setLinkHREF(""); + setLinkHREF(LLStringUtil::null); mItalic = FALSE; mBold = FALSE; mUnderline = FALSE; @@ -110,12 +110,12 @@ LLStyle &LLStyle::operator=(const LLStyle &rhs) } -void LLStyle::setFontName(const LLString& fontname) +void LLStyle::setFontName(const std::string& fontname) { mFontName = fontname; - LLString fontname_lc = fontname; - LLString::toLower(fontname_lc); + std::string fontname_lc = fontname; + LLStringUtil::toLower(fontname_lc); mFontID = LLFONT_OCRA; // default @@ -138,7 +138,7 @@ void LLStyle::setFontName(const LLString& fontname) } -void LLStyle::setLinkHREF(const LLString& href) +void LLStyle::setLinkHREF(const std::string& href) { mLink = href; } diff --git a/indra/llui/llstyle.h b/indra/llui/llstyle.h index 6896ee288f..ecb2d3c541 100644 --- a/indra/llui/llstyle.h +++ b/indra/llui/llstyle.h @@ -42,11 +42,11 @@ class LLStyle : public LLRefCount public: LLStyle(); LLStyle(const LLStyle &style); - LLStyle(BOOL is_visible, const LLColor4 &color, const LLString& font_name); + LLStyle(BOOL is_visible, const LLColor4 &color, const std::string& font_name); LLStyle &operator=(const LLStyle &rhs); - virtual void init (BOOL is_visible, const LLColor4 &color, const LLString& font_name); + virtual void init (BOOL is_visible, const LLColor4 &color, const std::string& font_name); virtual const LLColor4& getColor() const { return mColor; } virtual void setColor(const LLColor4 &color) { mColor = color; } @@ -54,12 +54,12 @@ public: virtual BOOL isVisible() const; virtual void setVisible(BOOL is_visible); - virtual const LLString& getFontString() const { return mFontName; } - virtual void setFontName(const LLString& fontname); + virtual const std::string& getFontString() const { return mFontName; } + virtual void setFontName(const std::string& fontname); virtual LLFONT_ID getFontID() const { return mFontID; } - virtual const LLString& getLinkHREF() const { return mLink; } - virtual void setLinkHREF(const LLString& href); + virtual const std::string& getLinkHREF() const { return mLink; } + virtual void setLinkHREF(const std::string& href); virtual BOOL isLink() const; virtual LLUIImagePtr getImage() const; @@ -105,9 +105,9 @@ protected: private: BOOL mVisible; LLColor4 mColor; - LLString mFontName; + std::string mFontName; LLFONT_ID mFontID; - LLString mLink; + std::string mLink; LLUIImagePtr mImagep; BOOL mIsEmbeddedItem; }; diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp index ccf6e90161..488e62c61e 100644 --- a/indra/llui/lltabcontainer.cpp +++ b/indra/llui/lltabcontainer.cpp @@ -65,7 +65,7 @@ const S32 TABCNTRV_PAD = 0; static LLRegisterWidget r("tab_container"); -LLTabContainer::LLTabContainer(const LLString& name, const LLRect& rect, TabPosition pos, +LLTabContainer::LLTabContainer(const std::string& name, const LLRect& rect, TabPosition pos, BOOL bordered, BOOL is_vertical ) : LLPanel(name, rect, bordered), @@ -121,7 +121,7 @@ void LLTabContainer::reshape(S32 width, S32 height, BOOL called_from_parent) } //virtual -LLView* LLTabContainer::getChildView(const LLString& name, BOOL recurse, BOOL create_if_missing) const +LLView* LLTabContainer::getChildView(const std::string& name, BOOL recurse, BOOL create_if_missing) const { tuple_list_t::const_iterator itor; for (itor = mTabList.begin(); itor != mTabList.end(); ++itor) @@ -460,7 +460,7 @@ BOOL LLTabContainer::handleMouseUp( S32 x, S32 y, MASK mask ) } // virtual -BOOL LLTabContainer::handleToolTip( S32 x, S32 y, LLString& msg, LLRect* sticky_rect ) +BOOL LLTabContainer::handleToolTip( S32 x, S32 y, std::string& msg, LLRect* sticky_rect ) { BOOL handled = LLPanel::handleToolTip( x, y, msg, sticky_rect ); if (!handled && getTabCount() > 0) @@ -604,7 +604,7 @@ LLXMLNodePtr LLTabContainer::getXML(bool save_children) const } // virtual -BOOL LLTabContainer::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType type, void* cargo_data, EAcceptance *accept, LLString &tooltip) +BOOL LLTabContainer::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType type, void* cargo_data, EAcceptance *accept, std::string &tooltip) { BOOL has_scroll_arrows = (getMaxScrollPos() > 0); @@ -656,7 +656,7 @@ BOOL LLTabContainer::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDrag } void LLTabContainer::addTabPanel(LLPanel* child, - const LLString& label, + const std::string& label, BOOL select, void (*on_tab_clicked)(void*, bool), void* userdata, @@ -673,8 +673,8 @@ void LLTabContainer::addTabPanel(LLPanel* child, // Store the original label for possible xml export. child->setLabel(label); - LLString trimmed_label = label; - LLString::trim(trimmed_label); + std::string trimmed_label = label; + LLStringUtil::trim(trimmed_label); S32 button_width = mMinTabWidth; if (!mIsVertical) @@ -723,8 +723,8 @@ void LLTabContainer::addTabPanel(LLPanel* child, // Tab button LLRect btn_rect; // Note: btn_rect.mLeft is just a dummy. Will be updated in draw(). - LLString tab_img; - LLString tab_selected_img; + std::string tab_img; + std::string tab_selected_img; S32 tab_fudge = 1; // To make new tab art look better, nudge buttons up 1 pel if (mIsVertical) @@ -755,21 +755,21 @@ void LLTabContainer::addTabPanel(LLPanel* child, btn_rect.translate(0, -LLBUTTON_V_PAD-2); textbox = new LLTextBox(trimmed_label, btn_rect, trimmed_label, font); - btn = new LLButton("", LLRect(0,0,0,0)); + btn = new LLButton(LLStringUtil::null, LLRect(0,0,0,0)); } else { if (mIsVertical) { - btn = new LLButton("vert tab button", + btn = new LLButton(std::string("vert tab button"), btn_rect, - "", - "", - "", + LLStringUtil::null, + LLStringUtil::null, + LLStringUtil::null, &LLTabContainer::onTabBtn, NULL, font, trimmed_label, trimmed_label); - btn->setImages("tab_left.tga", "tab_left_selected.tga"); + btn->setImages(std::string("tab_left.tga"), std::string("tab_left_selected.tga")); btn->setScaleImage(TRUE); btn->setHAlign(LLFontGL::LEFT); btn->setFollows(FOLLOWS_TOP | FOLLOWS_LEFT); @@ -781,13 +781,13 @@ void LLTabContainer::addTabPanel(LLPanel* child, } else { - LLString tooltip = trimmed_label; + std::string tooltip = trimmed_label; tooltip += "\nAlt-Left arrow for previous tab"; tooltip += "\nAlt-Right arrow for next tab"; - btn = new LLButton(LLString(child->getName()) + " tab", + btn = new LLButton(std::string(child->getName()) + " tab", btn_rect, - "", "", "", + LLStringUtil::null, LLStringUtil::null, LLStringUtil::null, &LLTabContainer::onTabBtn, NULL, // set userdata below font, trimmed_label, trimmed_label ); @@ -844,7 +844,7 @@ void LLTabContainer::addTabPanel(LLPanel* child, updateMaxScrollPos(); } -void LLTabContainer::addPlaceholder(LLPanel* child, const LLString& label) +void LLTabContainer::addPlaceholder(LLPanel* child, const std::string& label) { addTabPanel(child, label, FALSE, NULL, NULL, 0, TRUE); } @@ -1011,7 +1011,7 @@ S32 LLTabContainer::getIndexForPanel(LLPanel* panel) return -1; } -S32 LLTabContainer::getPanelIndexByTitle(const LLString& title) +S32 LLTabContainer::getPanelIndexByTitle(const std::string& title) { for (S32 index = 0 ; index < (S32)mTabList.size(); index++) { @@ -1023,7 +1023,7 @@ S32 LLTabContainer::getPanelIndexByTitle(const LLString& title) return -1; } -LLPanel *LLTabContainer::getPanelByName(const LLString& name) +LLPanel *LLTabContainer::getPanelByName(const std::string& name) { for (S32 index = 0 ; index < (S32)mTabList.size(); index++) { @@ -1037,7 +1037,7 @@ LLPanel *LLTabContainer::getPanelByName(const LLString& name) } // Change the name of the button for the current tab. -void LLTabContainer::setCurrentTabName(const LLString& name) +void LLTabContainer::setCurrentTabName(const std::string& name) { // Might not have a tab selected if (mCurrentTabIdx < 0) return; @@ -1211,7 +1211,7 @@ BOOL LLTabContainer::selectTab(S32 which) return is_visible; } -BOOL LLTabContainer::selectTabByName(const LLString& name) +BOOL LLTabContainer::selectTabByName(const std::string& name) { LLPanel* panel = getPanelByName(name); if (!panel) @@ -1275,7 +1275,7 @@ void LLTabContainer::setTabImage(LLPanel* child, std::string image_name, const L } } -void LLTabContainer::setTitle(const LLString& title) +void LLTabContainer::setTitle(const std::string& title) { if (mTitleBox) { @@ -1283,14 +1283,14 @@ void LLTabContainer::setTitle(const LLString& title) } } -const LLString LLTabContainer::getPanelTitle(S32 index) +const std::string LLTabContainer::getPanelTitle(S32 index) { if (index >= 0 && index < (S32)mTabList.size()) { LLButton* tab_button = mTabList[index]->mButton; return tab_button->getLabelSelected(); } - return LLString::null; + return LLStringUtil::null; } void LLTabContainer::setTopBorderHeight(S32 height) @@ -1328,7 +1328,7 @@ void LLTabContainer::setRightTabBtnOffset(S32 offset) updateMaxScrollPos(); } -void LLTabContainer::setPanelTitle(S32 index, const LLString& title) +void LLTabContainer::setPanelTitle(S32 index, const std::string& title) { if (index >= 0 && index < getTabCount()) { @@ -1434,7 +1434,7 @@ void LLTabContainer::onPrevBtnHeld( void* userdata ) // static LLView* LLTabContainer::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory) { - LLString name("tab_container"); + std::string name("tab_container"); node->getAttributeString("name", name); // Figure out if we are creating a vertical or horizontal tab container. @@ -1442,9 +1442,9 @@ LLView* LLTabContainer::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFacto LLTabContainer::TabPosition tab_position = LLTabContainer::TOP; if (node->hasAttribute("tab_position")) { - LLString tab_position_string; + std::string tab_position_string; node->getAttributeString("tab_position", tab_position_string); - LLString::toLower(tab_position_string); + LLStringUtil::toLower(tab_position_string); if ("top" == tab_position_string) { @@ -1506,7 +1506,7 @@ LLView* LLTabContainer::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFacto if (control && control->isPanel()) { LLPanel* panelp = (LLPanel*)control; - LLString label; + std::string label; child->getAttributeString("label", label); if (label.empty()) { @@ -1514,7 +1514,7 @@ LLView* LLTabContainer::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFacto } BOOL placeholder = FALSE; child->getAttributeBOOL("placeholder", placeholder); - tab_container->addTabPanel(panelp, label.c_str(), false, + tab_container->addTabPanel(panelp, label, false, NULL, NULL, 0, placeholder); } } @@ -1538,8 +1538,8 @@ void LLTabContainer::initButtons() return; // Don't have a rect yet or already got called } - LLString out_id; - LLString in_id; + std::string out_id; + std::string in_id; if (mIsVertical) { @@ -1555,16 +1555,16 @@ void LLTabContainer::initButtons() out_id = "UIImgBtnScrollUpOutUUID"; in_id = "UIImgBtnScrollUpInUUID"; - mPrevArrowBtn = new LLButton("Up Arrow", up_arrow_btn_rect, - out_id, in_id, "", + mPrevArrowBtn = new LLButton(std::string("Up Arrow"), up_arrow_btn_rect, + out_id, in_id, LLStringUtil::null, &onPrevBtn, this, NULL ); mPrevArrowBtn->setFollowsTop(); mPrevArrowBtn->setFollowsLeft(); out_id = "UIImgBtnScrollDownOutUUID"; in_id = "UIImgBtnScrollDownInUUID"; - mNextArrowBtn = new LLButton("Down Arrow", down_arrow_btn_rect, - out_id, in_id, "", + mNextArrowBtn = new LLButton(std::string("Down Arrow"), down_arrow_btn_rect, + out_id, in_id, LLStringUtil::null, &onNextBtn, this, NULL ); mNextArrowBtn->setFollowsBottom(); mNextArrowBtn->setFollowsLeft(); @@ -1603,31 +1603,31 @@ void LLTabContainer::initButtons() out_id = "UIImgBtnJumpLeftOutUUID"; in_id = "UIImgBtnJumpLeftInUUID"; - mJumpPrevArrowBtn = new LLButton("Jump Left Arrow", jump_left_arrow_btn_rect, - out_id, in_id, "", + mJumpPrevArrowBtn = new LLButton(std::string("Jump Left Arrow"), jump_left_arrow_btn_rect, + out_id, in_id, LLStringUtil::null, &LLTabContainer::onJumpFirstBtn, this, LLFontGL::sSansSerif ); mJumpPrevArrowBtn->setFollowsLeft(); out_id = "UIImgBtnScrollLeftOutUUID"; in_id = "UIImgBtnScrollLeftInUUID"; - mPrevArrowBtn = new LLButton("Left Arrow", left_arrow_btn_rect, - out_id, in_id, "", + mPrevArrowBtn = new LLButton(std::string("Left Arrow"), left_arrow_btn_rect, + out_id, in_id, LLStringUtil::null, &LLTabContainer::onPrevBtn, this, LLFontGL::sSansSerif ); mPrevArrowBtn->setHeldDownCallback(onPrevBtnHeld); mPrevArrowBtn->setFollowsLeft(); out_id = "UIImgBtnJumpRightOutUUID"; in_id = "UIImgBtnJumpRightInUUID"; - mJumpNextArrowBtn = new LLButton("Jump Right Arrow", jump_right_arrow_btn_rect, - out_id, in_id, "", + mJumpNextArrowBtn = new LLButton(std::string("Jump Right Arrow"), jump_right_arrow_btn_rect, + out_id, in_id, LLStringUtil::null, &LLTabContainer::onJumpLastBtn, this, LLFontGL::sSansSerif); mJumpNextArrowBtn->setFollowsRight(); out_id = "UIImgBtnScrollRightOutUUID"; in_id = "UIImgBtnScrollRightInUUID"; - mNextArrowBtn = new LLButton("Right Arrow", right_arrow_btn_rect, - out_id, in_id, "", + mNextArrowBtn = new LLButton(std::string("Right Arrow"), right_arrow_btn_rect, + out_id, in_id, LLStringUtil::null, &LLTabContainer::onNextBtn, this, LLFontGL::sSansSerif); mNextArrowBtn->setFollowsRight(); diff --git a/indra/llui/lltabcontainer.h b/indra/llui/lltabcontainer.h index f4da5e5aed..eef5a70a3b 100644 --- a/indra/llui/lltabcontainer.h +++ b/indra/llui/lltabcontainer.h @@ -55,7 +55,7 @@ public: RIGHT_OF_CURRENT } eInsertionPoint; - LLTabContainer( const LLString& name, const LLRect& rect, TabPosition pos, + LLTabContainer( const std::string& name, const LLRect& rect, TabPosition pos, BOOL bordered, BOOL is_vertical); /*virtual*/ ~LLTabContainer(); @@ -68,23 +68,23 @@ public: /*virtual*/ BOOL handleMouseDown( S32 x, S32 y, MASK mask ); /*virtual*/ BOOL handleHover( S32 x, S32 y, MASK mask ); /*virtual*/ BOOL handleMouseUp( S32 x, S32 y, MASK mask ); - /*virtual*/ BOOL handleToolTip(S32 x, S32 y, LLString& msg, LLRect* sticky_rect ); + /*virtual*/ BOOL handleToolTip(S32 x, S32 y, std::string& msg, LLRect* sticky_rect ); /*virtual*/ BOOL handleKeyHere(KEY key, MASK mask); /*virtual*/ BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType type, void* cargo_data, - EAcceptance* accept, LLString& tooltip); + EAcceptance* accept, std::string& tooltip); /*virtual*/ LLXMLNodePtr getXML(bool save_children = true) const; - /*virtual*/ LLView* getChildView(const LLString& name, BOOL recurse = TRUE, BOOL create_if_missing = TRUE) const; + /*virtual*/ LLView* getChildView(const std::string& name, BOOL recurse = TRUE, BOOL create_if_missing = TRUE) const; void addTabPanel(LLPanel* child, - const LLString& label, + const std::string& label, BOOL select = FALSE, void (*on_tab_clicked)(void*, bool) = NULL, void* userdata = NULL, S32 indent = 0, BOOL placeholder = FALSE, eInsertionPoint insertion_point = END); - void addPlaceholder(LLPanel* child, const LLString& label); + void addPlaceholder(LLPanel* child, const std::string& label); void removeTabPanel( LLPanel* child ); void lockTabs(S32 num_tabs = 0); void unlockTabs(); @@ -96,9 +96,9 @@ public: S32 getTabCount(); LLPanel* getPanelByIndex(S32 index); S32 getIndexForPanel(LLPanel* panel); - S32 getPanelIndexByTitle(const LLString& title); - LLPanel* getPanelByName(const LLString& name); - void setCurrentTabName(const LLString& name); + S32 getPanelIndexByTitle(const std::string& title); + LLPanel* getPanelByName(const std::string& name); + void setCurrentTabName(const std::string& name); void selectFirstTab(); void selectLastTab(); @@ -106,13 +106,13 @@ public: void selectPrevTab(); BOOL selectTabPanel( LLPanel* child ); BOOL selectTab(S32 which); - BOOL selectTabByName(const LLString& title); + BOOL selectTabByName(const std::string& title); BOOL getTabPanelFlashing(LLPanel* child); void setTabPanelFlashing(LLPanel* child, BOOL state); void setTabImage(LLPanel* child, std::string img_name, const LLColor4& color = LLColor4::white); - void setTitle( const LLString& title ); - const LLString getPanelTitle(S32 index); + void setTitle( const std::string& title ); + const std::string getPanelTitle(S32 index); void setTopBorderHeight(S32 height); S32 getTopBorderHeight() const; @@ -121,7 +121,7 @@ public: void setTabUserData(LLPanel* tab, void* userdata); void setRightTabBtnOffset( S32 offset ); - void setPanelTitle(S32 index, const LLString& title); + void setPanelTitle(S32 index, const std::string& title); TabPosition getTabPosition() const { return mTabPosition; } void setMinTabWidth(S32 width) { mMinTabWidth = width; } diff --git a/indra/llui/lltextbox.cpp b/indra/llui/lltextbox.cpp index 1c3c8329e6..ac2f2a64a3 100644 --- a/indra/llui/lltextbox.cpp +++ b/indra/llui/lltextbox.cpp @@ -36,7 +36,7 @@ static LLRegisterWidget r("text"); -LLTextBox::LLTextBox(const LLString& name, const LLRect& rect, const LLString& text, +LLTextBox::LLTextBox(const std::string& name, const LLRect& rect, const std::string& text, const LLFontGL* font, BOOL mouse_opaque) : LLUICtrl(name, rect, mouse_opaque, NULL, NULL, FOLLOWS_LEFT | FOLLOWS_TOP ), mFontGL(font ? font : LLFontGL::sSansSerifSmall), @@ -63,7 +63,7 @@ LLTextBox::LLTextBox(const LLString& name, const LLRect& rect, const LLString& t setTabStop(FALSE); } -LLTextBox::LLTextBox(const LLString& name, const LLString& text, F32 max_width, +LLTextBox::LLTextBox(const std::string& name, const std::string& text, F32 max_width, const LLFontGL* font, BOOL mouse_opaque) : LLUICtrl(name, LLRect(0, 0, 1, 1), mouse_opaque, NULL, NULL, FOLLOWS_LEFT | FOLLOWS_TOP), mFontGL(font ? font : LLFontGL::sSansSerifSmall), @@ -91,7 +91,7 @@ LLTextBox::LLTextBox(const LLString& name, const LLString& text, F32 max_width, setTabStop(FALSE); } -LLTextBox::LLTextBox(const LLString& name_and_label, const LLRect& rect) : +LLTextBox::LLTextBox(const std::string& name_and_label, const LLRect& rect) : LLUICtrl(name_and_label, rect, TRUE, NULL, NULL, FOLLOWS_LEFT | FOLLOWS_TOP), mFontGL(LLFontGL::sSansSerifSmall), mTextColor(LLUI::sColorsGroup->getColor("LabelTextColor")), @@ -113,7 +113,7 @@ LLTextBox::LLTextBox(const LLString& name_and_label, const LLRect& rect) : setTabStop(FALSE); } -LLTextBox::LLTextBox(const LLString& name_and_label) : +LLTextBox::LLTextBox(const std::string& name_and_label) : LLUICtrl(name_and_label, LLRect(0, 0, 1, 1), TRUE, NULL, NULL, FOLLOWS_LEFT | FOLLOWS_TOP), mFontGL(LLFontGL::sSansSerifSmall), mTextColor(LLUI::sColorsGroup->getColor("LabelTextColor")), @@ -211,15 +211,15 @@ void LLTextBox::setLineLengths() { mLineLengthList.clear(); - LLString::size_type cur = 0; - LLString::size_type len = mText.getWString().size(); + std::string::size_type cur = 0; + std::string::size_type len = mText.getWString().size(); while (cur < len) { - LLString::size_type end = mText.getWString().find('\n', cur); - LLString::size_type runLen; + std::string::size_type end = mText.getWString().find('\n', cur); + std::string::size_type runLen; - if (end == LLString::npos) + if (end == std::string::npos) { runLen = len - cur; cur = len; @@ -276,7 +276,7 @@ void LLTextBox::setWrappedText(const LLStringExplicit& in_text, F32 max_width) } } - LLString final_text = wstring_to_utf8str(final_wtext); + std::string final_text = wstring_to_utf8str(final_wtext); setText(final_text); } @@ -316,7 +316,7 @@ S32 LLTextBox::getTextPixelHeight() } -BOOL LLTextBox::setTextArg( const LLString& key, const LLStringExplicit& text ) +BOOL LLTextBox::setTextArg( const std::string& key, const LLStringExplicit& text ) { mText.setArg(key, text); setLineLengths(); @@ -451,11 +451,11 @@ LLXMLNodePtr LLTextBox::getXML(bool save_children) const // static LLView* LLTextBox::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory) { - LLString name("text_box"); + std::string name("text_box"); node->getAttributeString("name", name); LLFontGL* font = LLView::selectFont(node); - LLString text = node->getTextContents(); + std::string text = node->getTextContents(); LLTextBox* text_box = new LLTextBox(name, LLRect(), @@ -469,7 +469,7 @@ LLView* LLTextBox::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *f text_box->initFromXML(node, parent); - LLString font_style; + std::string font_style; if (node->getAttributeString("font-style", font_style)) { text_box->mFontStyle = LLFontGL::getStyleFromString(font_style); diff --git a/indra/llui/lltextbox.h b/indra/llui/lltextbox.h index 91d47795a5..b1e8e0b7c6 100644 --- a/indra/llui/lltextbox.h +++ b/indra/llui/lltextbox.h @@ -45,16 +45,16 @@ public: // By default, follows top and left and is mouse-opaque. // If no text, text = name. // If no font, uses default system font. - LLTextBox(const LLString& name, const LLRect& rect, const LLString& text, + LLTextBox(const std::string& name, const LLRect& rect, const std::string& text, const LLFontGL* font = NULL, BOOL mouse_opaque = TRUE ); // Construct a textbox which handles word wrapping for us. - LLTextBox(const LLString& name, const LLString& text, F32 max_width = 200, + LLTextBox(const std::string& name, const std::string& text, F32 max_width = 200, const LLFontGL* font = NULL, BOOL mouse_opaque = TRUE ); // "Simple" constructors for text boxes that have the same name and label *TO BE DEPRECATED* - LLTextBox(const LLString& name_and_label, const LLRect& rect); - LLTextBox(const LLString& name_and_label); + LLTextBox(const std::string& name_and_label, const LLRect& rect); + LLTextBox(const std::string& name_and_label); virtual ~LLTextBox() {} @@ -95,13 +95,13 @@ public: void reshapeToFitText(); - const LLString& getText() const { return mText.getString(); } + const std::string& getText() const { return mText.getString(); } S32 getTextPixelWidth(); S32 getTextPixelHeight(); virtual void setValue(const LLSD& value ) { setText(value.asString()); } virtual LLSD getValue() const { return LLSD(getText()); } - virtual BOOL setTextArg( const LLString& key, const LLStringExplicit& text ); + virtual BOOL setTextArg( const std::string& key, const LLStringExplicit& text ); private: void setLineLengths(); diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index 06df996088..a2063358bd 100644 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -86,7 +86,7 @@ const S32 PREEDIT_STANDOUT_POSITION = 2; const S32 PREEDIT_STANDOUT_THICKNESS = 2; LLColor4 LLTextEditor::mLinkColor = LLColor4::blue; -void (* LLTextEditor::mURLcallback)(const char*) = NULL; +void (* LLTextEditor::mURLcallback)(const std::string&) = NULL; bool (* LLTextEditor::mSecondlifeURLcallback)(const std::string&) = NULL; bool (* LLTextEditor::mSecondlifeURLcallbackRightClick)(const std::string&) = NULL; @@ -104,7 +104,7 @@ public: virtual BOOL execute( LLTextEditor* editor, S32* delta ) { *delta = insert(editor, getPosition(), mWString ); - LLWString::truncate(mWString, *delta); + LLWStringUtil::truncate(mWString, *delta); //mWString = wstring_truncate(mWString, *delta); return (*delta != 0); } @@ -142,7 +142,7 @@ public: virtual BOOL execute( LLTextEditor* editor, S32* delta ) { *delta = insert(editor, getPosition(), mWString); - LLWString::truncate(mWString, *delta); + LLWStringUtil::truncate(mWString, *delta); //mWString = wstring_truncate(mWString, *delta); return (*delta != 0); } @@ -240,10 +240,10 @@ private: /////////////////////////////////////////////////////////////////// LLTextEditor::LLTextEditor( - const LLString& name, + const std::string& name, const LLRect& rect, S32 max_length, // In bytes - const LLString &default_text, + const std::string &default_text, const LLFontGL* font, BOOL allow_embedded_items) : @@ -308,7 +308,7 @@ LLTextEditor::LLTextEditor( SCROLLBAR_SIZE, getRect().getHeight() - 1); S32 lines_in_doc = getLineCount(); - mScrollbar = new LLScrollbar( "Scrollbar", scroll_rect, + mScrollbar = new LLScrollbar( std::string("Scrollbar"), scroll_rect, LLScrollbar::VERTICAL, lines_in_doc, 0, @@ -322,7 +322,7 @@ LLTextEditor::LLTextEditor( mScrollbar->setOnScrollEndCallback(mOnScrollEndCallback, mOnScrollEndData); addChild(mScrollbar); - mBorder = new LLViewBorder( "text ed border", LLRect(0, getRect().getHeight(), getRect().getWidth(), 0), LLViewBorder::BEVEL_IN, LLViewBorder::STYLE_LINE, UI_TEXTEDITOR_BORDER ); + mBorder = new LLViewBorder( std::string("text ed border"), LLRect(0, getRect().getHeight(), getRect().getWidth(), 0), LLViewBorder::BEVEL_IN, LLViewBorder::STYLE_LINE, UI_TEXTEDITOR_BORDER ); addChild( mBorder ); appendText(default_text, FALSE, FALSE); @@ -330,7 +330,7 @@ LLTextEditor::LLTextEditor( resetDirty(); // Update saved text state mParseHTML=FALSE; - mHTML=""; + mHTML.clear(); } @@ -493,7 +493,7 @@ BOOL LLTextEditor::truncate() void LLTextEditor::setText(const LLStringExplicit &utf8str) { - // LLString::removeCRLF(utf8str); + // LLStringUtil::removeCRLF(utf8str); mUTF8Text = utf8str_removeCRLF(utf8str); // mUTF8Text = utf8str; mWText = utf8str_to_wstring(mUTF8Text); @@ -535,7 +535,7 @@ void LLTextEditor::setValue(const LLSD& value) setText(value.asString()); } -const LLString& LLTextEditor::getText() const +const std::string& LLTextEditor::getText() const { if (!mTextIsUpToDate) { @@ -588,7 +588,7 @@ void LLTextEditor::setHideScrollbarForShortDocs(BOOL b) } } -void LLTextEditor::selectNext(const LLString& search_text_in, BOOL case_insensitive, BOOL wrap) +void LLTextEditor::selectNext(const std::string& search_text_in, BOOL case_insensitive, BOOL wrap) { if (search_text_in.empty()) { @@ -599,8 +599,8 @@ void LLTextEditor::selectNext(const LLString& search_text_in, BOOL case_insensit LLWString search_text = utf8str_to_wstring(search_text_in); if (case_insensitive) { - LLWString::toLower(text); - LLWString::toLower(search_text); + LLWStringUtil::toLower(text); + LLWStringUtil::toLower(search_text); } if (mIsSelecting) @@ -638,7 +638,7 @@ void LLTextEditor::selectNext(const LLString& search_text_in, BOOL case_insensit mSelectionStart = llmin((S32)getLength(), (S32)(mCursorPos + search_text.size())); } -BOOL LLTextEditor::replaceText(const LLString& search_text_in, const LLString& replace_text, +BOOL LLTextEditor::replaceText(const std::string& search_text_in, const std::string& replace_text, BOOL case_insensitive, BOOL wrap) { BOOL replaced = FALSE; @@ -656,8 +656,8 @@ BOOL LLTextEditor::replaceText(const LLString& search_text_in, const LLString& r if (case_insensitive) { - LLWString::toLower(selected_text); - LLWString::toLower(search_text); + LLWStringUtil::toLower(selected_text); + LLWStringUtil::toLower(search_text); } if (selected_text == search_text) @@ -671,7 +671,7 @@ BOOL LLTextEditor::replaceText(const LLString& search_text_in, const LLString& r return replaced; } -void LLTextEditor::replaceTextAll(const LLString& search_text, const LLString& replace_text, BOOL case_insensitive) +void LLTextEditor::replaceTextAll(const std::string& search_text, const std::string& replace_text, BOOL case_insensitive) { S32 cur_pos = mScrollbar->getDocPos(); @@ -1058,7 +1058,7 @@ void LLTextEditor::selectAll() } -BOOL LLTextEditor::handleToolTip(S32 x, S32 y, LLString& msg, LLRect* sticky_rect_screen) +BOOL LLTextEditor::handleToolTip(S32 x, S32 y, std::string& msg, LLRect* sticky_rect_screen) { for ( child_list_const_iter_t child_it = getChildList()->begin(); child_it != getChildList()->end(); ++child_it) @@ -1389,7 +1389,7 @@ BOOL LLTextEditor::handleDoubleClick(S32 x, S32 y, MASK mask) BOOL LLTextEditor::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, void *cargo_data, EAcceptance *accept, - LLString& tooltip_msg) + std::string& tooltip_msg) { *accept = ACCEPT_NO; @@ -1876,7 +1876,7 @@ void LLTextEditor::paste() // Clean up string (replace tabs and remove characters that our fonts don't support). LLWString clean_string(paste); - LLWString::replaceTabsWithSpaces(clean_string, SPACES_PER_TAB); + LLWStringUtil::replaceTabsWithSpaces(clean_string, SPACES_PER_TAB); if( mAllowEmbeddedItems ) { const llwchar LF = 10; @@ -2567,7 +2567,7 @@ void LLTextEditor::drawSelectionBackground() { // extend selection slightly beyond end of line // to indicate selection of newline character (use "n" character to determine width) - const LLWString nstr(utf8str_to_wstring(LLString("n"))); + const LLWString nstr(utf8str_to_wstring(std::string("n"))); line_endings.push(mTextRect.mLeft + mGLFont->getWidth(line, 0, line_end - line_start, mAllowEmbeddedItems) + mGLFont->getWidth(nstr.c_str())); } @@ -2704,7 +2704,7 @@ void LLTextEditor::drawCursor() if (LL_KIM_OVERWRITE == gKeyboard->getInsertMode() && !hasSelection()) { cursor_left += CURSOR_THICKNESS; - const LLWString space(utf8str_to_wstring(LLString(" "))); + const LLWString space(utf8str_to_wstring(std::string(" "))); F32 spacew = mGLFont->getWidthF32(space.c_str()); if (mCursorPos == line_end) { @@ -3080,7 +3080,7 @@ void LLTextEditor::onTabInto() // virtual void LLTextEditor::clear() { - setText(LLString::null); + setText(LLStringUtil::null); } // Start or stop the editor from accepting text-editing keystrokes @@ -3408,7 +3408,7 @@ void LLTextEditor::autoIndent() } // Inserts new text at the cursor position -void LLTextEditor::insertText(const LLString &new_text) +void LLTextEditor::insertText(const std::string &new_text) { BOOL enabled = getEnabled(); setEnabled( TRUE ); @@ -3428,11 +3428,11 @@ void LLTextEditor::insertText(const LLString &new_text) } -void LLTextEditor::appendColoredText(const LLString &new_text, +void LLTextEditor::appendColoredText(const std::string &new_text, bool allow_undo, bool prepend_newline, const LLColor4 &color, - const LLString& font_name) + const std::string& font_name) { LLStyleSP style(new LLStyle); style->setVisible(true); @@ -3441,7 +3441,7 @@ void LLTextEditor::appendColoredText(const LLString &new_text, appendStyledText(new_text, allow_undo, prepend_newline, &style); } -void LLTextEditor::appendStyledText(const LLString &new_text, +void LLTextEditor::appendStyledText(const std::string &new_text, bool allow_undo, bool prepend_newline, const LLStyleSP *stylep) @@ -3450,7 +3450,7 @@ void LLTextEditor::appendStyledText(const LLString &new_text, { S32 start=0,end=0; - LLString text = new_text; + std::string text = new_text; while ( findHTML(text, &start, &end) ) { LLStyleSP html(new LLStyle); @@ -3484,7 +3484,7 @@ void LLTextEditor::appendStyledText(const LLString &new_text, } // Appends new text to end of document -void LLTextEditor::appendText(const LLString &new_text, bool allow_undo, bool prepend_newline, +void LLTextEditor::appendText(const std::string &new_text, bool allow_undo, bool prepend_newline, const LLStyleSP *stylep) { // Save old state @@ -3504,7 +3504,7 @@ void LLTextEditor::appendText(const LLString &new_text, bool allow_undo, bool pr if (getLength() != 0 && prepend_newline) { - LLString final_text = "\n"; + std::string final_text = "\n"; final_text += new_text; append(utf8str_to_wstring(final_text), TRUE); } @@ -3685,20 +3685,18 @@ void LLTextEditor::updateTextRect() getRect().getHeight() - 2 * UI_TEXTEDITOR_BORDER - UI_TEXTEDITOR_V_PAD_TOP ); } -void LLTextEditor::loadKeywords(const LLString& filename, - const LLDynamicArray& funcs, - const LLDynamicArray& tooltips, +void LLTextEditor::loadKeywords(const std::string& filename, + const std::vector& funcs, + const std::vector& tooltips, const LLColor3& color) { if(mKeywords.loadFromFile(filename)) { - S32 count = funcs.count(); - LLString name; + S32 count = llmin(funcs.size(), tooltips.size()); for(S32 i = 0; i < count; i++) { - name = funcs.get(i); - name = utf8str_trim(name); - mKeywords.addToken(LLKeywordToken::WORD, name.c_str(), color, tooltips.get(i) ); + std::string name = utf8str_trim(funcs[i]); + mKeywords.addToken(LLKeywordToken::WORD, name, color, tooltips[i] ); } mKeywords.findSegments( &mSegments, mWText, mDefaultColor ); @@ -3840,9 +3838,9 @@ BOOL LLTextEditor::handleMouseUpOverSegment(S32 x, S32 y, MASK mask) //Special handling for slurls if ( (mSecondlifeURLcallback!=NULL) && !(*mSecondlifeURLcallback)(mHTML) ) { - if (mURLcallback!=NULL) (*mURLcallback)(mHTML.c_str()); + if (mURLcallback!=NULL) (*mURLcallback)(mHTML); } - mHTML=""; + mHTML.clear(); } } @@ -3894,7 +3892,7 @@ void LLTextEditor::setOnScrollEndCallback(void (*callback)(void*), void* userdat /////////////////////////////////////////////////////////////////// // Hack for Notecards -BOOL LLTextEditor::importBuffer(const LLString& buffer ) +BOOL LLTextEditor::importBuffer(const char* buffer, S32 length ) { std::istringstream instream(buffer); @@ -3983,7 +3981,7 @@ BOOL LLTextEditor::importBuffer(const LLString& buffer ) return success; } -BOOL LLTextEditor::exportBuffer(LLString &buffer ) +BOOL LLTextEditor::exportBuffer(std::string &buffer ) { std::ostringstream outstream(buffer); @@ -4016,7 +4014,7 @@ LLTextSegment::LLTextSegment( const LLStyleSP& style, S32 start, S32 end ) : { } LLTextSegment::LLTextSegment( const LLColor4& color, S32 start, S32 end, BOOL is_visible) : - mStyle(new LLStyle(is_visible,color,"")), + mStyle(new LLStyle(is_visible,color,LLStringUtil::null)), mStart( start), mEnd( end ), mToken(NULL), @@ -4024,7 +4022,7 @@ LLTextSegment::LLTextSegment( const LLColor4& color, S32 start, S32 end, BOOL is { } LLTextSegment::LLTextSegment( const LLColor4& color, S32 start, S32 end ) : - mStyle(new LLStyle(TRUE, color,"" )), + mStyle(new LLStyle(TRUE, color,LLStringUtil::null )), mStart( start), mEnd( end ), mToken(NULL), @@ -4032,7 +4030,7 @@ LLTextSegment::LLTextSegment( const LLColor4& color, S32 start, S32 end ) : { } LLTextSegment::LLTextSegment( const LLColor3& color, S32 start, S32 end ) : - mStyle(new LLStyle(TRUE, color,"" )), + mStyle(new LLStyle(TRUE, color,LLStringUtil::null )), mStart( start), mEnd( end ), mToken(NULL), @@ -4040,7 +4038,7 @@ LLTextSegment::LLTextSegment( const LLColor3& color, S32 start, S32 end ) : { } -BOOL LLTextSegment::getToolTip(LLString& msg) const +BOOL LLTextSegment::getToolTip(std::string& msg) const { if (mToken && !mToken->getToolTip().empty()) { @@ -4095,7 +4093,7 @@ LLXMLNodePtr LLTextEditor::getXML(bool save_children) const // static LLView* LLTextEditor::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory) { - LLString name("text_editor"); + std::string name("text_editor"); node->getAttributeString("name", name); LLRect rect; @@ -4109,7 +4107,7 @@ LLView* LLTextEditor::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory LLFontGL* font = LLView::selectFont(node); - LLString text = node->getTextContents().substr(0, max_text_length - 1); + std::string text = node->getTextContents().substr(0, max_text_length - 1); LLTextEditor* text_editor = new LLTextEditor(name, rect, @@ -4161,10 +4159,10 @@ void LLTextEditor::setTextEditorParameters(LLXMLNodePtr node) } /////////////////////////////////////////////////////////////////// -S32 LLTextEditor::findHTMLToken(const LLString &line, S32 pos, BOOL reverse) const +S32 LLTextEditor::findHTMLToken(const std::string &line, S32 pos, BOOL reverse) const { - LLString openers=" \t('\"[{<>"; - LLString closers=" \t)'\"]}><;"; + std::string openers=" \t('\"[{<>"; + std::string closers=" \t)'\"]}><;"; S32 m2; S32 retval; @@ -4198,7 +4196,7 @@ S32 LLTextEditor::findHTMLToken(const LLString &line, S32 pos, BOOL reverse) con return retval; } -BOOL LLTextEditor::findHTML(const LLString &line, S32 *begin, S32 *end) const +BOOL LLTextEditor::findHTML(const std::string &line, S32 *begin, S32 *end) const { S32 m1,m2,m3; @@ -4215,7 +4213,7 @@ BOOL LLTextEditor::findHTML(const LLString &line, S32 *begin, S32 *end) const m2 = line.substr(*begin,(m1 - *begin)).find("http"); m3 = line.substr(*begin,(m1 - *begin)).find("secondlife"); - LLString badneighbors=".,<>?';\"][}{=-+_)(*&^%$#@!~`\t\r\n\\"; + std::string badneighbors=".,<>?';\"][}{=-+_)(*&^%$#@!~`\t\r\n\\"; if (m2 >= 0 || m3>=0) { @@ -4241,7 +4239,7 @@ BOOL LLTextEditor::findHTML(const LLString &line, S32 *begin, S32 *end) const if ( ( *end - m1 ) > 2 && m1 > *begin) { - LLString badneighbors=".,<>/?';\"][}{=-+_)(*&^%$#@!~`"; + std::string badneighbors=".,<>/?';\"][}{=-+_)(*&^%$#@!~`"; m2 = badneighbors.find(line.substr(m1+1,1)); m3 = badneighbors.find(line.substr(m1-1,1)); if (m3<0 && m2<0) @@ -4257,8 +4255,8 @@ BOOL LLTextEditor::findHTML(const LLString &line, S32 *begin, S32 *end) const { S32 strpos, strpos2; - LLString url = line.substr(*begin,*end - *begin); - LLString slurlID = "slurl.com/secondlife/"; + std::string url = line.substr(*begin,*end - *begin); + std::string slurlID = "slurl.com/secondlife/"; strpos = url.find(slurlID); if (strpos < 0) diff --git a/indra/llui/lltexteditor.h b/indra/llui/lltexteditor.h index af2dbcfd5f..e261d13872 100644 --- a/indra/llui/lltexteditor.h +++ b/indra/llui/lltexteditor.h @@ -62,10 +62,10 @@ public: static const llwchar LAST_EMBEDDED_CHAR = 0x10ffff; static const S32 MAX_EMBEDDED_ITEMS = LAST_EMBEDDED_CHAR - FIRST_EMBEDDED_CHAR + 1; - LLTextEditor(const LLString& name, + LLTextEditor(const std::string& name, const LLRect& rect, S32 max_length, - const LLString &default_text, + const std::string &default_text, const LLFontGL* glfont = NULL, BOOL allow_embedded_items = FALSE); @@ -85,10 +85,10 @@ public: virtual BOOL handleKeyHere(KEY key, MASK mask ); virtual BOOL handleUnicodeCharHere(llwchar uni_char); - virtual BOOL handleToolTip(S32 x, S32 y, LLString& msg, LLRect* sticky_rect); + virtual BOOL handleToolTip(S32 x, S32 y, std::string& msg, LLRect* sticky_rect); virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, void *cargo_data, - EAcceptance *accept, LLString& tooltip_msg); + EAcceptance *accept, std::string& tooltip_msg); virtual void onMouseCaptureLost(); // view overrides @@ -123,9 +123,9 @@ public: virtual void deselect(); virtual BOOL canDeselect() const; - void selectNext(const LLString& search_text_in, BOOL case_insensitive, BOOL wrap = TRUE); - BOOL replaceText(const LLString& search_text, const LLString& replace_text, BOOL case_insensitive, BOOL wrap = TRUE); - void replaceTextAll(const LLString& search_text, const LLString& replace_text, BOOL case_insensitive); + void selectNext(const std::string& search_text_in, BOOL case_insensitive, BOOL wrap = TRUE); + BOOL replaceText(const std::string& search_text, const std::string& replace_text, BOOL case_insensitive, BOOL wrap = TRUE); + void replaceTextAll(const std::string& search_text, const std::string& replace_text, BOOL case_insensitive); // Undo/redo stack void blockUndo(); @@ -136,17 +136,17 @@ public: BOOL allowsEmbeddedItems() const { return mAllowEmbeddedItems; } // inserts text at cursor - void insertText(const LLString &text); + void insertText(const std::string &text); // appends text at end - void appendText(const LLString &wtext, bool allow_undo, bool prepend_newline, + void appendText(const std::string &wtext, bool allow_undo, bool prepend_newline, const LLStyleSP *stylep = NULL); - void appendColoredText(const LLString &wtext, bool allow_undo, + void appendColoredText(const std::string &wtext, bool allow_undo, bool prepend_newline, const LLColor4 &color, - const LLString& font_name = LLString::null); + const std::string& font_name = LLStringUtil::null); // if styled text starts a line, you need to prepend a newline. - void appendStyledText(const LLString &new_text, bool allow_undo, + void appendStyledText(const std::string &new_text, bool allow_undo, bool prepend_newline, const LLStyleSP *stylep = NULL); @@ -162,10 +162,9 @@ public: void getCurrentLineAndColumn( S32* line, S32* col, BOOL include_wordwrap ); - // Keywords support - void loadKeywords(const LLString& filename, - const LLDynamicArray& funcs, - const LLDynamicArray& tooltips, + void loadKeywords(const std::string& filename, + const std::vector& funcs, + const std::vector& tooltips, const LLColor3& func_color); LLKeywords::keyword_iterator_t keywordsBegin() { return mKeywords.begin(); } LLKeywords::keyword_iterator_t keywordsEnd() { return mKeywords.end(); } @@ -195,8 +194,8 @@ public: void setCommitOnFocusLost(BOOL b) { mCommitOnFocusLost = b; } // Hack to handle Notecards - virtual BOOL importBuffer(const LLString& buffer ); - virtual BOOL exportBuffer(LLString& buffer ); + virtual BOOL importBuffer(const char* buffer, S32 length ); + virtual BOOL exportBuffer(std::string& buffer ); // If takes focus, will take keyboard focus on click. void setTakesFocus(BOOL b) { mTakesFocus = b; } @@ -210,7 +209,7 @@ public: // Callbacks static void setLinkColor(LLColor4 color) { mLinkColor = color; } - static void setURLCallbacks(void (*callback1) (const char* url), + static void setURLCallbacks(void (*callback1) (const std::string& url), bool (*callback2) (const std::string& url), bool (*callback3) (const std::string& url) ) { mURLcallback = callback1; mSecondlifeURLcallback = callback2; mSecondlifeURLcallbackRightClick = callback3;} @@ -221,7 +220,7 @@ public: void setValue(const LLSD& value); LLSD getValue() const; - const LLString& getText() const; + const std::string& getText() const; // Non-undoable void setText(const LLStringExplicit &utf8str); @@ -261,7 +260,7 @@ protected: void updateTextRect(); const LLRect& getTextRect() const { return mTextRect; } - void assignEmbedded(const LLString &s); + void assignEmbedded(const std::string &s); BOOL truncate(); // Returns true if truncation occurs static BOOL isPartOfWord(llwchar c) { return (c == '_') || isalnum(c); } @@ -313,8 +312,8 @@ protected: virtual void bindEmbeddedChars(LLFontGL* font) const {} virtual void unbindEmbeddedChars(LLFontGL* font) const {} - S32 findHTMLToken(const LLString &line, S32 pos, BOOL reverse) const; - BOOL findHTML(const LLString &line, S32 *begin, S32 *end) const; + S32 findHTMLToken(const std::string &line, S32 pos, BOOL reverse) const; + BOOL findHTML(const std::string &line, S32 *begin, S32 *end) const; // Abstract inner base class representing an undoable editor command. // Concrete sub-classes can be defined for operations such as insert, remove, etc. @@ -399,7 +398,7 @@ protected: S32 mLastSelectionY; BOOL mParseHTML; - LLString mHTML; + std::string mHTML; typedef std::vector segment_list_t; segment_list_t mSegments; @@ -436,7 +435,7 @@ private: // LLKeywords mKeywords; static LLColor4 mLinkColor; - static void (*mURLcallback) (const char* url); + static void (*mURLcallback) (const std::string& url); static bool (*mSecondlifeURLcallback) (const std::string& url); static bool (*mSecondlifeURLcallbackRightClick) (const std::string& url); @@ -447,7 +446,7 @@ private: class LLTextCmdRemove; LLWString mWText; - mutable LLString mUTF8Text; + mutable std::string mUTF8Text; mutable BOOL mTextIsUpToDate; S32 mMaxTextByteLength; // Maximum length mText is allowed to be in bytes @@ -544,7 +543,7 @@ public: BOOL getIsDefault() const { return mIsDefault; } void setToken( LLKeywordToken* token ) { mToken = token; } LLKeywordToken* getToken() const { return mToken; } - BOOL getToolTip( LLString& msg ) const; + BOOL getToolTip( std::string& msg ) const; void dump() const; diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp index 6ef485d82c..ac263250ff 100644 --- a/indra/llui/llui.cpp +++ b/indra/llui/llui.cpp @@ -63,8 +63,8 @@ const LLColor4 UI_VERTEX_COLOR(1.f, 1.f, 1.f, 1.f); BOOL gShowTextEditCursor = TRUE; // Language for UI construction -std::map gTranslation; -std::list gUntranslated; +std::map gTranslation; +std::list gUntranslated; LLControlGroup* LLUI::sConfigGroup = NULL; LLControlGroup* LLUI::sColorsGroup = NULL; @@ -80,8 +80,9 @@ BOOL LLUI::sQAMode = FALSE; // // Functions // -void make_ui_sound(const LLString& name) +void make_ui_sound(const char* namep) { + std::string name = ll_safe_string(namep); if (!LLUI::sConfigGroup->controlExists(name)) { llwarns << "tried to make ui sound for unknown sound name: " << name << llendl; @@ -1557,7 +1558,7 @@ void LLUI::initClass(LLControlGroup* config, LLImageProviderInterface* image_provider, LLUIAudioCallback audio_callback, const LLVector2* scale_factor, - const LLString& language) + const std::string& language) { sConfigGroup = config; sColorsGroup = colors; @@ -1647,10 +1648,10 @@ void LLUI::setCursorPositionLocal(const LLView* viewp, S32 x, S32 y) } //static -LLString LLUI::locateSkin(const LLString& filename) +std::string LLUI::locateSkin(const std::string& filename) { - LLString slash = gDirUtilp->getDirDelimiter(); - LLString found_file = filename; + std::string slash = gDirUtilp->getDirDelimiter(); + std::string found_file = filename; if (!gDirUtilp->fileExists(found_file)) { found_file = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, filename); // Should be CUSTOM_SKINS? @@ -1659,18 +1660,18 @@ LLString LLUI::locateSkin(const LLString& filename) { if (!gDirUtilp->fileExists(found_file)) { - LLString localization(sConfigGroup->getString("Language")); + std::string localization(sConfigGroup->getString("Language")); if(localization == "default") { localization = sConfigGroup->getString("SystemLanguage"); } - LLString local_skin = "xui" + slash + localization + slash + filename; + std::string local_skin = "xui" + slash + localization + slash + filename; found_file = gDirUtilp->getExpandedFilename(LL_PATH_SKINS, local_skin); } } if (!gDirUtilp->fileExists(found_file)) { - LLString local_skin = "xui" + slash + "en-us" + slash + filename; + std::string local_skin = "xui" + slash + "en-us" + slash + filename; found_file = gDirUtilp->getExpandedFilename(LL_PATH_SKINS, local_skin); } if (!gDirUtilp->fileExists(found_file)) @@ -1718,7 +1719,7 @@ void LLUI::glRectToScreen(const LLRect& gl, LLRect *screen) } //static -LLUIImage* LLUI::getUIImage(const LLString& name) +LLUIImage* LLUI::getUIImage(const std::string& name) { if (!name.empty()) return sImageProvider->getUIImage(name); @@ -1806,7 +1807,7 @@ LLLocalClipRect::LLLocalClipRect(const LLRect &rect, BOOL enabled) // LLUIImage // -LLUIImage::LLUIImage(const LLString& name, LLPointer image) : +LLUIImage::LLUIImage(const std::string& name, LLPointer image) : mName(name), mImage(image), mScaleRegion(0.f, 1.f, 1.f, 0.f), diff --git a/indra/llui/llui.h b/indra/llui/llui.h index ab45e36175..d434dbd6d1 100644 --- a/indra/llui/llui.h +++ b/indra/llui/llui.h @@ -56,7 +56,7 @@ class LLUIImage; // UI colors extern const LLColor4 UI_VERTEX_COLOR; -void make_ui_sound(const LLString& name); +void make_ui_sound(const char* name); BOOL ui_point_in_rect(S32 x, S32 y, S32 left, S32 top, S32 right, S32 bottom); void gl_state_for_2d(S32 width, S32 height); @@ -144,7 +144,7 @@ inline void gl_rect_2d_offset_local( const LLRect& rect, S32 pixel_offset, BOOL // void init_tr(); // Returns a string from the string table in the correct language -// LLString tr(const LLString& english_chars); +// std::string tr(const std::string& english_chars); // Used to hide the flashing text cursor when window doesn't have focus. extern BOOL gShowTextEditCursor; @@ -164,7 +164,7 @@ public: LLImageProviderInterface* image_provider, LLUIAudioCallback audio_callback = NULL, const LLVector2 *scale_factor = NULL, - const LLString& language = LLString::null); + const std::string& language = LLStringUtil::null); static void cleanupClass(); static void pushMatrix(); @@ -173,12 +173,12 @@ public: static void translate(F32 x, F32 y, F32 z = 0.0f); //helper functions (should probably move free standing rendering helper functions here) - static LLString locateSkin(const LLString& filename); + static std::string locateSkin(const std::string& filename); static void setCursorPositionScreen(S32 x, S32 y); static void setCursorPositionLocal(const LLView* viewp, S32 x, S32 y); static void setScaleFactor(const LLVector2& scale_factor); static void setLineWidth(F32 width); - static LLUIImage* getUIImage(const LLString& name); + static LLUIImage* getUIImage(const std::string& name); static LLVector2 getWindowSize(); static void screenPointToGL(S32 screen_x, S32 screen_y, S32 *gl_x, S32 *gl_y); static void glPointToScreen(S32 gl_x, S32 gl_y, S32 *screen_x, S32 *screen_y); @@ -411,7 +411,7 @@ public: class LLUIImage : public LLRefCount { public: - LLUIImage(const LLString& name, LLPointer image); + LLUIImage(const std::string& name, LLPointer image); void setClipRegion(const LLRectf& region); void setScaleRegion(const LLRectf& region); @@ -431,7 +431,7 @@ public: void drawBorder(const LLRect& rect, const LLColor4& color, S32 border_width) const { drawBorder(rect.mLeft, rect.mBottom, rect.getWidth(), rect.getHeight(), color, border_width); } void drawBorder(S32 x, S32 y, const LLColor4& color, S32 border_width) const { drawBorder(x, y, mImage->getWidth(0), mImage->getHeight(0), color, border_width); } - const LLString& getName() const { return mName; } + const std::string& getName() const { return mName; } S32 getWidth() const; S32 getHeight() const; @@ -441,7 +441,7 @@ public: S32 getTextureHeight() const; protected: - LLString mName; + std::string mName; LLRectf mScaleRegion; LLRectf mClipRegion; LLPointer mImage; @@ -592,7 +592,7 @@ public: LLImageProviderInterface() {}; virtual ~LLImageProviderInterface() {}; - virtual LLUIImagePtr getUIImage(const LLString& name) = 0; + virtual LLUIImagePtr getUIImage(const std::string& name) = 0; virtual LLUIImagePtr getUIImageByID(const LLUUID& id) = 0; virtual void cleanUp() = 0; }; diff --git a/indra/llui/lluictrl.cpp b/indra/llui/lluictrl.cpp index aa44663fd0..c01845e524 100644 --- a/indra/llui/lluictrl.cpp +++ b/indra/llui/lluictrl.cpp @@ -98,7 +98,7 @@ LLUICtrl::LLUICtrl() : { } -LLUICtrl::LLUICtrl(const LLString& name, const LLRect& rect, BOOL mouse_opaque, +LLUICtrl::LLUICtrl(const std::string& name, const LLRect& rect, BOOL mouse_opaque, void (*on_commit_callback)(LLUICtrl*, void*), void* callback_userdata, U32 reshape) @@ -147,13 +147,13 @@ LLSD LLUICtrl::getValue() const } // virtual -BOOL LLUICtrl::setTextArg( const LLString& key, const LLStringExplicit& text ) +BOOL LLUICtrl::setTextArg( const std::string& key, const LLStringExplicit& text ) { return FALSE; } // virtual -BOOL LLUICtrl::setLabelArg( const LLString& key, const LLStringExplicit& text ) +BOOL LLUICtrl::setLabelArg( const std::string& key, const LLStringExplicit& text ) { return FALSE; } @@ -495,7 +495,7 @@ LLUICtrl* LLUICtrl::findRootMostFocusRoot() const /* // Don't let the children handle the tool tip. Handle it here instead. -BOOL LLUICtrl::handleToolTip(S32 x, S32 y, LLString& msg, LLRect* sticky_rect_screen) +BOOL LLUICtrl::handleToolTip(S32 x, S32 y, std::string& msg, LLRect* sticky_rect_screen) { BOOL handled = FALSE; if (getVisible() && pointInView( x, y ) ) diff --git a/indra/llui/lluictrl.h b/indra/llui/lluictrl.h index 6863940ddd..52ea37ffdd 100644 --- a/indra/llui/lluictrl.h +++ b/indra/llui/lluictrl.h @@ -69,7 +69,7 @@ public: typedef BOOL (*LLUICtrlValidate)(LLUICtrl* ctrl, void* userdata); LLUICtrl(); - LLUICtrl( const LLString& name, const LLRect& rect, BOOL mouse_opaque, + LLUICtrl( const std::string& name, const LLRect& rect, BOOL mouse_opaque, LLUICtrlCallback callback, void* callback_userdata, U32 reshape=FOLLOWS_NONE); @@ -78,7 +78,7 @@ public: // LLView interface /*virtual*/ void initFromXML(LLXMLNodePtr node, LLView* parent); /*virtual*/ LLXMLNodePtr getXML(bool save_children = true) const; - /*virtual*/ BOOL setLabelArg( const LLString& key, const LLStringExplicit& text ); + /*virtual*/ BOOL setLabelArg( const std::string& key, const LLStringExplicit& text ); /*virtual*/ void onFocusReceived(); /*virtual*/ void onFocusLost(); /*virtual*/ BOOL isCtrl() const; @@ -97,7 +97,7 @@ public: virtual class LLCtrlScrollInterface* getScrollInterface(); virtual LLSD getValue() const; - virtual BOOL setTextArg( const LLString& key, const LLStringExplicit& text ); + virtual BOOL setTextArg( const std::string& key, const LLStringExplicit& text ); virtual void setIsChrome(BOOL is_chrome); virtual BOOL acceptsTextInput() const; // Defaults to false diff --git a/indra/llui/lluictrlfactory.cpp b/indra/llui/lluictrlfactory.cpp index c2dc9a1e90..15601850ae 100644 --- a/indra/llui/lluictrlfactory.cpp +++ b/indra/llui/lluictrlfactory.cpp @@ -76,18 +76,18 @@ const S32 VPAD = 4; const S32 FLOATER_H_MARGIN = 15; const S32 MIN_WIDGET_HEIGHT = 10; -std::vector LLUICtrlFactory::mXUIPaths; +std::vector LLUICtrlFactory::mXUIPaths; // UI Ctrl class for padding class LLUICtrlLocate : public LLUICtrl { public: - LLUICtrlLocate() : LLUICtrl("locate", LLRect(0,0,0,0), FALSE, NULL, NULL) { setTabStop(FALSE); } + LLUICtrlLocate() : LLUICtrl(std::string("locate"), LLRect(0,0,0,0), FALSE, NULL, NULL) { setTabStop(FALSE); } virtual void draw() { } static LLView *fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory) { - LLString name("pad"); + std::string name("pad"); node->getAttributeString("name", name); LLUICtrlLocate *new_ctrl = new LLUICtrlLocate(); @@ -117,7 +117,7 @@ LLUICtrlFactory::~LLUICtrlFactory() void LLUICtrlFactory::setupPaths() { - LLString filename = gDirUtilp->getExpandedFilename(LL_PATH_SKINS, "paths.xml"); + std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_SKINS, "paths.xml"); LLXMLNodePtr root; BOOL success = LLXMLNode::parseFile(filename, root, NULL); @@ -126,12 +126,12 @@ void LLUICtrlFactory::setupPaths() if (success) { LLXMLNodePtr path; - LLString app_dir = gDirUtilp->getAppRODataDir(); + std::string app_dir = gDirUtilp->getAppRODataDir(); for (path = root->getFirstChild(); path.notNull(); path = path->getNextSibling()) { LLUIString path_val_ui(path->getValue()); - LLString language = "en-us"; + std::string language = "en-us"; if (LLUI::sConfigGroup) { language = LLUI::sConfigGroup->getString("Language"); @@ -141,7 +141,7 @@ void LLUICtrlFactory::setupPaths() } } path_val_ui.setArg("[Language]", language); - LLString fullpath = app_dir + path_val_ui.getString(); + std::string fullpath = app_dir + path_val_ui.getString(); if (std::find(mXUIPaths.begin(), mXUIPaths.end(), fullpath) == mXUIPaths.end()) { @@ -151,8 +151,8 @@ void LLUICtrlFactory::setupPaths() } else // parsing failed { - LLString slash = gDirUtilp->getDirDelimiter(); - LLString dir = gDirUtilp->getAppRODataDir() + slash + "skins" + slash + "xui" + slash + "en-us" + slash; + std::string slash = gDirUtilp->getDirDelimiter(); + std::string dir = gDirUtilp->getAppRODataDir() + slash + "skins" + slash + "xui" + slash + "en-us" + slash; llwarns << "XUI::config file unable to open." << llendl; mXUIPaths.push_back(dir); } @@ -163,7 +163,7 @@ void LLUICtrlFactory::setupPaths() //----------------------------------------------------------------------------- // getLayeredXMLNode() //----------------------------------------------------------------------------- -bool LLUICtrlFactory::getLayeredXMLNode(const LLString &filename, LLXMLNodePtr& root) +bool LLUICtrlFactory::getLayeredXMLNode(const std::string &filename, LLXMLNodePtr& root) { if (!LLXMLNode::parseFile(mXUIPaths.front() + filename, root, NULL)) { @@ -176,12 +176,12 @@ bool LLUICtrlFactory::getLayeredXMLNode(const LLString &filename, LLXMLNodePtr& LLXMLNodePtr updateRoot; - std::vector::const_iterator itor; + std::vector::const_iterator itor; for (itor = mXUIPaths.begin(), ++itor; itor != mXUIPaths.end(); ++itor) { - LLString nodeName; - LLString updateName; + std::string nodeName; + std::string updateName; LLXMLNode::parseFile((*itor) + filename, updateRoot, NULL); @@ -201,7 +201,7 @@ bool LLUICtrlFactory::getLayeredXMLNode(const LLString &filename, LLXMLNodePtr& //----------------------------------------------------------------------------- // buildFloater() //----------------------------------------------------------------------------- -void LLUICtrlFactory::buildFloater(LLFloater* floaterp, const LLString &filename, +void LLUICtrlFactory::buildFloater(LLFloater* floaterp, const std::string& filename, const LLCallbackMap::map_t* factory_map, BOOL open) /* Flawfinder: ignore */ { LLXMLNodePtr root; @@ -242,9 +242,9 @@ void LLUICtrlFactory::buildFloater(LLFloater* floaterp, const LLString &filename //----------------------------------------------------------------------------- // saveToXML() //----------------------------------------------------------------------------- -S32 LLUICtrlFactory::saveToXML(LLView* viewp, const LLString& filename) +S32 LLUICtrlFactory::saveToXML(LLView* viewp, const std::string& filename) { - llofstream out(filename.c_str()); + llofstream out(filename); if (!out.good()) { llwarns << "Unable to open " << filename << " for output." << llendl; @@ -264,7 +264,7 @@ S32 LLUICtrlFactory::saveToXML(LLView* viewp, const LLString& filename) //----------------------------------------------------------------------------- // buildPanel() //----------------------------------------------------------------------------- -BOOL LLUICtrlFactory::buildPanel(LLPanel* panelp, const LLString &filename, +BOOL LLUICtrlFactory::buildPanel(LLPanel* panelp, const std::string& filename, const LLCallbackMap::map_t* factory_map) { BOOL didPost = FALSE; @@ -308,7 +308,7 @@ BOOL LLUICtrlFactory::buildPanel(LLPanel* panelp, const LLString &filename, //----------------------------------------------------------------------------- // buildMenu() //----------------------------------------------------------------------------- -LLMenuGL *LLUICtrlFactory::buildMenu(const LLString &filename, LLView* parentp) +LLMenuGL *LLUICtrlFactory::buildMenu(const std::string &filename, LLView* parentp) { // TomY TODO: Break this function into buildMenu and buildMenuBar LLXMLNodePtr root; @@ -346,7 +346,7 @@ LLMenuGL *LLUICtrlFactory::buildMenu(const LLString &filename, LLView* parentp) //----------------------------------------------------------------------------- // buildMenu() //----------------------------------------------------------------------------- -LLPieMenu *LLUICtrlFactory::buildPieMenu(const LLString &filename, LLView* parentp) +LLPieMenu *LLUICtrlFactory::buildPieMenu(const std::string &filename, LLView* parentp) { LLXMLNodePtr root; @@ -362,7 +362,7 @@ LLPieMenu *LLUICtrlFactory::buildPieMenu(const LLString &filename, LLView* paren return NULL; } - LLString name("menu"); + std::string name("menu"); root->getAttributeString("name", name); LLPieMenu *menu = new LLPieMenu(name); @@ -387,7 +387,7 @@ void LLUICtrlFactory::rebuild() built_panel_it != mBuiltPanels.end(); ++built_panel_it) { - LLString filename = built_panel_it->second; + std::string filename = built_panel_it->second; LLPanel* panelp = built_panel_it->first.get(); if (!panelp) { @@ -415,7 +415,7 @@ void LLUICtrlFactory::rebuild() { continue; } - LLString filename = built_floater_it->second; + std::string filename = built_floater_it->second; llinfos << "Rebuilding UI floater " << floaterp->getName() << " from " << filename << llendl; @@ -435,8 +435,8 @@ void LLUICtrlFactory::rebuild() LLView *LLUICtrlFactory::createCtrlWidget(LLPanel *parent, LLXMLNodePtr node) { - LLString ctrl_type = node->getName()->mString; - LLString::toLower(ctrl_type); + std::string ctrl_type = node->getName()->mString; + LLStringUtil::toLower(ctrl_type); LLWidgetClassRegistry::factory_func_t func = LLWidgetClassRegistry::getInstance()->getCreatorFunc(ctrl_type); @@ -477,7 +477,7 @@ LLView* LLUICtrlFactory::createWidget(LLPanel *parent, LLXMLNodePtr node) //----------------------------------------------------------------------------- // createFactoryPanel() //----------------------------------------------------------------------------- -LLPanel* LLUICtrlFactory::createFactoryPanel(LLString name) +LLPanel* LLUICtrlFactory::createFactoryPanel(const std::string& name) { std::deque::iterator itor; for (itor = mFactoryStack.begin(); itor != mFactoryStack.end(); ++itor) @@ -499,10 +499,10 @@ LLPanel* LLUICtrlFactory::createFactoryPanel(LLString name) //----------------------------------------------------------------------------- //static -BOOL LLUICtrlFactory::getAttributeColor(LLXMLNodePtr node, const LLString& name, LLColor4& color) +BOOL LLUICtrlFactory::getAttributeColor(LLXMLNodePtr node, const std::string& name, LLColor4& color) { - LLString colorstring; - BOOL res = node->getAttributeString(name, colorstring); + std::string colorstring; + BOOL res = node->getAttributeString(name.c_str(), colorstring); if (res && LLUI::sColorsGroup) { if (LLUI::sColorsGroup->controlExists(colorstring)) @@ -516,11 +516,11 @@ BOOL LLUICtrlFactory::getAttributeColor(LLXMLNodePtr node, const LLString& name, } if (!res) { - res = LLColor4::parseColor(colorstring.c_str(), &color); + res = LLColor4::parseColor(colorstring, &color); } if (!res) { - res = node->getAttributeColor(name, color); + res = node->getAttributeColor(name.c_str(), color); } return res; } diff --git a/indra/llui/lluictrlfactory.h b/indra/llui/lluictrlfactory.h index cd4fa8cacf..8638986c9f 100644 --- a/indra/llui/lluictrlfactory.h +++ b/indra/llui/lluictrlfactory.h @@ -50,44 +50,45 @@ public: void setupPaths(); - void buildFloater(LLFloater* floaterp, const LLString &filename, + void buildFloater(LLFloater* floaterp, const std::string &filename, const LLCallbackMap::map_t* factory_map = NULL, BOOL open = TRUE); - BOOL buildPanel(LLPanel* panelp, const LLString &filename, + BOOL buildPanel(LLPanel* panelp, const std::string &filename, const LLCallbackMap::map_t* factory_map = NULL); void removePanel(LLPanel* panelp) { mBuiltPanels.erase(panelp->getHandle()); } void removeFloater(LLFloater* floaterp) { mBuiltFloaters.erase(floaterp->getHandle()); } - class LLMenuGL *buildMenu(const LLString &filename, LLView* parentp); - class LLPieMenu *buildPieMenu(const LLString &filename, LLView* parentp); + class LLMenuGL *buildMenu(const std::string &filename, LLView* parentp); + class LLPieMenu *buildPieMenu(const std::string &filename, LLView* parentp); // Does what you want for LLFloaters and LLPanels // Returns 0 on success - S32 saveToXML(LLView* viewp, const LLString& filename); + S32 saveToXML(LLView* viewp, const std::string& filename); // Rebuilds all currently built panels. void rebuild(); - static BOOL getAttributeColor(LLXMLNodePtr node, const LLString& name, LLColor4& color); + static BOOL getAttributeColor(LLXMLNodePtr node, const std::string& name, LLColor4& color); - LLPanel* createFactoryPanel(LLString name); + LLPanel* createFactoryPanel(const std::string& name); virtual LLView* createCtrlWidget(LLPanel *parent, LLXMLNodePtr node); virtual LLView* createWidget(LLPanel *parent, LLXMLNodePtr node); - static bool getLayeredXMLNode(const LLString &filename, LLXMLNodePtr& root); + static bool getLayeredXMLNode(const std::string &filename, LLXMLNodePtr& root); private: - typedef std::map, LLString> built_panel_t; + typedef std::map, std::string> built_panel_t; built_panel_t mBuiltPanels; - typedef std::map, LLString> built_floater_t; + typedef std::map, std::string> built_floater_t; built_floater_t mBuiltFloaters; std::deque mFactoryStack; - static std::vector mXUIPaths; + + static std::vector mXUIPaths; LLPanel* mDummyPanel; }; diff --git a/indra/llui/lluistring.cpp b/indra/llui/lluistring.cpp index d6496b1a41..0dde20934c 100644 --- a/indra/llui/lluistring.cpp +++ b/indra/llui/lluistring.cpp @@ -32,29 +32,29 @@ #include "linden_common.h" #include "lluistring.h" -const LLString::format_map_t LLUIString::sNullArgs; +const LLStringUtil::format_map_t LLUIString::sNullArgs; -LLUIString::LLUIString(const LLString& instring, const LLString::format_map_t& args) +LLUIString::LLUIString(const std::string& instring, const LLStringUtil::format_map_t& args) : mOrig(instring), mArgs(args) { format(); } -void LLUIString::assign(const LLString& s) +void LLUIString::assign(const std::string& s) { mOrig = s; format(); } -void LLUIString::setArgList(const LLString::format_map_t& args) +void LLUIString::setArgList(const LLStringUtil::format_map_t& args) { mArgs = args; format(); } -void LLUIString::setArg(const LLString& key, const LLString& replacement) +void LLUIString::setArg(const std::string& key, const std::string& replacement) { mArgs[key] = replacement; format(); @@ -64,7 +64,7 @@ void LLUIString::truncate(S32 maxchars) { if (mWResult.size() > (size_t)maxchars) { - LLWString::truncate(mWResult, maxchars); + LLWStringUtil::truncate(mWResult, maxchars); mResult = wstring_to_utf8str(mWResult); } } @@ -98,6 +98,6 @@ void LLUIString::clear() void LLUIString::format() { mResult = mOrig; - LLString::format(mResult, mArgs); + LLStringUtil::format(mResult, mArgs); mWResult = utf8str_to_wstring(mResult); } diff --git a/indra/llui/lluistring.h b/indra/llui/lluistring.h index dd787baafe..773bc09763 100644 --- a/indra/llui/lluistring.h +++ b/indra/llui/lluistring.h @@ -1,7 +1,7 @@ /** * @file lluistring.h * @author: Steve Bennetts - * @brief A fancy wrapper for LLString supporting argument substitutions. + * @brief A fancy wrapper for std::string supporting argument substitutions. * * $LicenseInfo:firstyear=2006&license=viewergpl$ * @@ -47,15 +47,15 @@ // LLUIString mMessage("Welcome [USERNAME] to [SECONDLIFE]!"); // mMessage.setArg("[USERNAME]", "Steve"); // mMessage.setArg("[SECONDLIFE]", "Second Life"); -// llinfos << mMessage.getString().c_str() << llendl; // outputs "Welcome Steve to Second Life" +// llinfos << mMessage.getString() << llendl; // outputs "Welcome Steve to Second Life" // mMessage.setArg("[USERNAME]", "Joe"); -// llinfos << mMessage.getString().c_str() << llendl; // outputs "Welcome Joe to Second Life" +// llinfos << mMessage.getString() << llendl; // outputs "Welcome Joe to Second Life" // mMessage = "Recepción a la [SECONDLIFE] [USERNAME]" // mMessage.setArg("[SECONDLIFE]", "Segunda Vida"); -// llinfos << mMessage.getString().c_str() << llendl; // outputs "Recepción a la Segunda Vida Joe" +// llinfos << mMessage.getString() << llendl; // outputs "Recepción a la Segunda Vida Joe" // Implementation Notes: -// Attempting to have operator[](const LLString& s) return mArgs[s] fails because we have +// Attempting to have operator[](const std::string& s) return mArgs[s] fails because we have // to call format() after the assignment happens. class LLUIString @@ -64,17 +64,17 @@ public: // These methods all perform appropriate argument substitution // and modify mOrig where appropriate LLUIString() {} - LLUIString(const LLString& instring, const LLString::format_map_t& args); - LLUIString(const LLString& instring) { assign(instring); } + LLUIString(const std::string& instring, const LLStringUtil::format_map_t& args); + LLUIString(const std::string& instring) { assign(instring); } - void assign(const LLString& instring); - LLUIString& operator=(const LLString& s) { assign(s); return *this; } + void assign(const std::string& instring); + LLUIString& operator=(const std::string& s) { assign(s); return *this; } - void setArgList(const LLString::format_map_t& args); - void setArg(const LLString& key, const LLString& replacement); + void setArgList(const LLStringUtil::format_map_t& args); + void setArg(const std::string& key, const std::string& replacement); - const LLString& getString() const { return mResult; } - operator LLString() const { return mResult; } + const std::string& getString() const { return mResult; } + operator std::string() const { return mResult; } const LLWString& getWString() const { return mWResult; } operator LLWString() const { return mWResult; } @@ -92,15 +92,15 @@ public: void insert(S32 charidx, const LLWString& wchars); void replace(S32 charidx, llwchar wc); - static const LLString::format_map_t sNullArgs; + static const LLStringUtil::format_map_t sNullArgs; private: void format(); - LLString mOrig; - LLString mResult; + std::string mOrig; + std::string mResult; LLWString mWResult; // for displaying - LLString::format_map_t mArgs; + LLStringUtil::format_map_t mArgs; }; #endif // LL_LLUISTRING_H diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp index a239968e5d..c20bfe6ac0 100644 --- a/indra/llui/llview.cpp +++ b/indra/llui/llview.cpp @@ -62,7 +62,7 @@ BOOL LLView::sDebugRects = FALSE; BOOL LLView::sDebugKeys = FALSE; S32 LLView::sDepth = 0; BOOL LLView::sDebugMouseHandling = FALSE; -LLString LLView::sMouseHandlerMessage; +std::string LLView::sMouseHandlerMessage; S32 LLView::sSelectID = GL_NAME_UI_RESERVED; BOOL LLView::sEditingUI = FALSE; BOOL LLView::sForceReshape = FALSE; @@ -90,7 +90,7 @@ LLView::LLView() : { } -LLView::LLView(const LLString& name, BOOL mouse_opaque) : +LLView::LLView(const std::string& name, BOOL mouse_opaque) : mParentView(NULL), mName(name), mReshapeFlags(FOLLOWS_NONE), @@ -109,7 +109,7 @@ LLView::LLView(const LLString& name, BOOL mouse_opaque) : LLView::LLView( - const LLString& name, const LLRect& rect, BOOL mouse_opaque, U32 reshape) : + const std::string& name, const LLRect& rect, BOOL mouse_opaque, U32 reshape) : mParentView(NULL), mName(name), mRect(rect), @@ -194,7 +194,7 @@ BOOL LLView::setToolTipArg(const LLStringExplicit& key, const LLStringExplicit& return TRUE; } -void LLView::setToolTipArgs( const LLString::format_map_t& args ) +void LLView::setToolTipArgs( const LLStringUtil::format_map_t& args ) { mToolTipMsg.setArgList(args); } @@ -221,9 +221,9 @@ BOOL LLView::getUseBoundingRect() } // virtual -const LLString& LLView::getName() const +const std::string& LLView::getName() const { - static const LLString unnamed("(no name)"); + static const std::string unnamed("(no name)"); return mName.empty() ? unnamed : mName; } @@ -460,7 +460,7 @@ void LLView::setEnabled(BOOL enabled) } //virtual -BOOL LLView::setLabelArg( const LLString& key, const LLStringExplicit& text ) +BOOL LLView::setLabelArg( const std::string& key, const LLStringExplicit& text ) { return FALSE; } @@ -666,11 +666,11 @@ BOOL LLView::handleHover(S32 x, S32 y, MASK mask) return handled; } -LLString LLView::getShowNamesToolTip() +std::string LLView::getShowNamesToolTip() { LLView* view = getParent(); - LLString name; - LLString tool_tip = mName; + std::string name; + std::string tool_tip = mName; while (view) { @@ -678,7 +678,7 @@ LLString LLView::getShowNamesToolTip() if (name == "root") break; - if (view->getToolTip().find(".xml") != LLString::npos) + if (view->getToolTip().find(".xml") != std::string::npos) { tool_tip = view->getToolTip() + "/" + tool_tip; break; @@ -695,11 +695,11 @@ LLString LLView::getShowNamesToolTip() } -BOOL LLView::handleToolTip(S32 x, S32 y, LLString& msg, LLRect* sticky_rect_screen) +BOOL LLView::handleToolTip(S32 x, S32 y, std::string& msg, LLRect* sticky_rect_screen) { BOOL handled = FALSE; - LLString tool_tip; + std::string tool_tip; for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it) { @@ -719,8 +719,8 @@ BOOL LLView::handleToolTip(S32 x, S32 y, LLString& msg, LLRect* sticky_rect_scre tool_tip = mToolTipMsg.getString(); if ( LLUI::sShowXUINames && - (tool_tip.find(".xml", 0) == LLString::npos) && - (mName.find("Drag", 0) == LLString::npos)) + (tool_tip.find(".xml", 0) == std::string::npos) && + (mName.find("Drag", 0) == std::string::npos)) { tool_tip = getShowNamesToolTip(); } @@ -824,7 +824,7 @@ BOOL LLView::handleUnicodeCharHere(llwchar uni_char ) BOOL LLView::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, - LLString& tooltip_msg) + std::string& tooltip_msg) { // CRO this is an experiment to allow drag and drop into object inventory based on the DragAndDrop tool's permissions rather than the parent BOOL handled = childrenHandleDragAndDrop( x, y, mask, drop, @@ -847,7 +847,7 @@ LLView* LLView::childrenHandleDragAndDrop(S32 x, S32 y, MASK mask, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, - LLString& tooltip_msg) + std::string& tooltip_msg) { LLView* handled_view = FALSE; // CRO this is an experiment to allow drag and drop into object inventory based on the DragAndDrop tool's permissions rather than the parent @@ -987,7 +987,7 @@ LLView* LLView::childrenHandleScrollWheel(S32 x, S32 y, S32 clicks) { if (sDebugMouseHandling) { - sMouseHandlerMessage = LLString("->") + viewp->mName.c_str() + sMouseHandlerMessage; + sMouseHandlerMessage = std::string("->") + viewp->mName + sMouseHandlerMessage; } handled_view = viewp; @@ -1015,7 +1015,7 @@ LLView* LLView::childrenHandleHover(S32 x, S32 y, MASK mask) { if (sDebugMouseHandling) { - sMouseHandlerMessage = LLString("->") + viewp->mName.c_str() + sMouseHandlerMessage; + sMouseHandlerMessage = std::string("->") + viewp->mName + sMouseHandlerMessage; } handled_view = viewp; @@ -1093,7 +1093,7 @@ LLView* LLView::childrenHandleMouseDown(S32 x, S32 y, MASK mask) { if (sDebugMouseHandling) { - sMouseHandlerMessage = LLString("->") + viewp->mName.c_str() + sMouseHandlerMessage; + sMouseHandlerMessage = std::string("->") + viewp->mName + sMouseHandlerMessage; } handled_view = viewp; break; @@ -1120,7 +1120,7 @@ LLView* LLView::childrenHandleRightMouseDown(S32 x, S32 y, MASK mask) { if (sDebugMouseHandling) { - sMouseHandlerMessage = LLString("->") + viewp->mName.c_str() + sMouseHandlerMessage; + sMouseHandlerMessage = std::string("->") + viewp->mName + sMouseHandlerMessage; } handled_view = viewp; break; @@ -1148,7 +1148,7 @@ LLView* LLView::childrenHandleDoubleClick(S32 x, S32 y, MASK mask) { if (sDebugMouseHandling) { - sMouseHandlerMessage = LLString("->") + viewp->mName.c_str() + sMouseHandlerMessage; + sMouseHandlerMessage = std::string("->") + viewp->mName + sMouseHandlerMessage; } handled_view = viewp; break; @@ -1178,7 +1178,7 @@ LLView* LLView::childrenHandleMouseUp(S32 x, S32 y, MASK mask) { if (sDebugMouseHandling) { - sMouseHandlerMessage = LLString("->") + viewp->mName.c_str() + sMouseHandlerMessage; + sMouseHandlerMessage = std::string("->") + viewp->mName + sMouseHandlerMessage; } handled_view = viewp; break; @@ -1205,7 +1205,7 @@ LLView* LLView::childrenHandleRightMouseUp(S32 x, S32 y, MASK mask) { if (sDebugMouseHandling) { - sMouseHandlerMessage = LLString("->") + viewp->mName.c_str() + sMouseHandlerMessage; + sMouseHandlerMessage = std::string("->") + viewp->mName + sMouseHandlerMessage; } handled_view = viewp; break; @@ -1326,7 +1326,7 @@ void LLView::drawDebugRect() gGL.color4fv( border_color.mV ); x = debug_rect.getWidth()/2; y = debug_rect.getHeight()/2; - LLString debug_text = llformat("%s (%d x %d)", getName().c_str(), + std::string debug_text = llformat("%s (%d x %d)", getName().c_str(), debug_rect.getWidth(), debug_rect.getHeight()); LLFontGL::sSansSerifSmall->renderUTF8(debug_text, 0, (F32)x, (F32)y, border_color, LLFontGL::HCENTER, LLFontGL::BASELINE, LLFontGL::NORMAL, @@ -1537,7 +1537,7 @@ BOOL LLView::hasAncestor(const LLView* parentp) const //----------------------------------------------------------------------------- -BOOL LLView::childHasKeyboardFocus( const LLString& childname ) const +BOOL LLView::childHasKeyboardFocus( const std::string& childname ) const { LLView *child = getChildView(childname, TRUE, FALSE); if (child) @@ -1552,7 +1552,7 @@ BOOL LLView::childHasKeyboardFocus( const LLString& childname ) const //----------------------------------------------------------------------------- -BOOL LLView::hasChild(const LLString& childname, BOOL recurse) const +BOOL LLView::hasChild(const std::string& childname, BOOL recurse) const { return getChildView(childname, recurse, FALSE) != NULL; } @@ -1560,7 +1560,7 @@ BOOL LLView::hasChild(const LLString& childname, BOOL recurse) const //----------------------------------------------------------------------------- // getChildView() //----------------------------------------------------------------------------- -LLView* LLView::getChildView(const LLString& name, BOOL recurse, BOOL create_if_missing) const +LLView* LLView::getChildView(const std::string& name, BOOL recurse, BOOL create_if_missing) const { //richard: should we allow empty names? //if(name.empty()) @@ -1923,33 +1923,18 @@ LLView* LLView::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *fact // static void LLView::addColorXML(LLXMLNodePtr node, const LLColor4& color, - const LLString& xml_name, const LLString& control_name) + const char* xml_name, const char* control_name) { - if (color != LLUI::sColorsGroup->getColor(control_name)) + if (color != LLUI::sColorsGroup->getColor(ll_safe_string(control_name))) { node->createChild(xml_name, TRUE)->setFloatValue(4, color.mV); } } -// static -void LLView::saveColorToXML(std::ostream& out, const LLColor4& color, - const LLString& xml_name, const LLString& control_name, - const LLString& indent) -{ - if (color != LLUI::sColorsGroup->getColor(control_name)) - { - out << indent << xml_name << "=\"" - << color.mV[VRED] << ", " - << color.mV[VGREEN] << ", " - << color.mV[VBLUE] << ", " - << color.mV[VALPHA] << "\"\n"; - } -} - //static -LLString LLView::escapeXML(const LLString& xml, LLString& indent) +std::string LLView::escapeXML(const std::string& xml, std::string& indent) { - LLString ret = indent + "\"" + LLXMLNode::escapeXML(xml); + std::string ret = indent + "\"" + LLXMLNode::escapeXML(xml); //replace every newline with a close quote, new line, indent, open quote size_t index = ret.size()-1; @@ -2404,12 +2389,12 @@ LLView* LLView::findSnapEdge(S32& new_edge_val, const LLCoordGL& mouse_dir, ESna // Listener dispatch functions //----------------------------------------------------------------------------- -void LLView::registerEventListener(LLString name, LLSimpleListener* function) +void LLView::registerEventListener(std::string name, LLSimpleListener* function) { - mDispatchList.insert(std::pair(name, function)); + mDispatchList.insert(std::pair(name, function)); } -void LLView::deregisterEventListener(LLString name) +void LLView::deregisterEventListener(std::string name) { dispatch_list_t::iterator itor = mDispatchList.find(name); if (itor != mDispatchList.end()) @@ -2418,7 +2403,7 @@ void LLView::deregisterEventListener(LLString name) } } -LLString LLView::findEventListener(LLSimpleListener *listener) const +std::string LLView::findEventListener(LLSimpleListener *listener) const { dispatch_list_t::const_iterator itor; for (itor = mDispatchList.begin(); itor != mDispatchList.end(); ++itor) @@ -2432,10 +2417,10 @@ LLString LLView::findEventListener(LLSimpleListener *listener) const { return mParentView->findEventListener(listener); } - return LLString::null; + return LLStringUtil::null; } -LLSimpleListener* LLView::getListenerByName(const LLString& callback_name) +LLSimpleListener* LLView::getListenerByName(const std::string& callback_name) { LLSimpleListener* callback = NULL; dispatch_list_t::iterator itor = mDispatchList.find(callback_name); @@ -2450,7 +2435,7 @@ LLSimpleListener* LLView::getListenerByName(const LLString& callback_name) return callback; } -LLControlVariable *LLView::findControl(LLString name) +LLControlVariable *LLView::findControl(const std::string& name) { control_map_t::iterator itor = mFloaterControls.find(name); if (itor != mFloaterControls.end()) @@ -2494,7 +2479,7 @@ U32 LLView::createRect(LLXMLNodePtr node, LLRect &rect, LLView* parent_view, con } } - LLString rect_control; + std::string rect_control; node->getAttributeString("rect_control", rect_control); if (! rect_control.empty()) { @@ -2655,14 +2640,14 @@ void LLView::initFromXML(LLXMLNodePtr node, LLView* parent) if (node->hasAttribute("control_name")) { - LLString control_name; + std::string control_name; node->getAttributeString("control_name", control_name); setControlName(control_name, NULL); } if (node->hasAttribute("tool_tip")) { - LLString tool_tip_msg(""); + std::string tool_tip_msg; node->getAttributeString("tool_tip", tool_tip_msg); setToolTip(tool_tip_msg); } @@ -2695,7 +2680,7 @@ void LLView::parseFollowsFlags(LLXMLNodePtr node) { setFollowsNone(); - LLString follows; + std::string follows; node->getAttributeString("follows", follows); typedef boost::tokenizer > tokenizer; @@ -2739,10 +2724,10 @@ LLFontGL* LLView::selectFont(LLXMLNodePtr node) if (node->hasAttribute("font")) { - LLString font_name; + std::string font_name; node->getAttributeString("font", font_name); - gl_font = LLFontGL::fontFromName(font_name.c_str()); + gl_font = LLFontGL::fontFromName(font_name); } return gl_font; } @@ -2754,7 +2739,7 @@ LLFontGL::HAlign LLView::selectFontHAlign(LLXMLNodePtr node) if (node->hasAttribute("halign")) { - LLString horizontal_align_name; + std::string horizontal_align_name; node->getAttributeString("halign", horizontal_align_name); gl_hfont_align = LLFontGL::hAlignFromName(horizontal_align_name); } @@ -2768,7 +2753,7 @@ LLFontGL::VAlign LLView::selectFontVAlign(LLXMLNodePtr node) if (node->hasAttribute("valign")) { - LLString vert_align_name; + std::string vert_align_name; node->getAttributeString("valign", vert_align_name); gl_vfont_align = LLFontGL::vAlignFromName(vert_align_name); } @@ -2782,7 +2767,7 @@ LLFontGL::StyleFlags LLView::selectFontStyle(LLXMLNodePtr node) if (node->hasAttribute("style")) { - LLString style_flags_name; + std::string style_flags_name; node->getAttributeString("style", style_flags_name); if (style_flags_name == "normal") @@ -2808,7 +2793,7 @@ LLFontGL::StyleFlags LLView::selectFontStyle(LLXMLNodePtr node) bool LLView::setControlValue(const LLSD& value) { - LLString ctrlname = getControlName(); + std::string ctrlname = getControlName(); if (!ctrlname.empty()) { LLUI::sConfigGroup->setValue(ctrlname, value); @@ -2818,7 +2803,7 @@ bool LLView::setControlValue(const LLSD& value) } //virtual -void LLView::setControlName(const LLString& control_name, LLView *context) +void LLView::setControlName(const std::string& control_name, LLView *context) { if (context == NULL) { @@ -2870,12 +2855,12 @@ bool LLView::controlListener(const LLSD& newvalue, LLHandle handle, std: return false; } -void LLView::addBoolControl(LLString name, bool initial_value) +void LLView::addBoolControl(const std::string& name, bool initial_value) { - mFloaterControls[name] = new LLControlVariable(name, TYPE_BOOLEAN, initial_value, "Internal floater control"); + mFloaterControls[name] = new LLControlVariable(name, TYPE_BOOLEAN, initial_value, std::string("Internal floater control")); } -LLControlVariable *LLView::getControl(LLString name) +LLControlVariable *LLView::getControl(const std::string& name) { control_map_t::iterator itor = mFloaterControls.find(name); if (itor != mFloaterControls.end()) @@ -2910,20 +2895,20 @@ LLWidgetClassRegistry::LLWidgetClassRegistry() { } -void LLWidgetClassRegistry::registerCtrl(const LLString& tag, LLWidgetClassRegistry::factory_func_t function) +void LLWidgetClassRegistry::registerCtrl(const std::string& tag, LLWidgetClassRegistry::factory_func_t function) { - LLString lower_case_tag = tag; - LLString::toLower(lower_case_tag); + std::string lower_case_tag = tag; + LLStringUtil::toLower(lower_case_tag); mCreatorFunctions[lower_case_tag] = function; } -BOOL LLWidgetClassRegistry::isTagRegistered(const LLString &tag) +BOOL LLWidgetClassRegistry::isTagRegistered(const std::string &tag) { return mCreatorFunctions.find(tag) != mCreatorFunctions.end(); } -LLWidgetClassRegistry::factory_func_t LLWidgetClassRegistry::getCreatorFunc(const LLString& ctrl_type) +LLWidgetClassRegistry::factory_func_t LLWidgetClassRegistry::getCreatorFunc(const std::string& ctrl_type) { factory_map_t::const_iterator found_it = mCreatorFunctions.find(ctrl_type); if (found_it == mCreatorFunctions.end()) diff --git a/indra/llui/llview.h b/indra/llui/llview.h index 94811adaa5..2e1d0e3868 100644 --- a/indra/llui/llview.h +++ b/indra/llui/llview.h @@ -89,7 +89,7 @@ virtual void setVisible(BOOL visible); LLFloater, LLAlertDialog, LLMenuItemGL, LLModalDialog virtual void setEnabled(BOOL enabled) { mEnabled = enabled; } LLCheckBoxCtrl, LLComboBox, LLLineEditor, LLMenuGL, LLRadioGroup, etc -virtual BOOL setLabelArg( const LLString& key, const LLStringExplicit& text ) { return FALSE; } +virtual BOOL setLabelArg( const std::string& key, const LLStringExplicit& text ) { return FALSE; } LLUICtrl, LLButton, LLCheckBoxCtrl, LLLineEditor, LLMenuGL, LLSliderCtrl virtual void onVisibilityChange ( BOOL curVisibilityIn ); LLMenuGL @@ -114,7 +114,7 @@ virtual BOOL handleKey(KEY key, MASK mask, BOOL called_from_parent); * virtual BOOL handleUnicodeChar(llwchar uni_char, BOOL called_from_parent); * -virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,EDragAndDropType cargo_type,void* cargo_data,EAcceptance* accept,LLString& tooltip_msg); +virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,EDragAndDropType cargo_type,void* cargo_data,EAcceptance* accept,std::string& tooltip_msg); * virtual void draw(); * @@ -128,11 +128,11 @@ virtual void onFocusLost() {} LLUICtrl, LLScrollListCtrl, LLMenuGL, LLLineEditor, LLComboBox virtual void onFocusReceived() {} LLUICtrl, LLTextEditor, LLScrollListVtrl, LLMenuGL, LLLineEditor -virtual LLView* getChildView(const LLString& name, BOOL recurse = TRUE, BOOL create_if_missing = TRUE) const; +virtual LLView* getChildView(const std::string& name, BOOL recurse = TRUE, BOOL create_if_missing = TRUE) const; LLTabContainer, LLPanel, LLMenuGL -virtual void setControlName(const LLString& control, LLView *context); +virtual void setControlName(const std::string& control, LLView *context); LLSliderCtrl, LLCheckBoxCtrl -virtual LLString getControlName() const { return mControlName; } +virtual std::string getControlName() const { return mControlName; } LLSliderCtrl, LLCheckBoxCtrl virtual bool handleEvent(LLPointer event, const LLSD& userdata); LLMenuItem @@ -154,11 +154,11 @@ class LLWidgetClassRegistry : public LLSingleton friend class LLSingleton; public: typedef LLView* (*factory_func_t)(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory); - typedef std::map factory_map_t; + typedef std::map factory_map_t; - void registerCtrl(const LLString& xml_tag, factory_func_t function); - BOOL isTagRegistered(const LLString& xml_tag); - factory_func_t getCreatorFunc(const LLString& xml_tag); + void registerCtrl(const std::string& xml_tag, factory_func_t function); + BOOL isTagRegistered(const std::string& xml_tag); + factory_func_t getCreatorFunc(const std::string& xml_tag); // get (first) xml tag for a given class template std::string getTag() @@ -179,7 +179,7 @@ private: LLWidgetClassRegistry(); virtual ~LLWidgetClassRegistry() {}; - typedef std::set ctrl_name_set_t; + typedef std::set ctrl_name_set_t; ctrl_name_set_t mUICtrlNames; // map of xml tags to widget creator functions @@ -252,8 +252,8 @@ public: typedef child_tab_order_t::const_reverse_iterator child_tab_order_const_reverse_iter_t; LLView(); - LLView(const LLString& name, BOOL mouse_opaque); - LLView(const LLString& name, const LLRect& rect, BOOL mouse_opaque, U32 follows=FOLLOWS_NONE); + LLView(const std::string& name, BOOL mouse_opaque); + LLView(const std::string& name, const LLRect& rect, BOOL mouse_opaque, U32 follows=FOLLOWS_NONE); virtual ~LLView(); @@ -274,7 +274,7 @@ public: BOOL getMouseOpaque() const { return mMouseOpaque; } void setToolTip( const LLStringExplicit& msg ); BOOL setToolTipArg( const LLStringExplicit& key, const LLStringExplicit& text ); - void setToolTipArgs( const LLString::format_map_t& args ); + void setToolTipArgs( const LLStringUtil::format_map_t& args ); virtual void setRect(const LLRect &rect); void setFollows(U32 flags) { mReshapeFlags = flags; } @@ -288,11 +288,11 @@ public: void setFollowsAll() { mReshapeFlags |= FOLLOWS_ALL; } void setSoundFlags(U8 flags) { mSoundFlags = flags; } - void setName(LLString name) { mName = name; } + void setName(std::string name) { mName = name; } void setUseBoundingRect( BOOL use_bounding_rect ); BOOL getUseBoundingRect(); - const LLString& getToolTip() const { return mToolTipMsg.getString(); } + const std::string& getToolTip() const { return mToolTipMsg.getString(); } void sendChildToFront(LLView* child); void sendChildToBack(LLView* child); @@ -340,7 +340,7 @@ public: BOOL getEnabled() const { return mEnabled; } U8 getSoundFlags() const { return mSoundFlags; } - virtual BOOL setLabelArg( const LLString& key, const LLStringExplicit& text ); + virtual BOOL setLabelArg( const std::string& key, const LLStringExplicit& text ); virtual void onVisibilityChange ( BOOL curVisibilityIn ); @@ -374,8 +374,8 @@ public: S32 getChildCount() const { return (S32)mChildList.size(); } template void sortChildren(_Pr3 _Pred) { mChildList.sort(_Pred); } BOOL hasAncestor(const LLView* parentp) const; - BOOL hasChild(const LLString& childname, BOOL recurse = FALSE) const; - BOOL childHasKeyboardFocus( const LLString& childname ) const; + BOOL hasChild(const std::string& childname, BOOL recurse = FALSE) const; + BOOL childHasKeyboardFocus( const std::string& childname ) const; // @@ -403,9 +403,9 @@ public: EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, - LLString& tooltip_msg); + std::string& tooltip_msg); - LLString getShowNamesToolTip(); + std::string getShowNamesToolTip(); virtual void draw(); @@ -439,19 +439,19 @@ public: void localRectToScreen( const LLRect& local, LLRect* screen ) const; // Listener dispatching functions (Dispatcher deletes pointers to listeners on deregistration or destruction) - LLSimpleListener* getListenerByName(const LLString &callback_name); - void registerEventListener(LLString name, LLSimpleListener* function); - void deregisterEventListener(LLString name); - LLString findEventListener(LLSimpleListener *listener) const; - void addListenerToControl(LLEventDispatcher *observer, const LLString& name, LLSD filter, LLSD userdata); + LLSimpleListener* getListenerByName(const std::string& callback_name); + void registerEventListener(std::string name, LLSimpleListener* function); + void deregisterEventListener(std::string name); + std::string findEventListener(LLSimpleListener *listener) const; + void addListenerToControl(LLEventDispatcher *observer, const std::string& name, LLSD filter, LLSD userdata); - void addBoolControl(LLString name, bool initial_value); - LLControlVariable *getControl(LLString name); - LLControlVariable *findControl(LLString name); + void addBoolControl(const std::string& name, bool initial_value); + LLControlVariable *getControl(const std::string& name); + LLControlVariable *findControl(const std::string& name); bool setControlValue(const LLSD& value); - virtual void setControlName(const LLString& control, LLView *context); - virtual LLString getControlName() const { return mControlName; } + virtual void setControlName(const std::string& control, LLView *context); + virtual std::string getControlName() const { return mControlName; } // virtual bool handleEvent(LLPointer event, const LLSD& userdata); virtual void setValue(const LLSD& value); virtual LLSD getValue() const; @@ -467,15 +467,15 @@ public: /*virtual*/ BOOL handleScrollWheel(S32 x, S32 y, S32 clicks); /*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); /*virtual*/ BOOL handleRightMouseUp(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleToolTip(S32 x, S32 y, LLString& msg, LLRect* sticky_rect); // Display mToolTipMsg if no child handles it. - /*virtual*/ const LLString& getName() const; + /*virtual*/ BOOL handleToolTip(S32 x, S32 y, std::string& msg, LLRect* sticky_rect); // Display mToolTipMsg if no child handles it. + /*virtual*/ const std::string& getName() const; /*virtual*/ void onMouseCaptureLost(); /*virtual*/ BOOL hasMouseCapture(); /*virtual*/ BOOL isView(); // Hack to support LLFocusMgr /*virtual*/ void screenPointToLocal(S32 screen_x, S32 screen_y, S32* local_x, S32* local_y) const; /*virtual*/ void localPointToScreen(S32 local_x, S32 local_y, S32* screen_x, S32* screen_y) const; - template T* getChild(const LLString& name, BOOL recurse = TRUE, BOOL create_if_missing = TRUE) const + template T* getChild(const std::string& name, BOOL recurse = TRUE, BOOL create_if_missing = TRUE) const { LLView* child = getChildView(name, recurse, FALSE); T* result = dynamic_cast(child); @@ -495,22 +495,22 @@ public: return result; } - virtual LLView* getChildView(const LLString& name, BOOL recurse = TRUE, BOOL create_if_missing = TRUE) const; + virtual LLView* getChildView(const std::string& name, BOOL recurse = TRUE, BOOL create_if_missing = TRUE) const; - template T* createDummyWidget(const LLString& name) const + template T* createDummyWidget(const std::string& name) const { T* widget = getDummyWidget(name); if (!widget) { // get xml tag name corresponding to requested widget type (e.g. "button") - LLString xml_tag = LLWidgetClassRegistry::getInstance()->getTag(); + std::string xml_tag = LLWidgetClassRegistry::getInstance()->getTag(); if (xml_tag.empty()) { llwarns << "No xml tag registered for this class " << llendl; return NULL; } // create dummy xml node (