diff options
Diffstat (limited to 'indra/newview')
321 files changed, 4565 insertions, 5271 deletions
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 29d05cbdbc..a1515abf9d 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -199,7 +199,6 @@ set(viewer_SOURCE_FILES llglslshader.cpp llgroupmgr.cpp llgroupnotify.cpp - llhippo.cpp llhoverview.cpp llhudeffectbeam.cpp llhudeffect.cpp @@ -590,7 +589,6 @@ set(viewer_HEADER_FILES llglslshader.h llgroupmgr.h llgroupnotify.h - llhippo.h llhoverview.h llhudeffect.h llhudeffectbeam.h diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index a46db09e3e..9d2ea7a1b7 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -236,8 +236,8 @@ BOOL LLAgent::sDebugDisplayTarget = FALSE; const F32 LLAgent::TYPING_TIMEOUT_SECS = 5.f; -std::map<LLString, LLString> LLAgent::sTeleportErrorMessages; -std::map<LLString, LLString> LLAgent::sTeleportProgressMessages; +std::map<std::string, std::string> LLAgent::sTeleportErrorMessages; +std::map<std::string, std::string> LLAgent::sTeleportProgressMessages; class LLAgentFriendObserver : public LLFriendObserver { @@ -819,13 +819,10 @@ void LLAgent::setRegion(LLViewerRegion *regionp) llassert(regionp); if (mRegionp != regionp) { - // JC - Avoid this, causes out-of-bounds array write deep within - // Windows. - // char host_name[MAX_STRING]; - // regionp->getHost().getHostName(host_name, MAX_STRING); + // std::string host_name; + // host_name = regionp->getHost().getHostName(); - char ip[MAX_STRING]; /*Flawfinder: ignore*/ - regionp->getHost().getString(ip, MAX_STRING); + std::string ip = regionp->getHost().getString(); llinfos << "Moving agent into region: " << regionp->getName() << " located at " << ip << llendl; if (mRegionp) @@ -2092,7 +2089,7 @@ void LLAgent::setAFK() if (gAFKMenu) { //*TODO:Translate - gAFKMenu->setLabel(LLString("Set Not Away")); + gAFKMenu->setLabel(std::string("Set Not Away")); } } } @@ -2116,7 +2113,7 @@ void LLAgent::clearAFK() if (gAFKMenu) { //*TODO:Translate - gAFKMenu->setLabel(LLString("Set Away")); + gAFKMenu->setLabel(std::string("Set Away")); } } } @@ -2139,7 +2136,7 @@ void LLAgent::setBusy() if (gBusyMenu) { //*TODO:Translate - gBusyMenu->setLabel(LLString("Set Not Busy")); + gBusyMenu->setLabel(std::string("Set Not Busy")); } LLFloaterMute::getInstance()->updateButtons(); } @@ -2154,7 +2151,7 @@ void LLAgent::clearBusy() if (gBusyMenu) { //*TODO:Translate - gBusyMenu->setLabel(LLString("Set Busy")); + gBusyMenu->setLabel(std::string("Set Busy")); } LLFloaterMute::getInstance()->updateButtons(); } @@ -5113,9 +5110,8 @@ BOOL LLAgent::allowOperation(PermissionBit op, } -void LLAgent::getName(LLString& name) +void LLAgent::getName(std::string& name) { - // Note: assumes that name points to a buffer of at least DB_FULL_NAME_BUF_SIZE bytes. name.clear(); if (mAvatarObject) @@ -5198,8 +5194,8 @@ void LLAgent::processAgentDropGroup(LLMessageSystem *msg, void **) { gAgent.mGroupID.setNull(); gAgent.mGroupPowers = 0; - gAgent.mGroupName[0] = '\0'; - gAgent.mGroupTitle[0] = '\0'; + gAgent.mGroupName.clear(); + gAgent.mGroupTitle.clear(); } // refresh all group information @@ -5277,8 +5273,8 @@ class LLAgentDropGroupViewerNode : public LLHTTPNode { gAgent.mGroupID.setNull(); gAgent.mGroupPowers = 0; - gAgent.mGroupName[0] = '\0'; - gAgent.mGroupTitle[0] = '\0'; + gAgent.mGroupName.clear(); + gAgent.mGroupTitle.clear(); } // refresh all group information @@ -5330,7 +5326,6 @@ void LLAgent::processAgentGroupDataUpdate(LLMessageSystem *msg, void **) LLGroupData group; S32 index = -1; bool need_floater_update = false; - char group_name[DB_GROUP_NAME_BUF_SIZE]; /*Flawfinder: ignore*/ for(S32 i = 0; i < count; ++i) { msg->getUUIDFast(_PREHASH_GroupData, _PREHASH_GroupID, group.mID, i); @@ -5338,8 +5333,7 @@ void LLAgent::processAgentGroupDataUpdate(LLMessageSystem *msg, void **) msg->getU64(_PREHASH_GroupData, "GroupPowers", group.mPowers, i); msg->getBOOL(_PREHASH_GroupData, "AcceptNotices", group.mAcceptNotices, i); msg->getS32(_PREHASH_GroupData, "Contribution", group.mContribution, i); - msg->getStringFast(_PREHASH_GroupData, _PREHASH_GroupName, DB_GROUP_NAME_BUF_SIZE, group_name, i); - group.mName.assign(group_name); + msg->getStringFast(_PREHASH_GroupData, _PREHASH_GroupName, group.mName, i); if(group.mID.notNull()) { @@ -5437,7 +5431,7 @@ void LLAgent::processAgentDataUpdate(LLMessageSystem *msg, void **) return; } - msg->getStringFast(_PREHASH_AgentData, _PREHASH_GroupTitle, DB_GROUP_TITLE_BUF_SIZE, gAgent.mGroupTitle); + msg->getStringFast(_PREHASH_AgentData, _PREHASH_GroupTitle, gAgent.mGroupTitle); LLUUID active_id; msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_ActiveGroupID, active_id); @@ -5446,13 +5440,13 @@ void LLAgent::processAgentDataUpdate(LLMessageSystem *msg, void **) { gAgent.mGroupID = active_id; msg->getU64(_PREHASH_AgentData, "GroupPowers", gAgent.mGroupPowers); - msg->getString(_PREHASH_AgentData, _PREHASH_GroupName, DB_GROUP_NAME_BUF_SIZE, gAgent.mGroupName); + msg->getString(_PREHASH_AgentData, _PREHASH_GroupName, gAgent.mGroupName); } else { gAgent.mGroupID.setNull(); gAgent.mGroupPowers = 0; - gAgent.mGroupName[0] = '\0'; + gAgent.mGroupName.clear(); } update_group_floaters(active_id); @@ -6217,7 +6211,7 @@ void LLAgent::saveWearableAs( return; } std::string trunc_name(new_name); - LLString::truncate(trunc_name, DB_INV_ITEM_NAME_STR_LEN); + LLStringUtil::truncate(trunc_name, DB_INV_ITEM_NAME_STR_LEN); LLWearable* new_wearable = gWearableList.createCopyFromAvatar( old_wearable, trunc_name); @@ -6251,7 +6245,7 @@ void LLAgent::saveWearableAs( LLWearable* old_wearable = getWearable( type ); if( old_wearable ) { - LLString old_name = old_wearable->getName(); + std::string old_name = old_wearable->getName(); old_wearable->setName( new_name ); LLWearable* new_wearable = gWearableList.createCopyFromAvatar( old_wearable ); old_wearable->setName( old_name ); @@ -6330,7 +6324,7 @@ void LLAgent::setWearableName( const LLUUID& item_id, const std::string& new_nam LLWearable* old_wearable = mWearableEntry[i].mWearable; llassert( old_wearable ); - LLString old_name = old_wearable->getName(); + std::string old_name = old_wearable->getName(); old_wearable->setName( new_name ); LLWearable* new_wearable = gWearableList.createCopy( old_wearable ); LLInventoryItem* item = gInventory.getItem(item_id); @@ -6527,7 +6521,7 @@ void LLAgent::processAgentInitialWearablesUpdate( LLMessageSystem* mesgsys, void { gWearableList.getAsset( asset_id_array[i], - LLString::null, + LLStringUtil::null, LLWearable::typeToAssetType( (EWearableType) i ), LLAgent::onInitialWearableAssetArrived, (void*)(intptr_t)i ); } @@ -6769,7 +6763,7 @@ void LLAgent::makeNewOutfit( new_name = new_folder_name; new_name.append(" "); new_name.append(old_wearable->getTypeLabel()); - LLString::truncate(new_name, DB_INV_ITEM_NAME_STR_LEN); + LLStringUtil::truncate(new_name, DB_INV_ITEM_NAME_STR_LEN); new_wearable->setName(new_name); } @@ -7470,7 +7464,7 @@ void LLAgent::observeFriends() } } -void LLAgent::parseTeleportMessages(const LLString& xml_filename) +void LLAgent::parseTeleportMessages(const std::string& xml_filename) { LLXMLNodePtr root; BOOL success = LLUICtrlFactory::getLayeredXMLNode(xml_filename, root); @@ -7488,8 +7482,8 @@ void LLAgent::parseTeleportMessages(const LLString& xml_filename) { if ( !message_set->hasName("message_set") ) continue; - std::map<LLString, LLString> *teleport_msg_map = NULL; - LLString message_set_name; + std::map<std::string, std::string> *teleport_msg_map = NULL; + std::string message_set_name; if ( message_set->getAttributeString("name", message_set_name) ) { @@ -7507,7 +7501,7 @@ void LLAgent::parseTeleportMessages(const LLString& xml_filename) if ( !teleport_msg_map ) continue; - LLString message_name; + std::string message_name; for (LLXMLNode* message_node = message_set->getFirstChild(); message_node != NULL; message_node = message_node->getNextSibling()) diff --git a/indra/newview/llagent.h b/indra/newview/llagent.h index 281b2d0c88..45006fef8d 100644 --- a/indra/newview/llagent.h +++ b/indra/newview/llagent.h @@ -331,7 +331,7 @@ public: // of the agent in the absolute frame // BOOL getLookingAtAvatar() const; - void getName(LLString& name); + void getName(std::string& name); const LLColor4 &getEffectColor(); void setEffectColor(const LLColor4 &color); @@ -563,8 +563,8 @@ public: ETeleportState getTeleportState() const { return mTeleportState; } void setTeleportState( ETeleportState state ); - const LLString& getTeleportMessage() const { return mTeleportMessage; } - void setTeleportMessage(const LLString& message) + const std::string& getTeleportMessage() const { return mTeleportMessage; } + void setTeleportMessage(const std::string& message) { mTeleportMessage = message; } @@ -694,8 +694,8 @@ public: U64 mGroupPowers; BOOL mHideGroupTitle; - char mGroupTitle[DB_GROUP_TITLE_BUF_SIZE]; /*Flawfinder: ignore*/ // honorific, like "Sir" - char mGroupName[DB_GROUP_NAME_BUF_SIZE]; /*Flawfinder: ignore*/ + std::string mGroupTitle; // honorific, like "Sir" + std::string mGroupName; LLUUID mGroupID; //LLUUID mGroupInsigniaID; LLUUID mInventoryRootID; @@ -719,12 +719,12 @@ public: BOOL mForceMouselook; - static void parseTeleportMessages(const LLString& xml_filename); + static void parseTeleportMessages(const std::string& xml_filename); //we should really define ERROR and PROGRESS enums here //but I don't really feel like doing that, so I am just going //to expose the mappings....yup - static std::map<LLString, LLString> sTeleportErrorMessages; - static std::map<LLString, LLString> sTeleportProgressMessages; + static std::map<std::string, std::string> sTeleportErrorMessages; + static std::map<std::string, std::string> sTeleportProgressMessages; LLFrameTimer mDoubleTapRunTimer; EDoubleTapRunMode mDoubleTapRunMode; @@ -736,7 +736,7 @@ private: // Access or "maturity" level U8 mAccess; // SIM_ACCESS_MATURE or SIM_ACCESS_PG ETeleportState mTeleportState; - LLString mTeleportMessage; + std::string mTeleportMessage; S32 mControlsTakenCount[TOTAL_CONTROLS]; S32 mControlsTakenPassedOnCount[TOTAL_CONTROLS]; diff --git a/indra/newview/llagentpilot.cpp b/indra/newview/llagentpilot.cpp index 136afb78aa..679cd1688e 100644 --- a/indra/newview/llagentpilot.cpp +++ b/indra/newview/llagentpilot.cpp @@ -60,10 +60,13 @@ LLAgentPilot::~LLAgentPilot() { } -void LLAgentPilot::load(const char *filename) +void LLAgentPilot::load(const std::string& filename) { - if(!filename) return; - + if(filename.empty()) + { + return; + } + llifstream file(filename); if (!file) @@ -81,8 +84,7 @@ void LLAgentPilot::load(const char *filename) file >> num_actions; - S32 i; - for (i = 0; i < num_actions; i++) + for (S32 i = 0; i < num_actions; i++) { S32 action_type; Action new_action; @@ -95,10 +97,10 @@ void LLAgentPilot::load(const char *filename) file.close(); } -void LLAgentPilot::save(const char *filename) +void LLAgentPilot::save(const std::string& filename) { llofstream file; - file.open(filename); /*Flawfinder: ignore*/ + file.open(filename); if (!file) { @@ -128,7 +130,7 @@ void LLAgentPilot::startRecord() void LLAgentPilot::stopRecord() { gAgentPilot.addAction(STRAIGHT); - gAgentPilot.save(gSavedSettings.getString("StatsPilotFile").c_str()); + gAgentPilot.save(gSavedSettings.getString("StatsPilotFile")); mRecording = FALSE; } diff --git a/indra/newview/llagentpilot.h b/indra/newview/llagentpilot.h index 3a3140a6e4..55c5351c75 100644 --- a/indra/newview/llagentpilot.h +++ b/indra/newview/llagentpilot.h @@ -51,8 +51,8 @@ public: LLAgentPilot(); virtual ~LLAgentPilot(); - void load(const char *filename); - void save(const char *filename); + void load(const std::string& filename); + void save(const std::string& filename); void startRecord(); void stopRecord(); diff --git a/indra/newview/llanimstatelabels.cpp b/indra/newview/llanimstatelabels.cpp index 380bf7c39c..7877bd7d2f 100644 --- a/indra/newview/llanimstatelabels.cpp +++ b/indra/newview/llanimstatelabels.cpp @@ -33,7 +33,7 @@ #include "llanimstatelabels.h" #include "lltrans.h" -std::string LLAnimStateLabels::getStateLabel( const char *animName ) +std::string LLAnimStateLabels::getStateLabel( const char* animName ) { - return LLTrans::getString("anim_" + LLString(animName) ); + return LLTrans::getString(std::string("anim_") + std::string(animName) ); } diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 8140f00167..0c7a5e23ae 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -216,7 +216,7 @@ const F32 DEFAULT_AFK_TIMEOUT = 5.f * 60.f; // time with no input before user fl F32 gSimLastTime; // Used in LLAppViewer::init and send_stats() F32 gSimFrames; -LLString gDisabledMessage; // Set in LLAppViewer::initConfiguration used in idle_startup +std::string gDisabledMessage; // Set in LLAppViewer::initConfiguration used in idle_startup BOOL gHideLinks = FALSE; // Set in LLAppViewer::initConfiguration, used externally @@ -271,7 +271,7 @@ LLVFS* gStaticVFS = NULL; LLMemoryInfo gSysMemory; U64 gMemoryAllocated = 0; // updated in display_stats() in llviewerdisplay.cpp -LLString gLastVersionChannel; +std::string gLastVersionChannel; LLVector3 gWindVec(3.0, 3.0, 0.0); LLVector3 gRelativeWindVec(0.0, 0.0, 0.0); @@ -289,22 +289,22 @@ BOOL gLogoutInProgress = FALSE; //////////////////////////////////////////////////////////// // Internal globals... that should be removed. -static LLString gArgs; +static std::string gArgs; -const char* MARKER_FILE_NAME = "SecondLife.exec_marker"; -const char* ERROR_MARKER_FILE_NAME = "SecondLife.error_marker"; -const char* LLERROR_MARKER_FILE_NAME = "SecondLife.llerror_marker"; -const char* LOGOUT_MARKER_FILE_NAME = "SecondLife.logout_marker"; +const std::string MARKER_FILE_NAME("SecondLife.exec_marker"); +const std::string ERROR_MARKER_FILE_NAME("SecondLife.error_marker"); +const std::string LLERROR_MARKER_FILE_NAME("SecondLife.llerror_marker"); +const std::string LOGOUT_MARKER_FILE_NAME("SecondLife.logout_marker"); static BOOL gDoDisconnect = FALSE; -static LLString gLaunchFileOnQuit; +static std::string gLaunchFileOnQuit; //---------------------------------------------------------------------------- // File scope definitons const char *VFS_DATA_FILE_BASE = "data.db2.x."; const char *VFS_INDEX_FILE_BASE = "index.db2.x."; -static LLString gSecondLife; -static LLString gWindowTitle; +static std::string gSecondLife; +static std::string gWindowTitle; #ifdef LL_WINDOWS static char sWindowClass[] = "Second Life"; #endif @@ -527,7 +527,7 @@ void LLAppViewer::initGridChoice() server = llclamp(server, 0, (S32)GRID_INFO_COUNT - 1); if(server == GRID_INFO_OTHER) { - LLString custom_server = gSavedSettings.getString("CustomServer"); + std::string custom_server = gSavedSettings.getString("CustomServer"); LLViewerLogin::getInstance()->setGridChoice(custom_server); } else if(server != 0) @@ -659,7 +659,7 @@ bool LLAppViewer::init() // Get the single value from the crash settings file, if it exists std::string crash_settings_filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, CRASH_SETTINGS_FILE); - gCrashSettings.loadFromFile(crash_settings_filename.c_str()); + gCrashSettings.loadFromFile(crash_settings_filename); ///////////////////////////////////////////////// // OS-specific login dialogs @@ -697,14 +697,14 @@ bool LLAppViewer::init() } // Load art UUID information, don't require these strings to be declared in code. - LLString colors_base_filename = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "colors_base.xml"); + std::string colors_base_filename = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "colors_base.xml"); LL_DEBUGS("InitInfo") << "Loading base colors from " << colors_base_filename << LL_ENDL; - gColors.loadFromFileLegacy(colors_base_filename.c_str(), FALSE, TYPE_COL4U); + gColors.loadFromFileLegacy(colors_base_filename, FALSE, TYPE_COL4U); // Load overrides from user colors file - LLString user_colors_filename = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "colors.xml"); + std::string user_colors_filename = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "colors.xml"); LL_DEBUGS("InitInfo") << "Loading user colors from " << user_colors_filename << LL_ENDL; - if (gColors.loadFromFileLegacy(user_colors_filename.c_str(), FALSE, TYPE_COL4U) == 0) + if (gColors.loadFromFileLegacy(user_colors_filename, FALSE, TYPE_COL4U) == 0) { LL_DEBUGS("InitInfo") << "Cannot load user colors from " << user_colors_filename << LL_ENDL; } @@ -731,7 +731,7 @@ bool LLAppViewer::init() LLViewerJointMesh::updateVectorize(); // load MIME type -> media impl mappings - LLMIMETypes::parseMIMETypes( "mime_types.xml" ); + LLMIMETypes::parseMIMETypes( std::string("mime_types.xml") ); // Copy settings to globals. *TODO: Remove or move to appropriage class initializers @@ -778,8 +778,8 @@ bool LLAppViewer::init() "If it continues to persist, you may need to completely uninstall " << gSecondLife << " and reinstall it."; OSMessageBox( - msg.str().c_str(), - NULL, + msg.str(), + LLStringUtil::null, OSMB_OK); return 1; } @@ -803,12 +803,12 @@ bool LLAppViewer::init() bind_keyboard_functions(); // Load Default bindings - if (!gViewerKeyboard.loadBindings(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS,"keys.ini").c_str())) + if (!gViewerKeyboard.loadBindings(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS,"keys.ini"))) { LL_ERRS("InitInfo") << "Unable to open keys.ini" << LL_ENDL; } // Load Custom bindings (override defaults) - gViewerKeyboard.loadBindings(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS,"custom_keys.ini").c_str()); + gViewerKeyboard.loadBindings(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS,"custom_keys.ini")); // If we don't have the right GL requirements, exit. if (!gGLManager.mHasRequirements && !gNoRender) @@ -816,16 +816,16 @@ bool LLAppViewer::init() // can't use an alert here since we're existing and // all hell breaks lose. OSMessageBox( - LLAlertDialog::getTemplateMessage("UnsupportedGLRequirements").c_str(), - NULL, + LLAlertDialog::getTemplateMessage("UnsupportedGLRequirements"), + LLStringUtil::null, OSMB_OK); return 0; } bool unsupported = false; - LLString::format_map_t args; - LLString minSpecs; + LLStringUtil::format_map_t args; + std::string minSpecs; // get cpu data from xml std::stringstream minCPUString(LLAlertDialog::getTemplateMessage("UnsupportedCPUAmount")); @@ -1300,7 +1300,7 @@ bool LLAppViewer::cleanup() std::string crash_settings_filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, CRASH_SETTINGS_FILE); // save all settings, even if equals defaults - gCrashSettings.saveToFile(crash_settings_filename.c_str(), FALSE); + gCrashSettings.saveToFile(crash_settings_filename, FALSE); gSavedSettings.cleanup(); gColors.cleanup(); @@ -1315,9 +1315,8 @@ bool LLAppViewer::cleanup() if (mPurgeOnExit) { llinfos << "Purging all cache files on exit" << llendflush; - char mask[LL_MAX_PATH]; /* Flawfinder: ignore */ - snprintf(mask, LL_MAX_PATH, "%s*.*", gDirUtilp->getDirDelimiter().c_str()); /* Flawfinder: ignore */ - gDirUtilp->deleteFilesInDir(gDirUtilp->getExpandedFilename(LL_PATH_CACHE,"").c_str(),mask); + std::string mask = gDirUtilp->getDirDelimiter() + "*.*"; + gDirUtilp->deleteFilesInDir(gDirUtilp->getExpandedFilename(LL_PATH_CACHE,""),mask); } removeMarkerFile(); // Any crashes from here on we'll just have to ignore @@ -1438,7 +1437,7 @@ bool LLAppViewer::initThreads() void errorCallback(const std::string &error_string) { #ifndef LL_RELEASE_FOR_DOWNLOAD - OSMessageBox(error_string.c_str(), "Fatal Error", OSMB_OK); + OSMessageBox(error_string, "Fatal Error", OSMB_OK); #endif //Set the ErrorActivated global so we know to create a marker file @@ -1459,12 +1458,12 @@ bool LLAppViewer::initLogging() // Remove the last ".old" log file. std::string old_log_file = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, "SecondLife.old"); - LLFile::remove(old_log_file.c_str()); + LLFile::remove(old_log_file); // Rename current log file to ".old" std::string log_file = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, "SecondLife.log"); - LLFile::rename(log_file.c_str(), old_log_file.c_str()); + LLFile::rename(log_file, old_log_file); // Set the log file to SecondLife.log @@ -1478,10 +1477,10 @@ void LLAppViewer::loadSettingsFromDirectory(ELLPath path_index) { for(LLSD::map_iterator itr = mSettingsFileList.beginMap(); itr != mSettingsFileList.endMap(); ++itr) { - LLString settings_name = (*itr).first; - LLString settings_file = mSettingsFileList[settings_name].asString(); + std::string settings_name = (*itr).first; + std::string settings_file = mSettingsFileList[settings_name].asString(); - LLString full_settings_path = gDirUtilp->getExpandedFilename(path_index, settings_file); + std::string full_settings_path = gDirUtilp->getExpandedFilename(path_index, settings_file); if(settings_name == sGlobalSettingsName && path_index == LL_PATH_USER_SETTINGS) @@ -1820,7 +1819,7 @@ bool LLAppViewer::initConfiguration() } const LLControlVariable* skinfolder = gSavedSettings.getControl("SkinFolder"); - if(skinfolder && LLString::null != skinfolder->getValue().asString()) + if(skinfolder && LLStringUtil::null != skinfolder->getValue().asString()) { gDirUtilp->setSkinFolder(skinfolder->getValue().asString()); } @@ -1871,8 +1870,8 @@ bool LLAppViewer::initConfiguration() std::ostringstream msg; msg << gSecondLife << " requires a processor with AltiVec (G4 or later)."; OSMessageBox( - msg.str().c_str(), - NULL, + msg.str(), + LLStringUtil::null, OSMB_OK); removeMarkerFile(); return false; @@ -1886,14 +1885,14 @@ bool LLAppViewer::initConfiguration() std::ostringstream splash_msg; splash_msg << "Loading " << gSecondLife << "..."; LLSplashScreen::show(); - LLSplashScreen::update(splash_msg.str().c_str()); + LLSplashScreen::update(splash_msg.str()); //LLVolumeMgr::initClass(); LLVolumeMgr* volume_manager = new LLVolumeMgr(); volume_manager->useMutex(); // LLApp and LLMutex magic must be manually enabled LLPrimitive::setVolumeManager(volume_manager); - // Note: this is where we used to initialize LLFeatureManager::getInstance()->. + // Note: this is where we used to initialize gFeatureManagerp. gStartTime = totalTime(); @@ -1903,11 +1902,11 @@ bool LLAppViewer::initConfiguration() #if LL_RELEASE_FOR_DOWNLOAD gWindowTitle = gSecondLife; #elif LL_DEBUG - gWindowTitle = gSecondLife + LLString(" [DEBUG] ") + gArgs; + gWindowTitle = gSecondLife + std::string(" [DEBUG] ") + gArgs; #else - gWindowTitle = gSecondLife + LLString(" ") + gArgs; + gWindowTitle = gSecondLife + std::string(" ") + gArgs; #endif - LLString::truncate(gWindowTitle, 255); + LLStringUtil::truncate(gWindowTitle, 255); //RN: if we received a URL, hand it off to the existing instance // don't call anotherInstanceRunning() when doing URL handoff, as @@ -1948,8 +1947,8 @@ bool LLAppViewer::initConfiguration() "Check your task bar for a minimized copy of the program.\n" "If this message persists, restart your computer.", OSMessageBox( - msg.str().c_str(), - NULL, + msg.str(), + LLStringUtil::null, OSMB_OK); return false; } @@ -1970,9 +1969,9 @@ bool LLAppViewer::initConfiguration() std::string alert; alert = gSecondLife; alert += " Alert"; - S32 choice = OSMessageBox(msg.str().c_str(), - alert.c_str(), - OSMB_YESNO); + S32 choice = OSMessageBox(msg.str(), + alert, + OSMB_YESNO); if (OSBTN_YES == choice) { llinfos << "Sending crash report." << llendl; @@ -2051,10 +2050,10 @@ bool LLAppViewer::initConfiguration() } // need to do this here - need to have initialized global settings first - LLString nextLoginLocation = gSavedSettings.getString( "NextLoginLocation" ); + std::string nextLoginLocation = gSavedSettings.getString( "NextLoginLocation" ); if ( nextLoginLocation.length() ) { - LLURLSimString::setString( nextLoginLocation.c_str() ); + LLURLSimString::setString( nextLoginLocation ); }; gLastRunVersion = gSavedSettings.getString("LastRunVersion"); @@ -2072,14 +2071,9 @@ bool LLAppViewer::initWindow() // Hide the splash screen LLSplashScreen::hide(); - // HACK: Need a non-const char * for stupid window name (propagated deep down) - char window_title_str[256]; /* Flawfinder: ignore */ - strncpy(window_title_str, gWindowTitle.c_str(), sizeof(window_title_str) - 1); /* Flawfinder: ignore */ - window_title_str[sizeof(window_title_str) - 1] = '\0'; - // always start windowed BOOL ignorePixelDepth = gSavedSettings.getBOOL("IgnorePixelDepth"); - gViewerWindow = new LLViewerWindow(window_title_str, "Second Life", + gViewerWindow = new LLViewerWindow(gWindowTitle, "Second Life", gSavedSettings.getS32("WindowX"), gSavedSettings.getS32("WindowY"), gSavedSettings.getS32("WindowWidth"), gSavedSettings.getS32("WindowHeight"), FALSE, ignorePixelDepth); @@ -2143,7 +2137,7 @@ void LLAppViewer::closeDebug() { std::string debug_filename = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,"debug_info.log"); llinfos << "Opening debug file " << debug_filename << llendl; - std::ofstream out_file(debug_filename.c_str()); + llofstream out_file(debug_filename); LLSDSerialize::toPrettyXML(gDebugInfo, out_file); out_file.close(); } @@ -2202,11 +2196,10 @@ void LLAppViewer::cleanupSavedSettings() } } -void LLAppViewer::removeCacheFiles(const char* file_mask) +void LLAppViewer::removeCacheFiles(const std::string& file_mask) { - char mask[LL_MAX_PATH]; /* Flawfinder: ignore */ - snprintf(mask, LL_MAX_PATH, "%s%s", gDirUtilp->getDirDelimiter().c_str(), file_mask); /* Flawfinder: ignore */ - gDirUtilp->deleteFilesInDir(gDirUtilp->getExpandedFilename(LL_PATH_CACHE, "").c_str(), mask); + std::string mask = gDirUtilp->getDirDelimiter() + file_mask; + gDirUtilp->deleteFilesInDir(gDirUtilp->getExpandedFilename(LL_PATH_CACHE, ""), mask); } void LLAppViewer::writeSystemInfo() @@ -2306,8 +2299,8 @@ void LLAppViewer::handleViewerCrash() gDebugInfo["SettingsFilename"] = gSavedSettings.getString("ClientSettingsFile"); gDebugInfo["CAFilename"] = gDirUtilp->getCAFile(); - gDebugInfo["ViewerExePath"] = gDirUtilp->getExecutablePathAndName().c_str(); - gDebugInfo["CurrentPath"] = gDirUtilp->getCurPath().c_str(); + gDebugInfo["ViewerExePath"] = gDirUtilp->getExecutablePathAndName(); + gDebugInfo["CurrentPath"] = gDirUtilp->getCurPath(); if(gLogoutInProgress) { gDebugInfo["LastExecEvent"] = LAST_EXEC_LOGOUT_CRASH; @@ -2334,7 +2327,7 @@ void LLAppViewer::handleViewerCrash() //we're already in a crash situation if (gDirUtilp) { - LLString crash_file_name; + std::string crash_file_name; if(gLLErrorActivated) crash_file_name = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,LLERROR_MARKER_FILE_NAME); else crash_file_name = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,ERROR_MARKER_FILE_NAME); llinfos << "Creating crash marker file " << crash_file_name << llendl; @@ -2354,7 +2347,7 @@ void LLAppViewer::handleViewerCrash() { std::string filename; filename = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, "stats.log"); - llofstream file(filename.c_str(), llofstream::binary); + llofstream file(filename, llofstream::binary); if(file.good()) { llinfos << "Handle viewer crash generating stats log." << llendl; @@ -2443,9 +2436,9 @@ void LLAppViewer::initMarkerFile() // These checks should also remove these files for the last 2 cases if they currently exist //LLError/Error checks. Only one of these should ever happen at a time. - LLString logout_marker_file = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, LOGOUT_MARKER_FILE_NAME); - LLString llerror_marker_file = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, LLERROR_MARKER_FILE_NAME); - LLString error_marker_file = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, ERROR_MARKER_FILE_NAME); + std::string logout_marker_file = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, LOGOUT_MARKER_FILE_NAME); + std::string llerror_marker_file = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, LLERROR_MARKER_FILE_NAME); + std::string error_marker_file = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, ERROR_MARKER_FILE_NAME); apr_file_t* fMarker = ll_apr_file_open(logout_marker_file, LL_APR_RB); if(fMarker != NULL) @@ -2580,11 +2573,11 @@ static void finish_early_exit(S32 option, void* userdata) LLAppViewer::instance()->forceQuit(); } -void LLAppViewer::earlyExit(const LLString& msg) +void LLAppViewer::earlyExit(const std::string& msg) { llwarns << "app_early_exit: " << msg << llendl; gDoDisconnect = TRUE; -// LLStringBase<char>::format_map_t args; +// LLStringUtil::format_map_t args; // args["[MESSAGE]"] = mesg; // gViewerWindow->alertXml("AppEarlyExit", args, finish_early_exit); LLAlertDialog::showCritical(msg, finish_early_exit, NULL); @@ -2626,8 +2619,8 @@ bool LLAppViewer::initCache() } // Setup and verify the cache location - LLString cache_location = gSavedSettings.getString("CacheLocation"); - LLString new_cache_location = gSavedSettings.getString("NewCacheLocation"); + std::string cache_location = gSavedSettings.getString("CacheLocation"); + std::string new_cache_location = gSavedSettings.getString("NewCacheLocation"); if (new_cache_location != cache_location) { gDirUtilp->setCacheDir(gSavedSettings.getString("CacheLocation")); @@ -2681,12 +2674,12 @@ bool LLAppViewer::initCache() srand(time(NULL)); // Flawfinder: ignore U32 old_salt = gSavedSettings.getU32("VFSSalt"); U32 new_salt; - char old_vfs_data_file[LL_MAX_PATH]; // Flawfinder: ignore - char old_vfs_index_file[LL_MAX_PATH]; // Flawfinder: ignore - char new_vfs_data_file[LL_MAX_PATH]; // Flawfinder: ignore - char new_vfs_index_file[LL_MAX_PATH]; // Flawfinder: ignore - char static_vfs_index_file[LL_MAX_PATH]; // Flawfinder: ignore - char static_vfs_data_file[LL_MAX_PATH]; // Flawfinder: ignore + std::string old_vfs_data_file; + std::string old_vfs_index_file; + std::string new_vfs_data_file; + std::string new_vfs_index_file; + std::string static_vfs_index_file; + std::string static_vfs_data_file; if (gSavedSettings.getBOOL("AllowMultipleViewers")) { @@ -2701,9 +2694,7 @@ bool LLAppViewer::initCache() } while( new_salt == old_salt ); } - snprintf(old_vfs_data_file, LL_MAX_PATH, "%s%u", // Flawfinder: ignore - gDirUtilp->getExpandedFilename(LL_PATH_CACHE,VFS_DATA_FILE_BASE).c_str(), - old_salt); + old_vfs_data_file = gDirUtilp->getExpandedFilename(LL_PATH_CACHE,VFS_DATA_FILE_BASE) + llformat("%u",old_salt); // make sure this file exists llstat s; @@ -2722,29 +2713,18 @@ bool LLAppViewer::initCache() std::string found_file; if (gDirUtilp->getNextFileInDir(dir, mask, found_file, false)) { - snprintf(old_vfs_data_file, LL_MAX_PATH, "%s%s%s", dir.c_str(), gDirUtilp->getDirDelimiter().c_str(), found_file.c_str()); // Flawfinder: ignore + old_vfs_data_file = dir + gDirUtilp->getDirDelimiter() + found_file; - S32 start_pos; - S32 length = strlen(found_file.c_str()); /* Flawfinder: ignore*/ - for (start_pos = length - 1; start_pos >= 0; start_pos--) - { - if (found_file[start_pos] == '.') - { - start_pos++; - break; - } - } + S32 start_pos = found_file.find_last_of('.'); if (start_pos > 0) { - sscanf(found_file.c_str() + start_pos, "%d", &old_salt); + sscanf(found_file.substr(start_pos+1).c_str(), "%d", &old_salt); } LL_DEBUGS("AppCache") << "Default vfs data file not present, found: " << old_vfs_data_file << " Old salt: " << old_salt << llendl; } } - snprintf(old_vfs_index_file, LL_MAX_PATH, "%s%u", // Flawfinder: ignore - gDirUtilp->getExpandedFilename(LL_PATH_CACHE,VFS_INDEX_FILE_BASE).c_str(), - old_salt); + old_vfs_index_file = gDirUtilp->getExpandedFilename(LL_PATH_CACHE,VFS_INDEX_FILE_BASE) + llformat("%u",old_salt); stat_result = LLFile::stat(old_vfs_index_file, &s); if (stat_result) @@ -2773,18 +2753,11 @@ bool LLAppViewer::initCache() gDirUtilp->deleteFilesInDir(dir, mask); } - snprintf(new_vfs_data_file, LL_MAX_PATH, "%s%u", // Flawfinder: ignore - gDirUtilp->getExpandedFilename(LL_PATH_CACHE,VFS_DATA_FILE_BASE).c_str(), - new_salt); - - snprintf(new_vfs_index_file, LL_MAX_PATH, "%s%u", gDirUtilp->getExpandedFilename(LL_PATH_CACHE, VFS_INDEX_FILE_BASE).c_str(), // Flawfinder: ignore - new_salt); - + new_vfs_data_file = gDirUtilp->getExpandedFilename(LL_PATH_CACHE,VFS_DATA_FILE_BASE) + llformat("%u",new_salt); + new_vfs_index_file = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, VFS_INDEX_FILE_BASE) + llformat("%u",new_salt); - strncpy(static_vfs_data_file, gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS,"static_data.db2").c_str(), LL_MAX_PATH -1); // Flawfinder: ignore - static_vfs_data_file[LL_MAX_PATH -1] = '\0'; - strncpy(static_vfs_index_file, gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS,"static_index.db2").c_str(), LL_MAX_PATH -1); // Flawfinder: ignore - static_vfs_index_file[LL_MAX_PATH -1] = '\0'; + static_vfs_data_file = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS,"static_data.db2"); + static_vfs_index_file = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS,"static_index.db2"); if (resize_vfs) { @@ -2835,15 +2808,15 @@ void LLAppViewer::purgeCache() LL_INFOS("AppCache") << "Purging Cache and Texture Cache..." << llendl; LLAppViewer::getTextureCache()->purgeCache(LL_PATH_CACHE); std::string mask = gDirUtilp->getDirDelimiter() + "*.*"; - gDirUtilp->deleteFilesInDir(gDirUtilp->getExpandedFilename(LL_PATH_CACHE,"").c_str(),mask); + gDirUtilp->deleteFilesInDir(gDirUtilp->getExpandedFilename(LL_PATH_CACHE,""),mask); } -const LLString& LLAppViewer::getSecondLifeTitle() const +const std::string& LLAppViewer::getSecondLifeTitle() const { return gSecondLife; } -const LLString& LLAppViewer::getWindowTitle() const +const std::string& LLAppViewer::getWindowTitle() const { return gWindowTitle; } @@ -2864,7 +2837,7 @@ void finish_forced_disconnect(S32 /* option */, void* /* userdata */) } -void LLAppViewer::forceDisconnect(const LLString& mesg) +void LLAppViewer::forceDisconnect(const std::string& mesg) { if (gDoDisconnect) { @@ -2874,13 +2847,13 @@ void LLAppViewer::forceDisconnect(const LLString& mesg) } // Translate the message if possible - LLString big_reason = LLAgent::sTeleportErrorMessages[mesg]; + std::string big_reason = LLAgent::sTeleportErrorMessages[mesg]; if ( big_reason.size() == 0 ) { big_reason = mesg; } - LLStringBase<char>::format_map_t args; + LLStringUtil::format_map_t args; gDoDisconnect = TRUE; if (LLStartUp::getStartupState() < STATE_STARTED) @@ -2941,7 +2914,7 @@ void LLAppViewer::saveFinalSnapshot() gSavedSettings.setBOOL("ShowParcelOwners", FALSE); idle(); - LLString snap_filename = gDirUtilp->getLindenUserDir(); + std::string snap_filename = gDirUtilp->getLindenUserDir(); snap_filename += gDirUtilp->getDirDelimiter(); snap_filename += SCREEN_LAST_FILENAME; // use full pixel dimensions of viewer window (not post-scale dimensions) @@ -2956,7 +2929,7 @@ void LLAppViewer::loadNameCache() std::string name_cache; name_cache = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, "name.cache"); - llifstream cache_file(name_cache.c_str()); + llifstream cache_file(name_cache); if(cache_file.is_open()) { if(gCacheName->importFile(cache_file)) return; @@ -2964,7 +2937,7 @@ void LLAppViewer::loadNameCache() // Try to load from the legacy format. This should go away after a // while. Phoenix 2008-01-30 - LLFILE* name_cache_fp = LLFile::fopen(name_cache.c_str(), "r"); // Flawfinder: ignore + LLFILE* name_cache_fp = LLFile::fopen(name_cache, "r"); // Flawfinder: ignore if (name_cache_fp) { gCacheName->importFile(name_cache_fp); @@ -2978,7 +2951,7 @@ void LLAppViewer::saveNameCache() std::string name_cache; name_cache = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, "name.cache"); - llofstream cache_file(name_cache.c_str()); + llofstream cache_file(name_cache); if(cache_file.is_open()) { gCacheName->exportFile(cache_file); @@ -3421,9 +3394,7 @@ void LLAppViewer::idleShutdown() S32 finished_uploads = total_uploads - pending_uploads; F32 percent = 100.f * finished_uploads / total_uploads; gViewerWindow->setProgressPercent(percent); - char buffer[MAX_STRING]; // Flawfinder: ignore - snprintf(buffer, MAX_STRING, "Saving final data..."); // Flawfinder: ignore - gViewerWindow->setProgressString(buffer); + gViewerWindow->setProgressString("Saving final data..."); return; } diff --git a/indra/newview/llappviewer.h b/indra/newview/llappviewer.h index 8ef22deb27..228f6e4baf 100644 --- a/indra/newview/llappviewer.h +++ b/indra/newview/llappviewer.h @@ -63,7 +63,7 @@ public: void forceQuit(); // Puts the viewer into 'shutting down without error' mode. void requestQuit(); // Request a quit. A kinder, gentler quit. void userQuit(); // The users asks to quit. Confirm, then requestQuit() - void earlyExit(const LLString& msg); // Display an error dialog and forcibly quit. + void earlyExit(const std::string& msg); // Display an error dialog and forcibly quit. void forceExit(S32 arg); // exit() immediately (after some cleanup). void abortQuit(); // Called to abort a quit request. @@ -91,10 +91,10 @@ public: bool getPurgeCache() const { return mPurgeCache; } - const LLString& getSecondLifeTitle() const; // The Second Life title. - const LLString& getWindowTitle() const; // The window display name. + const std::string& getSecondLifeTitle() const; // The Second Life title. + const std::string& getWindowTitle() const; // The window display name. - void forceDisconnect(const LLString& msg); // Force disconnection, with a message to the user. + void forceDisconnect(const std::string& msg); // Force disconnection, with a message to the user. void badNetworkHandler(); // Cause a crash state due to bad network packet. bool hasSavedFinalSnapshot() { return mSavedFinalSnapshot; } @@ -157,7 +157,7 @@ private: void purgeCache(); // Clear the local cache. void cleanupSavedSettings(); // Sets some config data to current or default values during cleanup. - void removeCacheFiles(const char *filemask); // Deletes cached files the match the given wildcard. + void removeCacheFiles(const std::string& filemask); // Deletes cached files the match the given wildcard. void writeSystemInfo(); // Write system info to "debug_info.log" @@ -177,10 +177,10 @@ private: bool mSecondInstance; // Is this a second instance of the app? - LLString mMarkerFileName; + std::string mMarkerFileName; apr_file_t* mMarkerFile; // A file created to indicate the app is running. - LLString mLogoutMarkerFileName; + std::string mLogoutMarkerFileName; apr_file_t* mLogoutMarkerFile; // A file created to indicate the app is running. @@ -217,7 +217,7 @@ const S32 AGENT_UPDATES_PER_SECOND = 10; // "// llstartup" indicates that llstartup is the only client for this global. extern BOOL gHandleKeysAsync; // gSavedSettings used by llviewerdisplay.cpp & llviewermenu.cpp -extern LLString gDisabledMessage; // llstartup +extern std::string gDisabledMessage; // llstartup extern BOOL gHideLinks; // used by llpanellogin, lllfloaterbuycurrency, llstartup extern LLSD gDebugInfo; @@ -287,7 +287,7 @@ extern LLVFS *gStaticVFS; extern LLMemoryInfo gSysMemory; extern U64 gMemoryAllocated; -extern LLString gLastVersionChannel; +extern std::string gLastVersionChannel; extern LLVector3 gWindVec; extern LLVector3 gRelativeWindVec; diff --git a/indra/newview/llappviewerlinux.cpp b/indra/newview/llappviewerlinux.cpp index 0a2cb43c80..980ccd81fd 100644 --- a/indra/newview/llappviewerlinux.cpp +++ b/indra/newview/llappviewerlinux.cpp @@ -131,7 +131,7 @@ static inline BOOL do_basic_glibc_backtrace() std::string strace_filename = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,"stack_trace.log"); llinfos << "Opening stack trace file " << strace_filename << llendl; - LLFILE* StraceFile = LLFile::fopen(strace_filename.c_str(), "w"); + LLFILE* StraceFile = LLFile::fopen(strace_filename, "w"); if (!StraceFile) { llinfos << "Opening stack trace file " << strace_filename << " failed. Using stderr." << llendl; @@ -162,7 +162,7 @@ static inline BOOL do_basic_glibc_backtrace() std::string strace_filename = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,"stack_trace.log"); llinfos << "Opening stack trace file " << strace_filename << llendl; - LLFILE* StraceFile = LLFile::fopen(strace_filename.c_str(), "w"); // Flawfinder: ignore + LLFILE* StraceFile = LLFile::fopen(strace_filename, "w"); // Flawfinder: ignore if (!StraceFile) { llinfos << "Opening stack trace file " << strace_filename << " failed. Using stderr." << llendl; @@ -200,7 +200,7 @@ static inline BOOL do_elfio_glibc_backtrace() std::string strace_filename = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,"stack_trace.log"); llinfos << "Opening stack trace file " << strace_filename << llendl; - LLFILE* StraceFile = LLFile::fopen(strace_filename.c_str(), "w"); // Flawfinder: ignore + LLFILE* StraceFile = LLFile::fopen(strace_filename, "w"); // Flawfinder: ignore if (!StraceFile) { llinfos << "Opening stack trace file " << strace_filename << " failed. Using stderr." << llendl; @@ -429,7 +429,7 @@ bool LLAppViewerLinux::initLogging() // Remove the last stack trace, if any std::string old_stack_file = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,"stack_trace.log"); - LLFile::remove(old_stack_file.c_str()); + LLFile::remove(old_stack_file); return LLAppViewer::initLogging(); } diff --git a/indra/newview/llappviewermacosx.cpp b/indra/newview/llappviewermacosx.cpp index c1e6888478..a6d93e5652 100644 --- a/indra/newview/llappviewermacosx.cpp +++ b/indra/newview/llappviewermacosx.cpp @@ -178,7 +178,7 @@ bool LLAppViewerMacOSX::initParseCommandLine(LLCommandLineParser& clp) char path[MAX_PATH]; if(CFURLGetFileSystemRepresentation(url, false, (UInt8 *)path, sizeof(path))) { - LLString lang; + std::string lang; if(_read_file_into_string(lang, path)) /* Flawfinder: ignore*/ { LLControlVariable* c = gSavedSettings.getControl("SystemLanguage"); @@ -201,7 +201,7 @@ void LLAppViewerMacOSX::handleSyncCrashTrace() void LLAppViewerMacOSX::handleCrashReporting() { // Macintosh - LLString command_str; + std::string command_str; command_str += "open crashreporter.app"; clear_signals(); @@ -331,7 +331,7 @@ OSStatus DisplayReleaseNotes(void) id.signature = 'text'; id.id = 0; - LLString releaseNotesText; + std::string releaseNotesText; _read_file_into_string(releaseNotesText, "releasenotes.txt"); // Flawfinder: ignore diff --git a/indra/newview/llappviewerwin32.cpp b/indra/newview/llappviewerwin32.cpp index e2663f05bd..b88bcb758b 100644 --- a/indra/newview/llappviewerwin32.cpp +++ b/indra/newview/llappviewerwin32.cpp @@ -298,7 +298,7 @@ void LLAppViewerWin32::initConsole() void write_debug_dx(const char* str) { - LLString value = gDebugInfo["DXInfo"].asString(); + std::string value = gDebugInfo["DXInfo"].asString(); value += str; gDebugInfo["DXInfo"] = value; } @@ -347,7 +347,7 @@ bool LLAppViewerWin32::initHardwareTest() "\n" "Do you wish to continue?\n"; S32 button = OSMessageBox( - msg.str().c_str(), + msg.str(), "Warning", OSMB_YESNO); if (OSBTN_NO== button) @@ -367,7 +367,7 @@ bool LLAppViewerWin32::initHardwareTest() std::ostringstream splash_msg; splash_msg << "Loading " << LLAppViewer::instance()->getSecondLifeTitle() << "..."; - LLSplashScreen::update(splash_msg.str().c_str()); + LLSplashScreen::update(splash_msg.str()); } if (!LLWinDebug::checkExceptionHandler()) diff --git a/indra/newview/llassetuploadresponders.cpp b/indra/newview/llassetuploadresponders.cpp index 3d2ae03d63..3d91384f48 100644 --- a/indra/newview/llassetuploadresponders.cpp +++ b/indra/newview/llassetuploadresponders.cpp @@ -86,7 +86,7 @@ LLAssetUploadResponder::~LLAssetUploadResponder() if (!mFileName.empty()) { // Delete temp file - LLFile::remove(mFileName.c_str()); + LLFile::remove(mFileName); } } @@ -95,7 +95,7 @@ void LLAssetUploadResponder::error(U32 statusNum, const std::string& reason) { llinfos << "LLAssetUploadResponder::error " << statusNum << " reason: " << reason << llendl; - LLStringBase<char>::format_map_t args; + LLStringUtil::format_map_t args; switch(statusNum) { case 400: @@ -164,7 +164,7 @@ void LLAssetUploadResponder::uploadFailure(const LLSD& content) } else { - LLStringBase<char>::format_map_t args; + LLStringUtil::format_map_t args; args["[FILE]"] = (mFileName.empty() ? mVFileID.asString() : mFileName); args["[REASON]"] = content["message"].asString(); gViewerWindow->alertXml("CannotUploadReason", args); @@ -192,8 +192,8 @@ void LLNewAgentInventoryResponder::uploadComplete(const LLSD& content) { lldebugs << "LLNewAgentInventoryResponder::result from capabilities" << llendl; - LLAssetType::EType asset_type = LLAssetType::lookup(mPostData["asset_type"].asString().c_str()); - LLInventoryType::EType inventory_type = LLInventoryType::lookup(mPostData["inventory_type"].asString().c_str()); + LLAssetType::EType asset_type = LLAssetType::lookup(mPostData["asset_type"].asString()); + LLInventoryType::EType inventory_type = LLInventoryType::lookup(mPostData["inventory_type"].asString()); // Update L$ and ownership credit information // since it probably changed on the server @@ -209,7 +209,7 @@ void LLNewAgentInventoryResponder::uploadComplete(const LLSD& content) gMessageSystem->addUUIDFast(_PREHASH_TransactionID, LLUUID::null ); gAgent.sendReliableMessage(); - LLString::format_map_t args; + LLStringUtil::format_map_t args; args["[AMOUNT]"] = llformat("%d",LLGlobalEconomy::Singleton::getInstance()->getPriceUpload()); LLNotifyBox::showXml("UploadPayment", args); } @@ -276,27 +276,16 @@ void LLNewAgentInventoryResponder::uploadComplete(const LLSD& content) // *FIX: This is a pretty big hack. What this does is check the // file picker if there are any more pending uploads. If so, // upload that file. - const char* next_file = LLFilePicker::instance().getNextFile(); - if(next_file) + std::string next_file = LLFilePicker::instance().getNextFile(); + if(!next_file.empty()) { - const char* name = LLFilePicker::instance().getDirname(); + std::string name = gDirUtilp->getBaseFileName(next_file, true); - LLString asset_name = name; - LLString::replaceNonstandardASCII( asset_name, '?' ); - LLString::replaceChar(asset_name, '|', '?'); - LLString::stripNonprintable(asset_name); - LLString::trim(asset_name); - - char* asset_name_str = (char*)asset_name.c_str(); - char* end_p = strrchr(asset_name_str, '.'); // strip extension if exists - if( !end_p ) - { - end_p = asset_name_str + strlen( asset_name_str ); /*Flawfinder: ignore*/ - } - - S32 len = llmin( (S32) (DB_INV_ITEM_NAME_STR_LEN), (S32) (end_p - asset_name_str) ); - - asset_name = asset_name.substr( 0, len ); + std::string asset_name = name; + LLStringUtil::replaceNonstandardASCII( asset_name, '?' ); + LLStringUtil::replaceChar(asset_name, '|', '?'); + LLStringUtil::stripNonprintable(asset_name); + LLStringUtil::trim(asset_name); upload_new_resource(next_file, asset_name, asset_name, 0, LLAssetType::AT_NONE, LLInventoryType::IT_NONE); diff --git a/indra/newview/llcallingcard.cpp b/indra/newview/llcallingcard.cpp index 11d4f4c651..1fdefbac49 100644 --- a/indra/newview/llcallingcard.cpp +++ b/indra/newview/llcallingcard.cpp @@ -78,7 +78,7 @@ public: public: LLUUID mAvatarID; - LLString mName; + std::string mName; LLVector3d mGlobalPositionEstimate; bool mHaveInfo; bool mHaveCoarseInfo; @@ -240,7 +240,7 @@ void LLAvatarTracker::getDegreesAndDist(F32& rot, rot = F32(RAD_TO_DEG * atan2(to_vec.mdV[VY], to_vec.mdV[VX])); } -const LLString& LLAvatarTracker::getName() +const std::string& LLAvatarTracker::getName() { if(mTrackingData) { @@ -248,7 +248,7 @@ const LLString& LLAvatarTracker::getName() } else { - return LLString::null; + return LLStringUtil::null; } } @@ -592,7 +592,7 @@ void LLAvatarTracker::processChange(LLMessageSystem* msg) if((mBuddyInfo[agent_id]->getRightsGrantedFrom() ^ new_rights) & LLRelationship::GRANT_MODIFY_OBJECTS) { std::string first, last; - LLStringBase<char>::format_map_t args; + LLStringUtil::format_map_t args; if(gCacheName->getName(agent_id, first, last)) { args["[FIRST_NAME]"] = first; @@ -638,7 +638,7 @@ void LLAvatarTracker::processNotify(LLMessageSystem* msg, bool online) tracking_id = mTrackingData->mAvatarID; } BOOL notify = FALSE; - LLString::format_map_t args; + LLStringUtil::format_map_t args; for(S32 i = 0; i < count; ++i) { msg->getUUIDFast(_PREHASH_AgentBlock, _PREHASH_AgentID, agent_id, i); diff --git a/indra/newview/llcallingcard.h b/indra/newview/llcallingcard.h index c00fe5295d..763ef00b8a 100644 --- a/indra/newview/llcallingcard.h +++ b/indra/newview/llcallingcard.h @@ -101,7 +101,7 @@ public: LLVector3d getGlobalPos(); // Get the name passed in, returns null string if uninitialized. - const LLString& getName(); + const std::string& getName(); // Get the avatar being tracked, returns LLUUID::null if uninitialized const LLUUID& getAvatarID(); diff --git a/indra/newview/llcaphttpsender.cpp b/indra/newview/llcaphttpsender.cpp index f34711a5c6..3065da4c7b 100644 --- a/indra/newview/llcaphttpsender.cpp +++ b/indra/newview/llcaphttpsender.cpp @@ -40,7 +40,7 @@ LLCapHTTPSender::LLCapHTTPSender(const std::string& cap) : } //virtual -void LLCapHTTPSender::send(const LLHost& host, const char* message, +void LLCapHTTPSender::send(const LLHost& host, const std::string& message, const LLSD& body, LLHTTPClient::ResponderPtr response) const { diff --git a/indra/newview/llcaphttpsender.h b/indra/newview/llcaphttpsender.h index 222aa773cc..2296281241 100644 --- a/indra/newview/llcaphttpsender.h +++ b/indra/newview/llcaphttpsender.h @@ -43,7 +43,7 @@ public: /** @brief Send message via UntrustedMessage capability 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; private: diff --git a/indra/newview/llchatbar.cpp b/indra/newview/llchatbar.cpp index e2ab30f1cb..fac934a3bb 100644 --- a/indra/newview/llchatbar.cpp +++ b/indra/newview/llchatbar.cpp @@ -96,7 +96,7 @@ private: // LLChatBar::LLChatBar() -: LLPanel("", LLRect(), BORDER_NO), +: LLPanel(LLStringUtil::null, LLRect(), BORDER_NO), mInputEditor(NULL), mGestureLabelTimer(), mLastSpecialChatChannel(0), @@ -220,9 +220,9 @@ void LLChatBar::refreshGestures() if (mGestureCombo && gestures) { //store current selection so we can maintain it - LLString cur_gesture = mGestureCombo->getValue().asString(); + std::string cur_gesture = mGestureCombo->getValue().asString(); gestures->selectFirstItem(); - LLString label = mGestureCombo->getValue().asString();; + std::string label = mGestureCombo->getValue().asString();; // clear gestures->clearRows(); @@ -241,14 +241,14 @@ void LLChatBar::refreshGestures() } } - // ad unique gestures + // add unique gestures std::map <std::string, BOOL>::iterator it2; for (it2 = unique.begin(); it2 != unique.end(); ++it2) { gestures->addSimpleElement((*it2).first); } - gestures->sortByColumn(0, TRUE); + gestures->sortByColumn(LLStringUtil::null, TRUE); // Insert label after sorting gestures->addSimpleElement(label, ADD_TOP); @@ -299,9 +299,9 @@ BOOL LLChatBar::inputEditorHasFocus() return mInputEditor && mInputEditor->hasFocus(); } -LLString LLChatBar::getCurrentChat() +std::string LLChatBar::getCurrentChat() { - return mInputEditor ? mInputEditor->getText() : LLString::null; + return mInputEditor ? mInputEditor->getText() : LLStringUtil::null; } void LLChatBar::setGestureCombo(LLComboBox* combo) @@ -344,12 +344,12 @@ LLWString LLChatBar::stripChannelNumber(const LLWString &mesg, S32* channel) S32 pos = 0; // Copy the channel number into a string - llwchar channel_string[64]; + LLWString channel_string; llwchar c; do { c = mesg[pos+1]; - channel_string[pos] = c; + channel_string.push_back(c); pos++; } while(c && pos < 64 && LLStringOps::isDigit(c)); @@ -362,7 +362,6 @@ LLWString LLChatBar::stripChannelNumber(const LLWString &mesg, S32* channel) c = mesg[pos+1]; pos++; } - mLastSpecialChatChannel = strtol(wstring_to_utf8str(channel_string).c_str(), NULL, 10); *channel = mLastSpecialChatChannel; @@ -381,8 +380,8 @@ void LLChatBar::sendChat( EChatType type ) { LLWString text; if (mInputEditor) text = mInputEditor->getWText(); - LLWString::trim(text); - LLWString::replaceChar(text,182,'\n'); // Convert paragraph symbols back into newlines. + LLWStringUtil::trim(text); + LLWStringUtil::replaceChar(text,182,'\n'); // Convert paragraph symbols back into newlines. if (!text.empty()) { @@ -413,7 +412,7 @@ void LLChatBar::sendChat( EChatType type ) sendChatFromViewer(utf8_revised_text, type, TRUE); } } - childSetValue("Chat Editor", LLString::null); + childSetValue("Chat Editor", LLStringUtil::null); gAgent.stopTyping(); @@ -478,7 +477,7 @@ void LLChatBar::onInputEditorKeystroke( LLLineEditor* caller, void* userdata ) // Can't trim the end, because that will cause autocompletion // to eat trailing spaces that might be part of a gesture. - LLWString::trimHead(raw_text); + LLWStringUtil::trimHead(raw_text); S32 length = raw_text.length(); @@ -499,7 +498,7 @@ void LLChatBar::onInputEditorKeystroke( LLLineEditor* caller, void* userdata ) { // the selection will already be deleted, but we need to trim // off the character before - LLString new_text = raw_text.substr(0, length-1); + std::string new_text = raw_text.substr(0, length-1); self->mInputEditor->setText( new_text ); self->mInputEditor->setCursorToEnd(); length = length - 1; diff --git a/indra/newview/llchatbar.h b/indra/newview/llchatbar.h index c5cb741453..912cadbf7d 100644 --- a/indra/newview/llchatbar.h +++ b/indra/newview/llchatbar.h @@ -65,7 +65,7 @@ public: void setIgnoreArrowKeys(BOOL b); BOOL inputEditorHasFocus(); - LLString getCurrentChat(); + std::string getCurrentChat(); // since chat bar logic is reused for chat history // gesture combo box might not be a direct child diff --git a/indra/newview/llcolorswatch.cpp b/indra/newview/llcolorswatch.cpp index e4256b40f5..b8166a98f6 100644 --- a/indra/newview/llcolorswatch.cpp +++ b/indra/newview/llcolorswatch.cpp @@ -73,7 +73,7 @@ LLColorSwatchCtrl::LLColorSwatchCtrl(const std::string& name, const LLRect& rect // Scalable UI made this off-by-one, I don't know why. JC LLRect border_rect(0, getRect().getHeight()-1, getRect().getWidth()-1, 0); border_rect.mBottom += BTN_HEIGHT_SMALL; - mBorder = new LLViewBorder("border", border_rect, LLViewBorder::BEVEL_IN); + mBorder = new LLViewBorder(std::string("border"), border_rect, LLViewBorder::BEVEL_IN); addChild(mBorder); mAlphaGradientImage = LLUI::getUIImage("color_swatch_alpha.tga"); @@ -100,7 +100,7 @@ LLColorSwatchCtrl::LLColorSwatchCtrl(const std::string& name, const LLRect& rect // Scalable UI made this off-by-one, I don't know why. JC LLRect border_rect(0, getRect().getHeight()-1, getRect().getWidth()-1, 0); border_rect.mBottom += BTN_HEIGHT_SMALL; - mBorder = new LLViewBorder("border", border_rect, LLViewBorder::BEVEL_IN); + mBorder = new LLViewBorder(std::string("border"), border_rect, LLViewBorder::BEVEL_IN); addChild(mBorder); mAlphaGradientImage = LLUI::getUIImage("color_swatch_alpha.tga"); @@ -351,10 +351,10 @@ LLXMLNodePtr LLColorSwatchCtrl::getXML(bool save_children) const LLView* LLColorSwatchCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory) { - LLString name("colorswatch"); + std::string name("colorswatch"); node->getAttributeString("name", name); - LLString label; + std::string label; node->getAttributeString("label", label); LLColor4 color(1.f, 1.f, 1.f, 1.f); diff --git a/indra/newview/llcommandlineparser.cpp b/indra/newview/llcommandlineparser.cpp index f06a8abfe0..f9c8100cf5 100644 --- a/indra/newview/llcommandlineparser.cpp +++ b/indra/newview/llcommandlineparser.cpp @@ -218,20 +218,20 @@ protected: //---------------------------------------------------------------------------- // LLCommandLineParser defintions //---------------------------------------------------------------------------- -void LLCommandLineParser::addOptionDesc(const LLString& option_name, +void LLCommandLineParser::addOptionDesc(const std::string& option_name, boost::function1<void, const token_vector_t&> notify_callback, unsigned int token_count, - const LLString& description, - const LLString& short_name, + const std::string& description, + const std::string& short_name, bool composing, bool positional, bool last_option) { // Compose the name for boost::po. // It takes the format "long_name, short name" - const LLString comma(","); - LLString boost_option_name = option_name; - if(short_name != LLString::null) + const std::string comma(","); + std::string boost_option_name = option_name; + if(short_name != LLStringUtil::null) { boost_option_name += comma; boost_option_name += short_name; @@ -413,7 +413,7 @@ const LLCommandLineParser::token_vector_t& LLCommandLineParser::getOption(const // LLControlGroupCLP defintions //---------------------------------------------------------------------------- void setControlValueCB(const LLCommandLineParser::token_vector_t& value, - const LLString& opt_name, + const std::string& opt_name, LLControlGroup* ctrlGroup) { if(value.size() > 1) @@ -442,7 +442,7 @@ void setControlValueCB(const LLCommandLineParser::token_vector_t& value, { // There's a token. check the string for true/false/1/0 etc. BOOL result = false; - BOOL gotSet = LLString::convertToBOOL(value[0], result); + BOOL gotSet = LLStringUtil::convertToBOOL(value[0], result); if(gotSet) { ctrl->setValue(LLSD(result), false); @@ -489,14 +489,14 @@ void setControlValueCB(const LLCommandLineParser::token_vector_t& value, } } -void LLControlGroupCLP::configure(const LLString& config_filename, LLControlGroup* controlGroup) +void LLControlGroupCLP::configure(const std::string& config_filename, LLControlGroup* controlGroup) { // This method reads the llsd based config file, and uses it to set // members of a control group. LLSD clpConfigLLSD; llifstream input_stream; - input_stream.open(config_filename.c_str(), std::ios::in | std::ios::binary); + input_stream.open(config_filename, std::ios::in | std::ios::binary); if(input_stream.is_open()) { @@ -508,13 +508,13 @@ void LLControlGroupCLP::configure(const LLString& config_filename, LLControlGrou LLSD::String long_name = option_itr->first; LLSD option_params = option_itr->second; - LLString desc("n/a"); + std::string desc("n/a"); if(option_params.has("desc")) { desc = option_params["desc"].asString(); } - LLString short_name = LLString::null; + std::string short_name = LLStringUtil::null; if(option_params.has("short")) { short_name = option_params["short"].asString(); @@ -547,7 +547,7 @@ void LLControlGroupCLP::configure(const LLString& config_filename, LLControlGrou boost::function1<void, const token_vector_t&> callback; if(option_params.has("map-to") && (NULL != controlGroup)) { - LLString controlName = option_params["map-to"].asString(); + std::string controlName = option_params["map-to"].asString(); callback = boost::bind(setControlValueCB, _1, controlName, controlGroup); } diff --git a/indra/newview/llcommandlineparser.h b/indra/newview/llcommandlineparser.h index 6fe418a631..229da81bd1 100644 --- a/indra/newview/llcommandlineparser.h +++ b/indra/newview/llcommandlineparser.h @@ -62,11 +62,11 @@ public: * @param description The text description of the option usage. */ void addOptionDesc( - const LLString& option_name, + const std::string& option_name, boost::function1<void, const token_vector_t&> notify_callback = 0, unsigned int num_tokens = 0, - const LLString& description = LLString::null, - const LLString& short_name = LLString::null, + const std::string& description = LLStringUtil::null, + const std::string& short_name = LLStringUtil::null, bool composing = false, bool positional = false, bool last_option = false); @@ -159,7 +159,7 @@ public: * * *FIX:Mani Specify config file format. */ - void configure(const LLString& config_filename, + void configure(const std::string& config_filename, LLControlGroup* controlGroup); }; diff --git a/indra/newview/llcompilequeue.cpp b/indra/newview/llcompilequeue.cpp index 8e5e8c8ea3..3ab340f66a 100644 --- a/indra/newview/llcompilequeue.cpp +++ b/indra/newview/llcompilequeue.cpp @@ -63,14 +63,14 @@ ///---------------------------------------------------------------------------- // *TODO:Translate -const char* COMPILE_QUEUE_TITLE = "Recompilation Progress"; -const char* COMPILE_START_STRING = "recompile"; -const char* RESET_QUEUE_TITLE = "Reset Progress"; -const char* RESET_START_STRING = "reset"; -const char* RUN_QUEUE_TITLE = "Set Running Progress"; -const char* RUN_START_STRING = "set running"; -const char* NOT_RUN_QUEUE_TITLE = "Set Not Running Progress"; -const char* NOT_RUN_START_STRING = "set not running"; +const std::string COMPILE_QUEUE_TITLE("Recompilation Progress"); +const std::string COMPILE_START_STRING("recompile"); +const std::string RESET_QUEUE_TITLE("Reset Progress"); +const std::string RESET_START_STRING("reset"); +const std::string RUN_QUEUE_TITLE("Set Running Progress"); +const std::string RUN_START_STRING("set running"); +const std::string NOT_RUN_QUEUE_TITLE("Set Not Running Progress"); +const std::string NOT_RUN_START_STRING("set not running"); struct LLCompileQueueData { @@ -83,8 +83,8 @@ struct LLCompileQueueData struct LLScriptQueueData { LLUUID mQueueID; - LLString mScriptName; - LLScriptQueueData(const LLUUID& q_id, const char* name) : + std::string mScriptName; + LLScriptQueueData(const LLUUID& q_id, const std::string& name) : mQueueID(q_id), mScriptName(name) {} }; @@ -98,9 +98,9 @@ LLMap<LLUUID, LLFloaterScriptQueue*> LLFloaterScriptQueue::sInstances; // Default constructor LLFloaterScriptQueue::LLFloaterScriptQueue(const std::string& name, - const LLRect& rect, - const char* title, - const char* start_string) : + const LLRect& rect, + const std::string& title, + const std::string& start_string) : LLFloater(name, rect, title, RESIZE_YES, DEFAULT_MIN_WIDTH, DEFAULT_MIN_HEIGHT, DRAG_ON_TOP, MINIMIZE_YES, CLOSE_YES) @@ -198,8 +198,8 @@ void LLFloaterScriptQueue::addObject(const LLUUID& id) BOOL LLFloaterScriptQueue::start() { //llinfos << "LLFloaterCompileQueue::start()" << llendl; - char buffer[MAX_STRING]; /*Flawfinder: ignore*/ - snprintf(buffer, sizeof(buffer), "Starting %s of %d items.", mStartString, mObjectIDs.count()); /* Flawfinder: ignore */ + std::string buffer; + buffer = llformat("Starting %s of %d items.", mStartString.c_str(), mObjectIDs.count()); // *TODO: Translate LLScrollListCtrl* list = getChild<LLScrollListCtrl>("queue output"); list->addCommentText(buffer); @@ -238,8 +238,7 @@ BOOL LLFloaterScriptQueue::nextObject() LLScrollListCtrl* list = getChild<LLScrollListCtrl>("queue output"); mDone = TRUE; - char buffer[MAX_STRING]; /*Flawfinder: ignore*/ - snprintf(buffer, sizeof(buffer), "Done."); /* Flawfinder: ignore */ + std::string buffer = "Done."; // *TODO: Translate list->addCommentText(buffer); childSetEnabled("close",TRUE); } @@ -286,8 +285,7 @@ LLFloaterCompileQueue* LLFloaterCompileQueue::create() gFloaterView->getNewFloaterPosition(&left, &top); LLRect rect = gSavedSettings.getRect("CompileOutputRect"); rect.translate(left - rect.mLeft, top - rect.mTop); - LLFloaterCompileQueue* new_queue = new LLFloaterCompileQueue("queue", - rect); + LLFloaterCompileQueue* new_queue = new LLFloaterCompileQueue("queue", rect); new_queue->open(); /*Flawfinder: ignore*/ return new_queue; } @@ -344,7 +342,7 @@ void LLFloaterCompileQueue::handleInventory(LLViewerObject *viewer_object, for(iter = asset_item_map.begin(); iter != asset_item_map.end(); iter++) { LLInventoryItem *itemp = iter->second; - LLScriptQueueData* datap = new LLScriptQueueData(getID(), itemp->getName().c_str()); + LLScriptQueueData* datap = new LLScriptQueueData(getID(), itemp->getName()); //llinfos << "ITEM NAME 2: " << names.get(i) << llendl; gAssetStorage->getInvItemAsset(viewer_object->getRegion()->getHost(), @@ -373,18 +371,17 @@ void LLFloaterCompileQueue::scriptArrived(LLVFS *vfs, const LLUUID& asset_id, if(!data) return; LLFloaterCompileQueue* queue = static_cast<LLFloaterCompileQueue*> (LLFloaterScriptQueue::findInstance(data->mQueueID)); - char buffer[MAX_STRING]; /*Flawfinder: ignore*/ - buffer[0] = '\0'; + std::string buffer; if(queue && (0 == status)) { //llinfos << "ITEM NAME 3: " << data->mScriptName << llendl; // Dump this into a file on the local disk so we can compile it. - char filename[LL_MAX_PATH] = ""; /*Flawfinder: ignore*/ + std::string filename; LLVFile file(vfs, asset_id, type); - char uuid_str[UUID_STR_LENGTH]; /*Flawfinder: ignore*/ + std::string uuid_str; asset_id.toString(uuid_str); - snprintf(filename, sizeof(filename), "%s.%s",gDirUtilp->getExpandedFilename(LL_PATH_CACHE,uuid_str).c_str(),LLAssetType::lookup(type)); /* Flawfinder: ignore */ + filename = gDirUtilp->getExpandedFilename(LL_PATH_CACHE,uuid_str) + llformat(".%s",LLAssetType::lookup(type)); LLFILE *fp = LLFile::fopen(filename, "wb"); /*Flawfinder: ignore*/ if (fp) @@ -403,8 +400,9 @@ void LLFloaterCompileQueue::scriptArrived(LLVFS *vfs, const LLUUID& asset_id, fclose(fp); } + // *TODO: translate // It's now in the file, now compile it. - snprintf(buffer, sizeof(buffer), "Downloaded, now compiling '%s'.", data->mScriptName.c_str()); /* Flawfinder: ignore */ + buffer = std::string("Downloaded, now compiling: ") + data->mScriptName; // *TODO: Translate queue->compile(filename, asset_id); // Delete it after we're done compiling? @@ -416,22 +414,19 @@ void LLFloaterCompileQueue::scriptArrived(LLVFS *vfs, const LLUUID& asset_id, if( LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE == status ) { - LLChat chat("Script not found on server."); + LLChat chat(std::string("Script not found on server.")); // *TODO: Translate LLFloaterChat::addChat(chat); - snprintf(buffer, sizeof(buffer), "Problem downloading %s.", /* Flawfinder: ignore */ - data->mScriptName.c_str()); + buffer = std::string("Problem downloading: ") + data->mScriptName; // *TODO: Translate } else if (LL_ERR_INSUFFICIENT_PERMISSIONS == status) { - LLChat chat("Insufficient permissions to download a script."); + LLChat chat(std::string("Insufficient permissions to download a script.")); // *TODO: Translate LLFloaterChat::addChat(chat); - snprintf(buffer, sizeof(buffer), "Insufficient permissions for '%s'.", /* Flawfinder: ignore */ - data->mScriptName.c_str()); + buffer = std::string("Insufficient permissions for: ") + data->mScriptName; // *TODO: Translate } else { - snprintf(buffer, sizeof(buffer), "Unknown failure to download %s.", /* Flawfinder: ignore */ - data->mScriptName.c_str()); + buffer = std::string("Unknown failure to download ") + data->mScriptName; // *TODO: Translate } llwarns << "Problem downloading script asset." << llendl; @@ -452,7 +447,7 @@ void LLFloaterCompileQueue::onSaveTextComplete(const LLUUID& asset_id, void* use if (status) { llwarns << "Unable to save text for script." << llendl; - LLString::format_map_t args; + LLStringUtil::format_map_t args; args["[REASON]"] = std::string(LLAssetStorage::getErrorString(status)); gViewerWindow->alertXml("CompileQueueSaveText", args); } @@ -474,7 +469,7 @@ void LLFloaterCompileQueue::onSaveBytecodeComplete(const LLUUID& asset_id, void* else { llwarns << "Unable to save bytecode for script." << llendl; - LLStringBase<char>::format_map_t args; + LLStringUtil::format_map_t args; args["[REASON]"] = std::string(LLAssetStorage::getErrorString(status)); gViewerWindow->alertXml("CompileQueueSaveBytecode", args); } @@ -483,7 +478,7 @@ void LLFloaterCompileQueue::onSaveBytecodeComplete(const LLUUID& asset_id, void* } // compile the file given and save it out. -void LLFloaterCompileQueue::compile(const char* filename, +void LLFloaterCompileQueue::compile(const std::string& filename, const LLUUID& asset_id) { LLUUID new_asset_id; @@ -491,17 +486,17 @@ void LLFloaterCompileQueue::compile(const char* filename, tid.generate(); new_asset_id = tid.makeAssetID(gAgent.getSecureSessionID()); - char uuid_string[UUID_STR_LENGTH]; /*Flawfinder: ignore*/ + std::string uuid_string; new_asset_id.toString(uuid_string); - char dst_filename[LL_MAX_PATH]; /*Flawfinder: ignore*/ - snprintf(dst_filename, sizeof(dst_filename), "%s.lso", gDirUtilp->getExpandedFilename(LL_PATH_CACHE,uuid_string).c_str()); /* Flawfinder: ignore */ - char err_filename[LL_MAX_PATH]; /*Flawfinder: ignore*/ - snprintf(err_filename, sizeof(err_filename), "%s.out", gDirUtilp->getExpandedFilename(LL_PATH_CACHE,uuid_string).c_str()); /* Flawfinder: ignore */ + std::string dst_filename; + dst_filename = gDirUtilp->getExpandedFilename(LL_PATH_CACHE,uuid_string) + ".lso"; + std::string err_filename; + err_filename = gDirUtilp->getExpandedFilename(LL_PATH_CACHE,uuid_string) + ".out"; gAssetStorage->storeAssetData(filename, tid, LLAssetType::AT_LSL_TEXT, &onSaveTextComplete, NULL, FALSE); - if(!lscript_compile(filename, dst_filename, err_filename, gAgent.isGodlike())) + if(!lscript_compile(filename.c_str(), dst_filename.c_str(), err_filename.c_str(), gAgent.isGodlike())) { llwarns << "compile failed" << llendl; removeItemByAssetID(asset_id); @@ -586,8 +581,7 @@ LLFloaterResetQueue* LLFloaterResetQueue::create() gFloaterView->getNewFloaterPosition(&left, &top); LLRect rect = gSavedSettings.getRect("CompileOutputRect"); rect.translate(left - rect.mLeft, top - rect.mTop); - LLFloaterResetQueue* new_queue = new LLFloaterResetQueue("queue", - rect); + LLFloaterResetQueue* new_queue = new LLFloaterResetQueue("queue", rect); new_queue->open(); /*Flawfinder: ignore*/ return new_queue; } @@ -619,8 +613,8 @@ void LLFloaterResetQueue::handleInventory(LLViewerObject* viewer_obj, { LLInventoryItem* item = (LLInventoryItem*)((LLInventoryObject*)(*it)); LLScrollListCtrl* list = getChild<LLScrollListCtrl>("queue output"); - char buffer[MAX_STRING]; /*Flawfinder: ignore*/ - snprintf(buffer, sizeof(buffer), "Resetting '%s'.", item->getName().c_str()); /* Flawfinder: ignore */ + std::string buffer; + buffer = std::string("Resetting: ") + item->getName(); // *TODO: Translate list->addCommentText(buffer); LLMessageSystem* msg = gMessageSystem; msg->newMessageFast(_PREHASH_ScriptReset); @@ -649,8 +643,7 @@ LLFloaterRunQueue* LLFloaterRunQueue::create() gFloaterView->getNewFloaterPosition(&left, &top); LLRect rect = gSavedSettings.getRect("CompileOutputRect"); rect.translate(left - rect.mLeft, top - rect.mTop); - LLFloaterRunQueue* new_queue = new LLFloaterRunQueue("queue", - rect); + LLFloaterRunQueue* new_queue = new LLFloaterRunQueue("queue", rect); new_queue->open(); /*Flawfinder: ignore*/ return new_queue; } @@ -682,8 +675,8 @@ void LLFloaterRunQueue::handleInventory(LLViewerObject* viewer_obj, { LLInventoryItem* item = (LLInventoryItem*)((LLInventoryObject*)(*it)); LLScrollListCtrl* list = getChild<LLScrollListCtrl>("queue output"); - char buffer[MAX_STRING]; /*Flawfinder: ignore*/ - snprintf(buffer, sizeof(buffer), "Running '%s'.", item->getName().c_str()); /* Flawfinder: ignore */ + std::string buffer; + buffer = std::string("Running: ") + item->getName(); // *TODO: Translate list->addCommentText(buffer); LLMessageSystem* msg = gMessageSystem; @@ -714,8 +707,7 @@ LLFloaterNotRunQueue* LLFloaterNotRunQueue::create() gFloaterView->getNewFloaterPosition(&left, &top); LLRect rect = gSavedSettings.getRect("CompileOutputRect"); rect.translate(left - rect.mLeft, top - rect.mTop); - LLFloaterNotRunQueue* new_queue = new LLFloaterNotRunQueue("queue", - rect); + LLFloaterNotRunQueue* new_queue = new LLFloaterNotRunQueue("queue", rect); new_queue->open(); /*Flawfinder: ignore*/ return new_queue; } @@ -747,8 +739,8 @@ void LLFloaterNotRunQueue::handleInventory(LLViewerObject* viewer_obj, { LLInventoryItem* item = (LLInventoryItem*)((LLInventoryObject*)(*it)); LLScrollListCtrl* list = getChild<LLScrollListCtrl>("queue output"); - char buffer[MAX_STRING]; /*Flawfinder: ignore*/ - snprintf(buffer, sizeof(buffer), "Not running '%s'.", item->getName().c_str()); /* Flawfinder: ignore */ + std::string buffer; + buffer = std::string("Not running: ") +item->getName(); // *TODO: Translate list->addCommentText(buffer); LLMessageSystem* msg = gMessageSystem; diff --git a/indra/newview/llcompilequeue.h b/indra/newview/llcompilequeue.h index ca5589f902..be7bbd5ceb 100644 --- a/indra/newview/llcompilequeue.h +++ b/indra/newview/llcompilequeue.h @@ -66,7 +66,7 @@ public: protected: LLFloaterScriptQueue(const std::string& name, const LLRect& rect, - const char* title, const char* start_string); + const std::string& title, const std::string& start_string); virtual ~LLFloaterScriptQueue(); // This is the callback method for the viewer object currently @@ -109,7 +109,7 @@ protected: LLUUID mID; static LLMap<LLUUID, LLFloaterScriptQueue*> sInstances; - const char* mStartString; + std::string mStartString; }; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -144,7 +144,7 @@ protected: S32 status, LLExtStat ext_status); // compile the file given and save it out. - void compile(const char* filename, const LLUUID& asset_id); + void compile(const std::string& filename, const LLUUID& asset_id); // remove any object in mScriptScripts with the matching uuid. void removeItemByAssetID(const LLUUID& asset_id); diff --git a/indra/newview/llconfirmationmanager.cpp b/indra/newview/llconfirmationmanager.cpp index 1c62b70b4c..167afb8062 100644 --- a/indra/newview/llconfirmationmanager.cpp +++ b/indra/newview/llconfirmationmanager.cpp @@ -59,7 +59,7 @@ static void onConfirmAlert(S32 option, void* data) } static void onConfirmAlertPassword( - S32 option, const LLString& text, void* data) + S32 option, const std::string& text, void* data) { LLConfirmationManager::ListenerBase* listener = (LLConfirmationManager::ListenerBase*)data; @@ -77,7 +77,7 @@ void LLConfirmationManager::confirm(Type type, const std::string& action, ListenerBase* listener) { - LLString::format_map_t args; + LLStringUtil::format_map_t args; args["[ACTION]"] = action; switch (type) @@ -91,7 +91,7 @@ void LLConfirmationManager::confirm(Type type, gViewerWindow->alertXmlEditText("ConfirmPurchasePassword", args, NULL, NULL, onConfirmAlertPassword, listener, - LLString::format_map_t(), + LLStringUtil::format_map_t(), TRUE); break; case TYPE_NONE: diff --git a/indra/newview/llcurrencyuimanager.cpp b/indra/newview/llcurrencyuimanager.cpp index c32bf7c268..ab7990b170 100644 --- a/indra/newview/llcurrencyuimanager.cpp +++ b/indra/newview/llcurrencyuimanager.cpp @@ -381,7 +381,7 @@ void LLCurrencyUIManager::Impl::updateUI() { if (!mZeroMessage.empty() && mUserCurrencyBuy == 0) { - lindenAmount->setText(LLString::null); + lindenAmount->setText(LLStringUtil::null); } else { @@ -467,7 +467,7 @@ bool LLCurrencyUIManager::process() return changed; } -void LLCurrencyUIManager::buy(const LLString& buy_msg) +void LLCurrencyUIManager::buy(const std::string& buy_msg) { if (!canBuy()) { diff --git a/indra/newview/llcurrencyuimanager.h b/indra/newview/llcurrencyuimanager.h index bb135d0189..5f5845af9b 100644 --- a/indra/newview/llcurrencyuimanager.h +++ b/indra/newview/llcurrencyuimanager.h @@ -71,7 +71,7 @@ public: // call periodically, for example, from draw() // returns true if the UI needs to be updated - void buy(const LLString& buy_msg); + void buy(const std::string& buy_msg); // call to initiate the purchase bool inProcess(); // is a transaction in process diff --git a/indra/newview/lldebugmessagebox.cpp b/indra/newview/lldebugmessagebox.cpp index 371426d56e..9fa2c76bbf 100644 --- a/indra/newview/lldebugmessagebox.cpp +++ b/indra/newview/lldebugmessagebox.cpp @@ -46,34 +46,34 @@ /// Class LLDebugVarMessageBox ///---------------------------------------------------------------------------- -std::map<LLString, LLDebugVarMessageBox*> LLDebugVarMessageBox::sInstances; +std::map<std::string, LLDebugVarMessageBox*> LLDebugVarMessageBox::sInstances; LLDebugVarMessageBox::LLDebugVarMessageBox(const std::string& title, EDebugVarType var_type, void *var) : - LLFloater("msg box", LLRect(10,160,400,10), title), + LLFloater(std::string("msg box"), LLRect(10,160,400,10), title), mVarType(var_type), mVarData(var), mAnimate(FALSE) { switch(var_type) { case VAR_TYPE_F32: - mSlider1 = new LLSliderCtrl("slider 1", LLRect(20,130,190,110), title, NULL, 70, 130, TRUE, TRUE, FALSE, NULL, NULL, *((F32*)var), -100.f, 100.f, 0.1f, NULL); + mSlider1 = new LLSliderCtrl(std::string("slider 1"), LLRect(20,130,190,110), title, NULL, 70, 130, TRUE, TRUE, FALSE, NULL, NULL, *((F32*)var), -100.f, 100.f, 0.1f, LLStringUtil::null); mSlider1->setPrecision(3); addChild(mSlider1); mSlider2 = NULL; mSlider3 = NULL; break; case VAR_TYPE_S32: - mSlider1 = new LLSliderCtrl("slider 1", LLRect(20,100,190,80), title, NULL, 70, 130, TRUE, TRUE, FALSE, NULL, NULL, (F32)*((S32*)var), -255.f, 255.f, 1.f, NULL); + mSlider1 = new LLSliderCtrl(std::string("slider 1"), LLRect(20,100,190,80), title, NULL, 70, 130, TRUE, TRUE, FALSE, NULL, NULL, (F32)*((S32*)var), -255.f, 255.f, 1.f, LLStringUtil::null); mSlider1->setPrecision(0); addChild(mSlider1); mSlider2 = NULL; mSlider3 = NULL; break; case VAR_TYPE_VEC3: - mSlider1 = new LLSliderCtrl("slider 1", LLRect(20,130,190,110), "x: ", NULL, 70, 130, TRUE, TRUE, FALSE, NULL, NULL, ((LLVector3*)var)->mV[VX], -100.f, 100.f, 0.1f, NULL); + mSlider1 = new LLSliderCtrl(std::string("slider 1"), LLRect(20,130,190,110), std::string("x: "), NULL, 70, 130, TRUE, TRUE, FALSE, NULL, NULL, ((LLVector3*)var)->mV[VX], -100.f, 100.f, 0.1f, LLStringUtil::null); mSlider1->setPrecision(3); - mSlider2 = new LLSliderCtrl("slider 2", LLRect(20,100,190,80), "y: ", NULL, 70, 130, TRUE, TRUE, FALSE, NULL, NULL, ((LLVector3*)var)->mV[VY], -100.f, 100.f, 0.1f, NULL); + mSlider2 = new LLSliderCtrl(std::string("slider 2"), LLRect(20,100,190,80), std::string("y: "), NULL, 70, 130, TRUE, TRUE, FALSE, NULL, NULL, ((LLVector3*)var)->mV[VY], -100.f, 100.f, 0.1f, LLStringUtil::null); mSlider2->setPrecision(3); - mSlider3 = new LLSliderCtrl("slider 3", LLRect(20,70,190,50), "z: ", NULL, 70, 130, TRUE, TRUE, FALSE, NULL, NULL, ((LLVector3*)var)->mV[VZ], -100.f, 100.f, 0.1f, NULL); + mSlider3 = new LLSliderCtrl(std::string("slider 3"), LLRect(20,70,190,50), std::string("z: "), NULL, 70, 130, TRUE, TRUE, FALSE, NULL, NULL, ((LLVector3*)var)->mV[VZ], -100.f, 100.f, 0.1f, LLStringUtil::null); mSlider3->setPrecision(3); addChild(mSlider1); addChild(mSlider2); @@ -84,10 +84,10 @@ LLDebugVarMessageBox::LLDebugVarMessageBox(const std::string& title, EDebugVarTy break; } - mAnimateButton = new LLButton("Animate", LLRect(20, 45, 180, 25), "", onAnimateClicked, this); + mAnimateButton = new LLButton(std::string("Animate"), LLRect(20, 45, 180, 25), LLStringUtil::null, onAnimateClicked, this); addChild(mAnimateButton); - mText = new LLTextBox("value", LLRect(20,20,190,0)); + mText = new LLTextBox(std::string("value"), LLRect(20,20,190,0)); addChild(mText); //disable hitting enter closes dialog @@ -160,7 +160,7 @@ void LLDebugVarMessageBox::show(const std::string& title, LLVector3 *var, LLVect LLDebugVarMessageBox* LLDebugVarMessageBox::show(const std::string& title, EDebugVarType var_type, void *var) { - LLString title_string(title); + std::string title_string(title); LLDebugVarMessageBox *box = sInstances[title_string]; if (!box) @@ -217,7 +217,7 @@ void LLDebugVarMessageBox::onClose(bool app_quitting) void LLDebugVarMessageBox::draw() { - LLString text; + std::string text; switch(mVarType) { case VAR_TYPE_F32: diff --git a/indra/newview/lldebugmessagebox.h b/indra/newview/lldebugmessagebox.h index d90d7b1a5f..5e89c6614d 100644 --- a/indra/newview/lldebugmessagebox.h +++ b/indra/newview/lldebugmessagebox.h @@ -86,10 +86,10 @@ protected: LLSliderCtrl* mSlider3; LLButton* mAnimateButton; LLTextBox* mText; - LLString mTitle; + std::string mTitle; BOOL mAnimate; - static std::map<LLString, LLDebugVarMessageBox*> sInstances; + static std::map<std::string, LLDebugVarMessageBox*> sInstances; }; #endif // LL_LLMESSAGEBOX_H diff --git a/indra/newview/lldelayedgestureerror.cpp b/indra/newview/lldelayedgestureerror.cpp index aaa49b831d..832b1b9130 100644 --- a/indra/newview/lldelayedgestureerror.cpp +++ b/indra/newview/lldelayedgestureerror.cpp @@ -98,7 +98,7 @@ void LLDelayedGestureError::onIdle(void *userdata) //static bool LLDelayedGestureError::doDialog(const LLErrorEntry &ent, bool uuid_ok) { - LLStringBase<char>::format_map_t args; + LLStringUtil::format_map_t args; LLInventoryItem *item = gInventory.getItem( ent.mItemID ); if ( item ) @@ -109,7 +109,7 @@ bool LLDelayedGestureError::doDialog(const LLErrorEntry &ent, bool uuid_ok) { if ( uuid_ok || ent.mTimer.getElapsedTimeF32() > MAX_NAME_WAIT_TIME ) { - args["[NAME]"] = LLString( ent.mItemID.asString() ); + args["[NAME]"] = std::string( ent.mItemID.asString() ); } else { diff --git a/indra/newview/lldelayedgestureerror.h b/indra/newview/lldelayedgestureerror.h index 8430a9b848..090940b7c2 100644 --- a/indra/newview/lldelayedgestureerror.h +++ b/indra/newview/lldelayedgestureerror.h @@ -61,10 +61,10 @@ private: struct LLErrorEntry { - LLErrorEntry(const LLString& notify, const LLUUID &item) : mTimer(), mNotifyName(notify), mItemID(item) {} + LLErrorEntry(const std::string& notify, const LLUUID &item) : mTimer(), mNotifyName(notify), mItemID(item) {} LLTimer mTimer; - LLString mNotifyName; + std::string mNotifyName; LLUUID mItemID; }; diff --git a/indra/newview/lldirpicker.cpp b/indra/newview/lldirpicker.cpp index 367293929d..bf4a9bb8d4 100644 --- a/indra/newview/lldirpicker.cpp +++ b/indra/newview/lldirpicker.cpp @@ -67,7 +67,7 @@ LLDirPicker::~LLDirPicker() // nothing } -BOOL LLDirPicker::getDir(LLString* filename) +BOOL LLDirPicker::getDir(std::string* filename) { if( mLocked ) { @@ -114,7 +114,7 @@ BOOL LLDirPicker::getDir(LLString* filename) return success; } -LLString LLDirPicker::getDirName() +std::string LLDirPicker::getDirName() { return mDir; } @@ -225,7 +225,7 @@ OSStatus LLDirPicker::doNavChooseDialog() return error; } -BOOL LLDirPicker::getDir(LLString* filename) +BOOL LLDirPicker::getDir(std::string* filename) { if( mLocked ) return FALSE; BOOL success = FALSE; @@ -252,7 +252,7 @@ BOOL LLDirPicker::getDir(LLString* filename) return success; } -LLString LLDirPicker::getDirName() +std::string LLDirPicker::getDirName() { return mDir; } @@ -260,7 +260,7 @@ LLString LLDirPicker::getDirName() void LLDirPicker::reset() { mLocked = FALSE; - mDir = NULL; + mDir.clear(); } #elif LL_LINUX @@ -283,7 +283,7 @@ void LLDirPicker::reset() mFilePicker->reset(); } -BOOL LLDirPicker::getDir(LLString* filename) +BOOL LLDirPicker::getDir(std::string* filename) { reset(); if (mFilePicker) @@ -296,19 +296,17 @@ BOOL LLDirPicker::getDir(LLString* filename) gtk_window_set_title(GTK_WINDOW(picker), "Choose Directory"); gtk_widget_show_all(GTK_WIDGET(picker)); gtk_main(); - return (NULL != mFilePicker->getFirstFile()); + return (!mFilePicker->getFirstFile().empty()); } } return FALSE; } -LLString LLDirPicker::getDirName() +std::string LLDirPicker::getDirName() { if (mFilePicker) { - const char* name = mFilePicker->getFirstFile(); - if (name) - return name; + return mFilePicker->getFirstFile(); } return ""; } @@ -329,12 +327,12 @@ void LLDirPicker::reset() { } -BOOL LLDirPicker::getDir(LLString* filename) +BOOL LLDirPicker::getDir(std::string* filename) { return FALSE; } -LLString LLDirPicker::getDirName() +std::string LLDirPicker::getDirName() { return ""; } diff --git a/indra/newview/lldirpicker.h b/indra/newview/lldirpicker.h index 0bfb3620c9..d133a947e1 100644 --- a/indra/newview/lldirpicker.h +++ b/indra/newview/lldirpicker.h @@ -64,8 +64,8 @@ public: // calling this before main() is undefined static LLDirPicker& instance( void ) { return sInstance; } - BOOL getDir(LLString* filename); - LLString getDirName(); + BOOL getDir(std::string* filename); + std::string getDirName(); // clear any lists of buffers or whatever, and make sure the dir // picker isn't locked. @@ -94,9 +94,8 @@ private: LLFilePicker *mFilePicker; #endif - char mDirs[DIRNAME_BUFFER_SIZE]; /*Flawfinder: ignore*/ - LLString* mFileName; - LLString mDir; + std::string* mFileName; + std::string mDir; BOOL mLocked; static LLDirPicker sInstance; diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp index 1dfaf6569e..1784fccf1f 100644 --- a/indra/newview/lldrawpoolbump.cpp +++ b/indra/newview/lldrawpoolbump.cpp @@ -100,7 +100,7 @@ void LLStandardBumpmap::restoreGL() gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount++] = LLStandardBumpmap("Darkness"); // BE_DARKNESS std::string file_name = gDirUtilp->getExpandedFilename( LL_PATH_APP_SETTINGS, "std_bump.ini" ); - LLFILE* file = LLFile::fopen( file_name.c_str(), "rt" ); /*Flawfinder: ignore*/ + LLFILE* file = LLFile::fopen( file_name, "rt" ); /*Flawfinder: ignore*/ if( !file ) { llwarns << "Could not open std_bump <" << file_name << ">" << llendl; diff --git a/indra/newview/lldrawpoolbump.h b/indra/newview/lldrawpoolbump.h index ae722b2fd3..d0c9b258f3 100644 --- a/indra/newview/lldrawpoolbump.h +++ b/indra/newview/lldrawpoolbump.h @@ -96,9 +96,9 @@ class LLStandardBumpmap { public: LLStandardBumpmap() : mLabel() {} - LLStandardBumpmap( const char* label ) : mLabel(label) {} + LLStandardBumpmap( const std::string& label ) : mLabel(label) {} - LLString mLabel; + std::string mLabel; LLPointer<LLViewerImage> mImage; static U32 sStandardBumpmapCount; // Number of valid values in gStandardBumpmapList[] diff --git a/indra/newview/lldrawpoolwlsky.cpp b/indra/newview/lldrawpoolwlsky.cpp index 09a87f2402..ea3999f93f 100644 --- a/indra/newview/lldrawpoolwlsky.cpp +++ b/indra/newview/lldrawpoolwlsky.cpp @@ -55,7 +55,7 @@ LLPointer<LLImageRaw> LLDrawPoolWLSky::sCloudNoiseRawImage = NULL; LLDrawPoolWLSky::LLDrawPoolWLSky(void) : LLDrawPool(POOL_WL_SKY) { - const LLString cloudNoiseFilename(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight", "clouds2.tga")); + const std::string cloudNoiseFilename(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight", "clouds2.tga")); llinfos << "loading WindLight cloud noise from " << cloudNoiseFilename << llendl; LLPointer<LLImageFormatted> cloudNoiseFile(LLImageFormatted::createFromExtension(cloudNoiseFilename)); diff --git a/indra/newview/llemote.h b/indra/newview/llemote.h index 785c9df753..5f1e091fa1 100644 --- a/indra/newview/llemote.h +++ b/indra/newview/llemote.h @@ -113,8 +113,6 @@ public: virtual BOOL canDeprecate() { return FALSE; } - static BOOL getIndexFromName( const char* name, U32* index ); - protected: LLCharacter* mCharacter; diff --git a/indra/newview/lleventinfo.cpp b/indra/newview/lleventinfo.cpp index 91401a048b..a3cb925a46 100644 --- a/indra/newview/lleventinfo.cpp +++ b/indra/newview/lleventinfo.cpp @@ -38,54 +38,17 @@ LLEventInfo::cat_map LLEventInfo::sCategories; -LLEventInfo::LLEventInfo(F32 global_x, F32 global_y, - const char* name, - U32 id, - time_t unix_time, - U32 event_flags) -: mName( name ), - mID( id ), - mPosGlobal( global_x, global_y, 40.0 ), - mUnixTime( unix_time ), - mEventFlags(event_flags), - mSelected( FALSE ) -{ - struct tm* timep; - // Convert to Pacific, based on server's opinion of whether - // it's daylight savings time there. - timep = utc_to_pacific_time(unix_time, gPacificDaylightTime); - - S32 display_hour = timep->tm_hour % 12; - if (display_hour == 0) display_hour = 12; - - mTimeStr = llformat("% 2d/% 2d % 2d:%02d %s", - timep->tm_mon+1, - timep->tm_year-100, - display_hour, - timep->tm_min, - (timep->tm_hour < 12 ? "AM" : "PM") ); -} - - void LLEventInfo::unpack(LLMessageSystem *msg) { - const U32 MAX_DESC_LENGTH = 1024; - U32 event_id; msg->getU32("EventData", "EventID", event_id); mID = event_id; - char buffer[MAX_DESC_LENGTH]; /*Flawfinder: ignore*/ - msg->getString("EventData", "Name", MAX_DESC_LENGTH, buffer); - mName = buffer; + msg->getString("EventData", "Name", mName); - msg->getString("EventData", "Category", MAX_DESC_LENGTH, buffer); - mCategoryStr = buffer; + msg->getString("EventData", "Category", mCategoryStr); - msg->getString("EventData", "Date", MAX_DESC_LENGTH, buffer); - // *FIX: evil hack to let users know that we don't localize - // time information. Hack! This is WRONG. - mTimeStr = buffer; + msg->getString("EventData", "Date", mTimeStr); U32 duration; msg->getU32("EventData","Duration",duration); @@ -95,10 +58,10 @@ void LLEventInfo::unpack(LLMessageSystem *msg) msg->getU32("EventData", "DateUTC", date); mUnixTime = date; - msg->getString("EventData", "Desc", MAX_DESC_LENGTH, buffer); - mDesc = buffer; + msg->getString("EventData", "Desc", mDesc); - msg->getString("EventData", "Creator", MAX_DESC_LENGTH, buffer); + std::string buffer; + msg->getString("EventData", "Creator", buffer); mRunByID = LLUUID(buffer); U32 foo; @@ -112,9 +75,7 @@ void LLEventInfo::unpack(LLMessageSystem *msg) mCover = cover; } - char sim_name[256]; /*Flawfinder: ignore*/ - msg->getString("EventData", "SimName", 256, sim_name); - mSimName.assign(sim_name); + msg->getString("EventData", "SimName", mSimName); msg->getVector3d("EventData", "GlobalPos", mPosGlobal); diff --git a/indra/newview/lleventinfo.h b/indra/newview/lleventinfo.h index 4d0687f81c..8a33a191e1 100644 --- a/indra/newview/lleventinfo.h +++ b/indra/newview/lleventinfo.h @@ -44,7 +44,6 @@ class LLEventInfo { public: LLEventInfo() {} - LLEventInfo(F32 global_x, F32 global_y, const char* name, U32 id, time_t unix_time, U32 event_flags); void unpack(LLMessageSystem *msg); @@ -58,7 +57,7 @@ public: U32 mDuration; std::string mTimeStr; LLUUID mRunByID; - LLString mSimName; + std::string mSimName; LLVector3d mPosGlobal; time_t mUnixTime; // seconds from 1970 BOOL mHasCover; diff --git a/indra/newview/lleventnotifier.cpp b/indra/newview/lleventnotifier.cpp index 3d2bbcd1f5..343a572a6a 100644 --- a/indra/newview/lleventnotifier.cpp +++ b/indra/newview/lleventnotifier.cpp @@ -77,7 +77,7 @@ void LLEventNotifier::update() if (np->getEventDate() < (alert_time)) { - LLString::format_map_t args; + LLStringUtil::format_map_t args; args["[NAME]"] = np->getEventName(); args["[DATE]"] = np->getEventDateStr(); LLNotifyBox::showXml("EventNotification", args, diff --git a/indra/newview/llfasttimerview.cpp b/indra/newview/llfasttimerview.cpp index ad89d8220f..e224ee57c0 100644 --- a/indra/newview/llfasttimerview.cpp +++ b/indra/newview/llfasttimerview.cpp @@ -208,7 +208,7 @@ static const int FTV_DISPLAY_NUM = (sizeof(ft_display_table)/sizeof(ft_display_ S32 ft_display_idx[FTV_DISPLAY_NUM]; // line of table entry for display purposes (for collapse) LLFastTimerView::LLFastTimerView(const std::string& name, const LLRect& rect) - : LLFloater(name, rect, "Fast Timers") + : LLFloater(name, rect, std::string("Fast Timers")) { setVisible(FALSE); mDisplayMode = 0; @@ -499,7 +499,7 @@ void LLFastTimerView::draw() LLFontGL::sMonospace->renderUTF8(tdesc, 0, x, y, LLColor4::white, LLFontGL::LEFT, LLFontGL::TOP); y -= (texth + 2); - LLFontGL::sMonospace->renderUTF8("[Right-Click log selected] [ALT-Click toggle counts] [ALT-SHIFT-Click sub hidden]", + LLFontGL::sMonospace->renderUTF8(std::string("[Right-Click log selected] [ALT-Click toggle counts] [ALT-SHIFT-Click sub hidden]"), 0, x, y, LLColor4::white, LLFontGL::LEFT, LLFontGL::TOP); y -= (texth + 2); } @@ -632,7 +632,7 @@ void LLFastTimerView::draw() } y -= (texth + 2); - textw = dx + LLFontGL::sMonospace->getWidth(ft_display_table[i].desc) + 40; + textw = dx + LLFontGL::sMonospace->getWidth(std::string(ft_display_table[i].desc)) + 40; if (textw > legendwidth) legendwidth = textw; } @@ -946,11 +946,13 @@ void LLFastTimerView::draw() F32 ms = (F32)((F64)max_ticks * iclock_freq); //display y-axis range - LLString tdesc = mDisplayCalls ? - llformat("%d calls", max_ticks) : - mDisplayHz ? - llformat("%d Hz", max_ticks) : - llformat("%4.2f ms", ms); + std::string tdesc; + if (mDisplayCalls) + tdesc = llformat("%d calls", (int)max_ticks); + else if (mDisplayHz) + tdesc = llformat("%d Hz", (int)max_ticks); + else + tdesc = llformat("%4.2f ms", ms); x = graph_rect.mRight - LLFontGL::sMonospace->getWidth(tdesc)-5; y = graph_rect.mTop - ((S32)LLFontGL::sMonospace->getLineHeight()); @@ -1063,7 +1065,7 @@ void LLFastTimerView::draw() x = (graph_rect.mRight + graph_rect.mLeft)/2; y = graph_rect.mBottom + 8; - LLFontGL::sMonospace->renderUTF8(ft_display_table[mHoverIndex].desc, 0, x, y, LLColor4::white, + LLFontGL::sMonospace->renderUTF8(std::string(ft_display_table[mHoverIndex].desc), 0, x, y, LLColor4::white, LLFontGL::LEFT, LLFontGL::BOTTOM); } } @@ -1072,7 +1074,7 @@ void LLFastTimerView::draw() // Output stats for clicked bar to log if (mPrintStats >= 0) { - LLString legend_stat; + std::string legend_stat; S32 stat_num; S32 first = 1; for (stat_num = 0; stat_num < FTV_DISPLAY_NUM; stat_num++) @@ -1086,7 +1088,7 @@ void LLFastTimerView::draw() } llinfos << legend_stat << llendl; - LLString timer_stat; + std::string timer_stat; first = 1; for (stat_num = 0; stat_num < FTV_DISPLAY_NUM; stat_num++) { diff --git a/indra/newview/llfeaturemanager.cpp b/indra/newview/llfeaturemanager.cpp index c24b4c13d9..73d8036122 100644 --- a/indra/newview/llfeaturemanager.cpp +++ b/indra/newview/llfeaturemanager.cpp @@ -75,23 +75,21 @@ const char FEATURE_TABLE_FILENAME[] = "featuretable.txt"; const char GPU_TABLE_FILENAME[] = "gpu_table.txt"; -LLFeatureInfo::LLFeatureInfo(const char *name, const BOOL available, const F32 level) : mValid(TRUE) +LLFeatureInfo::LLFeatureInfo(const std::string& name, const BOOL available, const F32 level) + : mValid(TRUE), mName(name), mAvailable(available), mRecommendedLevel(level) { - mName = name; - mAvailable = available; - mRecommendedLevel = level; } -LLFeatureList::LLFeatureList(const char *name) +LLFeatureList::LLFeatureList(const std::string& name) + : mName(name) { - mName = name; } LLFeatureList::~LLFeatureList() { } -void LLFeatureList::addFeature(const char *name, const BOOL available, const F32 level) +void LLFeatureList::addFeature(const std::string& name, const BOOL available, const F32 level) { if (mFeatures.count(name)) { @@ -102,7 +100,7 @@ void LLFeatureList::addFeature(const char *name, const BOOL available, const F32 mFeatures[name] = fi; } -BOOL LLFeatureList::isFeatureAvailable(const char *name) +BOOL LLFeatureList::isFeatureAvailable(const std::string& name) { if (mFeatures.count(name)) { @@ -116,7 +114,7 @@ BOOL LLFeatureList::isFeatureAvailable(const char *name) return TRUE; } -F32 LLFeatureList::getRecommendedValue(const char *name) +F32 LLFeatureList::getRecommendedValue(const std::string& name) { if (mFeatures.count(name) && isFeatureAvailable(name)) { @@ -188,7 +186,7 @@ void LLFeatureList::dump() LL_DEBUGS("RenderInit") << LL_ENDL; } -LLFeatureList *LLFeatureManager::findMask(const char *name) +LLFeatureList *LLFeatureManager::findMask(const std::string& name) { if (mMaskList.count(name)) { @@ -198,7 +196,7 @@ LLFeatureList *LLFeatureManager::findMask(const char *name) return NULL; } -BOOL LLFeatureManager::maskFeatures(const char *name) +BOOL LLFeatureManager::maskFeatures(const std::string& name) { LLFeatureList *maskp = findMask(name); if (!maskp) @@ -227,12 +225,11 @@ BOOL LLFeatureManager::loadFeatureTables() data_path += FEATURE_TABLE_FILENAME; lldebugs << "Looking for feature table in " << data_path << llendl; - char name[MAX_STRING+1]; /*Flawfinder: ignore*/ - llifstream file; + std::string name; U32 version; - file.open(data_path.c_str()); /*Flawfinder: ignore*/ + file.open(data_path); /*Flawfinder: ignore*/ if (!file) { @@ -243,7 +240,7 @@ BOOL LLFeatureManager::loadFeatureTables() // Check file version file >> name; file >> version; - if (strcmp(name, "version")) + if (name != "version") { LL_WARNS("RenderInit") << data_path << " does not appear to be a valid feature table!" << LL_ENDL; return FALSE; @@ -255,27 +252,24 @@ BOOL LLFeatureManager::loadFeatureTables() while (!file.eof() && file.good()) { char buffer[MAX_STRING]; /*Flawfinder: ignore*/ - name[0] = 0; file >> name; - if (strlen(name) >= 2 && /*Flawfinder: ignore*/ - name[0] == '/' && - name[1] == '/') + if (name.substr(0,2) == "//") { // This is a comment. file.getline(buffer, MAX_STRING); continue; } - if (strlen(name) == 0) /*Flawfinder: ignore*/ + if (name.empty()) { // This is a blank line file.getline(buffer, MAX_STRING); continue; } - if (!strcmp(name, "list")) + if (name == "list") { if (flp) { @@ -323,7 +317,7 @@ void LLFeatureManager::loadGPUClass() llifstream file; - file.open(data_path.c_str()); /*Flawfinder: ignore*/ + file.open(data_path); /*Flawfinder: ignore*/ if (!file) { @@ -491,19 +485,19 @@ void LLFeatureManager::applyFeatures(bool skipFeatures) // handle all the different types if(ctrl->isType(TYPE_BOOLEAN)) { - gSavedSettings.setBOOL(mIt->first, (BOOL)getRecommendedValue(mIt->first.c_str())); + gSavedSettings.setBOOL(mIt->first, (BOOL)getRecommendedValue(mIt->first)); } else if (ctrl->isType(TYPE_S32)) { - gSavedSettings.setS32(mIt->first, (S32)getRecommendedValue(mIt->first.c_str())); + gSavedSettings.setS32(mIt->first, (S32)getRecommendedValue(mIt->first)); } else if (ctrl->isType(TYPE_U32)) { - gSavedSettings.setU32(mIt->first, (U32)getRecommendedValue(mIt->first.c_str())); + gSavedSettings.setU32(mIt->first, (U32)getRecommendedValue(mIt->first)); } else if (ctrl->isType(TYPE_F32)) { - gSavedSettings.setF32(mIt->first, (F32)getRecommendedValue(mIt->first.c_str())); + gSavedSettings.setF32(mIt->first, (F32)getRecommendedValue(mIt->first)); } else { @@ -618,7 +612,7 @@ void LLFeatureManager::applyBaseMasks() } //llinfos << "Masking features from gpu table match: " << gpustr << llendl; - maskFeatures(gpustr.c_str()); + maskFeatures(gpustr); // now mask cpu type ones if (gSysMemory.getPhysicalMemoryClamped() <= 256*1024*1024) diff --git a/indra/newview/llfeaturemanager.h b/indra/newview/llfeaturemanager.h index ffa8420697..e5bf73eb30 100644 --- a/indra/newview/llfeaturemanager.h +++ b/indra/newview/llfeaturemanager.h @@ -50,13 +50,13 @@ class LLFeatureInfo { public: LLFeatureInfo() : mValid(FALSE), mAvailable(FALSE), mRecommendedLevel(-1) {} - LLFeatureInfo(const char *name, const BOOL available, const F32 level); + LLFeatureInfo(const std::string& name, const BOOL available, const F32 level); BOOL isValid() const { return mValid; }; public: BOOL mValid; - LLString mName; + std::string mName; BOOL mAvailable; F32 mRecommendedLevel; }; @@ -65,22 +65,22 @@ public: class LLFeatureList { public: - typedef std::map<LLString, LLFeatureInfo> feature_map_t; + typedef std::map<std::string, LLFeatureInfo> feature_map_t; - LLFeatureList(const char *name = "default"); + LLFeatureList(const std::string& name); virtual ~LLFeatureList(); - BOOL isFeatureAvailable(const char *name); - F32 getRecommendedValue(const char *name); + BOOL isFeatureAvailable(const std::string& name); + F32 getRecommendedValue(const std::string& name); - void setFeatureAvailable(const char *name, const BOOL available); - void setRecommendedLevel(const char *name, const F32 level); + void setFeatureAvailable(const std::string& name, const BOOL available); + void setRecommendedLevel(const std::string& name, const F32 level); BOOL loadFeatureList(LLFILE *fp); BOOL maskList(LLFeatureList &mask); - void addFeature(const char *name, const BOOL available, const F32 level); + void addFeature(const std::string& name, const BOOL available, const F32 level); feature_map_t& getFeatures() { @@ -89,7 +89,7 @@ public: void dump(); protected: - LLString mName; + std::string mName; feature_map_t mFeatures; }; @@ -97,13 +97,16 @@ protected: class LLFeatureManager : public LLFeatureList, public LLSingleton<LLFeatureManager> { public: - LLFeatureManager() : mInited(FALSE), mTableVersion(0), mSafe(FALSE), mGPUClass(GPU_CLASS_UNKNOWN) {} + LLFeatureManager() : + LLFeatureList("default"), mInited(FALSE), mTableVersion(0), mSafe(FALSE), mGPUClass(GPU_CLASS_UNKNOWN) + { + } ~LLFeatureManager() {cleanupFeatureTables();} // initialize this by loading feature table and gpu table void init(); - void maskCurrentList(const char *name); // Mask the current feature list with the named list + void maskCurrentList(const std::string& name); // Mask the current feature list with the named list BOOL loadFeatureTables(); @@ -117,8 +120,8 @@ public: void setSafe(const BOOL safe) { mSafe = safe; } BOOL isSafe() const { return mSafe; } - LLFeatureList *findMask(const char *name); - BOOL maskFeatures(const char *name); + LLFeatureList *findMask(const std::string& name); + BOOL maskFeatures(const std::string& name); // set the graphics to low, medium, high, or ultra. // skipFeatures forces skipping of mostly hardware settings @@ -138,8 +141,8 @@ protected: void initBaseMask(); - std::map<LLString, LLFeatureList *> mMaskList; - std::set<LLString> mSkippedFeatures; + std::map<std::string, LLFeatureList *> mMaskList; + std::set<std::string> mSkippedFeatures; BOOL mInited; S32 mTableVersion; BOOL mSafe; // Reinitialize everything to the "safe" mask diff --git a/indra/newview/llfilepicker.cpp b/indra/newview/llfilepicker.cpp index 4c387a3b6d..344917150f 100644 --- a/indra/newview/llfilepicker.cpp +++ b/indra/newview/llfilepicker.cpp @@ -63,12 +63,14 @@ LLFilePicker LLFilePicker::sInstance; // // Implementation // -#if LL_WINDOWS +LLFilePicker::LLFilePicker() + : mCurrentFile(0), + mLocked(FALSE) -LLFilePicker::LLFilePicker() { reset(); +#if LL_WINDOWS mOFN.lStructSize = sizeof(OPENFILENAMEW); mOFN.hwndOwner = NULL; // Set later mOFN.hInstance = NULL; @@ -87,6 +89,16 @@ LLFilePicker::LLFilePicker() mOFN.lCustData = 0L; mOFN.lpfnHook = NULL; mOFN.lpTemplateName = NULL; +#endif + +#if LL_DARWIN + memset(&mNavOptions, 0, sizeof(mNavOptions)); + OSStatus error = NavGetDefaultDialogCreationOptions(&mNavOptions); + if (error == noErr) + { + mNavOptions.modality = kWindowModalityAppModal; + } +#endif } LLFilePicker::~LLFilePicker() @@ -94,6 +106,48 @@ LLFilePicker::~LLFilePicker() // nothing } + +const std::string LLFilePicker::getFirstFile() +{ + mCurrentFile = 0; + return getNextFile(); +} + +const std::string LLFilePicker::getNextFile() +{ + if (mCurrentFile >= (S32)mFiles.size()) + { + mLocked = FALSE; + return std::string(); + } + else + { + return mFiles[mCurrentFile++]; + } +} + +const std::string LLFilePicker::getCurFile() +{ + if (mCurrentFile >= (S32)mFiles.size()) + { + mLocked = FALSE; + return std::string(); + } + else + { + return mFiles[mCurrentFile]; + } +} + +void LLFilePicker::reset() +{ + mLocked = FALSE; + mFiles.clear(); + mCurrentFile = 0; +} + +#if LL_WINDOWS + BOOL LLFilePicker::setupFilter(ELoadFilter filter) { BOOL res = TRUE; @@ -150,7 +204,6 @@ BOOL LLFilePicker::getOpenFile(ELoadFilter filter) return FALSE; } BOOL success = FALSE; - mMultiFile = FALSE; // don't provide default file selection mFilesW[0] = '\0'; @@ -165,13 +218,15 @@ BOOL LLFilePicker::getOpenFile(ELoadFilter filter) // Modal, so pause agent send_agent_pause(); + + reset(); + // NOTA BENE: hitting the file dialog triggers a window focus event, destroying the selection manager!! success = GetOpenFileName(&mOFN); if (success) { - LLString tstr = utf16str_to_utf8str(llutf16string(mFilesW)); - memcpy(mFiles, tstr.c_str(), tstr.size()+1); /*Flawfinder: ignore*/ - mCurrentFile = mFiles; + std::string filename = utf16str_to_utf8str(llutf16string(mFilesW)); + mFiles.push_back(filename); } send_agent_resume(); @@ -187,7 +242,6 @@ BOOL LLFilePicker::getMultipleOpenFiles(ELoadFilter filter) return FALSE; } BOOL success = FALSE; - mMultiFile = FALSE; // don't provide default file selection mFilesW[0] = '\0'; @@ -200,6 +254,8 @@ BOOL LLFilePicker::getMultipleOpenFiles(ELoadFilter filter) OFN_EXPLORER | OFN_ALLOWMULTISELECT; setupFilter(filter); + + reset(); // Modal, so pause agent send_agent_pause(); @@ -212,31 +268,26 @@ BOOL LLFilePicker::getMultipleOpenFiles(ELoadFilter filter) // lengths. if( wcslen(mOFN.lpstrFile) > mOFN.nFileOffset ) /*Flawfinder: ignore*/ { - mMultiFile = FALSE; - mCurrentFile = mFiles; - LLString tstr = utf16str_to_utf8str(llutf16string(mFilesW)); - memcpy(mFiles, tstr.c_str(), tstr.size()+1); /*Flawfinder: ignore*/ - - mCurrentFile = &mFiles[mOFN.nFileOffset]; + std::string filename = utf16str_to_utf8str(llutf16string(mFilesW)); + mFiles.push_back(filename); } else { - mMultiFile = TRUE; - mCurrentFile = 0; mLocked = TRUE; WCHAR* tptrw = mFilesW; - char* tptr = mFiles; - memset( mFiles, 0, FILENAME_BUFFER_SIZE ); + std::string dirname; while(1) { if (*tptrw == 0 && *(tptrw+1) == 0) // double '\0' break; - if (*tptrw == 0 && !mCurrentFile) - mCurrentFile = tptr+1; - S32 tlen16,tlen8; - tlen16 = utf16chars_to_utf8chars(tptrw, tptr, &tlen8); - tptrw += tlen16; - tptr += tlen8; + if (*tptrw == 0) + tptrw++; // shouldn't happen? + std::string filename = utf16str_to_utf8str(llutf16string(tptrw)); + if (dirname.empty()) + dirname = filename + "\\"; + else + mFiles.push_back(dirname + filename); + tptrw += filename.size(); } } } @@ -247,17 +298,16 @@ BOOL LLFilePicker::getMultipleOpenFiles(ELoadFilter filter) return success; } -BOOL LLFilePicker::getSaveFile(ESaveFilter filter, const char* filename) +BOOL LLFilePicker::getSaveFile(ESaveFilter filter, const std::string& filename) { if( mLocked ) { return FALSE; } BOOL success = FALSE; - mMultiFile = FALSE; mOFN.lpstrFile = mFilesW; - if (filename) + if (!filename.empty()) { llutf16string tstring = utf8str_to_utf16str(filename); wcsncpy(mFilesW, tstring.c_str(), FILENAME_BUFFER_SIZE); } /*Flawfinder: ignore*/ @@ -278,7 +328,7 @@ BOOL LLFilePicker::getSaveFile(ESaveFilter filter, const char* filename) L"\0"; break; case FFSAVE_WAV: - if (!filename) + if (filename.empty()) { wcsncpy( mFilesW,L"untitled.wav", FILENAME_BUFFER_SIZE); /*Flawfinder: ignore*/ } @@ -288,7 +338,7 @@ BOOL LLFilePicker::getSaveFile(ESaveFilter filter, const char* filename) L"\0"; break; case FFSAVE_TGA: - if (!filename) + if (filename.empty()) { wcsncpy( mFilesW,L"untitled.tga", FILENAME_BUFFER_SIZE); /*Flawfinder: ignore*/ } @@ -298,7 +348,7 @@ BOOL LLFilePicker::getSaveFile(ESaveFilter filter, const char* filename) L"\0"; break; case FFSAVE_BMP: - if (!filename) + if (filename.empty()) { wcsncpy( mFilesW,L"untitled.bmp", FILENAME_BUFFER_SIZE); /*Flawfinder: ignore*/ } @@ -308,7 +358,7 @@ BOOL LLFilePicker::getSaveFile(ESaveFilter filter, const char* filename) L"\0"; break; case FFSAVE_AVI: - if (!filename) + if (filename.empty()) { wcsncpy( mFilesW,L"untitled.avi", FILENAME_BUFFER_SIZE); /*Flawfinder: ignore*/ } @@ -318,7 +368,7 @@ BOOL LLFilePicker::getSaveFile(ESaveFilter filter, const char* filename) L"\0"; break; case FFSAVE_ANIM: - if (!filename) + if (filename.empty()) { wcsncpy( mFilesW,L"untitled.xaf", FILENAME_BUFFER_SIZE); /*Flawfinder: ignore*/ } @@ -329,7 +379,7 @@ BOOL LLFilePicker::getSaveFile(ESaveFilter filter, const char* filename) break; #ifdef _CORY_TESTING case FFSAVE_GEOMETRY: - if (!filename) + if (filename.empty()) { wcsncpy( mFilesW,L"untitled.slg", FILENAME_BUFFER_SIZE); /*Flawfinder: ignore*/ } @@ -340,7 +390,7 @@ BOOL LLFilePicker::getSaveFile(ESaveFilter filter, const char* filename) break; #endif case FFSAVE_XML: - if (!filename) + if (filename.empty()) { wcsncpy( mFilesW,L"untitled.xml", FILENAME_BUFFER_SIZE); /*Flawfinder: ignore*/ } @@ -351,7 +401,7 @@ BOOL LLFilePicker::getSaveFile(ESaveFilter filter, const char* filename) L"\0"; break; case FFSAVE_COLLADA: - if (!filename) + if (filename.empty()) { wcsncpy( mFilesW,L"untitled.collada", FILENAME_BUFFER_SIZE); /*Flawfinder: ignore*/ } @@ -361,7 +411,7 @@ BOOL LLFilePicker::getSaveFile(ESaveFilter filter, const char* filename) L"\0"; break; case FFSAVE_RAW: - if (!filename) + if (filename.empty()) { wcsncpy( mFilesW,L"untitled.raw", FILENAME_BUFFER_SIZE); /*Flawfinder: ignore*/ } @@ -370,7 +420,7 @@ BOOL LLFilePicker::getSaveFile(ESaveFilter filter, const char* filename) L"\0"; break; case FFSAVE_J2C: - if (!filename) + if (filename.empty()) { wcsncpy( mFilesW,L"untitled.j2c", FILENAME_BUFFER_SIZE); } @@ -387,6 +437,8 @@ BOOL LLFilePicker::getSaveFile(ESaveFilter filter, const char* filename) mOFN.nMaxFile = SINGLE_FILENAME_BUFFER_SIZE; mOFN.Flags = OFN_OVERWRITEPROMPT | OFN_NOCHANGEDIR | OFN_PATHMUSTEXIST; + reset(); + // Modal, so pause agent send_agent_pause(); { @@ -394,9 +446,8 @@ BOOL LLFilePicker::getSaveFile(ESaveFilter filter, const char* filename) success = GetSaveFileName(&mOFN); if (success) { - LLString tstr = utf16str_to_utf8str(llutf16string(mFilesW)); - memcpy(mFiles, tstr.c_str(), tstr.size()+1); /*Flawfinder: ignore*/ - mCurrentFile = mFiles; + std::string filename = utf16str_to_utf8str(llutf16string(mFilesW)); + mFiles.push_back(filename); } gKeyboard->resetKeys(); } @@ -407,84 +458,8 @@ BOOL LLFilePicker::getSaveFile(ESaveFilter filter, const char* filename) return success; } -const char* LLFilePicker::getFirstFile() -{ - if(mMultiFile) - { - buildFilename(); - return mFilename; - } - return mFiles; -} - -const char* LLFilePicker::getNextFile() -{ - if(mMultiFile) - { - mCurrentFile += strlen(mCurrentFile) + 1; /*Flawfinder: ignore*/ - if( '\0' != mCurrentFile[0] ) - { - buildFilename(); - return mFilename; - } - else - { - mLocked = FALSE; - } - } - return NULL; -} - -const char* LLFilePicker::getDirname() -{ - if( '\0' != mCurrentFile[0] ) - { - return mCurrentFile; - } - return NULL; -} - -void LLFilePicker::reset() -{ - mLocked = FALSE; - memset( mFiles, 0, FILENAME_BUFFER_SIZE ); - memset( mFilename, 0, LL_MAX_PATH ); - mCurrentFile = mFiles; -} - -void LLFilePicker::buildFilename( void ) -{ - strncpy( mFilename, mFiles, LL_MAX_PATH ); - mFilename[LL_MAX_PATH-1] = '\0'; // stupid strncpy - S32 len = strlen( mFilename ); - - strncat(mFilename,gDirUtilp->getDirDelimiter().c_str(), sizeof(mFilename)-len+1); /*Flawfinder: ignore*/ - len += strlen(gDirUtilp->getDirDelimiter().c_str()); /*Flawfinder: ignore*/ - -// mFilename[len++] = '\\'; - LLString::copy( mFilename + len, mCurrentFile, LL_MAX_PATH - len ); -} - #elif LL_DARWIN -LLFilePicker::LLFilePicker() -{ - reset(); - - memset(&mNavOptions, 0, sizeof(mNavOptions)); - OSStatus error = NavGetDefaultDialogCreationOptions(&mNavOptions); - if (error == noErr) - { - mNavOptions.modality = kWindowModalityAppModal; - } - mFileIndex = 0; -} - -LLFilePicker::~LLFilePicker() -{ - // nothing -} - Boolean LLFilePicker::navOpenFilterProc(AEDesc *theItem, void *info, void *callBackUD, NavFilterModes filterMode) { Boolean result = true; @@ -589,8 +564,6 @@ OSStatus LLFilePicker::doNavChooseDialog(ELoadFilter filter) NavReplyRecord navReply; memset(&navReply, 0, sizeof(navReply)); - mFiles[0] = '\0'; - mFileVector.clear(); // NOTE: we are passing the address of a local variable here. // This is fine, because the object this call creates will exist for less than the lifetime of this function. @@ -632,22 +605,20 @@ OSStatus LLFilePicker::doNavChooseDialog(ELoadFilter filter) error = FSRefMakePath(&fsRef, (UInt8*) path, sizeof(path)); if (error == noErr) - mFileVector.push_back(LLString(path)); + mFiles.push_back(std::string(path)); } } return error; } -OSStatus LLFilePicker::doNavSaveDialog(ESaveFilter filter, const char* filename) +OSStatus LLFilePicker::doNavSaveDialog(ESaveFilter filter, const std::string& filename) { OSStatus error = noErr; NavDialogRef navRef = NULL; NavReplyRecord navReply; memset(&navReply, 0, sizeof(navReply)); - mFiles[0] = '\0'; - mFileVector.clear(); // Setup the type, creator, and extension OSType type, creator; @@ -719,8 +690,8 @@ OSStatus LLFilePicker::doNavSaveDialog(ESaveFilter filter, const char* filename) bool hasExtension = true; // Create a CFString of the initial file name - if (filename) - nameString = CFStringCreateWithCString(NULL, filename, kCFStringEncodingUTF8); + if (!filename.empty()) + nameString = CFStringCreateWithCString(NULL, filename.c_str(), kCFStringEncodingUTF8); else nameString = CFSTR("Untitled"); @@ -786,7 +757,7 @@ OSStatus LLFilePicker::doNavSaveDialog(ESaveFilter filter, const char* filename) { if (CFStringGetCString(navReply.saveFileName, newFileName, sizeof(newFileName), kCFStringEncodingUTF8)) { - mFileVector.push_back(LLString(path) + LLString("/") + LLString(newFileName)); + mFiles.push_back(std::string(path) + "/" + std::string(newFileName)); } else { @@ -806,13 +777,15 @@ OSStatus LLFilePicker::doNavSaveDialog(ESaveFilter filter, const char* filename) BOOL LLFilePicker::getOpenFile(ELoadFilter filter) { - if( mLocked ) return FALSE; - mMultiFile = FALSE; + if( mLocked ) + return FALSE; + BOOL success = FALSE; OSStatus error = noErr; - mFileVector.clear(); + reset(); + mNavOptions.optionFlags &= ~kNavAllowMultipleFiles; // Modal, so pause agent send_agent_pause(); @@ -822,7 +795,7 @@ BOOL LLFilePicker::getOpenFile(ELoadFilter filter) send_agent_resume(); if (error == noErr) { - if (mFileVector.size()) + if (mFiles.size()) success = true; } @@ -833,13 +806,15 @@ BOOL LLFilePicker::getOpenFile(ELoadFilter filter) BOOL LLFilePicker::getMultipleOpenFiles(ELoadFilter filter) { - if( mLocked ) return FALSE; - mMultiFile = TRUE; + if( mLocked ) + return FALSE; + BOOL success = FALSE; OSStatus error = noErr; + + reset(); - mFileVector.clear(); mNavOptions.optionFlags |= kNavAllowMultipleFiles; // Modal, so pause agent send_agent_pause(); @@ -849,9 +824,9 @@ BOOL LLFilePicker::getMultipleOpenFiles(ELoadFilter filter) send_agent_resume(); if (error == noErr) { - if (mFileVector.size()) + if (mFiles.size()) success = true; - if (mFileVector.size() > 1) + if (mFiles.size() > 1) mLocked = TRUE; } @@ -860,38 +835,15 @@ BOOL LLFilePicker::getMultipleOpenFiles(ELoadFilter filter) return success; } -void LLFilePicker::getFilePath(SInt32 index) -{ - mFiles[0] = 0; - if (mFileVector.size()) - { - strncpy(mFiles, mFileVector[index].c_str(), sizeof(mFiles)); - mFiles[sizeof(mFiles)-1] = '\0'; // stupid strncpy - } -} - -void LLFilePicker::getFileName(SInt32 index) +BOOL LLFilePicker::getSaveFile(ESaveFilter filter, const std::string& filename) { - mFilename[0] = 0; - if (mFileVector.size()) - { - char *start = strrchr(mFileVector[index].c_str(), '/'); - if (start && ((start + 1 - mFileVector[index].c_str()) < (mFileVector[index].size()))) - { - strncpy(mFilename, start + 1, sizeof(mFilename)); - mFilename[sizeof(mFilename)-1] = '\0';// stupid strncpy - } - } -} - -BOOL LLFilePicker::getSaveFile(ESaveFilter filter, const char* filename) -{ - if( mLocked ) return FALSE; + if( mLocked ) + return FALSE; BOOL success = FALSE; OSStatus error = noErr; - mFileVector.clear(); - mMultiFile = FALSE; + reset(); + mNavOptions.optionFlags &= ~kNavAllowMultipleFiles; // Modal, so pause agent @@ -902,7 +854,7 @@ BOOL LLFilePicker::getSaveFile(ESaveFilter filter, const char* filename) send_agent_resume(); if (error == noErr) { - if (mFileVector.size()) + if (mFiles.size()) success = true; } @@ -911,98 +863,38 @@ BOOL LLFilePicker::getSaveFile(ESaveFilter filter, const char* filename) return success; } -const char* LLFilePicker::getFirstFile() -{ - mFileIndex = 0; - getFilePath(mFileIndex); - return mFiles; -} - -const char* LLFilePicker::getNextFile() -{ - if(mMultiFile) - { - mFileIndex++; - if (mFileIndex < mFileVector.size()) - { - getFilePath(mFileIndex); - return mFiles; - } - else - { - mLocked = FALSE; - } - } - return NULL; -} - -const char* LLFilePicker::getDirname() -{ - if (mFileIndex < mFileVector.size()) - { - getFileName(mFileIndex); - return mFilename; - } - return NULL; -} - -void LLFilePicker::reset() -{ - mLocked = FALSE; - memset( mFiles, 0, FILENAME_BUFFER_SIZE ); - memset( mFilename, 0, LL_MAX_PATH ); - mCurrentFile = mFiles; - - mFileIndex = 0; - mFileVector.clear(); -} - #elif LL_LINUX # if LL_GTK -// This caches the previously-accessed path for a given context of the file -// chooser, for user convenience. -std::map <std::string, std::string> LLFilePicker::sContextToPathMap; -LLFilePicker::LLFilePicker() +// static +void LLFilePicker::add_to_selectedfiles(gpointer data, gpointer user_data) { - reset(); -} - -LLFilePicker::~LLFilePicker() -{ -} - - -static void add_to_sfs(gpointer data, gpointer user_data) -{ - StoreFilenamesStruct *sfs = (StoreFilenamesStruct*) user_data; + LLFilePicker* picker = (LLFilePicker*) user_data; gchar* filename_utf8 = g_filename_to_utf8((gchar*)data, - -1, NULL, - NULL, - NULL); - sfs->fileVector.push_back(LLString(filename_utf8)); + -1, NULL, NULL, NULL); + picker->mFiles.push_back(std::string(filename_utf8)); + lldebugs << "ADDED FILE " << filename_utf8 << llendl; g_free(filename_utf8); } - -void chooser_responder(GtkWidget *widget, - gint response, - gpointer user_data) { - StoreFilenamesStruct *sfs = (StoreFilenamesStruct*) user_data; +// static +void LLFilePicker::chooser_responder(GtkWidget *widget, gint response, gpointer user_data) +{ + LLFilePicker* picker = (LLFilePicker*)user_data; lldebugs << "GTK DIALOG RESPONSE " << response << llendl; if (response == GTK_RESPONSE_ACCEPT) { GSList *file_list = gtk_file_chooser_get_filenames(GTK_FILE_CHOOSER(widget)); - g_slist_foreach(file_list, (GFunc)add_to_sfs, sfs); + g_slist_foreach(file_list, (GFunc)add_to_selectedfiles, user_data); g_slist_foreach(file_list, (GFunc)g_free, NULL); g_slist_free (file_list); } // set the default path for this usage context. - LLFilePicker::sContextToPathMap[sfs->contextName] = + picker->mContextToPathMap[picker->mCurContextName] = gtk_file_chooser_get_current_folder(GTK_FILE_CHOOSER(widget)); gtk_widget_destroy(widget); @@ -1010,8 +902,7 @@ void chooser_responder(GtkWidget *widget, } -GtkWindow* LLFilePicker::buildFilePicker(bool is_save, bool is_folder, - std::string context) +GtkWindow* LLFilePicker::buildFilePicker(bool is_save, bool is_folder, std::string context) { if (ll_try_gtk_init() && ! gViewerWindow->getWindow()->getFullscreen()) @@ -1037,14 +928,13 @@ GtkWindow* LLFilePicker::buildFilePicker(bool is_save, bool is_folder, GTK_STOCK_OPEN), GTK_RESPONSE_ACCEPT, (gchar *)NULL); - mStoreFilenames.win = win; - mStoreFilenames.contextName = context; + mCurContextName = context; // get the default path for this usage context if it's been // seen before. std::map<std::string,std::string>::iterator - this_path = sContextToPathMap.find(context); - if (this_path != sContextToPathMap.end()) + this_path = mContextToPathMap.find(context); + if (this_path != mContextToPathMap.end()) { gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER(win), @@ -1071,8 +961,8 @@ GtkWindow* LLFilePicker::buildFilePicker(bool is_save, bool is_folder, g_signal_connect (GTK_FILE_CHOOSER(win), "response", - G_CALLBACK(chooser_responder), - &mStoreFilenames); + G_CALLBACK(LLFilePicker::chooser_responder), + this); gtk_window_set_modal(GTK_WINDOW(win), TRUE); @@ -1147,13 +1037,14 @@ static std::string add_imageload_filter_to_gtkchooser(GtkWindow *picker) } -BOOL LLFilePicker::getSaveFile( ESaveFilter filter, const char* filename ) +BOOL LLFilePicker::getSaveFile( ESaveFilter filter, const std::string& filename ) { BOOL rtn = FALSE; gViewerWindow->mWindow->beforeDialog(); reset(); + GtkWindow* picker = buildFilePicker(true, false, "savefile"); if (picker) @@ -1210,7 +1101,7 @@ BOOL LLFilePicker::getSaveFile( ESaveFilter filter, const char* filename ) gtk_window_set_title(GTK_WINDOW(picker), caption.c_str()); - if (!filename) + if (filename.empty()) { suggest_name += suggest_ext; @@ -1221,13 +1112,13 @@ BOOL LLFilePicker::getSaveFile( ESaveFilter filter, const char* filename ) else { gtk_file_chooser_set_current_name - (GTK_FILE_CHOOSER(picker), filename); + (GTK_FILE_CHOOSER(picker), filename.c_str()); } gtk_widget_show_all(GTK_WIDGET(picker)); gtk_main(); - rtn = (mStoreFilenames.fileVector.size() == 1); + rtn = (mFiles.size() == 1); } gViewerWindow->mWindow->afterDialog(); @@ -1242,6 +1133,7 @@ BOOL LLFilePicker::getOpenFile( ELoadFilter filter ) gViewerWindow->mWindow->beforeDialog(); reset(); + GtkWindow* picker = buildFilePicker(false, false, "openfile"); if (picker) @@ -1270,7 +1162,7 @@ BOOL LLFilePicker::getOpenFile( ELoadFilter filter ) gtk_widget_show_all(GTK_WIDGET(picker)); gtk_main(); - rtn = (mStoreFilenames.fileVector.size() == 1); + rtn = (mFiles.size() == 1); } gViewerWindow->mWindow->afterDialog(); @@ -1285,6 +1177,7 @@ BOOL LLFilePicker::getMultipleOpenFiles( ELoadFilter filter ) gViewerWindow->mWindow->beforeDialog(); reset(); + GtkWindow* picker = buildFilePicker(false, false, "openfile"); if (picker) @@ -1296,7 +1189,7 @@ BOOL LLFilePicker::getMultipleOpenFiles( ELoadFilter filter ) gtk_widget_show_all(GTK_WIDGET(picker)); gtk_main(); - rtn = !mStoreFilenames.fileVector.empty(); + rtn = !mFiles.empty(); } gViewerWindow->mWindow->afterDialog(); @@ -1304,178 +1197,69 @@ BOOL LLFilePicker::getMultipleOpenFiles( ELoadFilter filter ) return rtn; } -const char* LLFilePicker::getFirstFile() -{ - mNextFileIndex = 0; - return getNextFile(); -} - -const char* LLFilePicker::getNextFile() -{ - if (mStoreFilenames.fileVector.size() > mNextFileIndex) - return mStoreFilenames.fileVector[mNextFileIndex++].c_str(); - else - return NULL; -} - -const char* LLFilePicker::getDirname() -{ - // getDirname is badly named... it really means getBasename. - S32 index = mNextFileIndex - 1; // want index before the 'next' cursor - if (index >= 0 && index < (S32)mStoreFilenames.fileVector.size()) - { - // we do this using C strings so we don't have to - // convert a LLString/std::string character offset into a - // byte-offset for the return (which is a C string anyway). - const char* dirsep = gDirUtilp->getDirDelimiter().c_str(); - const char* fullpath = mStoreFilenames.fileVector[index].c_str(); - const char* finalpart = NULL; - const char* thispart = fullpath; - // (Hmm, is the strstr of dirsep UTF-8-correct? Yes, reckon.) - // Walk through the string looking for the final dirsep, i.e. / - do - { - thispart = strstr(thispart, dirsep); - if (NULL != thispart) - finalpart = thispart = &thispart[1]; - } - while (NULL != thispart); - return finalpart; - } - else - return NULL; -} - -void LLFilePicker::reset() -{ - mNextFileIndex = 0; - mStoreFilenames.win = NULL; - mStoreFilenames.fileVector.clear(); -} - # else // LL_GTK // Hacky stubs designed to facilitate fake getSaveFile and getOpenFile with // static results, when we don't have a real filepicker. -static LLString hackyfilename; - -LLFilePicker::LLFilePicker() +BOOL LLFilePicker::getSaveFile( ESaveFilter filter, const std::string& filename ) { reset(); -} - -LLFilePicker::~LLFilePicker() -{ -} - -BOOL LLFilePicker::getSaveFile( ESaveFilter filter, const char* filename ) -{ + llinfos << "getSaveFile suggested filename is [" << filename << "]" << llendl; - if (filename && filename[0]) + if (!filename.empty()) { - hackyfilename.assign(gDirUtilp->getLindenUserDir()); - hackyfilename += gDirUtilp->getDirDelimiter(); - hackyfilename += filename; + mFiles.push_back(gDirUtilp->getLindenUserDir() + gDirUtilp->getDirDelimiter() + filename); return TRUE; } - hackyfilename.clear(); return FALSE; } BOOL LLFilePicker::getOpenFile( ELoadFilter filter ) { + reset(); + // HACK: Static filenames for 'open' until we implement filepicker - hackyfilename.assign(gDirUtilp->getLindenUserDir()); - hackyfilename += gDirUtilp->getDirDelimiter(); - hackyfilename += "upload"; + std::string filename = gDirUtilp->getLindenUserDir() + gDirUtilp->getDirDelimiter() + "upload"; switch (filter) { - case FFLOAD_WAV: hackyfilename += ".wav"; break; - case FFLOAD_IMAGE: hackyfilename += ".tga"; break; - case FFLOAD_ANIM: hackyfilename += ".bvh"; break; + case FFLOAD_WAV: filename += ".wav"; break; + case FFLOAD_IMAGE: filename += ".tga"; break; + case FFLOAD_ANIM: filename += ".bvh"; break; default: break; } - llinfos << "getOpenFile: Will try to open file: " << hackyfilename - << llendl; + mFiles.push_back(filename); + llinfos << "getOpenFile: Will try to open file: " << hackyfilename << llendl; return TRUE; } BOOL LLFilePicker::getMultipleOpenFiles( ELoadFilter filter ) { - hackyfilename.clear(); + reset(); return FALSE; } -const char* LLFilePicker::getFirstFile() -{ - if (!hackyfilename.empty()) - { - return hackyfilename.c_str(); - } - return NULL; -} - -const char* LLFilePicker::getNextFile() -{ - hackyfilename.clear(); - return NULL; -} - -const char* LLFilePicker::getDirname() -{ - return NULL; -} - -void LLFilePicker::reset() -{ -} #endif // LL_GTK #else // not implemented -LLFilePicker::LLFilePicker() -{ - reset(); -} - -LLFilePicker::~LLFilePicker() -{ -} - -BOOL LLFilePicker::getSaveFile( ESaveFilter filter, const char* filename ) +BOOL LLFilePicker::getSaveFile( ESaveFilter filter, const std::string& filename ) { + reset(); return FALSE; } BOOL LLFilePicker::getOpenFile( ELoadFilter filter ) { + reset(); return FALSE; } BOOL LLFilePicker::getMultipleOpenFiles( ELoadFilter filter ) { + reset(); return FALSE; } -const char* LLFilePicker::getFirstFile() -{ - return NULL; -} - -const char* LLFilePicker::getNextFile() -{ - return NULL; -} - -const char* LLFilePicker::getDirname() -{ - return NULL; -} - -void LLFilePicker::reset() -{ -} - #endif diff --git a/indra/newview/llfilepicker.h b/indra/newview/llfilepicker.h index d4b0ebe321..012524a541 100644 --- a/indra/newview/llfilepicker.h +++ b/indra/newview/llfilepicker.h @@ -68,15 +68,6 @@ #include "SDL/SDL_syswm.h" #endif -#if LL_GTK -// we use an aggregate structure so we can pass its pointer through a C callback -typedef struct { - GtkWidget *win; - std::vector<LLString> fileVector; - std::string contextName; -} StoreFilenamesStruct; -#endif // LL_GTK - class LLFilePicker { #ifdef LL_GTK @@ -119,25 +110,26 @@ public: }; // open the dialog. This is a modal operation - BOOL getSaveFile( ESaveFilter filter = FFSAVE_ALL, const char* filename = NULL ); + BOOL getSaveFile( ESaveFilter filter = FFSAVE_ALL, const std::string& filename = LLStringUtil::null ); BOOL getOpenFile( ELoadFilter filter = FFLOAD_ALL ); BOOL getMultipleOpenFiles( ELoadFilter filter = FFLOAD_ALL ); // Get the filename(s) found. getFirstFile() sets the pointer to // the start of the structure and allows the start of iteration. - const char* getFirstFile(); + const std::string getFirstFile(); // getNextFile() increments the internal representation and // returns the next file specified by the user. Returns NULL when // no more files are left. Further calls to getNextFile() are // undefined. - const char* getNextFile(); + const std::string getNextFile(); - // This utility function extracts the directory name but doesn't - // do any incrementing. This is currently only supported when - // you're opening multiple files. - const char* getDirname(); + // This utility function extracts the current file name without + // doing any incrementing. + const std::string getCurFile(); + // See llvfs/lldir.h : getBaseFileName and getDirName to extract base or directory names + // clear any lists of buffers or whatever, and make sure the file // picker isn't locked. void reset(); @@ -150,11 +142,8 @@ private: FILENAME_BUFFER_SIZE = 65000 }; - void buildFilename( void ); - #if LL_WINDOWS OPENFILENAMEW mOFN; // for open and save dialogs - char *mOpenFilter; WCHAR mFilesW[FILENAME_BUFFER_SIZE]; BOOL setupFilter(ELoadFilter filter); @@ -162,26 +151,26 @@ private: #if LL_DARWIN NavDialogCreationOptions mNavOptions; - std::vector<LLString> mFileVector; + std::vector<std::string> mFileVector; UInt32 mFileIndex; OSStatus doNavChooseDialog(ELoadFilter filter); - OSStatus doNavSaveDialog(ESaveFilter filter, const char* filename); + OSStatus doNavSaveDialog(ESaveFilter filter, const std::string& filename); void getFilePath(SInt32 index); void getFileName(SInt32 index); static Boolean navOpenFilterProc(AEDesc *theItem, void *info, void *callBackUD, NavFilterModes filterMode); #endif #if LL_GTK - StoreFilenamesStruct mStoreFilenames; - U32 mNextFileIndex; + static void add_to_selectedfiles(gpointer data, gpointer user_data); + static void chooser_responder(GtkWidget *widget, gint response, gpointer user_data); // we remember the last path that was accessed for a particular usage - static std::map <std::string, std::string> sContextToPathMap; + std::map <std::string, std::string> mContextToPathMap; + std::string mCurContextName; #endif - char mFiles[FILENAME_BUFFER_SIZE]; /*Flawfinder: ignore*/ - char mFilename[LL_MAX_PATH]; /*Flawfinder: ignore*/ - char* mCurrentFile; + std::vector<std::string> mFiles; + S32 mCurrentFile; BOOL mLocked; BOOL mMultiFile; diff --git a/indra/newview/llfirstuse.cpp b/indra/newview/llfirstuse.cpp index 3cd1158ec0..6c956a1ed0 100644 --- a/indra/newview/llfirstuse.cpp +++ b/indra/newview/llfirstuse.cpp @@ -44,10 +44,10 @@ #include "llappviewer.h" // static -std::set<LLString> LLFirstUse::sConfigVariables; +std::set<std::string> LLFirstUse::sConfigVariables; // static -void LLFirstUse::addConfigVariable(const LLString& var) +void LLFirstUse::addConfigVariable(const std::string& var) { //Don't add the warning, now that we're storing the default in the settings_default.xml file //gSavedSettings.addWarning(var); @@ -58,7 +58,7 @@ void LLFirstUse::addConfigVariable(const LLString& var) void LLFirstUse::disableFirstUse() { // Set all first-use warnings to disabled - for (std::set<LLString>::iterator iter = sConfigVariables.begin(); + for (std::set<std::string>::iterator iter = sConfigVariables.begin(); iter != sConfigVariables.end(); ++iter) { gSavedSettings.setWarning(*iter, FALSE); @@ -69,7 +69,7 @@ void LLFirstUse::disableFirstUse() void LLFirstUse::resetFirstUse() { // Set all first-use warnings to disabled - for (std::set<LLString>::iterator iter = sConfigVariables.begin(); + for (std::set<std::string>::iterator iter = sConfigVariables.begin(); iter != sConfigVariables.end(); ++iter) { gSavedSettings.setWarning(*iter, TRUE); @@ -84,7 +84,7 @@ void LLFirstUse::useBalanceIncrease(S32 delta) { gSavedSettings.setWarning("FirstBalanceIncrease", FALSE); - LLString::format_map_t args; + LLStringUtil::format_map_t args; args["[AMOUNT]"] = llformat("%d",delta); LLNotifyBox::showXml("FirstBalanceIncrease", args); } @@ -98,7 +98,7 @@ void LLFirstUse::useBalanceDecrease(S32 delta) { gSavedSettings.setWarning("FirstBalanceDecrease", FALSE); - LLString::format_map_t args; + LLStringUtil::format_map_t args; args["[AMOUNT]"] = llformat("%d",-delta); LLNotifyBox::showXml("FirstBalanceDecrease", args); } @@ -220,7 +220,7 @@ void LLFirstUse::useSandbox() { gSavedSettings.setWarning("FirstSandbox", FALSE); - LLString::format_map_t args; + LLStringUtil::format_map_t args; args["[HOURS]"] = llformat("%d",SANDBOX_CLEAN_FREQ); args["[TIME]"] = llformat("%d",SANDBOX_FIRST_CLEAN_HOUR); LLNotifyBox::showXml("FirstSandbox", args); diff --git a/indra/newview/llfirstuse.h b/indra/newview/llfirstuse.h index 92c3da6f44..7747c0f177 100644 --- a/indra/newview/llfirstuse.h +++ b/indra/newview/llfirstuse.h @@ -79,7 +79,7 @@ class LLFirstUse { public: // Add a config variable to be reset on resetFirstUse() - static void addConfigVariable(const LLString& var); + static void addConfigVariable(const std::string& var); // Sets all controls back to show the dialogs. static void disableFirstUse(); @@ -107,7 +107,7 @@ public: static void useMedia(); protected: - static std::set<LLString> sConfigVariables; + static std::set<std::string> sConfigVariables; }; #endif diff --git a/indra/newview/llfloaterabout.cpp b/indra/newview/llfloaterabout.cpp index 62fe68f67a..9746b06500 100644 --- a/indra/newview/llfloaterabout.cpp +++ b/indra/newview/llfloaterabout.cpp @@ -68,19 +68,19 @@ LLFloaterAbout* LLFloaterAbout::sInstance = NULL; // Default constructor LLFloaterAbout::LLFloaterAbout() -: LLFloater("floater_about", "FloaterAboutRect", "") +: LLFloater(std::string("floater_about"), std::string("FloaterAboutRect"), LLStringUtil::null) { LLUICtrlFactory::getInstance()->buildFloater(this, "floater_about.xml"); // Support for changing product name. - LLString title("About "); + std::string title("About "); title += LLAppViewer::instance()->getSecondLifeTitle(); setTitle(title); - LLString support; + std::string support; // Version string - LLString version = LLAppViewer::instance()->getSecondLifeTitle() + std::string version = LLAppViewer::instance()->getSecondLifeTitle() + llformat(" %d.%d.%d (%d) %s %s (%s)", LL_VERSION_MAJOR, LL_VERSION_MINOR, LL_VERSION_PATCH, LL_VIEWER_BUILD, __DATE__, __TIME__, @@ -98,15 +98,15 @@ LLFloaterAbout::LLFloaterAbout() llformat("%.1f, %.1f, %.1f ", pos.mdV[VX], pos.mdV[VY], pos.mdV[VZ])); support.append(pos_text); - LLString region_text = llformat("in %s located at ", - gAgent.getRegion()->getName().c_str()); + std::string region_text = llformat("in %s located at ", + gAgent.getRegion()->getName().c_str()); support.append(region_text); - char buffer[MAX_STRING]; /*Flawfinder: ignore*/ - gAgent.getRegion()->getHost().getHostName(buffer, MAX_STRING); + std::string buffer; + buffer = gAgent.getRegion()->getHost().getHostName(); support.append(buffer); support.append(" ("); - gAgent.getRegion()->getHost().getString(buffer, MAX_STRING); + buffer = gAgent.getRegion()->getHost().getString(); support.append(buffer); support.append(")\n"); support.append(gLastVersionChannel); @@ -125,11 +125,11 @@ LLFloaterAbout::LLFloaterAbout() U32 memory = gSysMemory.getPhysicalMemoryKB() / 1024; // Moved hack adjustment to Windows memory size into llsys.cpp - LLString mem_text = llformat("Memory: %u MB\n", memory ); + std::string mem_text = llformat("Memory: %u MB\n", memory ); support.append(mem_text); support.append("OS Version: "); - support.append( LLAppViewer::instance()->getOSInfo().getOSString().c_str() ); + support.append( LLAppViewer::instance()->getOSInfo().getOSString() ); support.append("\n"); support.append("Graphics Card Vendor: "); @@ -151,7 +151,7 @@ LLFloaterAbout::LLFloaterAbout() if (media_source) { support.append("LLMozLib Version: "); - support.append((const char*) media_source->getVersion().c_str()); + support.append(media_source->getVersion()); support.append("\n"); mgr->destroySource(media_source); } @@ -159,7 +159,7 @@ LLFloaterAbout::LLFloaterAbout() if (gPacketsIn > 0) { - LLString packet_loss = llformat("Packets Lost: %.0f/%.0f (%.1f%%)", + std::string packet_loss = llformat("Packets Lost: %.0f/%.0f (%.1f%%)", LLViewerStats::getInstance()->mPacketsLostStat.getCurrent(), F32(gPacketsIn), 100.f*LLViewerStats::getInstance()->mPacketsLostStat.getCurrent() / F32(gPacketsIn) ); diff --git a/indra/newview/llfloateranimpreview.cpp b/indra/newview/llfloateranimpreview.cpp index 1e0ebb7248..6d4ff5a1a7 100644 --- a/indra/newview/llfloateranimpreview.cpp +++ b/indra/newview/llfloateranimpreview.cpp @@ -79,7 +79,7 @@ const F32 MAX_CAMERA_ZOOM = 10.f; //----------------------------------------------------------------------------- // LLFloaterAnimPreview() //----------------------------------------------------------------------------- -LLFloaterAnimPreview::LLFloaterAnimPreview(const char* filename) : +LLFloaterAnimPreview::LLFloaterAnimPreview(const std::string& filename) : LLFloaterNameDesc(filename) { mLastSliderValue = 0.f; @@ -174,28 +174,28 @@ BOOL LLFloaterAnimPreview::postBuild() mPlayButton = getChild<LLButton>( "play_btn"); if (!mPlayButton) { - mPlayButton = new LLButton("play_btn", LLRect(0,0,0,0)); + mPlayButton = new LLButton(std::string("play_btn"), LLRect(0,0,0,0)); } mPlayButton->setClickedCallback(onBtnPlay); mPlayButton->setCallbackUserData(this); - mPlayButton->setImages("button_anim_play.tga", - "button_anim_play_selected.tga"); - mPlayButton->setDisabledImages("",""); + mPlayButton->setImages(std::string("button_anim_play.tga"), + std::string("button_anim_play_selected.tga")); + mPlayButton->setDisabledImages(LLStringUtil::null,LLStringUtil::null); mPlayButton->setScaleImage(TRUE); mStopButton = getChild<LLButton>( "stop_btn"); if (!mStopButton) { - mStopButton = new LLButton("stop_btn", LLRect(0,0,0,0)); + mStopButton = new LLButton(std::string("stop_btn"), LLRect(0,0,0,0)); } mStopButton->setClickedCallback(onBtnStop); mStopButton->setCallbackUserData(this); - mStopButton->setImages("button_anim_stop.tga", - "button_anim_stop_selected.tga"); - mStopButton->setDisabledImages("",""); + mStopButton->setImages(std::string("button_anim_stop.tga"), + std::string("button_anim_stop_selected.tga")); + mStopButton->setDisabledImages(LLStringUtil::null,LLStringUtil::null); mStopButton->setScaleImage(TRUE); @@ -224,7 +224,8 @@ BOOL LLFloaterAnimPreview::postBuild() //childSetCommitCallback("ease_out_time", onCommitEaseOut, this); //childSetValidate("ease_out_time", validateEaseOut); - if (!stricmp(strrchr(mFilename.c_str(), '.'), ".bvh")) + std::string exten = gDirUtilp->getExtension(mFilename); + if (exten == "bvh") { // loading a bvh file @@ -312,10 +313,10 @@ BOOL LLFloaterAnimPreview::postBuild() childSetValue("ease_in_time", LLSD(motionp->getEaseInDuration())); childSetValue("ease_out_time", LLSD(motionp->getEaseOutDuration())); setEnabled(TRUE); - char seconds_string[128]; /*Flawfinder: ignore*/ - snprintf(seconds_string, sizeof(seconds_string), " - %.2f seconds", motionp->getDuration()); /* Flawfinder: ignore */ + std::string seconds_string; + seconds_string = llformat(" - %.2f seconds", motionp->getDuration()); - setTitle(mFilename + LLString(seconds_string)); + setTitle(mFilename + std::string(seconds_string)); } else { @@ -939,8 +940,8 @@ void LLFloaterAnimPreview::refresh() if (avatarp->areAnimationsPaused()) { - mPlayButton->setImages("button_anim_play.tga", - "button_anim_play_selected.tga"); + mPlayButton->setImages(std::string("button_anim_play.tga"), + std::string("button_anim_play_selected.tga")); } else @@ -953,16 +954,16 @@ void LLFloaterAnimPreview::refresh() childSetValue("playback_slider", fraction_complete); mLastSliderValue = fraction_complete; } - mPlayButton->setImages("button_anim_pause.tga", - "button_anim_pause_selected.tga"); + mPlayButton->setImages(std::string("button_anim_pause.tga"), + std::string("button_anim_pause_selected.tga")); } } else { mPauseRequest = avatarp->requestPause(); - mPlayButton->setImages("button_anim_play.tga", - "button_anim_play_selected.tga"); + mPlayButton->setImages(std::string("button_anim_play.tga"), + std::string("button_anim_play_selected.tga")); mStopButton->setEnabled(FALSE); } diff --git a/indra/newview/llfloateranimpreview.h b/indra/newview/llfloateranimpreview.h index cbfba0c43e..693e3f8fbf 100644 --- a/indra/newview/llfloateranimpreview.h +++ b/indra/newview/llfloateranimpreview.h @@ -70,7 +70,7 @@ protected: class LLFloaterAnimPreview : public LLFloaterNameDesc { public: - LLFloaterAnimPreview(const char* filename); + LLFloaterAnimPreview(const std::string& filename); virtual ~LLFloaterAnimPreview(); BOOL postBuild(); @@ -126,7 +126,7 @@ protected: BOOL mEnabled; LLAnimPauseRequest mPauseRequest; - std::map<LLString, LLUUID> mIDList; + std::map<std::string, LLUUID> mIDList; static S32 sUploadAmount; }; diff --git a/indra/newview/llfloaterauction.cpp b/indra/newview/llfloaterauction.cpp index 41bc0db6a6..480ef708d6 100644 --- a/indra/newview/llfloaterauction.cpp +++ b/indra/newview/llfloaterauction.cpp @@ -72,7 +72,7 @@ LLFloaterAuction* LLFloaterAuction::sInstance = NULL; // Default constructor LLFloaterAuction::LLFloaterAuction() : - LLFloater("floater_auction"), + LLFloater(std::string("floater_auction")), mParcelID(-1) { LLUICtrlFactory::getInstance()->buildFloater(this, "floater_auction.xml"); @@ -128,7 +128,7 @@ void LLFloaterAuction::initialize() } else { - childSetText("parcel_text", LLString::null); + childSetText("parcel_text", LLStringUtil::null); } mParcelID = -1; childSetEnabled("snapshot_btn", false); @@ -224,14 +224,14 @@ void LLFloaterAuction::onClickOK(void* data) LLSD parcel_name = self->childGetValue("parcel_text"); // create the asset - LLString* name = new LLString(parcel_name.asString()); + std::string* name = new std::string(parcel_name.asString()); gAssetStorage->storeAssetData(self->mTransactionID, LLAssetType::AT_IMAGE_TGA, &auction_tga_upload_done, (void*)name, FALSE); self->getWindow()->incBusyCount(); - LLString* j2c_name = new LLString(parcel_name.asString()); + std::string* j2c_name = new std::string(parcel_name.asString()); gAssetStorage->storeAssetData(self->mTransactionID, LLAssetType::AT_TEXTURE, &auction_j2c_upload_done, (void*)j2c_name, @@ -268,7 +268,7 @@ void LLFloaterAuction::onClickOK(void* data) void auction_tga_upload_done(const LLUUID& asset_id, void* user_data, S32 status, LLExtStat ext_status) // StoreAssetData callback (fixed) { - LLString* name = (LLString*)(user_data); + std::string* name = (std::string*)(user_data); llinfos << "Upload of asset '" << *name << "' " << asset_id << " returned " << status << llendl; delete name; @@ -281,7 +281,7 @@ void auction_tga_upload_done(const LLUUID& asset_id, void* user_data, S32 status } else { - LLStringBase<char>::format_map_t args; + LLStringUtil::format_map_t args; args["[REASON]"] = std::string(LLAssetStorage::getErrorString(status)); gViewerWindow->alertXml("UploadAuctionSnapshotFail", args); } @@ -289,7 +289,7 @@ void auction_tga_upload_done(const LLUUID& asset_id, void* user_data, S32 status void auction_j2c_upload_done(const LLUUID& asset_id, void* user_data, S32 status, LLExtStat ext_status) // StoreAssetData callback (fixed) { - LLString* name = (LLString*)(user_data); + std::string* name = (std::string*)(user_data); llinfos << "Upload of asset '" << *name << "' " << asset_id << " returned " << status << llendl; delete name; @@ -302,7 +302,7 @@ void auction_j2c_upload_done(const LLUUID& asset_id, void* user_data, S32 status } else { - LLStringBase<char>::format_map_t args; + LLStringUtil::format_map_t args; args["[REASON]"] = std::string(LLAssetStorage::getErrorString(status)); gViewerWindow->alertXml("UploadAuctionSnapshotFail", args); } diff --git a/indra/newview/llfloateravatarpicker.cpp b/indra/newview/llfloateravatarpicker.cpp index 0c1175b26c..c45b2916e7 100644 --- a/indra/newview/llfloateravatarpicker.cpp +++ b/indra/newview/llfloateravatarpicker.cpp @@ -47,7 +47,7 @@ const S32 MIN_WIDTH = 200; const S32 MIN_HEIGHT = 340; const LLRect FLOATER_RECT(0, 380, 240, 0); -const char FLOATER_TITLE[] = "Choose Resident"; +const std::string FLOATER_TITLE = "Choose Resident"; // static LLFloaterAvatarPicker* LLFloaterAvatarPicker::sInstance = NULL; @@ -83,7 +83,7 @@ LLFloaterAvatarPicker* LLFloaterAvatarPicker::show(callback_t callback, // Default constructor LLFloaterAvatarPicker::LLFloaterAvatarPicker() : - LLFloater("avatarpicker", FLOATER_RECT, FLOATER_TITLE, TRUE, MIN_WIDTH, MIN_HEIGHT), + LLFloater(std::string("avatarpicker"), FLOATER_RECT, FLOATER_TITLE, TRUE, MIN_WIDTH, MIN_HEIGHT), mResultsReturned(FALSE), mCallback(NULL), mCallbackUserdata(NULL) @@ -112,7 +112,7 @@ BOOL LLFloaterAvatarPicker::postBuild() if (mListNames) { - mListNames->addCommentText("No results"); + mListNames->addCommentText(std::string("No results")); // *TODO: Translate } mInventoryPanel = getChild<LLInventoryPanel>("Inventory Panel"); @@ -260,7 +260,7 @@ void LLFloaterAvatarPicker::doSelectionChange(const std::deque<LLFolderViewItem* void LLFloaterAvatarPicker::find() { - const LLString& text = childGetValue("Edit").asString(); + const std::string& text = childGetValue("Edit").asString(); mQueryID.generate(); @@ -279,7 +279,7 @@ void LLFloaterAvatarPicker::find() if (mListNames) { mListNames->deleteAllItems(); - mListNames->addCommentText("Searching..."); + mListNames->addCommentText(std::string("Searching...")); // *TODO: Translate } childSetEnabled("Select", FALSE); @@ -305,8 +305,8 @@ void LLFloaterAvatarPicker::processAvatarPickerReply(LLMessageSystem* msg, void* LLUUID agent_id; LLUUID query_id; LLUUID avatar_id; - char first_name[DB_FIRST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/ - char last_name[DB_LAST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/ + std::string first_name; + std::string last_name; msg->getUUID("AgentData", "AgentID", agent_id); msg->getUUID("AgentData", "QueryID", query_id); @@ -341,20 +341,20 @@ void LLFloaterAvatarPicker::processAvatarPickerReply(LLMessageSystem* msg, void* for (S32 i = 0; i < num_new_rows; i++) { msg->getUUIDFast( _PREHASH_Data,_PREHASH_AvatarID, avatar_id, i); - msg->getStringFast(_PREHASH_Data,_PREHASH_FirstName, DB_FIRST_NAME_BUF_SIZE, first_name, i); - msg->getStringFast(_PREHASH_Data,_PREHASH_LastName, DB_LAST_NAME_BUF_SIZE, last_name, i); + msg->getStringFast(_PREHASH_Data,_PREHASH_FirstName, first_name, i); + msg->getStringFast(_PREHASH_Data,_PREHASH_LastName, last_name, i); - LLString avatar_name; + std::string avatar_name; if (avatar_id.isNull()) { - LLString::format_map_t map; + LLStringUtil::format_map_t map; map["[TEXT]"] = self->childGetText("Edit"); avatar_name = self->getString("NotFound", map); self->mListNames->setEnabled(FALSE); } else { - avatar_name = LLString(first_name) + " " + last_name; + avatar_name = first_name + " " + last_name; self->mListNames->setEnabled(TRUE); found_one = TRUE; } diff --git a/indra/newview/llfloateravatartextures.cpp b/indra/newview/llfloateravatartextures.cpp index 3870448652..008266c6f7 100644 --- a/indra/newview/llfloateravatartextures.cpp +++ b/indra/newview/llfloateravatartextures.cpp @@ -40,7 +40,7 @@ #include "llvoavatar.h" LLFloaterAvatarTextures::LLFloaterAvatarTextures(const LLUUID& id) : - LLFloater("avatar_texture_debug"), + LLFloater(std::string("avatar_texture_debug")), mID(id) { } @@ -110,7 +110,7 @@ static void update_texture_ctrl(LLVOAvatar* avatarp, if (id == IMG_DEFAULT_AVATAR) { ctrl->setImageAssetID(LLUUID::null); - ctrl->setToolTip(LLString("IMG_DEFAULT_AVATAR")); + ctrl->setToolTip(std::string("IMG_DEFAULT_AVATAR")); } else { diff --git a/indra/newview/llfloateravatartextures.h b/indra/newview/llfloateravatartextures.h index 85208ce648..a49f9d5150 100644 --- a/indra/newview/llfloateravatartextures.h +++ b/indra/newview/llfloateravatartextures.h @@ -56,7 +56,7 @@ private: private: LLUUID mID; - LLString mTitle; + std::string mTitle; LLTextureCtrl* mBakedHead; LLTextureCtrl* mBakedEyes; LLTextureCtrl* mBakedUpper; diff --git a/indra/newview/llfloaterbuildoptions.cpp b/indra/newview/llfloaterbuildoptions.cpp index 35add8d5b5..0d2611556f 100644 --- a/indra/newview/llfloaterbuildoptions.cpp +++ b/indra/newview/llfloaterbuildoptions.cpp @@ -58,7 +58,7 @@ LLFloaterBuildOptions *LLFloaterBuildOptions::sInstance = NULL; // Methods // LLFloaterBuildOptions::LLFloaterBuildOptions( ) -: LLFloater("build options floater") +: LLFloater(std::string("build options floater")) { sInstance = this; } diff --git a/indra/newview/llfloaterbump.cpp b/indra/newview/llfloaterbump.cpp index ce2d56612c..98540f3c5e 100644 --- a/indra/newview/llfloaterbump.cpp +++ b/indra/newview/llfloaterbump.cpp @@ -84,7 +84,7 @@ void LLFloaterBump::show(void *contents) if (gMeanCollisionList.empty()) { - LLString none_detected = sInstance->getString("none_detected"); + std::string none_detected = sInstance->getString("none_detected"); LLSD row; row["columns"][0]["value"] = none_detected; row["columns"][0]["font"] = "SansSerifBold"; @@ -110,8 +110,7 @@ void LLFloaterBump::add(LLScrollListCtrl* list, LLMeanCollisionData* mcd) new LLFloaterBump(); } - if (!mcd->mFirstName[0] - || list->getItemCount() >= 20) + if (mcd->mFirstName.empty() || list->getItemCount() >= 20) { return; } @@ -123,9 +122,9 @@ void LLFloaterBump::add(LLScrollListCtrl* list, LLMeanCollisionData* mcd) // it's daylight savings time there. timep = utc_to_pacific_time(mcd->mTime, gPacificDaylightTime); - LLString time = llformat("[%d:%02d]", timep->tm_hour, timep->tm_min); + std::string time = llformat("[%d:%02d]", timep->tm_hour, timep->tm_min); - LLString action; + std::string action; switch(mcd->mType) { case MEAN_BUMP: diff --git a/indra/newview/llfloaterbuy.cpp b/indra/newview/llfloaterbuy.cpp index 34bdaffd76..e64f218457 100644 --- a/indra/newview/llfloaterbuy.cpp +++ b/indra/newview/llfloaterbuy.cpp @@ -52,7 +52,7 @@ LLFloaterBuy* LLFloaterBuy::sInstance = NULL; LLFloaterBuy::LLFloaterBuy() -: LLFloater("floater_buy_object", "FloaterBuyRect", "") +: LLFloater(std::string("floater_buy_object"), std::string("FloaterBuyRect"), LLStringUtil::null) { LLUICtrlFactory::getInstance()->buildFloater(this, "floater_buy_object.xml"); @@ -132,7 +132,7 @@ void LLFloaterBuy::show(const LLSaleInfo& sale_info) sInstance->setTitle(title); LLUUID owner_id; - LLString owner_name; + std::string owner_name; BOOL owners_identical = LLSelectMgr::getInstance()->selectGetOwner(owner_id, owner_name); if (!owners_identical) { @@ -151,7 +151,7 @@ void LLFloaterBuy::show(const LLSaleInfo& sale_info) LLSD row; // Compute icon for this item - LLString icon_name = get_item_icon_name(LLAssetType::AT_OBJECT, + std::string icon_name = get_item_icon_name(LLAssetType::AT_OBJECT, LLInventoryType::IT_OBJECT, 0x0, FALSE); @@ -162,7 +162,7 @@ void LLFloaterBuy::show(const LLSaleInfo& sale_info) // Append the permissions that you will acquire (not the current // permissions). U32 next_owner_mask = node->mPermissions->getMaskNextOwner(); - LLString text = node->mName; + std::string text = node->mName; if (!(next_owner_mask & PERM_COPY)) { text.append(sInstance->getString("no_copy_text")); @@ -256,7 +256,7 @@ void LLFloaterBuy::inventoryChanged(LLViewerObject* obj, item_is_multi = TRUE; } - LLString icon_name = get_item_icon_name(inv_item->getType(), + std::string icon_name = get_item_icon_name(inv_item->getType(), inv_item->getInventoryType(), inv_item->getFlags(), item_is_multi); @@ -267,7 +267,7 @@ void LLFloaterBuy::inventoryChanged(LLViewerObject* obj, // Append the permissions that you will acquire (not the current // permissions). U32 next_owner_mask = inv_item->getPermissions().getMaskNextOwner(); - LLString text = obj->getName(); + std::string text = obj->getName(); if (!(next_owner_mask & PERM_COPY)) { text.append(" (no copy)"); diff --git a/indra/newview/llfloaterbuycontents.cpp b/indra/newview/llfloaterbuycontents.cpp index 34be223286..d74707f6b1 100644 --- a/indra/newview/llfloaterbuycontents.cpp +++ b/indra/newview/llfloaterbuycontents.cpp @@ -56,7 +56,7 @@ LLFloaterBuyContents* LLFloaterBuyContents::sInstance = NULL; LLFloaterBuyContents::LLFloaterBuyContents() -: LLFloater("floater_buy_contents", "FloaterBuyContentsRect", "") +: LLFloater(std::string("floater_buy_contents"), std::string("FloaterBuyContentsRect"), LLStringUtil::null) { LLUICtrlFactory::getInstance()->buildFloater(this, "floater_buy_contents.xml"); @@ -109,7 +109,7 @@ void LLFloaterBuyContents::show(const LLSaleInfo& sale_info) sInstance->center(); LLUUID owner_id; - LLString owner_name; + std::string owner_name; BOOL owners_identical = LLSelectMgr::getInstance()->selectGetOwner(owner_id, owner_name); if (!owners_identical) { @@ -223,7 +223,7 @@ void LLFloaterBuyContents::inventoryChanged(LLViewerObject* obj, item_is_multi = TRUE; } - LLString icon_name = get_item_icon_name(inv_item->getType(), + std::string icon_name = get_item_icon_name(inv_item->getType(), inv_item->getInventoryType(), inv_item->getFlags(), item_is_multi); @@ -234,7 +234,7 @@ void LLFloaterBuyContents::inventoryChanged(LLViewerObject* obj, // Append the permissions that you will acquire (not the current // permissions). U32 next_owner_mask = inv_item->getPermissions().getMaskNextOwner(); - LLString text = (*it)->getName(); + std::string text = (*it)->getName(); if (!(next_owner_mask & PERM_COPY)) { diff --git a/indra/newview/llfloaterbuycurrency.cpp b/indra/newview/llfloaterbuycurrency.cpp index 1ab42efef3..34df1e06ae 100644 --- a/indra/newview/llfloaterbuycurrency.cpp +++ b/indra/newview/llfloaterbuycurrency.cpp @@ -113,7 +113,7 @@ LLFloaterBuyCurrencyUI* LLFloaterBuyCurrencyUI::soleInstance(bool createIfNeeded #pragma warning(disable : 4355) #endif LLFloaterBuyCurrencyUI::LLFloaterBuyCurrencyUI() -: LLFloater("Buy Currency"), +: LLFloater(std::string("Buy Currency")), mChildren(*this), mManager(*this) { @@ -219,7 +219,7 @@ void LLFloaterBuyCurrencyUI::updateUI() // error section if (hasError) { - mChildren.setBadge("step_error", LLViewChildren::BADGE_ERROR); + mChildren.setBadge(std::string("step_error"), LLViewChildren::BADGE_ERROR); LLTextBox* message = getChild<LLTextBox>("error_message"); if (message) @@ -249,7 +249,7 @@ void LLFloaterBuyCurrencyUI::updateUI() if (!hasError) { - mChildren.setBadge("step_1", LLViewChildren::BADGE_NOTE); + mChildren.setBadge(std::string("step_1"), LLViewChildren::BADGE_NOTE); if (mManager.buying()) { @@ -373,8 +373,8 @@ void LLFloaterBuyCurrency::buyCurrency(const std::string& name, S32 price) { if (gHideLinks) { - LLStringBase<char>::format_map_t args; - args["[NAME]"] = name.c_str(); + LLStringUtil::format_map_t args; + args["[NAME]"] = name; args["[PRICE]"] = llformat("%d", price); gViewerWindow->alertXml("NotEnoughCurrency", args); return; diff --git a/indra/newview/llfloaterbuyland.cpp b/indra/newview/llfloaterbuyland.cpp index 936aad6606..b08dea248f 100644 --- a/indra/newview/llfloaterbuyland.cpp +++ b/indra/newview/llfloaterbuyland.cpp @@ -198,7 +198,7 @@ private: }; static void cacheNameUpdateRefreshesBuyLand(const LLUUID&, - const char*, const char*, BOOL, void* data) + const std::string&, const std::string&, BOOL, void* data) { LLFloaterBuyLandUI* ui = LLFloaterBuyLandUI::soleInstance(false); if (ui) @@ -321,7 +321,7 @@ LLFloaterBuyLandUI* LLFloaterBuyLandUI::soleInstance(bool createIfNeeded) #pragma warning(disable : 4355) #endif LLFloaterBuyLandUI::LLFloaterBuyLandUI() -: LLFloater("Buy Land"), +: LLFloater(std::string("Buy Land")), mParcel(0), mBought(false), mParcelValid(false), mSiteValid(false), @@ -455,7 +455,7 @@ void LLFloaterBuyLandUI::updateParcelInfo() bool haveEnoughCash = mParcelPrice <= mAgentCashBalance; S32 cashBuy = haveEnoughCash ? 0 : (mParcelPrice - mAgentCashBalance); mCurrency.setAmount(cashBuy, true); - mCurrency.setZeroMessage(haveEnoughCash ? getString("none_needed") : ""); + mCurrency.setZeroMessage(haveEnoughCash ? getString("none_needed") : LLStringUtil::null); // checks that we can buy the land @@ -810,7 +810,7 @@ void LLFloaterBuyLandUI::updateNames() if (!parcelp) { - mParcelSellerName = ""; + mParcelSellerName = LLStringUtil::null; return; } @@ -1014,7 +1014,7 @@ void LLFloaterBuyLandUI::refreshUI() { childSetText("info_parcel", mParcelLocation); - LLString::format_map_t string_args; + LLStringUtil::format_map_t string_args; string_args["[AMOUNT]"] = llformat("%d", mParcelActualArea); string_args["[AMOUNT2]"] = llformat("%d", mParcelSupportedObjects); @@ -1033,8 +1033,8 @@ void LLFloaterBuyLandUI::refreshUI() else { childSetText("info_parcel", getString("no_parcel_selected")); - childSetText("info_size", LLString::null); - childSetText("info_price", LLString::null); + childSetText("info_size", LLStringUtil::null); + childSetText("info_price", LLStringUtil::null); } childSetText("info_action", @@ -1056,7 +1056,7 @@ void LLFloaterBuyLandUI::refreshUI() // error section if (showingError) { - mChildren.setBadge("step_error", + mChildren.setBadge(std::string("step_error"), mCannotBuyIsError ? LLViewChildren::BADGE_ERROR : LLViewChildren::BADGE_WARN); @@ -1084,7 +1084,7 @@ void LLFloaterBuyLandUI::refreshUI() // section one: account if (!showingError) { - mChildren.setBadge("step_1", + mChildren.setBadge(std::string("step_1"), mSiteMembershipUpgrade ? LLViewChildren::BADGE_NOTE : LLViewChildren::BADGE_OK); @@ -1127,7 +1127,7 @@ void LLFloaterBuyLandUI::refreshUI() // section two: land use fees if (!showingError) { - mChildren.setBadge("step_2", + mChildren.setBadge(std::string("step_2"), mSiteLandUseUpgrade ? LLViewChildren::BADGE_NOTE : LLViewChildren::BADGE_OK); @@ -1137,15 +1137,15 @@ void LLFloaterBuyLandUI::refreshUI() if (mIsForGroup) { - LLString::format_map_t string_args; - string_args["[GROUP]"] = LLString(gAgent.mGroupName); + LLStringUtil::format_map_t string_args; + string_args["[GROUP]"] = std::string(gAgent.mGroupName); message += getString("insufficient_land_credits", string_args); } else { - LLString::format_map_t string_args; + LLStringUtil::format_map_t string_args; string_args["[BUYER]"] = llformat("%d", mAgentCommittedTier); message += getString("land_holdings", string_args); } @@ -1156,7 +1156,7 @@ void LLFloaterBuyLandUI::refreshUI() } else if (mParcelBillableArea == mParcelActualArea) { - LLString::format_map_t string_args; + LLStringUtil::format_map_t string_args; string_args["[AMOUNT]"] = llformat("%d", mParcelActualArea); message += getString("parcel_meters", string_args); } @@ -1165,13 +1165,13 @@ void LLFloaterBuyLandUI::refreshUI() if (mParcelBillableArea > mParcelActualArea) { - LLString::format_map_t string_args; + LLStringUtil::format_map_t string_args; string_args["[AMOUNT]"] = llformat("%d", mParcelBillableArea); message += getString("premium_land", string_args); } else { - LLString::format_map_t string_args; + LLStringUtil::format_map_t string_args; string_args["[AMOUNT]"] = llformat("%d", mParcelBillableArea); message += getString("discounted_land", string_args); } @@ -1201,7 +1201,7 @@ void LLFloaterBuyLandUI::refreshUI() if (!showingError) { - mChildren.setBadge("step_3", + mChildren.setBadge(std::string("step_3"), !willHaveEnough ? LLViewChildren::BADGE_WARN : mCurrency.getAmount() > 0 @@ -1220,14 +1220,14 @@ void LLFloaterBuyLandUI::refreshUI() if (haveEnough) { - LLString::format_map_t string_args; + LLStringUtil::format_map_t string_args; string_args["[AMOUNT]"] = llformat("%d", mAgentCashBalance); childSetText("currency_reason", getString("have_enough_lindens", string_args)); } else { - LLString::format_map_t string_args; + LLStringUtil::format_map_t string_args; string_args["[AMOUNT]"] = llformat("%d", mAgentCashBalance); string_args["[AMOUNT2]"] = llformat("%d", mParcelPrice - mAgentCashBalance); @@ -1238,7 +1238,7 @@ void LLFloaterBuyLandUI::refreshUI() if (willHaveEnough) { - LLString::format_map_t string_args; + LLStringUtil::format_map_t string_args; string_args["[AMOUNT]"] = llformat("%d", finalBalance); childSetText("currency_balance", getString("balance_left", string_args)); @@ -1246,7 +1246,7 @@ void LLFloaterBuyLandUI::refreshUI() } else { - LLString::format_map_t string_args; + LLStringUtil::format_map_t string_args; string_args["[AMOUNT]"] = llformat("%d", mParcelPrice - mAgentCashBalance); childSetText("currency_balance", getString("balance_needed", string_args)); @@ -1311,14 +1311,14 @@ void LLFloaterBuyLandUI::startBuyPreConfirm() } if (mCurrency.getAmount() > 0) { - LLString::format_map_t string_args; + LLStringUtil::format_map_t string_args; string_args["[AMOUNT]"] = llformat("%d", mCurrency.getAmount()); string_args["[AMOUNT2]"] = llformat("%#.2f", mCurrency.getEstimate() / 100.0); action += getString("buy_for_US", string_args); } - LLString::format_map_t string_args; + LLStringUtil::format_map_t string_args; string_args["[AMOUNT]"] = llformat("%d", mParcelPrice); string_args["[SELLER]"] = mParcelSellerName; action += getString("pay_to_for_land", string_args); diff --git a/indra/newview/llfloatercamera.cpp b/indra/newview/llfloatercamera.cpp index 75e1d694a4..47803d8304 100644 --- a/indra/newview/llfloatercamera.cpp +++ b/indra/newview/llfloatercamera.cpp @@ -61,10 +61,10 @@ LLFloaterCamera::LLFloaterCamera(const LLSD& val) S32 left = 16; const S32 ROTATE_WIDTH = 64; - mRotate = new LLJoystickCameraRotate("cam rotate stick", + mRotate = new LLJoystickCameraRotate(std::string("cam rotate stick"), LLRect( left, top, left + ROTATE_WIDTH, bottom ), - "cam_rotate_out.tga", - "cam_rotate_in.tga" ); + std::string("cam_rotate_out.tga"), + std::string("cam_rotate_in.tga") ); mRotate->setFollows(FOLLOWS_TOP | FOLLOWS_LEFT); mRotate->setHeldDownDelay(CAMERA_BUTTON_DELAY); mRotate->setToolTip( getString("rotate_tooltip") ); @@ -75,11 +75,11 @@ LLFloaterCamera::LLFloaterCamera(const LLSD& val) const S32 ZOOM_WIDTH = 16; mZoom = new LLJoystickCameraZoom( - "zoom", + std::string("zoom"), LLRect( left, top, left + ZOOM_WIDTH, bottom ), - "cam_zoom_out.tga", - "cam_zoom_plus_in.tga", - "cam_zoom_minus_in.tga"); + std::string("cam_zoom_out.tga"), + std::string("cam_zoom_plus_in.tga"), + std::string("cam_zoom_minus_in.tga")); mZoom->setFollows(FOLLOWS_TOP | FOLLOWS_LEFT); mZoom->setHeldDownDelay(CAMERA_BUTTON_DELAY); mZoom->setToolTip( getString("zoom_tooltip") ); @@ -89,10 +89,10 @@ LLFloaterCamera::LLFloaterCamera(const LLSD& val) left += ZOOM_WIDTH; const S32 TRACK_WIDTH = 64; - mTrack = new LLJoystickCameraTrack("cam track stick", + mTrack = new LLJoystickCameraTrack(std::string("cam track stick"), LLRect( left, top, left + TRACK_WIDTH, bottom ), - "cam_tracking_out.tga", - "cam_tracking_in.tga"); + std::string("cam_tracking_out.tga"), + std::string("cam_tracking_in.tga")); mTrack->setFollows(FOLLOWS_TOP | FOLLOWS_LEFT); mTrack->setHeldDownDelay(CAMERA_BUTTON_DELAY); mTrack->setToolTip( getString("move_tooltip") ); diff --git a/indra/newview/llfloaterchat.cpp b/indra/newview/llfloaterchat.cpp index fd428990f8..745e7766f2 100644 --- a/indra/newview/llfloaterchat.cpp +++ b/indra/newview/llfloaterchat.cpp @@ -75,8 +75,8 @@ #include "llstylemap.h" // Used for LCD display -extern void AddNewIMToLCD(const LLString &newLine); -extern void AddNewChatToLCD(const LLString &newLine); +extern void AddNewIMToLCD(const std::string &newLine); +extern void AddNewChatToLCD(const std::string &newLine); // // Constants // @@ -94,7 +94,7 @@ LLColor4 get_text_color(const LLChat& chat); // Member Functions // LLFloaterChat::LLFloaterChat(const LLSD& seed) -: LLFloater("chat floater", "FloaterChatRect", "", +: LLFloater(std::string("chat floater"), std::string("FloaterChatRect"), LLStringUtil::null, RESIZE_YES, 440, 100, DRAG_ON_TOP, MINIMIZE_NO, CLOSE_YES), mPanel(NULL) { @@ -191,7 +191,7 @@ void LLFloaterChat::updateConsoleVisibility() void add_timestamped_line(LLViewerTextEditor* edit, const LLChat &chat, const LLColor4& color) { - LLString line = chat.mText; + std::string line = chat.mText; bool prepend_newline = true; if (gSavedSettings.getBOOL("ChatShowTimestamps")) { @@ -215,13 +215,13 @@ void add_timestamped_line(LLViewerTextEditor* edit, const LLChat &chat, const LL void log_chat_text(const LLChat& chat) { - LLString histstr; + std::string histstr; if (gSavedPerAccountSettings.getBOOL("LogChatTimestamp")) histstr = LLLogChat::timestamp(gSavedPerAccountSettings.getBOOL("LogTimestampDate")) + chat.mText; else histstr = chat.mText; - LLLogChat::saveHistory("chat",histstr); + LLLogChat::saveHistory(std::string("chat"),histstr); } // static void LLFloaterChat::addChatHistory(const LLChat& chat, bool log_to_file) @@ -304,7 +304,7 @@ void LLFloaterChat::onClickMute(void *data) LLComboBox* chatter_combo = self->getChild<LLComboBox>("chatter combobox"); - const LLString& name = chatter_combo->getSimple(); + const std::string& name = chatter_combo->getSimple(); LLUUID id = chatter_combo->getCurrentID(); if (name.empty()) return; @@ -459,11 +459,11 @@ LLColor4 get_text_color(const LLChat& chat) //static void LLFloaterChat::loadHistory() { - LLLogChat::loadHistory("chat", &chatFromLogFile, (void *)LLFloaterChat::getInstance(LLSD())); + LLLogChat::loadHistory(std::string("chat"), &chatFromLogFile, (void *)LLFloaterChat::getInstance(LLSD())); } //static -void LLFloaterChat::chatFromLogFile(LLLogChat::ELogLineType type , LLString line, void* userdata) +void LLFloaterChat::chatFromLogFile(LLLogChat::ELogLineType type , std::string line, void* userdata) { switch (type) { diff --git a/indra/newview/llfloaterchat.h b/indra/newview/llfloaterchat.h index 118e6bbe6d..d118f2f099 100644 --- a/indra/newview/llfloaterchat.h +++ b/indra/newview/llfloaterchat.h @@ -77,7 +77,7 @@ public: static void onClickMute(void *data); static void onClickToggleShowMute(LLUICtrl* caller, void *data); static void onClickToggleActiveSpeakers(void* userdata); - static void chatFromLogFile(LLLogChat::ELogLineType type,LLString line, void* userdata); + static void chatFromLogFile(LLLogChat::ELogLineType type,std::string line, void* userdata); static void loadHistory(); static void* createSpeakersPanel(void* data); static void* createChatPanel(void* data); diff --git a/indra/newview/llfloatercolorpicker.cpp b/indra/newview/llfloatercolorpicker.cpp index ec659b5146..d02fd072e2 100644 --- a/indra/newview/llfloatercolorpicker.cpp +++ b/indra/newview/llfloatercolorpicker.cpp @@ -78,7 +78,7 @@ const F32 CONTEXT_FADE_TIME = 0.08f; // default ctor LLFloaterColorPicker:: LLFloaterColorPicker (LLColorSwatchCtrl* swatch, BOOL show_apply_immediate ) - : LLFloater ("Color Picker Floater"), + : LLFloater (std::string("Color Picker Floater")), mComponents ( 3 ), mMouseDownInLumRegion ( FALSE ), mMouseDownInHueRegion ( FALSE ), @@ -232,7 +232,7 @@ postBuild() mPipetteBtn = getChild<LLButton>("color_pipette" ); - mPipetteBtn->setImages("eye_button_inactive.tga", "eye_button_active.tga"); + mPipetteBtn->setImages(std::string("eye_button_inactive.tga"), std::string("eye_button_active.tga")); mPipetteBtn->setClickedCallback( onClickPipette ); mPipetteBtn->setCallbackUserData ( this ); @@ -794,7 +794,7 @@ LLFloaterColorPicker:: onTextEntryChanged ( LLUICtrl* ctrl ) { // value in RGB boxes changed - LLString name = ctrl->getName(); + std::string name = ctrl->getName(); if ( ( name == "rspin" ) || ( name == "gspin" ) || ( name == "bspin" ) ) { // get current RGB diff --git a/indra/newview/llfloaterdaycycle.cpp b/indra/newview/llfloaterdaycycle.cpp index ca1131face..1a8c35b837 100644 --- a/indra/newview/llfloaterdaycycle.cpp +++ b/indra/newview/llfloaterdaycycle.cpp @@ -59,10 +59,10 @@ LLFloaterDayCycle* LLFloaterDayCycle::sDayCycle = NULL; -std::map<LLString, LLWLSkyKey> LLFloaterDayCycle::sSliderToKey; +std::map<std::string, LLWLSkyKey> LLFloaterDayCycle::sSliderToKey; const F32 LLFloaterDayCycle::sHoursPerDay = 24.0f; -LLFloaterDayCycle::LLFloaterDayCycle() : LLFloater("Day Cycle Floater") +LLFloaterDayCycle::LLFloaterDayCycle() : LLFloater(std::string("Day Cycle Floater")) { LLUICtrlFactory::getInstance()->buildFloater(this, "floater_day_cycle_options.xml"); @@ -75,7 +75,7 @@ LLFloaterDayCycle::LLFloaterDayCycle() : LLFloater("Day Cycle Floater") LLWLParamManager::instance()->mParamList.begin(); for(; mIt != LLWLParamManager::instance()->mParamList.end(); mIt++) { - keyCombo->add(LLString(mIt->first)); + keyCombo->add(std::string(mIt->first)); } // set defaults on combo boxes @@ -97,11 +97,10 @@ LLFloaterDayCycle::~LLFloaterDayCycle() void LLFloaterDayCycle::onClickHelp(void* data) { - LLFloaterDayCycle* self = LLFloaterDayCycle::instance(); + const std::string* xml_alert = (std::string*)data; - const char* xml_alert = (const char*) data; - LLAlertDialog* dialogp = gViewerWindow->alertXml(xml_alert); + LLAlertDialog* dialogp = gViewerWindow->alertXml(*xml_alert); if (dialogp) { LLFloater* root_floater = gFloaterView->getParentFloater(self); @@ -110,11 +109,12 @@ void LLFloaterDayCycle::onClickHelp(void* data) root_floater->addDependentFloater(dialogp); } } + delete xml_alert; } -void LLFloaterDayCycle::initHelpBtn(const char* name, const char* xml_alert) +void LLFloaterDayCycle::initHelpBtn(const std::string& name, const std::string& xml_alert) { - childSetAction(name, onClickHelp, (void*)xml_alert); + childSetAction(name, onClickHelp, new std::string(xml_alert)); } void LLFloaterDayCycle::initCallbacks(void) @@ -193,7 +193,7 @@ void LLFloaterDayCycle::syncSliderTrack() LLWLParamManager::instance()->mDay.mTimeMap.begin(); for(; mIt != LLWLParamManager::instance()->mDay.mTimeMap.end(); mIt++) { - addSliderKey(mIt->first * sHoursPerDay, mIt->second.c_str()); + addSliderKey(mIt->first * sHoursPerDay, mIt->second); } } @@ -218,7 +218,7 @@ void LLFloaterDayCycle::syncTrack() LLWLParamManager::instance()->mDay.clearKeys(); // add the keys one by one - std::map<LLString, LLWLSkyKey>::iterator mIt = sSliderToKey.begin(); + std::map<std::string, LLWLSkyKey>::iterator mIt = sSliderToKey.begin(); for(; mIt != sSliderToKey.end(); mIt++) { LLWLParamManager::instance()->mDay.addKey(mIt->second.time / sHoursPerDay, @@ -379,7 +379,7 @@ void LLFloaterDayCycle::onKeyTimeMoved(LLUICtrl* ctrl, void* userData) } // make sure we have a slider - const LLString& curSldr = sldr->getCurSlider(); + const std::string& curSldr = sldr->getCurSlider(); if(curSldr == "") { return; } @@ -387,7 +387,7 @@ void LLFloaterDayCycle::onKeyTimeMoved(LLUICtrl* ctrl, void* userData) F32 time = sldr->getCurSliderValue(); // check to see if a key exists - LLString presetName = sSliderToKey[curSldr].presetName; + std::string presetName = sSliderToKey[curSldr].presetName; sSliderToKey[curSldr].time = time; // if it exists, turn on check box @@ -428,12 +428,12 @@ void LLFloaterDayCycle::onKeyTimeChanged(LLUICtrl* ctrl, void* userData) F32 min = minSpin->get(); F32 val = hour + min / 60.0f; - const LLString& curSldr = sldr->getCurSlider(); + const std::string& curSldr = sldr->getCurSlider(); sldr->setCurSliderValue(val, TRUE); F32 time = sldr->getCurSliderValue() / sHoursPerDay; // now set the key's time in the sliderToKey map - LLString presetName = sSliderToKey[curSldr].presetName; + std::string presetName = sSliderToKey[curSldr].presetName; sSliderToKey[curSldr].time = time; syncTrack(); @@ -453,8 +453,8 @@ void LLFloaterDayCycle::onKeyPresetChanged(LLUICtrl* ctrl, void* userData) } // change the map - LLString newPreset(comboBox->getSelectedValue().asString()); - const LLString& curSldr = sldr->getCurSlider(); + std::string newPreset(comboBox->getSelectedValue().asString()); + const std::string& curSldr = sldr->getCurSlider(); // if null, don't use if(curSldr == "") { @@ -506,7 +506,7 @@ void LLFloaterDayCycle::onAddKey(void* userData) llassert_always(sSliderToKey.size() == kSldr->getValue().size()); // get the values - LLString newPreset(comboBox->getSelectedValue().asString()); + std::string newPreset(comboBox->getSelectedValue().asString()); // add the slider key addSliderKey(tSldr->getCurSliderValue(), newPreset); @@ -514,13 +514,13 @@ void LLFloaterDayCycle::onAddKey(void* userData) syncTrack(); } -void LLFloaterDayCycle::addSliderKey(F32 time, const LLString & presetName) +void LLFloaterDayCycle::addSliderKey(F32 time, const std::string & presetName) { LLMultiSliderCtrl* kSldr = sDayCycle->getChild<LLMultiSliderCtrl>( "WLDayCycleKeys"); // make a slider - const LLString& sldrName = kSldr->addSlider(time); + const std::string& sldrName = kSldr->addSlider(time); if(sldrName == "") { return; } @@ -530,21 +530,21 @@ void LLFloaterDayCycle::addSliderKey(F32 time, const LLString & presetName) newKey.presetName = presetName; newKey.time = kSldr->getCurSliderValue(); - llassert_always(sldrName != LLString::null); + llassert_always(sldrName != LLStringUtil::null); // add to map - sSliderToKey.insert(std::pair<LLString, LLWLSkyKey>(sldrName, newKey)); + sSliderToKey.insert(std::pair<std::string, LLWLSkyKey>(sldrName, newKey)); llassert_always(sSliderToKey.size() == kSldr->getValue().size()); } -void LLFloaterDayCycle::deletePreset(LLString& presetName) +void LLFloaterDayCycle::deletePreset(std::string& presetName) { LLMultiSliderCtrl* sldr = sDayCycle->getChild<LLMultiSliderCtrl>("WLDayCycleKeys"); /// delete any reference - std::map<LLString, LLWLSkyKey>::iterator curr_preset, next_preset; + std::map<std::string, LLWLSkyKey>::iterator curr_preset, next_preset; for(curr_preset = sSliderToKey.begin(); curr_preset != sSliderToKey.end(); curr_preset = next_preset) { next_preset = curr_preset; @@ -568,8 +568,8 @@ void LLFloaterDayCycle::onDeleteKey(void* userData) LLMultiSliderCtrl* sldr = sDayCycle->getChild<LLMultiSliderCtrl>("WLDayCycleKeys"); // delete from map - const LLString& sldrName = sldr->getCurSlider(); - std::map<LLString, LLWLSkyKey>::iterator mIt = sSliderToKey.find(sldrName); + const std::string& sldrName = sldr->getCurSlider(); + std::map<std::string, LLWLSkyKey>::iterator mIt = sSliderToKey.find(sldrName); sSliderToKey.erase(mIt); sldr->deleteCurSlider(); @@ -578,7 +578,7 @@ void LLFloaterDayCycle::onDeleteKey(void* userData) return; } - const LLString& name = sldr->getCurSlider(); + const std::string& name = sldr->getCurSlider(); comboBox->selectByValue(sSliderToKey[name].presetName); F32 time = sSliderToKey[name].time; diff --git a/indra/newview/llfloaterdaycycle.h b/indra/newview/llfloaterdaycycle.h index 91a649b97c..2e66c1c609 100644 --- a/indra/newview/llfloaterdaycycle.h +++ b/indra/newview/llfloaterdaycycle.h @@ -45,7 +45,7 @@ struct WLFloatControl; struct LLWLSkyKey { public: - LLString presetName; + std::string presetName; F32 time; }; @@ -60,7 +60,7 @@ public: /// help button stuff static void onClickHelp(void* data); - void initHelpBtn(const char* name, const char* xml_alert); + void initHelpBtn(const std::string& name, const std::string& xml_alert); /// initialize all void initCallbacks(void); @@ -93,7 +93,7 @@ public: static void onAddKey(void* userData); /// delete any and all reference to a preset - void deletePreset(LLString& presetName); + void deletePreset(std::string& presetName); /// delete a key frame static void onDeleteKey(void* userData); @@ -129,7 +129,7 @@ public: static void syncTrack(); /// add a slider to the track - static void addSliderKey(F32 time, const LLString& presetName); + static void addSliderKey(F32 time, const std::string& presetName); private: @@ -137,7 +137,7 @@ private: static LLFloaterDayCycle* sDayCycle; // map of sliders to parameters - static std::map<LLString, LLWLSkyKey> sSliderToKey; + static std::map<std::string, LLWLSkyKey> sSliderToKey; static const F32 sHoursPerDay; }; diff --git a/indra/newview/llfloaterenvsettings.cpp b/indra/newview/llfloaterenvsettings.cpp index 8570515f07..b28cc04047 100644 --- a/indra/newview/llfloaterenvsettings.cpp +++ b/indra/newview/llfloaterenvsettings.cpp @@ -53,7 +53,7 @@ LLFloaterEnvSettings* LLFloaterEnvSettings::sEnvSettings = NULL; -LLFloaterEnvSettings::LLFloaterEnvSettings() : LLFloater("Environment Settings Floater") +LLFloaterEnvSettings::LLFloaterEnvSettings() : LLFloater(std::string("Environment Settings Floater")) { LLUICtrlFactory::getInstance()->buildFloater(this, "floater_env_settings.xml"); @@ -110,7 +110,7 @@ void LLFloaterEnvSettings::syncMenu() // sync the clock F32 val = (F32)LLWLParamManager::instance()->mAnimator.getDayTime(); - LLString timeStr = timeToString(val); + std::string timeStr = timeToString(val); LLTextBox* textBox; textBox = sEnvSettings->getChild<LLTextBox>("EnvTimeText"); @@ -308,7 +308,7 @@ void LLFloaterEnvSettings::onUseEstateTime(void* userData) LLWLParamManager::instance()->mAnimator.mUseLindenTime = true; } -LLString LLFloaterEnvSettings::timeToString(F32 curTime) +std::string LLFloaterEnvSettings::timeToString(F32 curTime) { S32 hours; S32 min; diff --git a/indra/newview/llfloaterenvsettings.h b/indra/newview/llfloaterenvsettings.h index 2ac555083e..4208e7c0b9 100644 --- a/indra/newview/llfloaterenvsettings.h +++ b/indra/newview/llfloaterenvsettings.h @@ -95,7 +95,7 @@ public: void syncMenu(); /// convert the present time to a digital clock time - LLString timeToString(F32 curTime); + std::string timeToString(F32 curTime); private: // one instance on the inside diff --git a/indra/newview/llfloaterfriends.cpp b/indra/newview/llfloaterfriends.cpp index b7e50145c3..55d9aeead9 100644 --- a/indra/newview/llfloaterfriends.cpp +++ b/indra/newview/llfloaterfriends.cpp @@ -200,8 +200,8 @@ BOOL LLPanelFriends::postBuild() refreshUI(); // primary sort = online status, secondary sort = name - mFriendsList->sortByColumn("friend_name", TRUE); - mFriendsList->sortByColumn("icon_online_status", FALSE); + mFriendsList->sortByColumn(std::string("friend_name"), TRUE); + mFriendsList->sortByColumn(std::string("icon_online_status"), FALSE); return TRUE; } @@ -274,7 +274,7 @@ BOOL LLPanelFriends::updateFriendItem(const LLUUID& agent_id, const LLRelationsh std::string fullname; BOOL have_name = gCacheName->getFullName(agent_id, fullname); - itemp->getColumn(LIST_ONLINE_STATUS)->setValue(info->isOnline() ? "icon_avatar_online.tga" : LLString::null); + itemp->getColumn(LIST_ONLINE_STATUS)->setValue(info->isOnline() ? std::string("icon_avatar_online.tga") : LLStringUtil::null); itemp->getColumn(LIST_FRIEND_NAME)->setValue(fullname); // render name of online friends in bold text ((LLScrollListText*)itemp->getColumn(LIST_FRIEND_NAME))->setFontStyle(info->isOnline() ? LLFontGL::BOLD : LLFontGL::NORMAL); @@ -443,7 +443,7 @@ void LLPanelFriends::refreshUI() } else { - childSetText("friend_name_label", LLString::null); + childSetText("friend_name_label", LLStringUtil::null); } @@ -488,7 +488,7 @@ void LLPanelFriends::onSelectName(LLUICtrl* ctrl, void* user_data) //static void LLPanelFriends::onMaximumSelect(void* user_data) { - LLString::format_map_t args; + LLStringUtil::format_map_t args; args["[MAX_SELECT]"] = llformat("%d", MAX_FRIEND_SELECT); LLNotifyBox::showXml("MaxListSelectMessage", args); }; @@ -539,14 +539,14 @@ void LLPanelFriends::onClickIM(void* user_data) } // static -void LLPanelFriends::requestFriendship(const LLUUID& target_id, const LLString& target_name) +void LLPanelFriends::requestFriendship(const LLUUID& target_id, const std::string& target_name) { // HACK: folder id stored as "message" LLUUID calling_card_folder_id = gInventory.findCategoryUUIDForType(LLAssetType::AT_CALLINGCARD); std::string message = calling_card_folder_id.asString(); send_improved_im(target_id, - target_name.c_str(), - message.c_str(), + target_name, + message, IM_ONLINE, IM_FRIENDSHIP_OFFERED); } @@ -593,7 +593,7 @@ void LLPanelFriends::requestFriendshipDialog(const LLUUID& id, data->mName = name; // TODO: accept a line of text with this dialog - LLString::format_map_t args; + LLStringUtil::format_map_t args; args["[NAME]"] = name; gViewerWindow->alertXml("AddFriend", args, callbackAddFriend, data); } @@ -617,10 +617,10 @@ void LLPanelFriends::onClickRemove(void* user_data) //llinfos << "LLPanelFriends::onClickRemove()" << llendl; LLDynamicArray<LLUUID> ids = panelp->getSelectedIDs(); - LLStringBase<char>::format_map_t args; + LLStringUtil::format_map_t args; if(ids.size() > 0) { - LLString msgType = "RemoveFromFriends"; + std::string msgType = "RemoveFromFriends"; if(ids.size() == 1) { LLUUID agent_id = ids[0]; @@ -670,7 +670,7 @@ void LLPanelFriends::confirmModifyRights(rights_map_t& ids, EGrantRevoke command { if (ids.empty()) return; - LLStringBase<char>::format_map_t args; + LLStringUtil::format_map_t args; if(ids.size() > 0) { // copy map of ids onto heap diff --git a/indra/newview/llfloaterfriends.h b/indra/newview/llfloaterfriends.h index 2e87688f8e..211c6cf487 100644 --- a/indra/newview/llfloaterfriends.h +++ b/indra/newview/llfloaterfriends.h @@ -79,7 +79,7 @@ public: // Just request friendship, no dialog. static void requestFriendship(const LLUUID& target_id, - const LLString& target_name); + const std::string& target_name); private: @@ -138,7 +138,7 @@ private: // member data LLFriendObserver* mObserver; LLUUID mAddFriendID; - LLString mAddFriendName; + std::string mAddFriendName; LLScrollListCtrl* mFriendsList; BOOL mShowMaxSelectWarning; BOOL mAllowRightsChange; diff --git a/indra/newview/llfloatergesture.cpp b/indra/newview/llfloatergesture.cpp index e361309a61..03c13bb913 100644 --- a/indra/newview/llfloatergesture.cpp +++ b/indra/newview/llfloatergesture.cpp @@ -65,7 +65,7 @@ LLFloaterGestureObserver* LLFloaterGesture::sObserver = NULL; BOOL item_name_precedes( LLInventoryItem* a, LLInventoryItem* b ) { - return LLString::precedesDict( a->getName(), b->getName() ); + return LLStringUtil::precedesDict( a->getName(), b->getName() ); } class LLFloaterGestureObserver : public LLGestureManagerObserver @@ -80,7 +80,7 @@ public: // LLFloaterGesture //--------------------------------------------------------------------------- LLFloaterGesture::LLFloaterGesture() -: LLFloater("Gesture Floater") +: LLFloater(std::string("Gesture Floater")) { sInstance = this; @@ -105,7 +105,7 @@ LLFloaterGesture::~LLFloaterGesture() // virtual BOOL LLFloaterGesture::postBuild() { - LLString label; + std::string label; // Translate title label = getTitle(); @@ -159,7 +159,7 @@ void LLFloaterGesture::show() if (list) { const BOOL ascending = TRUE; - list->sortByColumn("name", ascending); + list->sortByColumn(std::string("name"), ascending); list->selectFirstItem(); } @@ -236,7 +236,7 @@ void LLFloaterGesture::buildGestureList() item_name = item->getName(); } - LLString font_style = "NORMAL"; + std::string font_style = "NORMAL"; // If gesture is playing, bold it LLSD element; @@ -254,8 +254,8 @@ void LLFloaterGesture::buildGestureList() element["columns"][0]["font"] = "SANSSERIF"; element["columns"][0]["font-style"] = font_style; - LLString key_string = LLKeyboard::stringFromKey(gesture->mKey); - LLString buffer; + std::string key_string = LLKeyboard::stringFromKey(gesture->mKey); + std::string buffer; { if (gesture->mKey == KEY_NONE) @@ -356,22 +356,22 @@ void LLFloaterGesture::onClickPlay(void* data) class GestureShowCallback : public LLInventoryCallback { public: - GestureShowCallback(LLString &title) + GestureShowCallback(std::string &title) { mTitle = title; } void fire(const LLUUID &inv_item) { - LLPreviewGesture::show(mTitle.c_str(), inv_item, LLUUID::null); + LLPreviewGesture::show(mTitle, inv_item, LLUUID::null); } private: - LLString mTitle; + std::string mTitle; }; // static void LLFloaterGesture::onClickNew(void* data) { - LLString title("Gesture: "); + std::string title("Gesture: "); title.append("New Gesture"); LLPointer<LLInventoryCallback> cb = new GestureShowCallback(title); create_inventory_item(gAgent.getID(), gAgent.getSessionID(), @@ -392,7 +392,7 @@ void LLFloaterGesture::onClickEdit(void* data) LLInventoryItem* item = gInventory.getItem(item_id); if (!item) return; - LLString title("Gesture: "); + std::string title("Gesture: "); title.append(item->getName()); LLPreviewGesture* previewp = LLPreviewGesture::show(title, item_id, LLUUID::null); diff --git a/indra/newview/llfloatergodtools.cpp b/indra/newview/llfloatergodtools.cpp index c919302424..a4022d844a 100644 --- a/indra/newview/llfloatergodtools.cpp +++ b/indra/newview/llfloatergodtools.cpp @@ -115,7 +115,7 @@ void LLFloaterGodTools::refreshAll() LLFloaterGodTools::LLFloaterGodTools() -: LLFloater("godtools floater"), +: LLFloater(std::string("godtools floater")), mCurrentHost(LLHost::invalid), mUpdateTimer() { @@ -224,7 +224,7 @@ void LLFloaterGodTools::show(void *) } } -void LLFloaterGodTools::showPanel(const LLString& panel_name) +void LLFloaterGodTools::showPanel(const std::string& panel_name) { childShowTab("GodTools Tabs", panel_name); open(); /*Flawfinder: ignore*/ @@ -258,7 +258,7 @@ void LLFloaterGodTools::processRegionInfo(LLMessageSystem* msg) U32 region_flags; U8 sim_access; U8 agent_limit; - char sim_name[MAX_STRING]; /*Flawfinder: ignore*/ + std::string sim_name; U32 estate_id; U32 parent_estate_id; F32 water_height; @@ -271,7 +271,7 @@ void LLFloaterGodTools::processRegionInfo(LLMessageSystem* msg) S32 redirect_grid_y; LLUUID cache_id; - msg->getStringFast(_PREHASH_RegionInfo, _PREHASH_SimName, MAX_STRING, sim_name); + msg->getStringFast(_PREHASH_RegionInfo, _PREHASH_SimName, sim_name); msg->getU32Fast(_PREHASH_RegionInfo, _PREHASH_EstateID, estate_id); msg->getU32Fast(_PREHASH_RegionInfo, _PREHASH_ParentEstateID, parent_estate_id); msg->getU32Fast(_PREHASH_RegionInfo, _PREHASH_RegionFlags, region_flags); @@ -375,7 +375,7 @@ void LLFloaterGodTools::sendGodUpdateRegionInfo() msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->nextBlockFast(_PREHASH_RegionInfo); - msg->addStringFast(_PREHASH_SimName, rtool->getSimName().c_str()); + msg->addStringFast(_PREHASH_SimName, rtool->getSimName()); msg->addU32Fast(_PREHASH_EstateID, rtool->getEstateID()); msg->addU32Fast(_PREHASH_ParentEstateID, rtool->getParentEstateID()); msg->addU32Fast(_PREHASH_RegionFlags, computeRegionFlags()); @@ -707,7 +707,7 @@ S32 LLPanelRegionTools::getPricePerMeter() const return childGetValue("land cost"); } -void LLPanelRegionTools::setSimName(char *name) +void LLPanelRegionTools::setSimName(const std::string& name) { childSetValue("region name", name); } @@ -924,13 +924,13 @@ void LLPanelGridTools::onClickKickAll(void* userdata) gFloaterView->getNewFloaterPosition(&left, &top); LLRect rect(left, top, left+400, top-300); - gViewerWindow->alertXmlEditText("KickAllUsers", LLString::format_map_t(), + gViewerWindow->alertXmlEditText("KickAllUsers", LLStringUtil::format_map_t(), NULL, NULL, LLPanelGridTools::confirmKick, self); } -void LLPanelGridTools::confirmKick(S32 option, const LLString& text, void* userdata) +void LLPanelGridTools::confirmKick(S32 option, const std::string& text, void* userdata) { LLPanelGridTools* self = (LLPanelGridTools*) userdata; @@ -957,7 +957,7 @@ void LLPanelGridTools::finishKick(S32 option, void* userdata) msg->addUUIDFast(_PREHASH_GodSessionID, gAgent.getSessionID()); msg->addUUIDFast(_PREHASH_AgentID, LL_UUID_ALL_AGENTS ); msg->addU32("KickFlags", KICK_FLAGS_DEFAULT ); - msg->addStringFast(_PREHASH_Reason, self->mKickMessage.c_str() ); + msg->addStringFast(_PREHASH_Reason, self->mKickMessage ); gAgent.sendReliableMessage(); } } @@ -1182,7 +1182,7 @@ void LLPanelObjectTools::onClickDeletePublicOwnedBy(void* userdata) panelp->mSimWideDeletesFlags = SWD_SCRIPTED_ONLY | SWD_OTHERS_LAND_ONLY; - LLStringBase<char>::format_map_t args; + LLStringUtil::format_map_t args; args["[AVATAR_NAME]"] = panelp->childGetValue("target_avatar_name").asString(); gViewerWindow->alertXml( "GodDeleteAllScriptedPublicObjectsByUser", @@ -1201,7 +1201,7 @@ void LLPanelObjectTools::onClickDeleteAllScriptedOwnedBy(void* userdata) { panelp->mSimWideDeletesFlags = SWD_SCRIPTED_ONLY; - LLStringBase<char>::format_map_t args; + LLStringUtil::format_map_t args; args["[AVATAR_NAME]"] = panelp->childGetValue("target_avatar_name").asString(); gViewerWindow->alertXml( "GodDeleteAllScriptedObjectsByUser", @@ -1220,7 +1220,7 @@ void LLPanelObjectTools::onClickDeleteAllOwnedBy(void* userdata) { panelp->mSimWideDeletesFlags = 0; - LLStringBase<char>::format_map_t args; + LLStringUtil::format_map_t args; args["[AVATAR_NAME]"] = panelp->childGetValue("target_avatar_name").asString(); gViewerWindow->alertXml( "GodDeleteAllObjectsByUser", @@ -1260,12 +1260,12 @@ void LLPanelObjectTools::onClickSetBySelection(void* data) LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode(NULL, non_root_ok); if (!node) return; - LLString owner_name; + std::string owner_name; LLUUID owner_id; LLSelectMgr::getInstance()->selectGetOwner(owner_id, owner_name); panelp->mTargetAvatar = owner_id; - LLString name = "Object " + node->mName + " owned by " + owner_name; + std::string name = "Object " + node->mName + " owned by " + owner_name; panelp->childSetValue("target_avatar_name", name); } @@ -1314,8 +1314,8 @@ void LLPanelObjectTools::onApplyChanges(void* userdata) // LLPanelRequestTools // -------------------- -const char SELECTION[] = "Selection"; -const char AGENT_REGION[] = "Agent Region"; +const std::string SELECTION = "Selection"; +const std::string AGENT_REGION = "Agent Region"; LLPanelRequestTools::LLPanelRequestTools(const std::string& name): LLPanel(name) @@ -1348,7 +1348,7 @@ void LLPanelRequestTools::refresh() iter != LLWorld::getInstance()->mActiveRegionList.end(); ++iter) { LLViewerRegion* regionp = *iter; - LLString name = regionp->getName(); + std::string name = regionp->getName(); if (!name.empty()) { list->addSimpleElement(name); @@ -1366,8 +1366,8 @@ void LLPanelRequestTools::refresh() // static -void LLPanelRequestTools::sendRequest(const char *request, - const char *parameter, +void LLPanelRequestTools::sendRequest(const std::string& request, + const std::string& parameter, const LLHost& host) { llinfos << "Sending request '" << request << "', '" @@ -1437,7 +1437,7 @@ void LLPanelRequestTools::sendRequest(const LLHost& host) std::string req = childGetValue("request"); if (req == "terrain download") { - gXferManager->requestFile("terrain.raw", "terrain.raw", LL_PATH_NONE, + gXferManager->requestFile(std::string("terrain.raw"), std::string("terrain.raw"), LL_PATH_NONE, host, FALSE, terrain_download_done, @@ -1446,7 +1446,7 @@ void LLPanelRequestTools::sendRequest(const LLHost& host) else { req = req.substr(0, req.find_first_of(" ")); - sendRequest(req.c_str(), childGetValue("parameter").asString().c_str(), host); + sendRequest(req, childGetValue("parameter").asString(), host); } } diff --git a/indra/newview/llfloatergodtools.h b/indra/newview/llfloatergodtools.h index 53e250f67e..7cc840cc97 100644 --- a/indra/newview/llfloatergodtools.h +++ b/indra/newview/llfloatergodtools.h @@ -81,7 +81,7 @@ public: static void refreshAll(); - void showPanel(const LLString& panel_name); + void showPanel(const std::string& panel_name); virtual void onClose(bool app_quitting); @@ -164,7 +164,7 @@ public: S32 getRedirectGridY() const; // set internal checkboxes/spinners/combos - void setSimName(char *name); + void setSimName(const std::string& name); void setEstateID(U32 id); void setParentEstateID(U32 id); void setCheckFlags(U32 flags); @@ -201,14 +201,14 @@ public: void refresh(); static void onClickKickAll(void *data); - static void confirmKick(S32 option, const LLString& text, void* userdata); + static void confirmKick(S32 option, const std::string& text, void* userdata); static void finishKick(S32 option, void* userdata); static void onDragSunPhase(LLUICtrl *ctrl, void *userdata); static void onClickFlushMapVisibilityCaches(void* data); static void flushMapVisibilityCachesConfirm(S32 option, void* data); protected: - LLString mKickMessage; // Message to send on kick + std::string mKickMessage; // Message to send on kick }; @@ -268,8 +268,8 @@ public: void refresh(); - static void sendRequest(const char* request, - const char* parameter, + static void sendRequest(const std::string& request, + const std::string& parameter, const LLHost& host); protected: diff --git a/indra/newview/llfloatergroups.cpp b/indra/newview/llfloatergroups.cpp index d67ae2de2d..a85b4ec0e9 100644 --- a/indra/newview/llfloatergroups.cpp +++ b/indra/newview/llfloatergroups.cpp @@ -389,7 +389,7 @@ void LLPanelGroups::leave() if(i < count) { LLUUID* cb_data = new LLUUID((const LLUUID&)group_id); - LLString::format_map_t args; + LLStringUtil::format_map_t args; args["[GROUP]"] = gAgent.mGroups.get(i).mName; gViewerWindow->alertXml("GroupLeaveConfirmMember", args, callbackLeaveGroup, (void*)cb_data); } @@ -439,7 +439,7 @@ void init_group_list(LLScrollListCtrl* ctrl, const LLUUID& highlight_id, U64 pow id = gAgent.mGroups.get(i).mID; LLGroupData* group_datap = &gAgent.mGroups.get(i); if ((group_datap->mPowers & powers_mask) != 0) { - LLString style = "NORMAL"; + std::string style = "NORMAL"; if(highlight_id == id) { style = "BOLD"; @@ -458,7 +458,7 @@ void init_group_list(LLScrollListCtrl* ctrl, const LLUUID& highlight_id, U64 pow // add "none" to list at top { - LLString style = "NORMAL"; + std::string style = "NORMAL"; if (highlight_id.isNull()) { style = "BOLD"; diff --git a/indra/newview/llfloaterhardwaresettings.cpp b/indra/newview/llfloaterhardwaresettings.cpp index d58517ee92..e4c13b2ae4 100644 --- a/indra/newview/llfloaterhardwaresettings.cpp +++ b/indra/newview/llfloaterhardwaresettings.cpp @@ -47,7 +47,7 @@ LLFloaterHardwareSettings* LLFloaterHardwareSettings::sHardwareSettings = NULL; -LLFloaterHardwareSettings::LLFloaterHardwareSettings() : LLFloater("Hardware Settings Floater") +LLFloaterHardwareSettings::LLFloaterHardwareSettings() : LLFloater(std::string("Hardware Settings Floater")) { LLUICtrlFactory::getInstance()->buildFloater(this, "floater_hardware_settings.xml"); diff --git a/indra/newview/llfloaterhud.cpp b/indra/newview/llfloaterhud.cpp index 12b1f0b4f1..c5cb6a91d5 100644 --- a/indra/newview/llfloaterhud.cpp +++ b/indra/newview/llfloaterhud.cpp @@ -26,7 +26,7 @@ std::string LLFloaterHUD::sTutorialUrl = ""; // Default constructor LLFloaterHUD::LLFloaterHUD() -: LLFloater("floater_hud"), +: LLFloater(std::string("floater_hud")), mWebBrowser(0) { // Create floater from its XML definition @@ -59,7 +59,7 @@ LLFloaterHUD::LLFloaterHUD() // arrow keys during tutorial). mWebBrowser->setTakeFocusOnClick(false); - LLString language(gSavedSettings.getString("Language")); + std::string language(gSavedSettings.getString("Language")); if(language == "default") { language = gSavedSettings.getString("SystemLanguage"); @@ -97,7 +97,7 @@ LLFloaterHUD::~LLFloaterHUD() } // Show the HUD -void LLFloaterHUD::show() +void LLFloaterHUD::showHUD() { // do not build the floater if there the url is empty if (sTutorialUrl == "") @@ -112,7 +112,7 @@ void LLFloaterHUD::show() hud->setFrontmost(FALSE); } -void LLFloaterHUD::close() +void LLFloaterHUD::closeHUD() { if (sInstance) sInstance->close(); } diff --git a/indra/newview/llfloaterhud.h b/indra/newview/llfloaterhud.h index 06da9fb44e..975ab2daf5 100644 --- a/indra/newview/llfloaterhud.h +++ b/indra/newview/llfloaterhud.h @@ -29,8 +29,8 @@ public: static std::string sTutorialUrl; - static void show(); ///< show the HUD - static void close(); ///< close the HUD (destroys floater) + static void showHUD(); ///< show the HUD + static void closeHUD(); ///< close the HUD (destroys floater) protected: LLWebBrowserCtrl* mWebBrowser; ///< the actual web browser control diff --git a/indra/newview/llfloaterimagepreview.cpp b/indra/newview/llfloaterimagepreview.cpp index 830b38faf8..50b8b39bd0 100644 --- a/indra/newview/llfloaterimagepreview.cpp +++ b/indra/newview/llfloaterimagepreview.cpp @@ -68,13 +68,13 @@ const S32 PREVIEW_TEXTURE_HEIGHT = 300; //----------------------------------------------------------------------------- // LLFloaterImagePreview() //----------------------------------------------------------------------------- -LLFloaterImagePreview::LLFloaterImagePreview(const char* filename) : +LLFloaterImagePreview::LLFloaterImagePreview(const std::string& filename) : LLFloaterNameDesc(filename) { mLastMouseX = 0; mLastMouseY = 0; mGLName = 0; - loadImage(mFilenameAndPath.c_str()); + loadImage(mFilenameAndPath); } //----------------------------------------------------------------------------- @@ -314,28 +314,25 @@ void LLFloaterImagePreview::draw() //----------------------------------------------------------------------------- // loadImage() //----------------------------------------------------------------------------- -bool LLFloaterImagePreview::loadImage(const char *src_filename) +bool LLFloaterImagePreview::loadImage(const std::string& src_filename) { - // U32 length = strlen(src_filename); - const char* ext = strrchr(src_filename, '.'); - char error_message[MAX_STRING]; - error_message[0] = '\0'; - + std::string exten = gDirUtilp->getExtension(src_filename); + U32 codec = IMG_CODEC_INVALID; - LLString temp_str; - if( 0 == strnicmp(ext, ".bmp", 4) ) + std::string temp_str; + if( exten == "bmp") { codec = IMG_CODEC_BMP; } - else if( 0 == strnicmp(ext, ".tga", 4) ) + else if( exten == "tga") { codec = IMG_CODEC_TGA; } - else if( 0 == strnicmp(ext, ".jpg", 4) || 0 == strnicmp(ext, ".jpeg", 5)) + else if( exten == "jpg" || exten == "jpeg") { codec = IMG_CODEC_JPEG; } - else if( 0 == strnicmp(ext, ".png", 4) ) + else if( exten == "png" ) { codec = IMG_CODEC_PNG; } @@ -629,7 +626,7 @@ LLImagePreviewAvatar::~LLImagePreviewAvatar() } -void LLImagePreviewAvatar::setPreviewTarget(const char* joint_name, const char* mesh_name, LLImageRaw* imagep, F32 distance, BOOL male) +void LLImagePreviewAvatar::setPreviewTarget(const std::string& joint_name, const std::string& mesh_name, LLImageRaw* imagep, F32 distance, BOOL male) { mTargetJoint = mDummyAvatar->mRoot.findJoint(joint_name); // clear out existing test mesh diff --git a/indra/newview/llfloaterimagepreview.h b/indra/newview/llfloaterimagepreview.h index 365dc7eefd..0376ec2bcb 100644 --- a/indra/newview/llfloaterimagepreview.h +++ b/indra/newview/llfloaterimagepreview.h @@ -76,7 +76,7 @@ public: LLImagePreviewAvatar(S32 width, S32 height); virtual ~LLImagePreviewAvatar(); - void setPreviewTarget(const char* joint_name, const char *mesh_name, LLImageRaw* imagep, F32 distance, BOOL male); + void setPreviewTarget(const std::string& joint_name, const std::string& mesh_name, LLImageRaw* imagep, F32 distance, BOOL male); void setTexture(U32 name) { mTextureName = name; } BOOL render(); @@ -102,7 +102,7 @@ protected: class LLFloaterImagePreview : public LLFloaterNameDesc { public: - LLFloaterImagePreview(const char* filename); + LLFloaterImagePreview(const std::string& filename); virtual ~LLFloaterImagePreview(); virtual BOOL postBuild(); @@ -118,7 +118,7 @@ public: protected: static void onPreviewTypeCommit(LLUICtrl*,void*); void draw(); - bool loadImage(const char* filename); + bool loadImage(const std::string& filename); LLPointer<LLImageRaw> mRawImagep; LLImagePreviewAvatar* mAvatarPreview; diff --git a/indra/newview/llfloaterinspect.cpp b/indra/newview/llfloaterinspect.cpp index a2e26d27a8..16c26ac588 100644 --- a/indra/newview/llfloaterinspect.cpp +++ b/indra/newview/llfloaterinspect.cpp @@ -45,7 +45,7 @@ LLFloaterInspect* LLFloaterInspect::sInstance = NULL; LLFloaterInspect::LLFloaterInspect(void) : - LLFloater("Inspect Object"), + LLFloater(std::string("Inspect Object")), mDirty(FALSE) { sInstance = this; @@ -188,7 +188,7 @@ LLUUID LLFloaterInspect::getSelectedUUID() void LLFloaterInspect::refresh() { LLUUID creator_id; - LLString creator_name; + std::string creator_name; S32 pos = mObjectList->getScrollPos(); childSetEnabled("button owner", false); childSetEnabled("button creator", false); @@ -214,7 +214,7 @@ void LLFloaterInspect::refresh() char time[MAX_STRING]; std::string owner_name, creator_name; time_t timestamp = (time_t) (obj->mCreationDate/1000000); - LLString::copy(time, ctime(×tamp), MAX_STRING); + LLStringUtil::copy(time, ctime(×tamp), MAX_STRING); time[24] = '\0'; gCacheName->getFullName(obj->mPermissions->getOwner(), owner_name); gCacheName->getFullName(obj->mPermissions->getCreator(), creator_name); @@ -225,7 +225,7 @@ void LLFloaterInspect::refresh() // or top of the editable chain, for attachments if(!(obj->getObject()->isRoot() || obj->getObject()->isRootEdit())) { - row["columns"][0]["value"] = LLString(" ") + obj->mName; + row["columns"][0]["value"] = std::string(" ") + obj->mName; } else { diff --git a/indra/newview/llfloaterjoystick.cpp b/indra/newview/llfloaterjoystick.cpp index 040ca8013e..de88b490d9 100644 --- a/indra/newview/llfloaterjoystick.cpp +++ b/indra/newview/llfloaterjoystick.cpp @@ -46,7 +46,7 @@ #include "llviewerjoystick.h" LLFloaterJoystick::LLFloaterJoystick(const LLSD& data) - : LLFloater("floater_joystick") + : LLFloater(std::string("floater_joystick")) { LLUICtrlFactory::getInstance()->buildFloater(this, "floater_joystick.xml"); center(); diff --git a/indra/newview/llfloaterlagmeter.cpp b/indra/newview/llfloaterlagmeter.cpp index b70ae9a227..96e4c819a8 100644 --- a/indra/newview/llfloaterlagmeter.cpp +++ b/indra/newview/llfloaterlagmeter.cpp @@ -45,12 +45,12 @@ #include "llfocusmgr.h" #include "lltextbox.h" -const LLString LAG_CRITICAL_IMAGE_NAME = "lag_status_critical.tga"; -const LLString LAG_WARNING_IMAGE_NAME = "lag_status_warning.tga"; -const LLString LAG_GOOD_IMAGE_NAME = "lag_status_good.tga"; +const std::string LAG_CRITICAL_IMAGE_NAME = "lag_status_critical.tga"; +const std::string LAG_WARNING_IMAGE_NAME = "lag_status_warning.tga"; +const std::string LAG_GOOD_IMAGE_NAME = "lag_status_good.tga"; LLFloaterLagMeter::LLFloaterLagMeter(const LLSD& key) - : LLFloater("floater_lagmeter") + : LLFloater(std::string("floater_lagmeter")) { LLUICtrlFactory::getInstance()->buildFloater(this, "floater_lagmeter.xml"); @@ -70,7 +70,7 @@ LLFloaterLagMeter::LLFloaterLagMeter(const LLSD& key) mServerText = getChild<LLTextBox>("server_text"); mServerCause = getChild<LLTextBox>("server_lag_cause"); - LLString config_string = getString("client_frame_rate_critical_fps", mStringArgs); + std::string config_string = getString("client_frame_rate_critical_fps", mStringArgs); mClientFrameTimeCritical = 1.0f / (float)atof( config_string.c_str() ); config_string = getString("client_frame_rate_warning_fps", mStringArgs); mClientFrameTimeWarning = 1.0f / (float)atof( config_string.c_str() ); @@ -152,7 +152,7 @@ void LLFloaterLagMeter::determineClient() { mClientButton->setImageUnselected(LAG_GOOD_IMAGE_NAME); mClientText->setText( getString("client_frame_time_window_bg_msg", mStringArgs) ); - mClientCause->setText( LLString::null ); + mClientCause->setText( LLStringUtil::null ); } else if(client_frame_time >= mClientFrameTimeCritical) { @@ -170,7 +170,7 @@ void LLFloaterLagMeter::determineClient() { mClientButton->setImageUnselected(LAG_GOOD_IMAGE_NAME); mClientText->setText( getString("client_frame_time_normal_msg", mStringArgs) ); - mClientCause->setText( LLString::null ); + mClientCause->setText( LLStringUtil::null ); } if(find_cause) @@ -241,7 +241,7 @@ void LLFloaterLagMeter::determineNetwork() } else { - mNetworkCause->setText( LLString::null ); + mNetworkCause->setText( LLStringUtil::null ); } } @@ -266,7 +266,7 @@ void LLFloaterLagMeter::determineServer() { mServerButton->setImageUnselected(LAG_GOOD_IMAGE_NAME); mServerText->setText( getString("server_frame_time_normal_msg", mStringArgs) ); - mServerCause->setText( LLString::null ); + mServerCause->setText( LLStringUtil::null ); } if(find_cause) diff --git a/indra/newview/llfloaterlagmeter.h b/indra/newview/llfloaterlagmeter.h index 6a034c840c..eca043398a 100644 --- a/indra/newview/llfloaterlagmeter.h +++ b/indra/newview/llfloaterlagmeter.h @@ -75,7 +75,7 @@ private: LLTextBox * mServerText; LLTextBox * mServerCause; - LLString::format_map_t mStringArgs; + LLStringUtil::format_map_t mStringArgs; }; #endif diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp index 595f4afd72..58ad07c5bb 100644 --- a/indra/newview/llfloaterland.cpp +++ b/indra/newview/llfloaterland.cpp @@ -31,6 +31,9 @@ #include "llviewerprecompiledheaders.h" +#include <sstream> +#include <time.h> + #include "llfloaterland.h" #include "llcachename.h" @@ -70,39 +73,9 @@ #include "llviewercontrol.h" #include "roles_constants.h" -#include <sstream> -#include <time.h> - -static const S32 EDIT_HEIGHT = 16; -static const S32 LEFT = HPAD; -static const S32 BOTTOM = VPAD; -static const S32 RULER0 = LEFT; -static const S32 RULER05 = RULER0 + 24; -static const S32 RULER1 = RULER05 + 16; -static const S32 RULER15 = RULER1 + 20; -static const S32 RULER2 = RULER1 + 32; -static const S32 RULER205= RULER2 + 32; -static const S32 RULER20 = RULER2 + 64; -static const S32 RULER21 = RULER20 + 16; -static const S32 RULER22 = RULER21 + 32; -static const S32 RULER225 = RULER20 + 64; -static const S32 RULER23 = RULER22 + 64; -static const S32 RULER24 = RULER23 + 26; -static const S32 RULER3 = RULER2 + 102; -static const S32 RULER4 = RULER3 + 8; -static const S32 RULER5 = RULER4 + 50; -static const S32 RULER6 = RULER5 + 52; -static const S32 RULER7 = RULER6 + 24; -static const S32 RIGHT = LEFT + 278; -static const S32 FAR_RIGHT = LEFT + 324 + 40; - -static const char PRICE[] = "Price:"; -static const char NO_PRICE[] = ""; -static const char AREA[] = "Area:"; - -static const char OWNER_ONLINE[] = "0"; -static const char OWNER_OFFLINE[] = "1"; -static const char OWNER_GROUP[] = "2"; +static std::string OWNER_ONLINE = "0"; +static std::string OWNER_OFFLINE = "1"; +static std::string OWNER_GROUP = "2"; // constants used in callbacks below - syntactic sugar. static const BOOL BUY_GROUP_LAND = TRUE; @@ -219,11 +192,11 @@ void LLFloaterLand::onClose(bool app_quitting) LLFloaterLand::LLFloaterLand(const LLSD& seed) -: LLFloater("floaterland", "FloaterLandRect5", "About Land") +: LLFloater(std::string("floaterland"), std::string("FloaterLandRect5"), std::string("About Land")) { - std::map<LLString, LLCallbackMap> factory_map; + LLCallbackMap::map_t factory_map; factory_map["land_general_panel"] = LLCallbackMap(createPanelLandGeneral, this); @@ -325,7 +298,7 @@ void* LLFloaterLand::createPanelLandAccess(void* data) LLPanelLandGeneral::LLPanelLandGeneral(LLParcelSelectionHandle& parcel) -: LLPanel("land_general_panel"), +: LLPanel(std::string("land_general_panel")), mUncheckedSell(FALSE), mParcel(parcel) { @@ -458,12 +431,12 @@ void LLPanelLandGeneral::refresh() { // nothing selected, disable panel mEditName->setEnabled(FALSE); - mEditName->setText(LLString::null); + mEditName->setText(LLStringUtil::null); mEditDesc->setEnabled(FALSE); - mEditDesc->setText(LLString::null); + mEditDesc->setText(LLStringUtil::null); - mTextSalePending->setText(LLString::null); + mTextSalePending->setText(LLStringUtil::null); mTextSalePending->setEnabled(FALSE); mBtnDeedToGroup->setEnabled(FALSE); @@ -475,13 +448,13 @@ void LLPanelLandGeneral::refresh() mCheckContributeWithDeed->set(FALSE); mCheckContributeWithDeed->setEnabled(FALSE); - mTextOwner->setText(LLString::null); + mTextOwner->setText(LLStringUtil::null); mBtnProfile->setLabel(getString("profile_text")); mBtnProfile->setEnabled(FALSE); - mTextClaimDate->setText(LLString::null); - mTextGroup->setText(LLString::null); - mTextPrice->setText(LLString::null); + mTextClaimDate->setText(LLStringUtil::null); + mTextGroup->setText(LLStringUtil::null); + mTextPrice->setText(LLStringUtil::null); mSaleInfoForSale1->setVisible(FALSE); mSaleInfoForSale2->setVisible(FALSE); @@ -491,8 +464,8 @@ void LLPanelLandGeneral::refresh() mBtnSellLand->setVisible(FALSE); mBtnStopSellLand->setVisible(FALSE); - mTextPriceLabel->setText(LLString::null); - mTextDwell->setText(LLString::null); + mTextPriceLabel->setText(LLStringUtil::null); + mTextDwell->setText(LLStringUtil::null); mBtnBuyLand->setEnabled(FALSE); mBtnBuyGroupLand->setEnabled(FALSE); @@ -528,12 +501,12 @@ void LLPanelLandGeneral::refresh() // Is it owned? if (is_public) { - mTextSalePending->setText(LLString::null); + mTextSalePending->setText(LLStringUtil::null); mTextSalePending->setEnabled(FALSE); mTextOwner->setText(getString("public_text")); mTextOwner->setEnabled(FALSE); mBtnProfile->setEnabled(FALSE); - mTextClaimDate->setText(LLString::null); + mTextClaimDate->setText(LLStringUtil::null); mTextClaimDate->setEnabled(FALSE); mTextGroup->setText(getString("none_text")); mTextGroup->setEnabled(FALSE); @@ -555,7 +528,7 @@ void LLPanelLandGeneral::refresh() else { // not the owner, or it is leased - mTextSalePending->setText(LLString::null); + mTextSalePending->setText(LLStringUtil::null); mTextSalePending->setEnabled(FALSE); } //refreshNames(); @@ -584,8 +557,7 @@ void LLPanelLandGeneral::refresh() // Display claim date // *TODO:Localize (Time format may need Translating) time_t claim_date = parcel->getClaimDate(); - char time_buf[TIME_STR_LENGTH]; /*Flawfinder: ignore*/ - mTextClaimDate->setText(LLString(formatted_time(claim_date, time_buf))); + mTextClaimDate->setText(formatted_time(claim_date)); mTextClaimDate->setEnabled(is_leased); BOOL enable_auction = (gAgent.getGodLevel() >= GOD_LIAISON) @@ -718,11 +690,11 @@ void LLPanelLandGeneral::refreshNames() LLParcel *parcel = mParcel->getParcel(); if (!parcel) { - mTextOwner->setText(LLString::null); + mTextOwner->setText(LLStringUtil::null); return; } - LLString owner; + std::string owner; if (parcel->getIsGroupOwned()) { owner = getString("group_owned_text"); @@ -739,7 +711,7 @@ void LLPanelLandGeneral::refreshNames() } mTextOwner->setText(owner); - LLString group; + std::string group; if(!parcel->getGroupID().isNull()) { gCacheName->getGroupName(parcel->getGroupID(), group); @@ -749,7 +721,7 @@ void LLPanelLandGeneral::refreshNames() const LLUUID& auth_buyer_id = parcel->getAuthorizedBuyerID(); if(auth_buyer_id.notNull()) { - LLString name; + std::string name; gCacheName->getFullName(auth_buyer_id, name); mSaleInfoForSale2->setTextArg("[BUYER]", name); } @@ -885,14 +857,14 @@ void LLPanelLandGeneral::onClickBuyPass(void* data) if (!parcel) return; S32 pass_price = parcel->getPassPrice(); - LLString parcel_name = parcel->getName(); + std::string parcel_name = parcel->getName(); F32 pass_hours = parcel->getPassHours(); - char cost[256], time[256]; /*Flawfinder: ignore*/ - snprintf(cost, sizeof(cost), "%d", pass_price); /* Flawfinder: ignore */ - snprintf(time, sizeof(time), "%.2f", pass_hours); /* Flawfinder: ignore */ + std::string cost, time; + cost = llformat("%d", pass_price); + time = llformat("%.2f", pass_hours); - LLStringBase<char>::format_map_t args; + LLStringUtil::format_map_t args; args["[COST]"] = cost; args["[PARCEL_NAME]"] = parcel_name; args["[TIME]"] = time; @@ -952,8 +924,8 @@ void LLPanelLandGeneral::onCommitAny(LLUICtrl *ctrl, void *userdata) // Valid data from UI // Stuff data into selected parcel - parcel->setName(name.c_str()); - parcel->setDesc(desc.c_str()); + parcel->setName(name); + parcel->setDesc(desc); BOOL allow_deed_to_group= panelp->mCheckDeedToGroup->get(); BOOL contribute_with_deed = panelp->mCheckContributeWithDeed->get(); @@ -991,7 +963,7 @@ void LLPanelLandGeneral::onClickStopSellLand(void* data) // LLPanelLandObjects //--------------------------------------------------------------------------- LLPanelLandObjects::LLPanelLandObjects(LLParcelSelectionHandle& parcel) -: LLPanel("land_objects_panel"), mParcel(parcel) +: LLPanel(std::string("land_objects_panel")), mParcel(parcel) { } @@ -1047,7 +1019,7 @@ BOOL LLPanelLandObjects::postBuild() mIconGroup = LLUIImageList::getInstance()->getUIImage("icon_group.tga"); mOwnerList = getChild<LLNameListCtrl>("owner list"); - mOwnerList->sortByColumn(3, FALSE); + mOwnerList->sortByColumnIndex(3, FALSE); childSetCommitCallback("owner list", onCommitList, this); mOwnerList->setDoubleClickCallback(onDoubleClickOwner); @@ -1279,7 +1251,7 @@ void LLPanelLandObjects::callbackReturnOwnerObjects(S32 option, void* userdata) if (parcel) { LLUUID owner_id = parcel->getOwnerID(); - LLString::format_map_t args; + LLStringUtil::format_map_t args; if (owner_id == gAgentID) { LLNotifyBox::showXml("OwnedObjectsReturned"); @@ -1312,7 +1284,7 @@ void LLPanelLandObjects::callbackReturnGroupObjects(S32 option, void* userdata) { std::string group_name; gCacheName->getGroupName(parcel->getGroupID(), group_name); - LLString::format_map_t args; + LLStringUtil::format_map_t args; args["[GROUPNAME]"] = group_name; LLNotifyBox::showXml("GroupObjectsReturned", args); send_return_objects_message(parcel->getLocalID(), RT_GROUP); @@ -1354,7 +1326,7 @@ void LLPanelLandObjects::callbackReturnOwnerList(S32 option, void* userdata) uuid_list_t::iterator selected = self->mSelectedOwners.begin(); if (selected != self->mSelectedOwners.end()) { - LLString::format_map_t args; + LLStringUtil::format_map_t args; if (self->mSelectedIsGroup) { args["[GROUPNAME]"] = self->mSelectedName; @@ -1394,7 +1366,7 @@ void LLPanelLandObjects::onClickReturnOwnerList(void* userdata) send_parcel_select_objects(parcelp->getLocalID(), RT_LIST, &(self->mSelectedOwners)); - LLStringBase<char>::format_map_t args; + LLStringUtil::format_map_t args; args["[NAME]"] = self->mSelectedName; args["[N]"] = llformat("%d",self->mSelectedCount); if (self->mSelectedIsGroup) @@ -1423,7 +1395,7 @@ void LLPanelLandObjects::onClickRefresh(void* userdata) // ready the list for results self->mOwnerList->deleteAllItems(); - self->mOwnerList->addCommentText("Searching..."); + self->mOwnerList->addCommentText(std::string("Searching...")); // *TODO: Translate self->mOwnerList->setEnabled(FALSE); self->mFirstReply = TRUE; @@ -1459,7 +1431,7 @@ void LLPanelLandObjects::processParcelObjectOwnersReply(LLMessageSystem *msg, vo BOOL is_group_owned; S32 object_count; BOOL is_online; - char object_count_str[MAX_STRING]; /*Flawfinder: ignore*/ + std::string object_count_str; //BOOL b_need_refresh = FALSE; // If we were waiting for the first reply, clear the "Searching..." text. @@ -1498,9 +1470,9 @@ void LLPanelLandObjects::processParcelObjectOwnersReply(LLMessageSystem *msg, vo row->addColumn(OWNER_OFFLINE, FONT); } // Placeholder for name. - row->addColumn(LLString::null, FONT); + row->addColumn(LLStringUtil::null, FONT); - snprintf(object_count_str, sizeof(object_count_str), "%d", object_count); /* Flawfinder: ignore */ + object_count_str = llformat("%d", object_count); row->addColumn(object_count_str, FONT); if (is_group_owned) @@ -1518,7 +1490,7 @@ void LLPanelLandObjects::processParcelObjectOwnersReply(LLMessageSystem *msg, vo // check for no results if (0 == self->mOwnerList->getItemCount()) { - self->mOwnerList->addCommentText("None found."); + self->mOwnerList->addCommentText(std::string("None found.")); // *TODO: Translate } else { @@ -1604,7 +1576,7 @@ void LLPanelLandObjects::onClickReturnOwnerObjects(void* userdata) LLUUID owner_id = parcel->getOwnerID(); - LLStringBase<char>::format_map_t args; + LLStringUtil::format_map_t args; args["[N]"] = llformat("%d",owned); if (owner_id == gAgent.getID()) @@ -1632,7 +1604,7 @@ void LLPanelLandObjects::onClickReturnGroupObjects(void* userdata) std::string group_name; gCacheName->getGroupName(parcel->getGroupID(), group_name); - LLStringBase<char>::format_map_t args; + LLStringUtil::format_map_t args; args["[NAME]"] = group_name; args["[N]"] = llformat("%d", parcel->getGroupPrimCount()); @@ -1653,7 +1625,7 @@ void LLPanelLandObjects::onClickReturnOtherObjects(void* userdata) send_parcel_select_objects(parcel->getLocalID(), RT_OTHER); - LLStringBase<char>::format_map_t args; + LLStringUtil::format_map_t args; args["[N]"] = llformat("%d", other); if (parcel->getIsGroupOwned()) @@ -1709,7 +1681,7 @@ void LLPanelLandObjects::onCommitClean(LLUICtrl *caller, void* user_data) //--------------------------------------------------------------------------- LLPanelLandOptions::LLPanelLandOptions(LLParcelSelectionHandle& parcel) -: LLPanel("land_options_panel"), +: LLPanel(std::string("land_options_panel")), mCheckEditObjects(NULL), mCheckEditGroupObjects(NULL), mCheckAllObjectEntry(NULL), @@ -1903,8 +1875,8 @@ void LLPanelLandOptions::refresh() mPushRestrictionCtrl->setEnabled(FALSE); // *TODO:Translate - const char* none_string = LLParcel::getCategoryUIString(LLParcel::C_NONE); - mCategoryCombo->setSimple(LLString(none_string)); + const std::string& none_string = LLParcel::getCategoryUIString(LLParcel::C_NONE); + mCategoryCombo->setSimple(none_string); mCategoryCombo->setEnabled(FALSE); mLandingTypeCombo->setCurrentByIndex(0); @@ -1975,8 +1947,8 @@ void LLPanelLandOptions::refresh() // Set by string in case the order in UI doesn't match the order by index. // *TODO:Translate LLParcel::ECategory cat = parcel->getCategory(); - const char* category_string = LLParcel::getCategoryUIString(cat); - mCategoryCombo->setSimple(LLString(category_string)); + const std::string& category_string = LLParcel::getCategoryUIString(cat); + mCategoryCombo->setSimple(category_string); mCategoryCombo->setEnabled( can_change_identity ); BOOL can_change_landing_point = LLViewerParcelMgr::isParcelModifiableByAgent(parcel, @@ -2188,7 +2160,7 @@ void LLPanelLandOptions::onClickPublishHelp(void*) //--------------------------------------------------------------------------- LLPanelLandAccess::LLPanelLandAccess(LLParcelSelectionHandle& parcel) -: LLPanel("land_access_panel"), mParcel(parcel) +: LLPanel(std::string("land_access_panel")), mParcel(parcel) { } @@ -2212,11 +2184,11 @@ BOOL LLPanelLandAccess::postBuild() mListAccess = getChild<LLNameListCtrl>("AccessList"); if (mListAccess) - mListAccess->sortByColumn(0, TRUE); // ascending + mListAccess->sortByColumnIndex(0, TRUE); // ascending mListBanned = getChild<LLNameListCtrl>("BannedList"); if (mListBanned) - mListBanned->sortByColumn(0, TRUE); // ascending + mListBanned->sortByColumnIndex(0, TRUE); // ascending return TRUE; } @@ -2260,7 +2232,7 @@ void LLPanelLandAccess::refresh() cit != parcel->mAccessList.end(); ++cit) { const LLAccessEntry& entry = (*cit).second; - LLString suffix; + std::string suffix; if (entry.mTime != 0) { S32 now = time(NULL); @@ -2299,7 +2271,7 @@ void LLPanelLandAccess::refresh() cit != parcel->mBanList.end(); ++cit) { const LLAccessEntry& entry = (*cit).second; - LLString suffix; + std::string suffix; if (entry.mTime != 0) { S32 now = time(NULL); @@ -2366,7 +2338,7 @@ void LLPanelLandAccess::refresh() childSetValue("limit_payment", FALSE); childSetValue("limit_age_verified", FALSE); childSetValue("GroupCheck", FALSE); - childSetLabelArg("GroupCheck", "[GROUP]", LLString::null ); + childSetLabelArg("GroupCheck", "[GROUP]", LLStringUtil::null ); childSetValue("PassCheck", FALSE); childSetValue("PriceSpin", (F32)PARCEL_PASS_PRICE_DEFAULT); childSetValue( "HoursSpin", PARCEL_PASS_HOURS_DEFAULT ); @@ -2425,7 +2397,7 @@ void LLPanelLandAccess::refresh_ui() } else { - childSetToolTip("Only Allow", LLString()); + childSetToolTip("Only Allow", std::string()); } childSetEnabled("GroupCheck", FALSE); childSetEnabled("PassCheck", FALSE); @@ -2436,7 +2408,8 @@ void LLPanelLandAccess::refresh_ui() { childSetEnabled("limit_payment", FALSE); childSetEnabled("limit_age_verified", FALSE); - char group_name[MAX_STRING]; /*Flawfinder: ignore*/ + + std::string group_name; if (gCacheName->getGroupName(parcel->getGroupID(), group_name)) { childSetEnabled("GroupCheck", can_manage_allowed); @@ -2499,7 +2472,7 @@ void LLPanelLandAccess::onCommitPublicAccess(LLUICtrl *ctrl, void *userdata) BOOL public_access = self->childGetValue("public_access").asBoolean(); if (public_access == FALSE) { - char group_name[MAX_STRING]; /*Flawfinder: ignore*/ + std::string group_name; if (gCacheName->getGroupName(parcel->getGroupID(), group_name)) { self->childSetValue("GroupCheck", public_access ? FALSE : TRUE); @@ -2682,7 +2655,7 @@ void LLPanelLandAccess::onClickRemoveBanned(void* data) // LLPanelLandCovenant //--------------------------------------------------------------------------- LLPanelLandCovenant::LLPanelLandCovenant(LLParcelSelectionHandle& parcel) -: LLPanel("land_covenant_panel"), mParcel(parcel) +: LLPanel(std::string("land_covenant_panel")), mParcel(parcel) { } diff --git a/indra/newview/llfloaterland.h b/indra/newview/llfloaterland.h index 9979e8b24a..9bed9d53ae 100644 --- a/indra/newview/llfloaterland.h +++ b/indra/newview/llfloaterland.h @@ -288,7 +288,7 @@ protected: BOOL mFirstReply; uuid_list_t mSelectedOwners; - LLString mSelectedName; + std::string mSelectedName; S32 mSelectedCount; BOOL mSelectedIsGroup; diff --git a/indra/newview/llfloaterlandholdings.cpp b/indra/newview/llfloaterlandholdings.cpp index 08ea7e1b8e..dfc3896a6a 100644 --- a/indra/newview/llfloaterlandholdings.cpp +++ b/indra/newview/llfloaterlandholdings.cpp @@ -82,7 +82,7 @@ void LLFloaterLandHoldings::show(void*) // protected LLFloaterLandHoldings::LLFloaterLandHoldings() -: LLFloater("land holdings floater"), +: LLFloater(std::string("land holdings floater")), mActualArea(0), mBillableArea(0), mFirstPacketReceived(FALSE), @@ -183,28 +183,28 @@ void LLFloaterLandHoldings::processPlacesReply(LLMessageSystem* msg, void**) } LLUUID owner_id; - char name[MAX_STRING]; /* Flawfinder: ignore */ - char desc[MAX_STRING]; /* Flawfinder: ignore */ + std::string name; + std::string desc; S32 actual_area; S32 billable_area; U8 flags; F32 global_x; F32 global_y; - char sim_name[MAX_STRING]; /* Flawfinder: ignore */ + std::string sim_name; S32 i; S32 count = msg->getNumberOfBlocks("QueryData"); for (i = 0; i < count; i++) { msg->getUUID("QueryData", "OwnerID", owner_id, i); - msg->getString("QueryData", "Name", MAX_STRING, name, i); - msg->getString("QueryData", "Desc", MAX_STRING, desc, i); + msg->getString("QueryData", "Name", name, i); + msg->getString("QueryData", "Desc", desc, i); msg->getS32("QueryData", "ActualArea", actual_area, i); msg->getS32("QueryData", "BillableArea", billable_area, i); msg->getU8("QueryData", "Flags", flags, i); msg->getF32("QueryData", "GlobalX", global_x, i); msg->getF32("QueryData", "GlobalY", global_y, i); - msg->getString("QueryData", "SimName", MAX_STRING, sim_name, i); + msg->getString("QueryData", "SimName", sim_name, i); self->mActualArea += actual_area; self->mBillableArea += billable_area; @@ -212,21 +212,21 @@ void LLFloaterLandHoldings::processPlacesReply(LLMessageSystem* msg, void**) S32 region_x = llround(global_x) % REGION_WIDTH_UNITS; S32 region_y = llround(global_y) % REGION_WIDTH_UNITS; - char location[MAX_STRING]; /* Flawfinder: ignore */ - snprintf(location, MAX_STRING, "%s (%d, %d)", sim_name, region_x, region_y); /* Flawfinder: ignore */ + std::string location; + location = llformat("%s (%d, %d)", sim_name.c_str(), region_x, region_y); - char area[MAX_STRING]; /* Flawfinder: ignore */ + std::string area; if(billable_area == actual_area) { - snprintf(area, MAX_STRING, "%d", billable_area); /* Flawfinder: ignore */ + area = llformat("%d", billable_area); } else { - snprintf(area, MAX_STRING, "%d / %d", billable_area, actual_area); /* Flawfinder: ignore */ + area = llformat("%d / %d", billable_area, actual_area); } - char hidden[MAX_STRING]; /* Flawfinder: ignore */ - snprintf(hidden, MAX_STRING, "%f %f", global_x, global_y); /* Flawfinder: ignore */ + std::string hidden; + hidden = llformat("%f %f", global_x, global_y); LLSD element; element["columns"][0]["column"] = "name"; @@ -256,7 +256,7 @@ void LLFloaterLandHoldings::buttonCore(S32 which) S32 index = list->getFirstSelectedIndex(); if (index < 0) return; - LLString location = list->getSelectedItemLabel(3); + std::string location = list->getSelectedItemLabel(3); F32 global_x = 0.f; F32 global_y = 0.f; diff --git a/indra/newview/llfloaterlandholdings.h b/indra/newview/llfloaterlandholdings.h index 3490547a75..7ec7e70c18 100644 --- a/indra/newview/llfloaterlandholdings.h +++ b/indra/newview/llfloaterlandholdings.h @@ -78,7 +78,7 @@ protected: // Used to clear out the mParcelList's "Loading..." indicator BOOL mFirstPacketReceived; - LLString mSortColumn; + std::string mSortColumn; BOOL mSortAscending; }; diff --git a/indra/newview/llfloatermap.cpp b/indra/newview/llfloatermap.cpp index d147f863ef..7067d4b055 100644 --- a/indra/newview/llfloatermap.cpp +++ b/indra/newview/llfloatermap.cpp @@ -86,8 +86,6 @@ const S32 MAP_SCALE_MIN = 35; // in pixels per sim const S32 MAP_SCALE_MAX = 180; // in pixels per sim const S32 MAP_SCALE_INCREMENT = 5; -const char MAP_TITLE[] = ""; - const S32 NETMAP_MIN_WIDTH = 128; const S32 NETMAP_MIN_HEIGHT = 128; @@ -118,8 +116,8 @@ LLFloaterMap *gFloaterMap = NULL; LLFloaterMap::LLFloaterMap(const std::string& name) : LLFloater(name, - "FloaterMiniMapRect", - MAP_TITLE, + std::string("FloaterMiniMapRect"), + LLStringUtil::null, TRUE, FLOATERMAP_MIN_WIDTH, FLOATERMAP_MIN_HEIGHT_LARGE, diff --git a/indra/newview/llfloaternamedesc.cpp b/indra/newview/llfloaternamedesc.cpp index 2c7d40695b..a95cafa7e4 100644 --- a/indra/newview/llfloaternamedesc.cpp +++ b/indra/newview/llfloaternamedesc.cpp @@ -65,13 +65,12 @@ const S32 PREF_BUTTON_HEIGHT = 16; // LLFloaterNameDesc() //----------------------------------------------------------------------------- LLFloaterNameDesc::LLFloaterNameDesc(const std::string& filename ) - : - LLFloater("Name/Description Floater") + : LLFloater(std::string("Name/Description Floater")) { mFilenameAndPath = filename; - mFilename.assign(strrchr( filename.c_str(), gDirUtilp->getDirDelimiter()[0]) + 1); + mFilename = gDirUtilp->getBaseFileName(filename, false); // SL-5521 Maintain capitalization of filename when making the inventory item. JC - //LLString::toLower(mFilename); + //LLStringUtil::toLower(mFilename); mIsAudio = FALSE; } @@ -82,27 +81,18 @@ BOOL LLFloaterNameDesc::postBuild() { LLRect r; - LLString asset_name = mFilename; - LLString::replaceNonstandardASCII( asset_name, '?' ); - LLString::replaceChar(asset_name, '|', '?'); - LLString::stripNonprintable(asset_name); - LLString::trim(asset_name); + std::string asset_name = mFilename; + LLStringUtil::replaceNonstandardASCII( asset_name, '?' ); + LLStringUtil::replaceChar(asset_name, '|', '?'); + LLStringUtil::stripNonprintable(asset_name); + LLStringUtil::trim(asset_name); - char* asset_name_str = (char*)asset_name.c_str(); - char* end_p = strrchr(asset_name_str, '.'); // strip extension if exists - if( !end_p ) - { - end_p = asset_name_str + strlen( asset_name_str ); /* Flawfinder: ignore */ - } - else - if( !stricmp( end_p, ".wav") ) + std::string exten = gDirUtilp->getExtension(asset_name); + if (exten == "wav") { mIsAudio = TRUE; } - - S32 len = llmin( (S32) (DB_INV_ITEM_NAME_STR_LEN), (S32) (end_p - asset_name_str) ); - - asset_name = asset_name.substr( 0, len ); + asset_name = gDirUtilp->getBaseFileName(asset_name, true); // no extsntion setTitle(mFilename); diff --git a/indra/newview/llfloaternamedesc.h b/indra/newview/llfloaternamedesc.h index 8c968329c2..22f8080662 100644 --- a/indra/newview/llfloaternamedesc.h +++ b/indra/newview/llfloaternamedesc.h @@ -54,8 +54,8 @@ protected: protected: BOOL mIsAudio; - LLString mFilenameAndPath; - LLString mFilename; + std::string mFilenameAndPath; + std::string mFilename; static void onBtnOK(void*); static void onBtnCancel(void*); diff --git a/indra/newview/llfloateropenobject.cpp b/indra/newview/llfloateropenobject.cpp index a3350b5225..b1380ccd8c 100644 --- a/indra/newview/llfloateropenobject.cpp +++ b/indra/newview/llfloateropenobject.cpp @@ -57,7 +57,7 @@ LLFloaterOpenObject* LLFloaterOpenObject::sInstance = NULL; LLFloaterOpenObject::LLFloaterOpenObject() -: LLFloater("object_contents"), +: LLFloater(std::string("object_contents")), mPanelInventory(NULL), mDirty(TRUE) { @@ -67,7 +67,7 @@ LLFloaterOpenObject::LLFloaterOpenObject() childSetAction("copy_to_inventory_button", onClickMoveToInventory, this); childSetAction("copy_and_wear_button", onClickMoveAndWear, this); - childSetTextArg("object_name", "[DESC]", LLString("Object") ); // *Note: probably do not want to translate this + childSetTextArg("object_name", "[DESC]", std::string("Object") ); // *Note: probably do not want to translate this } LLFloaterOpenObject::~LLFloaterOpenObject() @@ -215,6 +215,6 @@ void LLFloaterOpenObject::onClickMoveAndWear(void* data) void* LLFloaterOpenObject::createPanelInventory(void* data) { LLFloaterOpenObject* floater = (LLFloaterOpenObject*)data; - floater->mPanelInventory = new LLPanelInventory("Object Contents", LLRect()); + floater->mPanelInventory = new LLPanelInventory(std::string("Object Contents"), LLRect()); return floater->mPanelInventory; } diff --git a/indra/newview/llfloaterpostcard.cpp b/indra/newview/llfloaterpostcard.cpp index 8741cdf510..1e71872ea6 100644 --- a/indra/newview/llfloaterpostcard.cpp +++ b/indra/newview/llfloaterpostcard.cpp @@ -75,7 +75,7 @@ LLFloaterPostcard::instance_list_t LLFloaterPostcard::sInstances; ///---------------------------------------------------------------------------- LLFloaterPostcard::LLFloaterPostcard(LLImageJPEG* jpeg, LLImageGL *img, const LLVector2& img_scale, const LLVector3d& pos_taken_global) -: LLFloater("Postcard Floater"), +: LLFloater(std::string("Postcard Floater")), mJPEGImage(jpeg), mViewerImage(img), mImageScale(img_scale), @@ -282,7 +282,7 @@ void LLFloaterPostcard::uploadCallback(const LLUUID& asset_id, void *user_data, if (result) { - LLStringBase<char>::format_map_t args; + LLStringUtil::format_map_t args; args["[REASON]"] = std::string(LLAssetStorage::getErrorString(result)); gViewerWindow->alertXml("ErrorUploadingPostcard", args); } @@ -312,13 +312,13 @@ void LLFloaterPostcard::uploadCallback(const LLUUID& asset_id, void *user_data, } // static -void LLFloaterPostcard::updateUserInfo(const char *email) +void LLFloaterPostcard::updateUserInfo(const std::string& email) { for (instance_list_t::iterator iter = sInstances.begin(); iter != sInstances.end(); ++iter) { LLFloaterPostcard *instance = *iter; - const LLString& text = instance->childGetValue("from_form").asString(); + const std::string& text = instance->childGetValue("from_form").asString(); if (text.empty()) { // there's no text in this field yet, pre-populate @@ -336,7 +336,7 @@ void LLFloaterPostcard::onMsgFormFocusRecieved(LLFocusableElement* receiver, voi if(msgForm && msgForm == receiver && msgForm->hasFocus() && !(self->mHasFirstMsgFocus)) { self->mHasFirstMsgFocus = true; - msgForm->setText(LLString::null); + msgForm->setText(LLStringUtil::null); } } } diff --git a/indra/newview/llfloaterpostcard.h b/indra/newview/llfloaterpostcard.h index 2e2fffb18a..28248f65df 100644 --- a/indra/newview/llfloaterpostcard.h +++ b/indra/newview/llfloaterpostcard.h @@ -62,7 +62,7 @@ public: void *user_data, S32 result, LLExtStat ext_status); - static void updateUserInfo(const char *email); + static void updateUserInfo(const std::string& email); static void onMsgFormFocusRecieved(LLFocusableElement* receiver, void* data); static void missingSubjMsgAlertCallback(S32 option, void* data); diff --git a/indra/newview/llfloaterpostprocess.cpp b/indra/newview/llfloaterpostprocess.cpp index 5c42f1222f..692b7e036f 100644 --- a/indra/newview/llfloaterpostprocess.cpp +++ b/indra/newview/llfloaterpostprocess.cpp @@ -46,7 +46,7 @@ LLFloaterPostProcess* LLFloaterPostProcess::sPostProcess = NULL; -LLFloaterPostProcess::LLFloaterPostProcess() : LLFloater("Post-Process Floater") +LLFloaterPostProcess::LLFloaterPostProcess() : LLFloater(std::string("Post-Process Floater")) { LLUICtrlFactory::getInstance()->buildFloater(this, "floater_post_process.xml"); diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index f78da984a9..981c9c41b3 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -302,10 +302,7 @@ void LLPreferenceCore::onTabChanged(void* user_data, bool from_click) } -void LLPreferenceCore::setPersonalInfo( - const char* visibility, - BOOL im_via_email, - const char* email) +void LLPreferenceCore::setPersonalInfo(const std::string& visibility, bool im_via_email, const std::string& email) { mPrefsIM->setPersonalInfo(visibility, im_via_email, email); } @@ -435,7 +432,7 @@ void LLFloaterPreference::onBtnOK( void* userdata ) std::string crash_settings_filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, CRASH_SETTINGS_FILE); // save all settings, even if equals defaults - gCrashSettings.saveToFile(crash_settings_filename.c_str(), FALSE); + gCrashSettings.saveToFile(crash_settings_filename, FALSE); } else { @@ -488,15 +485,11 @@ void LLFloaterPreference::onBtnCancel( void* userdata ) // static -void LLFloaterPreference::updateUserInfo( - const char* visibility, - BOOL im_via_email, - const char* email) +void LLFloaterPreference::updateUserInfo(const std::string& visibility, bool im_via_email, const std::string& email) { if(sInstance && sInstance->mPreferenceCore) { - sInstance->mPreferenceCore->setPersonalInfo( - visibility, im_via_email, email); + sInstance->mPreferenceCore->setPersonalInfo(visibility, im_via_email, email); } } diff --git a/indra/newview/llfloaterpreference.h b/indra/newview/llfloaterpreference.h index b915dff660..1a580a0e8c 100644 --- a/indra/newview/llfloaterpreference.h +++ b/indra/newview/llfloaterpreference.h @@ -68,10 +68,7 @@ public: LLTabContainer* getTabContainer() { return mTabContainer; } - void setPersonalInfo( - const char* visibility, - BOOL im_via_email, - const char* email); + void setPersonalInfo(const std::string& visibility, bool im_via_email, const std::string& email); static void onTabChanged(void* user_data, bool from_click); @@ -107,10 +104,7 @@ public: static void show(void*); // static data update, called from message handler - static void updateUserInfo( - const char* visibility, - BOOL im_via_email, - const char* email); + static void updateUserInfo(const std::string& visibility, bool im_via_email, const std::string& email); // refresh all the graphics preferences menus static void refreshEnabledGraphics(); diff --git a/indra/newview/llfloaterproperties.cpp b/indra/newview/llfloaterproperties.cpp index 21ed153920..4a996a9c06 100644 --- a/indra/newview/llfloaterproperties.cpp +++ b/indra/newview/llfloaterproperties.cpp @@ -346,7 +346,7 @@ void LLFloaterProperties::refreshFromItem(LLInventoryItem* item) //////////////// if(perm.isOwned()) { - LLString name; + std::string name; if (perm.isGroupOwned()) { gCacheName->getGroupName(perm.getGroup(), name); @@ -380,7 +380,7 @@ void LLFloaterProperties::refreshFromItem(LLInventoryItem* item) } else { - childSetText("LabelAcquiredDate", LLString(ctime(&time_utc)) ); + childSetText("LabelAcquiredDate", std::string(ctime(&time_utc)) ); } /////////////////////// @@ -942,7 +942,7 @@ void LLFloaterProperties::closeByID(const LLUUID& item_id, const LLUUID &object_ /// LLMultiProperties ///---------------------------------------------------------------------------- -LLMultiProperties::LLMultiProperties(const LLRect &rect) : LLMultiFloater("Properties", rect) +LLMultiProperties::LLMultiProperties(const LLRect &rect) : LLMultiFloater(std::string("Properties"), rect) { } diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index 925ba0156d..fc3c0952cb 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -47,6 +47,7 @@ #include "llagent.h" #include "llalertdialog.h" +#include "llappviewer.h" #include "llfloateravatarpicker.h" #include "llbutton.h" #include "llcheckboxctrl.h" @@ -80,9 +81,6 @@ const S32 TERRAIN_TEXTURE_COUNT = 4; const S32 CORNER_COUNT = 4; -extern LLString gLastVersionChannel; - - ///---------------------------------------------------------------------------- /// Local class declaration ///---------------------------------------------------------------------------- @@ -263,7 +261,7 @@ void LLFloaterRegionInfo::processEstateOwnerRequest(LLMessageSystem* msg,void**) LLDispatcher::unpackMessage(msg, request, invoice, strings); if(invoice != getLastInvoice()) { - llwarns << "Mismatched Estate message: " << request.c_str() << llendl; + llwarns << "Mismatched Estate message: " << request << llendl; return; } @@ -294,7 +292,7 @@ void LLFloaterRegionInfo::processRegionInfo(LLMessageSystem* msg) BOOL allow_modify = gAgent.isGodlike() || (region && region->canManageEstate()); // extract message - char sim_name[MAX_STRING]; /* Flawfinder: ignore*/ + std::string sim_name; U32 region_flags; U8 agent_limit; F32 object_bonus_factor; @@ -304,7 +302,7 @@ void LLFloaterRegionInfo::processRegionInfo(LLMessageSystem* msg) F32 terrain_lower_limit; BOOL use_estate_sun; F32 sun_hour; - msg->getString("RegionInfo", "SimName", MAX_STRING, sim_name); + msg->getString("RegionInfo", "SimName", sim_name); msg->getU32("RegionInfo", "RegionFlags", region_flags); msg->getU8("RegionInfo", "MaxAgents", agent_limit); msg->getF32("RegionInfo", "ObjectBonusFactor", object_bonus_factor); @@ -488,7 +486,7 @@ bool LLPanelRegionInfo::refreshFromRegion(LLViewerRegion* region) void LLPanelRegionInfo::sendEstateOwnerMessage( LLMessageSystem* msg, - const char* request, + const std::string& request, const LLUUID& invoice, const strings_t& strings) { @@ -513,43 +511,44 @@ void LLPanelRegionInfo::sendEstateOwnerMessage( for(; it != end; ++it) { msg->nextBlock("ParamList"); - msg->addString("Parameter", (*it).c_str()); + msg->addString("Parameter", *it); } } msg->sendReliable(mHost); } -void LLPanelRegionInfo::enableButton(const char* btn_name, BOOL enable) +void LLPanelRegionInfo::enableButton(const std::string& btn_name, BOOL enable) { childSetEnabled(btn_name, enable); } -void LLPanelRegionInfo::disableButton(const char* btn_name) +void LLPanelRegionInfo::disableButton(const std::string& btn_name) { childDisable(btn_name); } -void LLPanelRegionInfo::initCtrl(const char* name) +void LLPanelRegionInfo::initCtrl(const std::string& name) { childSetCommitCallback(name, onChangeAnything, this); } -void LLPanelRegionInfo::initTextCtrl(const char* name) +void LLPanelRegionInfo::initTextCtrl(const std::string& name) { childSetCommitCallback(name, onChangeAnything, this); childSetKeystrokeCallback("abuse_email_address", onChangeText, this); } -void LLPanelRegionInfo::initHelpBtn(const char* name, const char* xml_alert) +void LLPanelRegionInfo::initHelpBtn(const std::string& name, const std::string& xml_alert) { - childSetAction(name, onClickHelp, (void*)xml_alert); + childSetAction(name, onClickHelp, new std::string(xml_alert)); } // static void LLPanelRegionInfo::onClickHelp(void* data) { - const char* xml_alert = (const char*)data; - gViewerWindow->alertXml(xml_alert); + const std::string* xml_alert = (std::string*)data; + gViewerWindow->alertXml(*xml_alert); + delete xml_alert; } ///////////////////////////////////////////////////////////////////////////// @@ -630,7 +629,7 @@ void LLPanelRegionGeneralInfo::onKickCommit(const std::vector<std::string>& name strings_t strings; // [0] = our agent id // [1] = target agent id - char buffer[MAX_STRING]; /* Flawfinder: ignore*/ + std::string buffer; gAgent.getID().toString(buffer); strings.push_back(buffer); @@ -658,7 +657,7 @@ void LLPanelRegionGeneralInfo::onKickAllCommit(S32 option, void* userdata) if(!self) return; strings_t strings; // [0] = our agent id - char buffer[MAX_STRING]; /* Flawfinder: ignore*/ + std::string buffer; gAgent.getID().toString(buffer); strings.push_back(buffer); @@ -672,13 +671,13 @@ void LLPanelRegionGeneralInfo::onKickAllCommit(S32 option, void* userdata) void LLPanelRegionGeneralInfo::onClickMessage(void* userdata) { llinfos << "LLPanelRegionGeneralInfo::onClickMessage" << llendl; - gViewerWindow->alertXmlEditText("MessageRegion", LLString::format_map_t(), + gViewerWindow->alertXmlEditText("MessageRegion", LLStringUtil::format_map_t(), NULL, NULL, onMessageCommit, userdata); } // static -void LLPanelRegionGeneralInfo::onMessageCommit(S32 option, const LLString& text, void* userdata) +void LLPanelRegionGeneralInfo::onMessageCommit(S32 option, const std::string& text, void* userdata) { if(option != 0) return; if(text.empty()) return; @@ -693,7 +692,7 @@ void LLPanelRegionGeneralInfo::onMessageCommit(S32 option, const LLString& text, // [4] message strings.push_back("-1"); strings.push_back("-1"); - char buffer[MAX_STRING]; /* Flawfinder: ignore*/ + std::string buffer; gAgent.getID().toString(buffer); strings.push_back(buffer); std::string name; @@ -740,7 +739,7 @@ BOOL LLPanelRegionGeneralInfo::sendUpdate() body["prim_bonus"] = childGetValue("object_bonus_spin"); // the combo box stores strings "Mature" and "PG", but we have to convert back to a number, // because the sim doesn't know from strings for this stuff - body["sim_access"] = LLViewerRegion::stringToAccess(childGetValue("access_combo").asString().c_str()); + body["sim_access"] = LLViewerRegion::stringToAccess(childGetValue("access_combo").asString()); body["restrict_pushobject"] = childGetValue("restrict_pushobject"); body["allow_parcel_changes"] = childGetValue("allow_parcel_changes_check"); body["block_parcel_search"] = childGetValue("block_parcel_search_check"); @@ -750,44 +749,43 @@ BOOL LLPanelRegionGeneralInfo::sendUpdate() else { strings_t strings; - char buffer[MAX_STRING]; /* Flawfinder: ignore*/ + std::string buffer; - snprintf(buffer, MAX_STRING, "%s", (childGetValue("block_terraform_check").asBoolean() ? "Y" : "N")); /* Flawfinder: ignore */ + buffer = llformat("%s", (childGetValue("block_terraform_check").asBoolean() ? "Y" : "N")); strings.push_back(strings_t::value_type(buffer)); - snprintf(buffer, MAX_STRING, "%s", (childGetValue("block_fly_check").asBoolean() ? "Y" : "N")); /* Flawfinder: ignore */ + buffer = llformat("%s", (childGetValue("block_fly_check").asBoolean() ? "Y" : "N")); strings.push_back(strings_t::value_type(buffer)); - snprintf(buffer, MAX_STRING, "%s", (childGetValue("allow_damage_check").asBoolean() ? "Y" : "N")); /* Flawfinder: ignore */ + buffer = llformat("%s", (childGetValue("allow_damage_check").asBoolean() ? "Y" : "N")); strings.push_back(strings_t::value_type(buffer)); - snprintf(buffer, MAX_STRING, "%s", (childGetValue("allow_land_resell_check").asBoolean() ? "Y" : "N")); /* Flawfinder: ignore */ + buffer = llformat("%s", (childGetValue("allow_land_resell_check").asBoolean() ? "Y" : "N")); strings.push_back(strings_t::value_type(buffer)); F32 value = (F32)childGetValue("agent_limit_spin").asReal(); - snprintf(buffer, MAX_STRING, "%f", value); /* Flawfinder: ignore */ + buffer = llformat("%f", value); strings.push_back(strings_t::value_type(buffer)); value = (F32)childGetValue("object_bonus_spin").asReal(); - snprintf(buffer, MAX_STRING, "%f", value); /* Flawfinder: ignore */ + buffer = llformat("%f", value); strings.push_back(strings_t::value_type(buffer)); - U8 access = LLViewerRegion::stringToAccess(childGetValue("access_combo").asString().c_str()); - snprintf(buffer, MAX_STRING, "%d", (S32)access); /* Flawfinder: ignore */ + U8 access = LLViewerRegion::stringToAccess(childGetValue("access_combo").asString()); + buffer = llformat("%d", (S32)access); strings.push_back(strings_t::value_type(buffer)); - snprintf(buffer, MAX_STRING, "%s", (childGetValue("restrict_pushobject").asBoolean() ? "Y" : "N")); /* Flawfinder: ignore */ + buffer = llformat("%s", (childGetValue("restrict_pushobject").asBoolean() ? "Y" : "N")); strings.push_back(strings_t::value_type(buffer)); - snprintf(buffer, MAX_STRING, "%s", (childGetValue("allow_parcel_changes_check").asBoolean() ? "Y" : "N")); /* Flawfinder: ignore */ + buffer = llformat("%s", (childGetValue("allow_parcel_changes_check").asBoolean() ? "Y" : "N")); strings.push_back(strings_t::value_type(buffer)); LLUUID invoice(LLFloaterRegionInfo::getLastInvoice()); sendEstateOwnerMessage(gMessageSystem, "setregioninfo", invoice, strings); LLViewerRegion* region = gAgent.getRegion(); - if (region - && access != region->getSimAccess() ) /* Flawfinder: ignore */ + if (region && access != region->getSimAccess() ) { gViewerWindow->alertXml("RegionMaturityChange"); } @@ -851,15 +849,15 @@ BOOL LLPanelRegionDebugInfo::sendUpdate() { llinfos << "LLPanelRegionDebugInfo::sendUpdate" << llendl; strings_t strings; - char buffer[MAX_STRING]; /* Flawfinder: ignore */ + std::string buffer; - snprintf(buffer, MAX_STRING, "%s", (childGetValue("disable_scripts_check").asBoolean() ? "Y" : "N")); /* Flawfinder: ignore */ + buffer = llformat("%s", (childGetValue("disable_scripts_check").asBoolean() ? "Y" : "N")); strings.push_back(buffer); - snprintf(buffer, MAX_STRING, "%s", (childGetValue("disable_collisions_check").asBoolean() ? "Y" : "N")); /* Flawfinder: ignore */ + buffer = llformat("%s", (childGetValue("disable_collisions_check").asBoolean() ? "Y" : "N")); strings.push_back(buffer); - snprintf(buffer, MAX_STRING, "%s", (childGetValue("disable_physics_check").asBoolean() ? "Y" : "N")); /* Flawfinder: ignore */ + buffer = llformat("%s", (childGetValue("disable_physics_check").asBoolean() ? "Y" : "N")); strings.push_back(buffer); LLUUID invoice(LLFloaterRegionInfo::getLastInvoice()); @@ -888,7 +886,7 @@ void LLPanelRegionDebugInfo::onClickReturnScriptedOtherLand(void* data) LLPanelRegionDebugInfo* panelp = (LLPanelRegionDebugInfo*) data; if (panelp->mTargetAvatar.isNull()) return; - LLString::format_map_t args; + LLStringUtil::format_map_t args; args["[USER_NAME]"] = panelp->childGetValue("target_avatar_name").asString(); gViewerWindow->alertXml("ReturnScriptedOnOthersLand", args, callbackReturnScriptedOtherLand, data); } @@ -917,7 +915,7 @@ void LLPanelRegionDebugInfo::onClickReturnScriptedAll(void* data) if (panelp->mTargetAvatar.isNull()) return; - LLString::format_map_t args; + LLStringUtil::format_map_t args; args["[USER_NAME]"] = panelp->childGetValue("target_avatar_name").asString(); gViewerWindow->alertXml("ReturnScriptedOnAllLand", args, callbackReturnScriptedAll, data); } @@ -1018,10 +1016,10 @@ bool LLPanelRegionTextureInfo::refreshFromRegion(LLViewerRegion* region) LLVLComposition* compp = region->getComposition(); LLTextureCtrl* texture_ctrl; - char buffer[MAX_STRING]; /* Flawfinder: ignore */ + std::string buffer; for(S32 i = 0; i < TERRAIN_TEXTURE_COUNT; ++i) { - snprintf(buffer, MAX_STRING, "texture_detail_%d", i); /* Flawfinder: ignore */ + buffer = llformat("texture_detail_%d", i); texture_ctrl = getChild<LLTextureCtrl>(buffer); if(texture_ctrl) { @@ -1034,9 +1032,9 @@ bool LLPanelRegionTextureInfo::refreshFromRegion(LLViewerRegion* region) for(S32 i = 0; i < CORNER_COUNT; ++i) { - snprintf(buffer, MAX_STRING, "height_start_spin_%d", i); /* Flawfinder: ignore */ + buffer = llformat("height_start_spin_%d", i); childSetValue(buffer, LLSD(compp->getStartHeight(i))); - snprintf(buffer, MAX_STRING, "height_range_spin_%d", i); /* Flawfinder: ignore */ + buffer = llformat("height_range_spin_%d", i); childSetValue(buffer, LLSD(compp->getHeightRange(i))); } @@ -1048,18 +1046,18 @@ bool LLPanelRegionTextureInfo::refreshFromRegion(LLViewerRegion* region) BOOL LLPanelRegionTextureInfo::postBuild() { LLPanelRegionInfo::postBuild(); - char buffer[MAX_STRING]; /* Flawfinder: ignore */ + std::string buffer; for(S32 i = 0; i < TERRAIN_TEXTURE_COUNT; ++i) { - snprintf(buffer, MAX_STRING, "texture_detail_%d", i); /* Flawfinder: ignore */ + buffer = llformat("texture_detail_%d", i); initCtrl(buffer); } for(S32 i = 0; i < CORNER_COUNT; ++i) { - snprintf(buffer, MAX_STRING, "height_start_spin_%d", i); /* Flawfinder: ignore */ + buffer = llformat("height_start_spin_%d", i); initCtrl(buffer); - snprintf(buffer, MAX_STRING, "height_range_spin_%d", i); /* Flawfinder: ignore */ + buffer = llformat("height_range_spin_%d", i); initCtrl(buffer); } @@ -1081,9 +1079,8 @@ BOOL LLPanelRegionTextureInfo::sendUpdate() } LLTextureCtrl* texture_ctrl; - char buffer[MAX_STRING]; /* Flawfinder: ignore */ - char buffer2[MAX_STRING]; /* Flawfinder: ignore */ - char id_str[UUID_STR_LENGTH]; /* Flawfinder: ignore */ + std::string buffer; + std::string id_str; LLMessageSystem* msg = gMessageSystem; strings_t strings; @@ -1091,24 +1088,24 @@ BOOL LLPanelRegionTextureInfo::sendUpdate() for(S32 i = 0; i < TERRAIN_TEXTURE_COUNT; ++i) { - snprintf(buffer, MAX_STRING, "texture_detail_%d", i); /* Flawfinder: ignore */ + buffer = llformat("texture_detail_%d", i); texture_ctrl = getChild<LLTextureCtrl>(buffer); if(texture_ctrl) { LLUUID tmp_id(texture_ctrl->getImageAssetID()); tmp_id.toString(id_str); - snprintf(buffer, MAX_STRING, "%d %s", i, id_str); /* Flawfinder: ignore */ - strings.push_back(strings_t::value_type(buffer)); + buffer = llformat("%d %s", i, id_str.c_str()); + strings.push_back(buffer); } } sendEstateOwnerMessage(msg, "texturedetail", invoice, strings); strings.clear(); for(S32 i = 0; i < CORNER_COUNT; ++i) { - snprintf(buffer, MAX_STRING, "height_start_spin_%d", i); /* Flawfinder: ignore */ - snprintf(buffer2, MAX_STRING, "height_range_spin_%d", i); /* Flawfinder: ignore */ - snprintf(buffer, MAX_STRING, "%d %f %f", i, (F32)childGetValue(buffer).asReal(), (F32)childGetValue(buffer2).asReal()); /* Flawfinder: ignore */ - strings.push_back(strings_t::value_type(buffer)); + buffer = llformat("height_start_spin_%d", i); + std::string buffer2 = llformat("height_range_spin_%d", i); + std::string buffer3 = llformat("%d %f %f", i, (F32)childGetValue(buffer).asReal(), (F32)childGetValue(buffer2).asReal()); + strings.push_back(buffer3); } sendEstateOwnerMessage(msg, "textureheights", invoice, strings); strings.clear(); @@ -1120,8 +1117,8 @@ BOOL LLPanelRegionTextureInfo::validateTextureSizes() { for(S32 i = 0; i < TERRAIN_TEXTURE_COUNT; ++i) { - char buffer[MAX_STRING]; /* Flawfinder: ignore */ - snprintf(buffer, MAX_STRING, "texture_detail_%d", i); /* Flawfinder: ignore */ + std::string buffer; + buffer = llformat("texture_detail_%d", i); LLTextureCtrl* texture_ctrl = getChild<LLTextureCtrl>(buffer); if (!texture_ctrl) continue; @@ -1136,7 +1133,7 @@ BOOL LLPanelRegionTextureInfo::validateTextureSizes() if (components != 3) { - LLString::format_map_t args; + LLStringUtil::format_map_t args; args["[TEXTURE_NUM]"] = llformat("%d",i+1); args["[TEXTURE_BIT_DEPTH]"] = llformat("%d",components * 8); gViewerWindow->alertXml("InvalidTerrainBitDepth", args); @@ -1146,7 +1143,7 @@ BOOL LLPanelRegionTextureInfo::validateTextureSizes() if (width > 512 || height > 512) { - LLString::format_map_t args; + LLStringUtil::format_map_t args; args["[TEXTURE_NUM]"] = llformat("%d",i+1); args["[TEXTURE_SIZE_X]"] = llformat("%d",width); args["[TEXTURE_SIZE_Y]"] = llformat("%d",height); @@ -1222,21 +1219,21 @@ bool LLPanelRegionTerrainInfo::refreshFromRegion(LLViewerRegion* region) BOOL LLPanelRegionTerrainInfo::sendUpdate() { llinfos << "LLPanelRegionTerrainInfo::sendUpdate" << llendl; - char buffer[MAX_STRING]; /* Flawfinder: ignore */ + std::string buffer; strings_t strings; LLUUID invoice(LLFloaterRegionInfo::getLastInvoice()); - snprintf(buffer, MAX_STRING, "%f", (F32)childGetValue("water_height_spin").asReal()); /* Flawfinder: ignore */ + buffer = llformat("%f", (F32)childGetValue("water_height_spin").asReal()); strings.push_back(buffer); - snprintf(buffer, MAX_STRING, "%f", (F32)childGetValue("terrain_raise_spin").asReal()); /* Flawfinder: ignore */ + buffer = llformat("%f", (F32)childGetValue("terrain_raise_spin").asReal()); strings.push_back(buffer); - snprintf(buffer, MAX_STRING, "%f", (F32)childGetValue("terrain_lower_spin").asReal()); /* Flawfinder: ignore */ + buffer = llformat("%f", (F32)childGetValue("terrain_lower_spin").asReal()); strings.push_back(buffer); - snprintf(buffer, MAX_STRING, "%s", (childGetValue("use_estate_sun_check").asBoolean() ? "Y" : "N")); /* Flawfinder: ignore */ + buffer = llformat("%s", (childGetValue("use_estate_sun_check").asBoolean() ? "Y" : "N")); strings.push_back(buffer); - snprintf(buffer, MAX_STRING, "%s", (childGetValue("fixed_sun_check").asBoolean() ? "Y" : "N")); /* Flawfinder: ignore */ + buffer = llformat("%s", (childGetValue("fixed_sun_check").asBoolean() ? "Y" : "N")); strings.push_back(buffer); - snprintf(buffer, MAX_STRING, "%f", (F32)childGetValue("sun_hour_slider").asReal() ); /* Flawfinder: ignore */ + buffer = llformat("%f", (F32)childGetValue("sun_hour_slider").asReal() ); strings.push_back(buffer); // Grab estate information in case the user decided to set the @@ -1262,11 +1259,11 @@ BOOL LLPanelRegionTerrainInfo::sendUpdate() estate_sun_hour = panel->getSunHour(); } - snprintf(buffer, MAX_STRING, "%s", (estate_global_time ? "Y" : "N") ); /* Flawfinder: ignore */ + buffer = llformat("%s", (estate_global_time ? "Y" : "N") ); strings.push_back(buffer); - snprintf(buffer, MAX_STRING, "%s", (estate_fixed_sun ? "Y" : "N") ); /* Flawfinder: ignore */ + buffer = llformat("%s", (estate_fixed_sun ? "Y" : "N") ); strings.push_back(buffer); - snprintf(buffer, MAX_STRING, "%f", estate_sun_hour); /* Flawfinder: ignore */ + buffer = llformat("%f", estate_sun_hour); strings.push_back(buffer); sendEstateOwnerMessage(gMessageSystem, "setregionterrain", invoice, strings); @@ -1317,7 +1314,7 @@ void LLPanelRegionTerrainInfo::onClickDownloadRaw(void* data) llwarns << "No file" << llendl; return; } - LLString filepath = picker.getFirstFile(); + std::string filepath = picker.getFirstFile(); LLPanelRegionTerrainInfo* self = (LLPanelRegionTerrainInfo*)data; strings_t strings; @@ -1336,7 +1333,7 @@ void LLPanelRegionTerrainInfo::onClickUploadRaw(void* data) llwarns << "No file" << llendl; return; } - LLString filepath = picker.getFirstFile(); + std::string filepath = picker.getFirstFile(); LLPanelRegionTerrainInfo* self = (LLPanelRegionTerrainInfo*)data; strings_t strings; @@ -1451,7 +1448,7 @@ void LLPanelEstateInfo::onClickAddAllowedAgent(void* user_data) { //args - LLString::format_map_t args; + LLStringUtil::format_map_t args; args["[MAX_AGENTS]"] = llformat("%d",ESTATE_MAX_ACCESS_IDS); gViewerWindow->alertXml("MaxAllowedAgentOnRegion", args); return; @@ -1473,7 +1470,7 @@ void LLPanelEstateInfo::onClickAddAllowedGroup(void* user_data) if (!list) return; if (list->getItemCount() >= ESTATE_MAX_ACCESS_IDS) { - LLString::format_map_t args; + LLStringUtil::format_map_t args; args["[MAX_GROUPS]"] = llformat("%d",ESTATE_MAX_ACCESS_IDS); gViewerWindow->alertXml("MaxAllowedGroupsOnRegion", args); return; @@ -1525,7 +1522,7 @@ void LLPanelEstateInfo::onClickAddBannedAgent(void* user_data) if (!list) return; if (list->getItemCount() >= ESTATE_MAX_ACCESS_IDS) { - LLString::format_map_t args; + LLStringUtil::format_map_t args; args["[MAX_BANNED]"] = llformat("%d",ESTATE_MAX_ACCESS_IDS); gViewerWindow->alertXml("MaxBannedAgentsOnRegion", args); return; @@ -1547,7 +1544,7 @@ void LLPanelEstateInfo::onClickAddEstateManager(void* user_data) if (!list) return; if (list->getItemCount() >= ESTATE_MAX_MANAGERS) { // Tell user they can't add more managers - LLString::format_map_t args; + LLStringUtil::format_map_t args; args["[MAX_MANAGER]"] = llformat("%d",ESTATE_MAX_MANAGERS); gViewerWindow->alertXml("MaxManagersOnRegion", args); } @@ -1569,7 +1566,7 @@ void LLPanelEstateInfo::onClickRemoveEstateManager(void* user_data) struct LLKickFromEstateInfo { LLPanelEstateInfo *mEstatePanelp; - LLString mDialogName; + std::string mDialogName; LLUUID mAgentID; }; @@ -1605,7 +1602,7 @@ void LLPanelEstateInfo::onKickUserCommit(const std::vector<std::string>& names, kick_info->mAgentID = ids[0]; //Bring up a confirmation dialog - LLString::format_map_t args; + LLStringUtil::format_map_t args; args["[EVIL_USER]"] = names[0]; gViewerWindow->alertXml(kick_info->mDialogName, args, LLPanelEstateInfo::kickUserConfirm, (void*)kick_info); @@ -1619,14 +1616,14 @@ void LLPanelEstateInfo::kickUserConfirm(S32 option, void* userdata) LLUUID invoice(LLFloaterRegionInfo::getLastInvoice()); strings_t strings; - char buffer[MAX_STRING]; /* Flawfinder: ignore*/ + std::string buffer; switch(option) { case 0: //Kick User kick_info->mAgentID.toString(buffer); - strings.push_back(strings_t::value_type(buffer)); + strings.push_back(buffer); kick_info->mEstatePanelp->sendEstateOwnerMessage(gMessageSystem, "kickestate", invoice, strings); break; @@ -1681,7 +1678,7 @@ typedef std::vector<LLUUID> AgentOrGroupIDsVector; struct LLEstateAccessChangeInfo { U32 mOperationFlag; // ESTATE_ACCESS_BANNED_AGENT_ADD, _REMOVE, etc. - LLString mDialogName; + std::string mDialogName; AgentOrGroupIDsVector mAgentOrGroupIDs; // List of agent IDs to apply to this change }; @@ -1700,14 +1697,14 @@ void LLPanelEstateInfo::addAllowedGroup2(LLUUID id, void* user_data) } else { - LLString::format_map_t args; + LLStringUtil::format_map_t args; args["[ALL_ESTATES]"] = all_estates_text(); gViewerWindow->alertXml(change_info->mDialogName, args, accessCoreConfirm, (void*)change_info); } } // static -void LLPanelEstateInfo::accessAddCore(U32 operation_flag, const char* dialog_name) +void LLPanelEstateInfo::accessAddCore(U32 operation_flag, const std::string& dialog_name) { LLEstateAccessChangeInfo* change_info = new LLEstateAccessChangeInfo; change_info->mOperationFlag = operation_flag; @@ -1767,7 +1764,7 @@ void LLPanelEstateInfo::accessAddCore3(const std::vector<std::string>& names, co int currentCount = (list ? list->getItemCount() : 0); if (ids.size() + currentCount > ESTATE_MAX_ACCESS_IDS) { - LLString::format_map_t args; + LLStringUtil::format_map_t args; args["[NUM_ADDED]"] = llformat("%d",ids.size()); args["[MAX_AGENTS]"] = llformat("%d",ESTATE_MAX_ACCESS_IDS); args["[LIST_TYPE]"] = "Allowed Residents"; @@ -1783,7 +1780,7 @@ void LLPanelEstateInfo::accessAddCore3(const std::vector<std::string>& names, co int currentCount = (list ? list->getItemCount() : 0); if (ids.size() + currentCount > ESTATE_MAX_ACCESS_IDS) { - LLString::format_map_t args; + LLStringUtil::format_map_t args; args["[NUM_ADDED]"] = llformat("%d",ids.size()); args["[MAX_AGENTS]"] = llformat("%d",ESTATE_MAX_ACCESS_IDS); args["[LIST_TYPE]"] = "Banned Residents"; @@ -1802,14 +1799,14 @@ void LLPanelEstateInfo::accessAddCore3(const std::vector<std::string>& names, co else { // ask if this estate or all estates with this owner - LLString::format_map_t args; + LLStringUtil::format_map_t args; args["[ALL_ESTATES]"] = all_estates_text(); gViewerWindow->alertXml(change_info->mDialogName, args, accessCoreConfirm, (void*)change_info); } } // static -void LLPanelEstateInfo::accessRemoveCore(U32 operation_flag, const char* dialog_name, const char* list_ctrl_name) +void LLPanelEstateInfo::accessRemoveCore(U32 operation_flag, const std::string& dialog_name, const std::string& list_ctrl_name) { LLPanelEstateInfo* panel = LLFloaterRegionInfo::getPanelEstate(); if (!panel) return; @@ -1866,7 +1863,7 @@ void LLPanelEstateInfo::accessRemoveCore2(S32 option, void* data) } else { - LLString::format_map_t args; + LLStringUtil::format_map_t args; args["[ALL_ESTATES]"] = all_estates_text(); gViewerWindow->alertXml(change_info->mDialogName, args, @@ -1953,12 +1950,12 @@ void LLPanelEstateInfo::sendEstateAccessDelta(U32 flags, const LLUUID& agent_or_ msg->addString("Method", "estateaccessdelta"); msg->addUUID("Invoice", LLFloaterRegionInfo::getLastInvoice()); - char buf[MAX_STRING]; /* Flawfinder: ignore*/ + std::string buf; gAgent.getID().toString(buf); msg->nextBlock("ParamList"); msg->addString("Parameter", buf); - snprintf(buf, MAX_STRING, "%u", flags); /* Flawfinder: ignore */ + buf = llformat("%u", flags); msg->nextBlock("ParamList"); msg->addString("Parameter", buf); @@ -2305,10 +2302,10 @@ void LLPanelEstateInfo::commitEstateInfoDataserver() msg->nextBlock("ParamList"); msg->addString("Parameter", getEstateName()); - char buf[MAX_STRING]; /* Flawfinder: ignore*/ - snprintf(buf, MAX_STRING, "%u", computeEstateFlags()); /* Flawfinder: ignore */ + std::string buffer; + buffer = llformat("%u", computeEstateFlags()); msg->nextBlock("ParamList"); - msg->addString("Parameter", buf); + msg->addString("Parameter", buffer); F32 sun_hour = getSunHour(); if (childGetValue("use_global_time_check").asBoolean()) @@ -2316,9 +2313,9 @@ void LLPanelEstateInfo::commitEstateInfoDataserver() sun_hour = 0.f; // 0 = global time } - snprintf(buf, MAX_STRING, "%d", (S32)(sun_hour*1024.0f)); /* Flawfinder: ignore */ + buffer = llformat("%d", (S32)(sun_hour*1024.0f)); msg->nextBlock("ParamList"); - msg->addString("Parameter", buf); + msg->addString("Parameter", buffer); gAgent.sendMessage(); } @@ -2489,8 +2486,8 @@ void LLPanelEstateInfo::setAccessAllowedEnabled(bool enable_agent, // static void LLPanelEstateInfo::callbackCacheName( const LLUUID& id, - const char* first, - const char* last, + const std::string& first, + const std::string& last, BOOL is_group, void*) { @@ -2505,9 +2502,7 @@ void LLPanelEstateInfo::callbackCacheName( } else { - name = first; - name += " "; - name += last; + name = first + " " + last; } self->setOwnerName(name); @@ -2556,7 +2551,7 @@ BOOL LLPanelEstateInfo::checkRemovalButton(std::string name) // enable the remove button if something is selected LLNameListCtrl* name_list = getChild<LLNameListCtrl>(name); - childSetEnabled(btn_name.c_str(), name_list && name_list->getFirstSelected() ? TRUE : FALSE); + childSetEnabled(btn_name, name_list && name_list->getFirstSelected() ? TRUE : FALSE); return (btn_name != ""); } @@ -2576,13 +2571,13 @@ BOOL LLPanelEstateInfo::checkSunHourSlider(LLUICtrl* child_ctrl) void LLPanelEstateInfo::onClickMessageEstate(void* userdata) { llinfos << "LLPanelEstateInfo::onClickMessageEstate" << llendl; - gViewerWindow->alertXmlEditText("MessageEstate", LLString::format_map_t(), + gViewerWindow->alertXmlEditText("MessageEstate", LLStringUtil::format_map_t(), NULL, NULL, onMessageCommit, userdata); } // static -void LLPanelEstateInfo::onMessageCommit(S32 option, const LLString& text, void* userdata) +void LLPanelEstateInfo::onMessageCommit(S32 option, const std::string& text, void* userdata) { if(option != 0) return; if(text.empty()) return; @@ -2683,7 +2678,7 @@ BOOL LLPanelEstateCovenant::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, - LLString& tooltip_msg) + std::string& tooltip_msg) { LLInventoryItem* item = (LLInventoryItem*)cargo_data; @@ -2809,7 +2804,7 @@ void LLPanelEstateCovenant::onLoadComplete(LLVFS *vfs, if( (file_length > 19) && !strncmp( buffer, "Linden text version", 19 ) ) { - if( !panelp->mEditor->importBuffer( buffer ) ) + if( !panelp->mEditor->importBuffer( buffer, file_length+1 ) ) { llwarns << "Problem importing estate covenant." << llendl; gViewerWindow->alertXml("ProblemImportingEstateCovenant"); @@ -2972,12 +2967,12 @@ bool LLDispatchEstateUpdateInfo::operator()( // NOTE: LLDispatcher extracts strings with an extra \0 at the // end. If we pass the std::string direct to the UI/renderer // it draws with a weird character at the end of the string. - std::string estate_name = strings[0].c_str(); + std::string estate_name = strings[0].c_str(); // preserve c_str() call! panel->setEstateName(estate_name); if (strings.size() > 9) { - std::string abuse_email = strings[9].c_str(); + std::string abuse_email = strings[9].c_str(); // preserve c_str() call! panel->setAbuseEmailAddress(abuse_email); } else @@ -2987,7 +2982,7 @@ bool LLDispatchEstateUpdateInfo::operator()( LLViewerRegion* regionp = gAgent.getRegion(); - LLUUID owner_id(strings[1].c_str()); + LLUUID owner_id(strings[1]); regionp->setOwner(owner_id); // Update estate owner name in UI const BOOL is_group = FALSE; @@ -3105,7 +3100,7 @@ bool LLDispatchSetEstateAccess::operator()( allowed_agent_name_list->addNameItem(id); } panel->childSetEnabled("remove_allowed_avatar_btn", allowed_agent_name_list->getFirstSelected() ? TRUE : FALSE); - allowed_agent_name_list->sortByColumn(0, TRUE); + allowed_agent_name_list->sortByColumnIndex(0, TRUE); } } @@ -3129,7 +3124,7 @@ bool LLDispatchSetEstateAccess::operator()( allowed_group_name_list->addGroupNameItem(id); } panel->childSetEnabled("remove_allowed_group_btn", allowed_group_name_list->getFirstSelected() ? TRUE : FALSE); - allowed_group_name_list->sortByColumn(0, TRUE); + allowed_group_name_list->sortByColumnIndex(0, TRUE); } } @@ -3161,7 +3156,7 @@ bool LLDispatchSetEstateAccess::operator()( banned_agent_name_list->addNameItem(id); } panel->childSetEnabled("remove_banned_avatar_btn", banned_agent_name_list->getFirstSelected() ? TRUE : FALSE); - banned_agent_name_list->sortByColumn(0, TRUE); + banned_agent_name_list->sortByColumnIndex(0, TRUE); } } @@ -3188,7 +3183,7 @@ bool LLDispatchSetEstateAccess::operator()( estate_manager_name_list->addNameItem(id); } panel->childSetEnabled("remove_estate_manager_btn", estate_manager_name_list->getFirstSelected() ? TRUE : FALSE); - estate_manager_name_list->sortByColumn(0, TRUE); + estate_manager_name_list->sortByColumnIndex(0, TRUE); } } diff --git a/indra/newview/llfloaterregioninfo.h b/indra/newview/llfloaterregioninfo.h index b7ee1cc17b..7d05ffa5bc 100644 --- a/indra/newview/llfloaterregioninfo.h +++ b/indra/newview/llfloaterregioninfo.h @@ -102,7 +102,7 @@ protected: class LLPanelRegionInfo : public LLPanel { public: - LLPanelRegionInfo() : LLPanel("Region Info Panel") {} + LLPanelRegionInfo() : LLPanel(std::string("Region Info Panel")) {} static void onBtnSet(void* user_data); static void onChangeChildCtrl(LLUICtrl* ctrl, void* user_data); static void onChangeAnything(LLUICtrl* ctrl, void* user_data); @@ -114,13 +114,13 @@ public: virtual BOOL postBuild(); virtual void updateChild(LLUICtrl* child_ctrl); - void enableButton(const char* btn_name, BOOL enable = TRUE); - void disableButton(const char* btn_name); + void enableButton(const std::string& btn_name, BOOL enable = TRUE); + void disableButton(const std::string& btn_name); protected: - void initCtrl(const char* name); - void initTextCtrl(const char* name); - void initHelpBtn(const char* name, const char* xml_alert); + void initCtrl(const std::string& name); + void initTextCtrl(const std::string& name); + void initHelpBtn(const std::string& name, const std::string& xml_alert); // Callback for all help buttons, data is name of XML alert to show. static void onClickHelp(void* data); @@ -133,7 +133,7 @@ protected: //typedef std::vector<U32> integers_t; void sendEstateOwnerMessage( LLMessageSystem* msg, - const char* request, + const std::string& request, const LLUUID& invoice, const strings_t& strings); @@ -164,7 +164,7 @@ protected: static void onClickKickAll(void* userdata); static void onKickAllCommit(S32 option, void* userdata); static void onClickMessage(void* userdata); - static void onMessageCommit(S32 option, const LLString& text, void* userdata); + static void onMessageCommit(S32 option, const std::string& text, void* userdata); static void onClickManageTelehub(void* data); }; @@ -276,11 +276,11 @@ public: static void addAllowedGroup2(LLUUID id, void* data); // Core methods for all above add/remove button clicks - static void accessAddCore(U32 operation_flag, const char* dialog_name); + static void accessAddCore(U32 operation_flag, const std::string& dialog_name); static void accessAddCore2(S32 option, void* data); static void accessAddCore3(const std::vector<std::string>& names, const std::vector<LLUUID>& ids, void* data); - static void accessRemoveCore(U32 operation_flag, const char* dialog_name, const char* list_ctrl_name); + static void accessRemoveCore(U32 operation_flag, const std::string& dialog_name, const std::string& list_ctrl_name); static void accessRemoveCore2(S32 option, void* data); // used for both add and remove operations @@ -292,7 +292,7 @@ public: static void onKickUserCommit(const std::vector<std::string>& names, const std::vector<LLUUID>& ids, void* userdata); static void onClickMessageEstate(void* data); - static void onMessageCommit(S32 option, const LLString& text, void* data); + static void onMessageCommit(S32 option, const std::string& text, void* data); LLPanelEstateInfo(); ~LLPanelEstateInfo() {} @@ -337,8 +337,8 @@ public: // llmessage/llcachename.h:LLCacheNameCallback static void callbackCacheName( const LLUUID& id, - const char* first, - const char* last, + const std::string& first, + const std::string& last, BOOL is_group, void*); @@ -377,7 +377,7 @@ public: BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, void *cargo_data, EAcceptance *accept, - LLString& tooltip_msg); + std::string& tooltip_msg); static void confirmChangeCovenantCallback(S32 option, void* userdata); static void resetCovenantID(void* userdata); static void confirmResetCovenantCallback(S32 option, void* userdata); diff --git a/indra/newview/llfloaterreporter.cpp b/indra/newview/llfloaterreporter.cpp index 369ac4f3ee..d00157da76 100644 --- a/indra/newview/llfloaterreporter.cpp +++ b/indra/newview/llfloaterreporter.cpp @@ -137,8 +137,8 @@ LLFloaterReporter::LLFloaterReporter( if (pick_btn) { // XUI: Why aren't these in viewerart.ini? - pick_btn->setImages( "UIImgFaceUUID", - "UIImgFaceSelectedUUID" ); + pick_btn->setImages( std::string("UIImgFaceUUID"), + std::string("UIImgFaceSelectedUUID") ); childSetAction("pick_btn", onClickObjPicker, this); } @@ -173,8 +173,8 @@ LLFloaterReporter::LLFloaterReporter( setVisible(TRUE); // Default text to be blank - childSetText("object_name", LLString::null); - childSetText("owner_name", LLString::null); + childSetText("object_name", LLStringUtil::null); + childSetText("owner_name", LLStringUtil::null); childSetFocus("summary_edit"); @@ -308,7 +308,7 @@ void LLFloaterReporter::getObjectInfo(const LLUUID& object_id) if (objectp->isAvatar()) { // we have the information we need - LLString object_owner; + std::string object_owner; LLNameValue* firstname = objectp->getNVPair("FirstName"); LLNameValue* lastname = objectp->getNVPair("LastName"); @@ -391,10 +391,10 @@ void LLFloaterReporter::onClickSend(void *userdata) { if ( ! self->mCopyrightWarningSeen ) { - LLString details_lc = self->childGetText("details_edit"); - LLString::toLower( details_lc ); - LLString summary_lc = self->childGetText("summary_edit"); - LLString::toLower( summary_lc ); + std::string details_lc = self->childGetText("details_edit"); + LLStringUtil::toLower( details_lc ); + std::string summary_lc = self->childGetText("summary_edit"); + LLStringUtil::toLower( summary_lc ); if ( details_lc.find( "copyright" ) != std::string::npos || summary_lc.find( "copyright" ) != std::string::npos ) { @@ -457,8 +457,8 @@ void LLFloaterReporter::onClickObjPicker(void *userdata) LLToolObjPicker::getInstance()->setExitCallback(LLFloaterReporter::closePickTool, self); LLToolMgr::getInstance()->setTransientTool(LLToolObjPicker::getInstance()); self->mPicking = TRUE; - self->childSetText("object_name", LLString::null); - self->childSetText("owner_name", LLString::null); + self->childSetText("object_name", LLStringUtil::null); + self->childSetText("owner_name", LLStringUtil::null); LLButton* pick_btn = self->getChild<LLButton>("pick_btn"); if (pick_btn) pick_btn->setToggleState(TRUE); } @@ -517,7 +517,7 @@ void LLFloaterReporter::showFromMenu(EReportType report_type) } // grab the user's name - LLString fullname; + std::string fullname; gAgent.buildFullname(fullname); f->childSetText("reporter_field", fullname); } @@ -532,7 +532,7 @@ void LLFloaterReporter::showFromObject(const LLUUID& object_id) f->setFocus(TRUE); // grab the user's name - LLString fullname; + std::string fullname; gAgent.buildFullname(fullname); f->childSetText("reporter_field", fullname); @@ -577,7 +577,7 @@ LLFloaterReporter* LLFloaterReporter::createNewBugReporter() -void LLFloaterReporter::setPickedObjectProperties(const LLString& object_name, const LLString& owner_name, const LLUUID owner_id) +void LLFloaterReporter::setPickedObjectProperties(const std::string& object_name, const std::string& owner_name, const LLUUID owner_id) { childSetText("object_name", object_name); childSetText("owner_name", owner_name); @@ -661,7 +661,7 @@ LLSD LLFloaterReporter::gatherReport() summary << "Preview "; } - LLString category_name; + std::string category_name; LLComboBox* combo = getChild<LLComboBox>( "category_combo"); if (combo) { @@ -711,8 +711,8 @@ LLSD LLFloaterReporter::gatherReport() << LL_VERSION_PATCH << "." << LL_VIEWER_BUILD << std::endl << std::endl; } - LLString object_name = childGetText("object_name"); - LLString owner_name = childGetText("owner_name"); + std::string object_name = childGetText("object_name"); + std::string owner_name = childGetText("owner_name"); if (!object_name.empty() && !owner_name.empty()) { details << "Object: " << object_name << "\n"; @@ -727,9 +727,8 @@ LLSD LLFloaterReporter::gatherReport() details << childGetValue("details_edit").asString(); - char version_string[MAX_STRING]; /* Flawfinder: ignore */ - snprintf(version_string, /* Flawfinder: ignore */ - MAX_STRING, + std::string version_string; + version_string = llformat( "%d.%d.%d %s %s %s %s", LL_VERSION_MAJOR, LL_VERSION_MINOR, @@ -794,7 +793,7 @@ void LLFloaterReporter::sendReportViaLegacy(const LLSD & report) msg->addString("AbuseRegionName", report["abuse-region-name"].asString()); msg->addUUID("AbuseRegionID", report["abuse-region-id"].asUUID()); - msg->addStringFast(_PREHASH_Summary, report["summary"].asString().c_str()); + msg->addStringFast(_PREHASH_Summary, report["summary"].asString()); msg->addString("VersionString", report["version-string"]); msg->addStringFast(_PREHASH_Details, report["details"] ); @@ -908,7 +907,7 @@ void LLFloaterReporter::takeScreenshot() { texture->setImageAssetID(mResourceDatap->mAssetInfo.mUuid); texture->setDefaultImageAssetID(mResourceDatap->mAssetInfo.mUuid); - texture->setCaption("Screenshot"); + texture->setCaption(std::string("Screenshot")); } } @@ -937,7 +936,7 @@ void LLFloaterReporter::uploadDoneCallback(const LLUUID &uuid, void *user_data, if(result < 0) { - LLStringBase<char>::format_map_t args; + LLStringUtil::format_map_t args; args["[REASON]"] = std::string(LLAssetStorage::getErrorString(result)); gViewerWindow->alertXml("ErrorUploadingReportScreenshot", args); @@ -975,14 +974,14 @@ void LLFloaterReporter::uploadDoneCallback(const LLUUID &uuid, void *user_data, void LLFloaterReporter::setPosBox(const LLVector3d &pos) { mPosition.setVec(pos); - LLString pos_string = llformat("{%.1f, %.1f, %.1f}", + std::string pos_string = llformat("{%.1f, %.1f, %.1f}", mPosition.mV[VX], mPosition.mV[VY], mPosition.mV[VZ]); childSetText("pos_field", pos_string); } -void LLFloaterReporter::setDescription(const LLString& description, LLMeanCollisionData *mcd) +void LLFloaterReporter::setDescription(const std::string& description, LLMeanCollisionData *mcd) { LLFloaterReporter *self = gReporterInstances[COMPLAINT_REPORT]; if (self) @@ -998,7 +997,7 @@ void LLFloaterReporter::setDescription(const LLString& description, LLMeanCollis } } -void LLFloaterReporter::addDescription(const LLString& description, LLMeanCollisionData *mcd) +void LLFloaterReporter::addDescription(const std::string& description, LLMeanCollisionData *mcd) { LLFloaterReporter *self = gReporterInstances[COMPLAINT_REPORT]; if (self) diff --git a/indra/newview/llfloaterreporter.h b/indra/newview/llfloaterreporter.h index d015b88197..db6d3ef38a 100644 --- a/indra/newview/llfloaterreporter.h +++ b/indra/newview/llfloaterreporter.h @@ -100,8 +100,8 @@ public: static void onClickSelectAbuser (void *userdata); static void closePickTool (void *userdata); static void uploadDoneCallback(const LLUUID &uuid, void* user_data, S32 result, LLExtStat ext_status); - static void addDescription(const LLString& description, LLMeanCollisionData *mcd = NULL); - static void setDescription(const LLString& description, LLMeanCollisionData *mcd = NULL); + static void addDescription(const std::string& description, LLMeanCollisionData *mcd = NULL); + static void setDescription(const std::string& description, LLMeanCollisionData *mcd = NULL); // returns a pointer to reporter of report_type static LLFloaterReporter* getReporter(EReportType report_type); @@ -111,7 +111,7 @@ public: // static static void processRegionInfo(LLMessageSystem* msg); - void setPickedObjectProperties(const LLString& object_name, const LLString& owner_name, const LLUUID owner_id); + void setPickedObjectProperties(const std::string& object_name, const std::string& owner_name, const LLUUID owner_id); private: void takeScreenshot(); @@ -137,7 +137,7 @@ private: LLVector3 mPosition; BOOL mCopyrightWarningSeen; std::list<LLMeanCollisionData*> mMCDList; - LLString mDefaultSummary; + std::string mDefaultSummary; LLResourceData* mResourceDatap; }; diff --git a/indra/newview/llfloaterscriptdebug.cpp b/indra/newview/llfloaterscriptdebug.cpp index 14bc721e8e..7992abad94 100644 --- a/indra/newview/llfloaterscriptdebug.cpp +++ b/indra/newview/llfloaterscriptdebug.cpp @@ -124,7 +124,7 @@ LLFloater* LLFloaterScriptDebug::addOutputWindow(const LLUUID &object_id) void LLFloaterScriptDebug::addScriptLine(const std::string &utf8mesg, const std::string &user_name, const LLColor4& color, const LLUUID& source_id) { LLViewerObject* objectp = gObjectList.findObject(source_id); - LLString floater_label; + std::string floater_label; if (objectp) { @@ -161,7 +161,7 @@ LLFloaterScriptDebugOutput::LLFloaterScriptDebugOutput() } LLFloaterScriptDebugOutput::LLFloaterScriptDebugOutput(const LLUUID& object_id) -: LLFloater("script instance floater", LLRect(0, 200, 200, 0), "Script", TRUE), mObjectID(object_id) +: LLFloater(std::string("script instance floater"), LLRect(0, 200, 200, 0), std::string("Script"), TRUE), mObjectID(object_id) { S32 y = getRect().getHeight() - LLFLOATER_HEADER_SIZE - LLFLOATER_VPAD; S32 x = LLFLOATER_HPAD; @@ -172,8 +172,8 @@ LLFloaterScriptDebugOutput::LLFloaterScriptDebugOutput(const LLUUID& object_id) y, getRect().getWidth() - LLFLOATER_HPAD, LLFLOATER_VPAD ); - mHistoryEditor = new LLViewerTextEditor( "Chat History Editor", - history_editor_rect, S32_MAX, "", LLFontGL::sSansSerif); + mHistoryEditor = new LLViewerTextEditor( std::string("Chat History Editor"), + history_editor_rect, S32_MAX, LLStringUtil::null, LLFontGL::sSansSerif); mHistoryEditor->setWordWrap( TRUE ); mHistoryEditor->setFollowsAll(); mHistoryEditor->setEnabled( FALSE ); @@ -181,7 +181,7 @@ LLFloaterScriptDebugOutput::LLFloaterScriptDebugOutput(const LLUUID& object_id) addChild(mHistoryEditor); } -void LLFloaterScriptDebugOutput::initFloater(const LLString& title, BOOL resizable, +void LLFloaterScriptDebugOutput::initFloater(const std::string& title, BOOL resizable, S32 min_width, S32 min_height, BOOL drag_on_left, BOOL minimizable, BOOL close_btn) { @@ -195,8 +195,8 @@ void LLFloaterScriptDebugOutput::initFloater(const LLString& title, BOOL resizab y, getRect().getWidth() - LLFLOATER_HPAD, LLFLOATER_VPAD ); - mHistoryEditor = new LLViewerTextEditor( "Chat History Editor", - history_editor_rect, S32_MAX, "", LLFontGL::sSansSerif); + mHistoryEditor = new LLViewerTextEditor( std::string("Chat History Editor"), + history_editor_rect, S32_MAX, LLStringUtil::null, LLFontGL::sSansSerif); mHistoryEditor->setWordWrap( TRUE ); mHistoryEditor->setFollowsAll(); mHistoryEditor->setEnabled( FALSE ); diff --git a/indra/newview/llfloaterscriptdebug.h b/indra/newview/llfloaterscriptdebug.h index 05e6629913..96365465f9 100644 --- a/indra/newview/llfloaterscriptdebug.h +++ b/indra/newview/llfloaterscriptdebug.h @@ -62,7 +62,7 @@ public: LLFloaterScriptDebugOutput(const LLUUID& object_id); ~LLFloaterScriptDebugOutput(); - 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); diff --git a/indra/newview/llfloatersellland.cpp b/indra/newview/llfloatersellland.cpp index 025d726b82..749ccbe7fa 100644 --- a/indra/newview/llfloatersellland.cpp +++ b/indra/newview/llfloatersellland.cpp @@ -138,7 +138,7 @@ LLFloaterSellLandUI* LLFloaterSellLandUI::soleInstance(bool createIfNeeded) } LLFloaterSellLandUI::LLFloaterSellLandUI() -: LLFloater("Sell Land"), +: LLFloater(std::string("Sell Land")), mRegion(0) { } @@ -243,7 +243,7 @@ void LLFloaterSellLandUI::updateParcelInfo() if(mSellToBuyer) { - LLString name; + std::string name; gCacheName->getFullName(mAuthorizedBuyer, name); childSetText("sell_to_agent", name); } @@ -251,12 +251,12 @@ void LLFloaterSellLandUI::updateParcelInfo() void LLFloaterSellLandUI::setBadge(const char* id, Badge badge) { - static LLString badgeOK("badge_ok.j2c"); - static LLString badgeNote("badge_note.j2c"); - static LLString badgeWarn("badge_warn.j2c"); - static LLString badgeError("badge_error.j2c"); + static std::string badgeOK("badge_ok.j2c"); + static std::string badgeNote("badge_note.j2c"); + static std::string badgeWarn("badge_warn.j2c"); + static std::string badgeError("badge_error.j2c"); - LLString badgeName; + std::string badgeName; switch (badge) { default: @@ -283,7 +283,7 @@ void LLFloaterSellLandUI::refreshUI() childSetText("info_parcel", parcelp->getName()); childSetTextArg("info_size", "[AREA]", llformat("%d", mParcelActualArea)); - LLString price_str = childGetValue("price").asString(); + std::string price_str = childGetValue("price").asString(); bool valid_price = false; valid_price = (price_str != "") && LLLineEditor::prevalidateNonNegativeS32(utf8str_to_wstring(price_str)); @@ -331,7 +331,7 @@ void LLFloaterSellLandUI::refreshUI() } // Must select Sell To: Anybody, or User (with a specified username) - LLString sell_to = childGetValue("sell_to").asString(); + std::string sell_to = childGetValue("sell_to").asString(); bool valid_sell_to = "select" != sell_to && ("user" != sell_to || mAuthorizedBuyer.notNull()); @@ -370,7 +370,7 @@ void LLFloaterSellLandUI::onChangeValue(LLUICtrl *ctrl, void *userdata) { LLFloaterSellLandUI *self = (LLFloaterSellLandUI *)userdata; - LLString sell_to = self->childGetValue("sell_to").asString(); + std::string sell_to = self->childGetValue("sell_to").asString(); if (sell_to == "user") { @@ -481,7 +481,7 @@ void LLFloaterSellLandUI::doSellLand(void *userdata) return; } - LLStringBase<char>::format_map_t args; + LLStringUtil::format_map_t args; args["[LAND_SIZE]"] = llformat("%d",area); args["[SALE_PRICE]"] = llformat("%d",sale_price); args["[NAME]"] = authorizedBuyerName; diff --git a/indra/newview/llfloatersettingsdebug.cpp b/indra/newview/llfloatersettingsdebug.cpp index 2b7d10a7a9..e362da411d 100644 --- a/indra/newview/llfloatersettingsdebug.cpp +++ b/indra/newview/llfloatersettingsdebug.cpp @@ -41,7 +41,7 @@ LLFloaterSettingsDebug* LLFloaterSettingsDebug::sInstance = NULL; -LLFloaterSettingsDebug::LLFloaterSettingsDebug() : LLFloater("Configuration Editor") +LLFloaterSettingsDebug::LLFloaterSettingsDebug() : LLFloater(std::string("Configuration Editor")) { } @@ -58,7 +58,7 @@ BOOL LLFloaterSettingsDebug::postBuild() { LLComboBox* combo; f(LLComboBox* c) : combo(c) {} - virtual void apply(const LLString& name, LLControlVariable* control) + virtual void apply(const std::string& name, LLControlVariable* control) { combo->add(name, (void*)control); } @@ -235,7 +235,7 @@ void LLFloaterSettingsDebug::updateControl(LLControlVariable* controlp) spinner4->setVisible(FALSE); color_swatch->setVisible(FALSE); childSetVisible("val_text", FALSE); - mComment->setText(LLString::null); + mComment->setText(LLStringUtil::null); if (controlp) { @@ -276,7 +276,7 @@ void LLFloaterSettingsDebug::updateControl(LLControlVariable* controlp) { case TYPE_U32: spinner1->setVisible(TRUE); - spinner1->setLabel(LLString("value")); // Debug, don't translate + spinner1->setLabel(std::string("value")); // Debug, don't translate if (!spinner1->hasFocus()) { spinner1->setValue(sd); @@ -288,7 +288,7 @@ void LLFloaterSettingsDebug::updateControl(LLControlVariable* controlp) break; case TYPE_S32: spinner1->setVisible(TRUE); - spinner1->setLabel(LLString("value")); // Debug, don't translate + spinner1->setLabel(std::string("value")); // Debug, don't translate if (!spinner1->hasFocus()) { spinner1->setValue(sd); @@ -300,7 +300,7 @@ void LLFloaterSettingsDebug::updateControl(LLControlVariable* controlp) break; case TYPE_F32: spinner1->setVisible(TRUE); - spinner1->setLabel(LLString("value")); // Debug, don't translate + spinner1->setLabel(std::string("value")); // Debug, don't translate if (!spinner1->hasFocus()) { spinner1->setPrecision(3); @@ -332,11 +332,11 @@ void LLFloaterSettingsDebug::updateControl(LLControlVariable* controlp) LLVector3 v; v.setValue(sd); spinner1->setVisible(TRUE); - spinner1->setLabel(LLString("X")); + spinner1->setLabel(std::string("X")); spinner2->setVisible(TRUE); - spinner2->setLabel(LLString("Y")); + spinner2->setLabel(std::string("Y")); spinner3->setVisible(TRUE); - spinner3->setLabel(LLString("Z")); + spinner3->setLabel(std::string("Z")); if (!spinner1->hasFocus()) { spinner1->setPrecision(3); @@ -359,11 +359,11 @@ void LLFloaterSettingsDebug::updateControl(LLControlVariable* controlp) LLVector3d v; v.setValue(sd); spinner1->setVisible(TRUE); - spinner1->setLabel(LLString("X")); + spinner1->setLabel(std::string("X")); spinner2->setVisible(TRUE); - spinner2->setLabel(LLString("Y")); + spinner2->setLabel(std::string("Y")); spinner3->setVisible(TRUE); - spinner3->setLabel(LLString("Z")); + spinner3->setLabel(std::string("Z")); if (!spinner1->hasFocus()) { spinner1->setPrecision(3); @@ -386,13 +386,13 @@ void LLFloaterSettingsDebug::updateControl(LLControlVariable* controlp) LLRect r; r.setValue(sd); spinner1->setVisible(TRUE); - spinner1->setLabel(LLString("Left")); + spinner1->setLabel(std::string("Left")); spinner2->setVisible(TRUE); - spinner2->setLabel(LLString("Right")); + spinner2->setLabel(std::string("Right")); spinner3->setVisible(TRUE); - spinner3->setLabel(LLString("Bottom")); + spinner3->setLabel(std::string("Bottom")); spinner4->setVisible(TRUE); - spinner4->setLabel(LLString("Top")); + spinner4->setLabel(std::string("Top")); if (!spinner1->hasFocus()) { spinner1->setPrecision(0); @@ -442,7 +442,7 @@ void LLFloaterSettingsDebug::updateControl(LLControlVariable* controlp) color_swatch->set(LLColor4(sd), TRUE, FALSE); } spinner4->setVisible(TRUE); - spinner4->setLabel(LLString("Alpha")); + spinner4->setLabel(std::string("Alpha")); if (!spinner4->hasFocus()) { spinner4->setPrecision(3); @@ -470,7 +470,7 @@ void LLFloaterSettingsDebug::updateControl(LLControlVariable* controlp) color_swatch->set(LLColor4(clr), TRUE, FALSE); } spinner4->setVisible(TRUE); - spinner4->setLabel(LLString("Alpha")); + spinner4->setLabel(std::string("Alpha")); if(!spinner4->hasFocus()) { spinner4->setPrecision(0); @@ -484,7 +484,7 @@ void LLFloaterSettingsDebug::updateControl(LLControlVariable* controlp) break; } default: - mComment->setText(LLString("unknown")); + mComment->setText(std::string("unknown")); break; } } diff --git a/indra/newview/llfloatersnapshot.cpp b/indra/newview/llfloatersnapshot.cpp index 7dd4f293c4..1f601e6dc1 100644 --- a/indra/newview/llfloatersnapshot.cpp +++ b/indra/newview/llfloatersnapshot.cpp @@ -192,7 +192,7 @@ public: std::set<LLSnapshotLivePreview*> LLSnapshotLivePreview::sList; LLSnapshotLivePreview::LLSnapshotLivePreview (const LLRect& rect) : - LLView("snapshot_live_preview", rect, FALSE), + LLView(std::string("snapshot_live_preview"), rect, FALSE), mColor(1.f, 0.f, 0.f, 0.5f), mCurImageIndex(0), mRawImage(NULL), @@ -1771,7 +1771,7 @@ void LLFloaterSnapshot::Impl::onCommitCustomResolution(LLUICtrl *ctrl, void* dat // Default constructor LLFloaterSnapshot::LLFloaterSnapshot() - : LLFloater("Snapshot Floater"), + : LLFloater(std::string("Snapshot Floater")), impl (*(new Impl)) { } @@ -1879,7 +1879,7 @@ void LLFloaterSnapshot::draw() { LLLocale locale(LLLocale::USER_LOCALE); - LLString bytes_string; + std::string bytes_string; if (previewp->getSnapshotType() == LLSnapshotLivePreview::SNAPSHOT_POSTCARD && previewp->getDataSize() > MAX_POSTCARD_DATASIZE) { @@ -1894,7 +1894,7 @@ void LLFloaterSnapshot::draw() if (previewp->getSnapshotUpToDate()) { - LLString bytes_string; + std::string bytes_string; LLResMgr::getInstance()->getIntegerString(bytes_string, (previewp->getDataSize()) >> 10 ); childSetTextArg("file_size_label", "[SIZE]", bytes_string); } @@ -1909,7 +1909,7 @@ void LLFloaterSnapshot::draw() } else { - childSetTextArg("file_size_label", "[SIZE]", LLString("???")); + childSetTextArg("file_size_label", "[SIZE]", std::string("???")); childSetEnabled("upload_btn", FALSE); childSetEnabled("send_btn", FALSE); childSetEnabled("save_btn", FALSE); @@ -1917,7 +1917,7 @@ void LLFloaterSnapshot::draw() BOOL ui_in_snapshot = gSavedSettings.getBOOL("RenderUIInSnapshot"); childSetValue("ui_check", ui_in_snapshot); - childSetToolTip("ui_check", "If selected shows the UI in the snapshot"); + childSetToolTip("ui_check", std::string("If selected shows the UI in the snapshot")); } LLFloater::draw(); @@ -2025,7 +2025,7 @@ void LLFloaterSnapshot::update() //============================================================================ -LLSnapshotFloaterView::LLSnapshotFloaterView( const LLString& name, const LLRect& rect ) : LLFloaterView(name, rect) +LLSnapshotFloaterView::LLSnapshotFloaterView( const std::string& name, const LLRect& rect ) : LLFloaterView(name, rect) { setMouseOpaque(TRUE); setEnabled(FALSE); diff --git a/indra/newview/llfloatersnapshot.h b/indra/newview/llfloatersnapshot.h index fecc3f0fd5..a7aee1143c 100644 --- a/indra/newview/llfloatersnapshot.h +++ b/indra/newview/llfloatersnapshot.h @@ -69,7 +69,7 @@ private: class LLSnapshotFloaterView : public LLFloaterView { public: - LLSnapshotFloaterView( const LLString& name, const LLRect& rect ); + LLSnapshotFloaterView( const std::string& name, const LLRect& rect ); virtual ~LLSnapshotFloaterView(); /*virtual*/ BOOL handleKey(KEY key, MASK mask, BOOL called_from_parent); diff --git a/indra/newview/llfloatertelehub.cpp b/indra/newview/llfloatertelehub.cpp index 65b6d55480..0b4a05867f 100644 --- a/indra/newview/llfloatertelehub.cpp +++ b/indra/newview/llfloatertelehub.cpp @@ -81,7 +81,7 @@ void LLFloaterTelehub::show() } LLFloaterTelehub::LLFloaterTelehub() -: LLFloater("telehub"), +: LLFloater(std::string("telehub")), mTelehubObjectID(), mTelehubObjectName(), mTelehubPos(), @@ -244,8 +244,8 @@ void LLFloaterTelehub::onClickRemoveSpawnPoint(void* data) msg->nextBlock("ParamList"); msg->addString("Parameter", "spawnpoint remove"); - char buffer[MAX_STRING]; /* Flawfinder: ignore */ - snprintf(buffer, MAX_STRING, "%d", spawn_index); /* Flawfinder: ignore */ + std::string buffer; + buffer = llformat("%d", spawn_index); msg->nextBlock("ParamList"); msg->addString("Parameter", buffer); @@ -263,11 +263,8 @@ void LLFloaterTelehub::processTelehubInfo(LLMessageSystem* msg, void**) void LLFloaterTelehub::unpackTelehubInfo(LLMessageSystem* msg) { - char buffer[MAX_STRING]; /* Flawfinder: ignore */ - msg->getUUID("TelehubBlock", "ObjectID", mTelehubObjectID); - msg->getString("TelehubBlock", "ObjectName", MAX_STRING, buffer); - mTelehubObjectName = buffer; + msg->getString("TelehubBlock", "ObjectName", mTelehubObjectName); msg->getVector3("TelehubBlock", "TelehubPos", mTelehubPos); msg->getQuat("TelehubBlock", "TelehubRot", mTelehubRot); @@ -301,7 +298,7 @@ void LLFloaterTelehub::unpackTelehubInfo(LLMessageSystem* msg) list->deleteAllItems(); for (S32 i = 0; i < mNumSpawn; i++) { - LLString pos = llformat("%.1f, %.1f, %.1f", + std::string pos = llformat("%.1f, %.1f, %.1f", mSpawnPointPos[i].mV[VX], mSpawnPointPos[i].mV[VY], mSpawnPointPos[i].mV[VZ]); diff --git a/indra/newview/llfloatertelehub.h b/indra/newview/llfloatertelehub.h index dd7631f6dd..9957d60ec9 100644 --- a/indra/newview/llfloatertelehub.h +++ b/indra/newview/llfloatertelehub.h @@ -68,7 +68,7 @@ private: private: LLUUID mTelehubObjectID; // null if no telehub - LLString mTelehubObjectName; + std::string mTelehubObjectName; LLVector3 mTelehubPos; // region local, fallback if viewer can't see the object LLQuaternion mTelehubRot; diff --git a/indra/newview/llfloatertools.cpp b/indra/newview/llfloatertools.cpp index b8f7e3ed0a..a8192e544c 100644 --- a/indra/newview/llfloatertools.cpp +++ b/indra/newview/llfloatertools.cpp @@ -82,13 +82,13 @@ LLFloaterTools *gFloaterTools = NULL; -const LLString PANEL_NAMES[LLFloaterTools::PANEL_COUNT] = +const std::string PANEL_NAMES[LLFloaterTools::PANEL_COUNT] = { - LLString("General"), // PANEL_GENERAL, - LLString("Object"), // PANEL_OBJECT, - LLString("Features"), // PANEL_FEATURES, - LLString("Texture"), // PANEL_FACE, - LLString("Content"), // PANEL_CONTENTS, + std::string("General"), // PANEL_GENERAL, + std::string("Object"), // PANEL_OBJECT, + std::string("Features"), // PANEL_FEATURES, + std::string("Texture"), // PANEL_FACE, + std::string("Content"), // PANEL_CONTENTS, }; // Local prototypes @@ -158,7 +158,7 @@ void* LLFloaterTools::createPanelContents(void* data) void* LLFloaterTools::createPanelContentsInventory(void* data) { LLFloaterTools* floater = (LLFloaterTools*)data; - floater->mPanelContents->mPanelInventory = new LLPanelInventory("ContentsInventory", LLRect()); + floater->mPanelContents->mPanelInventory = new LLPanelInventory(std::string("ContentsInventory"), LLRect()); return floater->mPanelContents->mPanelInventory; } @@ -166,7 +166,7 @@ void* LLFloaterTools::createPanelContentsInventory(void* data) void* LLFloaterTools::createPanelLandInfo(void* data) { LLFloaterTools* floater = (LLFloaterTools*)data; - floater->mPanelLandInfo = new LLPanelLandInfo("land info panel"); + floater->mPanelLandInfo = new LLPanelLandInfo(std::string("land info panel")); return floater->mPanelLandInfo; } @@ -236,7 +236,7 @@ BOOL LLFloaterTools::postBuild() // Create Buttons // - static const LLString toolNames[]={ + static const std::string toolNames[]={ "ToolCube", "ToolPrism", "ToolPyramid", @@ -335,7 +335,7 @@ BOOL LLFloaterTools::postBuild() // Create the popupview with a dummy center. It will be moved into place // during LLViewerWindow's per-frame hover processing. LLFloaterTools::LLFloaterTools() -: LLFloater("toolbox floater"), +: LLFloater(std::string("toolbox floater")), mBtnFocus(NULL), mBtnMove(NULL), mBtnEdit(NULL), @@ -765,7 +765,7 @@ void LLFloaterTools::onOpen() mParcelSelection = LLViewerParcelMgr::getInstance()->getFloatingParcelSelection(); mObjectSelection = LLSelectMgr::getInstance()->getEditSelection(); - gMenuBarView->setItemVisible("Tools", TRUE); + gMenuBarView->setItemVisible(std::string("Tools"), TRUE); gMenuBarView->arrange(); } @@ -799,7 +799,7 @@ void LLFloaterTools::onClose(bool app_quitting) // so manually reset tool to default (pie menu tool) LLToolMgr::getInstance()->getCurrentToolset()->selectFirstTool(); - gMenuBarView->setItemVisible("Tools", FALSE); + gMenuBarView->setItemVisible(std::string("Tools"), FALSE); gMenuBarView->arrange(); } diff --git a/indra/newview/llfloatertopobjects.cpp b/indra/newview/llfloatertopobjects.cpp index 5d2f21e370..93622ed94e 100644 --- a/indra/newview/llfloatertopobjects.cpp +++ b/indra/newview/llfloatertopobjects.cpp @@ -67,7 +67,7 @@ void LLFloaterTopObjects::show() } LLFloaterTopObjects::LLFloaterTopObjects() -: LLFloater("top_objects"), +: LLFloater(std::string("top_objects")), mInitialized(FALSE), mtotalScore(0.f) { @@ -124,7 +124,7 @@ BOOL LLFloaterTopObjects::postBuild() mCurrentMode = STAT_REPORT_TOP_SCRIPTS; mFlags = 0; - mFilter = ""; + mFilter.clear(); return TRUE; } @@ -164,8 +164,8 @@ void LLFloaterTopObjects::handleReply(LLMessageSystem *msg, void** data) LLUUID task_id; F32 location_x, location_y, location_z; F32 score; - char name_buf[MAX_STRING]; /* Flawfinder: ignore */ - char owner_buf[MAX_STRING]; /* Flawfinder: ignore */ + std::string name_buf; + std::string owner_buf; msg->getU32Fast(_PREHASH_ReportData, _PREHASH_TaskLocalID, task_local_id, block); msg->getUUIDFast(_PREHASH_ReportData, _PREHASH_TaskID, task_id, block); @@ -173,14 +173,14 @@ void LLFloaterTopObjects::handleReply(LLMessageSystem *msg, void** data) msg->getF32Fast(_PREHASH_ReportData, _PREHASH_LocationY, location_y, block); msg->getF32Fast(_PREHASH_ReportData, _PREHASH_LocationZ, location_z, block); msg->getF32Fast(_PREHASH_ReportData, _PREHASH_Score, score, block); - msg->getStringFast(_PREHASH_ReportData, _PREHASH_TaskName, MAX_STRING, name_buf, block); - msg->getStringFast(_PREHASH_ReportData, _PREHASH_OwnerName, MAX_STRING, owner_buf, block); + msg->getStringFast(_PREHASH_ReportData, _PREHASH_TaskName, name_buf, block); + msg->getStringFast(_PREHASH_ReportData, _PREHASH_OwnerName, owner_buf, block); LLSD element; element["id"] = task_id; - element["object_name"] = LLString(name_buf); - element["owner_name"] = LLString(owner_buf); + element["object_name"] = name_buf; + element["owner_name"] = owner_buf; element["columns"][0]["column"] = "score"; element["columns"][0]["value"] = llformat("%0.3f", score); element["columns"][0]["font"] = "SANSSERIF"; @@ -393,7 +393,7 @@ void LLFloaterTopObjects::onRefresh(void* data) { U32 mode = STAT_REPORT_TOP_SCRIPTS; U32 flags = 0; - LLString filter = ""; + std::string filter = ""; if (sInstance) { @@ -418,7 +418,7 @@ void LLFloaterTopObjects::onRefresh(void* data) if (sInstance) { - sInstance->mFilter = ""; + sInstance->mFilter.clear(); sInstance->mFlags = 0; } } @@ -451,8 +451,8 @@ void LLFloaterTopObjects::showBeacon() LLScrollListItem* first_selected = list->getFirstSelected(); if (!first_selected) return; - LLString name = first_selected->getColumn(1)->getValue().asString(); - LLString pos_string = first_selected->getColumn(3)->getValue().asString(); + std::string name = first_selected->getColumn(1)->getValue().asString(); + std::string pos_string = first_selected->getColumn(3)->getValue().asString(); F32 x, y, z; S32 matched = sscanf(pos_string.c_str(), "<%g,%g,%g>", &x, &y, &z); @@ -460,6 +460,6 @@ void LLFloaterTopObjects::showBeacon() LLVector3 pos_agent(x, y, z); LLVector3d pos_global = gAgent.getPosGlobalFromAgent(pos_agent); - LLString tooltip(""); + std::string tooltip(""); LLTracker::trackLocation(pos_global, name, tooltip, LLTracker::LOCATION_ITEM); } diff --git a/indra/newview/llfloatertopobjects.h b/indra/newview/llfloatertopobjects.h index cab99c9792..5b23e737d7 100644 --- a/indra/newview/llfloatertopobjects.h +++ b/indra/newview/llfloatertopobjects.h @@ -84,14 +84,14 @@ private: void showBeacon(); private: - LLString mMethod; + std::string mMethod; LLSD mObjectListData; std::vector<LLUUID> mObjectListIDs; U32 mCurrentMode; U32 mFlags; - LLString mFilter; + std::string mFilter; BOOL mInitialized; diff --git a/indra/newview/llfloatertos.cpp b/indra/newview/llfloatertos.cpp index af3321c814..5ace957694 100644 --- a/indra/newview/llfloatertos.cpp +++ b/indra/newview/llfloatertos.cpp @@ -74,7 +74,7 @@ LLFloaterTOS* LLFloaterTOS::show(ETOSType type, const std::string & message) LLFloaterTOS::LLFloaterTOS(ETOSType type, const std::string & message) -: LLModalDialog( " ", 100, 100 ), +: LLModalDialog( std::string(" "), 100, 100 ), mType(type), mMessage(message), mWebBrowserWindowId( 0 ), diff --git a/indra/newview/llfloatertos.h b/indra/newview/llfloatertos.h index e6c487d1a8..2affd66ad5 100644 --- a/indra/newview/llfloatertos.h +++ b/indra/newview/llfloatertos.h @@ -77,7 +77,7 @@ private: private: ETOSType mType; - LLString mMessage; + std::string mMessage; int mWebBrowserWindowId; int mLoadCompleteCount; diff --git a/indra/newview/llfloaterurlentry.cpp b/indra/newview/llfloaterurlentry.cpp index 400927632c..69916f80ea 100644 --- a/indra/newview/llfloaterurlentry.cpp +++ b/indra/newview/llfloaterurlentry.cpp @@ -213,7 +213,7 @@ void LLFloaterURLEntry::onBtnOK( void* userdata ) } // leading whitespace causes problems with the MIME-type detection so strip it - LLString::trim( media_url ); + LLStringUtil::trim( media_url ); // First check the URL scheme LLURI url(media_url); diff --git a/indra/newview/llfloatervoicedevicesettings.cpp b/indra/newview/llfloatervoicedevicesettings.cpp index 699f89c944..74d04c7aad 100644 --- a/indra/newview/llfloatervoicedevicesettings.cpp +++ b/indra/newview/llfloatervoicedevicesettings.cpp @@ -105,7 +105,7 @@ void LLPanelVoiceDeviceSettings::draw() { for(S32 power_bar_idx = 0; power_bar_idx < 5; power_bar_idx++) { - LLString view_name = llformat("%s%d", "bar", power_bar_idx); + std::string view_name = llformat("%s%d", "bar", power_bar_idx); LLView* bar_view = getChild<LLView>(view_name); if (bar_view) { @@ -260,7 +260,9 @@ void LLPanelVoiceDeviceSettings::onCommitOutputDevice(LLUICtrl* ctrl, void* user // LLFloaterVoiceDeviceSettings // -LLFloaterVoiceDeviceSettings::LLFloaterVoiceDeviceSettings(const LLSD& seed) : LLFloater("floater_device_settings"), mDevicePanel(NULL) +LLFloaterVoiceDeviceSettings::LLFloaterVoiceDeviceSettings(const LLSD& seed) + : LLFloater(std::string("floater_device_settings")), + mDevicePanel(NULL) { mFactoryMap["device_settings"] = LLCallbackMap(createPanelVoiceDeviceSettings, this); // do not automatically open singleton floaters (as result of getInstance()) diff --git a/indra/newview/llfloaterwater.cpp b/indra/newview/llfloaterwater.cpp index f3f25f7847..c540a0b37c 100644 --- a/indra/newview/llfloaterwater.cpp +++ b/indra/newview/llfloaterwater.cpp @@ -65,7 +65,7 @@ LLFloaterWater* LLFloaterWater::sWaterMenu = NULL; std::set<std::string> LLFloaterWater::sDefaultPresets; -LLFloaterWater::LLFloaterWater() : LLFloater("water floater") +LLFloaterWater::LLFloaterWater() : LLFloater(std::string("water floater")) { LLUICtrlFactory::getInstance()->buildFloater(this, "floater_water.xml"); @@ -85,14 +85,14 @@ LLFloaterWater::LLFloaterWater() : LLFloater("water floater") comboBox->selectByValue(LLSD("Default")); } - LLString def_water = getString("WLDefaultWaterNames"); + std::string def_water = getString("WLDefaultWaterNames"); // no editing or deleting of the blank string sDefaultPresets.insert(""); boost_tokenizer tokens(def_water, boost::char_separator<char>(":")); for (boost_tokenizer::iterator token_iter = tokens.begin(); token_iter != tokens.end(); ++token_iter) { - LLString tok(*token_iter); + std::string tok(*token_iter); sDefaultPresets.insert(tok); } @@ -175,8 +175,8 @@ void LLFloaterWater::onClickHelp(void* data) { LLFloaterWater* self = LLFloaterWater::instance(); - const char* xml_alert = (const char*) data; - LLAlertDialog* dialogp = gViewerWindow->alertXml(xml_alert); + const std::string* xml_alert = (std::string*)data; + LLAlertDialog* dialogp = gViewerWindow->alertXml(*xml_alert); if (dialogp) { LLFloater* root_floater = gFloaterView->getParentFloater(self); @@ -185,14 +185,15 @@ void LLFloaterWater::onClickHelp(void* data) root_floater->addDependentFloater(dialogp); } } + delete xml_alert; } -void LLFloaterWater::initHelpBtn(const char* name, const char* xml_alert) +void LLFloaterWater::initHelpBtn(const std::string& name, const std::string& xml_alert) { - childSetAction(name, onClickHelp, (void*)xml_alert); + childSetAction(name, onClickHelp, new std::string(xml_alert)); } -void LLFloaterWater::newPromptCallback(S32 option, const LLString& text, void* userData) +void LLFloaterWater::newPromptCallback(S32 option, const std::string& text, void* userData) { if(text == "") { @@ -207,13 +208,12 @@ void LLFloaterWater::newPromptCallback(S32 option, const LLString& text, void* u // add the current parameters to the list // see if it's there first std::map<std::string, LLWaterParamSet>::iterator mIt = - param_mgr->mParamList.find(text.c_str()); + param_mgr->mParamList.find(text); // if not there, add a new one if(mIt == param_mgr->mParamList.end()) { - param_mgr->addParamSet(text.c_str(), - param_mgr->mCurParams); + param_mgr->addParamSet(text, param_mgr->mCurParams); comboBox->add(text); comboBox->sortByName(); @@ -537,9 +537,9 @@ void LLFloaterWater::onColorControlIMoved(LLUICtrl* ctrl, void* userData) } // set the sliders to the new vals - sWaterMenu->childSetValue(rName.c_str(), colorControl->mR); - sWaterMenu->childSetValue(gName.c_str(), colorControl->mG); - sWaterMenu->childSetValue(bName.c_str(), colorControl->mB); + sWaterMenu->childSetValue(rName, colorControl->mR); + sWaterMenu->childSetValue(gName, colorControl->mG); + sWaterMenu->childSetValue(bName, colorControl->mB); } // now update the current parameters and send them to shaders @@ -597,7 +597,7 @@ void LLFloaterWater::onNormalMapPicked(LLUICtrl* ctrl, void* userData) void LLFloaterWater::onNewPreset(void* userData) { - gViewerWindow->alertXmlEditText("NewWaterPreset", LLString::format_map_t(), + gViewerWindow->alertXmlEditText("NewWaterPreset", LLStringUtil::format_map_t(), NULL, NULL, newPromptCallback, NULL); } @@ -617,7 +617,7 @@ void LLFloaterWater::onSavePreset(void* userData) // check to see if it's a default and shouldn't be overwritten std::set<std::string>::iterator sIt = sDefaultPresets.find( - comboBox->getSelectedItemLabel().c_str()); + comboBox->getSelectedItemLabel()); if(sIt != sDefaultPresets.end() && !gSavedSettings.getBOOL("WaterEditPresets")) { gViewerWindow->alertXml("WLNoEditDefault"); @@ -653,7 +653,7 @@ void LLFloaterWater::onDeletePreset(void* userData) return; } - LLString::format_map_t args; + LLStringUtil::format_map_t args; args["[SKY]"] = combo_box->getSelectedValue().asString(); gViewerWindow->alertXml("WLDeletePresetAlert", args, deleteAlertCallback, sWaterMenu); } @@ -675,10 +675,10 @@ void LLFloaterWater::deleteAlertCallback(S32 option, void* userdata) mult_sldr = day_cycle->getChild<LLMultiSliderCtrl>("WaterDayCycleKeys"); } - LLString name = combo_box->getSelectedValue().asString(); + std::string name = combo_box->getSelectedValue().asString(); // check to see if it's a default and shouldn't be deleted - std::set<std::string>::iterator sIt = sDefaultPresets.find(name.c_str()); + std::set<std::string>::iterator sIt = sDefaultPresets.find(name); if(sIt != sDefaultPresets.end()) { gViewerWindow->alertXml("WaterNoEditDefault"); diff --git a/indra/newview/llfloaterwater.h b/indra/newview/llfloaterwater.h index 311ef9a75e..883b2a35f1 100644 --- a/indra/newview/llfloaterwater.h +++ b/indra/newview/llfloaterwater.h @@ -61,9 +61,9 @@ public: // help button stuff static void onClickHelp(void* data); - void initHelpBtn(const char* name, const char* xml_alert); + void initHelpBtn(const std::string& name, const std::string& xml_alert); - static void newPromptCallback(S32 option, const LLString& text, void* userData); + static void newPromptCallback(S32 option, const std::string& text, void* userData); /// general purpose callbacks for dealing with color controllers static void onColorControlRMoved(LLUICtrl* ctrl, void* userData); diff --git a/indra/newview/llfloaterwindlight.cpp b/indra/newview/llfloaterwindlight.cpp index a83530e53c..f03579a97b 100644 --- a/indra/newview/llfloaterwindlight.cpp +++ b/indra/newview/llfloaterwindlight.cpp @@ -66,7 +66,7 @@ std::set<std::string> LLFloaterWindLight::sDefaultPresets; static const F32 WL_SUN_AMBIENT_SLIDER_SCALE = 3.0f; -LLFloaterWindLight::LLFloaterWindLight() : LLFloater("windlight floater") +LLFloaterWindLight::LLFloaterWindLight() : LLFloater(std::string("windlight floater")) { LLUICtrlFactory::getInstance()->buildFloater(this, "floater_windlight_options.xml"); @@ -83,21 +83,21 @@ LLFloaterWindLight::LLFloaterWindLight() : LLFloater("windlight floater") } // entry for when we're in estate time - comboBox->add(""); + comboBox->add(LLStringUtil::null); // set defaults on combo boxes comboBox->selectByValue(LLSD("Default")); } // add the list of presets - LLString def_days = getString("WLDefaultSkyNames"); + std::string def_days = getString("WLDefaultSkyNames"); // no editing or deleting of the blank string sDefaultPresets.insert(""); boost_tokenizer tokens(def_days, boost::char_separator<char>(":")); for (boost_tokenizer::iterator token_iter = tokens.begin(); token_iter != tokens.end(); ++token_iter) { - LLString tok(*token_iter); + std::string tok(*token_iter); sDefaultPresets.insert(tok); } @@ -233,8 +233,8 @@ void LLFloaterWindLight::onClickHelp(void* data) { LLFloaterWindLight* self = LLFloaterWindLight::instance(); - const char* xml_alert = (const char*) data; - LLAlertDialog* dialogp = gViewerWindow->alertXml(xml_alert); + const std::string* xml_alert = (std::string*)data; + LLAlertDialog* dialogp = gViewerWindow->alertXml(*xml_alert); if (dialogp) { LLFloater* root_floater = gFloaterView->getParentFloater(self); @@ -243,15 +243,15 @@ void LLFloaterWindLight::onClickHelp(void* data) root_floater->addDependentFloater(dialogp); } } - + delete xml_alert; } -void LLFloaterWindLight::initHelpBtn(const char* name, const char* xml_alert) +void LLFloaterWindLight::initHelpBtn(const std::string& name, const std::string& xml_alert) { - childSetAction(name, onClickHelp, (void*)xml_alert); + childSetAction(name, onClickHelp, new std::string(xml_alert)); } -void LLFloaterWindLight::newPromptCallback(S32 option, const LLString& text, void* userData) +void LLFloaterWindLight::newPromptCallback(S32 option, const std::string& text, void* userData) { if(text == "") { @@ -274,12 +274,12 @@ void LLFloaterWindLight::newPromptCallback(S32 option, const LLString& text, voi // add the current parameters to the list // see if it's there first std::map<std::string, LLWLParamSet>::iterator mIt = - LLWLParamManager::instance()->mParamList.find(text.c_str()); + LLWLParamManager::instance()->mParamList.find(text); // if not there, add a new one if(mIt == LLWLParamManager::instance()->mParamList.end()) { - LLWLParamManager::instance()->addParamSet(text.c_str(), + LLWLParamManager::instance()->addParamSet(text, LLWLParamManager::instance()->mCurParams); comboBox->add(text); comboBox->sortByName(); @@ -290,7 +290,7 @@ void LLFloaterWindLight::newPromptCallback(S32 option, const LLString& text, voi { comboBox->remove(0); } - comboBox->add(""); + comboBox->add(LLStringUtil::null); comboBox->setSelectedByValue(text, true); if(LLFloaterDayCycle::isOpen()) @@ -319,7 +319,7 @@ void LLFloaterWindLight::syncMenu() //std::map<std::string, LLVector4> & currentParams = param_mgr->mCurParams.mParamValues; // blue horizon - param_mgr->mBlueHorizon = currentParams.getVector(param_mgr->mBlueHorizon.name, err); + param_mgr->mBlueHorizon = currentParams.getVector(param_mgr->mBlueHorizon.mName, err); childSetValue("WLBlueHorizonR", param_mgr->mBlueHorizon.r / 2.0); childSetValue("WLBlueHorizonG", param_mgr->mBlueHorizon.g / 2.0); childSetValue("WLBlueHorizonB", param_mgr->mBlueHorizon.b / 2.0); @@ -329,18 +329,18 @@ void LLFloaterWindLight::syncMenu() param_mgr->mBlueHorizon.b / 2.0))); // haze density, horizon, mult, and altitude - param_mgr->mHazeDensity = currentParams.getVector(param_mgr->mHazeDensity.name, err); + param_mgr->mHazeDensity = currentParams.getVector(param_mgr->mHazeDensity.mName, err); childSetValue("WLHazeDensity", param_mgr->mHazeDensity.r); - param_mgr->mHazeHorizon = currentParams.getVector(param_mgr->mHazeHorizon.name, err); + param_mgr->mHazeHorizon = currentParams.getVector(param_mgr->mHazeHorizon.mName, err); childSetValue("WLHazeHorizon", param_mgr->mHazeHorizon.r); - param_mgr->mDensityMult = currentParams.getVector(param_mgr->mDensityMult.name, err); + param_mgr->mDensityMult = currentParams.getVector(param_mgr->mDensityMult.mName, err); childSetValue("WLDensityMult", param_mgr->mDensityMult.x * param_mgr->mDensityMult.mult); - param_mgr->mMaxAlt = currentParams.getVector(param_mgr->mMaxAlt.name, err); + param_mgr->mMaxAlt = currentParams.getVector(param_mgr->mMaxAlt.mName, err); childSetValue("WLMaxAltitude", param_mgr->mMaxAlt.x); // blue density - param_mgr->mBlueDensity = currentParams.getVector(param_mgr->mBlueDensity.name, err); + param_mgr->mBlueDensity = currentParams.getVector(param_mgr->mBlueDensity.mName, err); childSetValue("WLBlueDensityR", param_mgr->mBlueDensity.r / 2.0); childSetValue("WLBlueDensityG", param_mgr->mBlueDensity.g / 2.0); childSetValue("WLBlueDensityB", param_mgr->mBlueDensity.b / 2.0); @@ -351,7 +351,7 @@ void LLFloaterWindLight::syncMenu() // Lighting // sunlight - param_mgr->mSunlight = currentParams.getVector(param_mgr->mSunlight.name, err); + param_mgr->mSunlight = currentParams.getVector(param_mgr->mSunlight.mName, err); childSetValue("WLSunlightR", param_mgr->mSunlight.r / WL_SUN_AMBIENT_SLIDER_SCALE); childSetValue("WLSunlightG", param_mgr->mSunlight.g / WL_SUN_AMBIENT_SLIDER_SCALE); childSetValue("WLSunlightB", param_mgr->mSunlight.b / WL_SUN_AMBIENT_SLIDER_SCALE); @@ -360,12 +360,12 @@ void LLFloaterWindLight::syncMenu() std::max(param_mgr->mSunlight.g / WL_SUN_AMBIENT_SLIDER_SCALE, param_mgr->mSunlight.b / WL_SUN_AMBIENT_SLIDER_SCALE))); // glow - param_mgr->mGlow = currentParams.getVector(param_mgr->mGlow.name, err); + param_mgr->mGlow = currentParams.getVector(param_mgr->mGlow.mName, err); childSetValue("WLGlowR", 2 - param_mgr->mGlow.r / 20.0f); childSetValue("WLGlowB", -param_mgr->mGlow.b / 5.0f); // ambient - param_mgr->mAmbient = currentParams.getVector(param_mgr->mAmbient.name, err); + param_mgr->mAmbient = currentParams.getVector(param_mgr->mAmbient.mName, err); childSetValue("WLAmbientR", param_mgr->mAmbient.r / WL_SUN_AMBIENT_SLIDER_SCALE); childSetValue("WLAmbientG", param_mgr->mAmbient.g / WL_SUN_AMBIENT_SLIDER_SCALE); childSetValue("WLAmbientB", param_mgr->mAmbient.b / WL_SUN_AMBIENT_SLIDER_SCALE); @@ -379,7 +379,7 @@ void LLFloaterWindLight::syncMenu() // Clouds // Cloud Color - param_mgr->mCloudColor = currentParams.getVector(param_mgr->mCloudColor.name, err); + param_mgr->mCloudColor = currentParams.getVector(param_mgr->mCloudColor.mName, err); childSetValue("WLCloudColorR", param_mgr->mCloudColor.r); childSetValue("WLCloudColorG", param_mgr->mCloudColor.g); childSetValue("WLCloudColorB", param_mgr->mCloudColor.b); @@ -388,20 +388,20 @@ void LLFloaterWindLight::syncMenu() std::max(param_mgr->mCloudColor.g, param_mgr->mCloudColor.b))); // Cloud - param_mgr->mCloudMain = currentParams.getVector(param_mgr->mCloudMain.name, err); + param_mgr->mCloudMain = currentParams.getVector(param_mgr->mCloudMain.mName, err); childSetValue("WLCloudX", param_mgr->mCloudMain.r); childSetValue("WLCloudY", param_mgr->mCloudMain.g); childSetValue("WLCloudDensity", param_mgr->mCloudMain.b); // Cloud Detail - param_mgr->mCloudDetail = currentParams.getVector(param_mgr->mCloudDetail.name, err); + param_mgr->mCloudDetail = currentParams.getVector(param_mgr->mCloudDetail.mName, err); childSetValue("WLCloudDetailX", param_mgr->mCloudDetail.r); childSetValue("WLCloudDetailY", param_mgr->mCloudDetail.g); childSetValue("WLCloudDetailDensity", param_mgr->mCloudDetail.b); // Cloud extras - param_mgr->mCloudCoverage = currentParams.getVector(param_mgr->mCloudCoverage.name, err); - param_mgr->mCloudScale = currentParams.getVector(param_mgr->mCloudScale.name, err); + param_mgr->mCloudCoverage = currentParams.getVector(param_mgr->mCloudCoverage.mName, err); + param_mgr->mCloudScale = currentParams.getVector(param_mgr->mCloudScale.mName, err); childSetValue("WLCloudCoverage", param_mgr->mCloudCoverage.x); childSetValue("WLCloudScale", param_mgr->mCloudScale.x); @@ -430,12 +430,12 @@ void LLFloaterWindLight::syncMenu() childSetValue("WLCloudScrollX", param_mgr->mCurParams.getCloudScrollX() - 10.0f); childSetValue("WLCloudScrollY", param_mgr->mCurParams.getCloudScrollY() - 10.0f); - param_mgr->mDistanceMult = currentParams.getVector(param_mgr->mDistanceMult.name, err); + param_mgr->mDistanceMult = currentParams.getVector(param_mgr->mDistanceMult.mName, err); childSetValue("WLDistanceMult", param_mgr->mDistanceMult.x); // Tweak extras - param_mgr->mWLGamma = currentParams.getVector(param_mgr->mWLGamma.name, err); + param_mgr->mWLGamma = currentParams.getVector(param_mgr->mWLGamma.mName, err); childSetValue("WLGamma", param_mgr->mWLGamma.x); childSetValue("WLStarAlpha", param_mgr->mCurParams.getStarBrightness()); @@ -653,24 +653,24 @@ void LLFloaterWindLight::onColorControlIMoved(LLUICtrl* ctrl, void* userData) // divide sun color vals by three if(colorControl->isSunOrAmbientColor) { - sWindLight->childSetValue(rName.c_str(), colorControl->r/3); - sWindLight->childSetValue(gName.c_str(), colorControl->g/3); - sWindLight->childSetValue(bName.c_str(), colorControl->b/3); + sWindLight->childSetValue(rName, colorControl->r/3); + sWindLight->childSetValue(gName, colorControl->g/3); + sWindLight->childSetValue(bName, colorControl->b/3); } else if(colorControl->isBlueHorizonOrDensity) { - sWindLight->childSetValue(rName.c_str(), colorControl->r/2); - sWindLight->childSetValue(gName.c_str(), colorControl->g/2); - sWindLight->childSetValue(bName.c_str(), colorControl->b/2); + sWindLight->childSetValue(rName, colorControl->r/2); + sWindLight->childSetValue(gName, colorControl->g/2); + sWindLight->childSetValue(bName, colorControl->b/2); } else { // set the sliders to the new vals - sWindLight->childSetValue(rName.c_str(), colorControl->r); - sWindLight->childSetValue(gName.c_str(), colorControl->g); - sWindLight->childSetValue(bName.c_str(), colorControl->b); + sWindLight->childSetValue(rName, colorControl->r); + sWindLight->childSetValue(gName, colorControl->g); + sWindLight->childSetValue(bName, colorControl->b); } } @@ -785,7 +785,7 @@ void LLFloaterWindLight::onStarAlphaMoved(LLUICtrl* ctrl, void* userData) void LLFloaterWindLight::onNewPreset(void* userData) { - gViewerWindow->alertXmlEditText("NewSkyPreset", LLString::format_map_t(), + gViewerWindow->alertXmlEditText("NewSkyPreset", LLStringUtil::format_map_t(), NULL, NULL, newPromptCallback, NULL); } @@ -803,7 +803,7 @@ void LLFloaterWindLight::onSavePreset(void* userData) // check to see if it's a default and shouldn't be overwritten std::set<std::string>::iterator sIt = sDefaultPresets.find( - comboBox->getSelectedItemLabel().c_str()); + comboBox->getSelectedItemLabel()); if(sIt != sDefaultPresets.end() && !gSavedSettings.getBOOL("SkyEditPresets")) { gViewerWindow->alertXml("WLNoEditDefault"); @@ -841,7 +841,7 @@ void LLFloaterWindLight::onDeletePreset(void* userData) return; } - LLString::format_map_t args; + LLStringUtil::format_map_t args; args["[SKY]"] = combo_box->getSelectedValue().asString(); gViewerWindow->alertXml("WLDeletePresetAlert", args, deleteAlertCallback, sWindLight); } @@ -865,10 +865,10 @@ void LLFloaterWindLight::deleteAlertCallback(S32 option, void* userdata) mult_sldr = day_cycle->getChild<LLMultiSliderCtrl>("WLDayCycleKeys"); } - LLString name(combo_box->getSelectedValue().asString()); + std::string name(combo_box->getSelectedValue().asString()); // check to see if it's a default and shouldn't be deleted - std::set<std::string>::iterator sIt = sDefaultPresets.find(name.c_str()); + std::set<std::string>::iterator sIt = sDefaultPresets.find(name); if(sIt != sDefaultPresets.end()) { gViewerWindow->alertXml("WLNoEditDefault"); diff --git a/indra/newview/llfloaterwindlight.h b/indra/newview/llfloaterwindlight.h index 9bb7f1371c..d9e02b1117 100644 --- a/indra/newview/llfloaterwindlight.h +++ b/indra/newview/llfloaterwindlight.h @@ -61,9 +61,9 @@ public: // help button stuff static void onClickHelp(void* data); - void initHelpBtn(const char* name, const char* xml_alert); + void initHelpBtn(const std::string& name, const std::string& xml_alert); - static void newPromptCallback(S32 option, const LLString& text, void* userData); + static void newPromptCallback(S32 option, const std::string& text, void* userData); /// general purpose callbacks for dealing with color controllers static void onColorControlRMoved(LLUICtrl* ctrl, void* userData); diff --git a/indra/newview/llfloaterworldmap.cpp b/indra/newview/llfloaterworldmap.cpp index 401cc9fc6c..d38121047a 100644 --- a/indra/newview/llfloaterworldmap.cpp +++ b/indra/newview/llfloaterworldmap.cpp @@ -150,7 +150,7 @@ const LLUUID LLFloaterWorldMap::sHomeID( "10000000-0000-0000-0000-000000000001" LLFloaterWorldMap::LLFloaterWorldMap() -: LLFloater("worldmap"), +: LLFloater(std::string("worldmap")), mInventory(NULL), mInventoryObserver(NULL), mFriendObserver(NULL), @@ -171,7 +171,7 @@ LLFloaterWorldMap::LLFloaterWorldMap() // static void* LLFloaterWorldMap::createWorldMapView(void* data) { - return new LLWorldMapView("mapview", LLRect(0,300,400,0)); + return new LLWorldMapView(std::string("mapview"), LLRect(0,300,400,0)); } BOOL LLFloaterWorldMap::postBuild() @@ -515,7 +515,7 @@ void LLFloaterWorldMap::draw() //------------------------------------------------------------------------- -void LLFloaterWorldMap::trackAvatar( const LLUUID& avatar_id, const LLString& name ) +void LLFloaterWorldMap::trackAvatar( const LLUUID& avatar_id, const std::string& name ) { LLCtrlSelectionInterface *iface = childGetSelectionInterface("friend combo"); if (!iface) return; @@ -565,7 +565,7 @@ void LLFloaterWorldMap::trackLandmark( const LLUUID& landmark_item_id ) if (found && iface->setCurrentByID( landmark_item_id ) ) { LLUUID asset_id = mLandmarkAssetIDList.get( idx ); - LLString name; + std::string name; LLComboBox* combo = getChild<LLComboBox>( "landmark combo"); if (combo) name = combo->getSimple(); mTrackedStatus = LLTracker::TRACKING_LANDMARK; @@ -630,17 +630,17 @@ void LLFloaterWorldMap::trackLocation(const LLVector3d& pos_global) return; } - LLString sim_name; + std::string sim_name; LLWorldMap::getInstance()->simNameFromPosGlobal( pos_global, sim_name ); F32 region_x = (F32)fmod( pos_global.mdV[VX], (F64)REGION_WIDTH_METERS ); F32 region_y = (F32)fmod( pos_global.mdV[VY], (F64)REGION_WIDTH_METERS ); - LLString full_name = llformat("%s (%d, %d, %d)", + std::string full_name = llformat("%s (%d, %d, %d)", sim_name.c_str(), llround(region_x), llround(region_y), llround((F32)pos_global.mdV[VZ])); - LLString tooltip(""); + std::string tooltip(""); mTrackedStatus = LLTracker::TRACKING_LOCATION; LLTracker::trackLocation(pos_global, full_name, tooltip); LLWorldMap::getInstance()->mIsTrackingUnknownLocation = FALSE; @@ -667,7 +667,7 @@ void LLFloaterWorldMap::updateLocation() if ( status == LLTracker::TRACKING_NOTHING && mSetToUserPosition ) { // Make sure we know where we are before setting the current user position - LLString agent_sim_name; + std::string agent_sim_name; gotSimName = LLWorldMap::getInstance()->simNameFromPosGlobal( agentPos, agent_sim_name ); if ( gotSimName ) { @@ -694,7 +694,7 @@ void LLFloaterWorldMap::updateLocation() return; // invalid location } - LLString sim_name; + std::string sim_name; gotSimName = LLWorldMap::getInstance()->simNameFromPosGlobal( pos_global, sim_name ); if ((status != LLTracker::TRACKING_NOTHING) && (status != mTrackedStatus || pos_global != mTrackedLocation || sim_name != mTrackedSimName)) @@ -734,7 +734,7 @@ void LLFloaterWorldMap::updateLocation() } } -void LLFloaterWorldMap::trackURL(const LLString& region_name, S32 x_coord, S32 y_coord, S32 z_coord) +void LLFloaterWorldMap::trackURL(const std::string& region_name, S32 x_coord, S32 y_coord, S32 z_coord) { LLSimInfo* sim_info = LLWorldMap::getInstance()->simInfoFromName(region_name); z_coord = llclamp(z_coord, 0, 1000); @@ -759,7 +759,7 @@ void LLFloaterWorldMap::trackURL(const LLString& region_name, S32 x_coord, S32 y // pass sim name to combo box gFloaterWorldMap->mCompletingRegionName = region_name; LLWorldMap::getInstance()->sendNamedRegionRequest(region_name); - LLString::toLower(gFloaterWorldMap->mCompletingRegionName); + LLStringUtil::toLower(gFloaterWorldMap->mCompletingRegionName); LLWorldMap::getInstance()->mIsTrackingCommit = TRUE; } } @@ -906,8 +906,7 @@ void LLFloaterWorldMap::buildLandmarkIDLists() mLandmarkAssetIDList.put( item->getAssetUUID() ); mLandmarkItemIDList.put( item->getUUID() ); } - - list->sortByColumn("landmark name", TRUE); + list->sortByColumn(std::string("landmark name"), TRUE); list->selectFirstItem(); } @@ -1184,7 +1183,7 @@ void LLFloaterWorldMap::onAvatarComboCommit( LLUICtrl* ctrl, void* userdata ) const LLUUID& new_avatar_id = list->getCurrentID(); if (new_avatar_id.notNull()) { - LLString name; + std::string name; LLComboBox* combo = gFloaterWorldMap->getChild<LLComboBox>("friend combo"); if (combo) name = combo->getSimple(); self->trackAvatar(new_avatar_id, name); @@ -1230,17 +1229,17 @@ void LLFloaterWorldMap::onLocationCommit( void* userdata ) self->mCompletingRegionName = ""; self->mLastRegionName = ""; - LLString str = self->childGetValue("location").asString(); + std::string str = self->childGetValue("location").asString(); // Trim any leading and trailing spaces in the search target - LLString saved_str = str; - LLString::trim( str ); + std::string saved_str = str; + LLStringUtil::trim( str ); if ( str != saved_str ) { // Set the value in the UI if any spaces were removed self->childSetValue("location", str); } - LLString::toLower(str); + LLStringUtil::toLower(str); gFloaterWorldMap->mCompletingRegionName = str; LLWorldMap::getInstance()->mIsTrackingCommit = TRUE; self->mExactMatch = FALSE; @@ -1302,7 +1301,7 @@ void LLFloaterWorldMap::onCopySLURL(void* data) LLFloaterWorldMap* self = (LLFloaterWorldMap*)data; gViewerWindow->mWindow->copyTextToClipboard(utf8str_to_wstring(self->mSLURL)); - LLString::format_map_t args; + LLStringUtil::format_map_t args; args["[SLURL]"] = self->mSLURL; LLAlertDialog::showXml("CopySLURL", args); @@ -1554,9 +1553,9 @@ void LLFloaterWorldMap::updateSims(bool found_null_sim) for (it = LLWorldMap::getInstance()->mSimInfoMap.begin(); it != LLWorldMap::getInstance()->mSimInfoMap.end(); ++it) { LLSimInfo* info = (*it).second; - LLString sim_name = info->mName; - LLString sim_name_lower = sim_name; - LLString::toLower(sim_name_lower); + std::string sim_name = info->mName; + std::string sim_name_lower = sim_name; + LLStringUtil::toLower(sim_name_lower); if (sim_name_lower.substr(0, name_length) == mCompletingRegionName) { @@ -1599,7 +1598,7 @@ void LLFloaterWorldMap::updateSims(bool found_null_sim) } else { - list->addCommentText("None found."); + list->addCommentText(std::string("None found.")); list->operateOnAll(LLCtrlListInterface::OP_DESELECT); } } @@ -1631,19 +1630,19 @@ void LLFloaterWorldMap::onCommitSearchResult(LLUICtrl*, void* userdata) if (!list) return; LLSD selected_value = list->getSelectedValue(); - LLString sim_name = selected_value.asString(); + std::string sim_name = selected_value.asString(); if (sim_name.empty()) { return; } - LLString::toLower(sim_name); + LLStringUtil::toLower(sim_name); std::map<U64, LLSimInfo*>::const_iterator it; for (it = LLWorldMap::getInstance()->mSimInfoMap.begin(); it != LLWorldMap::getInstance()->mSimInfoMap.end(); ++it) { LLSimInfo* info = (*it).second; - LLString info_sim_name = info->mName; - LLString::toLower(info_sim_name); + std::string info_sim_name = info->mName; + LLStringUtil::toLower(info_sim_name); if (sim_name == info_sim_name) { diff --git a/indra/newview/llfloaterworldmap.h b/indra/newview/llfloaterworldmap.h index 3cf12a9eb7..f4c2b1abed 100644 --- a/indra/newview/llfloaterworldmap.h +++ b/indra/newview/llfloaterworldmap.h @@ -85,12 +85,12 @@ public: void friendsChanged(); // tracking methods - void trackAvatar( const LLUUID& avatar_id, const LLString& name ); + void trackAvatar( const LLUUID& avatar_id, const std::string& name ); void trackLandmark( const LLUUID& landmark_item_id ); void trackLocation(const LLVector3d& pos); void trackEvent(const LLItemInfo &event_info); void trackGenericItem(const LLItemInfo &item); - void trackURL(const LLString& region_name, S32 x_coord, S32 y_coord, S32 z_coord); + void trackURL(const std::string& region_name, S32 x_coord, S32 y_coord, S32 z_coord); static const LLUUID& getHomeID() { return sHomeID; } @@ -177,8 +177,8 @@ protected: LLInventoryObserver* mInventoryObserver; LLFriendObserver* mFriendObserver; - LLString mCompletingRegionName; - LLString mLastRegionName; + std::string mCompletingRegionName; + std::string mLastRegionName; BOOL mWaitingForTracker; BOOL mExactMatch; @@ -187,9 +187,9 @@ protected: LLVector3d mTrackedLocation; LLTracker::ETrackingStatus mTrackedStatus; - LLString mTrackedSimName; - LLString mTrackedAvatarName; - LLString mSLURL; + std::string mTrackedSimName; + std::string mTrackedAvatarName; + std::string mSLURL; }; extern LLFloaterWorldMap* gFloaterWorldMap; diff --git a/indra/newview/llfolderview.cpp b/indra/newview/llfolderview.cpp index a514d9b997..2739a30031 100644 --- a/indra/newview/llfolderview.cpp +++ b/indra/newview/llfolderview.cpp @@ -118,7 +118,7 @@ LLColor4 LLFolderViewItem::sSuffixColor; LLColor4 LLFolderViewItem::sSearchStatusColor; // Default constructor -LLFolderViewItem::LLFolderViewItem( const LLString& name, LLUIImagePtr icon, +LLFolderViewItem::LLFolderViewItem( const std::string& name, LLUIImagePtr icon, S32 creation_date, LLFolderView* root, LLFolderViewEventListener* listener ) : @@ -137,7 +137,7 @@ LLFolderViewItem::LLFolderViewItem( const LLString& name, LLUIImagePtr icon, mNumDescendantsSelected(0), mFiltered(FALSE), mLastFilterGeneration(-1), - mStringMatchOffset(LLString::npos), + mStringMatchOffset(std::string::npos), mControlLabelRotation(0.f), mRoot( root ), mDragAndDropTarget(FALSE), @@ -280,8 +280,7 @@ void LLFolderViewItem::refresh() { if(mListener) { - const char* label = mListener->getDisplayName().c_str(); - mLabel = label ? label : ""; + mLabel = mListener->getDisplayName(); setIcon(mListener->getIcon()); time_t creation_date = mListener->getCreationDate(); if (mCreationDate != creation_date) @@ -292,9 +291,9 @@ void LLFolderViewItem::refresh() mLabelStyle = mListener->getLabelStyle(); mLabelSuffix = mListener->getLabelSuffix(); - LLString searchable_label(mLabel); + std::string searchable_label(mLabel); searchable_label.append(mLabelSuffix); - LLString::toUpper(searchable_label); + LLStringUtil::toUpper(searchable_label); if (mSearchableLabel.compare(searchable_label)) { @@ -564,11 +563,11 @@ void LLFolderViewItem::preview( void ) } } -void LLFolderViewItem::rename(const LLString& new_name) +void LLFolderViewItem::rename(const std::string& new_name) { if( !new_name.empty() ) { - mLabel = new_name.c_str(); + mLabel = new_name; if( mListener ) { mListener->renameItem(new_name); @@ -581,12 +580,12 @@ void LLFolderViewItem::rename(const LLString& new_name) } } -const LLString& LLFolderViewItem::getSearchableLabel() const +const std::string& LLFolderViewItem::getSearchableLabel() const { return mSearchableLabel; } -const LLString& LLFolderViewItem::getName( void ) const +const std::string& LLFolderViewItem::getName( void ) const { if(mListener) { @@ -757,7 +756,7 @@ BOOL LLFolderViewItem::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, - LLString& tooltip_msg) + std::string& tooltip_msg) { BOOL accepted = FALSE; BOOL handled = FALSE; @@ -922,7 +921,8 @@ void LLFolderViewItem::draw() if ( mIsLoading && mTimeSinceRequestStart.getElapsedTimeF32() >= gSavedSettings.getF32("FolderLoadingMessageWaitTime") ) { - sFont->renderUTF8( "Loading... ", 0, text_left, y, sSearchStatusColor, + // *TODO: Translate + sFont->renderUTF8( std::string("Loading... "), 0, text_left, y, sSearchStatusColor, LLFontGL::LEFT, LLFontGL::BOTTOM, mLabelStyle, S32_MAX, S32_MAX, &right_x, FALSE); text_left = right_x; } @@ -937,13 +937,13 @@ void LLFolderViewItem::draw() S32_MAX, S32_MAX, &right_x, FALSE ); } - if (mBoxImage.notNull() && mStringMatchOffset != LLString::npos) + if (mBoxImage.notNull() && mStringMatchOffset != std::string::npos) { // don't draw backgrounds for zero-length strings S32 filter_string_length = mRoot->getFilterSubString().size(); if (filter_string_length > 0) { - LLString combined_string = mLabel + mLabelSuffix; + std::string combined_string = mLabel + mLabelSuffix; S32 left = llround(text_left) + sFont->getWidth(combined_string, 0, mStringMatchOffset) - 1; S32 right = left + sFont->getWidth(combined_string, mStringMatchOffset, filter_string_length) + 2; S32 bottom = llfloor(getRect().getHeight() - sFont->getLineHeight() - 3); @@ -972,7 +972,7 @@ void LLFolderViewItem::draw() ///---------------------------------------------------------------------------- // Default constructor -LLFolderViewFolder::LLFolderViewFolder( const LLString& name, LLUIImagePtr icon, +LLFolderViewFolder::LLFolderViewFolder( const std::string& name, LLUIImagePtr icon, LLFolderView* root, LLFolderViewEventListener* listener ): LLFolderViewItem( name, icon, 0, root, listener ), // 0 = no create time @@ -988,7 +988,7 @@ LLFolderViewFolder::LLFolderViewFolder( const LLString& name, LLUIImagePtr icon, mCompletedFilterGeneration(-1), mMostFilteredDescendantGeneration(-1) { - mType = "(folder)"; + mType = std::string("(folder)"); } // Destroys the object @@ -1958,7 +1958,7 @@ BOOL LLFolderViewFolder::handleDragAndDropFromChild(MASK mask, EDragAndDropType c_type, void* cargo_data, EAcceptance* accept, - LLString& tooltip_msg) + std::string& tooltip_msg) { BOOL accepted = mListener && mListener->dragOrDrop(mask,drop,c_type,cargo_data); if (accepted) @@ -2023,7 +2023,7 @@ BOOL LLFolderViewFolder::handleDragAndDrop(S32 x, S32 y, MASK mask, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, - LLString& tooltip_msg) + std::string& tooltip_msg) { LLFolderView* root_view = getRoot(); @@ -2487,7 +2487,7 @@ void LLCloseAllFoldersFunctor::doItem(LLFolderViewItem* item) ///---------------------------------------------------------------------------- // Default constructor -LLFolderView::LLFolderView( const LLString& name, LLUIImagePtr root_folder_icon, +LLFolderView::LLFolderView( const std::string& name, LLUIImagePtr root_folder_icon, const LLRect& rect, const LLUUID& source_id, LLView *parent_view ) : #if LL_WINDOWS #pragma warning( push ) @@ -2534,9 +2534,9 @@ LLFolderView::LLFolderView( const LLString& name, LLUIImagePtr root_folder_icon, //clear label // go ahead and render root folder as usual // just make sure the label ("Inventory Folder") never shows up - mLabel = LLString::null; + mLabel = LLStringUtil::null; - mRenamer = new LLLineEditor("ren", getRect(), "", sFont, + mRenamer = new LLLineEditor(std::string("ren"), getRect(), LLStringUtil::null, sFont, DB_INV_ITEM_NAME_STR_LEN, &LLFolderView::commitRename, NULL, @@ -2553,7 +2553,7 @@ LLFolderView::LLFolderView( const LLString& name, LLUIImagePtr root_folder_icon, LLMenuGL* menu = LLUICtrlFactory::getInstance()->buildMenu("menu_inventory.xml", parent_view); if (!menu) { - menu = new LLMenuGL(""); + menu = new LLMenuGL(LLStringUtil::null); } menu->setBackgroundColor(gColors.getColor("MenuPopupBgColor")); menu->setVisible(FALSE); @@ -2665,7 +2665,7 @@ void LLFolderView::closeAllFolders() setOpenArrangeRecursively(FALSE, LLFolderViewFolder::RECURSE_DOWN); } -void LLFolderView::openFolder(const LLString& foldername) +void LLFolderView::openFolder(const std::string& foldername) { LLFolderViewFolder* inv = getChild<LLFolderViewFolder>(foldername); if (inv) @@ -2771,7 +2771,7 @@ S32 LLFolderView::arrange( S32* unused_width, S32* unused_height, S32 filter_gen return llround(mTargetHeight); } -const LLString LLFolderView::getFilterSubString(BOOL trim) +const std::string LLFolderView::getFilterSubString(BOOL trim) { return mFilter.getFilterSubString(trim); } @@ -3119,7 +3119,7 @@ void LLFolderView::draw() { if (mDebugFilters) { - LLString current_filter_string = llformat("Current Filter: %d, Least Filter: %d, Auto-accept Filter: %d", + std::string current_filter_string = llformat("Current Filter: %d, Least Filter: %d, Auto-accept Filter: %d", mFilter.getCurrentGeneration(), mFilter.getMinRequiredGeneration(), mFilter.getMustPassGeneration()); sSmallFont->renderUTF8(current_filter_string, 0, 2, getRect().getHeight() - sSmallFont->getLineHeight(), LLColor4(0.5f, 0.5f, 0.8f, 1.f), @@ -3169,12 +3169,12 @@ void LLFolderView::draw() { if (gInventory.backgroundFetchActive() || mCompletedFilterGeneration < mFilter.getMinRequiredGeneration()) { - mStatusText = "Searching..."; // *TODO:translate + mStatusText = std::string("Searching..."); // *TODO:translate sFont->renderUTF8(mStatusText, 0, 2, 1, sSearchStatusColor, LLFontGL::LEFT, LLFontGL::TOP, LLFontGL::NORMAL, S32_MAX, S32_MAX, NULL, FALSE ); } else { - mStatusText = "No matching items found in inventory."; // *TODO:translate + mStatusText = std::string("No matching items found in inventory."); // *TODO:translate sFont->renderUTF8(mStatusText, 0, 2, 1, sSearchStatusColor, LLFontGL::LEFT, LLFontGL::TOP, LLFontGL::NORMAL, S32_MAX, S32_MAX, NULL, FALSE ); } } @@ -3192,7 +3192,7 @@ void LLFolderView::finishRenamingItem( void ) } if( mRenameItem ) { - mRenameItem->rename( mRenamer->getText().c_str() ); + mRenameItem->rename( mRenamer->getText() ); } mRenamer->setCommitOnFocusLost( FALSE ); @@ -3862,7 +3862,7 @@ BOOL LLFolderView::handleKeyHere( KEY key, MASK mask ) { mSearchString.erase(mSearchString.size() - 1, 1); } - search(getCurSelectedItem(), mSearchString.c_str(), FALSE); + search(getCurSelectedItem(), mSearchString, FALSE); handled = TRUE; } } @@ -3905,7 +3905,7 @@ BOOL LLFolderView::handleUnicodeCharHere(llwchar uni_char) { mSearchString += uni_char; } - search(getCurSelectedItem(), mSearchString.c_str(), FALSE); + search(getCurSelectedItem(), mSearchString, FALSE); handled = TRUE; } @@ -3956,14 +3956,14 @@ void LLFolderView::onFocusLost( ) LLUICtrl::onFocusLost(); } -BOOL LLFolderView::search(LLFolderViewItem* first_item, const LLString &search_string, BOOL backward) +BOOL LLFolderView::search(LLFolderViewItem* first_item, const std::string &search_string, BOOL backward) { // get first selected item LLFolderViewItem* search_item = first_item; // make sure search string is upper case - LLString upper_case_string = search_string; - LLString::toUpper(upper_case_string); + std::string upper_case_string = search_string; + LLStringUtil::toUpper(upper_case_string); // if nothing selected, select first item in folder if (!search_item) @@ -3994,7 +3994,7 @@ BOOL LLFolderView::search(LLFolderViewItem* first_item, const LLString &search_s } } - const LLString current_item_label(search_item->getSearchableLabel()); + const std::string current_item_label(search_item->getSearchableLabel()); S32 search_string_length = llmin(upper_case_string.size(), current_item_label.size()); if (!current_item_label.compare(0, search_string_length, upper_case_string)) { @@ -4082,7 +4082,7 @@ BOOL LLFolderView::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, - LLString& tooltip_msg) + std::string& tooltip_msg) { mDragAndDropThisFrame = TRUE; BOOL handled = LLView::handleDragAndDrop(x, y, mask, drop, cargo_type, cargo_data, @@ -4374,7 +4374,7 @@ bool LLInventorySort::operator()(const LLFolderViewItem* const& a, const LLFolde if (by_name) { - S32 compare = LLString::compareDict(a->getLabel(), b->getLabel()); + S32 compare = LLStringUtil::compareDict(a->getLabel(), b->getLabel()); if (0 == compare) { return (a->getCreationDate() > b->getCreationDate()); @@ -4392,7 +4392,7 @@ bool LLInventorySort::operator()(const LLFolderViewItem* const& a, const LLFolde time_t second_create = b->getCreationDate(); if (first_create == second_create) { - return (LLString::compareDict(a->getLabel(), b->getLabel()) < 0); + return (LLStringUtil::compareDict(a->getLabel(), b->getLabel()) < 0); } else { @@ -4477,7 +4477,7 @@ void LLFolderViewEventListener::arrangeAndSet(LLFolderViewItem* focus, ///---------------------------------------------------------------------------- /// Class LLInventoryFilter ///---------------------------------------------------------------------------- -LLInventoryFilter::LLInventoryFilter(const LLString& name) : +LLInventoryFilter::LLInventoryFilter(const std::string& name) : mName(name), mModified(FALSE), mNeedTextRebuild(TRUE) @@ -4492,7 +4492,7 @@ LLInventoryFilter::LLInventoryFilter(const LLString& name) : mOrder = SO_FOLDERS_BY_NAME; // This gets overridden by a pref immediately mSubStringMatchOffset = 0; - mFilterSubString = ""; + mFilterSubString.clear(); mFilterGeneration = 0; mMustPassGeneration = S32_MAX; mMinRequiredGeneration = 0; @@ -4524,15 +4524,15 @@ BOOL LLInventoryFilter::check(LLFolderViewItem* item) earliest = 0; } LLFolderViewEventListener* listener = item->getListener(); - mSubStringMatchOffset = mFilterSubString.size() ? item->getSearchableLabel().find(mFilterSubString) : LLString::npos; + mSubStringMatchOffset = mFilterSubString.size() ? item->getSearchableLabel().find(mFilterSubString) : std::string::npos; BOOL passed = (0x1 << listener->getInventoryType() & mFilterOps.mFilterTypes || listener->getInventoryType() == LLInventoryType::IT_NONE) - && (mFilterSubString.size() == 0 || mSubStringMatchOffset != LLString::npos) + && (mFilterSubString.size() == 0 || mSubStringMatchOffset != std::string::npos) && ((listener->getPermissionMask() & mFilterOps.mPermissions) == mFilterOps.mPermissions) && (listener->getCreationDate() >= earliest && listener->getCreationDate() <= mFilterOps.mMaxDate); return passed; } -const LLString LLInventoryFilter::getFilterSubString(BOOL trim) +const std::string LLInventoryFilter::getFilterSubString(BOOL trim) { return mFilterSubString; } @@ -4603,7 +4603,7 @@ void LLInventoryFilter::setFilterTypes(U32 types) } } -void LLInventoryFilter::setFilterSubString(const LLString& string) +void LLInventoryFilter::setFilterSubString(const std::string& string) { if (mFilterSubString != string) { @@ -4612,8 +4612,8 @@ void LLInventoryFilter::setFilterSubString(const LLString& string) // appending new characters BOOL more_restrictive = mFilterSubString.size() < string.size() && !string.substr(0, mFilterSubString.size()).compare(mFilterSubString); mFilterSubString = string; - LLString::toUpper(mFilterSubString); - LLString::trimHead(mFilterSubString); + LLStringUtil::toUpper(mFilterSubString); + LLStringUtil::trimHead(mFilterSubString); if (less_restrictive) { @@ -4808,7 +4808,7 @@ BOOL LLInventoryFilter::isFilterWith(LLInventoryType::EType t) return mFilterOps.mFilterTypes & (0x01 << t); } -LLString LLInventoryFilter::getFilterText() +std::string LLInventoryFilter::getFilterText() { if (!mNeedTextRebuild) { @@ -4816,12 +4816,12 @@ LLString LLInventoryFilter::getFilterText() } mNeedTextRebuild = FALSE; - LLString filtered_types; - LLString not_filtered_types; + std::string filtered_types; + std::string not_filtered_types; BOOL filtered_by_type = FALSE; BOOL filtered_by_all_types = TRUE; S32 num_filter_types = 0; - mFilterText = ""; + mFilterText.clear(); if (isFilterWith(LLInventoryType::IT_ANIMATION)) { @@ -5020,7 +5020,7 @@ void LLInventoryFilter::fromLLSD(LLSD& data) if(data.has("substring")) { - setFilterSubString(LLString(data["substring"].asString())); + setFilterSubString(std::string(data["substring"].asString())); } if(data.has("sort_order")) diff --git a/indra/newview/llfolderview.h b/indra/newview/llfolderview.h index c6b1e52157..32b0580a5c 100644 --- a/indra/newview/llfolderview.h +++ b/indra/newview/llfolderview.h @@ -70,26 +70,25 @@ class LLFolderViewItem; class LLFolderView; class LLInventoryModel; class LLScrollableContainerView; -typedef BOOL (*LLFolderSearchFunction)(LLFolderViewItem* first_item, const char *find_text, BOOL backward); class LLFolderViewEventListener { public: virtual ~LLFolderViewEventListener( void ) {} - virtual const LLString& getName() const = 0; - virtual const LLString& getDisplayName() const = 0; + virtual const std::string& getName() const = 0; + virtual const std::string& getDisplayName() const = 0; virtual const LLUUID& getUUID() const = 0; virtual time_t getCreationDate() const = 0; // UTC seconds virtual PermissionMask getPermissionMask() const = 0; virtual LLUIImagePtr getIcon() const = 0; virtual LLFontGL::StyleFlags getLabelStyle() const = 0; - virtual LLString getLabelSuffix() const = 0; + virtual std::string getLabelSuffix() const = 0; virtual void openItem( void ) = 0; virtual void previewItem( void ) = 0; virtual void selectItem(void) = 0; virtual void showProperties(void) = 0; virtual BOOL isItemRenameable() const = 0; - virtual BOOL renameItem(const LLString& new_name) = 0; + virtual BOOL renameItem(const std::string& new_name) = 0; virtual BOOL isItemMovable( void ) = 0; // Can be moved to another folder virtual BOOL isItemRemovable( void ) = 0; // Can be destroyed virtual BOOL removeItem() = 0; @@ -104,7 +103,7 @@ public: virtual BOOL isUpToDate() const = 0; virtual BOOL hasChildren() const = 0; virtual LLInventoryType::EType getInventoryType() const = 0; - virtual void performAction(LLFolderView* folder, LLInventoryModel* model, LLString action) {} + virtual void performAction(LLFolderView* folder, LLInventoryModel* model, std::string action) {} // This method should be called when a drag begins. returns TRUE // if the drag can begin, otherwise FALSE. @@ -186,14 +185,14 @@ public: static const U32 SO_FOLDERS_BY_NAME = 2; static const U32 SO_SYSTEM_FOLDERS_TO_TOP = 4; - LLInventoryFilter(const LLString& name); + LLInventoryFilter(const std::string& name); virtual ~LLInventoryFilter(); void setFilterTypes(U32 types); U32 getFilterTypes() const { return mFilterOps.mFilterTypes; } - void setFilterSubString(const LLString& string); - const LLString getFilterSubString(BOOL trim = FALSE); + void setFilterSubString(const std::string& string); + const std::string getFilterSubString(BOOL trim = FALSE); void setFilterPermissions(PermissionMask perms); PermissionMask getFilterPermissions() const { return mFilterOps.mPermissions; } @@ -220,8 +219,8 @@ public: BOOL isModifiedAndClear(); BOOL isSinceLogoff(); void clearModified() { mModified = FALSE; mFilterBehavior = FILTER_NONE; } - const LLString getName() const { return mName; } - LLString getFilterText(); + const std::string getName() const { return mName; } + std::string getFilterText(); void setFilterCount(S32 count) { mFilterCount = count; } S32 getFilterCount() { return mFilterCount; } @@ -255,9 +254,9 @@ protected: filter_ops mFilterOps; filter_ops mDefaultFilterOps; std::string::size_type mSubStringMatchOffset; - LLString mFilterSubString; + std::string mFilterSubString; U32 mOrder; - const LLString mName; + const std::string mName; S32 mFilterGeneration; S32 mMustPassGeneration; S32 mMinRequiredGeneration; @@ -269,7 +268,7 @@ private: U32 mLastLogoff; BOOL mModified; BOOL mNeedTextRebuild; - LLString mFilterText; + std::string mFilterText; }; // These are grouping of inventory types. @@ -329,9 +328,9 @@ protected: static LLColor4 sSuffixColor; static LLColor4 sSearchStatusColor; - LLString mLabel; - LLString mSearchableLabel; - LLString mType; + std::string mLabel; + std::string mSearchableLabel; + std::string mType; S32 mLabelWidth; U32 mCreationDate; LLFolderViewFolder* mParentFolder; @@ -340,9 +339,9 @@ protected: BOOL mIsCurSelection; BOOL mSelectPending; LLFontGL::StyleFlags mLabelStyle; - LLString mLabelSuffix; + std::string mLabelSuffix; LLUIImagePtr mIcon; - LLString mStatusText; + std::string mStatusText; BOOL mHasVisibleChildren; S32 mIndentation; S32 mNumDescendantsSelected; @@ -383,7 +382,7 @@ public: void filterFromRoot( void ); // creation_date is in UTC seconds - LLFolderViewItem( const LLString& name, LLUIImagePtr icon, S32 creation_date, LLFolderView* root, LLFolderViewEventListener* listener ); + LLFolderViewItem( const std::string& name, LLUIImagePtr icon, S32 creation_date, LLFolderView* root, LLFolderViewEventListener* listener ); virtual ~LLFolderViewItem( void ); // addToFolder() returns TRUE if it succeeds. FALSE otherwise @@ -454,14 +453,14 @@ public: // This method returns the actual name of the thing being // viewed. This method will ask the viewed object itself. - const LLString& getName( void ) const; + const std::string& getName( void ) const; - const LLString& getSearchableLabel( void ) const; + const std::string& getSearchableLabel( void ) const; // This method returns the label displayed on the view. This // method was primarily added to allow sorting on the folder // contents possible before the entire view has been constructed. - const char* getLabel() const { return mLabel.c_str(); } + const std::string& getLabel() const { return mLabel; } // Used for sorting, like getLabel() above. virtual time_t getCreationDate() const { return mCreationDate; } @@ -476,7 +475,7 @@ public: LLFolderViewEventListener* getListener( void ) { return mListener; } // just rename the object. - void rename(const LLString& new_name); + void rename(const std::string& new_name); // open virtual void openItem( void ); @@ -519,7 +518,7 @@ public: EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, - LLString& tooltip_msg); + std::string& tooltip_msg); }; @@ -570,7 +569,7 @@ public: RECURSE_UP_DOWN } ERecurseType; - LLFolderViewFolder( const LLString& name, LLUIImagePtr icon, + LLFolderViewFolder( const std::string& name, LLUIImagePtr icon, LLFolderView* root, LLFolderViewEventListener* listener ); virtual ~LLFolderViewFolder( void ); @@ -681,7 +680,7 @@ public: EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, - LLString& tooltip_msg); + std::string& tooltip_msg); void applyFunctorRecursively(LLFolderViewFunctor& functor); virtual void applyListenerFunctorRecursively(LLFolderViewListenerFunctor& functor); @@ -699,7 +698,7 @@ public: EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, - LLString& tooltip_msg); + std::string& tooltip_msg); virtual void draw(); time_t getCreationDate() const; @@ -724,7 +723,7 @@ public: static F32 sAutoOpenTime; - LLFolderView( const LLString& name, LLUIImagePtr root_folder_icon, const LLRect& rect, + LLFolderView( const std::string& name, LLUIImagePtr root_folder_icon, const LLRect& rect, const LLUUID& source_id, LLView *parent_view ); virtual ~LLFolderView( void ); @@ -739,7 +738,7 @@ public: void setAllowMultiSelect(BOOL allow) { mAllowMultiSelect = allow; } LLInventoryFilter* getFilter() { return &mFilter; } - const LLString getFilterSubString(BOOL trim = FALSE); + const std::string getFilterSubString(BOOL trim = FALSE); U32 getFilterTypes() const { return mFilter.getFilterTypes(); } PermissionMask getFilterPermissions() const { return mFilter.getFilterPermissions(); } LLInventoryFilter::EFolderShow getShowFolderState() { return mFilter.getShowFolderState(); } @@ -749,7 +748,7 @@ public: // Close all folders in the view void closeAllFolders(); - void openFolder(const LLString& foldername); + void openFolder(const std::string& foldername); virtual void toggleOpen() {}; virtual void setOpenArrangeRecursively(BOOL openitem, ERecurseType recurse); @@ -839,7 +838,7 @@ public: EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, - LLString& tooltip_msg); + std::string& tooltip_msg); /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); /*virtual*/ void onFocusLost(); virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks); @@ -851,7 +850,7 @@ public: void setScrollContainer( LLScrollableContainerView* parent ) { mScrollContainer = parent; } LLRect getVisibleRect(); - BOOL search(LLFolderViewItem* first_item, const LLString &search_string, BOOL backward); + BOOL search(LLFolderViewItem* first_item, const std::string &search_string, BOOL backward); void setShowSelectionContext(BOOL show) { mShowSelectionContext = show; } BOOL getShowSelectionContext(); void setShowSingleSelection(BOOL show); @@ -910,7 +909,7 @@ protected: LLFolderViewFolder* mAutoOpenCandidate; LLFrameTimer mAutoOpenTimer; LLFrameTimer mSearchTimer; - LLString mSearchString; + std::string mSearchString; LLInventoryFilter mFilter; BOOL mShowSelectionContext; BOOL mShowSingleSelection; diff --git a/indra/newview/llgesturemgr.cpp b/indra/newview/llgesturemgr.cpp index adafd8e4c2..9af4bbd532 100644 --- a/indra/newview/llgesturemgr.cpp +++ b/indra/newview/llgesturemgr.cpp @@ -489,7 +489,7 @@ void LLGestureManager::playGesture(const LLUUID& item_id) // and (as a minor side effect) has multiple spaces in a row replaced by single spaces. BOOL LLGestureManager::triggerAndReviseString(const std::string &utf8str, std::string* revised_string) { - LLString tokenized = LLString(utf8str.c_str()); + std::string tokenized = utf8str; BOOL found_gestures = FALSE; BOOL first_token = TRUE; @@ -507,8 +507,8 @@ BOOL LLGestureManager::triggerAndReviseString(const std::string &utf8str, std::s // Only pay attention to the first gesture in the string. if( !found_gestures ) { - LLString cur_token_lower = cur_token; - LLString::toLower(cur_token_lower); + std::string cur_token_lower = cur_token; + LLStringUtil::toLower(cur_token_lower); // collect gestures that match std::vector <LLMultiGesture *> matching; @@ -520,7 +520,7 @@ BOOL LLGestureManager::triggerAndReviseString(const std::string &utf8str, std::s // Gesture asset data might not have arrived yet if (!gesture) continue; - if (!stricmp(gesture->mTrigger.c_str(), cur_token_lower.c_str())) + if (gesture->mTrigger == cur_token_lower) { matching.push_back(gesture); } @@ -548,9 +548,9 @@ BOOL LLGestureManager::triggerAndReviseString(const std::string &utf8str, std::s } // Don't muck with the user's capitalization if we don't have to. - LLString output = gesture->mReplaceText.c_str(); - LLString output_lower = output; - LLString::toLower(output_lower); + std::string output = gesture->mReplaceText; + std::string output_lower = output; + LLStringUtil::toLower(output_lower); if( cur_token_lower == output_lower ) { if (revised_string) @@ -958,7 +958,7 @@ void LLGestureManager::onLoadComplete(LLVFS *vfs, && gGestureManager.mDeactivateSimilarNames.length() > 0) { // we're done with this set of deactivations - LLString::format_map_t args; + LLStringUtil::format_map_t args; args["[NAMES]"] = gGestureManager.mDeactivateSimilarNames; LLNotifyBox::showXml("DeactivatedGesturesTrigger", args); } @@ -1123,9 +1123,9 @@ BOOL LLGestureManager::matchPrefix(const std::string& in_str, std::string* out_s continue; } - LLString trigger_trunc = trigger; - LLString::truncate(trigger_trunc, in_len); - if (!LLString::compareInsensitive(in_str.c_str(), trigger_trunc.c_str())) + std::string trigger_trunc = trigger; + LLStringUtil::truncate(trigger_trunc, in_len); + if (!LLStringUtil::compareInsensitive(in_str, trigger_trunc)) { *out_str = trigger; return TRUE; diff --git a/indra/newview/llglsandbox.cpp b/indra/newview/llglsandbox.cpp index f4ef00d310..6b89d52b68 100644 --- a/indra/newview/llglsandbox.cpp +++ b/indra/newview/llglsandbox.cpp @@ -1102,7 +1102,7 @@ void LLViewerObjectList::renderObjectBeacons() color = debug_beacon.mTextColor; color.mV[3] *= 1.f; - hud_textp->setString(utf8str_to_wstring(debug_beacon.mString.c_str())); + hud_textp->setString(utf8str_to_wstring(debug_beacon.mString)); hud_textp->setColor(color); hud_textp->setPositionAgent(debug_beacon.mPositionAgent); debug_beacon.mHUDObject = hud_textp; diff --git a/indra/newview/llgroupmgr.cpp b/indra/newview/llgroupmgr.cpp index 542274b295..32ccc761f8 100644 --- a/indra/newview/llgroupmgr.cpp +++ b/indra/newview/llgroupmgr.cpp @@ -821,8 +821,8 @@ void LLGroupMgr::processGroupMembersReply(LLMessageSystem* msg, void** data) if (group_datap->mMemberCount > 0) { S32 contribution = 0; - char online_status[DB_DATETIME_BUF_SIZE]; /* Flawfinder: ignore */ - char title[DB_GROUP_TITLE_BUF_SIZE]; /* Flawfinder: ignore */ + std::string online_status; + std::string title; U64 agent_powers = 0; BOOL is_owner = FALSE; @@ -834,8 +834,8 @@ void LLGroupMgr::processGroupMembersReply(LLMessageSystem* msg, void** data) msg->getUUIDFast(_PREHASH_MemberData, _PREHASH_AgentID, member_id, i ); msg->getS32(_PREHASH_MemberData, _PREHASH_Contribution, contribution, i); msg->getU64(_PREHASH_MemberData, "AgentPowers", agent_powers, i); - msg->getStringFast(_PREHASH_MemberData, _PREHASH_OnlineStatus, DB_DATETIME_BUF_SIZE, online_status, i); - msg->getString(_PREHASH_MemberData, "Title", DB_GROUP_TITLE_BUF_SIZE, title, i); + msg->getStringFast(_PREHASH_MemberData, _PREHASH_OnlineStatus, online_status, i); + msg->getString(_PREHASH_MemberData, "Title", title, i); msg->getBOOL(_PREHASH_MemberData,"IsOwner",is_owner,i); if (member_id.notNull()) @@ -844,8 +844,8 @@ void LLGroupMgr::processGroupMembersReply(LLMessageSystem* msg, void** data) LLGroupMemberData* newdata = new LLGroupMemberData(member_id, contribution, agent_powers, - std::string(title), - std::string(online_status), + title, + online_status, is_owner); #if LL_DEBUG LLGroupMgrGroupData::member_list_t::iterator mit = group_datap->mMembers.find(member_id); @@ -898,13 +898,13 @@ void LLGroupMgr::processGroupPropertiesReply(LLMessageSystem* msg, void** data) } LLUUID group_id; - char name[DB_GROUP_NAME_BUF_SIZE]; /* Flawfinder: ignore */ - char charter[DB_GROUP_CHARTER_BUF_SIZE]; /* Flawfinder: ignore */ + std::string name; + std::string charter; BOOL show_in_list = FALSE; LLUUID founder_id; U64 powers_mask = GP_NO_POWERS; S32 money = 0; - char member_title[DB_GROUP_TITLE_BUF_SIZE]; /* Flawfinder: ignore */ + std::string member_title; LLUUID insignia_id; LLUUID owner_role; U32 membership_fee = 0; @@ -915,18 +915,18 @@ void LLGroupMgr::processGroupPropertiesReply(LLMessageSystem* msg, void** data) BOOL mature = FALSE; msg->getUUIDFast(_PREHASH_GroupData, _PREHASH_GroupID, group_id ); - msg->getUUIDFast(_PREHASH_GroupData, _PREHASH_FounderID, founder_id); - msg->getStringFast(_PREHASH_GroupData, _PREHASH_Name, DB_GROUP_NAME_BUF_SIZE, name ); - msg->getStringFast(_PREHASH_GroupData, _PREHASH_Charter, DB_GROUP_CHARTER_BUF_SIZE, charter ); - msg->getBOOLFast(_PREHASH_GroupData, _PREHASH_ShowInList, show_in_list ); - msg->getStringFast(_PREHASH_GroupData, _PREHASH_MemberTitle, DB_GROUP_TITLE_BUF_SIZE, member_title ); - msg->getUUIDFast(_PREHASH_GroupData, _PREHASH_InsigniaID, insignia_id ); - msg->getU64Fast(_PREHASH_GroupData, _PREHASH_PowersMask, powers_mask ); - msg->getU32Fast(_PREHASH_GroupData, _PREHASH_MembershipFee, membership_fee ); - msg->getBOOLFast(_PREHASH_GroupData, _PREHASH_OpenEnrollment, open_enrollment ); - msg->getS32Fast(_PREHASH_GroupData, _PREHASH_GroupMembershipCount, num_group_members); - msg->getS32(_PREHASH_GroupData, "GroupRolesCount", num_group_roles); - msg->getS32Fast(_PREHASH_GroupData, _PREHASH_Money, money); + msg->getUUIDFast(_PREHASH_GroupData, _PREHASH_FounderID, founder_id); + msg->getStringFast(_PREHASH_GroupData, _PREHASH_Name, name ); + msg->getStringFast(_PREHASH_GroupData, _PREHASH_Charter, charter ); + msg->getBOOLFast(_PREHASH_GroupData, _PREHASH_ShowInList, show_in_list ); + msg->getStringFast(_PREHASH_GroupData, _PREHASH_MemberTitle, member_title ); + msg->getUUIDFast(_PREHASH_GroupData, _PREHASH_InsigniaID, insignia_id ); + msg->getU64Fast(_PREHASH_GroupData, _PREHASH_PowersMask, powers_mask ); + msg->getU32Fast(_PREHASH_GroupData, _PREHASH_MembershipFee, membership_fee ); + msg->getBOOLFast(_PREHASH_GroupData, _PREHASH_OpenEnrollment, open_enrollment ); + msg->getS32Fast(_PREHASH_GroupData, _PREHASH_GroupMembershipCount, num_group_members); + msg->getS32(_PREHASH_GroupData, "GroupRolesCount", num_group_roles); + msg->getS32Fast(_PREHASH_GroupData, _PREHASH_Money, money); msg->getBOOL("GroupData", "AllowPublish", allow_publish); msg->getBOOL("GroupData", "MaturePublish", mature); msg->getUUID(_PREHASH_GroupData, "OwnerRole", owner_role); @@ -979,9 +979,9 @@ void LLGroupMgr::processGroupRoleDataReply(LLMessageSystem* msg, void** data) msg->getS32(_PREHASH_GroupData, "RoleCount", group_data->mRoleCount ); - char name[DB_GROUP_NAME_BUF_SIZE]; /* Flawfinder: ignore */ - char title[DB_GROUP_TITLE_BUF_SIZE]; /* Flawfinder: ignore */ - char desc[DB_GROUP_CHARTER_BUF_SIZE]; /* Flawfinder: ignore */ + std::string name; + std::string title; + std::string desc; U64 powers = 0; U32 member_count = 0; LLUUID role_id; @@ -992,9 +992,9 @@ void LLGroupMgr::processGroupRoleDataReply(LLMessageSystem* msg, void** data) { msg->getUUID("RoleData", "RoleID", role_id, i ); - msg->getString("RoleData","Name",DB_GROUP_NAME_BUF_SIZE,name,i); - msg->getString("RoleData","Title",DB_GROUP_TITLE_BUF_SIZE,title,i); - msg->getString("RoleData","Description",DB_GROUP_CHARTER_BUF_SIZE,desc,i); + msg->getString("RoleData","Name",name,i); + msg->getString("RoleData","Title",title,i); + msg->getString("RoleData","Description",desc,i); msg->getU64("RoleData","Powers",powers,i); msg->getU32("RoleData","Members",member_count,i); @@ -1154,20 +1154,17 @@ void LLGroupMgr::processGroupTitlesReply(LLMessageSystem* msg, void** data) return; } - char title_buf[DB_GROUP_TITLE_BUF_SIZE]; /* Flawfinder: ignore */ - LLGroupTitle title; S32 i = 0; S32 blocks = msg->getNumberOfBlocksFast(_PREHASH_GroupData); for (i=0; i<blocks; ++i) { - msg->getString("GroupData","Title",DB_GROUP_TITLE_BUF_SIZE,title_buf,i); - title.mTitle = title_buf; + msg->getString("GroupData","Title",title.mTitle,i); msg->getUUID("GroupData","RoleID",title.mRoleID,i); msg->getBOOL("GroupData","Selected",title.mSelected,i); - if (title_buf[0] != '\0') + if (!title.mTitle.empty()) { lldebugs << "LLGroupMgr adding title: " << title.mTitle << ", " << title.mRoleID << ", " << (title.mSelected ? 'Y' : 'N') << llendl; group_data->mTitles.push_back(title); @@ -1243,12 +1240,12 @@ void LLGroupMgr::processCreateGroupReply(LLMessageSystem* msg, void ** data) { LLUUID group_id; BOOL success; - char message[MAX_STRING]; /* Flawfinder: ignore */ + std::string message; msg->getUUIDFast(_PREHASH_ReplyData, _PREHASH_GroupID, group_id ); msg->getBOOLFast(_PREHASH_ReplyData, _PREHASH_Success, success ); - msg->getStringFast(_PREHASH_ReplyData, _PREHASH_Message, MAX_STRING, message ); + msg->getStringFast(_PREHASH_ReplyData, _PREHASH_Message, message ); if (success) { @@ -1274,7 +1271,7 @@ void LLGroupMgr::processCreateGroupReply(LLMessageSystem* msg, void ** data) else { // *TODO:translate - LLString::format_map_t args; + LLStringUtil::format_map_t args; args["[MESSAGE]"] = message; gViewerWindow->alertXml("UnableToCreateGroup", args); } @@ -1723,7 +1720,7 @@ void LLGroupMgr::cancelGroupRoleChanges(const LLUUID& group_id) } //static -bool LLGroupMgr::parseRoleActions(const LLString& xml_filename) +bool LLGroupMgr::parseRoleActions(const std::string& xml_filename) { LLXMLNodePtr root; @@ -1747,7 +1744,7 @@ bool LLGroupMgr::parseRoleActions(const LLString& xml_filename) LLRoleAction* role_action_data = new LLRoleAction(); // name= - LLString action_set_name; + std::string action_set_name; if (action_set->getAttributeString("name", action_set_name)) { lldebugs << "Loading action set " << action_set_name << llendl; @@ -1761,13 +1758,13 @@ bool LLGroupMgr::parseRoleActions(const LLString& xml_filename) continue; } // description= - LLString set_description; + std::string set_description; if (action_set->getAttributeString("description", set_description)) { role_action_data->mDescription = set_description; } // long description= - LLString set_longdescription; + std::string set_longdescription; if (action_set->getAttributeString("longdescription", set_longdescription)) { role_action_data->mLongDescription = set_longdescription; @@ -1788,7 +1785,7 @@ bool LLGroupMgr::parseRoleActions(const LLString& xml_filename) LLRoleAction* role_action = new LLRoleAction(); // name= - LLString action_name; + std::string action_name; if (action->getAttributeString("name", action_name)) { lldebugs << "Loading action " << action_name << llendl; @@ -1801,13 +1798,13 @@ bool LLGroupMgr::parseRoleActions(const LLString& xml_filename) continue; } // description= - LLString description; + std::string description; if (action->getAttributeString("description", description)) { role_action->mDescription = description; } // long description= - LLString longdescription; + std::string longdescription; if (action->getAttributeString("longdescription", longdescription)) { role_action->mLongDescription = longdescription; diff --git a/indra/newview/llgroupmgr.h b/indra/newview/llgroupmgr.h index 2cab236954..cbfeca31e1 100644 --- a/indra/newview/llgroupmgr.h +++ b/indra/newview/llgroupmgr.h @@ -343,7 +343,7 @@ public: static void processEjectGroupMemberReply(LLMessageSystem* msg, void ** data); static void processLeaveGroupReply(LLMessageSystem* msg, void ** data); - static bool parseRoleActions(const LLString& xml_filename); + static bool parseRoleActions(const std::string& xml_filename); std::vector<LLRoleActionSet*> mRoleActionSets; diff --git a/indra/newview/llhudeffectlookat.cpp b/indra/newview/llhudeffectlookat.cpp index 432096e781..ea7413ea3f 100644 --- a/indra/newview/llhudeffectlookat.cpp +++ b/indra/newview/llhudeffectlookat.cpp @@ -77,12 +77,12 @@ public: : mTimeout(0.f), mPriority(0.f) {} - LLAttention(F32 timeout, F32 priority, LLString name, LLColor3 color) : + LLAttention(F32 timeout, F32 priority, const std::string& name, LLColor3 color) : mTimeout(timeout), mPriority(priority), mName(name), mColor(color) { } F32 mTimeout, mPriority; - LLString mName; + std::string mName; LLColor3 mColor; }; @@ -150,7 +150,7 @@ static BOOL loadGender(LLXmlTreeNode* gender) { return FALSE; } - LLString str; + std::string str; gender->getAttributeString("name", str); LLAttentionSet& attentions = (str.compare("Masculine") == 0) ? gBoyAttentions : gGirlAttentions; for (LLXmlTreeNode* attention_node = gender->getChildByName( "param" ); @@ -189,9 +189,8 @@ static BOOL loadAttentions() } first_time = FALSE; - char filename[MAX_PATH]; /*Flawfinder: ignore*/ - strncpy(filename,gDirUtilp->getExpandedFilename(LL_PATH_CHARACTER,"attentions.xml").c_str(), sizeof(filename) -1); /*Flawfinder: ignore*/ - filename[sizeof(filename) -1] = '\0'; + std::string filename; + filename = gDirUtilp->getExpandedFilename(LL_PATH_CHARACTER,"attentions.xml"); LLXmlTree xml_tree; BOOL success = xml_tree.parseFile( filename, FALSE ); if( !success ) @@ -213,7 +212,7 @@ static BOOL loadAttentions() return FALSE; } - LLString version; + std::string version; static LLStdStringHandle version_string = LLXmlTree::addAttributeString("version"); if( !root->getFastAttributeString( version_string, version ) || (version != "1.0") ) { diff --git a/indra/newview/llhudtext.cpp b/indra/newview/llhudtext.cpp index df03f8d45e..da9441e108 100644 --- a/indra/newview/llhudtext.cpp +++ b/indra/newview/llhudtext.cpp @@ -1,3 +1,4 @@ + /** * @file llhudtext.cpp * @brief LLHUDText class implementation @@ -921,8 +922,7 @@ void LLHUDText::setLOD(S32 lod) { mLOD = lod; //RN: uncomment this to visualize LOD levels - //char label[255]; - //sprintf(label, "%d", lod); + //std::string label = llformat("%d", lod); //setLabel(label); } diff --git a/indra/newview/llimpanel.cpp b/indra/newview/llimpanel.cpp index ebcbc20270..8a8321f9a0 100644 --- a/indra/newview/llimpanel.cpp +++ b/indra/newview/llimpanel.cpp @@ -86,9 +86,9 @@ const U32 DEFAULT_RETRIES_COUNT = 3; // Statics // // -static LLString sTitleString = "Instant Message with [NAME]"; -static LLString sTypingStartString = "[NAME]: ..."; -static LLString sSessionStartString = "Starting session with [NAME] please wait."; +static std::string sTitleString = "Instant Message with [NAME]"; +static std::string sTypingStartString = "[NAME]: ..."; +static std::string sSessionStartString = "Starting session with [NAME] please wait."; LLVoiceChannel::voice_channel_map_t LLVoiceChannel::sVoiceChannelMap; LLVoiceChannel::voice_channel_map_uri_t LLVoiceChannel::sVoiceChannelURIMap; @@ -121,7 +121,7 @@ void session_starter_helper( gAgent.buildFullname(name); msg->addStringFast(_PREHASH_FromAgentName, name); - msg->addStringFast(_PREHASH_Message, LLString::null); + msg->addStringFast(_PREHASH_Message, LLStringUtil::null); msg->addU32Fast(_PREHASH_ParentEstateID, 0); msg->addUUIDFast(_PREHASH_RegionID, LLUUID::null); msg->addVector3Fast(_PREHASH_Position, gAgent.getPositionAgent()); @@ -342,7 +342,7 @@ void LLVoiceCallCapResponder::result(const LLSD& content) // // LLVoiceChannel // -LLVoiceChannel::LLVoiceChannel(const LLUUID& session_id, const LLString& session_name) : +LLVoiceChannel::LLVoiceChannel(const LLUUID& session_id, const std::string& session_name) : mSessionID(session_id), mState(STATE_NO_CHANNEL_INFO), mSessionName(session_name), @@ -373,8 +373,8 @@ LLVoiceChannel::~LLVoiceChannel() } void LLVoiceChannel::setChannelInfo( - const LLString& uri, - const LLString& credentials) + const std::string& uri, + const std::string& credentials) { setURI(uri); @@ -563,7 +563,7 @@ LLVoiceChannel* LLVoiceChannel::getChannelByID(const LLUUID& session_id) } //static -LLVoiceChannel* LLVoiceChannel::getChannelByURI(LLString uri) +LLVoiceChannel* LLVoiceChannel::getChannelByURI(std::string uri) { voice_channel_map_uri_t::iterator found_it = sVoiceChannelURIMap.find(uri); if (found_it == sVoiceChannelURIMap.end()) @@ -584,7 +584,7 @@ void LLVoiceChannel::updateSessionID(const LLUUID& new_session_id) sVoiceChannelMap.insert(std::make_pair(mSessionID, this)); } -void LLVoiceChannel::setURI(LLString uri) +void LLVoiceChannel::setURI(std::string uri) { sVoiceChannelURIMap.erase(mURI); mURI = uri; @@ -654,7 +654,7 @@ void LLVoiceChannel::resume() // LLVoiceChannelGroup // -LLVoiceChannelGroup::LLVoiceChannelGroup(const LLUUID& session_id, const LLString& session_name) : +LLVoiceChannelGroup::LLVoiceChannelGroup(const LLUUID& session_id, const std::string& session_name) : LLVoiceChannel(session_id, session_name) { mRetries = DEFAULT_RETRIES_COUNT; @@ -701,8 +701,8 @@ void LLVoiceChannelGroup::getChannelInfo() } void LLVoiceChannelGroup::setChannelInfo( - const LLString& uri, - const LLString& credentials) + const std::string& uri, + const std::string& credentials) { setURI(uri); @@ -795,7 +795,7 @@ void LLVoiceChannelGroup::handleError(EStatusType status) { LLNotifyBox::showXml(notify, mNotifyArgs); // echo to im window - gIMMgr->addMessage(mSessionID, LLUUID::null, SYSTEM_FROM, LLNotifyBox::getTemplateMessage(notify, mNotifyArgs).c_str()); + gIMMgr->addMessage(mSessionID, LLUUID::null, SYSTEM_FROM, LLNotifyBox::getTemplateMessage(notify, mNotifyArgs)); } LLVoiceChannel::handleError(status); @@ -822,7 +822,7 @@ void LLVoiceChannelGroup::setState(EState state) // LLVoiceChannelProximal // LLVoiceChannelProximal::LLVoiceChannelProximal() : - LLVoiceChannel(LLUUID::null, LLString::null) + LLVoiceChannel(LLUUID::null, LLStringUtil::null) { activate(); } @@ -914,7 +914,7 @@ void LLVoiceChannelProximal::deactivate() // // LLVoiceChannelP2P // -LLVoiceChannelP2P::LLVoiceChannelP2P(const LLUUID& session_id, const LLString& session_name, const LLUUID& other_user_id) : +LLVoiceChannelP2P::LLVoiceChannelP2P(const LLUUID& session_id, const std::string& session_name, const LLUUID& other_user_id) : LLVoiceChannelGroup(session_id, session_name), mOtherUserID(other_user_id), mReceivedCall(FALSE) @@ -1000,7 +1000,7 @@ void LLVoiceChannelP2P::getChannelInfo() } // receiving session from other user who initiated call -void LLVoiceChannelP2P::setSessionHandle(const LLString& handle) +void LLVoiceChannelP2P::setSessionHandle(const std::string& handle) { BOOL needs_activate = FALSE; if (callStarted()) @@ -1109,11 +1109,11 @@ LLFloaterIMPanel::LLFloaterIMPanel( } -void LLFloaterIMPanel::init(const LLString& session_label) +void LLFloaterIMPanel::init(const std::string& session_label) { mSessionLabel = session_label; - LLString xml_filename; + std::string xml_filename; switch(mDialog) { case IM_SESSION_GROUP_START: @@ -1454,7 +1454,7 @@ BOOL LLFloaterIMPanel::inviteToSession(const LLDynamicArray<LLUUID>& ids) return TRUE; } -void LLFloaterIMPanel::addHistoryLine(const std::string &utf8msg, const LLColor4& color, bool log_to_file, const LLUUID& source, const char *name) +void LLFloaterIMPanel::addHistoryLine(const std::string &utf8msg, const LLColor4& color, bool log_to_file, const LLUUID& source, const std::string& name) { // start tab flashing when receiving im for background session from user if (source != LLUUID::null) @@ -1474,7 +1474,7 @@ void LLFloaterIMPanel::addHistoryLine(const std::string &utf8msg, const LLColor4 removeTypingIndicator(NULL); // Actually add the line - LLString timestring; + std::string timestring; bool prepend_newline = true; if (gSavedSettings.getBOOL("IMShowTimestamps")) { @@ -1483,10 +1483,10 @@ void LLFloaterIMPanel::addHistoryLine(const std::string &utf8msg, const LLColor4 } // 'name' is a sender name that we want to hotlink so that clicking on it opens a profile. - if (name != NULL) // If name exists, then add it to the front of the message. + if (!name.empty()) // If name exists, then add it to the front of the message. { // Don't hotlink any messages from the system (e.g. "Second Life:"), so just add those in plain text. - if (!strcmp(name,SYSTEM_FROM)) + if (name == SYSTEM_FROM) { mHistoryEditor->appendColoredText(name,false,prepend_newline,color); } @@ -1503,11 +1503,11 @@ void LLFloaterIMPanel::addHistoryLine(const std::string &utf8msg, const LLColor4 if (log_to_file && gSavedPerAccountSettings.getBOOL("LogInstantMessages") ) { - LLString histstr; + std::string histstr; if (gSavedPerAccountSettings.getBOOL("IMLogTimestamp")) - histstr = LLLogChat::timestamp(gSavedPerAccountSettings.getBOOL("LogTimestampDate")) + LLString(name) + utf8msg; + histstr = LLLogChat::timestamp(gSavedPerAccountSettings.getBOOL("LogTimestampDate")) + name + utf8msg; else - histstr = LLString(name) + utf8msg; + histstr = name + utf8msg; LLLogChat::saveHistory(getTitle(),histstr); } @@ -1597,7 +1597,7 @@ BOOL LLFloaterIMPanel::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, - LLString& tooltip_msg) + std::string& tooltip_msg) { BOOL accepted = FALSE; switch(cargo_type) @@ -1812,7 +1812,7 @@ void LLFloaterIMPanel::onInputEditorFocusLost(LLFocusableElement* caller, void* void LLFloaterIMPanel::onInputEditorKeystroke(LLLineEditor* caller, void* userdata) { LLFloaterIMPanel* self = (LLFloaterIMPanel*)userdata; - LLString text = self->mInputEditor->getText(); + std::string text = self->mInputEditor->getText(); if (!text.empty()) { self->setTyping(TRUE); @@ -1838,8 +1838,8 @@ void LLFloaterIMPanel::onClose(bool app_quitting) FALSE, gAgent.getSessionID(), mOtherParticipantUUID, - name.c_str(), - "", + name, + LLStringUtil::null, IM_ONLINE, IM_SESSION_LEAVE, mSessionUUID); @@ -1885,8 +1885,8 @@ void deliver_message(const std::string& utf8_text, FALSE, gAgent.getSessionID(), other_participant_id, - name.c_str(), - utf8_text.c_str(), + name, + utf8_text, offline, (EInstantMessage)new_dialog, im_session_id); @@ -1901,7 +1901,7 @@ void deliver_message(const std::string& utf8_text, void LLFloaterIMPanel::sendMsg() { LLWString text = mInputEditor->getWText(); - LLWString::trim(text); + LLWStringUtil::trim(text); if (!gAgent.isGodlike() && (mDialog == IM_NOTHING_SPECIAL) && mOtherParticipantUUID.isNull()) @@ -1930,13 +1930,8 @@ void LLFloaterIMPanel::sendMsg() gAgent.buildFullname(history_echo); // Look for IRC-style emotes here. - char tmpstr[5]; /* Flawfinder: ignore */ - strncpy(tmpstr, - utf8_text.substr(0,4).c_str(), - sizeof(tmpstr) -1); /* Flawfinder: ignore */ - tmpstr[sizeof(tmpstr) -1] = '\0'; - if (!strncmp(tmpstr, "/me ", 4) || - !strncmp(tmpstr, "/me'", 4)) + std::string prefix = utf8_text.substr(0, 4); + if (prefix == "/me " || prefix == "/me'") { utf8_text.replace(0,3,""); } @@ -1966,7 +1961,7 @@ void LLFloaterIMPanel::sendMsg() LLViewerStats::getInstance()->incStat(LLViewerStats::ST_IM_COUNT); } - mInputEditor->setText(LLString::null); + mInputEditor->setText(LLStringUtil::null); // Don't need to actually send the typing stop message, the other // client will infer it from receiving the message. @@ -1989,7 +1984,7 @@ void LLFloaterIMPanel::processSessionUpdate(const LLSD& session_update) if (voice_moderated) { - setTitle(mSessionLabel + LLString(" ") + getString("moderated_chat_label")); + setTitle(mSessionLabel + std::string(" ") + getString("moderated_chat_label")); } else { @@ -2086,8 +2081,8 @@ void LLFloaterIMPanel::sendTypingState(BOOL typing) FALSE, gAgent.getSessionID(), mOtherParticipantUUID, - name.c_str(), - "typing", + name, + std::string("typing"), IM_ONLINE, (typing ? IM_TYPING_START : IM_TYPING_STOP), mSessionUUID); @@ -2144,7 +2139,7 @@ void LLFloaterIMPanel::removeTypingIndicator(const LLIMInfo* im_info) } //static -void LLFloaterIMPanel::chatFromLogFile(LLLogChat::ELogLineType type, LLString line, void* userdata) +void LLFloaterIMPanel::chatFromLogFile(LLLogChat::ELogLineType type, std::string line, void* userdata) { LLFloaterIMPanel* self = (LLFloaterIMPanel*)userdata; LLUIString message = line; @@ -2184,7 +2179,7 @@ void LLFloaterIMPanel::showSessionStartError( //their own XML file which would be read in by any LLIMPanel //post build function instead of repeating the same info //in the group, adhoc and normal IM xml files. - LLString::format_map_t args; + LLStringUtil::format_map_t args; args["[REASON]"] = LLFloaterIM::sErrorStringsMap[error_string]; args["[RECIPIENT]"] = getTitle(); @@ -2200,7 +2195,7 @@ void LLFloaterIMPanel::showSessionEventError( const std::string& event_string, const std::string& error_string) { - LLString::format_map_t args; + LLStringUtil::format_map_t args; args["[REASON]"] = LLFloaterIM::sErrorStringsMap[error_string]; args["[EVENT]"] = @@ -2215,7 +2210,7 @@ void LLFloaterIMPanel::showSessionEventError( void LLFloaterIMPanel::showSessionForceClose( const std::string& reason_string) { - LLString::format_map_t args; + LLStringUtil::format_map_t args; args["[NAME]"] = getTitle(); args["[REASON]"] = LLFloaterIM::sForceCloseSessionMap[reason_string]; diff --git a/indra/newview/llimpanel.h b/indra/newview/llimpanel.h index a3ece98727..b20dcd02bd 100644 --- a/indra/newview/llimpanel.h +++ b/indra/newview/llimpanel.h @@ -61,7 +61,7 @@ public: STATE_CONNECTED } EState; - LLVoiceChannel(const LLUUID& session_id, const LLString& session_name); + LLVoiceChannel(const LLUUID& session_id, const std::string& session_name); virtual ~LLVoiceChannel(); /*virtual*/ void onChange(EStatusType status, const std::string &channelURI, bool proximal); @@ -71,8 +71,8 @@ public: virtual void deactivate(); virtual void activate(); virtual void setChannelInfo( - const LLString& uri, - const LLString& credentials); + const std::string& uri, + const std::string& credentials); virtual void getChannelInfo(); virtual BOOL isActive(); virtual BOOL callStarted(); @@ -81,10 +81,10 @@ public: EState getState() { return mState; } void updateSessionID(const LLUUID& new_session_id); - const LLString::format_map_t& getNotifyArgs() { return mNotifyArgs; } + const LLStringUtil::format_map_t& getNotifyArgs() { return mNotifyArgs; } static LLVoiceChannel* getChannelByID(const LLUUID& session_id); - static LLVoiceChannel* getChannelByURI(LLString uri); + static LLVoiceChannel* getChannelByURI(std::string uri); static LLVoiceChannel* getCurrentVoiceChannel() { return sCurrentVoiceChannel; } static void initClass(); @@ -93,21 +93,21 @@ public: protected: virtual void setState(EState state); - void setURI(LLString uri); + void setURI(std::string uri); - LLString mURI; - LLString mCredentials; + std::string mURI; + std::string mCredentials; LLUUID mSessionID; EState mState; - LLString mSessionName; - LLString::format_map_t mNotifyArgs; + std::string mSessionName; + LLStringUtil::format_map_t mNotifyArgs; BOOL mIgnoreNextSessionLeave; LLHandle<LLPanel> mLoginNotificationHandle; typedef std::map<LLUUID, LLVoiceChannel*> voice_channel_map_t; static voice_channel_map_t sVoiceChannelMap; - typedef std::map<LLString, LLVoiceChannel*> voice_channel_map_uri_t; + typedef std::map<std::string, LLVoiceChannel*> voice_channel_map_uri_t; static voice_channel_map_uri_t sVoiceChannelURIMap; static LLVoiceChannel* sCurrentVoiceChannel; @@ -118,15 +118,15 @@ protected: class LLVoiceChannelGroup : public LLVoiceChannel { public: - LLVoiceChannelGroup(const LLUUID& session_id, const LLString& session_name); + LLVoiceChannelGroup(const LLUUID& session_id, const std::string& session_name); /*virtual*/ void handleStatusChange(EStatusType status); /*virtual*/ void handleError(EStatusType status); /*virtual*/ void activate(); /*virtual*/ void deactivate(); /*vritual*/ void setChannelInfo( - const LLString& uri, - const LLString& credentials); + const std::string& uri, + const std::string& credentials); /*virtual*/ void getChannelInfo(); protected: @@ -154,20 +154,20 @@ public: class LLVoiceChannelP2P : public LLVoiceChannelGroup { public: - LLVoiceChannelP2P(const LLUUID& session_id, const LLString& session_name, const LLUUID& other_user_id); + LLVoiceChannelP2P(const LLUUID& session_id, const std::string& session_name, const LLUUID& other_user_id); /*virtual*/ void handleStatusChange(EStatusType status); /*virtual*/ void handleError(EStatusType status); /*virtual*/ void activate(); /*virtual*/ void getChannelInfo(); - void setSessionHandle(const LLString& handle); + void setSessionHandle(const std::string& handle); protected: virtual void setState(EState state); private: - LLString mSessionHandle; + std::string mSessionHandle; LLUUID mOtherUserID; BOOL mReceivedCall; }; @@ -207,7 +207,7 @@ public: const LLColor4& color = LLColor4::white, bool log_to_file = true, const LLUUID& source = LLUUID::null, - const char *name = NULL); + const std::string& name = LLStringUtil::null); void setInputFocus( BOOL b ); @@ -221,7 +221,7 @@ public: BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, void *cargo_data, EAcceptance *accept, - LLString& tooltip_msg); + std::string& tooltip_msg); static void onInputEditorFocusReceived( LLFocusableElement* caller, void* userdata ); static void onInputEditorFocusLost(LLFocusableElement* caller, void* userdata); @@ -257,7 +257,7 @@ public: // Handle other participant in the session typing. void processIMTyping(const LLIMInfo* im_info, BOOL typing); - static void chatFromLogFile(LLLogChat::ELogLineType type, LLString line, void* userdata); + static void chatFromLogFile(LLLogChat::ELogLineType type, std::string line, void* userdata); //show error statuses to the user void showSessionStartError(const std::string& error_string); @@ -270,7 +270,7 @@ public: private: // called by constructors - void init(const LLString& session_label); + void init(const std::string& session_label); // Called by UI methods. void sendMsg(); @@ -307,7 +307,7 @@ private: // 911 ==> Gaurdian_Angel_Group_ID ^ gAgent.getID() LLUUID mSessionUUID; - LLString mSessionLabel; + std::string mSessionLabel; LLVoiceChannel* mVoiceChannel; BOOL mSessionInitialized; diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index 75aacabeea..6f473dfba9 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -81,14 +81,14 @@ LLIMMgr* gIMMgr = NULL; // Statics // // *FIXME: make these all either UIStrings or Strings -static LLString sOnlyUserMessage; +static std::string sOnlyUserMessage; static LLUIString sOfflineMessage; -static LLString sMutedMessage; +static std::string sMutedMessage; static LLUIString sInviteMessage; -std::map<std::string,LLString> LLFloaterIM::sEventStringsMap; -std::map<std::string,LLString> LLFloaterIM::sErrorStringsMap; -std::map<std::string,LLString> LLFloaterIM::sForceCloseSessionMap; +std::map<std::string,std::string> LLFloaterIM::sEventStringsMap; +std::map<std::string,std::string> LLFloaterIM::sErrorStringsMap; +std::map<std::string,std::string> LLFloaterIM::sForceCloseSessionMap; // // Helper Functions @@ -97,7 +97,7 @@ std::map<std::string,LLString> LLFloaterIM::sForceCloseSessionMap; // returns true if a should appear before b //static BOOL group_dictionary_sort( LLGroupData* a, LLGroupData* b ) //{ -// return (LLString::compareDict( a->mName, b->mName ) < 0); +// return (LLStringUtil::compareDict( a->mName, b->mName ) < 0); //} @@ -269,13 +269,13 @@ class LLIMMgr::LLIMSessionInvite public: LLIMSessionInvite( const LLUUID& session_id, - const LLString& session_name, + const std::string& session_name, const LLUUID& caller_id, - const LLString& caller_name, + const std::string& caller_name, EInstantMessage type, EInvitationType inv_type, - const LLString& session_handle, - const LLString& notify_box) : + const std::string& session_handle, + const std::string& notify_box) : mSessionID(session_id), mSessionName(session_name), mCallerID(caller_id), @@ -287,13 +287,13 @@ public: {}; LLUUID mSessionID; - LLString mSessionName; + std::string mSessionName; LLUUID mCallerID; - LLString mCallerName; + std::string mCallerName; EInstantMessage mType; EInvitationType mInvType; - LLString mSessionHandle; - LLString mNotifyBox; + std::string mSessionHandle; + std::string mNotifyBox; }; @@ -396,9 +396,9 @@ LLIMMgr::~LLIMMgr() void LLIMMgr::addMessage( const LLUUID& session_id, const LLUUID& target_id, - const char* from, - const char* msg, - const char* session_name, + const std::string& from, + const std::string& msg, + const std::string& session_name, EInstantMessage dialog, U32 parent_estate_id, const LLUUID& region_id, @@ -443,8 +443,8 @@ void LLIMMgr::addMessage( // create IM window as necessary if(!floater) { - const char* name = from; - if(session_name && (strlen(session_name)>1)) + std::string name = from; + if(!session_name.empty() && session_name.size()>1) { name = session_name; } @@ -482,7 +482,7 @@ void LLIMMgr::addMessage( } // now add message to floater - bool is_from_system = target_id.isNull() || !strcmp(from, SYSTEM_FROM); + bool is_from_system = target_id.isNull() || (from == SYSTEM_FROM); const LLColor4& color = ( is_from_system ? gSavedSettings.getColor4("SystemChatColor") : gSavedSettings.getColor("IMChatColor")); @@ -518,7 +518,7 @@ void LLIMMgr::addMessage( } } -void LLIMMgr::addSystemMessage(const LLUUID& session_id, const LLString& message_name, const LLString::format_map_t& args) +void LLIMMgr::addSystemMessage(const LLUUID& session_id, const std::string& message_name, const LLStringUtil::format_map_t& args) { LLUIString message; @@ -542,7 +542,7 @@ void LLIMMgr::addSystemMessage(const LLUUID& session_id, const LLString& message message = floaterp->getUIString(message_name); message.setArgList(args); - gIMMgr->addMessage(session_id, LLUUID::null, SYSTEM_FROM, message.getString().c_str()); + gIMMgr->addMessage(session_id, LLUUID::null, SYSTEM_FROM, message.getString()); } } } @@ -576,7 +576,7 @@ BOOL LLIMMgr::isIMSessionOpen(const LLUUID& uuid) LLUUID LLIMMgr::addP2PSession(const std::string& name, const LLUUID& other_participant_id, - const LLString& voice_session_handle) + const std::string& voice_session_handle) { LLUUID session_id = addSession(name, IM_NOTHING_SPECIAL, other_participant_id); @@ -692,12 +692,12 @@ void LLIMMgr::removeSession(const LLUUID& session_id) void LLIMMgr::inviteToSession( const LLUUID& session_id, - const LLString& session_name, + const std::string& session_name, const LLUUID& caller_id, - const LLString& caller_name, + const std::string& caller_name, EInstantMessage type, EInvitationType inv_type, - const LLString& session_handle) + const std::string& session_handle) { //ignore invites from muted residents if (LLMuteList::getInstance()->isMuted(caller_id)) @@ -705,7 +705,7 @@ void LLIMMgr::inviteToSession( return; } - LLString notify_box_type; + std::string notify_box_type; BOOL ad_hoc_invite = FALSE; if(type == IM_SESSION_P2P_INVITE) @@ -769,11 +769,11 @@ void LLIMMgr::inviteToSession( { if (caller_name.empty()) { - gCacheName->getName(caller_id, onInviteNameLookup, invite); + gCacheName->get(caller_id, FALSE, onInviteNameLookup, invite); } else { - LLString::format_map_t args; + LLStringUtil::format_map_t args; args["[NAME]"] = caller_name; args["[GROUP]"] = session_name; @@ -792,14 +792,14 @@ void LLIMMgr::inviteToSession( } //static -void LLIMMgr::onInviteNameLookup(const LLUUID& id, const char* first, const char* last, BOOL is_group, void* userdata) +void LLIMMgr::onInviteNameLookup(const LLUUID& id, const std::string& first, const std::string& last, BOOL is_group, void* userdata) { LLIMSessionInvite* invite = (LLIMSessionInvite*)userdata; - invite->mCallerName = llformat("%s %s", first, last); + invite->mCallerName = first + " " + last; invite->mSessionName = invite->mCallerName; - LLString::format_map_t args; + LLStringUtil::format_map_t args; args["[NAME]"] = invite->mCallerName; LLNotifyBox::showXml( @@ -1248,8 +1248,7 @@ void LLIMMgr::noteMutedUsers(LLFloaterIMPanel* floater, for(S32 i = 0; i < count; ++i) { info = at.getBuddyInfo(ids.get(i)); - char first[DB_FIRST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/ - char last[DB_LAST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/ + std::string first, last; if(info && LLMuteList::getInstance() && LLMuteList::getInstance()->isMuted(ids.get(i)) && gCacheName->getName(ids.get(i), first, last)) { @@ -1413,7 +1412,7 @@ public: const LLSD& input) const { LLUUID session_id; - LLString reason; + std::string reason; session_id = input["body"]["session_id"].asUUID(); reason = input["body"]["reason"].asString(); @@ -1495,7 +1494,6 @@ public: { return; } - char buffer[DB_IM_MSG_BUF_SIZE * 2]; /* Flawfinder: ignore */ LLChat chat; std::string message = message_params["message"].asString(); @@ -1511,19 +1509,18 @@ public: BOOL is_busy = gAgent.getBusy(); BOOL is_muted = LLMuteList::getInstance()->isMuted( from_id, - name.c_str(), + name, LLMute::flagTextChat); - BOOL is_linden = LLMuteList::getInstance()->isLinden( - name.c_str()); - char separator_string[3]=": "; /* Flawfinder: ignore */ + BOOL is_linden = LLMuteList::getInstance()->isLinden(name); + std::string separator_string(": "); int message_offset=0; //Handle IRC styled /me messages. - if (!strncmp(message.c_str(), "/me ", 4) || - !strncmp(message.c_str(), "/me'", 4)) + std::string prefix = message.substr(0, 4); + if (prefix == "/me " || prefix == "/me'") { - strcpy(separator_string,""); /* Flawfinder: ignore */ + separator_string = ""; message_offset = 3; } @@ -1537,23 +1534,12 @@ public: } // standard message, not from system - char saved[MAX_STRING]; /* Flawfinder: ignore */ - saved[0] = '\0'; + std::string saved; if(offline == IM_OFFLINE) { - char time_buf[TIME_STR_LENGTH]; /* Flawfinder: ignore */ - snprintf(saved, /* Flawfinder: ignore */ - MAX_STRING, - "(Saved %s) ", - formatted_time(timestamp, time_buf)); + saved = llformat("(Saved %s) ", formatted_time(timestamp).c_str()); } - snprintf( - buffer, - sizeof(buffer), - "%s%s%s", - separator_string, - saved, - (message.c_str() + message_offset)); /*Flawfinder: ignore*/ + std::string buffer = separator_string + saved + message.substr(message_offset); BOOL is_this_agent = FALSE; if(from_id == gAgentID) @@ -1563,24 +1549,16 @@ public: gIMMgr->addMessage( session_id, from_id, - name.c_str(), + name, buffer, - (char*)&bin_bucket[0], + std::string((char*)&bin_bucket[0]), IM_SESSION_INVITE, message_params["parent_estate_id"].asInteger(), message_params["region_id"].asUUID(), ll_vector3_from_sd(message_params["position"]), true); - snprintf( - buffer, - sizeof(buffer), - "IM: %s%s%s%s", - name.c_str(), - separator_string, - saved, - (message.c_str()+message_offset)); /* Flawfinder: ignore */ - chat.mText = buffer; + chat.mText = std::string("IM: ") + name + separator_string + saved + message.substr(message_offset); LLFloaterChat::addChat(chat, TRUE, is_this_agent); //K now we want to accept the invitation diff --git a/indra/newview/llimview.h b/indra/newview/llimview.h index 91768132ed..da64cd3bab 100644 --- a/indra/newview/llimview.h +++ b/indra/newview/llimview.h @@ -59,16 +59,16 @@ public: // or agent id. void addMessage(const LLUUID& session_id, const LLUUID& target_id, - const char* from, - const char* msg, - const char* session_name = NULL, + const std::string& from, + const std::string& msg, + const std::string& session_name = LLStringUtil::null, EInstantMessage dialog = IM_NOTHING_SPECIAL, U32 parent_estate_id = 0, const LLUUID& region_id = LLUUID::null, const LLVector3& position = LLVector3::zero, bool link_name = false); - void addSystemMessage(const LLUUID& session_id, const LLString& message_name, const LLString::format_map_t& args); + void addSystemMessage(const LLUUID& session_id, const std::string& message_name, const LLStringUtil::format_map_t& args); // This method returns TRUE if the local viewer has a session // currently open keyed to the uuid. The uuid can be keyed by @@ -97,7 +97,7 @@ public: // Creates a P2P session with the requisite handle for responding to voice calls LLUUID addP2PSession(const std::string& name, const LLUUID& other_participant_id, - const LLString& voice_session_handle); + const std::string& voice_session_handle); // This removes the panel referenced by the uuid, and then // restores internal consistency. The internal pointer is not @@ -106,12 +106,12 @@ public: void inviteToSession( const LLUUID& session_id, - const LLString& session_name, + const std::string& session_name, const LLUUID& caller, - const LLString& caller_name, + const std::string& caller_name, EInstantMessage type, EInvitationType inv_type, - const LLString& session_handle = LLString::null); + const std::string& session_handle = LLStringUtil::null); //Updates a given session's session IDs. Does not open, //create or do anything new. If the old session doesn't @@ -198,7 +198,7 @@ private: void processIMTypingCore(const LLIMInfo* im_info, BOOL typing); static void inviteUserResponse(S32 option, void* user_data); - static void onInviteNameLookup(const LLUUID& id, const char* first, const char* last, BOOL is_group, void* userdata); + static void onInviteNameLookup(const LLUUID& id, const std::string& first, const std::string& last, BOOL is_group, void* userdata); private: std::set<LLHandle<LLFloater> > mFloaters; @@ -218,9 +218,9 @@ public: LLFloaterIM(); /*virtual*/ BOOL postBuild(); - static std::map<std::string,LLString> sEventStringsMap; - static std::map<std::string,LLString> sErrorStringsMap; - static std::map<std::string,LLString> sForceCloseSessionMap; + static std::map<std::string,std::string> sEventStringsMap; + static std::map<std::string,std::string> sErrorStringsMap; + static std::map<std::string,std::string> sForceCloseSessionMap; }; // Globals diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index e948b64459..8aa51ad048 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -111,7 +111,7 @@ void remove_inventory_category_from_avatar_step2( BOOL proceed, void* userdata); void move_task_inventory_callback(S32 option, void* user_data); void confirm_replace_attachment_rez(S32 option, void* user_data); -const char* ICON_NAME[ICON_NAME_COUNT] = +std::string ICON_NAME[ICON_NAME_COUNT] = { "inv_item_texture.tga", "inv_item_sound.tga", @@ -157,17 +157,17 @@ BOOL gAddToOutfit = FALSE; // | LLInvFVBridge | // +=================================================+ -const LLString& LLInvFVBridge::getName() const +const std::string& LLInvFVBridge::getName() const { LLInventoryObject* obj = getInventoryObject(); if(obj) { return obj->getName(); } - return LLString::null; + return LLStringUtil::null; } -const LLString& LLInvFVBridge::getDisplayName() const +const std::string& LLInvFVBridge::getDisplayName() const { return getName(); } @@ -377,15 +377,15 @@ BOOL LLInvFVBridge::isClipboardPasteable() const } void hideContextEntries(LLMenuGL& menu, - const std::vector<LLString> &entries_to_show, - const std::vector<LLString> &disabled_entries) + const std::vector<std::string> &entries_to_show, + const std::vector<std::string> &disabled_entries) { const LLView::child_list_t *list = menu.getChildList(); LLView::child_list_t::const_iterator itor; for (itor = list->begin(); itor != list->end(); ++itor) { - LLString name = (*itor)->getName(); + std::string name = (*itor)->getName(); // descend into split menus: LLMenuItemBranchGL* branchp = dynamic_cast<LLMenuItemBranchGL*>(*itor); @@ -396,7 +396,7 @@ void hideContextEntries(LLMenuGL& menu, bool found = false; - std::vector<LLString>::const_iterator itor2; + std::vector<std::string>::const_iterator itor2; for (itor2 = entries_to_show.begin(); itor2 != entries_to_show.end(); ++itor2) { if (*itor2 == name) @@ -422,66 +422,68 @@ void hideContextEntries(LLMenuGL& menu, } // Helper for commonly-used entries -void LLInvFVBridge::getClipboardEntries(bool show_asset_id, std::vector<LLString> &items, - std::vector<LLString> &disabled_items, U32 flags) +void LLInvFVBridge::getClipboardEntries(bool show_asset_id, std::vector<std::string> &items, + std::vector<std::string> &disabled_items, U32 flags) { - items.push_back("Rename"); + // *TODO: Translate + items.push_back(std::string("Rename")); if (!isItemRenameable() || (flags & FIRST_SELECTED_ITEM) == 0) { - disabled_items.push_back("Rename"); + disabled_items.push_back(std::string("Rename")); } if (show_asset_id) { - items.push_back("Copy Asset UUID"); + items.push_back(std::string("Copy Asset UUID")); if ( (! ( isItemPermissive() || gAgent.isGodlike() ) ) || (flags & FIRST_SELECTED_ITEM) == 0) { - disabled_items.push_back("Copy Asset UUID"); + disabled_items.push_back(std::string("Copy Asset UUID")); } } - items.push_back("Copy Separator"); + items.push_back(std::string("Copy Separator")); - items.push_back("Copy"); + items.push_back(std::string("Copy")); if (!isItemCopyable()) { - disabled_items.push_back("Copy"); + disabled_items.push_back(std::string("Copy")); } - items.push_back("Paste"); + items.push_back(std::string("Paste")); if (!isClipboardPasteable() || (flags & FIRST_SELECTED_ITEM) == 0) { - disabled_items.push_back("Paste"); + disabled_items.push_back(std::string("Paste")); } - items.push_back("Paste Separator"); + items.push_back(std::string("Paste Separator")); - items.push_back("Delete"); + items.push_back(std::string("Delete")); if (!isItemRemovable()) { - disabled_items.push_back("Delete"); + disabled_items.push_back(std::string("Delete")); } } void LLInvFVBridge::buildContextMenu(LLMenuGL& menu, U32 flags) { + // *TODO: Translate lldebugs << "LLInvFVBridge::buildContextMenu()" << llendl; - std::vector<LLString> items; - std::vector<LLString> disabled_items; + std::vector<std::string> items; + std::vector<std::string> disabled_items; if(isInTrash()) { - items.push_back("Purge Item"); + items.push_back(std::string("Purge Item")); if (!isItemRemovable()) { - disabled_items.push_back("Purge Item"); + disabled_items.push_back(std::string("Purge Item")); } - items.push_back("Restore Item"); + items.push_back(std::string("Restore Item")); } else { - items.push_back("Open"); - items.push_back("Properties"); + items.push_back(std::string("Open")); + items.push_back(std::string("Properties")); getClipboardEntries(true, items, disabled_items, flags); } @@ -728,7 +730,7 @@ LLInvFVBridge* LLInvFVBridge::createBridge(LLAssetType::EType asset_type, // | LLItemBridge | // +=================================================+ -void LLItemBridge::performAction(LLFolderView* folder, LLInventoryModel* model, LLString action) +void LLItemBridge::performAction(LLFolderView* folder, LLInventoryModel* model, std::string action) { if ("open" == action) { @@ -762,7 +764,7 @@ void LLItemBridge::performAction(LLFolderView* folder, LLInventoryModel* model, LLInventoryItem* item = model->getItem(mUUID); if(!item) return; LLUUID asset_id = item->getAssetUUID(); - char buffer[UUID_STR_LENGTH]; /*Flawfinder: ignore*/ + std::string buffer; asset_id.toString(buffer); gViewerWindow->mWindow->copyTextToClipboard(utf8str_to_wstring(buffer)); @@ -832,7 +834,7 @@ PermissionMask LLItemBridge::getPermissionMask() const return perm_mask; } -const LLString& LLItemBridge::getDisplayName() const +const std::string& LLItemBridge::getDisplayName() const { if(mDisplayName.empty()) { @@ -841,7 +843,7 @@ const LLString& LLItemBridge::getDisplayName() const return mDisplayName; } -void LLItemBridge::buildDisplayName(LLInventoryItem* item, LLString& name) +void LLItemBridge::buildDisplayName(LLInventoryItem* item, std::string& name) { if(item) { @@ -849,13 +851,13 @@ void LLItemBridge::buildDisplayName(LLInventoryItem* item, LLString& name) } else { - name.assign(LLString::null); + name.assign(LLStringUtil::null); } } -LLString LLItemBridge::getLabelSuffix() const +std::string LLItemBridge::getLabelSuffix() const { - LLString suffix; + std::string suffix; LLInventoryItem* item = getItem(); if(item) { @@ -867,6 +869,7 @@ LLString LLItemBridge::getLabelSuffix() const BOOL mod = item->getPermissions().allowModifyBy(gAgent.getID()); BOOL xfer = item->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID()); + // *TODO: Translate const char* EMPTY = ""; const char* NO_COPY = " (no copy)"; const char* NO_MOD = " (no modify)"; @@ -880,15 +883,7 @@ LLString LLItemBridge::getLabelSuffix() const const char* sxfer; if(xfer) sxfer = EMPTY; else sxfer = NO_XFER; - char buffer[MAX_STRING]; /*Flawfinder: ignore*/ - snprintf( /* Flawfinder: ignore */ - buffer, - MAX_STRING, - "%s%s%s", - scopy, - smod, - sxfer); - suffix.assign(buffer); + suffix = llformat("%s%s%s",scopy,smod,sxfer); } } return suffix; @@ -915,7 +910,7 @@ BOOL LLItemBridge::isItemRenameable() const return FALSE; } -BOOL LLItemBridge::renameItem(const LLString& new_name) +BOOL LLItemBridge::renameItem(const std::string& new_name) { if(!isItemRenameable()) return FALSE; LLPreview::rename(mUUID, getPrefix() + new_name); @@ -1543,7 +1538,7 @@ void LLInventoryCopyAndWearObserver::changed(U32 mask) -void LLFolderBridge::performAction(LLFolderView* folder, LLInventoryModel* model, LLString action) +void LLFolderBridge::performAction(LLFolderView* folder, LLInventoryModel* model, std::string action) { if ("open" == action) { @@ -1692,7 +1687,7 @@ LLUIImagePtr LLFolderBridge::getIcon() const return LLUI::getUIImage(control); } -BOOL LLFolderBridge::renameItem(const LLString& new_name) +BOOL LLFolderBridge::renameItem(const std::string& new_name) { if(!isItemRenameable()) return FALSE; LLInventoryModel* model = mInventoryPanel->getModel(); @@ -1796,8 +1791,10 @@ void LLFolderBridge::staticFolderOptionsMenu() void LLFolderBridge::folderOptionsMenu() { - std::vector<LLString> disabled_items; + std::vector<std::string> disabled_items; + // *TODO: Translate + LLInventoryModel* model = mInventoryPanel->getModel(); if(!model) return; @@ -1806,9 +1803,9 @@ void LLFolderBridge::folderOptionsMenu() LLIsType is_callingcard(LLAssetType::AT_CALLINGCARD); if (mCallingCards || checkFolderForContentsOfType(model, is_callingcard)) { - mItems.push_back("Calling Card Separator"); - mItems.push_back("Conference Chat Folder"); - mItems.push_back("IM All Contacts In Folder"); + mItems.push_back(std::string("Calling Card Separator")); + mItems.push_back(std::string("Conference Chat Folder")); + mItems.push_back(std::string("IM All Contacts In Folder")); } // wearables related functionality for folders. @@ -1822,16 +1819,16 @@ void LLFolderBridge::folderOptionsMenu() checkFolderForContentsOfType(model, is_object) || checkFolderForContentsOfType(model, is_gesture) ) { - mItems.push_back("Folder Wearables Separator"); + mItems.push_back(std::string("Folder Wearables Separator")); // Only enable add/replace outfit for non-default folders. const LLInventoryCategory* category = model->getCategory(mUUID); if (!category || (LLAssetType::AT_NONE == category->getPreferredType())) { - mItems.push_back("Add To Outfit"); - mItems.push_back("Replace Outfit"); + mItems.push_back(std::string("Add To Outfit")); + mItems.push_back(std::string("Replace Outfit")); } - mItems.push_back("Take Off Items"); + mItems.push_back(std::string("Take Off Items")); } hideContextEntries(*mMenu, mItems, disabled_items); } @@ -1851,8 +1848,9 @@ BOOL LLFolderBridge::checkFolderForContentsOfType(LLInventoryModel* model, LLInv // Flags unused void LLFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags) { + // *TODO: Translate lldebugs << "LLFolderBridge::buildContextMenu()" << llendl; -// std::vector<LLString> disabled_items; +// std::vector<std::string> disabled_items; LLInventoryModel* model = mInventoryPanel->getModel(); if(!model) return; LLUUID trash_id = model->findCategoryUUIDForType(LLAssetType::AT_TRASH); @@ -1861,25 +1859,25 @@ void LLFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags) if (lost_and_found_id == mUUID) { // This is the lost+found folder. - mItems.push_back("Empty Lost And Found"); + mItems.push_back(std::string("Empty Lost And Found")); } if(trash_id == mUUID) { // This is the trash. - mItems.push_back("Empty Trash"); + mItems.push_back(std::string("Empty Trash")); } else if(model->isObjectDescendentOf(mUUID, trash_id)) { // This is a folder in the trash. mItems.clear(); // clear any items that used to exist - mItems.push_back("Purge Item"); + mItems.push_back(std::string("Purge Item")); if (!isItemRemovable()) { - mDisabledItems.push_back("Purge Item"); + mDisabledItems.push_back(std::string("Purge Item")); } - mItems.push_back("Restore Item"); + mItems.push_back(std::string("Restore Item")); } else if(isAgentInventory()) // do not allow creating in library { @@ -1908,12 +1906,12 @@ void LLFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags) is_callingcard); if(item_array.count() > 0) contains_calling_cards = TRUE; */ - mItems.push_back("New Folder"); - mItems.push_back("New Script"); - mItems.push_back("New Note"); - mItems.push_back("New Gesture"); - mItems.push_back("New Clothes"); - mItems.push_back("New Body Parts"); + mItems.push_back(std::string("New Folder")); + mItems.push_back(std::string("New Script")); + mItems.push_back(std::string("New Note")); + mItems.push_back(std::string("New Gesture")); + mItems.push_back(std::string("New Clothes")); + mItems.push_back(std::string("New Body Parts")); getClipboardEntries(false, mItems, mDisabledItems, flags); @@ -1960,8 +1958,8 @@ void LLFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags) } else { - mItems.push_back("--no options--"); - mDisabledItems.push_back("--no options--"); + mItems.push_back(std::string("--no options--")); + mDisabledItems.push_back(std::string("--no options--")); } hideContextEntries(menu, mItems, mDisabledItems); } @@ -2036,7 +2034,7 @@ void LLFolderBridge::createNewCategory(void* user_data) LLUUID id; id = model->createNewCategory(bridge->getUUID(), LLAssetType::AT_NONE, - NULL); + LLStringUtil::null); model->notifyObservers(); // At this point, the bridge has probably been deleted, but the @@ -2361,7 +2359,7 @@ LLUIImagePtr LLScriptBridge::getIcon() const // | LLTextureBridge | // +=================================================+ -LLString LLTextureBridge::sPrefix("Texture: "); +std::string LLTextureBridge::sPrefix("Texture: "); LLUIImagePtr LLTextureBridge::getIcon() const @@ -2370,7 +2368,7 @@ LLUIImagePtr LLTextureBridge::getIcon() const } void open_texture(const LLUUID& item_id, - const LLString& title, + const std::string& title, BOOL show_keep_discard, const LLUUID& source_id, BOOL take_focus) @@ -2411,7 +2409,7 @@ void LLTextureBridge::openItem() // | LLSoundBridge | // +=================================================+ -LLString LLSoundBridge::sPrefix("Sound: "); +std::string LLSoundBridge::sPrefix("Sound: "); LLUIImagePtr LLSoundBridge::getIcon() const @@ -2476,29 +2474,30 @@ void LLSoundBridge::openSoundPreview(void* which) void LLSoundBridge::buildContextMenu(LLMenuGL& menu, U32 flags) { lldebugs << "LLTextureBridge::buildContextMenu()" << llendl; - std::vector<LLString> items; - std::vector<LLString> disabled_items; + std::vector<std::string> items; + std::vector<std::string> disabled_items; + // *TODO: Translate if(isInTrash()) { - items.push_back("Purge Item"); + items.push_back(std::string("Purge Item")); if (!isItemRemovable()) { - disabled_items.push_back("Purge Item"); + disabled_items.push_back(std::string("Purge Item")); } - items.push_back("Restore Item"); + items.push_back(std::string("Restore Item")); } else { - items.push_back("Sound Open"); - items.push_back("Properties"); + items.push_back(std::string("Sound Open")); + items.push_back(std::string("Properties")); getClipboardEntries(true, items, disabled_items, flags); } - items.push_back("Sound Separator"); - items.push_back("Sound Play"); + items.push_back(std::string("Sound Separator")); + items.push_back(std::string("Sound Play")); hideContextEntries(menu, items, disabled_items); } @@ -2507,7 +2506,7 @@ void LLSoundBridge::buildContextMenu(LLMenuGL& menu, U32 flags) // | LLLandmarkBridge | // +=================================================+ -LLString LLLandmarkBridge::sPrefix("Landmark: "); +std::string LLLandmarkBridge::sPrefix("Landmark: "); LLUIImagePtr LLLandmarkBridge::getIcon() const { @@ -2516,37 +2515,38 @@ LLUIImagePtr LLLandmarkBridge::getIcon() const void LLLandmarkBridge::buildContextMenu(LLMenuGL& menu, U32 flags) { - std::vector<LLString> items; - std::vector<LLString> disabled_items; + std::vector<std::string> items; + std::vector<std::string> disabled_items; + // *TODO: Translate lldebugs << "LLLandmarkBridge::buildContextMenu()" << llendl; if(isInTrash()) { - items.push_back("Purge Item"); + items.push_back(std::string("Purge Item")); if (!isItemRemovable()) { - disabled_items.push_back("Purge Item"); + disabled_items.push_back(std::string("Purge Item")); } - items.push_back("Restore Item"); + items.push_back(std::string("Restore Item")); } else { - items.push_back("Landmark Open"); - items.push_back("Properties"); + items.push_back(std::string("Landmark Open")); + items.push_back(std::string("Properties")); getClipboardEntries(true, items, disabled_items, flags); } - items.push_back("Landmark Separator"); - items.push_back("Teleport To Landmark"); + items.push_back(std::string("Landmark Separator")); + items.push_back(std::string("Teleport To Landmark")); hideContextEntries(menu, items, disabled_items); } // virtual -void LLLandmarkBridge::performAction(LLFolderView* folder, LLInventoryModel* model, LLString action) +void LLLandmarkBridge::performAction(LLFolderView* folder, LLInventoryModel* model, std::string action) { if ("teleport" == action) { @@ -2568,14 +2568,14 @@ void LLLandmarkBridge::performAction(LLFolderView* folder, LLInventoryModel* mod LLViewerInventoryItem* item = getItem(); if(item) { - open_landmark(item, LLString(" ") + getPrefix() + item->getName(), FALSE); + open_landmark(item, std::string(" ") + getPrefix() + item->getName(), FALSE); } } else LLItemBridge::performAction(folder, model, action); } void open_landmark(LLViewerInventoryItem* inv_item, - const LLString& title, + const std::string& title, BOOL show_keep_discard, const LLUUID& source_id, BOOL take_focus) @@ -2627,7 +2627,7 @@ void LLLandmarkBridge::openItem() { // Opening (double-clicking) a landmark immediately teleports, // but warns you the first time. - // open_landmark(item, LLString(" ") + getPrefix() + item->getName(), FALSE); + // open_landmark(item, std::string(" ") + getPrefix() + item->getName(), FALSE); LLUUID* asset_idp = new LLUUID(item->getAssetUUID()); LLAlertDialog::showXml("TeleportFromLandmark", open_landmark_callback, (void*)asset_idp); @@ -2647,7 +2647,7 @@ void LLCallingCardObserver::changed(U32 mask) // | LLCallingCardBridge | // +=================================================+ -LLString LLCallingCardBridge::sPrefix("Calling Card: "); +std::string LLCallingCardBridge::sPrefix("Calling Card: "); LLCallingCardBridge::LLCallingCardBridge( LLInventoryPanel* inventory, const LLUUID& uuid ) : LLItemBridge(inventory, uuid) @@ -2672,7 +2672,7 @@ void LLCallingCardBridge::refreshFolderViewItem() } // virtual -void LLCallingCardBridge::performAction(LLFolderView* folder, LLInventoryModel* model, LLString action) +void LLCallingCardBridge::performAction(LLFolderView* folder, LLInventoryModel* model, std::string action) { if ("begin_im" == action) { @@ -2707,7 +2707,7 @@ LLUIImagePtr LLCallingCardBridge::getIcon() const return get_item_icon(LLAssetType::AT_CALLINGCARD, LLInventoryType::IT_CALLINGCARD, online, FALSE); } -LLString LLCallingCardBridge::getLabelSuffix() const +std::string LLCallingCardBridge::getLabelSuffix() const { LLViewerInventoryItem* item = getItem(); if( item && LLAvatarTracker::instance().isBuddyOnline(item->getCreatorUUID()) ) @@ -2733,24 +2733,25 @@ void LLCallingCardBridge::openItem() void LLCallingCardBridge::buildContextMenu(LLMenuGL& menu, U32 flags) { + // *TODO: Translate lldebugs << "LLCallingCardBridge::buildContextMenu()" << llendl; - std::vector<LLString> items; - std::vector<LLString> disabled_items; + std::vector<std::string> items; + std::vector<std::string> disabled_items; if(isInTrash()) { - items.push_back("Purge Item"); + items.push_back(std::string("Purge Item")); if (!isItemRemovable()) { - disabled_items.push_back("Purge Item"); + disabled_items.push_back(std::string("Purge Item")); } - items.push_back("Restore Item"); + items.push_back(std::string("Restore Item")); } else { - items.push_back("Open"); - items.push_back("Properties"); + items.push_back(std::string("Open")); + items.push_back(std::string("Properties")); getClipboardEntries(true, items, disabled_items, flags); @@ -2759,19 +2760,19 @@ void LLCallingCardBridge::buildContextMenu(LLMenuGL& menu, U32 flags) && (LLUUID::null != item->getCreatorUUID()) && (item->getCreatorUUID() != gAgent.getID())); BOOL user_online = (LLAvatarTracker::instance().isBuddyOnline(item->getCreatorUUID())); - items.push_back("Send Instant Message Separator"); - items.push_back("Send Instant Message"); - items.push_back("Offer Teleport..."); - items.push_back("Conference Chat"); + items.push_back(std::string("Send Instant Message Separator")); + items.push_back(std::string("Send Instant Message")); + items.push_back(std::string("Offer Teleport...")); + items.push_back(std::string("Conference Chat")); if (!good_card) { - disabled_items.push_back("Send Instant Message"); + disabled_items.push_back(std::string("Send Instant Message")); } if (!good_card || !user_online) { - disabled_items.push_back("Offer Teleport..."); - disabled_items.push_back("Conference Chat"); + disabled_items.push_back(std::string("Offer Teleport...")); + disabled_items.push_back(std::string("Conference Chat")); } } hideContextEntries(menu, items, disabled_items); @@ -2853,7 +2854,7 @@ BOOL LLCallingCardBridge::dragOrDrop(MASK mask, BOOL drop, // | LLNotecardBridge | // +=================================================+ -LLString LLNotecardBridge::sPrefix("Note: "); +std::string LLNotecardBridge::sPrefix("Note: "); LLUIImagePtr LLNotecardBridge::getIcon() const @@ -2862,7 +2863,7 @@ LLUIImagePtr LLNotecardBridge::getIcon() const } void open_notecard(LLViewerInventoryItem* inv_item, - const LLString& title, + const std::string& title, const LLUUID& object_id, BOOL show_keep_discard, const LLUUID& source_id, @@ -2922,7 +2923,7 @@ void LLNotecardBridge::openItem() // | LLGestureBridge | // +=================================================+ -LLString LLGestureBridge::sPrefix("Gesture: "); +std::string LLGestureBridge::sPrefix("Gesture: "); LLUIImagePtr LLGestureBridge::getIcon() const { @@ -2941,7 +2942,7 @@ LLFontGL::StyleFlags LLGestureBridge::getLabelStyle() const } } -LLString LLGestureBridge::getLabelSuffix() const +std::string LLGestureBridge::getLabelSuffix() const { if( gGestureManager.isGestureActive(mUUID) ) { @@ -2954,7 +2955,7 @@ LLString LLGestureBridge::getLabelSuffix() const } // virtual -void LLGestureBridge::performAction(LLFolderView* folder, LLInventoryModel* model, LLString action) +void LLGestureBridge::performAction(LLFolderView* folder, LLInventoryModel* model, std::string action) { if ("activate" == action) { @@ -2992,7 +2993,7 @@ void LLGestureBridge::openItem() if(!LLPreview::show(mUUID)) { LLUUID item_id = mUUID; - LLString title = getPrefix() + item->getName(); + std::string title = getPrefix() + item->getName(); LLUUID object_id = LLUUID::null; // TODO: save the rectangle @@ -3013,29 +3014,30 @@ BOOL LLGestureBridge::removeItem() void LLGestureBridge::buildContextMenu(LLMenuGL& menu, U32 flags) { + // *TODO: Translate lldebugs << "LLGestureBridge::buildContextMenu()" << llendl; - std::vector<LLString> items; - std::vector<LLString> disabled_items; + std::vector<std::string> items; + std::vector<std::string> disabled_items; if(isInTrash()) { - items.push_back("Purge Item"); + items.push_back(std::string("Purge Item")); if (!isItemRemovable()) { - disabled_items.push_back("Purge Item"); + disabled_items.push_back(std::string("Purge Item")); } - items.push_back("Restore Item"); + items.push_back(std::string("Restore Item")); } else { - items.push_back("Open"); - items.push_back("Properties"); + items.push_back(std::string("Open")); + items.push_back(std::string("Properties")); getClipboardEntries(true, items, disabled_items, flags); - items.push_back("Gesture Separator"); - items.push_back("Activate"); - items.push_back("Deactivate"); + items.push_back(std::string("Gesture Separator")); + items.push_back(std::string("Activate")); + items.push_back(std::string("Deactivate")); /*menu.append(new LLMenuItemCallGL("Activate", handleActivateGesture, @@ -3053,7 +3055,7 @@ void LLGestureBridge::buildContextMenu(LLMenuGL& menu, U32 flags) // | LLAnimationBridge | // +=================================================+ -LLString LLAnimationBridge::sPrefix("Animation: "); +std::string LLAnimationBridge::sPrefix("Animation: "); LLUIImagePtr LLAnimationBridge::getIcon() const @@ -3063,38 +3065,39 @@ LLUIImagePtr LLAnimationBridge::getIcon() const void LLAnimationBridge::buildContextMenu(LLMenuGL& menu, U32 flags) { - std::vector<LLString> items; - std::vector<LLString> disabled_items; + // *TODO: Translate + std::vector<std::string> items; + std::vector<std::string> disabled_items; lldebugs << "LLAnimationBridge::buildContextMenu()" << llendl; if(isInTrash()) { - items.push_back("Purge Item"); + items.push_back(std::string("Purge Item")); if (!isItemRemovable()) { - disabled_items.push_back("Purge Item"); + disabled_items.push_back(std::string("Purge Item")); } - items.push_back("Restore Item"); + items.push_back(std::string("Restore Item")); } else { - items.push_back("Animation Open"); - items.push_back("Properties"); + items.push_back(std::string("Animation Open")); + items.push_back(std::string("Properties")); getClipboardEntries(true, items, disabled_items, flags); } - items.push_back("Animation Separator"); - items.push_back("Animation Play"); - items.push_back("Animation Audition"); + items.push_back(std::string("Animation Separator")); + items.push_back(std::string("Animation Play")); + items.push_back(std::string("Animation Audition")); hideContextEntries(menu, items, disabled_items); } // virtual -void LLAnimationBridge::performAction(LLFolderView* folder, LLInventoryModel* model, LLString action) +void LLAnimationBridge::performAction(LLFolderView* folder, LLInventoryModel* model, std::string action) { S32 activate = 0; @@ -3161,7 +3164,7 @@ void LLAnimationBridge::openItem() // +=================================================+ // static -LLString LLObjectBridge::sPrefix("Object: "); +std::string LLObjectBridge::sPrefix("Object: "); // static LLUUID LLObjectBridge::sContextMenuItemID; @@ -3182,7 +3185,7 @@ LLUIImagePtr LLObjectBridge::getIcon() const void rez_attachment(LLViewerInventoryItem* item, LLViewerJointAttachment* attachment); // virtual -void LLObjectBridge::performAction(LLFolderView* folder, LLInventoryModel* model, LLString action) +void LLObjectBridge::performAction(LLFolderView* folder, LLInventoryModel* model, std::string action) { if ("attach" == action) { @@ -3255,14 +3258,14 @@ LLFontGL::StyleFlags LLObjectBridge::getLabelStyle() const } } -LLString LLObjectBridge::getLabelSuffix() const +std::string LLObjectBridge::getLabelSuffix() const { LLVOAvatar* avatar = gAgent.getAvatarObject(); if( avatar && avatar->isWearingAttachment( mUUID ) ) { - LLString attachment_point_name = avatar->getAttachedPointName(mUUID); - LLString::toLower(attachment_point_name); - return LLItemBridge::getLabelSuffix() + LLString(" (worn on ") + attachment_point_name + LLString(")"); + std::string attachment_point_name = avatar->getAttachedPointName(mUUID); + LLStringUtil::toLower(attachment_point_name); + return LLItemBridge::getLabelSuffix() + std::string(" (worn on ") + attachment_point_name + std::string(")"); } else { @@ -3330,21 +3333,22 @@ void confirm_replace_attachment_rez(S32 option, void* user_data) void LLObjectBridge::buildContextMenu(LLMenuGL& menu, U32 flags) { - std::vector<LLString> items; - std::vector<LLString> disabled_items; + // *TODO: Translate + std::vector<std::string> items; + std::vector<std::string> disabled_items; if(isInTrash()) { - items.push_back("Purge Item"); + items.push_back(std::string("Purge Item")); if (!isItemRemovable()) { - disabled_items.push_back("Purge Item"); + disabled_items.push_back(std::string("Purge Item")); } - items.push_back("Restore Item"); + items.push_back(std::string("Restore Item")); } else { - items.push_back("Properties"); + items.push_back(std::string("Properties")); getClipboardEntries(true, items, disabled_items, flags); @@ -3361,15 +3365,15 @@ void LLObjectBridge::buildContextMenu(LLMenuGL& menu, U32 flags) if( avatarp->isWearingAttachment( mUUID ) ) { - items.push_back("Detach From Yourself"); + items.push_back(std::string("Detach From Yourself")); } else if( !isInTrash() ) { - items.push_back("Attach Separator"); - items.push_back("Object Wear"); - items.push_back("Attach To"); - items.push_back("Attach To HUD"); + items.push_back(std::string("Attach Separator")); + items.push_back(std::string("Object Wear")); + items.push_back(std::string("Attach To")); + items.push_back(std::string("Attach To HUD")); LLMenuGL* attach_menu = menu.getChildMenuByName("Attach To", TRUE); LLMenuGL* attach_hud_menu = menu.getChildMenuByName("Attach To HUD", TRUE); @@ -3411,7 +3415,7 @@ void LLObjectBridge::buildContextMenu(LLMenuGL& menu, U32 flags) hideContextEntries(menu, items, disabled_items); } -BOOL LLObjectBridge::renameItem(const LLString& new_name) +BOOL LLObjectBridge::renameItem(const std::string& new_name) { if(!isItemRenameable()) return FALSE; LLPreview::rename(mUUID, getPrefix() + new_name); @@ -3449,7 +3453,7 @@ BOOL LLObjectBridge::renameItem(const LLString& new_name) // | LLLSLTextBridge | // +=================================================+ -LLString LLLSLTextBridge::sPrefix("Script: "); +std::string LLLSLTextBridge::sPrefix("Script: "); LLUIImagePtr LLLSLTextBridge::getIcon() const { @@ -3505,7 +3509,7 @@ struct LLFoundData { LLFoundData(const LLUUID& item_id, const LLUUID& asset_id, - const LLString& name, + const std::string& name, LLAssetType::EType asset_type) : mItemID(item_id), mAssetID(asset_id), @@ -3515,7 +3519,7 @@ struct LLFoundData LLUUID mItemID; LLUUID mAssetID; - LLString mName; + std::string mName; LLAssetType::EType mAssetType; LLWearable* mWearable; }; @@ -3598,7 +3602,7 @@ void LLOutfitObserver::done() if(mCopyItems) { LLInventoryCategory* cat = gInventory.getCategory(mCatID); - LLString name; + std::string name; if(!cat) { // should never happen. @@ -3729,7 +3733,7 @@ void LLOutfitFetch::done() } } -void wear_outfit_by_name(const char* name) +void wear_outfit_by_name(const std::string& name) { llinfos << "Wearing category " << name << llendl; inc_busy_count(); @@ -4204,7 +4208,7 @@ void remove_inventory_category_from_avatar_step2( BOOL proceed, void* userdata) category_id = NULL; } -BOOL LLWearableBridge::renameItem(const LLString& new_name) +BOOL LLWearableBridge::renameItem(const std::string& new_name) { if( gAgent.isWearingItem( mUUID ) ) { @@ -4232,7 +4236,7 @@ LLFontGL::StyleFlags LLWearableBridge::getLabelStyle() const } } -LLString LLWearableBridge::getLabelSuffix() const +std::string LLWearableBridge::getLabelSuffix() const { if( gAgent.isWearingItem( mUUID ) ) { @@ -4250,7 +4254,7 @@ LLUIImagePtr LLWearableBridge::getIcon() const } // virtual -void LLWearableBridge::performAction(LLFolderView* folder, LLInventoryModel* model, LLString action) +void LLWearableBridge::performAction(LLFolderView* folder, LLInventoryModel* model, std::string action) { if ("wear" == action) { @@ -4319,18 +4323,19 @@ void LLWearableBridge::openItem() void LLWearableBridge::buildContextMenu(LLMenuGL& menu, U32 flags) { + // *TODO: Translate lldebugs << "LLWearableBridge::buildContextMenu()" << llendl; - std::vector<LLString> items; - std::vector<LLString> disabled_items; + std::vector<std::string> items; + std::vector<std::string> disabled_items; if(isInTrash()) { - items.push_back("Purge Item"); + items.push_back(std::string("Purge Item")); if (!isItemRemovable()) { - disabled_items.push_back("Purge Item"); + disabled_items.push_back(std::string("Purge Item")); } - items.push_back("Restore Item"); + items.push_back(std::string("Restore Item")); } else { // FWIW, it looks like SUPPRESS_OPEN_ITEM is not set anywhere @@ -4345,22 +4350,22 @@ void LLWearableBridge::buildContextMenu(LLMenuGL& menu, U32 flags) } if (!no_open) { - items.push_back("Open"); + items.push_back(std::string("Open")); } - items.push_back("Properties"); + items.push_back(std::string("Properties")); getClipboardEntries(true, items, disabled_items, flags); - items.push_back("Wearable Separator"); + items.push_back(std::string("Wearable Separator")); - items.push_back("Wearable Wear"); - items.push_back("Wearable Edit"); + items.push_back(std::string("Wearable Wear")); + items.push_back(std::string("Wearable Edit")); if ((flags & FIRST_SELECTED_ITEM) == 0) { - disabled_items.push_back("Wearable Edit"); + disabled_items.push_back(std::string("Wearable Edit")); } //menu.appendSeparator(); //menu.append(new LLMenuItemCallGL("Wear", @@ -4374,7 +4379,7 @@ void LLWearableBridge::buildContextMenu(LLMenuGL& menu, U32 flags) if( item && (item->getType() == LLAssetType::AT_CLOTHING) ) { - items.push_back("Take Off"); + items.push_back(std::string("Take Off")); /*menu.append(new LLMenuItemCallGL("Take Off", LLWearableBridge::onRemoveFromAvatar, LLWearableBridge::canRemoveFromAvatar, diff --git a/indra/newview/llinventorybridge.h b/indra/newview/llinventorybridge.h index 2646dab96c..d038c10c73 100644 --- a/indra/newview/llinventorybridge.h +++ b/indra/newview/llinventorybridge.h @@ -70,7 +70,7 @@ enum EInventoryIcon ICON_NAME_COUNT }; -extern const char* ICON_NAME[ICON_NAME_COUNT]; +extern std::string ICON_NAME[ICON_NAME_COUNT]; typedef std::pair<LLUUID, LLUUID> two_uuids_t; typedef std::list<two_uuids_t> two_uuids_list_t; @@ -157,24 +157,24 @@ public: virtual const LLUUID& getUUID() const { return mUUID; } - virtual const LLString& getPrefix() { return LLString::null; } + virtual const std::string& getPrefix() { return LLStringUtil::null; } virtual void restoreItem() {} // LLFolderViewEventListener functions - virtual const LLString& getName() const; - virtual const LLString& getDisplayName() const; + virtual const std::string& getName() const; + virtual const std::string& getDisplayName() const; virtual PermissionMask getPermissionMask() const; virtual time_t getCreationDate() const; virtual LLFontGL::StyleFlags getLabelStyle() const { return LLFontGL::NORMAL; } - virtual LLString getLabelSuffix() const { return LLString::null; } + virtual std::string getLabelSuffix() const { return LLStringUtil::null; } virtual void openItem() {} virtual void previewItem() {openItem();} virtual void showProperties(); virtual BOOL isItemRenameable() const { return TRUE; } - //virtual BOOL renameItem(const LLString& new_name) {} + //virtual BOOL renameItem(const std::string& new_name) {} virtual BOOL isItemRemovable(); virtual BOOL isItemMovable(); //virtual BOOL removeItem() = 0; @@ -185,8 +185,8 @@ public: virtual void cutToClipboard() {} virtual BOOL isClipboardPasteable() const; virtual void pasteFromClipboard() {} - void getClipboardEntries(bool show_asset_id, std::vector<LLString> &items, - std::vector<LLString> &disabled_items, U32 flags); + void getClipboardEntries(bool show_asset_id, std::vector<std::string> &items, + std::vector<std::string> &disabled_items, U32 flags); virtual void buildContextMenu(LLMenuGL& menu, U32 flags); virtual BOOL startDrag(EDragAndDropType* type, LLUUID* id) const; virtual BOOL dragOrDrop(MASK mask, BOOL drop, @@ -230,18 +230,18 @@ public: LLItemBridge(LLInventoryPanel* inventory, const LLUUID& uuid) : LLInvFVBridge(inventory, uuid) {} - virtual void performAction(LLFolderView* folder, LLInventoryModel* model, LLString action); + virtual void performAction(LLFolderView* folder, LLInventoryModel* model, std::string action); virtual void selectItem(); virtual void restoreItem(); virtual LLUIImagePtr getIcon() const; - virtual const LLString& getDisplayName() const; - virtual LLString getLabelSuffix() const; + virtual const std::string& getDisplayName() const; + virtual std::string getLabelSuffix() const; virtual PermissionMask getPermissionMask() const; virtual time_t getCreationDate() const; virtual BOOL isItemRenameable() const; - virtual BOOL renameItem(const LLString& new_name); + virtual BOOL renameItem(const std::string& new_name); virtual BOOL removeItem(); virtual BOOL isItemCopyable() const; virtual BOOL copyToClipboard() const; @@ -255,8 +255,8 @@ public: protected: virtual BOOL isItemPermissive() const; - static void buildDisplayName(LLInventoryItem* item, LLString& name); - mutable LLString mDisplayName; + static void buildDisplayName(LLInventoryItem* item, std::string& name); + mutable std::string mDisplayName; }; @@ -268,7 +268,7 @@ public: BOOL drop); BOOL dragCategoryIntoFolder(LLInventoryCategory* inv_category, BOOL drop); - virtual void performAction(LLFolderView* folder, LLInventoryModel* model, LLString action); + virtual void performAction(LLFolderView* folder, LLInventoryModel* model, std::string action); virtual void openItem(); virtual BOOL isItemRenameable() const; virtual void selectItem(); @@ -276,7 +276,7 @@ public: virtual LLUIImagePtr getIcon() const; - virtual BOOL renameItem(const LLString& new_name); + virtual BOOL renameItem(const std::string& new_name); virtual BOOL removeItem(); virtual BOOL isClipboardPasteable() const; virtual void pasteFromClipboard(); @@ -328,8 +328,8 @@ private: BOOL mCallingCards; BOOL mWearables; LLMenuGL* mMenu; - std::vector<LLString> mItems; - std::vector<LLString> mDisabledItems; + std::vector<std::string> mItems; + std::vector<std::string> mDisabledItems; }; // DEPRECATED @@ -349,7 +349,7 @@ class LLTextureBridge : public LLItemBridge { friend class LLInvFVBridge; public: - virtual const LLString& getPrefix() { return sPrefix; } + virtual const std::string& getPrefix() { return sPrefix; } virtual LLUIImagePtr getIcon() const; virtual void openItem(); @@ -357,7 +357,7 @@ public: protected: LLTextureBridge(LLInventoryPanel* inventory, const LLUUID& uuid, LLInventoryType::EType type) : LLItemBridge(inventory, uuid), mInvType(type) {} - static LLString sPrefix; + static std::string sPrefix; LLInventoryType::EType mInvType; }; @@ -365,7 +365,7 @@ class LLSoundBridge : public LLItemBridge { friend class LLInvFVBridge; public: - virtual const LLString& getPrefix() { return sPrefix; } + virtual const std::string& getPrefix() { return sPrefix; } virtual LLUIImagePtr getIcon() const; virtual void openItem(); @@ -376,16 +376,16 @@ public: protected: LLSoundBridge(LLInventoryPanel* inventory, const LLUUID& uuid) : LLItemBridge(inventory, uuid) {} - static LLString sPrefix; + static std::string sPrefix; }; class LLLandmarkBridge : public LLItemBridge { friend class LLInvFVBridge; public: - static const LLString& prefix() { return sPrefix; } - virtual const LLString& getPrefix() { return sPrefix; } - virtual void performAction(LLFolderView* folder, LLInventoryModel* model, LLString action); + static const std::string& prefix() { return sPrefix; } + virtual const std::string& getPrefix() { return sPrefix; } + virtual void performAction(LLFolderView* folder, LLInventoryModel* model, std::string action); virtual void buildContextMenu(LLMenuGL& menu, U32 flags); virtual LLUIImagePtr getIcon() const; virtual void openItem(); @@ -402,7 +402,7 @@ protected: } protected: - static LLString sPrefix; + static std::string sPrefix; BOOL mVisited; }; @@ -423,15 +423,15 @@ class LLCallingCardBridge : public LLItemBridge { friend class LLInvFVBridge; public: - virtual const LLString& getPrefix() { return sPrefix; } + virtual const std::string& getPrefix() { return sPrefix; } - virtual LLString getLabelSuffix() const; - //virtual const LLString& getDisplayName() const; + virtual std::string getLabelSuffix() const; + //virtual const std::string& getDisplayName() const; virtual LLUIImagePtr getIcon() const; - virtual void performAction(LLFolderView* folder, LLInventoryModel* model, LLString action); + virtual void performAction(LLFolderView* folder, LLInventoryModel* model, std::string action); virtual void openItem(); virtual void buildContextMenu(LLMenuGL& menu, U32 flags); - //virtual void renameItem(const LLString& new_name); + //virtual void renameItem(const std::string& new_name); //virtual BOOL removeItem(); virtual BOOL dragOrDrop(MASK mask, BOOL drop, EDragAndDropType cargo_type, @@ -443,7 +443,7 @@ protected: ~LLCallingCardBridge(); protected: - static LLString sPrefix; + static std::string sPrefix; LLCallingCardObserver* mObserver; }; @@ -452,7 +452,7 @@ class LLNotecardBridge : public LLItemBridge { friend class LLInvFVBridge; public: - virtual const LLString& getPrefix() { return sPrefix; } + virtual const std::string& getPrefix() { return sPrefix; } virtual LLUIImagePtr getIcon() const; virtual void openItem(); @@ -462,23 +462,23 @@ protected: LLItemBridge(inventory, uuid) {} protected: - static LLString sPrefix; + static std::string sPrefix; }; class LLGestureBridge : public LLItemBridge { friend class LLInvFVBridge; public: - virtual const LLString& getPrefix() { return sPrefix; } + virtual const std::string& getPrefix() { return sPrefix; } virtual LLUIImagePtr getIcon() const; // Only suffix for gesture items, not task items, because only // gestures in your inventory can be active. virtual LLFontGL::StyleFlags getLabelStyle() const; - virtual LLString getLabelSuffix() const; + virtual std::string getLabelSuffix() const; - virtual void performAction(LLFolderView* folder, LLInventoryModel* model, LLString action); + virtual void performAction(LLFolderView* folder, LLInventoryModel* model, std::string action); virtual void openItem(); virtual BOOL removeItem(); @@ -489,7 +489,7 @@ protected: : LLItemBridge(inventory, uuid) {} protected: - static LLString sPrefix; + static std::string sPrefix; }; @@ -497,8 +497,8 @@ class LLAnimationBridge : public LLItemBridge { friend class LLInvFVBridge; public: - virtual const LLString& getPrefix() { return sPrefix; } - virtual void performAction(LLFolderView* folder, LLInventoryModel* model, LLString action); + virtual const std::string& getPrefix() { return sPrefix; } + virtual void performAction(LLFolderView* folder, LLInventoryModel* model, std::string action); virtual void buildContextMenu(LLMenuGL& menu, U32 flags); virtual LLUIImagePtr getIcon() const; @@ -509,7 +509,7 @@ protected: LLItemBridge(inventory, uuid) {} protected: - static LLString sPrefix; + static std::string sPrefix; }; @@ -517,16 +517,16 @@ class LLObjectBridge : public LLItemBridge { friend class LLInvFVBridge; public: - virtual const LLString& getPrefix() { return sPrefix; } + virtual const std::string& getPrefix() { return sPrefix; } virtual LLUIImagePtr getIcon() const; - virtual void performAction(LLFolderView* folder, LLInventoryModel* model, LLString action); + virtual void performAction(LLFolderView* folder, LLInventoryModel* model, std::string action); virtual void openItem(); virtual LLFontGL::StyleFlags getLabelStyle() const; - virtual LLString getLabelSuffix() const; + virtual std::string getLabelSuffix() const; virtual void buildContextMenu(LLMenuGL& menu, U32 flags); virtual BOOL isItemRemovable(); - virtual BOOL renameItem(const LLString& new_name); + virtual BOOL renameItem(const std::string& new_name); protected: LLObjectBridge(LLInventoryPanel* inventory, const LLUUID& uuid, LLInventoryType::EType type, U32 flags) : @@ -538,7 +538,7 @@ protected: } protected: - static LLString sPrefix; + static std::string sPrefix; static LLUUID sContextMenuItemID; // Only valid while the context menu is open. LLInventoryType::EType mInvType; U32 mAttachPt; @@ -550,7 +550,7 @@ class LLLSLTextBridge : public LLItemBridge { friend class LLInvFVBridge; public: - virtual const LLString& getPrefix() { return sPrefix; } + virtual const std::string& getPrefix() { return sPrefix; } virtual LLUIImagePtr getIcon() const; virtual void openItem(); @@ -560,7 +560,7 @@ protected: LLItemBridge(inventory, uuid) {} protected: - static LLString sPrefix; + static std::string sPrefix; }; @@ -569,13 +569,13 @@ class LLWearableBridge : public LLItemBridge friend class LLInvFVBridge; public: virtual LLUIImagePtr getIcon() const; - virtual void performAction(LLFolderView* folder, LLInventoryModel* model, LLString action); + virtual void performAction(LLFolderView* folder, LLInventoryModel* model, std::string action); virtual void openItem(); virtual void buildContextMenu(LLMenuGL& menu, U32 flags); virtual LLFontGL::StyleFlags getLabelStyle() const; - virtual LLString getLabelSuffix() const; + virtual std::string getLabelSuffix() const; virtual BOOL isItemRemovable(); - virtual BOOL renameItem(const LLString& new_name); + virtual BOOL renameItem(const std::string& new_name); static void onWearOnAvatar( void* userdata ); // Access to wearOnAvatar() from menu static BOOL canWearOnAvatar( void* userdata ); diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index 8cbc55892f..01b2942a37 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -303,7 +303,7 @@ LLUUID LLInventoryModel::findCategoryUUIDForType(LLAssetType::EType t, bool crea LLUUID root_id = gAgent.getInventoryRootID(); if(root_id.notNull()) { - rv = createNewCategory(root_id, t, NULL); + rv = createNewCategory(root_id, t, LLStringUtil::null); } } return rv; @@ -343,7 +343,7 @@ LLUUID LLInventoryModel::findCatUUID(LLAssetType::EType preferred_type) // based on preferred type. Returns the UUID of the new category. LLUUID LLInventoryModel::createNewCategory(const LLUUID& parent_id, LLAssetType::EType preferred_type, - const LLString& pname) + const std::string& pname) { LLUUID id; if(!isInventoryUsable()) @@ -353,7 +353,7 @@ LLUUID LLInventoryModel::createNewCategory(const LLUUID& parent_id, } id.generate(); - LLString name = pname; + std::string name = pname; if(!pname.empty()) { name.assign(pname); @@ -466,13 +466,13 @@ void LLInventoryModel::collectDescendentsIf(const LLUUID& id, // Generates a string containing the path to the item specified by // item_id. -void LLInventoryModel::appendPath(const LLUUID& id, LLString& path) +void LLInventoryModel::appendPath(const LLUUID& id, std::string& path) { - LLString temp; + std::string temp; LLInventoryObject* obj = getObject(id); LLUUID parent_id; if(obj) parent_id = obj->getParentUUID(); - LLString forward_slash("/"); + std::string forward_slash("/"); while(obj) { obj = getCategory(parent_id); @@ -1509,19 +1509,15 @@ void LLInventoryModel::cache( items, INCLUDE_TRASH, can_cache); - char agent_id_str[UUID_STR_LENGTH]; /*Flawfinder: ignore*/ - char inventory_filename[LL_MAX_PATH]; /*Flawfinder: ignore*/ + std::string agent_id_str; + std::string inventory_filename; agent_id.toString(agent_id_str); std::string path(gDirUtilp->getExpandedFilename(LL_PATH_CACHE, agent_id_str)); - snprintf( /* Flawfinder: ignore */ - inventory_filename, - LL_MAX_PATH, - CACHE_FORMAT_STRING, - path.c_str()); + inventory_filename = llformat(CACHE_FORMAT_STRING, path.c_str()); saveToFile(inventory_filename, categories, items); std::string gzip_filename(inventory_filename); gzip_filename.append(".gz"); - if(gzip_file(inventory_filename, gzip_filename.c_str())) + if(gzip_file(inventory_filename, gzip_filename)) { lldebugs << "Successfully compressed " << inventory_filename << llendl; LLFile::remove(inventory_filename); @@ -1759,16 +1755,16 @@ bool LLInventoryModel::loadSkeleton( response_t::const_iterator skel; skel = (*it).find("name"); if(skel == no_response) goto clean_cat; - cat->rename(LLString((*skel).second.c_str())); + cat->rename(std::string((*skel).second)); skel = (*it).find("folder_id"); if(skel == no_response) goto clean_cat; - id.set((*skel).second.c_str()); + id.set((*skel).second); // if an id is null, it locks the viewer. if(id.isNull()) goto clean_cat; cat->setUUID(id); skel = (*it).find("parent_id"); if(skel == no_response) goto clean_cat; - id.set((*skel).second.c_str()); + id.set((*skel).second); cat->setParent(id); skel = (*it).find("type_default"); if(skel == no_response) @@ -1798,25 +1794,21 @@ bool LLInventoryModel::loadSkeleton( { cat_array_t categories; item_array_t items; - char owner_id_str[UUID_STR_LENGTH]; /*Flawfinder: ignore*/ + std::string owner_id_str; owner_id.toString(owner_id_str); std::string path(gDirUtilp->getExpandedFilename(LL_PATH_CACHE, owner_id_str)); - char inventory_filename[LL_MAX_PATH]; /*Flawfinder: ignore*/ - snprintf( /* Flawfinder: ignore */ - inventory_filename, - LL_MAX_PATH, - CACHE_FORMAT_STRING, - path.c_str()); + std::string inventory_filename; + inventory_filename = llformat(CACHE_FORMAT_STRING, path.c_str()); const S32 NO_VERSION = LLViewerInventoryCategory::VERSION_UNKNOWN; std::string gzip_filename(inventory_filename); gzip_filename.append(".gz"); - LLFILE* fp = LLFile::fopen(gzip_filename.c_str(), "rb"); /*Flawfinder: ignore*/ + LLFILE* fp = LLFile::fopen(gzip_filename, "rb"); bool remove_inventory_file = false; if(fp) { fclose(fp); fp = NULL; - if(gunzip_file(gzip_filename.c_str(), inventory_filename)) + if(gunzip_file(gzip_filename, inventory_filename)) { // we only want to remove the inventory file if it was // gzipped before we loaded, and we successfully @@ -1970,14 +1962,14 @@ bool LLInventoryModel::loadMeat( response_t::const_iterator meat; meat = (*it).find("name"); if(meat == no_response) goto clean_item; - item->rename(LLString((*meat).second.c_str())); + item->rename(std::string((*meat).second)); meat = (*it).find("item_id"); if(meat == no_response) goto clean_item; - id.set((*meat).second.c_str()); + id.set((*meat).second); item->setUUID(id); meat = (*it).find("parent_id"); if(meat == no_response) goto clean_item; - id.set((*meat).second.c_str()); + id.set((*meat).second); item->setParent(id); meat = (*it).find("type"); if(meat == no_response) goto clean_item; @@ -1991,7 +1983,7 @@ bool LLInventoryModel::loadMeat( } meat = (*it).find("data_id"); if(meat == no_response) goto clean_item; - id.set((*meat).second.c_str()); + id.set((*meat).second); if(LLAssetType::AT_CALLINGCARD == type) { LLPermissions perm; @@ -2236,16 +2228,16 @@ void LLInventoryModel::buildParentChildMap() struct LLUUIDAndName { LLUUIDAndName() {} - LLUUIDAndName(const LLUUID& id, const LLString& name); + LLUUIDAndName(const LLUUID& id, const std::string& name); bool operator==(const LLUUIDAndName& rhs) const; bool operator<(const LLUUIDAndName& rhs) const; bool operator>(const LLUUIDAndName& rhs) const; LLUUID mID; - LLString mName; + std::string mName; }; -LLUUIDAndName::LLUUIDAndName(const LLUUID& id, const LLString& name) : +LLUUIDAndName::LLUUIDAndName(const LLUUID& id, const std::string& name) : mID(id), mName(name) { } @@ -2333,12 +2325,11 @@ bool LLUUIDAndName::operator>(const LLUUIDAndName& rhs) const //} // static -bool LLInventoryModel::loadFromFile( - const char* filename, - LLInventoryModel::cat_array_t& categories, - LLInventoryModel::item_array_t& items) +bool LLInventoryModel::loadFromFile(const std::string& filename, + LLInventoryModel::cat_array_t& categories, + LLInventoryModel::item_array_t& items) { - if(!filename) + if(filename.empty()) { llerrs << "Filename is Null!" << llendl; return false; @@ -2406,12 +2397,11 @@ bool LLInventoryModel::loadFromFile( } // static -bool LLInventoryModel::saveToFile( - const char* filename, - const cat_array_t& categories, - const item_array_t& items) +bool LLInventoryModel::saveToFile(const std::string& filename, + const cat_array_t& categories, + const item_array_t& items) { - if(!filename) + if(filename.empty()) { llerrs << "Filename is Null!" << llendl; return false; @@ -2986,7 +2976,7 @@ void LLInventoryModel::processMoveInventoryItem(LLMessageSystem* msg, void**) LLUUID item_id; LLUUID folder_id; - char new_name[MAX_STRING]; /*Flawfinder: ignore*/ + std::string new_name; bool anything_changed = false; S32 count = msg->getNumberOfBlocksFast(_PREHASH_InventoryData); for(S32 i = 0; i < count; ++i) @@ -2997,7 +2987,7 @@ void LLInventoryModel::processMoveInventoryItem(LLMessageSystem* msg, void**) { LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item); msg->getUUIDFast(_PREHASH_InventoryData, _PREHASH_FolderID, folder_id, i); - msg->getString("InventoryData", "NewName", MAX_STRING, new_name, i); + msg->getString("InventoryData", "NewName", new_name, i); lldebugs << "moving item " << item_id << " to folder " << folder_id << llendl; @@ -3009,7 +2999,7 @@ void LLInventoryModel::processMoveInventoryItem(LLMessageSystem* msg, void**) gInventory.accountForUpdate(update); new_item->setParent(folder_id); - if(strlen(new_name) > 0) /*Flawfinder: ignore*/ + if (new_name.length() > 0) { new_item->rename(new_name); } @@ -3199,7 +3189,7 @@ bool LLNameCategoryCollector::operator()( { if(cat) { - if (!LLString::compareInsensitive(mName.c_str(), cat->getName().c_str())) + if (!LLStringUtil::compareInsensitive(mName, cat->getName())) { return true; } @@ -3593,11 +3583,14 @@ void LLInventoryAddedObserver::changed(U32 mask) // the network, figure out which item was updated. // Code from Gigs Taggert, sin allowed by JC. LLMessageSystem* msg = gMessageSystem; - const char* msg_name = msg->getMessageName(); - if (!msg_name) return; - + std::string msg_name = msg->getMessageName(); + if (msg_name.empty()) + { + return; + } + // We only want newly created inventory items. JC - if ( strcmp(msg_name, "UpdateCreateInventoryItem") ) + if ( msg_name != "UpdateCreateInventoryItem") { return; } diff --git a/indra/newview/llinventorymodel.h b/indra/newview/llinventorymodel.h index 6ec2af5d7b..8d554e2673 100644 --- a/indra/newview/llinventorymodel.h +++ b/indra/newview/llinventorymodel.h @@ -292,7 +292,7 @@ public: // Generates a string containing the path to the item specified by // item_id. - void appendPath(const LLUUID& id, LLString& path); + void appendPath(const LLUUID& id, std::string& path); // message handling functionality static void registerCallbacks(LLMessageSystem* msg); @@ -305,7 +305,7 @@ public: // pass in a NULL to the 'name parameter. LLUUID createNewCategory(const LLUUID& parent_id, LLAssetType::EType preferred_type, - const LLString& name); + const std::string& name); // methods to load up inventory skeleton & meat. These are used // during authentication. return true if everything parsed. @@ -392,14 +392,12 @@ protected: //void recalculateCloneInformation(); // file import/export. - static bool loadFromFile( - const char* filename, - cat_array_t& categories, - item_array_t& items); - static bool saveToFile( - const char* filename, - const cat_array_t& categories, - const item_array_t& items); + static bool loadFromFile(const std::string& filename, + cat_array_t& categories, + item_array_t& items); + static bool saveToFile(const std::string& filename, + const cat_array_t& categories, + const item_array_t& items); // message handling functionality //static void processUseCachedInventory(LLMessageSystem* msg, void**); @@ -645,7 +643,7 @@ protected: class LLNameCategoryCollector : public LLInventoryCollectFunctor { public: - LLNameCategoryCollector(const char* name) : mName(name) {} + LLNameCategoryCollector(const std::string& name) : mName(name) {} virtual ~LLNameCategoryCollector() {} virtual bool operator()(LLInventoryCategory* cat, LLInventoryItem* item); diff --git a/indra/newview/lljoystickbutton.cpp b/indra/newview/lljoystickbutton.cpp index 8a685d5479..994bf39300 100644 --- a/indra/newview/lljoystickbutton.cpp +++ b/indra/newview/lljoystickbutton.cpp @@ -59,13 +59,13 @@ const F32 ORBIT_NUDGE_RATE = 0.05f; // fraction of normal speed // Public Methods // LLJoystick::LLJoystick( - const LLString& name, + const std::string& name, LLRect rect, - const LLString &default_image, - const LLString &selected_image, + const std::string &default_image, + const std::string &selected_image, EJoystickQuadrant initial_quadrant ) : - LLButton(name, rect, default_image, selected_image, NULL, NULL), + LLButton(name, rect, default_image, selected_image, LLStringUtil::null, NULL, NULL), mInitialQuadrant(initial_quadrant), mInitialOffset(0, 0), mLastMouse(0, 0), @@ -196,27 +196,27 @@ EJoystickQuadrant LLJoystick::selectQuadrant(LLXMLNodePtr node) if (node->hasAttribute("quadrant")) { - LLString quadrant_name; + std::string quadrant_name; node->getAttributeString("quadrant", quadrant_name); - quadrant = quadrantFromName(quadrant_name.c_str()); + quadrant = quadrantFromName(quadrant_name); } return quadrant; } -LLString LLJoystick::nameFromQuadrant(EJoystickQuadrant quadrant) +std::string LLJoystick::nameFromQuadrant(EJoystickQuadrant quadrant) { - if (quadrant == JQ_ORIGIN) return LLString("origin"); - else if (quadrant == JQ_UP) return LLString("up"); - else if (quadrant == JQ_DOWN) return LLString("down"); - else if (quadrant == JQ_LEFT) return LLString("left"); - else if (quadrant == JQ_RIGHT) return LLString("right"); - else return LLString(); + if (quadrant == JQ_ORIGIN) return std::string("origin"); + else if (quadrant == JQ_UP) return std::string("up"); + else if (quadrant == JQ_DOWN) return std::string("down"); + else if (quadrant == JQ_LEFT) return std::string("left"); + else if (quadrant == JQ_RIGHT) return std::string("right"); + else return std::string(); } -EJoystickQuadrant LLJoystick::quadrantFromName(const LLString& sQuadrant) +EJoystickQuadrant LLJoystick::quadrantFromName(const std::string& sQuadrant) { EJoystickQuadrant quadrant = JQ_RIGHT; @@ -252,8 +252,8 @@ LLXMLNodePtr LLJoystick::getXML(bool save_children) const node->createChild("halign", TRUE)->setStringValue(LLFontGL::nameFromHAlign(getHAlign())); node->createChild("quadrant", TRUE)->setStringValue(nameFromQuadrant(mInitialQuadrant)); - addImageAttributeToXML(node,getImageUnselectedName(),getImageUnselectedID(),"image_unselected"); - addImageAttributeToXML(node,getImageSelectedName(),getImageSelectedID(),"image_selected"); + addImageAttributeToXML(node,getImageUnselectedName(),getImageUnselectedID(),std::string("image_unselected")); + addImageAttributeToXML(node,getImageSelectedName(),getImageSelectedID(),std::string("image_selected")); node->createChild("scale_image", TRUE)->setBoolValue(getScaleImage()); @@ -328,13 +328,13 @@ void LLJoystickAgentTurn::onHeldDown() LLView* LLJoystickAgentTurn::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory) { - LLString name("button"); + std::string name("button"); node->getAttributeString("name", name); - 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); EJoystickQuadrant quad = JQ_ORIGIN; @@ -437,13 +437,13 @@ void LLJoystickAgentSlide::onHeldDown() // static LLView* LLJoystickAgentSlide::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory) { - LLString name("button"); + std::string name("button"); node->getAttributeString("name", name); - 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); @@ -479,7 +479,7 @@ LLView* LLJoystickAgentSlide::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtr // LLJoystickCameraRotate //------------------------------------------------------------------------------- -LLJoystickCameraRotate::LLJoystickCameraRotate(const LLString& name, LLRect rect, const LLString &out_img, const LLString &in_img) +LLJoystickCameraRotate::LLJoystickCameraRotate(const std::string& name, LLRect rect, const std::string &out_img, const std::string &in_img) : LLJoystick(name, rect, out_img, in_img, JQ_ORIGIN), mInLeft( FALSE ), @@ -716,9 +716,9 @@ void LLJoystickCameraTrack::onHeldDown() // LLJoystickCameraZoom //------------------------------------------------------------------------------- -LLJoystickCameraZoom::LLJoystickCameraZoom(const LLString& name, LLRect rect, const LLString &out_img, const LLString &plus_in_img, const LLString &minus_in_img) +LLJoystickCameraZoom::LLJoystickCameraZoom(const std::string& name, LLRect rect, const std::string &out_img, const std::string &plus_in_img, const std::string &minus_in_img) : - LLJoystick(name, rect, out_img, "", JQ_ORIGIN), + LLJoystick(name, rect, out_img, LLStringUtil::null, JQ_ORIGIN), mInTop( FALSE ), mInBottom( FALSE ) { diff --git a/indra/newview/lljoystickbutton.h b/indra/newview/lljoystickbutton.h index e2d95e184e..91c660fbf8 100644 --- a/indra/newview/lljoystickbutton.h +++ b/indra/newview/lljoystickbutton.h @@ -49,7 +49,7 @@ class LLJoystick : public LLButton { public: - LLJoystick(const LLString& name, LLRect rect, const LLString &default_image, const LLString &selected_image, EJoystickQuadrant initial); + LLJoystick(const std::string& name, LLRect rect, const std::string &default_image, const std::string &selected_image, EJoystickQuadrant initial); virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); @@ -63,8 +63,8 @@ public: void setInitialQuadrant(EJoystickQuadrant initial) { mInitialQuadrant = initial; }; virtual LLXMLNodePtr getXML(bool save_children = true) const; - static LLString nameFromQuadrant(const EJoystickQuadrant quadrant); - static EJoystickQuadrant quadrantFromName(const LLString& name); + static std::string nameFromQuadrant(const EJoystickQuadrant quadrant); + static EJoystickQuadrant quadrantFromName(const std::string& name); static EJoystickQuadrant selectQuadrant(LLXMLNodePtr node); @@ -90,7 +90,7 @@ class LLJoystickAgentTurn : public LLJoystick { public: - LLJoystickAgentTurn(const LLString& name, LLRect rect, const LLString &default_image, const LLString &selected_image, EJoystickQuadrant initial) + LLJoystickAgentTurn(const std::string& name, LLRect rect, const std::string &default_image, const std::string &selected_image, EJoystickQuadrant initial) : LLJoystick(name, rect, default_image, selected_image, initial) { } @@ -106,7 +106,7 @@ class LLJoystickAgentSlide : public LLJoystick { public: - LLJoystickAgentSlide(const LLString& name, LLRect rect, const LLString &default_image, const LLString &selected_image, EJoystickQuadrant initial) + LLJoystickAgentSlide(const std::string& name, LLRect rect, const std::string &default_image, const std::string &selected_image, EJoystickQuadrant initial) : LLJoystick(name, rect, default_image, selected_image, initial) { } @@ -122,7 +122,7 @@ class LLJoystickCameraRotate : public LLJoystick { public: - LLJoystickCameraRotate(const LLString& name, LLRect rect, const LLString &out_img, const LLString &in_img); + LLJoystickCameraRotate(const std::string& name, LLRect rect, const std::string &out_img, const std::string &in_img); virtual void setToggleState( BOOL left, BOOL top, BOOL right, BOOL bottom ); @@ -148,7 +148,7 @@ class LLJoystickCameraTrack : public LLJoystickCameraRotate { public: - LLJoystickCameraTrack(const LLString& name, LLRect rect, const LLString &out_img, const LLString &in_img) + LLJoystickCameraTrack(const std::string& name, LLRect rect, const std::string &out_img, const std::string &in_img) : LLJoystickCameraRotate(name, rect, out_img, in_img) { } @@ -161,7 +161,7 @@ class LLJoystickCameraZoom : public LLJoystick { public: - LLJoystickCameraZoom(const LLString& name, LLRect rect, const LLString &out_img, const LLString &plus_in_img, const LLString &minus_in_img); + LLJoystickCameraZoom(const std::string& name, LLRect rect, const std::string &out_img, const std::string &plus_in_img, const std::string &minus_in_img); virtual void setToggleState( BOOL top, BOOL bottom ); diff --git a/indra/newview/lllogchat.cpp b/indra/newview/lllogchat.cpp index 76a4ec99b1..cb7af207d2 100644 --- a/indra/newview/lllogchat.cpp +++ b/indra/newview/lllogchat.cpp @@ -38,14 +38,14 @@ const S32 LOG_RECALL_SIZE = 2048; //static -LLString LLLogChat::makeLogFileName(LLString filename) +std::string LLLogChat::makeLogFileName(std::string filename) { - filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_ACCOUNT_CHAT_LOGS,filename.c_str()); + filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_ACCOUNT_CHAT_LOGS,filename); filename += ".txt"; return filename; } -LLString LLLogChat::timestamp(bool withdate) +std::string LLLogChat::timestamp(bool withdate) { time_t utc_time; utc_time = time_corrected(); @@ -57,7 +57,7 @@ LLString LLLogChat::timestamp(bool withdate) // it's daylight savings time there. timep = utc_to_pacific_time(utc_time, gPacificDaylightTime); - LLString text; + std::string text; if (withdate) text = llformat("[%d/%02d/%02d %d:%02d] ", (timep->tm_year-100)+2000, timep->tm_mon+1, timep->tm_mday, timep->tm_hour, timep->tm_min); else @@ -68,7 +68,7 @@ LLString LLLogChat::timestamp(bool withdate) //static -void LLLogChat::saveHistory(LLString filename, LLString line) +void LLLogChat::saveHistory(std::string filename, std::string line) { if(!filename.size()) { @@ -76,7 +76,7 @@ void LLLogChat::saveHistory(LLString filename, LLString line) return; } - LLFILE* fp = LLFile::fopen(LLLogChat::makeLogFileName(filename).c_str(), "a"); /*Flawfinder: ignore*/ + LLFILE* fp = LLFile::fopen(LLLogChat::makeLogFileName(filename), "a"); /*Flawfinder: ignore*/ if (!fp) { llinfos << "Couldn't open chat history log!" << llendl; @@ -89,19 +89,19 @@ void LLLogChat::saveHistory(LLString filename, LLString line) } } -void LLLogChat::loadHistory(LLString filename , void (*callback)(ELogLineType,LLString,void*), void* userdata) +void LLLogChat::loadHistory(std::string filename , void (*callback)(ELogLineType,std::string,void*), void* userdata) { if(!filename.size()) { llerrs << "Filename is Empty!" << llendl; } - LLFILE* fptr = LLFile::fopen(makeLogFileName(filename).c_str(), "r"); /*Flawfinder: ignore*/ + LLFILE* fptr = LLFile::fopen(makeLogFileName(filename), "r"); /*Flawfinder: ignore*/ if (!fptr) { //LLUIString message = LLFloaterChat::getInstance()->getUIString("IM_logging_string"); //callback(LOG_EMPTY,"IM_logging_string",userdata); - callback(LOG_EMPTY,"",userdata); + callback(LOG_EMPTY,LLStringUtil::null,userdata); return; //No previous conversation with this name. } else @@ -128,14 +128,14 @@ void LLLogChat::loadHistory(LLString filename , void (*callback)(ELogLineType,LL if (!firstline) { - callback(LOG_LINE,buffer,userdata); + callback(LOG_LINE,std::string(buffer),userdata); } else { firstline = FALSE; } } - callback(LOG_END,"",userdata); + callback(LOG_END,LLStringUtil::null,userdata); fclose(fptr); } diff --git a/indra/newview/lllogchat.h b/indra/newview/lllogchat.h index 0fcee48dfc..45279fd6ae 100644 --- a/indra/newview/lllogchat.h +++ b/indra/newview/lllogchat.h @@ -42,11 +42,11 @@ public: LOG_LINE, LOG_END }; - static LLString timestamp(bool withdate = false); - static LLString makeLogFileName(LLString(filename)); - static void saveHistory(LLString filename, LLString line); - static void loadHistory(LLString filename, - void (*callback)(ELogLineType,LLString,void*), + static std::string timestamp(bool withdate = false); + static std::string makeLogFileName(std::string(filename)); + static void saveHistory(std::string filename, std::string line); + static void loadHistory(std::string filename, + void (*callback)(ELogLineType,std::string,void*), void* userdata); }; diff --git a/indra/newview/llmanip.cpp b/indra/newview/llmanip.cpp index b6980d0382..5e09e69e2b 100644 --- a/indra/newview/llmanip.cpp +++ b/indra/newview/llmanip.cpp @@ -92,7 +92,7 @@ void LLManip::rebuild(LLViewerObject* vobj) // LLManip -LLManip::LLManip( const LLString& name, LLToolComposite* composite ) +LLManip::LLManip( const std::string& name, LLToolComposite* composite ) : LLTool( name, composite ), mInSnapRegime(FALSE), @@ -422,7 +422,7 @@ void LLManip::renderGuidelines(BOOL draw_x, BOOL draw_y, BOOL draw_z) void LLManip::renderXYZ(const LLVector3 &vec) { const S32 PAD = 10; - char feedback_string[128]; /*Flawfinder: ignore*/ + std::string feedback_string; LLVector3 camera_pos = LLViewerCamera::getInstance()->getOrigin() + LLViewerCamera::getInstance()->getAtAxis(); S32 vertical_offset = gViewerWindow->getWindowHeight() / 2 - VERTICAL_OFFSET; S32 window_center_x = gViewerWindow->getWindowWidth() / 2; @@ -451,30 +451,30 @@ void LLManip::renderXYZ(const LLVector3 &vec) LLLocale locale(LLLocale::USER_LOCALE); LLGLDepthTest gls_depth(GL_FALSE); // render drop shadowed text - snprintf(feedback_string, sizeof(feedback_string), "X: %.3f", vec.mV[VX]); /* Flawfinder: ignore */ + feedback_string = llformat("X: %.3f", vec.mV[VX]); hud_render_text(utf8str_to_wstring(feedback_string), camera_pos, *LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF ), LLFontGL::NORMAL, -102.f + 1.f, (F32)vertical_offset - 1.f, LLColor4::black, FALSE); - snprintf(feedback_string, sizeof(feedback_string), "Y: %.3f", vec.mV[VY]); /* Flawfinder: ignore */ + feedback_string = llformat("Y: %.3f", vec.mV[VY]); hud_render_text(utf8str_to_wstring(feedback_string), camera_pos, *LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF ), LLFontGL::NORMAL, -27.f + 1.f, (F32)vertical_offset - 1.f, LLColor4::black, FALSE); - snprintf(feedback_string, sizeof(feedback_string), "Z: %.3f", vec.mV[VZ]); /* Flawfinder: ignore */ + feedback_string = llformat("Z: %.3f", vec.mV[VZ]); hud_render_text(utf8str_to_wstring(feedback_string), camera_pos, *LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF ), LLFontGL::NORMAL, 48.f + 1.f, (F32)vertical_offset - 1.f, LLColor4::black, FALSE); // render text on top - snprintf(feedback_string, sizeof(feedback_string), "X: %.3f", vec.mV[VX]); /* Flawfinder: ignore */ + feedback_string = llformat("X: %.3f", vec.mV[VX]); hud_render_text(utf8str_to_wstring(feedback_string), camera_pos, *LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF ), LLFontGL::NORMAL, -102.f, (F32)vertical_offset, LLColor4(1.f, 0.5f, 0.5f, 1.f), FALSE); glColor3f(0.5f, 1.f, 0.5f); - snprintf(feedback_string, sizeof(feedback_string), "Y: %.3f", vec.mV[VY]); /* Flawfinder: ignore */ + feedback_string = llformat("Y: %.3f", vec.mV[VY]); hud_render_text(utf8str_to_wstring(feedback_string), camera_pos, *LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF ), LLFontGL::NORMAL, -27.f, (F32)vertical_offset, LLColor4(0.5f, 1.f, 0.5f, 1.f), FALSE); glColor3f(0.5f, 0.5f, 1.f); - snprintf(feedback_string, sizeof(feedback_string), "Z: %.3f", vec.mV[VZ]); /* Flawfinder: ignore */ + feedback_string = llformat("Z: %.3f", vec.mV[VZ]); hud_render_text(utf8str_to_wstring(feedback_string), camera_pos, *LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF ), LLFontGL::NORMAL, 48.f, (F32)vertical_offset, LLColor4(0.5f, 0.5f, 1.f, 1.f), FALSE); } } -void LLManip::renderTickText(const LLVector3& pos, const char* text, const LLColor4 &color) +void LLManip::renderTickText(const LLVector3& pos, const std::string& text, const LLColor4 &color) { const LLFontGL* big_fontp = LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF ); @@ -502,37 +502,37 @@ void LLManip::renderTickText(const LLVector3& pos, const char* text, const LLCol glPopMatrix(); } -void LLManip::renderTickValue(const LLVector3& pos, F32 value, const char* suffix, const LLColor4 &color) +void LLManip::renderTickValue(const LLVector3& pos, F32 value, const std::string& suffix, const LLColor4 &color) { LLLocale locale(LLLocale::USER_LOCALE); const LLFontGL* big_fontp = LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF ); const LLFontGL* small_fontp = LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF_SMALL ); - char val_string[128]; /*Flawfinder: ignore*/ - char fraction_string[128]; /*Flawfinder: ignore*/ + std::string val_string; + std::string fraction_string; F32 val_to_print = llround(value, 0.001f); S32 fractional_portion = llround(fmodf(llabs(val_to_print), 1.f) * 100.f); if (val_to_print < 0.f) { if (fractional_portion == 0) { - snprintf(val_string, sizeof(val_string), "-%d%s", lltrunc(llabs(val_to_print)), suffix); /* Flawfinder: ignore */ + val_string = llformat("-%d%s", lltrunc(llabs(val_to_print)), suffix.c_str()); } else { - snprintf(val_string, sizeof(val_string), "-%d", lltrunc(llabs(val_to_print))); /* Flawfinder: ignore */ + val_string = llformat("-%d", lltrunc(llabs(val_to_print))); } } else { if (fractional_portion == 0) { - snprintf(val_string, sizeof(val_string), "%d%s", lltrunc(llabs(val_to_print)), suffix); /* Flawfinder: ignore */ + val_string = llformat("%d%s", lltrunc(llabs(val_to_print)), suffix.c_str()); } else { - snprintf(val_string, sizeof(val_string), "%d", lltrunc(val_to_print)); /* Flawfinder: ignore */ + val_string = llformat("%d", lltrunc(val_to_print)); } } @@ -554,7 +554,7 @@ void LLManip::renderTickValue(const LLVector3& pos, F32 value, const char* suffi if (fractional_portion != 0) { - snprintf(fraction_string, sizeof(fraction_string), "%c%02d%s", LLResMgr::getInstance()->getDecimalPoint(), fractional_portion, suffix); /* Flawfinder: ignore */ + fraction_string = llformat("%c%02d%s", LLResMgr::getInstance()->getDecimalPoint(), fractional_portion, suffix.c_str()); gViewerWindow->setupViewport(1, -1); hud_render_utf8text(val_string, render_pos, *big_fontp, LLFontGL::NORMAL, -1.f * big_fontp->getWidthF32(val_string), 3.f, shadow_color, hud_selection); diff --git a/indra/newview/llmanip.h b/indra/newview/llmanip.h index a2ad464f3c..1313f77c5b 100644 --- a/indra/newview/llmanip.h +++ b/indra/newview/llmanip.h @@ -120,7 +120,7 @@ public: public: static void rebuild(LLViewerObject* vobj); - LLManip( const LLString& name, LLToolComposite* composite ); + LLManip( const std::string& name, LLToolComposite* composite ); virtual BOOL handleMouseDownOnPart(S32 x, S32 y, MASK mask) = 0; void renderGuidelines(BOOL draw_x = TRUE, BOOL draw_y = TRUE, BOOL draw_z = TRUE); @@ -143,8 +143,8 @@ protected: void getManipNormal(LLViewerObject* object, EManipPart manip, LLVector3 &normal); BOOL getManipAxis(LLViewerObject* object, EManipPart manip, LLVector3 &axis); F32 getSubdivisionLevel(const LLVector3 &reference_point, const LLVector3 &translate_axis, F32 grid_scale, S32 min_pixel_spacing = MIN_DIVISION_PIXEL_WIDTH); - void renderTickValue(const LLVector3& pos, F32 value, const char* suffix, const LLColor4 &color); - void renderTickText(const LLVector3& pos, const char* suffix, const LLColor4 &color); + void renderTickValue(const LLVector3& pos, F32 value, const std::string& suffix, const LLColor4 &color); + void renderTickText(const LLVector3& pos, const std::string& suffix, const LLColor4 &color); void updateGridSettings(); BOOL getMousePointOnPlaneGlobal(LLVector3d& point, S32 x, S32 y, LLVector3d origin, LLVector3 normal) const; BOOL getMousePointOnPlaneAgent(LLVector3& point, S32 x, S32 y, LLVector3 origin, LLVector3 normal); diff --git a/indra/newview/llmaniprotate.cpp b/indra/newview/llmaniprotate.cpp index 77e6112e95..e98ded2a87 100644 --- a/indra/newview/llmaniprotate.cpp +++ b/indra/newview/llmaniprotate.cpp @@ -86,7 +86,7 @@ const F32 MANIPULATOR_SCALE_HALF_LIFE = 0.07f; extern void handle_reset_rotation(void*); // in LLViewerWindow LLManipRotate::LLManipRotate( LLToolComposite* composite ) -: LLManip( "Rotate", composite ), +: LLManip( std::string("Rotate"), composite ), mRotationCenter(), mCenterScreen(), mRotation(), @@ -926,6 +926,7 @@ void LLManipRotate::renderSnapGuides() } gGL.end(); + // *TODO: Translate //RN: text rendering does own shadow pass, so only render once if (pass == 1 && render_text && i % 16 == 0) { @@ -933,32 +934,32 @@ void LLManipRotate::renderSnapGuides() { if (i == 0) { - renderTickText(text_point, mObjectSelection->isAttachment() ? "Forward" : "East", LLColor4::white); + renderTickText(text_point, mObjectSelection->isAttachment() ? std::string("Forward") : std::string("East"), LLColor4::white); } else if (i == 16) { if (constraint_axis.mV[VZ] > 0.f) { - renderTickText(text_point, mObjectSelection->isAttachment() ? "Left" : "North", LLColor4::white); + renderTickText(text_point, mObjectSelection->isAttachment() ? std::string("Left") : std::string("North"), LLColor4::white); } else { - renderTickText(text_point, mObjectSelection->isAttachment() ? "Right" : "South", LLColor4::white); + renderTickText(text_point, mObjectSelection->isAttachment() ? std::string("Right") : std::string("South"), LLColor4::white); } } else if (i == 32) { - renderTickText(text_point, mObjectSelection->isAttachment() ? "Back" : "West", LLColor4::white); + renderTickText(text_point, mObjectSelection->isAttachment() ? std::string("Back") : std::string("West"), LLColor4::white); } else { if (constraint_axis.mV[VZ] > 0.f) { - renderTickText(text_point, mObjectSelection->isAttachment() ? "Right" : "South", LLColor4::white); + renderTickText(text_point, mObjectSelection->isAttachment() ? std::string("Right") : std::string("South"), LLColor4::white); } else { - renderTickText(text_point, mObjectSelection->isAttachment() ? "Left" : "North", LLColor4::white); + renderTickText(text_point, mObjectSelection->isAttachment() ? std::string("Left") : std::string("North"), LLColor4::white); } } } @@ -966,32 +967,32 @@ void LLManipRotate::renderSnapGuides() { if (i == 0) { - renderTickText(text_point, mObjectSelection->isAttachment() ? "Left" : "North", LLColor4::white); + renderTickText(text_point, mObjectSelection->isAttachment() ? std::string("Left") : std::string("North"), LLColor4::white); } else if (i == 16) { if (constraint_axis.mV[VX] > 0.f) { - renderTickText(text_point, "Up", LLColor4::white); + renderTickText(text_point, std::string("Up"), LLColor4::white); } else { - renderTickText(text_point, "Down", LLColor4::white); + renderTickText(text_point, std::string("Down"), LLColor4::white); } } else if (i == 32) { - renderTickText(text_point, mObjectSelection->isAttachment() ? "Right" : "South", LLColor4::white); + renderTickText(text_point, mObjectSelection->isAttachment() ? std::string("Right") : std::string("South"), LLColor4::white); } else { if (constraint_axis.mV[VX] > 0.f) { - renderTickText(text_point, "Down", LLColor4::white); + renderTickText(text_point, std::string("Down"), LLColor4::white); } else { - renderTickText(text_point, "Up", LLColor4::white); + renderTickText(text_point, std::string("Up"), LLColor4::white); } } } @@ -999,32 +1000,32 @@ void LLManipRotate::renderSnapGuides() { if (i == 0) { - renderTickText(text_point, "Up", LLColor4::white); + renderTickText(text_point, std::string("Up"), LLColor4::white); } else if (i == 16) { if (constraint_axis.mV[VY] > 0.f) { - renderTickText(text_point, mObjectSelection->isAttachment() ? "Forward" : "East", LLColor4::white); + renderTickText(text_point, mObjectSelection->isAttachment() ? std::string("Forward") : std::string("East"), LLColor4::white); } else { - renderTickText(text_point, mObjectSelection->isAttachment() ? "Back" : "West", LLColor4::white); + renderTickText(text_point, mObjectSelection->isAttachment() ? std::string("Back") : std::string("West"), LLColor4::white); } } else if (i == 32) { - renderTickText(text_point, "Down", LLColor4::white); + renderTickText(text_point, std::string("Down"), LLColor4::white); } else { if (constraint_axis.mV[VY] > 0.f) { - renderTickText(text_point, mObjectSelection->isAttachment() ? "Back" : "West", LLColor4::white); + renderTickText(text_point, mObjectSelection->isAttachment() ? std::string("Back") : std::string("West"), LLColor4::white); } else { - renderTickText(text_point, mObjectSelection->isAttachment() ? "Forward" : "East", LLColor4::white); + renderTickText(text_point, mObjectSelection->isAttachment() ? std::string("Forward") : std::string("East"), LLColor4::white); } } } diff --git a/indra/newview/llmanipscale.cpp b/indra/newview/llmanipscale.cpp index 3a3a22081a..57c901e9bc 100644 --- a/indra/newview/llmanipscale.cpp +++ b/indra/newview/llmanipscale.cpp @@ -175,7 +175,7 @@ void LLManipScale::handleDeselect() LLManipScale::LLManipScale( LLToolComposite* composite ) : - LLManip( "Scale", composite ), + LLManip( std::string("Scale"), composite ), mBoxHandleSize( 1.f ), mScaledBoxHandleSize( 1.f ), mManipPart( LL_NO_PART ), @@ -1751,7 +1751,7 @@ void LLManipScale::renderSnapGuides(const LLBBox& bbox) text_highlight = 1.f; } - renderTickValue(text_origin, tick_val, grid_mode == GRID_MODE_WORLD ? "m" : "x", LLColor4(text_highlight, text_highlight, text_highlight, alpha)); + renderTickValue(text_origin, tick_val, grid_mode == GRID_MODE_WORLD ? std::string("m") : std::string("x"), LLColor4(text_highlight, text_highlight, text_highlight, alpha)); } } @@ -1803,7 +1803,7 @@ void LLManipScale::renderSnapGuides(const LLBBox& bbox) text_highlight = 1.f; } - renderTickValue(text_origin, tick_val, grid_mode == GRID_MODE_WORLD ? "m" : "x", LLColor4(text_highlight, text_highlight, text_highlight, alpha)); + renderTickValue(text_origin, tick_val, grid_mode == GRID_MODE_WORLD ? std::string("m") : std::string("x"), LLColor4(text_highlight, text_highlight, text_highlight, alpha)); } } } diff --git a/indra/newview/llmaniptranslate.cpp b/indra/newview/llmaniptranslate.cpp index e179e01030..f4f3a535de 100644 --- a/indra/newview/llmaniptranslate.cpp +++ b/indra/newview/llmaniptranslate.cpp @@ -101,7 +101,7 @@ const U32 ARROW_TO_AXIS[4] = }; LLManipTranslate::LLManipTranslate( LLToolComposite* composite ) -: LLManip( "Move", composite ), +: LLManip( std::string("Move"), composite ), mLastHoverMouseX(-1), mLastHoverMouseY(-1), mSendUpdateOnMouseUp(FALSE), @@ -1412,11 +1412,11 @@ void LLManipTranslate::renderSnapGuides() { // rescale units to meters from multiple of grid scale offset_val *= 2.f * grid_scale[ARROW_TO_AXIS[mManipPart]]; - renderTickValue(text_origin, offset_val, "m", LLColor4(text_highlight, text_highlight, text_highlight, alpha)); + renderTickValue(text_origin, offset_val, std::string("m"), LLColor4(text_highlight, text_highlight, text_highlight, alpha)); } else { - renderTickValue(text_origin, offset_val, "x", LLColor4(text_highlight, text_highlight, text_highlight, alpha)); + renderTickValue(text_origin, offset_val, std::string("x"), LLColor4(text_highlight, text_highlight, text_highlight, alpha)); } } } diff --git a/indra/newview/llmimetypes.cpp b/indra/newview/llmimetypes.cpp index 821f21313c..a7f6d0e9f0 100644 --- a/indra/newview/llmimetypes.cpp +++ b/indra/newview/llmimetypes.cpp @@ -39,17 +39,17 @@ LLMIMETypes::mime_info_map_t LLMIMETypes::sMap; LLMIMETypes::mime_widget_set_map_t LLMIMETypes::sWidgetMap; -LLString sDefaultLabel; +std::string sDefaultLabel; // Returned when we don't know what to do with the mime type -LLString sDefaultWidgetType; +std::string sDefaultWidgetType; // Returned when we don't know what widget set to use -LLString sDefaultImpl; +std::string sDefaultImpl; // Returned when we don't know what impl to use ///////////////////////////////////////////////////////////////////////////// // static -bool LLMIMETypes::parseMIMETypes(const LLString& xml_filename) +bool LLMIMETypes::parseMIMETypes(const std::string& xml_filename) { LLXMLNodePtr root; bool success = LLUICtrlFactory::getLayeredXMLNode(xml_filename, root); @@ -78,7 +78,7 @@ bool LLMIMETypes::parseMIMETypes(const LLString& xml_filename) } else if (node->hasName("mimetype") || node->hasName("scheme")) { - LLString mime_type; + std::string mime_type; node->getAttributeString("name", mime_type); LLMIMEInfo info; for (LLXMLNode* child = node->getFirstChild(); @@ -102,7 +102,7 @@ bool LLMIMETypes::parseMIMETypes(const LLString& xml_filename) } else if (node->hasName("widgetset")) { - LLString set_name; + std::string set_name; node->getAttributeString("name", set_name); LLMIMEWidgetSet info; for (LLXMLNode* child = node->getFirstChild(); @@ -149,7 +149,7 @@ bool LLMIMETypes::parseMIMETypes(const LLString& xml_filename) } // static -LLString LLMIMETypes::translate(const LLString& mime_type) +std::string LLMIMETypes::translate(const std::string& mime_type) { mime_info_map_t::const_iterator it = sMap.find(mime_type); if (it != sMap.end()) @@ -163,7 +163,7 @@ LLString LLMIMETypes::translate(const LLString& mime_type) } // static -LLString LLMIMETypes::widgetType(const LLString& mime_type) +std::string LLMIMETypes::widgetType(const std::string& mime_type) { mime_info_map_t::const_iterator it = sMap.find(mime_type); if (it != sMap.end()) @@ -177,7 +177,7 @@ LLString LLMIMETypes::widgetType(const LLString& mime_type) } // static -LLString LLMIMETypes::implType(const LLString& mime_type) +std::string LLMIMETypes::implType(const std::string& mime_type) { mime_info_map_t::const_iterator it = sMap.find(mime_type); if (it != sMap.end()) @@ -191,10 +191,10 @@ LLString LLMIMETypes::implType(const LLString& mime_type) } // static -LLString LLMIMETypes::findIcon(const LLString& mime_type) +std::string LLMIMETypes::findIcon(const std::string& mime_type) { - LLString icon = ""; - LLString widget_type = LLMIMETypes::widgetType(mime_type); + std::string icon = ""; + std::string widget_type = LLMIMETypes::widgetType(mime_type); mime_widget_set_map_t::iterator it = sWidgetMap.find(widget_type); if(it != sWidgetMap.end()) { @@ -204,9 +204,9 @@ LLString LLMIMETypes::findIcon(const LLString& mime_type) } // static -LLString LLMIMETypes::findDefaultMimeType(const LLString& widget_type) +std::string LLMIMETypes::findDefaultMimeType(const std::string& widget_type) { - LLString mime_type = "none/none"; + std::string mime_type = "none/none"; mime_widget_set_map_t::iterator it = sWidgetMap.find(widget_type); if(it != sWidgetMap.end()) { @@ -216,10 +216,10 @@ LLString LLMIMETypes::findDefaultMimeType(const LLString& widget_type) } // static -LLString LLMIMETypes::findToolTip(const LLString& mime_type) +std::string LLMIMETypes::findToolTip(const std::string& mime_type) { - LLString tool_tip = ""; - LLString widget_type = LLMIMETypes::widgetType(mime_type); + std::string tool_tip = ""; + std::string widget_type = LLMIMETypes::widgetType(mime_type); mime_widget_set_map_t::iterator it = sWidgetMap.find(widget_type); if(it != sWidgetMap.end()) { @@ -229,10 +229,10 @@ LLString LLMIMETypes::findToolTip(const LLString& mime_type) } // static -LLString LLMIMETypes::findPlayTip(const LLString& mime_type) +std::string LLMIMETypes::findPlayTip(const std::string& mime_type) { - LLString play_tip = ""; - LLString widget_type = LLMIMETypes::widgetType(mime_type); + std::string play_tip = ""; + std::string widget_type = LLMIMETypes::widgetType(mime_type); mime_widget_set_map_t::iterator it = sWidgetMap.find(widget_type); if(it != sWidgetMap.end()) { @@ -242,10 +242,10 @@ LLString LLMIMETypes::findPlayTip(const LLString& mime_type) } // static -bool LLMIMETypes::findAllowResize(const LLString& mime_type) +bool LLMIMETypes::findAllowResize(const std::string& mime_type) { bool allow_resize = false; - LLString widget_type = LLMIMETypes::widgetType(mime_type); + std::string widget_type = LLMIMETypes::widgetType(mime_type); mime_widget_set_map_t::iterator it = sWidgetMap.find(widget_type); if(it != sWidgetMap.end()) { @@ -255,10 +255,10 @@ bool LLMIMETypes::findAllowResize(const LLString& mime_type) } // static -bool LLMIMETypes::findAllowLooping(const LLString& mime_type) +bool LLMIMETypes::findAllowLooping(const std::string& mime_type) { bool allow_looping = false; - LLString widget_type = LLMIMETypes::widgetType(mime_type); + std::string widget_type = LLMIMETypes::widgetType(mime_type); mime_widget_set_map_t::iterator it = sWidgetMap.find(widget_type); if(it != sWidgetMap.end()) { diff --git a/indra/newview/llmimetypes.h b/indra/newview/llmimetypes.h index 61359e1933..dcdd347499 100644 --- a/indra/newview/llmimetypes.h +++ b/indra/newview/llmimetypes.h @@ -33,71 +33,71 @@ #ifndef LLMIMETYPES_H #define LLMIMETYPES_H -#include "llstring.h" // because XML parsing lib uses LLString, ugh +#include <string> #include <map> class LLMIMETypes { public: - static bool parseMIMETypes(const LLString& xml_file_path); + static bool parseMIMETypes(const std::string& xml_file_path); // Loads the MIME string definition XML file, usually // from the application skins directory - static LLString translate(const LLString& mime_type); + static std::string translate(const std::string& mime_type); // Returns "QuickTime Movie" from "video/quicktime" - static LLString widgetType(const LLString& mime_type); + static std::string widgetType(const std::string& mime_type); // Type of control widgets for this MIME type // Returns "movie" from "video/quicktime" - static LLString implType(const LLString& mime_type); + static std::string implType(const std::string& mime_type); // Type of Impl to use for decoding media. - static LLString findIcon(const LLString& mime_type); + static std::string findIcon(const std::string& mime_type); // Icon from control widget type for this MIME type - static LLString findToolTip(const LLString& mime_type); + static std::string findToolTip(const std::string& mime_type); // Tool tip from control widget type for this MIME type - static LLString findPlayTip(const LLString& mime_type); + static std::string findPlayTip(const std::string& mime_type); // Play button tool tip from control widget type for this MIME type - static LLString findDefaultMimeType(const LLString& widget_type); + static std::string findDefaultMimeType(const std::string& widget_type); // Canonical mime type associated with this widget set - static bool findAllowResize(const LLString& mime_type); + static bool findAllowResize(const std::string& mime_type); // accessor for flag to enable/disable media size edit fields - static bool findAllowLooping(const LLString& mime_type); + static bool findAllowLooping(const std::string& mime_type); // accessor for flag to enable/disable media looping checkbox public: struct LLMIMEInfo { - LLString mLabel; + std::string mLabel; // friendly label like "QuickTime Movie" - LLString mWidgetType; + std::string mWidgetType; // "web" means use web media UI widgets - LLString mImpl; + std::string mImpl; // which impl to use with this mime type }; struct LLMIMEWidgetSet { - LLString mLabel; + std::string mLabel; // friendly label like "QuickTime Movie" - LLString mIcon; + std::string mIcon; // Name of icon asset to display in toolbar - LLString mDefaultMimeType; + std::string mDefaultMimeType; // Mime type string to use in absence of a specific one - LLString mToolTip; + std::string mToolTip; // custom tool tip for this mime type - LLString mPlayTip; + std::string mPlayTip; // custom tool tip to display for Play button bool mAllowResize; @@ -106,8 +106,8 @@ public: bool mAllowLooping; // enable/disable media looping checkbox }; - typedef std::map< LLString, LLMIMEInfo > mime_info_map_t; - typedef std::map< LLString, LLMIMEWidgetSet > mime_widget_set_map_t; + typedef std::map< std::string, LLMIMEInfo > mime_info_map_t; + typedef std::map< std::string, LLMIMEWidgetSet > mime_widget_set_map_t; // Public so users can iterate over it static mime_info_map_t sMap; diff --git a/indra/newview/llmoveview.cpp b/indra/newview/llmoveview.cpp index 4819d5bd10..58401a804a 100644 --- a/indra/newview/llmoveview.cpp +++ b/indra/newview/llmoveview.cpp @@ -58,7 +58,7 @@ const F32 NUDGE_TIME = 0.25f; // in seconds // protected LLFloaterMove::LLFloaterMove(const LLSD& key) -: LLFloater("move floater") +: LLFloater(std::string("move floater")) { setIsChrome(TRUE); diff --git a/indra/newview/llmutelist.cpp b/indra/newview/llmutelist.cpp index e9a5648b7b..e2b5c821ae 100644 --- a/indra/newview/llmutelist.cpp +++ b/indra/newview/llmutelist.cpp @@ -100,9 +100,9 @@ const char AGENT_SUFFIX[] = " (resident)"; const char OBJECT_SUFFIX[] = " (object)"; const char GROUP_SUFFIX[] = " (group)"; -LLString LLMute::getDisplayName() const +std::string LLMute::getDisplayName() const { - LLString name_with_suffix = mName; + std::string name_with_suffix = mName; switch (mType) { case BY_NAME: @@ -122,7 +122,7 @@ LLString LLMute::getDisplayName() const return name_with_suffix; } -void LLMute::setFromDisplayName(const LLString& display_name) +void LLMute::setFromDisplayName(const std::string& display_name) { size_t pos = 0; mName = display_name; @@ -192,7 +192,7 @@ LLMuteList::LLMuteList() : LLSD settings_llsd; llifstream file; - file.open(filename.c_str()); + file.open(filename); if (file.is_open()) { LLSDSerialize::fromXML(settings_llsd, file); @@ -219,11 +219,11 @@ LLMuteList::~LLMuteList() } llofstream file; - file.open(filename.c_str()); + file.open(filename); LLSDSerialize::toPrettyXML(settings_llsd, file); } -BOOL LLMuteList::isLinden(const LLString& name) const +BOOL LLMuteList::isLinden(const std::string& name) const { typedef boost::tokenizer<boost::char_separator<char> > tokenizer; boost::char_separator<char> sep(" "); @@ -234,7 +234,7 @@ BOOL LLMuteList::isLinden(const LLString& name) const token_iter++; if (token_iter == tokens.end()) return FALSE; - LLString last_name = *token_iter; + std::string last_name = *token_iter; return last_name == "Linden"; } @@ -443,7 +443,7 @@ void LLMuteList::updateRemove(const LLMute& mute) gAgent.sendReliableMessage(); } -void notify_automute_callback(const LLUUID& agent_id, const char* first_name, const char* last_name, BOOL is_group, void* user_data) +void notify_automute_callback(const LLUUID& agent_id, const std::string& first_name, const std::string& last_name, BOOL is_group, void* user_data) { U32 temp_data = (U32) (uintptr_t) user_data; LLMuteList::EAutoReason reason = (LLMuteList::EAutoReason)temp_data; @@ -480,20 +480,19 @@ void notify_automute_callback(const LLUUID& agent_id, const char* first_name, co } -BOOL LLMuteList::autoRemove(const LLUUID& agent_id, const EAutoReason reason, const LLString& first_name, const LLString& last_name) +BOOL LLMuteList::autoRemove(const LLUUID& agent_id, const EAutoReason reason, const std::string& first_name, const std::string& last_name) { BOOL removed = FALSE; if (isMuted(agent_id)) { - LLMute automute(agent_id, "", LLMute::AGENT); + LLMute automute(agent_id, LLStringUtil::null, LLMute::AGENT); removed = TRUE; remove(automute); if (first_name.empty() && last_name.empty()) { - char cache_first[DB_FIRST_NAME_BUF_SIZE]; /* Flawfinder: ignore */ - char cache_last[DB_LAST_NAME_BUF_SIZE]; /* Flawfinder: ignore */ + std::string cache_first, cache_last; if (gCacheName->getName(agent_id, cache_first, cache_last)) { // name in cache, call callback directly @@ -508,7 +507,7 @@ BOOL LLMuteList::autoRemove(const LLUUID& agent_id, const EAutoReason reason, co else { // call callback directly - notify_automute_callback(agent_id, first_name.c_str(), last_name.c_str(), FALSE, (void *)reason); + notify_automute_callback(agent_id, first_name, last_name, FALSE, (void *)reason); } } @@ -542,7 +541,7 @@ std::vector<LLMute> LLMuteList::getMutes() const //----------------------------------------------------------------------------- // loadFromFile() //----------------------------------------------------------------------------- -BOOL LLMuteList::loadFromFile(const LLString& filename) +BOOL LLMuteList::loadFromFile(const std::string& filename) { if(!filename.size()) { @@ -550,7 +549,7 @@ BOOL LLMuteList::loadFromFile(const LLString& filename) return FALSE; } - LLFILE* fp = LLFile::fopen(filename.c_str(), "rb"); /*Flawfinder: ignore*/ + LLFILE* fp = LLFile::fopen(filename, "rb"); /*Flawfinder: ignore*/ if (!fp) { llwarns << "Couldn't open mute list " << filename << llendl; @@ -573,7 +572,7 @@ BOOL LLMuteList::loadFromFile(const LLString& filename) buffer, " %d %254s %254[^|]| %u\n", &type, id_buffer, name_buffer, &flags); LLUUID id = LLUUID(id_buffer); - LLMute mute(id, name_buffer, (LLMute::EType)type, flags); + LLMute mute(id, std::string(name_buffer), (LLMute::EType)type, flags); if (mute.mID.isNull() || mute.mType == LLMute::BY_NAME) { @@ -592,7 +591,7 @@ BOOL LLMuteList::loadFromFile(const LLString& filename) //----------------------------------------------------------------------------- // saveToFile() //----------------------------------------------------------------------------- -BOOL LLMuteList::saveToFile(const LLString& filename) +BOOL LLMuteList::saveToFile(const std::string& filename) { if(!filename.size()) { @@ -600,35 +599,35 @@ BOOL LLMuteList::saveToFile(const LLString& filename) return FALSE; } - LLFILE* fp = LLFile::fopen(filename.c_str(), "wb"); /*Flawfinder: ignore*/ + LLFILE* fp = LLFile::fopen(filename, "wb"); /*Flawfinder: ignore*/ if (!fp) { llwarns << "Couldn't open mute list " << filename << llendl; return FALSE; } // legacy mutes have null uuid - char id_string[UUID_STR_LENGTH]; /*Flawfinder: ignore*/ + std::string id_string; LLUUID::null.toString(id_string); for (string_set_t::iterator it = mLegacyMutes.begin(); it != mLegacyMutes.end(); ++it) { - fprintf(fp, "%d %s %s|\n", (S32)LLMute::BY_NAME, id_string, it->c_str()); + fprintf(fp, "%d %s %s|\n", (S32)LLMute::BY_NAME, id_string.c_str(), it->c_str()); } for (mute_set_t::iterator it = mMutes.begin(); it != mMutes.end(); ++it) { it->mID.toString(id_string); - const LLString& name = it->mName; - fprintf(fp, "%d %s %s|%u\n", (S32)it->mType, id_string, name.c_str(), it->mFlags); + const std::string& name = it->mName; + fprintf(fp, "%d %s %s|%u\n", (S32)it->mType, id_string.c_str(), name.c_str(), it->mFlags); } fclose(fp); return TRUE; } -BOOL LLMuteList::isMuted(const LLUUID& id, const LLString& name, U32 flags) const +BOOL LLMuteList::isMuted(const LLUUID& id, const std::string& name, U32 flags) const { LLUUID id_to_check = id; @@ -669,10 +668,10 @@ BOOL LLMuteList::isMuted(const LLUUID& id, const LLString& name, U32 flags) cons //----------------------------------------------------------------------------- void LLMuteList::requestFromServer(const LLUUID& agent_id) { - char agent_id_string[UUID_STR_LENGTH]; /*Flawfinder: ignore*/ - char filename[LL_MAX_PATH]; /*Flawfinder: ignore*/ + std::string agent_id_string; + std::string filename; agent_id.toString(agent_id_string); - snprintf(filename, sizeof(filename), "%s.cached_mute", gDirUtilp->getExpandedFilename(LL_PATH_CACHE,agent_id_string).c_str()); /* Flawfinder: ignore */ + filename = gDirUtilp->getExpandedFilename(LL_PATH_CACHE,agent_id_string) + ".cached_mute"; LLCRC crc; crc.update(filename); @@ -695,10 +694,10 @@ void LLMuteList::cache(const LLUUID& agent_id) // Write to disk even if empty. if(mIsLoaded) { - char agent_id_string[UUID_STR_LENGTH]; /*Flawfinder: ignore*/ - char filename[LL_MAX_PATH]; /*Flawfinder: ignore*/ + std::string agent_id_string; + std::string filename; agent_id.toString(agent_id_string); - snprintf(filename, sizeof(filename), "%s.cached_mute", gDirUtilp->getExpandedFilename(LL_PATH_CACHE,agent_id_string).c_str()); /* Flawfinder: ignore */ + filename = gDirUtilp->getExpandedFilename(LL_PATH_CACHE,agent_id_string) + ".cached_mute"; saveToFile(filename); } } @@ -737,12 +736,11 @@ void LLMuteList::processMuteListUpdate(LLMessageSystem* msg, void**) llwarns << "Got an mute list update for the wrong agent." << llendl; return; } - char filename[MAX_STRING]; /*Flawfinder: ignore*/ - filename[0] = '\0'; - msg->getStringFast(_PREHASH_MuteData, _PREHASH_Filename, MAX_STRING, filename); + std::string filename; + msg->getStringFast(_PREHASH_MuteData, _PREHASH_Filename, filename); std::string *local_filename_and_path = new std::string(gDirUtilp->getExpandedFilename( LL_PATH_CACHE, filename )); - gXferManager->requestFile(local_filename_and_path->c_str(), + gXferManager->requestFile(*local_filename_and_path, filename, LL_PATH_CACHE, msg->getSender(), @@ -756,10 +754,10 @@ void LLMuteList::processUseCachedMuteList(LLMessageSystem* msg, void**) { llinfos << "LLMuteList::processUseCachedMuteList()" << llendl; - char agent_id_string[UUID_STR_LENGTH]; /*Flawfinder: ignore*/ + std::string agent_id_string; gAgent.getID().toString(agent_id_string); - char filename[LL_MAX_PATH]; /*Flawfinder: ignore*/ - snprintf(filename, sizeof(filename), "%s.cached_mute", gDirUtilp->getExpandedFilename(LL_PATH_CACHE,agent_id_string).c_str()); /* Flawfinder: ignore */ + std::string filename; + filename = gDirUtilp->getExpandedFilename(LL_PATH_CACHE,agent_id_string) + ".cached_mute"; LLMuteList::getInstance()->loadFromFile(filename); } @@ -767,11 +765,11 @@ void LLMuteList::onFileMuteList(void** user_data, S32 error_code, LLExtStat ext_ { llinfos << "LLMuteList::processMuteListFile()" << llendl; - std::string *local_filename_and_path = (std::string*)user_data; + std::string* local_filename_and_path = (std::string*)user_data; if(local_filename_and_path && !local_filename_and_path->empty() && (error_code == 0)) { - LLMuteList::getInstance()->loadFromFile(local_filename_and_path->c_str()); - LLFile::remove(local_filename_and_path->c_str()); + LLMuteList::getInstance()->loadFromFile(*local_filename_and_path); + LLFile::remove(*local_filename_and_path); } delete local_filename_and_path; } diff --git a/indra/newview/llmutelist.h b/indra/newview/llmutelist.h index 5f2306e0a6..cc6f5c9762 100644 --- a/indra/newview/llmutelist.h +++ b/indra/newview/llmutelist.h @@ -60,21 +60,21 @@ public: flagAll = 0x0000000F // Mask of all currently defined flags }; - LLMute(const LLUUID& id, const LLString& name = LLString(), EType type = BY_NAME, U32 flags = 0) + LLMute(const LLUUID& id, const std::string& name = std::string(), EType type = BY_NAME, U32 flags = 0) : mID(id), mName(name), mType(type),mFlags(flags) { } // Returns name + suffix based on type // For example: "James Tester (resident)" - LLString getDisplayName() const; + std::string getDisplayName() const; // Converts a UI name into just the agent or object name // For example: "James Tester (resident)" sets the name to "James Tester" // and the type to AGENT. - void setFromDisplayName(const LLString& display_name); + void setFromDisplayName(const std::string& display_name); public: LLUUID mID; // agent or object id - LLString mName; // agent or object name + std::string mName; // agent or object name EType mType; // needed for UI display of existing mutes U32 mFlags; // flags pertaining to this mute entry }; @@ -107,15 +107,15 @@ public: // Remove both normal and legacy mutes, for any or all properties. BOOL remove(const LLMute& mute, U32 flags = 0); - BOOL autoRemove(const LLUUID& agent_id, const EAutoReason reason, const LLString& first_name = "", const LLString& last_name = ""); + BOOL autoRemove(const LLUUID& agent_id, const EAutoReason reason, const std::string& first_name = LLStringUtil::null, const std::string& last_name = LLStringUtil::null); // Name is required to test against legacy text-only mutes. - BOOL isMuted(const LLUUID& id, const LLString& name = LLString::null, U32 flags = 0) const; + BOOL isMuted(const LLUUID& id, const std::string& name = LLStringUtil::null, U32 flags = 0) const; // Alternate (convenience) form for places we don't need to pass the name, but do need flags - BOOL isMuted(const LLUUID& id, U32 flags) const { return isMuted(id, LLString::null, flags); }; + BOOL isMuted(const LLUUID& id, U32 flags) const { return isMuted(id, LLStringUtil::null, flags); }; - BOOL isLinden(const LLString& name) const; + BOOL isLinden(const std::string& name) const; BOOL isLoaded() const { return mIsLoaded; } @@ -131,8 +131,8 @@ public: F32 getSavedResidentVolume(const LLUUID& id); private: - BOOL loadFromFile(const LLString& filename); - BOOL saveToFile(const LLString& filename); + BOOL loadFromFile(const std::string& filename); + BOOL saveToFile(const std::string& filename); void setLoaded(); void notifyObservers(); @@ -164,7 +164,7 @@ private: typedef std::set<LLMute, compare_by_id> mute_set_t; mute_set_t mMutes; - typedef std::set<LLString> string_set_t; + typedef std::set<std::string> string_set_t; string_set_t mLegacyMutes; typedef std::set<LLMuteListObserver*> observer_set_t; diff --git a/indra/newview/llnamebox.cpp b/indra/newview/llnamebox.cpp index 17185299a8..9f272dd0c1 100644 --- a/indra/newview/llnamebox.cpp +++ b/indra/newview/llnamebox.cpp @@ -47,7 +47,7 @@ std::set<LLNameBox*> LLNameBox::sInstances; LLNameBox::LLNameBox(const std::string& name, const LLRect& rect, const LLUUID& name_id, BOOL is_group, const LLFontGL* font, BOOL mouse_opaque) -: LLTextBox(name, rect, "(retrieving)", font, mouse_opaque), +: LLTextBox(name, rect, std::string("(retrieving)"), font, mouse_opaque), mNameID(name_id) { LLNameBox::sInstances.insert(this); @@ -57,7 +57,7 @@ LLNameBox::LLNameBox(const std::string& name, const LLRect& rect, const LLUUID& } else { - setText(LLString::null); + setText(LLStringUtil::null); } } @@ -84,26 +84,26 @@ void LLNameBox::setNameID(const LLUUID& name_id, BOOL is_group) setText(name); } -void LLNameBox::refresh(const LLUUID& id, const char* firstname, - const char* lastname, BOOL is_group) +void LLNameBox::refresh(const LLUUID& id, const std::string& firstname, + const std::string& lastname, BOOL is_group) { if (id == mNameID) { - LLString name; - - name.assign(firstname); + std::string name; if (!is_group) { - name.append(1, ' '); - name.append(lastname); + name = firstname + " " + lastname; + } + else + { + name = firstname; } - setText(name); } } -void LLNameBox::refreshAll(const LLUUID& id, const char* firstname, - const char* lastname, BOOL is_group) +void LLNameBox::refreshAll(const LLUUID& id, const std::string& firstname, + const std::string& lastname, BOOL is_group) { std::set<LLNameBox*>::iterator it; for (it = LLNameBox::sInstances.begin(); diff --git a/indra/newview/llnamebox.h b/indra/newview/llnamebox.h index da8df5c225..f45aa8bb2e 100644 --- a/indra/newview/llnamebox.h +++ b/indra/newview/llnamebox.h @@ -51,11 +51,10 @@ public: void setNameID(const LLUUID& name_id, BOOL is_group); - void refresh(const LLUUID& id, const char* first, const char* last, - BOOL is_group); + void refresh(const LLUUID& id, const std::string& first, const std::string& last, BOOL is_group); - static void refreshAll(const LLUUID& id, const char* firstname, - const char* lastname, BOOL is_group); + static void refreshAll(const LLUUID& id, const std::string& firstname, + const std::string& lastname, BOOL is_group); private: static std::set<LLNameBox*> sInstances; diff --git a/indra/newview/llnameeditor.cpp b/indra/newview/llnameeditor.cpp index 31c9b41f30..ca47e50899 100644 --- a/indra/newview/llnameeditor.cpp +++ b/indra/newview/llnameeditor.cpp @@ -58,7 +58,7 @@ LLNameEditor::LLNameEditor(const std::string& name, const LLRect& rect, void* userdata, LLLinePrevalidateFunc prevalidate_func) : LLLineEditor(name, rect, - "(retrieving)", + std::string("(retrieving)"), glfont, max_text_length, commit_callback, @@ -99,26 +99,26 @@ void LLNameEditor::setNameID(const LLUUID& name_id, BOOL is_group) setText(name); } -void LLNameEditor::refresh(const LLUUID& id, const char* firstname, - const char* lastname, BOOL is_group) +void LLNameEditor::refresh(const LLUUID& id, const std::string& firstname, + const std::string& lastname, BOOL is_group) { if (id == mNameID) { - LLString name; - - name.assign(firstname); + std::string name; if (!is_group) { - name.append(1, ' '); - name.append(lastname); + name = firstname + " " + lastname; + } + else + { + name = firstname; } - setText(name); } } -void LLNameEditor::refreshAll(const LLUUID& id, const char* firstname, - const char* lastname, BOOL is_group) +void LLNameEditor::refreshAll(const LLUUID& id, const std::string& firstname, + const std::string& lastname, BOOL is_group) { std::set<LLNameEditor*>::iterator it; for (it = LLNameEditor::sInstances.begin(); @@ -142,7 +142,7 @@ LLSD LLNameEditor::getValue() const LLView* LLNameEditor::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory) { - LLString name("name_editor"); + std::string name("name_editor"); node->getAttributeString("name", name); LLRect rect; @@ -162,7 +162,7 @@ LLView* LLNameEditor::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory max_text_length, commit_callback); - LLString label; + std::string label; if(node->getAttributeString("label", label)) { line_editor->setLabel(label); diff --git a/indra/newview/llnameeditor.h b/indra/newview/llnameeditor.h index 70b20fc369..46df7c2a23 100644 --- a/indra/newview/llnameeditor.h +++ b/indra/newview/llnameeditor.h @@ -65,11 +65,10 @@ public: void setNameID(const LLUUID& name_id, BOOL is_group); - void refresh(const LLUUID& id, const char* first, const char* last, - BOOL is_group); + void refresh(const LLUUID& id, const std::string& first, const std::string& last, BOOL is_group); - static void refreshAll(const LLUUID& id, const char* firstname, - const char* lastname, BOOL is_group); + static void refreshAll(const LLUUID& id, const std::string& firstname, + const std::string& lastname, BOOL is_group); // Take/return agent UUIDs diff --git a/indra/newview/llnamelistctrl.cpp b/indra/newview/llnamelistctrl.cpp index 6e08eff6ee..dfc327e329 100644 --- a/indra/newview/llnamelistctrl.cpp +++ b/indra/newview/llnamelistctrl.cpp @@ -44,14 +44,14 @@ static LLRegisterWidget<LLNameListCtrl> r("name_list"); // statics std::set<LLNameListCtrl*> LLNameListCtrl::sInstances; -LLNameListCtrl::LLNameListCtrl(const LLString& name, +LLNameListCtrl::LLNameListCtrl(const std::string& name, const LLRect& rect, LLUICtrlCallback cb, void* userdata, BOOL allow_multiple_selection, BOOL draw_border, S32 name_column_index, - const LLString& tooltip) + const std::string& tooltip) : LLScrollListCtrl(name, rect, cb, userdata, allow_multiple_selection, draw_border), mNameColumnIndex(name_column_index), @@ -71,7 +71,7 @@ LLNameListCtrl::~LLNameListCtrl() // public BOOL LLNameListCtrl::addNameItem(const LLUUID& agent_id, EAddPosition pos, - BOOL enabled, LLString& suffix) + BOOL enabled, std::string& suffix) { //llinfos << "LLNameListCtrl::addNameItem " << agent_id << llendl; @@ -91,7 +91,7 @@ BOOL LLNameListCtrl::handleDragAndDrop( BOOL drop, EDragAndDropType cargo_type, void *cargo_data, EAcceptance *accept, - LLString& tooltip_msg) + std::string& tooltip_msg) { if (!mAllowCallingCardDrop) { @@ -153,7 +153,7 @@ void LLNameListCtrl::addGroupNameItem(LLScrollListItem* item, EAddPosition pos) gCacheName->getGroupName(item->getUUID(), group_name); LLScrollListCell* cell = (LLScrollListCell*)item->getColumn(mNameColumnIndex); - ((LLScrollListText*)cell)->setText( LLString(group_name) ); + ((LLScrollListText*)cell)->setText( std::string(group_name) ); addItem(item, pos); } @@ -234,19 +234,20 @@ void LLNameListCtrl::removeNameItem(const LLUUID& agent_id) } // public -void LLNameListCtrl::refresh(const LLUUID& id, const char* first, - const char* last, - BOOL is_group) +void LLNameListCtrl::refresh(const LLUUID& id, const std::string& first, + const std::string& last, BOOL is_group) { //llinfos << "LLNameListCtrl::refresh " << id << " '" << first << " " // << last << "'" << llendl; - LLString fullname; - fullname.assign(first); - if (last[0] && !is_group) + std::string fullname; + if (!is_group) + { + fullname = first + " " + last; + } + else { - fullname.append(1, ' '); - fullname.append(last); + fullname = first; } // TODO: scan items for that ID, fix if necessary @@ -268,9 +269,8 @@ void LLNameListCtrl::refresh(const LLUUID& id, const char* first, // static -void LLNameListCtrl::refreshAll(const LLUUID& id, const char* first, - const char* last, - BOOL is_group) +void LLNameListCtrl::refreshAll(const LLUUID& id, const std::string& first, + const std::string& last, BOOL is_group) { std::set<LLNameListCtrl*>::iterator it; for (it = LLNameListCtrl::sInstances.begin(); @@ -301,7 +301,7 @@ LLXMLNodePtr LLNameListCtrl::getXML(bool save_children) const LLView* LLNameListCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory) { - LLString name("name_list"); + std::string name("name_list"); node->getAttributeString("name", name); LLRect rect; @@ -355,16 +355,16 @@ LLView* LLNameListCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFacto { if (child->hasName("column")) { - LLString labelname(""); + std::string labelname(""); child->getAttributeString("label", labelname); - LLString columnname(labelname); + std::string columnname(labelname); child->getAttributeString("name", columnname); BOOL columndynamicwidth = FALSE; child->getAttributeBOOL("dynamicwidth", columndynamicwidth); - LLString sortname(columnname); + std::string sortname(columnname); child->getAttributeString("sort", sortname); S32 columnwidth = -1; @@ -415,15 +415,15 @@ LLView* LLNameListCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFacto { 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; @@ -437,7 +437,7 @@ LLView* LLNameListCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFacto } } - LLString contents = node->getTextContents(); + std::string contents = node->getTextContents(); typedef boost::tokenizer<boost::char_separator<char> > tokenizer; boost::char_separator<char> sep("\t\n"); @@ -446,7 +446,7 @@ LLView* LLNameListCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFacto while(token_iter != tokens.end()) { - const char* line = token_iter->c_str(); + const std::string& line = *token_iter; name_list->addCommentText(line); ++token_iter; } diff --git a/indra/newview/llnamelistctrl.h b/indra/newview/llnamelistctrl.h index c49a163ba8..ebac31469e 100644 --- a/indra/newview/llnamelistctrl.h +++ b/indra/newview/llnamelistctrl.h @@ -41,14 +41,14 @@ class LLNameListCtrl : public LLScrollListCtrl { public: - LLNameListCtrl(const LLString& name, + LLNameListCtrl(const std::string& name, const LLRect& rect, LLUICtrlCallback callback, void* userdata, BOOL allow_multiple_selection, BOOL draw_border = TRUE, S32 name_column_index = 0, - const LLString& tooltip = LLString::null); + const std::string& tooltip = LLStringUtil::null); virtual ~LLNameListCtrl(); virtual LLXMLNodePtr getXML(bool save_children = true) const; @@ -57,7 +57,7 @@ public: // Add a user to the list by name. It will be added, the name // requested from the cache, and updated as necessary. BOOL addNameItem(const LLUUID& agent_id, EAddPosition pos = ADD_BOTTOM, - BOOL enabled = TRUE, LLString& suffix = LLString::null); + BOOL enabled = TRUE, std::string& suffix = LLStringUtil::null); BOOL addNameItem(LLScrollListItem* item, EAddPosition pos = ADD_BOTTOM); virtual LLScrollListItem* addElement(const LLSD& value, EAddPosition pos = ADD_BOTTOM, void* userdata = NULL); @@ -71,16 +71,15 @@ public: void removeNameItem(const LLUUID& agent_id); - void refresh(const LLUUID& id, const char* first, const char* last, - BOOL is_group); + void refresh(const LLUUID& id, const std::string& first, const std::string& last, BOOL is_group); - static void refreshAll(const LLUUID& id, const char* firstname, - const char* lastname, BOOL is_group); + static void refreshAll(const LLUUID& id, const std::string& firstname, + const std::string& lastname, BOOL is_group); virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, void *cargo_data, EAcceptance *accept, - LLString& tooltip_msg); + std::string& tooltip_msg); void setAllowCallingCardDrop(BOOL b) { mAllowCallingCardDrop = b; } diff --git a/indra/newview/llnetmap.cpp b/indra/newview/llnetmap.cpp index ee184e74b4..3a33f62c38 100644 --- a/indra/newview/llnetmap.cpp +++ b/indra/newview/llnetmap.cpp @@ -114,52 +114,52 @@ LLNetMap::LLNetMap( //mTextBoxNorth = new LLTextBox( "N", major_dir_rect ); //mTextBoxNorth->setFontStyle(LLFontGL::DROP_SHADOW_SOFT); //addChild( mTextBoxNorth ); - mTextBoxNorth = new LLTextBox( "N", major_dir_rect ); + mTextBoxNorth = new LLTextBox( std::string("N"), major_dir_rect ); mTextBoxNorth->setColor( minor_color ); addChild( mTextBoxNorth ); - mTextBoxEast = new LLTextBox( "E", major_dir_rect ); + mTextBoxEast = new LLTextBox( std::string("E"), major_dir_rect ); mTextBoxEast->setColor( minor_color ); addChild( mTextBoxEast ); major_dir_rect.mRight += 1 ; - mTextBoxWest = new LLTextBox( "W", major_dir_rect ); + mTextBoxWest = new LLTextBox( std::string("W"), major_dir_rect ); mTextBoxWest->setColor( minor_color ); addChild( mTextBoxWest ); major_dir_rect.mRight -= 1 ; - mTextBoxSouth = new LLTextBox( "S", major_dir_rect ); + mTextBoxSouth = new LLTextBox( std::string("S"), major_dir_rect ); mTextBoxSouth->setColor( minor_color ); addChild( mTextBoxSouth ); - mTextBoxSouthEast = new LLTextBox( "SE", minor_dir_rect ); + mTextBoxSouthEast = new LLTextBox( std::string("SE"), minor_dir_rect ); mTextBoxSouthEast->setColor( minor_color ); addChild( mTextBoxSouthEast ); - mTextBoxNorthEast = new LLTextBox( "NE", minor_dir_rect ); + mTextBoxNorthEast = new LLTextBox( std::string("NE"), minor_dir_rect ); mTextBoxNorthEast->setColor( minor_color ); addChild( mTextBoxNorthEast ); - mTextBoxSouthWest = new LLTextBox( "SW", minor_dir_rect ); + mTextBoxSouthWest = new LLTextBox( std::string("SW"), minor_dir_rect ); mTextBoxSouthWest->setColor( minor_color ); addChild( mTextBoxSouthWest ); - mTextBoxNorthWest = new LLTextBox( "NW", minor_dir_rect ); + mTextBoxNorthWest = new LLTextBox( std::string("NW"), minor_dir_rect ); mTextBoxNorthWest->setColor( minor_color ); addChild( mTextBoxNorthWest ); // Right-click menu LLMenuGL* menu; - menu = new LLMenuGL("popup"); + menu = new LLMenuGL(std::string("popup")); menu->setCanTearOff(FALSE); - menu->append(new LLMenuItemCallGL("Zoom Close", handleZoomLevel, + menu->append(new LLMenuItemCallGL(std::string("Zoom Close"), handleZoomLevel, NULL, (void*)2) ); - menu->append(new LLMenuItemCallGL("Zoom Medium", handleZoomLevel, + menu->append(new LLMenuItemCallGL(std::string("Zoom Medium"), handleZoomLevel, NULL, (void*)1) ); - menu->append(new LLMenuItemCallGL("Zoom Far", handleZoomLevel, + menu->append(new LLMenuItemCallGL(std::string("Zoom Far"), handleZoomLevel, NULL, (void*)0) ); menu->appendSeparator(); - menu->append(new LLMenuItemCallGL("Stop Tracking", &LLTracker::stopTracking, + menu->append(new LLMenuItemCallGL(std::string("Stop Tracking"), &LLTracker::stopTracking, &LLTracker::isTracking, NULL) ); menu->setVisible(FALSE); addChild(menu); @@ -580,7 +580,7 @@ BOOL LLNetMap::handleScrollWheel(S32 x, S32 y, S32 clicks) return TRUE; } -BOOL LLNetMap::handleToolTip( S32 x, S32 y, LLString& msg, LLRect* sticky_rect_screen ) +BOOL LLNetMap::handleToolTip( S32 x, S32 y, std::string& msg, LLRect* sticky_rect_screen ) { BOOL handled = FALSE; if (gDisconnected) @@ -593,12 +593,12 @@ BOOL LLNetMap::handleToolTip( S32 x, S32 y, LLString& msg, LLRect* sticky_rect_s msg.assign( region->getName() ); #ifndef LL_RELEASE_FOR_DOWNLOAD - char buffer[MAX_STRING]; /*Flawfinder: ignore*/ + std::string buffer; msg.append("\n"); - region->getHost().getHostName(buffer, MAX_STRING); + buffer = region->getHost().getHostName(); msg.append(buffer); msg.append("\n"); - region->getHost().getString(buffer, MAX_STRING); + buffer = region->getHost().getString(); msg.append(buffer); #endif // *TODO: put this under the control of XUI so it can be diff --git a/indra/newview/llnetmap.h b/indra/newview/llnetmap.h index 5d506c473c..3950a08166 100644 --- a/indra/newview/llnetmap.h +++ b/indra/newview/llnetmap.h @@ -55,7 +55,7 @@ public: virtual BOOL handleDoubleClick( S32 x, S32 y, MASK mask ); virtual BOOL handleRightMouseDown( S32 x, S32 y, MASK mask ); virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks); - virtual BOOL handleToolTip( S32 x, S32 y, LLString& msg, LLRect* sticky_rect_screen ); + virtual BOOL handleToolTip( S32 x, S32 y, std::string& msg, LLRect* sticky_rect_screen ); void setScale( F32 scale ); void translatePan( F32 delta_x, F32 delta_y ); diff --git a/indra/newview/lloverlaybar.cpp b/indra/newview/lloverlaybar.cpp index 23ba7163c2..483793cfad 100644 --- a/indra/newview/lloverlaybar.cpp +++ b/indra/newview/lloverlaybar.cpp @@ -87,7 +87,7 @@ void* LLOverlayBar::createMediaRemote(void* userdata) void* LLOverlayBar::createVoiceRemote(void* userdata) { LLOverlayBar *self = (LLOverlayBar*)userdata; - self->mVoiceRemote = new LLVoiceRemoteCtrl("voice_remote"); + self->mVoiceRemote = new LLVoiceRemoteCtrl(std::string("voice_remote")); return self->mVoiceRemote; } @@ -379,7 +379,7 @@ void LLOverlayBar::toggleMusicPlay(void*) // stream is stopped, it doesn't return the right thing - commenting out for now. // if ( gAudiop->isInternetStreamPlaying() == 0 ) { - gAudiop->startInternetStream(parcel->getMusicURL().c_str()); + gAudiop->startInternetStream(parcel->getMusicURL()); } } } diff --git a/indra/newview/llpanelavatar.cpp b/indra/newview/llpanelavatar.cpp index 94bf17f531..7162f9dc53 100644 --- a/indra/newview/llpanelavatar.cpp +++ b/indra/newview/llpanelavatar.cpp @@ -111,7 +111,7 @@ public: EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, - LLString& tooltip_msg); + std::string& tooltip_msg); void setAgentID(const LLUUID &agent_id) { mAgentID = agent_id; } protected: LLUUID mAgentID; @@ -138,7 +138,7 @@ BOOL LLDropTarget::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, - LLString& tooltip_msg) + std::string& tooltip_msg) { BOOL handled = FALSE; if(getParent()) @@ -234,7 +234,7 @@ void LLPanelAvatarTab::draw() LLPanel::draw(); } -void LLPanelAvatarTab::sendAvatarProfileRequestIfNeeded(const char* method) +void LLPanelAvatarTab::sendAvatarProfileRequestIfNeeded(const std::string& method) { if (!mDataRequested) { @@ -292,8 +292,8 @@ void LLPanelAvatarSecondLife::clearControls() childSetValue("born", ""); childSetValue("acct", ""); - childSetTextArg("partner_edit", "[FIRST]", LLString::null); - childSetTextArg("partner_edit", "[LAST]", LLString::null); + childSetTextArg("partner_edit", "[FIRST]", LLStringUtil::null); + childSetTextArg("partner_edit", "[LAST]", LLStringUtil::null); mPartnerID = LLUUID::null; @@ -502,7 +502,7 @@ BOOL LLPanelAvatarAdvanced::postBuild() mWantToCount = (8>kArraySize(mWantToCheck))?kArraySize(mWantToCheck):8; for(S32 tt=0; tt < mWantToCount; ++tt) { - LLString ctlname = llformat("chk%d", tt); + std::string ctlname = llformat("chk%d", tt); mWantToCheck[tt] = getChild<LLCheckBoxCtrl>(ctlname); } mSkillsCount = (6>kArraySize(mSkillsCheck))?kArraySize(mSkillsCheck):6; @@ -510,7 +510,7 @@ BOOL LLPanelAvatarAdvanced::postBuild() for(S32 tt=0; tt < mSkillsCount; ++tt) { //Find the Skills checkboxes and save off thier controls - LLString ctlname = llformat("schk%d",tt); + std::string ctlname = llformat("schk%d",tt); mSkillsCheck[tt] = getChild<LLCheckBoxCtrl>(ctlname); } @@ -545,7 +545,7 @@ void LLPanelAvatarWeb::enableControls(BOOL self) { childSetEnabled("url_edit",self); childSetVisible("status_text",!self && !mURL.empty()); - childSetText("status_text", LLString::null); + childSetText("status_text", LLStringUtil::null); } void LLPanelAvatarWeb::setWebURL(std::string url) @@ -780,7 +780,7 @@ void LLPanelAvatarNotes::onCommitNotes(LLUICtrl*, void* userdata) //----------------------------------------------------------------------------- // LLPanelAvatarClassified() //----------------------------------------------------------------------------- -LLPanelAvatarClassified::LLPanelAvatarClassified(const LLString& name, const LLRect& rect, +LLPanelAvatarClassified::LLPanelAvatarClassified(const std::string& name, const LLRect& rect, LLPanelAvatar* panel_avatar) : LLPanelAvatarTab(name, rect, panel_avatar) { @@ -885,7 +885,7 @@ void LLPanelAvatarClassified::processAvatarClassifiedReply(LLMessageSystem* msg, S32 block = 0; S32 block_count = 0; LLUUID classified_id; - char classified_name[DB_PICK_NAME_SIZE]; /*Flawfinder: ignore*/ + std::string classified_name; LLPanelClassified* panel_classified = NULL; LLTabContainer* tabs = getChild<LLTabContainer>("classified tab"); @@ -897,7 +897,7 @@ void LLPanelAvatarClassified::processAvatarClassifiedReply(LLMessageSystem* msg, for (block = 0; block < block_count; block++) { msg->getUUIDFast(_PREHASH_Data, _PREHASH_ClassifiedID, classified_id, block); - msg->getStringFast(_PREHASH_Data, _PREHASH_Name, DB_PICK_NAME_SIZE, classified_name, block); + msg->getStringFast(_PREHASH_Data, _PREHASH_Name, classified_name, block); panel_classified = new LLPanelClassified(false, false); @@ -969,7 +969,7 @@ void LLPanelAvatarClassified::onClickDelete(void* data) } if (!panel_classified) return; - LLStringBase<char>::format_map_t args; + LLStringUtil::format_map_t args; args["[NAME]"] = panel_classified->getClassifiedName(); gViewerWindow->alertXml("DeleteClassified", args, callbackDelete, self); @@ -1054,7 +1054,7 @@ void LLPanelAvatarPicks::processAvatarPicksReply(LLMessageSystem* msg, void**) S32 block = 0; S32 block_count = 0; LLUUID pick_id; - char pick_name[DB_PICK_NAME_SIZE]; /*Flawfinder: ignore*/ + std::string pick_name; LLPanelPick* panel_pick = NULL; LLTabContainer* tabs = getChild<LLTabContainer>("picks tab"); @@ -1070,7 +1070,7 @@ void LLPanelAvatarPicks::processAvatarPicksReply(LLMessageSystem* msg, void**) for (block = 0; block < block_count; block++) { msg->getUUID("Data", "PickID", pick_id, block); - msg->getString("Data", "PickName", DB_PICK_NAME_SIZE, pick_name, block); + msg->getString("Data", "PickName", pick_name, block); panel_pick = new LLPanelPick(FALSE); @@ -1127,7 +1127,7 @@ void LLPanelAvatarPicks::onClickDelete(void* data) if (!panel_pick) return; - LLString::format_map_t args; + LLStringUtil::format_map_t args; args["[PICK]"] = panel_pick->getPickName(); gViewerWindow->alertXml("DeleteAvatarPick", args, @@ -1275,7 +1275,7 @@ void LLPanelAvatar::setAvatar(LLViewerObject *avatarp) LLNameValue *firstname = avatarp->getNVPair("FirstName"); LLNameValue *lastname = avatarp->getNVPair("LastName"); - LLString name; + std::string name; if (firstname && lastname) { name.assign( firstname->getString() ); @@ -1330,7 +1330,7 @@ void LLPanelAvatar::setOnlineStatus(EOnlineStatus online_status) } } -void LLPanelAvatar::setAvatarID(const LLUUID &avatar_id, const LLString &name, +void LLPanelAvatar::setAvatarID(const LLUUID &avatar_id, const std::string &name, EOnlineStatus online_status) { if (avatar_id.isNull()) return; @@ -1532,7 +1532,7 @@ void LLPanelAvatar::resetGroupList() row["columns"][0]["width"] = 0; group_list->addElement(row); } - group_list->sortByColumn(0, TRUE); + group_list->sortByColumnIndex(0, TRUE); } } } @@ -1742,9 +1742,9 @@ void LLPanelAvatar::processAvatarPropertiesReply(LLMessageSystem *msg, void**) LLUUID image_id; LLUUID fl_image_id; LLUUID partner_id; - char about_text[DB_USER_ABOUT_BUF_SIZE]; /*Flawfinder: ignore*/ - char fl_about_text[DB_USER_FL_ABOUT_BUF_SIZE]; /*Flawfinder: ignore*/ - char born_on[DB_BORN_BUF_SIZE]; /*Flawfinder: ignore*/ + std::string about_text; + std::string fl_about_text; + std::string born_on; S32 charter_member_size = 0; BOOL allow_publish = FALSE; //BOOL mature = FALSE; @@ -1752,7 +1752,7 @@ void LLPanelAvatar::processAvatarPropertiesReply(LLMessageSystem *msg, void**) BOOL transacted = FALSE; BOOL age_verified = FALSE; BOOL online = FALSE; - char profile_url[DB_USER_PROFILE_URL_BUF_SIZE]; /*Flawfinder: ignore*/ + std::string profile_url; U32 flags = 0x0; @@ -1780,10 +1780,10 @@ void LLPanelAvatar::processAvatarPropertiesReply(LLMessageSystem *msg, void**) msg->getUUIDFast( _PREHASH_PropertiesData, _PREHASH_ImageID, image_id ); msg->getUUIDFast( _PREHASH_PropertiesData, _PREHASH_FLImageID, fl_image_id ); msg->getUUIDFast(_PREHASH_PropertiesData, _PREHASH_PartnerID, partner_id); - msg->getStringFast(_PREHASH_PropertiesData, _PREHASH_AboutText, DB_USER_ABOUT_BUF_SIZE, about_text ); - msg->getStringFast(_PREHASH_PropertiesData, _PREHASH_FLAboutText, DB_USER_FL_ABOUT_BUF_SIZE, fl_about_text ); - msg->getStringFast(_PREHASH_PropertiesData, _PREHASH_BornOn, DB_BORN_BUF_SIZE, born_on); - msg->getString("PropertiesData","ProfileURL", DB_USER_PROFILE_URL_BUF_SIZE, profile_url); + msg->getStringFast(_PREHASH_PropertiesData, _PREHASH_AboutText, about_text ); + msg->getStringFast(_PREHASH_PropertiesData, _PREHASH_FLAboutText, fl_about_text ); + msg->getStringFast(_PREHASH_PropertiesData, _PREHASH_BornOn, born_on); + msg->getString("PropertiesData","ProfileURL", profile_url); msg->getU32Fast(_PREHASH_PropertiesData, _PREHASH_Flags, flags); identified = (flags & AVATAR_IDENTIFIED); @@ -1793,7 +1793,7 @@ void LLPanelAvatar::processAvatarPropertiesReply(LLMessageSystem *msg, void**) online = (flags & AVATAR_ONLINE); U8 caption_index = 0; - LLString caption_text; + std::string caption_text; charter_member_size = msg->getSize("PropertiesData", "CharterMember"); if(1 == charter_member_size) { @@ -1801,15 +1801,13 @@ void LLPanelAvatar::processAvatarPropertiesReply(LLMessageSystem *msg, void**) } else if(1 < charter_member_size) { - char caption[MAX_STRING]; /*Flawfinder: ignore*/ - msg->getString("PropertiesData", "CharterMember", MAX_STRING, caption); - caption_text = caption; + msg->getString("PropertiesData", "CharterMember", caption_text); } if(caption_text.empty()) { - LLString::format_map_t args; + LLStringUtil::format_map_t args; caption_text = self->mPanelSecondLife->getString("CaptionTextAcctInfo"); const char* ACCT_TYPE[] = { @@ -1821,7 +1819,7 @@ void LLPanelAvatar::processAvatarPropertiesReply(LLMessageSystem *msg, void**) caption_index = llclamp(caption_index, (U8)0, (U8)(sizeof(ACCT_TYPE)/sizeof(ACCT_TYPE[0])-1)); args["[ACCTTYPE]"] = self->mPanelSecondLife->getString(ACCT_TYPE[caption_index]); - LLString payment_text = " "; + std::string payment_text = " "; const S32 DEFAULT_CAPTION_LINDEN_INDEX = 3; if(caption_index != DEFAULT_CAPTION_LINDEN_INDEX) { @@ -1838,7 +1836,7 @@ void LLPanelAvatar::processAvatarPropertiesReply(LLMessageSystem *msg, void**) payment_text = "NoPaymentInfoOnFile"; } args["[PAYMENTINFO]"] = self->mPanelSecondLife->getString(payment_text); - LLString age_text = age_verified ? "AgeVerified" : "NotAgeVerified"; + std::string age_text = age_verified ? "AgeVerified" : "NotAgeVerified"; // Do not display age verification status at this time //args["[AGEVERIFICATION]"] = self->mPanelSecondLife->getString(age_text); args["[AGEVERIFICATION]"] = " "; @@ -1848,7 +1846,7 @@ void LLPanelAvatar::processAvatarPropertiesReply(LLMessageSystem *msg, void**) args["[PAYMENTINFO]"] = " "; args["[AGEVERIFICATION]"] = " "; } - LLString::format(caption_text, args); + LLStringUtil::format(caption_text, args); } self->mPanelSecondLife->childSetValue("acct", caption_text); @@ -1858,7 +1856,7 @@ void LLPanelAvatar::processAvatarPropertiesReply(LLMessageSystem *msg, void**) self->setOnlineStatus(online_status); - self->mPanelWeb->setWebURL(std::string(profile_url)); + self->mPanelWeb->setWebURL(profile_url); LLTextureCtrl* image_ctrl = self->mPanelSecondLife->getChild<LLTextureCtrl>("img"); if(image_ctrl) @@ -1893,10 +1891,10 @@ void LLPanelAvatar::processAvatarInterestsReply(LLMessageSystem *msg, void**) LLUUID avatar_id; // target of this panel U32 want_to_mask; - char want_to_text[DB_USER_WANT_TO_BUF_SIZE]; /*Flawfinder: ignore*/ + std::string want_to_text; U32 skills_mask; - char skills_text[DB_USER_SKILLS_BUF_SIZE]; /*Flawfinder: ignore*/ - char languages_text[DB_USER_SKILLS_BUF_SIZE]; /*Flawfinder: ignore*/ + std::string skills_text; + std::string languages_text; //llinfos << "properties packet size " << msg->getReceiveSize() << llendl; @@ -1912,10 +1910,10 @@ void LLPanelAvatar::processAvatarInterestsReply(LLMessageSystem *msg, void**) } msg->getU32Fast( _PREHASH_PropertiesData, _PREHASH_WantToMask, want_to_mask ); - msg->getStringFast(_PREHASH_PropertiesData, _PREHASH_WantToText, DB_USER_WANT_TO_BUF_SIZE, want_to_text ); + msg->getStringFast(_PREHASH_PropertiesData, _PREHASH_WantToText, want_to_text ); msg->getU32Fast( _PREHASH_PropertiesData, _PREHASH_SkillsMask, skills_mask ); - msg->getStringFast(_PREHASH_PropertiesData, _PREHASH_SkillsText, DB_USER_SKILLS_BUF_SIZE, skills_text ); - msg->getString(_PREHASH_PropertiesData, "LanguagesText", DB_USER_SKILLS_BUF_SIZE, languages_text ); + msg->getStringFast(_PREHASH_PropertiesData, _PREHASH_SkillsText, skills_text ); + msg->getString(_PREHASH_PropertiesData, "LanguagesText", languages_text ); self->mPanelAdvanced->setWantSkills(want_to_mask, want_to_text, skills_mask, skills_text, languages_text); } @@ -1929,9 +1927,9 @@ void LLPanelAvatar::processAvatarGroupsReply(LLMessageSystem *msg, void**) LLUUID agent_id; // your id LLUUID avatar_id; // target of this panel U64 group_powers; - char group_title[DB_GROUP_TITLE_BUF_SIZE]; /*Flawfinder: ignore*/ + std::string group_title; LLUUID group_id; - char group_name[DB_GROUP_NAME_BUF_SIZE]; /*Flawfinder: ignore*/ + std::string group_name; LLUUID group_insignia_id; llinfos << "groups packet size " << msg->getReceiveSize() << llendl; @@ -1956,19 +1954,19 @@ void LLPanelAvatar::processAvatarGroupsReply(LLMessageSystem *msg, void**) S32 group_count = msg->getNumberOfBlocksFast(_PREHASH_GroupData); if (0 == group_count) { - if(group_list) group_list->addCommentText("None"); + if(group_list) group_list->addCommentText(std::string("None")); // *TODO: Translate } else { for(S32 i = 0; i < group_count; ++i) { msg->getU64( _PREHASH_GroupData, "GroupPowers", group_powers, i ); - msg->getStringFast(_PREHASH_GroupData, _PREHASH_GroupTitle, DB_GROUP_TITLE_BUF_SIZE, group_title, i ); - msg->getUUIDFast( _PREHASH_GroupData, _PREHASH_GroupID, group_id, i); - msg->getStringFast(_PREHASH_GroupData, _PREHASH_GroupName, DB_GROUP_NAME_BUF_SIZE, group_name, i ); + msg->getStringFast(_PREHASH_GroupData, _PREHASH_GroupTitle, group_title, i ); + msg->getUUIDFast( _PREHASH_GroupData, _PREHASH_GroupID, group_id, i); + msg->getStringFast(_PREHASH_GroupData, _PREHASH_GroupName, group_name, i ); msg->getUUIDFast( _PREHASH_GroupData, _PREHASH_GroupInsigniaID, group_insignia_id, i ); - LLString group_string; + std::string group_string; if (group_id.notNull()) { group_string.assign(group_name); @@ -1999,7 +1997,7 @@ void LLPanelAvatar::processAvatarGroupsReply(LLMessageSystem *msg, void**) } } } - if(group_list) group_list->sortByColumn(0, TRUE); + if(group_list) group_list->sortByColumnIndex(0, TRUE); } } @@ -2036,7 +2034,7 @@ void LLPanelAvatar::sendAvatarPropertiesUpdate() mPanelAdvanced->getWantSkills(&want_to_mask, want_to_text, &skills_mask, skills_text, languages_text); LLUUID first_life_image_id; - LLString first_life_about_text; + std::string first_life_about_text; if (mPanelFirstLife) { first_life_about_text = mPanelFirstLife->childGetValue("about").asString(); @@ -2047,7 +2045,7 @@ void LLPanelAvatar::sendAvatarPropertiesUpdate() } } - LLString about_text = mPanelSecondLife->childGetValue("about").asString(); + std::string about_text = mPanelSecondLife->childGetValue("about").asString(); LLMessageSystem *msg = gMessageSystem; @@ -2131,8 +2129,8 @@ void LLPanelAvatar::processAvatarNotesReply(LLMessageSystem *msg, void**) continue; } - char text[DB_USER_NOTE_SIZE]; /*Flawfinder: ignore*/ - msg->getString("Data", "Notes", DB_USER_NOTE_SIZE, text); + std::string text; + msg->getString("Data", "Notes", text); self->childSetValue("notes edit", text); self->childSetEnabled("notes edit", true); self->mHaveNotes = true; @@ -2192,13 +2190,13 @@ void LLPanelAvatar::onClickKick(void* userdata) gFloaterView->getNewFloaterPosition(&left, &top); LLRect rect(left, top, left+400, top-300); - gViewerWindow->alertXmlEditText("KickUser", LLString::format_map_t(), + gViewerWindow->alertXmlEditText("KickUser", LLStringUtil::format_map_t(), NULL, NULL, LLPanelAvatar::finishKick, self); } // static -void LLPanelAvatar::finishKick(S32 option, const LLString& text, void* userdata) +void LLPanelAvatar::finishKick(S32 option, const std::string& text, void* userdata) { LLPanelAvatar* self = (LLPanelAvatar*) userdata; @@ -2220,13 +2218,13 @@ void LLPanelAvatar::finishKick(S32 option, const LLString& text, void* userdata) // static void LLPanelAvatar::onClickFreeze(void* userdata) { - gViewerWindow->alertXmlEditText("FreezeUser", LLString::format_map_t(), + gViewerWindow->alertXmlEditText("FreezeUser", LLStringUtil::format_map_t(), NULL, NULL, LLPanelAvatar::finishFreeze, userdata); } // static -void LLPanelAvatar::finishFreeze(S32 option, const LLString& text, void* userdata) +void LLPanelAvatar::finishFreeze(S32 option, const std::string& text, void* userdata) { LLPanelAvatar* self = (LLPanelAvatar*) userdata; @@ -2248,13 +2246,13 @@ void LLPanelAvatar::finishFreeze(S32 option, const LLString& text, void* userdat // static void LLPanelAvatar::onClickUnfreeze(void* userdata) { - gViewerWindow->alertXmlEditText("UnFreezeUser", LLString::format_map_t(), + gViewerWindow->alertXmlEditText("UnFreezeUser", LLStringUtil::format_map_t(), NULL, NULL, LLPanelAvatar::finishUnfreeze, userdata); } // static -void LLPanelAvatar::finishUnfreeze(S32 option, const LLString& text, void* userdata) +void LLPanelAvatar::finishUnfreeze(S32 option, const std::string& text, void* userdata) { LLPanelAvatar* self = (LLPanelAvatar*) userdata; @@ -2282,10 +2280,10 @@ void LLPanelAvatar::onClickCSR(void* userdata) LLNameEditor* name_edit = self->getChild<LLNameEditor>("name"); if (!name_edit) return; - LLString name = name_edit->getText(); + std::string name = name_edit->getText(); if (name.empty()) return; - LLString url = "http://csr.lindenlab.com/agent/"; + std::string url = "http://csr.lindenlab.com/agent/"; // slow and stupid, but it's late S32 len = name.length(); @@ -2308,21 +2306,21 @@ void LLPanelAvatar::onClickCSR(void* userdata) void* LLPanelAvatar::createPanelAvatarSecondLife(void* data) { LLPanelAvatar* self = (LLPanelAvatar*)data; - self->mPanelSecondLife = new LLPanelAvatarSecondLife("2nd Life",LLRect(),self); + self->mPanelSecondLife = new LLPanelAvatarSecondLife(std::string("2nd Life"),LLRect(),self); return self->mPanelSecondLife; } void* LLPanelAvatar::createPanelAvatarWeb(void* data) { LLPanelAvatar* self = (LLPanelAvatar*)data; - self->mPanelWeb = new LLPanelAvatarWeb("Web",LLRect(),self); + self->mPanelWeb = new LLPanelAvatarWeb(std::string("Web"),LLRect(),self); return self->mPanelWeb; } void* LLPanelAvatar::createPanelAvatarInterests(void* data) { LLPanelAvatar* self = (LLPanelAvatar*)data; - self->mPanelAdvanced = new LLPanelAvatarAdvanced("Interests",LLRect(),self); + self->mPanelAdvanced = new LLPanelAvatarAdvanced(std::string("Interests"),LLRect(),self); return self->mPanelAdvanced; } @@ -2330,27 +2328,27 @@ void* LLPanelAvatar::createPanelAvatarInterests(void* data) void* LLPanelAvatar::createPanelAvatarPicks(void* data) { LLPanelAvatar* self = (LLPanelAvatar*)data; - self->mPanelPicks = new LLPanelAvatarPicks("Picks",LLRect(),self); + self->mPanelPicks = new LLPanelAvatarPicks(std::string("Picks"),LLRect(),self); return self->mPanelPicks; } void* LLPanelAvatar::createPanelAvatarClassified(void* data) { LLPanelAvatar* self = (LLPanelAvatar*)data; - self->mPanelClassified = new LLPanelAvatarClassified("Classified",LLRect(),self); + self->mPanelClassified = new LLPanelAvatarClassified(std::string("Classified"),LLRect(),self); return self->mPanelClassified; } void* LLPanelAvatar::createPanelAvatarFirstLife(void* data) { LLPanelAvatar* self = (LLPanelAvatar*)data; - self->mPanelFirstLife = new LLPanelAvatarFirstLife("1st Life", LLRect(), self); + self->mPanelFirstLife = new LLPanelAvatarFirstLife(std::string("1st Life"), LLRect(), self); return self->mPanelFirstLife; } void* LLPanelAvatar::createPanelAvatarNotes(void* data) { LLPanelAvatar* self = (LLPanelAvatar*)data; - self->mPanelNotes = new LLPanelAvatarNotes("My Notes",LLRect(),self); + self->mPanelNotes = new LLPanelAvatarNotes(std::string("My Notes"),LLRect(),self); return self->mPanelNotes; } diff --git a/indra/newview/llpanelavatar.h b/indra/newview/llpanelavatar.h index a598dfebf5..5aadb5c6d7 100644 --- a/indra/newview/llpanelavatar.h +++ b/indra/newview/llpanelavatar.h @@ -84,7 +84,7 @@ public: // when they are first displayed. // type is one of "avatarnotesrequest", "avatarpicksrequest", // or "avatarclassifiedsrequest" - void sendAvatarProfileRequestIfNeeded(const char* method); + void sendAvatarProfileRequestIfNeeded(const std::string& method); private: LLPanelAvatar* mPanelAvatar; @@ -207,7 +207,7 @@ public: class LLPanelAvatarClassified : public LLPanelAvatarTab { public: - LLPanelAvatarClassified(const LLString& name, const LLRect& rect, LLPanelAvatar* panel_avatar); + LLPanelAvatarClassified(const std::string& name, const LLRect& rect, LLPanelAvatar* panel_avatar); /*virtual*/ BOOL postBuild(void); @@ -279,7 +279,7 @@ public: // Fill in the avatar ID and handle some field fill-in, as well as // button enablement. // Pass one of the ONLINE_STATUS_foo constants above. - void setAvatarID(const LLUUID &avatar_id, const LLString &name, EOnlineStatus online_status); + void setAvatarID(const LLUUID &avatar_id, const std::string &name, EOnlineStatus online_status); void setOnlineStatus(EOnlineStatus online_status); @@ -326,9 +326,9 @@ public: private: void enableOKIfReady(); - static void finishKick(S32 option, const LLString& text, void* userdata); - static void finishFreeze(S32 option, const LLString& text, void* userdata); - static void finishUnfreeze(S32 option, const LLString& text, void* userdata); + static void finishKick(S32 option, const std::string& text, void* userdata); + static void finishFreeze(S32 option, const std::string& text, void* userdata); + static void finishUnfreeze(S32 option, const std::string& text, void* userdata); static void showProfileCallback(S32 option, void *userdata); @@ -374,7 +374,7 @@ private: }; // helper funcs -void add_left_label(LLPanel *panel, const LLString& name, S32 y); +void add_left_label(LLPanel *panel, const std::string& name, S32 y); #endif // LL_LLPANELAVATAR_H diff --git a/indra/newview/llpanelclassified.cpp b/indra/newview/llpanelclassified.cpp index 7cdde04347..34731f653f 100644 --- a/indra/newview/llpanelclassified.cpp +++ b/indra/newview/llpanelclassified.cpp @@ -148,7 +148,7 @@ LLClassifiedTeleportHandler gClassifiedTeleportHandler; */ LLPanelClassified::LLPanelClassified(bool in_finder, bool from_search) -: LLPanel("Classified Panel"), +: LLPanel(std::string("Classified Panel")), mInFinder(in_finder), mFromSearch(from_search), mDirty(false), @@ -313,7 +313,7 @@ BOOL LLPanelClassified::titleIsValid() { // Disallow leading spaces, punctuation, etc. that screw up // sort order. - const LLString& name = mNameEditor->getText(); + const std::string& name = mNameEditor->getText(); if (name.empty()) { gViewerWindow->alertXml("BlankClassifiedName"); @@ -379,7 +379,7 @@ BOOL LLPanelClassified::canClose() if (mForceClose || !checkDirty()) return TRUE; - LLString::format_map_t args; + LLStringUtil::format_map_t args; args["[NAME]"] = mNameEditor->getText(); LLAlertDialog::showXml("ClassifiedSave", args, saveCallback, this); return FALSE; @@ -576,33 +576,27 @@ void LLPanelClassified::processClassifiedInfoReply(LLMessageSystem *msg, void ** LLUUID parcel_id; msg->getUUIDFast(_PREHASH_Data, _PREHASH_ParcelID, parcel_id); - char name[DB_PARCEL_NAME_SIZE]; /*Flawfinder: ignore*/ - msg->getStringFast(_PREHASH_Data, _PREHASH_Name, DB_PARCEL_NAME_SIZE, name); + std::string name; + msg->getStringFast(_PREHASH_Data, _PREHASH_Name, name); - char desc[DB_PICK_DESC_SIZE]; /*Flawfinder: ignore*/ - msg->getStringFast(_PREHASH_Data, _PREHASH_Desc, DB_PICK_DESC_SIZE, desc); + std::string desc; + msg->getStringFast(_PREHASH_Data, _PREHASH_Desc, desc); LLUUID snapshot_id; msg->getUUIDFast(_PREHASH_Data, _PREHASH_SnapshotID, snapshot_id); // "Location text" is actually the original // name that owner gave the parcel, and the location. - char buffer[256]; /*Flawfinder: ignore*/ - LLString location_text; + std::string location_text; - msg->getStringFast(_PREHASH_Data, _PREHASH_ParcelName, 256, buffer); - if (buffer[0] != '\0') + msg->getStringFast(_PREHASH_Data, _PREHASH_ParcelName, location_text); + if (!location_text.empty()) { - location_text.assign(buffer); location_text.append(", "); } - else - { - location_text.assign(""); - } - char sim_name[256]; /*Flawfinder: ignore*/ - msg->getStringFast(_PREHASH_Data, _PREHASH_SimName, 256, sim_name); + std::string sim_name; + msg->getStringFast(_PREHASH_Data, _PREHASH_SimName, sim_name); LLVector3d pos_global; msg->getVector3dFast(_PREHASH_Data, _PREHASH_PosGlobal, pos_global); @@ -610,8 +604,8 @@ void LLPanelClassified::processClassifiedInfoReply(LLMessageSystem *msg, void ** S32 region_x = llround((F32)pos_global.mdV[VX]) % REGION_WIDTH_UNITS; S32 region_y = llround((F32)pos_global.mdV[VY]) % REGION_WIDTH_UNITS; S32 region_z = llround((F32)pos_global.mdV[VZ]); - - snprintf(buffer, sizeof(buffer), "%s (%d, %d, %d)", sim_name, region_x, region_y, region_z); /* Flawfinder: ignore */ + + std::string buffer = llformat("%s (%d, %d, %d)", sim_name.c_str(), region_x, region_y, region_z); location_text.append(buffer); U8 flags; @@ -654,8 +648,8 @@ void LLPanelClassified::processClassifiedInfoReply(LLMessageSystem *msg, void ** self->mPosGlobal = pos_global; // Update UI controls - self->mNameEditor->setText(LLString(name)); - self->mDescEditor->setText(LLString(desc)); + self->mNameEditor->setText(name); + self->mDescEditor->setText(desc); self->mSnapshotCtrl->setImageAssetID(snapshot_id); self->mLocationEditor->setText(location_text); self->mLocationChanged = false; @@ -674,8 +668,8 @@ void LLPanelClassified::processClassifiedInfoReply(LLMessageSystem *msg, void ** self->mAutoRenewCheck->set(auto_renew); } - LLString datestr = llformat("%02d/%02d/%d", now->tm_mon+1, now->tm_mday, now->tm_year+1900); - LLString::format_map_t string_args; + std::string datestr = llformat("%02d/%02d/%d", now->tm_mon+1, now->tm_mday, now->tm_year+1900); + LLStringUtil::format_map_t string_args; string_args["[DATE]"] = datestr; string_args["[AMT]"] = llformat("%d", price_for_listing); self->childSetText("classified_info_text", self->getString("ad_placed_paid", string_args)); @@ -790,7 +784,7 @@ void LLPanelClassified::onClickUpdate(void* data) // If user has not set mature, do not allow publish if(self->mMatureCombo->getCurrentIndex() == DECLINE_TO_STATE) { - LLString::format_map_t args; + LLStringUtil::format_map_t args; gViewerWindow->alertXml("SetClassifiedMature", &callbackConfirmMature, self); return; } @@ -845,7 +839,7 @@ void LLPanelClassified::gotMature() } // static -void LLPanelClassified::callbackGotPriceForListing(S32 option, LLString text, void* data) +void LLPanelClassified::callbackGotPriceForListing(S32 option, std::string text, void* data) { LLPanelClassified* self = (LLPanelClassified*)data; @@ -855,8 +849,8 @@ void LLPanelClassified::callbackGotPriceForListing(S32 option, LLString text, vo S32 price_for_listing = strtol(text.c_str(), NULL, 10); if (price_for_listing < MINIMUM_PRICE_FOR_LISTING) { - LLString::format_map_t args; - LLString price_text = llformat("%d", MINIMUM_PRICE_FOR_LISTING); + LLStringUtil::format_map_t args; + std::string price_text = llformat("%d", MINIMUM_PRICE_FOR_LISTING); args["[MIN_PRICE]"] = price_text; gViewerWindow->alertXml("MinClassifiedPrice", args); @@ -867,7 +861,7 @@ void LLPanelClassified::callbackGotPriceForListing(S32 option, LLString text, vo // update send self->mPriceForListing = price_for_listing; - LLString::format_map_t args; + LLStringUtil::format_map_t args; args["[AMOUNT]"] = llformat("%d", price_for_listing); gViewerWindow->alertXml("PublishClassified", args, &callbackConfirmPublish, self); @@ -907,7 +901,7 @@ void LLPanelClassified::confirmPublish(S32 option) { // TODO: enable this //LLPanelDirClassifieds* panel = (LLPanelDirClassifieds*)getParent(); - //panel->renameClassified(mClassifiedID, mNameEditor->getText().c_str()); + //panel->renameClassified(mClassifiedID, mNameEditor->getText()); } else { @@ -963,7 +957,7 @@ void LLPanelClassified::onClickProfile(void* data) void LLPanelClassified::onClickLandmark(void* data) { LLPanelClassified* self = (LLPanelClassified*)data; - create_landmark(self->mNameEditor->getText().c_str(), "", self->mPosGlobal); + create_landmark(self->mNameEditor->getText(), "", self->mPosGlobal); } */ @@ -975,7 +969,7 @@ void LLPanelClassified::onClickSet(void* data) // Save location for later. self->mPosGlobal = gAgent.getPositionGlobal(); - LLString location_text; + std::string location_text; location_text.assign("(will update after publish)"); location_text.append(", "); @@ -1029,7 +1023,7 @@ void LLPanelClassified::focusReceived(LLFocusableElement* ctrl, void* data) } -void LLPanelClassified::sendClassifiedClickMessage(const char* type) +void LLPanelClassified::sendClassifiedClickMessage(const std::string& type) { // You're allowed to click on your own ads to reassure yourself // that the system is working. @@ -1049,7 +1043,7 @@ void LLPanelClassified::sendClassifiedClickMessage(const char* type) //////////////////////////////////////////////////////////////////////////////////////////// LLFloaterPriceForListing::LLFloaterPriceForListing() -: LLFloater("PriceForListing"), +: LLFloater(std::string("PriceForListing")), mCallback(NULL), mUserData(NULL) { } @@ -1065,7 +1059,7 @@ BOOL LLFloaterPriceForListing::postBuild() if (edit) { edit->setPrevalidate(LLLineEditor::prevalidateNonNegativeS32); - LLString min_price = llformat("%d", MINIMUM_PRICE_FOR_LISTING); + std::string min_price = llformat("%d", MINIMUM_PRICE_FOR_LISTING); edit->setText(min_price); edit->selectAll(); edit->setFocus(TRUE); @@ -1080,7 +1074,7 @@ BOOL LLFloaterPriceForListing::postBuild() } //static -void LLFloaterPriceForListing::show( void (*callback)(S32, LLString, void*), void* userdata) +void LLFloaterPriceForListing::show( void (*callback)(S32, std::string, void*), void* userdata) { LLFloaterPriceForListing *self = new LLFloaterPriceForListing(); @@ -1111,7 +1105,7 @@ void LLFloaterPriceForListing::buttonCore(S32 button, void* data) if (self->mCallback) { - LLString text = self->childGetText("price_edit"); + std::string text = self->childGetText("price_edit"); self->mCallback(button, text, self->mUserData); self->close(); } diff --git a/indra/newview/llpanelclassified.h b/indra/newview/llpanelclassified.h index 5552a3b9e1..ee84d89f43 100644 --- a/indra/newview/llpanelclassified.h +++ b/indra/newview/llpanelclassified.h @@ -103,11 +103,11 @@ public: static void callbackConfirmMature(S32 option, void* data); void confirmMature(S32 option); void gotMature(); - static void callbackGotPriceForListing(S32 option, LLString text, void* data); + static void callbackGotPriceForListing(S32 option, std::string text, void* data); static void callbackConfirmPublish(S32 option, void* data); void confirmPublish(S32 option); - void sendClassifiedClickMessage(const char* type); + void sendClassifiedClickMessage(const std::string& type); protected: static void saveCallback(S32 option, void* data); @@ -150,7 +150,7 @@ protected: // yet for this classified? That is, have they saved once? BOOL mPaidFor; - LLString mSimName; + std::string mSimName; LLVector3d mPosGlobal; // Values the user may change @@ -185,7 +185,7 @@ public: virtual ~LLFloaterPriceForListing(); virtual BOOL postBuild(); - static void show( void (*callback)(S32 option, LLString value, void* userdata), void* userdata ); + static void show( void (*callback)(S32 option, std::string value, void* userdata), void* userdata ); private: static void onClickSetPrice(void*); @@ -193,7 +193,7 @@ private: static void buttonCore(S32 button, void* data); private: - void (*mCallback)(S32 option, LLString, void*); + void (*mCallback)(S32 option, std::string, void*); void* mUserData; }; diff --git a/indra/newview/llpanelcontents.cpp b/indra/newview/llpanelcontents.cpp index e76a3dd554..e9fb9d3a17 100644 --- a/indra/newview/llpanelcontents.cpp +++ b/indra/newview/llpanelcontents.cpp @@ -168,7 +168,7 @@ void LLPanelContents::onClickNewScript(void *userdata) PERM_NONE, PERM_NONE, PERM_MOVE | PERM_TRANSFER); - LLString desc; + std::string desc; LLAssetType::generateDescriptionFor(LLAssetType::AT_LSL_TEXT, desc); LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem( @@ -178,7 +178,7 @@ void LLPanelContents::onClickNewScript(void *userdata) LLUUID::null, LLAssetType::AT_LSL_TEXT, LLInventoryType::IT_LSL, - LLString("New Script"), + std::string("New Script"), desc, LLSaleInfo::DEFAULT, LLViewerInventoryItem::II_FLAGS_NONE, diff --git a/indra/newview/llpanelgroup.cpp b/indra/newview/llpanelgroup.cpp index 42df0c2ac8..2d5f789141 100644 --- a/indra/newview/llpanelgroup.cpp +++ b/indra/newview/llpanelgroup.cpp @@ -112,10 +112,10 @@ void LLPanelGroupTab::onClickHelp(void* user_data) void LLPanelGroupTab::handleClickHelp() { // Display the help text. - LLString help_text( getHelpText() ); + std::string help_text( getHelpText() ); if ( !help_text.empty() ) { - LLString::format_map_t args; + LLStringUtil::format_map_t args; args["[MESSAGE]"] = help_text; LLAlertDialog* dialogp = gViewerWindow->alertXml("GenericAlert", args); if (dialogp) @@ -323,7 +323,7 @@ void LLPanelGroup::tabChanged() //based on if they need an apply if ( mApplyBtn ) { - LLString mesg; + std::string mesg; mApplyBtn->setEnabled(mCurrentTab->needsApply(mesg)); } } @@ -402,7 +402,7 @@ BOOL LLPanelGroup::canClose() BOOL LLPanelGroup::attemptTransition() { // Check if the current tab needs to be applied. - LLString mesg; + std::string mesg; if (mCurrentTab && mCurrentTab->needsApply(mesg)) { // If no message was provided, give a generic one. @@ -411,7 +411,7 @@ BOOL LLPanelGroup::attemptTransition() mesg = mDefaultNeedsApplyMesg; } // Create a notify box, telling the user about the unapplied tab. - LLString::format_map_t args; + LLStringUtil::format_map_t args; args["[NEEDS_APPLY_MESSAGE]"] = mesg; args["[WANT_APPLY_MESSAGE]"] = mWantApplyMesg; gViewerWindow->alertXml("PanelGroupApply", args, @@ -547,7 +547,7 @@ bool LLPanelGroup::apply() LLPanelGroupTab* panelp = (LLPanelGroupTab*) mTabContainer->getCurrentPanel(); if (!panelp) return false; - LLString mesg; + std::string mesg; if ( !panelp->needsApply(mesg) ) { // We don't need to apply anything. @@ -557,7 +557,7 @@ bool LLPanelGroup::apply() // Ignore the needs apply message. // Try to do the actual apply. - LLString apply_mesg; + std::string apply_mesg; if ( panelp->apply( apply_mesg ) ) { // Everything worked. We're done. @@ -568,7 +568,7 @@ bool LLPanelGroup::apply() // Inform the user. if ( !apply_mesg.empty() ) { - LLString::format_map_t args; + LLStringUtil::format_map_t args; args["[MESSAGE]"] = apply_mesg; gViewerWindow->alertXml("GenericAlert", args); } @@ -595,7 +595,7 @@ void LLPanelGroup::draw() } if (mCurrentTab) { - LLString mesg; + std::string mesg; childSetEnabled("btn_apply", mCurrentTab->needsApply(mesg)); } @@ -627,11 +627,11 @@ void LLPanelGroup::close() } } -void LLPanelGroup::showNotice(const char* subject, - const char* message, - const bool& has_inventory, - const char* inventory_name, - LLOfferInfo* inventory_offer) +void LLPanelGroup::showNotice(const std::string& subject, + const std::string& message, + const bool& has_inventory, + const std::string& inventory_name, + LLOfferInfo* inventory_offer) { if (mCurrentTab->getName() != "notices_tab") { diff --git a/indra/newview/llpanelgroup.h b/indra/newview/llpanelgroup.h index 3928d1d2f5..f27ef75843 100644 --- a/indra/newview/llpanelgroup.h +++ b/indra/newview/llpanelgroup.h @@ -103,11 +103,11 @@ public: void setAllowEdit(BOOL v) { mAllowEdit = v; } - void showNotice(const char* subject, - const char* message, - const bool& has_inventory, - const char* inventory_name, - LLOfferInfo* inventory_offer); + void showNotice(const std::string& subject, + const std::string& message, + const bool& has_inventory, + const std::string& inventory_name, + LLOfferInfo* inventory_offer); protected: LLPanelGroupTab* mCurrentTab; LLPanelGroupTab* mRequestedTab; @@ -123,8 +123,8 @@ protected: std::string mInitialTab; std::string mFilename; - LLString mDefaultNeedsApplyMesg; - LLString mWantApplyMesg; + std::string mDefaultNeedsApplyMesg; + std::string mWantApplyMesg; BOOL mAllowEdit; BOOL mShowingNotifyDialog; @@ -148,14 +148,14 @@ public: // Asks if something needs to be applied. // If returning true, this function should modify the message to the user. - virtual bool needsApply(LLString& mesg) { return false; } + virtual bool needsApply(std::string& mesg) { return false; } // Asks if there is currently a modal dialog being shown. virtual BOOL hasModal() { return mHasModal; } // Request to apply current data. // If returning fail, this function should modify the message to the user. - virtual bool apply(LLString& mesg) { return true; } + virtual bool apply(std::string& mesg) { return true; } // Request a cancel of changes virtual void cancel() { } @@ -164,7 +164,7 @@ public: virtual void update(LLGroupChange gc) { } // This is the text to be displayed when a help button is pressed. - virtual LLString getHelpText() const { return mHelpText; } + virtual std::string getHelpText() const { return mHelpText; } // Display anything returned by getHelpText static void onClickHelp(void* data); @@ -184,7 +184,7 @@ public: protected: LLUUID mGroupID; LLTabContainer* mTabContainer; - LLString mHelpText; + std::string mHelpText; BOOL mAllowEdit; BOOL mHasModal; diff --git a/indra/newview/llpanelgroupgeneral.cpp b/indra/newview/llpanelgroupgeneral.cpp index 72e7fb3abb..a70ca9444f 100644 --- a/indra/newview/llpanelgroupgeneral.cpp +++ b/indra/newview/llpanelgroupgeneral.cpp @@ -344,7 +344,7 @@ void LLPanelGroupGeneral::onClickJoin(void *userdata) if (gdatap) { S32 cost = gdatap->mMembershipFee; - LLString::format_map_t args; + LLStringUtil::format_map_t args; args["[COST]"] = llformat("%d", cost); if (can_afford_transaction(cost)) @@ -394,7 +394,7 @@ void LLPanelGroupGeneral::openProfile(void* data) } } -bool LLPanelGroupGeneral::needsApply(LLString& mesg) +bool LLPanelGroupGeneral::needsApply(std::string& mesg) { mesg = getUIString("group_info_unchanged"); return mChanged || mGroupID.isNull(); @@ -432,7 +432,7 @@ void LLPanelGroupGeneral::draw() } } -bool LLPanelGroupGeneral::apply(LLString& mesg) +bool LLPanelGroupGeneral::apply(std::string& mesg) { BOOL has_power_in_group = gAgent.hasPowerInGroup(mGroupID,GP_GROUP_CHANGE_IDENTITY); @@ -443,7 +443,7 @@ bool LLPanelGroupGeneral::apply(LLString& mesg) // Check to make sure mature has been set if(mComboMature->getCurrentIndex() == DECLINE_TO_STATE) { - LLString::format_map_t args; + LLStringUtil::format_map_t args; gViewerWindow->alertXml("SetGroupMature", &callbackConfirmMatureApply, new LLHandle<LLPanel>(getHandle())); return false; @@ -463,7 +463,7 @@ bool LLPanelGroupGeneral::apply(LLString& mesg) return false; } - LLString::format_map_t args; + LLStringUtil::format_map_t args; args["[MESSAGE]"] = mConfirmGroupCreateStr; gViewerWindow->alertXml("GenericAlertYesCancel", args, createGroupCallback, new LLHandle<LLPanel>(getHandle()) ); @@ -474,7 +474,8 @@ bool LLPanelGroupGeneral::apply(LLString& mesg) LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID); if (!gdatap) { - mesg = "No group data found for group "; + // *TODO: Translate + mesg = std::string("No group data found for group "); mesg.append(mGroupID.asString()); return false; } @@ -575,7 +576,7 @@ void LLPanelGroupGeneral::confirmMatureApply(S32 option) } // If we got here it means they set a valid value - LLString mesg = ""; + std::string mesg = ""; apply(mesg); } @@ -721,7 +722,7 @@ void LLPanelGroupGeneral::update(LLGroupChange gc) } if ( mBtnJoinGroup ) { - char fee_buff[20]; /*Flawfinder: ignore*/ + std::string fee_buff; bool visible; visible = !is_member && gdatap->mOpenEnrollment; @@ -729,9 +730,9 @@ void LLPanelGroupGeneral::update(LLGroupChange gc) if ( visible ) { - snprintf(fee_buff, sizeof(fee_buff), "Join (L$%d)", gdatap->mMembershipFee); /* Flawfinder: ignore */ - mBtnJoinGroup->setLabelSelected(std::string(fee_buff)); - mBtnJoinGroup->setLabelUnselected(std::string(fee_buff)); + fee_buff = llformat( "Join (L$%d)", gdatap->mMembershipFee); + mBtnJoinGroup->setLabelSelected(fee_buff); + mBtnJoinGroup->setLabelUnselected(fee_buff); } } if ( mBtnInfo ) @@ -825,7 +826,7 @@ void LLPanelGroupGeneral::updateMembers() continue; } // Owners show up in bold. - LLString style = "NORMAL"; + std::string style = "NORMAL"; if ( member->isOwner() ) { style = "BOLD"; diff --git a/indra/newview/llpanelgroupgeneral.h b/indra/newview/llpanelgroupgeneral.h index 056d288094..982d0678dd 100644 --- a/indra/newview/llpanelgroupgeneral.h +++ b/indra/newview/llpanelgroupgeneral.h @@ -54,8 +54,8 @@ public: // LLPanelGroupTab static void* createTab(void* data); virtual void activate(); - virtual bool needsApply(LLString& mesg); - virtual bool apply(LLString& mesg); + virtual bool needsApply(std::string& mesg); + virtual bool apply(std::string& mesg); virtual void cancel(); static void createGroupCallback(S32 option, void* user_data); static void callbackConfirmMatureApply(S32 option, void* data); diff --git a/indra/newview/llpanelgroupinvite.cpp b/indra/newview/llpanelgroupinvite.cpp index fed7247816..c4af61587c 100644 --- a/indra/newview/llpanelgroupinvite.cpp +++ b/indra/newview/llpanelgroupinvite.cpp @@ -71,13 +71,13 @@ public: public: LLUUID mGroupID; - LLString mLoadingText; + std::string mLoadingText; LLNameListCtrl *mInvitees; LLComboBox *mRoleNames; LLButton *mOKButton; LLButton *mRemoveButton; LLTextBox *mGroupName; - LLString mOwnerWarning; + std::string mOwnerWarning; bool mConfirmedOwnerInvite; void (*mCloseCallback)(void* data); @@ -158,7 +158,7 @@ void LLPanelGroupInvite::impl::submitInvitations() // owner role: display confirmation and wait for callback if ((role_id == gdatap->mOwnerRole) && (!mConfirmedOwnerInvite)) { - LLString::format_map_t args; + LLStringUtil::format_map_t args; args["[MESSAGE]"] = mOwnerWarning; gViewerWindow->alertXml("GenericAlertYesCancel", args, inviteOwnerCallback, this); return; // we'll be called again if user confirms @@ -395,8 +395,8 @@ void LLPanelGroupInvite::addUsers(std::vector<LLUUID>& agent_ids) LLViewerObject* dest = gObjectList.findObject(agent_id); if(dest && dest->isAvatar()) { - LLString fullname; - LLString::format_map_t args; + std::string fullname; + LLStringUtil::format_map_t args; LLNameValue* nvfirst = dest->getNVPair("FirstName"); LLNameValue* nvlast = dest->getNVPair("LastName"); if(nvfirst && nvlast) diff --git a/indra/newview/llpanelgrouplandmoney.cpp b/indra/newview/llpanelgrouplandmoney.cpp index fdeb3368e8..8483e43394 100644 --- a/indra/newview/llpanelgrouplandmoney.cpp +++ b/indra/newview/llpanelgrouplandmoney.cpp @@ -62,7 +62,7 @@ public: LLTextEditor* text_editor, LLTabContainer* tab_containerp, LLPanel* panelp, - const LLString& loading_text, + const std::string& loading_text, const LLUUID& group_id, S32 interval_length_days, S32 max_interval_days); @@ -94,7 +94,7 @@ public: LLTextEditor* text_editorp, LLTabContainer* tab_containerp, LLPanel* panelp, - const LLString& loading_text, + const std::string& loading_text, const LLUUID& group_id); virtual ~LLGroupMoneyDetailsTabEventHandler(); @@ -111,7 +111,7 @@ public: LLTextEditor* text_editorp, LLTabContainer* tab_containerp, LLPanel* panelp, - const LLString& loading_text, + const std::string& loading_text, const LLUUID& group_id); virtual ~LLGroupMoneySalesTabEventHandler(); @@ -125,7 +125,7 @@ public: LLGroupMoneyPlanningTabEventHandler(LLTextEditor* text_editor, LLTabContainer* tab_containerp, LLPanel* panelp, - const LLString& loading_text, + const std::string& loading_text, const LLUUID& group_id); virtual ~LLGroupMoneyPlanningTabEventHandler(); @@ -306,7 +306,7 @@ int LLPanelGroupLandMoney::impl::getStoredContribution() // Fills in the text field with the contribution, contrib void LLPanelGroupLandMoney::impl::setYourContributionTextField(int contrib) { - LLString buffer = llformat("%d", contrib); + std::string buffer = llformat("%d", contrib); if ( mYourContributionEditorp ) { @@ -405,41 +405,40 @@ void LLPanelGroupLandMoney::impl::processGroupLand(LLMessageSystem* msg) mMapButtonp->setEnabled(TRUE); } - char name[MAX_STRING]; /*Flawfinder: ignore*/ - char desc[MAX_STRING]; /*Flawfinder: ignore*/ + std::string name; + std::string desc; S32 actual_area; S32 billable_area; U8 flags; F32 global_x; F32 global_y; - char sim_name[MAX_STRING]; /*Flawfinder: ignore*/ + std::string sim_name; for(S32 i = first_block; i < count; ++i) { msg->getUUID("QueryData", "OwnerID", owner_id, i); - msg->getString("QueryData", "Name", MAX_STRING, name, i); - msg->getString("QueryData", "Desc", MAX_STRING, desc, i); + msg->getString("QueryData", "Name", name, i); + msg->getString("QueryData", "Desc", desc, i); msg->getS32("QueryData", "ActualArea", actual_area, i); msg->getS32("QueryData", "BillableArea", billable_area, i); msg->getU8("QueryData", "Flags", flags, i); msg->getF32("QueryData", "GlobalX", global_x, i); msg->getF32("QueryData", "GlobalY", global_y, i); - msg->getString("QueryData", "SimName", MAX_STRING, sim_name, i); + msg->getString("QueryData", "SimName", sim_name, i); S32 region_x = llround(global_x) % REGION_WIDTH_UNITS; S32 region_y = llround(global_y) % REGION_WIDTH_UNITS; - char location[MAX_STRING]; /*Flawfinder: ignore*/ - snprintf(location, MAX_STRING, "%s (%d, %d)", sim_name, region_x, region_y); /* Flawfinder: ignore */ - char area[MAX_STRING]; /*Flawfinder: ignore*/ + std::string location = sim_name + llformat(" (%d, %d)", region_x, region_y); + std::string area; if(billable_area == actual_area) { - snprintf(area, MAX_STRING, "%d", billable_area); /* Flawfinder: ignore */ + area = llformat("%d", billable_area); } else { - snprintf(area, MAX_STRING, "%d / %d", billable_area, actual_area); /* Flawfinder: ignore */ + area = llformat("%d / %d", billable_area, actual_area); } - char hidden[MAX_STRING]; /*Flawfinder: ignore*/ - snprintf(hidden, MAX_STRING, "%f %f", global_x, global_y); /* Flawfinder: ignore */ + std::string hidden; + hidden = llformat("%f %f", global_x, global_y); LLSD row; @@ -563,12 +562,12 @@ void LLPanelGroupLandMoney::update(LLGroupChange gc) mImplementationp->setYourContributionTextField(mImplementationp->getStoredContribution()); } -bool LLPanelGroupLandMoney::needsApply(LLString& mesg) +bool LLPanelGroupLandMoney::needsApply(std::string& mesg) { return mImplementationp->mNeedsApply; } -bool LLPanelGroupLandMoney::apply(LLString& mesg) +bool LLPanelGroupLandMoney::apply(std::string& mesg) { if (!mImplementationp->applyContribution() ) { @@ -679,7 +678,7 @@ BOOL LLPanelGroupLandMoney::postBuild() } } - LLString loading_text = getString("loading_txt"); + std::string loading_text = getString("loading_txt"); //pull out the widgets for the L$ details tab earlierp = getChild<LLButton>("earlier_details_button", true); @@ -777,7 +776,7 @@ public: LLButton* later_buttonp, LLTextEditor* text_editorp, LLPanel* tabpanelp, - const LLString& loading_text, + const std::string& loading_text, const LLUUID& group_id, S32 interval_length_days, S32 max_interval_days); @@ -803,14 +802,14 @@ public: LLButton* mEarlierButtonp; LLButton* mLaterButtonp; - LLString mLoadingText; + std::string mLoadingText; }; LLGroupMoneyTabEventHandler::impl::impl(LLButton* earlier_buttonp, LLButton* later_buttonp, LLTextEditor* text_editorp, LLPanel* tabpanelp, - const LLString& loading_text, + const std::string& loading_text, const LLUUID& group_id, S32 interval_length_days, S32 max_interval_days) @@ -868,7 +867,7 @@ LLGroupMoneyTabEventHandler::LLGroupMoneyTabEventHandler(LLButton* earlier_butto LLTextEditor* text_editorp, LLTabContainer* tab_containerp, LLPanel* panelp, - const LLString& loading_text, + const std::string& loading_text, const LLUUID& group_id, S32 interval_length_days, S32 max_interval_days) @@ -985,7 +984,7 @@ LLGroupMoneyDetailsTabEventHandler::LLGroupMoneyDetailsTabEventHandler(LLButton* LLTextEditor* text_editorp, LLTabContainer* tab_containerp, LLPanel* panelp, - const LLString& loading_text, + const std::string& loading_text, const LLUUID& group_id) : LLGroupMoneyTabEventHandler(earlier_buttonp, later_buttonp, @@ -1036,16 +1035,13 @@ void LLGroupMoneyDetailsTabEventHandler::processReply(LLMessageSystem* msg, return; } - char line[MAX_STRING]; /*Flawfinder: ignore*/ - LLString text; - - char start_date[MAX_STRING]; /*Flawfinder: ignore*/ + std::string start_date; S32 interval_days; S32 current_interval; msg->getS32Fast(_PREHASH_MoneyData, _PREHASH_IntervalDays, interval_days ); msg->getS32Fast(_PREHASH_MoneyData, _PREHASH_CurrentInterval, current_interval ); - msg->getStringFast(_PREHASH_MoneyData, _PREHASH_StartDate, MAX_STRING, start_date); + msg->getStringFast(_PREHASH_MoneyData, _PREHASH_StartDate, start_date); if ( interval_days != mImplementationp->mIntervalLength || current_interval != mImplementationp->mCurrentInterval ) @@ -1055,23 +1051,22 @@ void LLGroupMoneyDetailsTabEventHandler::processReply(LLMessageSystem* msg, return; } - snprintf(line, MAX_STRING, "%s\n\n", start_date); /* Flawfinder: ignore */ - text.append(line); + std::string text = start_date; + text.append("\n\n"); S32 total_amount = 0; S32 transactions = msg->getNumberOfBlocksFast(_PREHASH_HistoryData); for(S32 i = 0; i < transactions; i++) { - S32 amount = 0; - char desc[MAX_STRING]; /*Flawfinder: ignore*/ + S32 amount = 0; + std::string desc; - msg->getStringFast(_PREHASH_HistoryData, _PREHASH_Description, MAX_STRING, desc, i ); - msg->getS32Fast(_PREHASH_HistoryData, _PREHASH_Amount, amount, i); + msg->getStringFast(_PREHASH_HistoryData, _PREHASH_Description, desc, i ); + msg->getS32Fast(_PREHASH_HistoryData, _PREHASH_Amount, amount, i); if (amount != 0) { - snprintf(line, MAX_STRING, "%-24s %6d\n", desc, amount ); /* Flawfinder: ignore */ - text.append(line); + text.append(llformat("%-24s %6d\n", desc.c_str(), amount)); } else { @@ -1083,8 +1078,7 @@ void LLGroupMoneyDetailsTabEventHandler::processReply(LLMessageSystem* msg, text.append(1, '\n'); - snprintf(line, MAX_STRING, "%-24s %6d\n", "Total", total_amount ); /* Flawfinder: ignore */ - text.append(line); + text.append(llformat("%-24s %6d\n", "Total", total_amount)); if ( mImplementationp->mTextEditorp ) { @@ -1125,7 +1119,7 @@ LLGroupMoneySalesTabEventHandler::LLGroupMoneySalesTabEventHandler(LLButton* ear LLTextEditor* text_editorp, LLTabContainer* tab_containerp, LLPanel* panelp, - const LLString& loading_text, + const std::string& loading_text, const LLUUID& group_id) : LLGroupMoneyTabEventHandler(earlier_buttonp, later_buttonp, @@ -1176,16 +1170,15 @@ void LLGroupMoneySalesTabEventHandler::processReply(LLMessageSystem* msg, return; } - char line[MAX_STRING]; /*Flawfinder: ignore*/ std::string text = mImplementationp->mTextEditorp->getText(); - char start_date[MAX_STRING]; /*Flawfinder: ignore*/ + std::string start_date; S32 interval_days; S32 current_interval; msg->getS32Fast(_PREHASH_MoneyData, _PREHASH_IntervalDays, interval_days ); msg->getS32Fast(_PREHASH_MoneyData, _PREHASH_CurrentInterval, current_interval ); - msg->getStringFast(_PREHASH_MoneyData, _PREHASH_StartDate, MAX_STRING, start_date); + msg->getStringFast(_PREHASH_MoneyData, _PREHASH_StartDate, start_date); if (interval_days != mImplementationp->mIntervalLength || current_interval != mImplementationp->mCurrentInterval) @@ -1199,10 +1192,7 @@ void LLGroupMoneySalesTabEventHandler::processReply(LLMessageSystem* msg, // Start with the date. if (text == mImplementationp->mLoadingText) { - text.clear(); - - snprintf(line, MAX_STRING, "%s\n\n", start_date); /* Flawfinder: ignore */ - text.append(line); + text = start_date + "\n\n"; } S32 transactions = msg->getNumberOfBlocksFast(_PREHASH_HistoryData); @@ -1214,22 +1204,21 @@ void LLGroupMoneySalesTabEventHandler::processReply(LLMessageSystem* msg, { for(S32 i = 0; i < transactions; i++) { - const S32 SHORT_STRING = 64; - char time[SHORT_STRING]; /*Flawfinder: ignore*/ + std::string time; S32 type = 0; S32 amount = 0; - char user[SHORT_STRING]; /*Flawfinder: ignore*/ - char item[SHORT_STRING]; /*Flawfinder: ignore*/ + std::string user; + std::string item; - msg->getStringFast(_PREHASH_HistoryData, _PREHASH_Time, SHORT_STRING, time, i); - msg->getStringFast(_PREHASH_HistoryData, _PREHASH_User, SHORT_STRING, user, i ); + msg->getStringFast(_PREHASH_HistoryData, _PREHASH_Time, time, i); + msg->getStringFast(_PREHASH_HistoryData, _PREHASH_User, user, i ); msg->getS32Fast(_PREHASH_HistoryData, _PREHASH_Type, type, i); - msg->getStringFast(_PREHASH_HistoryData, _PREHASH_Item, SHORT_STRING, item, i ); - msg->getS32Fast(_PREHASH_HistoryData, _PREHASH_Amount, amount, i); + msg->getStringFast(_PREHASH_HistoryData, _PREHASH_Item, item, i ); + msg->getS32Fast(_PREHASH_HistoryData, _PREHASH_Amount, amount, i); if (amount != 0) { - const char* verb; + std::string verb; switch(type) { @@ -1256,7 +1245,7 @@ void LLGroupMoneySalesTabEventHandler::processReply(LLMessageSystem* msg, break; } - snprintf(line, sizeof(line), "%s %6d - %s %s %s\n", time, amount, user, verb, item); /* Flawfinder: ignore */ + std::string line = llformat("%s %6d - %s %s %s\n", time.c_str(), amount, user.c_str(), verb.c_str(), item.c_str()); text.append(line); } } @@ -1302,7 +1291,7 @@ void LLPanelGroupLandMoney::processGroupAccountTransactionsReply(LLMessageSystem LLGroupMoneyPlanningTabEventHandler::LLGroupMoneyPlanningTabEventHandler(LLTextEditor* text_editorp, LLTabContainer* tab_containerp, LLPanel* panelp, - const LLString& loading_text, + const std::string& loading_text, const LLUUID& group_id) : LLGroupMoneyTabEventHandler(NULL, NULL, @@ -1353,12 +1342,11 @@ void LLGroupMoneyPlanningTabEventHandler::processReply(LLMessageSystem* msg, return; } - char line[MAX_STRING]; /*Flawfinder: ignore*/ - LLString text; + std::string text; - char start_date[MAX_STRING]; /*Flawfinder: ignore*/ - char last_stipend_date[MAX_STRING]; /*Flawfinder: ignore*/ - char next_stipend_date[MAX_STRING]; /*Flawfinder: ignore*/ + std::string start_date; + std::string last_stipend_date; + std::string next_stipend_date; S32 interval_days; S32 current_interval; S32 balance; @@ -1395,9 +1383,9 @@ void LLGroupMoneyPlanningTabEventHandler::processReply(LLMessageSystem* msg, msg->getS32Fast(_PREHASH_MoneyData, _PREHASH_ParcelDirFeeEstimate, proj_parcel_dir_fee ); msg->getS32Fast(_PREHASH_MoneyData, _PREHASH_NonExemptMembers, non_exempt_members ); - msg->getStringFast(_PREHASH_MoneyData, _PREHASH_StartDate, MAX_STRING, start_date); - msg->getStringFast(_PREHASH_MoneyData, _PREHASH_LastTaxDate, MAX_STRING, last_stipend_date); - msg->getStringFast(_PREHASH_MoneyData, _PREHASH_TaxDate, MAX_STRING, next_stipend_date); + msg->getStringFast(_PREHASH_MoneyData, _PREHASH_StartDate, start_date); + msg->getStringFast(_PREHASH_MoneyData, _PREHASH_LastTaxDate, last_stipend_date); + msg->getStringFast(_PREHASH_MoneyData, _PREHASH_TaxDate, next_stipend_date); cur_total_tax = cur_object_tax + cur_light_tax + cur_land_tax + cur_group_tax + cur_parcel_dir_fee; proj_total_tax = proj_object_tax + proj_light_tax + proj_land_tax + proj_group_tax + proj_parcel_dir_fee; @@ -1410,27 +1398,22 @@ void LLGroupMoneyPlanningTabEventHandler::processReply(LLMessageSystem* msg, return; } - snprintf(line, MAX_STRING, "Summary for this week, beginning on %s\n", start_date); /* Flawfinder: ignore */ - text.append(line); + text.append("Summary for this week, beginning on "); + text.append(start_date); if (current_interval == 0) { - snprintf(line, MAX_STRING, "The next stipend day is %s\n\n", next_stipend_date); /* Flawfinder: ignore */ - text.append(line); - snprintf(line, MAX_STRING, "%-24sL$%6d\n", "Balance", balance ); /* Flawfinder: ignore */ - text.append(line); - + text.append("The next stipend day is "); + text.append(next_stipend_date); + text.append("\n\n"); + text.append(llformat("%-24sL$%6d\n", "Balance", balance )); text.append(1, '\n'); } - snprintf(line, MAX_STRING, " Group Individual Share\n"); /* Flawfinder: ignore */ - text.append(line); - snprintf(line, MAX_STRING, "%-24s %6d %6d \n", "Credits", total_credits, (S32)floor((F32)total_credits/(F32)non_exempt_members)); /* Flawfinder: ignore */ - text.append(line); - snprintf(line, MAX_STRING, "%-24s %6d %6d \n", "Debits", total_debits, (S32)floor((F32)total_debits/(F32)non_exempt_members)); /* Flawfinder: ignore */ - text.append(line); - snprintf(line, MAX_STRING, "%-24s %6d %6d \n", "Total", total_credits + total_debits, (S32)floor((F32)(total_credits + total_debits)/(F32)non_exempt_members)); /* Flawfinder: ignore */ - text.append(line); + text.append( " Group Individual Share\n"); + text.append(llformat( "%-24s %6d %6d \n", "Credits", total_credits, (S32)floor((F32)total_credits/(F32)non_exempt_members))); + text.append(llformat( "%-24s %6d %6d \n", "Debits", total_debits, (S32)floor((F32)total_debits/(F32)non_exempt_members))); + text.append(llformat( "%-24s %6d %6d \n", "Total", total_credits + total_debits, (S32)floor((F32)(total_credits + total_debits)/(F32)non_exempt_members))); if ( mImplementationp->mTextEditorp ) { diff --git a/indra/newview/llpanelgrouplandmoney.h b/indra/newview/llpanelgrouplandmoney.h index 83126f9906..ec3ca18e1f 100644 --- a/indra/newview/llpanelgrouplandmoney.h +++ b/indra/newview/llpanelgrouplandmoney.h @@ -51,8 +51,8 @@ public: static void* createTab(void* data); virtual void activate(); - virtual bool needsApply(LLString& mesg); - virtual bool apply(LLString& mesg); + virtual bool needsApply(std::string& mesg); + virtual bool apply(std::string& mesg); virtual void cancel(); virtual void update(LLGroupChange gc); diff --git a/indra/newview/llpanelgroupnotices.cpp b/indra/newview/llpanelgroupnotices.cpp index 3d5abc2fb9..18fcc9d291 100644 --- a/indra/newview/llpanelgroupnotices.cpp +++ b/indra/newview/llpanelgroupnotices.cpp @@ -80,7 +80,7 @@ public: EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, - LLString& tooltip_msg); + std::string& tooltip_msg); protected: LLPanelGroupNotices* mGroupNoticesPanel; LLUUID mGroupID; @@ -103,7 +103,7 @@ BOOL LLGroupDropTarget::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, - LLString& tooltip_msg) + std::string& tooltip_msg) { BOOL handled = FALSE; @@ -168,14 +168,14 @@ BOOL LLGroupDropTarget::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, //----------------------------------------------------------------------------- // LLPanelGroupNotices //----------------------------------------------------------------------------- -char* build_notice_date(const time_t& the_time, char* buffer) +std::string build_notice_date(const time_t& the_time) { time_t t = the_time; if (!t) time(&t); tm* lt = localtime(&t); //for some reason, the month is off by 1. See other uses of //"local" time in the code... - snprintf(buffer, NOTICE_DATE_STRING_SIZE, "%i/%i/%i", lt->tm_mon + 1, lt->tm_mday, lt->tm_year + 1900); /*Flawfinder: ignore*/ + std::string buffer = llformat("%i/%i/%i", lt->tm_mon + 1, lt->tm_mday, lt->tm_year + 1900); return buffer; } @@ -316,7 +316,7 @@ void LLPanelGroupNotices::setItem(LLPointer<LLInventoryItem> inv_item) item_is_multi = TRUE; }; - LLString icon_name = get_item_icon_name(inv_item->getType(), + std::string icon_name = get_item_icon_name(inv_item->getType(), inv_item->getInventoryType(), inv_item->getFlags(), item_is_multi ); @@ -362,8 +362,8 @@ void LLPanelGroupNotices::onClickSendMessage(void* data) } send_group_notice( self->mGroupID, - self->mCreateSubject->getText().c_str(), - self->mCreateMessage->getText().c_str(), + self->mCreateSubject->getText(), + self->mCreateMessage->getText(), self->mInventoryItem); self->mCreateMessage->clear(); @@ -442,8 +442,8 @@ void LLPanelGroupNotices::processGroupNoticesListReply(LLMessageSystem* msg, voi void LLPanelGroupNotices::processNotices(LLMessageSystem* msg) { LLUUID id; - char subj[MAX_STRING]; /*Flawfinder: ignore*/ - char name[MAX_STRING]; /*Flawfinder: ignore*/ + std::string subj; + std::string name; U32 timestamp; BOOL has_attachment; U8 asset_type; @@ -461,8 +461,8 @@ void LLPanelGroupNotices::processNotices(LLMessageSystem* msg) return; } - msg->getString("Data","Subject",MAX_STRING,subj,i); - msg->getString("Data","FromName",MAX_STRING,name,i); + msg->getString("Data","Subject",subj,i); + msg->getString("Data","FromName",name,i); msg->getBOOL("Data","HasAttachment",has_attachment,i); msg->getU8("Data","AssetType",asset_type,i); msg->getU32("Data","Timestamp",timestamp,i); @@ -474,7 +474,7 @@ void LLPanelGroupNotices::processNotices(LLMessageSystem* msg) row["columns"][0]["column"] = "icon"; if (has_attachment) { - LLString icon_name = get_item_icon_name( + std::string icon_name = get_item_icon_name( (LLAssetType::EType)asset_type, LLInventoryType::IT_NONE,FALSE, FALSE); row["columns"][0]["type"] = "icon"; @@ -487,12 +487,11 @@ void LLPanelGroupNotices::processNotices(LLMessageSystem* msg) row["columns"][2]["column"] = "from"; row["columns"][2]["value"] = name; - char buffer[NOTICE_DATE_STRING_SIZE]; /*Flawfinder: ignore*/ - build_notice_date(t, buffer); + std::string buffer = build_notice_date(t); row["columns"][3]["column"] = "date"; row["columns"][3]["value"] = buffer; - snprintf(buffer, 30, "%u", timestamp); /* Flawfinder: ignore */ + buffer = llformat( "%u", timestamp); row["columns"][4]["column"] = "sort"; row["columns"][4]["value"] = buffer; @@ -522,16 +521,16 @@ void LLPanelGroupNotices::onSelectNotice(LLUICtrl* ctrl, void* data) lldebugs << "Item " << item->getUUID() << " selected." << llendl; } -void LLPanelGroupNotices::showNotice(const char* subject, - const char* message, - const bool& has_inventory, - const char* inventory_name, - LLOfferInfo* inventory_offer) +void LLPanelGroupNotices::showNotice(const std::string& subject, + const std::string& message, + const bool& has_inventory, + const std::string& inventory_name, + LLOfferInfo* inventory_offer) { arrangeNoticeView(VIEW_PAST_NOTICE); - if(mViewSubject) mViewSubject->setText(LLString(subject)); - if(mViewMessage) mViewMessage->setText(LLString(message)); + if(mViewSubject) mViewSubject->setText(subject); + if(mViewMessage) mViewMessage->setText(message); if (mInventoryOffer) { @@ -544,7 +543,7 @@ void LLPanelGroupNotices::showNotice(const char* subject, { mInventoryOffer = inventory_offer; - LLString icon_name = get_item_icon_name(mInventoryOffer->mType, + std::string icon_name = get_item_icon_name(mInventoryOffer->mType, LLInventoryType::IT_TEXTURE, 0, FALSE); diff --git a/indra/newview/llpanelgroupnotices.h b/indra/newview/llpanelgroupnotices.h index aaac23fd98..96cb35a567 100644 --- a/indra/newview/llpanelgroupnotices.h +++ b/indra/newview/llpanelgroupnotices.h @@ -52,8 +52,8 @@ public: // LLPanelGroupTab static void* createTab(void* data); virtual void activate(); - //virtual bool needsApply(LLString& mesg); - //virtual bool apply(LLString& mesg); + //virtual bool needsApply(std::string& mesg); + //virtual bool apply(std::string& mesg); //virtual void update(); virtual BOOL postBuild(); @@ -63,11 +63,11 @@ public: static void processGroupNoticesListReply(LLMessageSystem* msg, void** data); - void showNotice(const char* subject, - const char* message, - const bool& has_inventory, - const char* inventory_name, - LLOfferInfo* inventory_offer); + void showNotice(const std::string& subject, + const std::string& message, + const bool& has_inventory, + const std::string& inventory_name, + LLOfferInfo* inventory_offer); private: static void onClickRemoveAttachment(void* data); diff --git a/indra/newview/llpanelgrouproles.cpp b/indra/newview/llpanelgrouproles.cpp index 5f11c4ac80..ba4153b087 100644 --- a/indra/newview/llpanelgrouproles.cpp +++ b/indra/newview/llpanelgrouproles.cpp @@ -228,7 +228,7 @@ void LLPanelGroupRoles::handleClickSubTab() BOOL LLPanelGroupRoles::attemptTransition() { // Check if the current tab needs to be applied. - LLString mesg; + std::string mesg; if (mCurrentTab && mCurrentTab->needsApply(mesg)) { // If no message was provided, give a generic one. @@ -237,7 +237,7 @@ BOOL LLPanelGroupRoles::attemptTransition() mesg = mDefaultNeedsApplyMesg; } // Create a notify box, telling the user about the unapplied tab. - LLString::format_map_t args; + LLStringUtil::format_map_t args; args["[NEEDS_APPLY_MESSAGE]"] = mesg; args["[WANT_APPLY_MESSAGE]"] = mWantApplyMesg; gViewerWindow->alertXml("PanelGroupApply", args, @@ -300,14 +300,14 @@ void LLPanelGroupRoles::handleNotifyCallback(S32 option) case 0: // "Apply Changes" { // Try to apply changes, and switch to the requested tab. - LLString apply_mesg; + std::string apply_mesg; if ( !apply( apply_mesg ) ) { // There was a problem doing the apply. if ( !apply_mesg.empty() ) { mHasModal = TRUE; - LLString::format_map_t args; + LLStringUtil::format_map_t args; args["[MESSAGE]"] = apply_mesg; gViewerWindow->alertXml("GenericAlert", args, onModalClose, (void*) this); } @@ -350,7 +350,7 @@ void LLPanelGroupRoles::onModalClose(S32 option, void* user_data) } -bool LLPanelGroupRoles::apply(LLString& mesg) +bool LLPanelGroupRoles::apply(std::string& mesg) { // Pass this along to the currently visible sub tab. if (!mSubTabContainer) return false; @@ -359,7 +359,7 @@ bool LLPanelGroupRoles::apply(LLString& mesg) if (!panelp) return false; // Ignore the needs apply message. - LLString ignore_mesg; + std::string ignore_mesg; if ( !panelp->needsApply(ignore_mesg) ) { // We don't need to apply anything. @@ -383,7 +383,7 @@ void LLPanelGroupRoles::cancel() } // Pass all of these messages to the currently visible sub tab. -LLString LLPanelGroupRoles::getHelpText() const +std::string LLPanelGroupRoles::getHelpText() const { LLPanelGroupTab* panelp = (LLPanelGroupTab*) mSubTabContainer->getCurrentPanel(); if (panelp) @@ -458,7 +458,7 @@ void LLPanelGroupRoles::deactivate() if (panelp) panelp->deactivate(); } -bool LLPanelGroupRoles::needsApply(LLString& mesg) +bool LLPanelGroupRoles::needsApply(std::string& mesg) { LLPanelGroupTab* panelp = (LLPanelGroupTab*) mSubTabContainer->getCurrentPanel(); if (!panelp) return false; @@ -606,15 +606,15 @@ void LLPanelGroupSubTab::onClickShowAll(void* user_data) void LLPanelGroupSubTab::handleClickShowAll() { lldebugs << "LLPanelGroupSubTab::handleClickShowAll()" << llendl; - setSearchFilter( LLString::null ); + setSearchFilter( LLStringUtil::null ); mShowAllButton->setEnabled(FALSE); } -void LLPanelGroupSubTab::setSearchFilter(const LLString& filter) +void LLPanelGroupSubTab::setSearchFilter(const std::string& filter) { lldebugs << "LLPanelGroupSubTab::setSearchFilter() ==> '" << filter << "'" << llendl; mSearchFilter = filter; - LLString::toLower(mSearchFilter); + LLStringUtil::toLower(mSearchFilter); update(GC_ALL); } @@ -656,7 +656,7 @@ bool LLPanelGroupSubTab::matchesActionSearchFilter(std::string action) // If the search filter is empty, everything passes. if (mSearchFilter.empty()) return true; - LLString::toLower(action); + LLStringUtil::toLower(action); std::string::size_type match = action.find(mSearchFilter); if (std::string::npos == match) @@ -1338,7 +1338,7 @@ void LLPanelGroupMembersSubTab::deactivate() LLPanelGroupSubTab::deactivate(); } -bool LLPanelGroupMembersSubTab::needsApply(LLString& mesg) +bool LLPanelGroupMembersSubTab::needsApply(std::string& mesg) { return mChanged; } @@ -1357,7 +1357,7 @@ void LLPanelGroupMembersSubTab::cancel() } } -bool LLPanelGroupMembersSubTab::apply(LLString& mesg) +bool LLPanelGroupMembersSubTab::apply(std::string& mesg) { LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID); if (!gdatap) @@ -1375,7 +1375,7 @@ bool LLPanelGroupMembersSubTab::apply(LLString& mesg) if ( mNumOwnerAdditions > 0 ) { LLRoleData rd; - LLStringBase<char>::format_map_t args; + LLStringUtil::format_map_t args; if ( gdatap->getRoleData(gdatap->mOwnerRole, rd) ) { @@ -1465,7 +1465,7 @@ bool LLPanelGroupMembersSubTab::matchesSearchFilter(const std::string& fullname) // Create a full name, and compare it to the search filter. std::string fullname_lc(fullname); - LLString::toLower(fullname_lc); + LLStringUtil::toLower(fullname_lc); std::string::size_type match = fullname_lc.find(mSearchFilter); @@ -1721,7 +1721,7 @@ void LLPanelGroupMembersSubTab::updateMembers() else { mMembersList->setEnabled(FALSE); - mMembersList->addCommentText("No match."); + mMembersList->addCommentText(std::string("No match.")); } } else @@ -1855,7 +1855,7 @@ void LLPanelGroupRolesSubTab::deactivate() LLPanelGroupSubTab::deactivate(); } -bool LLPanelGroupRolesSubTab::needsApply(LLString& mesg) +bool LLPanelGroupRolesSubTab::needsApply(std::string& mesg) { lldebugs << "LLPanelGroupRolesSubTab::needsApply()" << llendl; @@ -1865,7 +1865,7 @@ bool LLPanelGroupRolesSubTab::needsApply(LLString& mesg) || (gdatap && gdatap->pendingRoleChanges())); // Pending role changes in the group } -bool LLPanelGroupRolesSubTab::apply(LLString& mesg) +bool LLPanelGroupRolesSubTab::apply(std::string& mesg) { lldebugs << "LLPanelGroupRolesSubTab::apply()" << llendl; @@ -1910,8 +1910,8 @@ bool LLPanelGroupRolesSubTab::matchesSearchFilter(std::string rolename, std::str // If the search filter is empty, everything passes. if (mSearchFilter.empty()) return true; - LLString::toLower(rolename); - LLString::toLower(roletitle); + LLStringUtil::toLower(rolename); + LLStringUtil::toLower(roletitle); std::string::size_type match_name = rolename.find(mSearchFilter); std::string::size_type match_title = roletitle.find(mSearchFilter); @@ -1978,7 +1978,7 @@ void LLPanelGroupRolesSubTab::update(LLGroupChange gc) } } - mRolesList->sortByColumn("name", TRUE); + mRolesList->sortByColumn(std::string("name"), TRUE); if ( (gdatap->mRoles.size() < (U32)MAX_ROLES) && gAgent.hasPowerInGroup(mGroupID, GP_ROLE_CREATE) ) @@ -2216,7 +2216,7 @@ void LLPanelGroupRolesSubTab::handleActionCheck(LLCheckBoxCtrl* check, bool forc check->set(FALSE); LLRoleData rd; - LLStringBase<char>::format_map_t args; + LLStringUtil::format_map_t args; if ( gdatap->getRoleData(role_id, rd) ) { @@ -2226,7 +2226,7 @@ void LLPanelGroupRolesSubTab::handleActionCheck(LLCheckBoxCtrl* check, bool forc cb_data->mSelf = this; cb_data->mCheck = check; mHasModal = TRUE; - LLString warning = "AssignDangerousActionWarning"; + std::string warning = "AssignDangerousActionWarning"; if (GP_ROLE_CHANGE_ACTIONS == power) { warning = "AssignDangerousAbilityWarning"; @@ -2404,7 +2404,7 @@ void LLPanelGroupRolesSubTab::handleDeleteRole() if (role_item->getUUID().isNull() || role_item->getUUID() == gdatap->mOwnerRole) { - LLString::format_map_t args; + LLStringUtil::format_map_t args; args["[MESSAGE]"] = mRemoveEveryoneTxt; LLNotifyBox::showXml("GenericNotify", args); return; @@ -2511,14 +2511,14 @@ void LLPanelGroupActionsSubTab::deactivate() LLPanelGroupSubTab::deactivate(); } -bool LLPanelGroupActionsSubTab::needsApply(LLString& mesg) +bool LLPanelGroupActionsSubTab::needsApply(std::string& mesg) { lldebugs << "LLPanelGroupActionsSubTab::needsApply()" << llendl; return false; } -bool LLPanelGroupActionsSubTab::apply(LLString& mesg) +bool LLPanelGroupActionsSubTab::apply(std::string& mesg) { lldebugs << "LLPanelGroupActionsSubTab::apply()" << llendl; return true; diff --git a/indra/newview/llpanelgrouproles.h b/indra/newview/llpanelgrouproles.h index 8d16d613e9..f55d70f018 100644 --- a/indra/newview/llpanelgrouproles.h +++ b/indra/newview/llpanelgrouproles.h @@ -78,12 +78,12 @@ public: static void onModalClose(S32 option, void* user_data); // Most of these messages are just passed on to the current sub-tab. - virtual LLString getHelpText() const; + virtual std::string getHelpText() const; virtual void activate(); virtual void deactivate(); - virtual bool needsApply(LLString& mesg); + virtual bool needsApply(std::string& mesg); virtual BOOL hasModal(); - virtual bool apply(LLString& mesg); + virtual bool apply(std::string& mesg); virtual void cancel(); virtual void update(LLGroupChange gc); @@ -97,8 +97,8 @@ protected: BOOL mFirstUse; BOOL mIgnoreTransition; - LLString mDefaultNeedsApplyMesg; - LLString mWantApplyMesg; + std::string mDefaultNeedsApplyMesg; + std::string mWantApplyMesg; }; class LLPanelGroupSubTab : public LLPanelGroupTab @@ -120,7 +120,7 @@ public: static void onClickShowAll(void*); void handleClickShowAll(); - virtual void setSearchFilter( const LLString& filter ); + virtual void setSearchFilter( const std::string& filter ); virtual void activate(); virtual void deactivate(); @@ -154,7 +154,7 @@ protected: LLButton* mSearchButton; LLButton* mShowAllButton; - LLString mSearchFilter; + std::string mSearchFilter; icon_map_t mActionIcons; @@ -193,8 +193,8 @@ public: virtual void activate(); virtual void deactivate(); virtual void cancel(); - virtual bool needsApply(LLString& mesg); - virtual bool apply(LLString& mesg); + virtual bool needsApply(std::string& mesg); + virtual bool apply(std::string& mesg); virtual void update(LLGroupChange gc); void updateMembers(); @@ -238,8 +238,8 @@ public: virtual void activate(); virtual void deactivate(); - virtual bool needsApply(LLString& mesg); - virtual bool apply(LLString& mesg); + virtual bool needsApply(std::string& mesg); + virtual bool apply(std::string& mesg); virtual void cancel(); bool matchesSearchFilter(std::string rolename, std::string roletitle); virtual void update(LLGroupChange gc); @@ -302,8 +302,8 @@ public: virtual void activate(); virtual void deactivate(); - virtual bool needsApply(LLString& mesg); - virtual bool apply(LLString& mesg); + virtual bool needsApply(std::string& mesg); + virtual bool apply(std::string& mesg); virtual void update(LLGroupChange gc); static void onActionSelect(LLUICtrl*, void*); diff --git a/indra/newview/llpanelland.cpp b/indra/newview/llpanelland.cpp index a994a94fb7..f0afa3434e 100644 --- a/indra/newview/llpanelland.cpp +++ b/indra/newview/llpanelland.cpp @@ -120,8 +120,8 @@ void LLPanelLandInfo::refresh() childSetVisible("label_area_price",false); childSetVisible("label_area",false); - //mTextPrice->setText(LLString::null); - childSetText("textbox price",LLString::null); + //mTextPrice->setText(LLStringUtil::null); + childSetText("textbox price",LLStringUtil::null); childSetEnabled("button buy land",FALSE); childSetEnabled("button abandon land",FALSE); diff --git a/indra/newview/llpanellandmedia.cpp b/indra/newview/llpanellandmedia.cpp index 085cbfa7a0..34a4ad3954 100644 --- a/indra/newview/llpanellandmedia.cpp +++ b/indra/newview/llpanellandmedia.cpp @@ -66,7 +66,7 @@ enum //--------------------------------------------------------------------------- LLPanelLandMedia::LLPanelLandMedia(LLParcelSelectionHandle& parcel) -: LLPanel("land_media_panel"), mParcel(parcel) +: LLPanel(std::string("land_media_panel")), mParcel(parcel) { } @@ -170,7 +170,7 @@ void LLPanelLandMedia::refresh() mMediaURLEdit->setText(parcel->getMediaURL()); mMediaURLEdit->setEnabled( FALSE ); - mMediaDescEdit->setText(LLString(parcel->getMediaDesc())); + mMediaDescEdit->setText(parcel->getMediaDesc()); mMediaDescEdit->setEnabled( can_change_media ); std::string mime_type = parcel->getMediaType(); @@ -267,12 +267,12 @@ void LLPanelLandMedia::refresh() void LLPanelLandMedia::populateMIMECombo() { - LLString default_mime_type = "none/none"; - LLString default_label; + std::string default_mime_type = "none/none"; + std::string default_label; LLMIMETypes::mime_widget_set_map_t::const_iterator it; for (it = LLMIMETypes::sWidgetMap.begin(); it != LLMIMETypes::sWidgetMap.end(); ++it) { - const LLString& mime_type = it->first; + const std::string& mime_type = it->first; const LLMIMETypes::LLMIMEWidgetSet& info = it->second; if (info.mDefaultMimeType == default_mime_type) { @@ -289,24 +289,24 @@ void LLPanelLandMedia::populateMIMECombo() mMediaTypeCombo->add( default_label, default_mime_type, ADD_BOTTOM ); } -void LLPanelLandMedia::setMediaType(const LLString& mime_type) +void LLPanelLandMedia::setMediaType(const std::string& mime_type) { LLParcel *parcel = mParcel->getParcel(); if(parcel) - parcel->setMediaType(mime_type.c_str()); + parcel->setMediaType(mime_type); - LLString media_key = LLMIMETypes::widgetType(mime_type); + std::string media_key = LLMIMETypes::widgetType(mime_type); mMediaTypeCombo->setValue(media_key); childSetText("mime_type", mime_type); } -void LLPanelLandMedia::setMediaURL(const LLString& media_url) +void LLPanelLandMedia::setMediaURL(const std::string& media_url) { mMediaURLEdit->setText(media_url); mMediaURLEdit->onCommit(); } -LLString LLPanelLandMedia::getMediaURL() +std::string LLPanelLandMedia::getMediaURL() { return mMediaURLEdit->getText(); } @@ -374,17 +374,17 @@ void LLPanelLandMedia::onCommitAny(LLUICtrl*, void *userdata) } // Remove leading/trailing whitespace (common when copying/pasting) - LLString::trim(music_url); - LLString::trim(media_url); + LLStringUtil::trim(music_url); + LLStringUtil::trim(media_url); // Push data into current parcel parcel->setParcelFlag(PF_ALLOW_VOICE_CHAT, voice_enabled); parcel->setParcelFlag(PF_USE_ESTATE_VOICE_CHAN, voice_estate_chan); parcel->setParcelFlag(PF_SOUND_LOCAL, sound_local); - parcel->setMusicURL(music_url.c_str()); - parcel->setMediaURL(media_url.c_str()); - parcel->setMediaType(mime_type.c_str()); - parcel->setMediaDesc(media_desc.c_str()); + parcel->setMusicURL(music_url); + parcel->setMediaURL(media_url); + parcel->setMediaType(mime_type); + parcel->setMediaDesc(media_desc); parcel->setMediaWidth(media_width); parcel->setMediaHeight(media_height); parcel->setMediaID(media_id); diff --git a/indra/newview/llpanellandmedia.h b/indra/newview/llpanellandmedia.h index e22e49ca35..4810a0a94c 100644 --- a/indra/newview/llpanellandmedia.h +++ b/indra/newview/llpanellandmedia.h @@ -46,9 +46,9 @@ public: /*virtual*/ ~LLPanelLandMedia(); /*virtual*/ BOOL postBuild(); void refresh(); - void setMediaType(const LLString& media_type); - void setMediaURL(const LLString& media_type); - LLString getMediaURL(); + void setMediaType(const std::string& media_type); + void setMediaURL(const std::string& media_type); + std::string getMediaURL(); private: void populateMIMECombo(); diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index a3526dff21..c252c54ad7 100644 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -79,7 +79,7 @@ #define USE_VIEWER_AUTH 0 -LLString load_password_from_disk(void); +std::string load_password_from_disk(void); void save_password_to_disk(const char* hashed_password); const S32 BLACK_BORDER_HEIGHT = 160; @@ -204,7 +204,7 @@ void LLLoginHandler::parse(const LLSD& queryMap) LLViewerLogin::getInstance()->setGridChoice(grid_choice); } - LLString startLocation = queryMap["location"].asString(); + std::string startLocation = queryMap["location"].asString(); if (startLocation == "specify") { @@ -213,12 +213,12 @@ void LLLoginHandler::parse(const LLSD& queryMap) else if (startLocation == "home") { gSavedSettings.setBOOL("LoginLastLocation", FALSE); - LLURLSimString::setString(""); + LLURLSimString::setString(LLStringUtil::null); } else if (startLocation == "last") { gSavedSettings.setBOOL("LoginLastLocation", TRUE); - LLURLSimString::setString(""); + LLURLSimString::setString(LLStringUtil::null); } } @@ -234,7 +234,7 @@ bool LLLoginHandler::handle(const LLSD& tokens, return true; } - LLString password = queryMap["password"].asString(); + std::string password = queryMap["password"].asString(); if (!password.empty()) { @@ -245,7 +245,7 @@ bool LLLoginHandler::handle(const LLSD& tokens, LLMD5 pass((unsigned char*)password.c_str()); char md5pass[33]; /* Flawfinder: ignore */ pass.hex_digest(md5pass); - password = md5pass; + password = ll_safe_string(md5pass, 32); save_password_to_disk(password.c_str()); } } @@ -324,7 +324,7 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect, BOOL show_server, void (*callback)(S32 option, void* user_data), void *cb_data) -: LLPanel("panel_login", LLRect(0,600,800,0), FALSE), // not bordered +: LLPanel(std::string("panel_login"), LLRect(0,600,800,0), FALSE), // not bordered mLogoImage(), mCallback(callback), mCallbackData(cb_data), @@ -386,7 +386,7 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect, // 2 - "<Type region name>" BOOL login_last = gSavedSettings.getBOOL("LoginLastLocation"); - LLString sim_string = LLURLSimString::sInstance.mSimString; + std::string sim_string = LLURLSimString::sInstance.mSimString; if (!sim_string.empty()) { // Replace "<Type region name>" with this region name @@ -415,7 +415,7 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect, childSetAction("quit_btn", onClickQuit, this); LLTextBox* version_text = getChild<LLTextBox>("version_text"); - LLString version = llformat("%d.%d.%d (%d)", + std::string version = llformat("%d.%d.%d (%d)", LL_VERSION_MAJOR, LL_VERSION_MINOR, LL_VERSION_PATCH, @@ -744,7 +744,7 @@ void LLPanelLogin::setFields(const std::string& firstname, const std::string& la // static -void LLPanelLogin::addServer(const char *server, S32 domain_name) +void LLPanelLogin::addServer(const std::string& server, S32 domain_name) { if (!sInstance) { @@ -758,7 +758,7 @@ void LLPanelLogin::addServer(const char *server, S32 domain_name) } // static -void LLPanelLogin::getFields(LLString &firstname, LLString &lastname, LLString &password, +void LLPanelLogin::getFields(std::string &firstname, std::string &lastname, std::string &password, BOOL &remember) { if (!sInstance) @@ -768,10 +768,10 @@ void LLPanelLogin::getFields(LLString &firstname, LLString &lastname, LLString & } firstname = sInstance->childGetText("first_name_edit"); - LLString::trim(firstname); + LLStringUtil::trim(firstname); lastname = sInstance->childGetText("last_name_edit"); - LLString::trim(lastname); + LLStringUtil::trim(lastname); password = sInstance->mMungedPassword; remember = sInstance->childGetValue("remember_check"); @@ -779,7 +779,7 @@ void LLPanelLogin::getFields(LLString &firstname, LLString &lastname, LLString & // static. Return TRUE if user made a choice from the popup -BOOL LLPanelLogin::getServer(LLString &server, S32 &domain_name) +BOOL LLPanelLogin::getServer(std::string &server, S32 &domain_name) { BOOL user_picked = FALSE; if (!sInstance) @@ -812,7 +812,7 @@ BOOL LLPanelLogin::getServer(LLString &server, S32 &domain_name) } // static -void LLPanelLogin::getLocation(LLString &location) +void LLPanelLogin::getLocation(std::string &location) { if (!sInstance) { @@ -914,7 +914,7 @@ void LLPanelLogin::loadLoginPage() } // Language - LLString language(gSavedSettings.getString("Language")); + std::string language(gSavedSettings.getString("Language")); if(language == "default") { language = gSavedSettings.getString("SystemLanguage"); @@ -928,7 +928,7 @@ void LLPanelLogin::loadLoginPage() } // Channel and Version - LLString version = llformat("%d.%d.%d (%d)", + std::string version = llformat("%d.%d.%d (%d)", LL_VERSION_MAJOR, LL_VERSION_MINOR, LL_VERSION_PATCH, LL_VIEWER_BUILD); char* curl_channel = curl_escape(gSavedSettings.getString("VersionChannelName").c_str(), 0); @@ -941,7 +941,7 @@ void LLPanelLogin::loadLoginPage() curl_free(curl_version); // Grid - LLString grid; + std::string grid; S32 grid_index; getServer( grid, grid_index ); @@ -958,9 +958,9 @@ void LLPanelLogin::loadLoginPage() #if USE_VIEWER_AUTH LLURLSimString::sInstance.parse(); - LLString location; - LLString region; - LLString password; + std::string location; + std::string region; + std::string password; if (LLURLSimString::parse()) { @@ -983,7 +983,7 @@ void LLPanelLogin::loadLoginPage() } } - LLString firstname, lastname; + std::string firstname, lastname; if(gSavedSettings.getLLSD("UserLoginInfo").size() == 3) { @@ -1076,8 +1076,8 @@ void LLPanelLogin::onClickConnect(void *) // JC - Make sure the fields all get committed. sInstance->setFocus(FALSE); - LLString first = sInstance->childGetText("first_name_edit"); - LLString last = sInstance->childGetText("last_name_edit"); + std::string first = sInstance->childGetText("first_name_edit"); + std::string last = sInstance->childGetText("last_name_edit"); if (!first.empty() && !last.empty()) { // has both first and last name typed @@ -1167,7 +1167,7 @@ void LLPanelLogin::onSelectServer(LLUICtrl*, void*) { // The user twiddled with the grid choice ui. // apply the selection to the grid setting. - LLString grid; + std::string grid; S32 grid_index; getServer( grid, grid_index ); diff --git a/indra/newview/llpanellogin.h b/indra/newview/llpanellogin.h index 6a1b5d7758..69bf54ecc4 100644 --- a/indra/newview/llpanellogin.h +++ b/indra/newview/llpanellogin.h @@ -58,8 +58,8 @@ class LLLoginHandler : public LLCommandHandler void parse(const LLSD& queryMap); LLUUID mWebLoginKey; - LLString mFirstName; - LLString mLastName; + std::string mFirstName; + std::string mLastName; }; extern LLLoginHandler gLoginHandler; @@ -86,14 +86,14 @@ public: static void setFields(const std::string& firstname, const std::string& lastname, const std::string& password, BOOL remember); - static void addServer(const char *server, S32 domain_name); + static void addServer(const std::string& server, S32 domain_name); static void refreshLocation( bool force_visible ); - static void getFields(LLString &firstname, LLString &lastname, - LLString &password, BOOL &remember); + static void getFields(std::string& firstname, std::string& lastname, + std::string& password, BOOL& remember); - static BOOL getServer(LLString &server, S32& domain_name); - static void getLocation(LLString &location); + static BOOL getServer(std::string& server, S32& domain_name); + static void getLocation(std::string& location); static void close(); diff --git a/indra/newview/llpanelobject.cpp b/indra/newview/llpanelobject.cpp index 62115be473..b181aff62d 100644 --- a/indra/newview/llpanelobject.cpp +++ b/indra/newview/llpanelobject.cpp @@ -99,7 +99,7 @@ enum { }; //*TODO:translate (depricated, so very low priority) -static const LLString LEGACY_FULLBRIGHT_DESC("Fullbright (Legacy)"); +static const std::string LEGACY_FULLBRIGHT_DESC("Fullbright (Legacy)"); BOOL LLPanelObject::postBuild() { @@ -429,7 +429,7 @@ void LLPanelObject::getState( ) BOOL owners_identical; LLUUID owner_id; - LLString owner_name; + std::string owner_name; owners_identical = LLSelectMgr::getInstance()->selectGetOwner(owner_id, owner_name); // BUG? Check for all objects being editable? @@ -538,7 +538,7 @@ void LLPanelObject::getState( ) mComboMaterial->remove(LEGACY_FULLBRIGHT_DESC); } // *TODO:Translate - mComboMaterial->setSimple(LLString(LLMaterialTable::basic.getName(material_code))); + mComboMaterial->setSimple(std::string(LLMaterialTable::basic.getName(material_code))); } } else @@ -1191,10 +1191,10 @@ void LLPanelObject::onCommitMaterial( LLUICtrl* ctrl, void* userdata ) if (box) { // apply the currently selected material to the object - const LLString& material_name = box->getSimple(); + const std::string& material_name = box->getSimple(); if (material_name != LEGACY_FULLBRIGHT_DESC) { - U8 material_code = LLMaterialTable::basic.getMCode(material_name.c_str()); + U8 material_code = LLMaterialTable::basic.getMCode(material_name); LLSelectMgr::getInstance()->selectionSetMaterial(material_code); } } diff --git a/indra/newview/llpanelpermissions.cpp b/indra/newview/llpanelpermissions.cpp index ae0b9c2811..3dab6e62c6 100644 --- a/indra/newview/llpanelpermissions.cpp +++ b/indra/newview/llpanelpermissions.cpp @@ -135,7 +135,7 @@ void LLPanelPermissions::refresh() LLButton* BtnDeedToGroup = getChild<LLButton>("button deed"); if(BtnDeedToGroup) { - LLString deedText; + std::string deedText; if (gSavedSettings.getWarning("DeedObject")) { deedText = getString("text deed continued"); @@ -165,33 +165,33 @@ void LLPanelPermissions::refresh() { // ...nothing selected childSetEnabled("perm_modify",false); - childSetText("perm_modify",LLString::null); + childSetText("perm_modify",LLStringUtil::null); childSetEnabled("Creator:",false); - childSetText("Creator Name",LLString::null); + childSetText("Creator Name",LLStringUtil::null); childSetEnabled("Creator Name",false); childSetEnabled("button creator profile",false); childSetEnabled("Owner:",false); - childSetText("Owner Name",LLString::null); + childSetText("Owner Name",LLStringUtil::null); childSetEnabled("Owner Name",false); childSetEnabled("button owner profile",false); childSetEnabled("Group:",false); - childSetText("Group Name",LLString::null); + childSetText("Group Name",LLStringUtil::null); childSetEnabled("Group Name",false); childSetEnabled("button set group",false); - childSetText("Object Name",LLString::null); + childSetText("Object Name",LLStringUtil::null); childSetEnabled("Object Name",false); childSetEnabled("Name:",false); - childSetText("Group Name",LLString::null); + childSetText("Group Name",LLStringUtil::null); childSetEnabled("Group Name",false); childSetEnabled("Description:",false); - childSetText("Object Description",LLString::null); + childSetText("Object Description",LLStringUtil::null); childSetEnabled("Object Description",false); - childSetText("prim info",LLString::null); + childSetText("prim info",LLStringUtil::null); childSetEnabled("prim info",false); childSetEnabled("Permissions:",false); @@ -231,7 +231,7 @@ void LLPanelPermissions::refresh() childSetEnabled("Cost",false); childSetText("Cost",getString("Cost Default")); - childSetText("Edit Cost",LLString::null); + childSetText("Edit Cost",LLStringUtil::null); childSetEnabled("Edit Cost",false); childSetEnabled("label click action",false); @@ -260,7 +260,7 @@ void LLPanelPermissions::refresh() || LLSelectMgr::getInstance()->selectGetModify(); const LLView* keyboard_focus_view = gFocusMgr.getKeyboardFocus(); S32 string_index = 0; - LLString MODIFY_INFO_STRINGS[] = + std::string MODIFY_INFO_STRINGS[] = { getString("text modify info 1"), getString("text modify info 2"), @@ -283,7 +283,7 @@ void LLPanelPermissions::refresh() // Update creator text field childSetEnabled("Creator:",true); BOOL creators_identical; - LLString creator_name; + std::string creator_name; creators_identical = LLSelectMgr::getInstance()->selectGetCreator(mCreatorID, creator_name); @@ -295,7 +295,7 @@ void LLPanelPermissions::refresh() childSetEnabled("Owner:",true); BOOL owners_identical; - LLString owner_name; + std::string owner_name; owners_identical = LLSelectMgr::getInstance()->selectGetOwner(mOwnerID, owner_name); // llinfos << "owners_identical " << (owners_identical ? "TRUE": "FALSE") << llendl; @@ -309,7 +309,7 @@ void LLPanelPermissions::refresh() else { // Display last owner if public - LLString last_owner_name; + std::string last_owner_name; LLSelectMgr::getInstance()->selectGetLastOwner(mLastOwnerID, last_owner_name); // It should never happen that the last owner is null and the owner @@ -328,7 +328,7 @@ void LLPanelPermissions::refresh() // update group text field childSetEnabled("Group:",true); - childSetText("Group Name",LLString::null); + childSetText("Group Name",LLStringUtil::null); LLUUID group_id; BOOL groups_identical = LLSelectMgr::getInstance()->selectGetGroup(group_id); if (groups_identical) @@ -344,7 +344,7 @@ void LLPanelPermissions::refresh() if(mLabelGroupName) { mLabelGroupName->setNameID(LLUUID::null, TRUE); - mLabelGroupName->refresh(LLUUID::null, "", "", TRUE); + mLabelGroupName->refresh(LLUUID::null, LLStringUtil::null, LLStringUtil::null, TRUE); mLabelGroupName->setEnabled(FALSE); } } @@ -393,16 +393,14 @@ void LLPanelPermissions::refresh() S32 prim_count = LLSelectMgr::getInstance()->getSelection()->getObjectCount(); S32 obj_count = LLSelectMgr::getInstance()->getSelection()->getRootObjectCount(); - LLString object_info_string; + std::string object_info_string; if (1 == obj_count) { object_info_string.assign("1 Object, "); } else { - char buffer[MAX_STRING]; /*Flawfinder: ignore*/ - snprintf(buffer, MAX_STRING, "%d Objects, ", obj_count); /* Flawfinder: ignore */ - object_info_string.assign(buffer); + object_info_string = llformat( "%d Objects, ", obj_count); } if (1 == prim_count) { @@ -410,8 +408,8 @@ void LLPanelPermissions::refresh() } else { - char buffer[MAX_STRING]; /*Flawfinder: ignore*/ - snprintf(buffer, MAX_STRING, "%d Primitives", prim_count); /* Flawfinder: ignore */ + std::string buffer; + buffer = llformat( "%d Primitives", prim_count); object_info_string.append(buffer); } childSetText("prim info",object_info_string); @@ -437,7 +435,7 @@ void LLPanelPermissions::refresh() if(!owners_identical) { childSetEnabled("Cost",false); - childSetText("Edit Cost",LLString::null); + childSetText("Edit Cost",LLStringUtil::null); childSetEnabled("Edit Cost",false); } // You own these objects. @@ -487,7 +485,7 @@ void LLPanelPermissions::refresh() if (num_for_sale) childSetText("Edit Cost",llformat("%d",total_sale_price)); else - childSetText("Edit Cost",LLString::null); + childSetText("Edit Cost",LLStringUtil::null); // If multiple items are for sale, set text to TOTAL PRICE. if (num_for_sale > 1) @@ -501,7 +499,7 @@ void LLPanelPermissions::refresh() childSetEnabled("Cost",false); childSetText("Cost",getString("Cost Default")); - childSetText("Edit Cost",LLString::null); + childSetText("Edit Cost",LLStringUtil::null); childSetEnabled("Edit Cost",false); } @@ -871,7 +869,7 @@ void LLPanelPermissions::onClickGroup(void* data) { LLPanelPermissions* panelp = (LLPanelPermissions*)data; LLUUID owner_id; - LLString name; + std::string name; BOOL owners_identical = LLSelectMgr::getInstance()->selectGetOwner(owner_id, name); LLFloater* parent_floater = gFloaterView->getParentFloater(panelp); @@ -1056,11 +1054,11 @@ void LLPanelPermissions::setAllSaleInfo() if (editPrice) { // Don't extract the price if it's labeled as MIXED or is empty. - const char *editPriceString = editPrice->getText().c_str(); - if (0 != strcmp(editPriceString,getString("Cost Mixed").c_str()) && - 0 != strcmp(editPriceString,"")) + const std::string& editPriceString = editPrice->getText(); + if (editPriceString != getString("Cost Mixed") && + !editPriceString.empty()) { - price = atoi(editPriceString); + price = atoi(editPriceString.c_str()); } else { diff --git a/indra/newview/llpanelpick.cpp b/indra/newview/llpanelpick.cpp index 674515273b..9bd118fa1d 100644 --- a/indra/newview/llpanelpick.cpp +++ b/indra/newview/llpanelpick.cpp @@ -63,7 +63,7 @@ std::list<LLPanelPick*> LLPanelPick::sAllPanels; LLPanelPick::LLPanelPick(BOOL top_pick) -: LLPanel("Top Picks Panel"), +: LLPanel(std::string("Top Picks Panel")), mTopPick(top_pick), mPickID(), mCreatorID(), @@ -292,33 +292,33 @@ void LLPanelPick::processPickInfoReply(LLMessageSystem *msg, void **) LLUUID parcel_id; msg->getUUID("Data", "ParcelID", parcel_id); - char name[DB_PARCEL_NAME_SIZE]; /*Flawfinder: ignore*/ - msg->getString("Data", "Name", DB_PARCEL_NAME_SIZE, name); + std::string name; + msg->getString("Data", "Name", name); - char desc[DB_PICK_DESC_SIZE]; /*Flawfinder: ignore*/ - msg->getString("Data", "Desc", DB_PICK_DESC_SIZE, desc); + std::string desc; + msg->getString("Data", "Desc", desc); LLUUID snapshot_id; msg->getUUID("Data", "SnapshotID", snapshot_id); // "Location text" is actually the owner name, the original // name that owner gave the parcel, and the location. - char buffer[256]; /*Flawfinder: ignore*/ - LLString location_text; - - msg->getString("Data", "User", 256, buffer); - location_text.assign(buffer); + std::string location_text; + msg->getString("Data", "User", location_text); location_text.append(", "); - msg->getString("Data", "OriginalName", 256, buffer); - if (buffer[0] != '\0') + std::string original_name; + msg->getString("Data", "OriginalName", original_name); + if (!original_name.empty()) { - location_text.append(buffer); + location_text.append(original_name); location_text.append(", "); } - char sim_name[256]; /*Flawfinder: ignore*/ - msg->getString("Data", "SimName", 256, sim_name); + std::string sim_name; + msg->getString("Data", "SimName", sim_name); + location_text.append(sim_name); + location_text.append(" "); LLVector3d pos_global; msg->getVector3d("Data", "PosGlobal", pos_global); @@ -327,7 +327,7 @@ void LLPanelPick::processPickInfoReply(LLMessageSystem *msg, void **) S32 region_y = llround((F32)pos_global.mdV[VY]) % REGION_WIDTH_UNITS; S32 region_z = llround((F32)pos_global.mdV[VZ]); - location_text.append(llformat("%s (%d, %d, %d)", sim_name, region_x, region_y, region_z)); + location_text.append(llformat("(%d, %d, %d)", region_x, region_y, region_z)); S32 sort_order; msg->getS32("Data", "SortOrder", sort_order); @@ -355,8 +355,8 @@ void LLPanelPick::processPickInfoReply(LLMessageSystem *msg, void **) self->mPosGlobal = pos_global; // Update UI controls - self->mNameEditor->setText(LLString(name)); - self->mDescEditor->setText(LLString(desc)); + self->mNameEditor->setText(std::string(name)); + self->mDescEditor->setText(std::string(desc)); self->mSnapshotCtrl->setImageAssetID(snapshot_id); self->mLocationEditor->setText(location_text); self->mEnabledCheck->set(enabled); @@ -448,7 +448,7 @@ void LLPanelPick::onClickMap(void* data) void LLPanelPick::onClickLandmark(void* data) { LLPanelPick* self = (LLPanelPick*)data; - create_landmark(self->mNameEditor->getText().c_str(), "", self->mPosGlobal); + create_landmark(self->mNameEditor->getText(), "", self->mPosGlobal); } */ @@ -460,7 +460,7 @@ void LLPanelPick::onClickSet(void* data) // Save location for later. self->mPosGlobal = gAgent.getPositionGlobal(); - LLString location_text; + std::string location_text; location_text.assign("(will update after save)"); location_text.append(", "); @@ -500,7 +500,7 @@ void LLPanelPick::onCommitAny(LLUICtrl* ctrl, void* data) /*if (self->mTopPick) { LLPanelDirPicks* panel = (LLPanelDirPicks*)self->getParent(); - panel->renamePick(self->mPickID, self->mNameEditor->getText().c_str()); + panel->renamePick(self->mPickID, self->mNameEditor->getText()); } else {*/ diff --git a/indra/newview/llpanelpick.h b/indra/newview/llpanelpick.h index d0ab562e46..953021934b 100644 --- a/indra/newview/llpanelpick.h +++ b/indra/newview/llpanelpick.h @@ -103,7 +103,7 @@ protected: BOOL mDataRequested; BOOL mDataReceived; - LLString mSimName; + std::string mSimName; LLVector3d mPosGlobal; LLTextureCtrl* mSnapshotCtrl; diff --git a/indra/newview/llpanelplace.cpp b/indra/newview/llpanelplace.cpp index 9985486170..963394b749 100644 --- a/indra/newview/llpanelplace.cpp +++ b/indra/newview/llpanelplace.cpp @@ -61,7 +61,7 @@ std::list<LLPanelPlace*> LLPanelPlace::sAllPanels; LLPanelPlace::LLPanelPlace() -: LLPanel("Places Panel"), +: LLPanel(std::string("Places Panel")), mParcelID(), mRequestedID(), mRegionID(), @@ -91,7 +91,7 @@ BOOL LLPanelPlace::postBuild() mNameEditor = getChild<LLTextBox>("name_editor"); // Text boxes appear to have a " " in them by default. This breaks the // emptiness test for filling in data from the network. Slam to empty. - mNameEditor->setText( LLString::null ); + mNameEditor->setText( LLStringUtil::null ); mDescEditor = getChild<LLTextEditor>("desc_editor"); @@ -144,10 +144,10 @@ void LLPanelPlace::resetLocation() mPosGlobal.clearVec(); mPosRegion.clearVec(); mAuctionID = 0; - mNameEditor->setText( LLString::null ); - mDescEditor->setText( LLString::null ); - mInfoEditor->setText( LLString::null ); - mLocationEditor->setText( LLString::null ); + mNameEditor->setText( LLStringUtil::null ); + mDescEditor->setText( LLStringUtil::null ); + mInfoEditor->setText( LLStringUtil::null ); + mLocationEditor->setText( LLStringUtil::null ); } void LLPanelPlace::setParcelID(const LLUUID& parcel_id) @@ -187,7 +187,7 @@ void LLPanelPlace::sendParcelInfoRequest() void LLPanelPlace::setErrorStatus(U32 status, const std::string& reason) { // We only really handle 404 and 499 errors - LLString error_text; + std::string error_text; if(status == 404) { error_text = getString("server_error_text"); @@ -205,15 +205,15 @@ void LLPanelPlace::processParcelInfoReply(LLMessageSystem *msg, void **) LLUUID agent_id; LLUUID parcel_id; LLUUID owner_id; - char name[MAX_STRING]; /*Flawfinder: ignore*/ - char desc[MAX_STRING]; /*Flawfinder: ignore*/ + std::string name; + std::string desc; S32 actual_area; S32 billable_area; U8 flags; F32 global_x; F32 global_y; F32 global_z; - char sim_name[MAX_STRING]; /*Flawfinder: ignore*/ + std::string sim_name; LLUUID snapshot_id; F32 dwell; S32 sale_price; @@ -232,15 +232,15 @@ void LLPanelPlace::processParcelInfoReply(LLMessageSystem *msg, void **) } msg->getUUID ("Data", "OwnerID", owner_id); - msg->getString ("Data", "Name", MAX_STRING, name); - msg->getString ("Data", "Desc", MAX_STRING, desc); + msg->getString ("Data", "Name", name); + msg->getString ("Data", "Desc", desc); msg->getS32 ("Data", "ActualArea", actual_area); msg->getS32 ("Data", "BillableArea", billable_area); msg->getU8 ("Data", "Flags", flags); msg->getF32 ("Data", "GlobalX", global_x); msg->getF32 ("Data", "GlobalY", global_y); msg->getF32 ("Data", "GlobalZ", global_z); - msg->getString ("Data", "SimName", MAX_STRING, sim_name); + msg->getString ("Data", "SimName", sim_name); msg->getUUID ("Data", "SnapshotID", snapshot_id); msg->getF32 ("Data", "Dwell", dwell); msg->getS32 ("Data", "SalePrice", sale_price); @@ -256,22 +256,20 @@ void LLPanelPlace::processParcelInfoReply(LLMessageSystem *msg, void **) // Only assign the name and description if they are not empty and there is not a // value present (passed in from a landmark, e.g.) - std::string name_str(name); - std::string desc_str(desc); - if( !name_str.empty() + if( !name.empty() && self->mNameEditor && self->mNameEditor->getText().empty()) { - self->mNameEditor->setText(name_str); + self->mNameEditor->setText(name); } - if( !desc_str.empty() + if( !desc.empty() && self->mDescEditor && self->mDescEditor->getText().empty()) { - self->mDescEditor->setText(desc_str); + self->mDescEditor->setText(desc); } - LLString info_text; + std::string info_text; LLUIString traffic = self->getUIString("traffic_text"); traffic.setArg("[TRAFFIC]", llformat("%d ", (int)dwell)); info_text = traffic; @@ -296,7 +294,7 @@ void LLPanelPlace::processParcelInfoReply(LLMessageSystem *msg, void **) } // HACK: Flag 0x1 == mature region, otherwise assume PG - const char* rating = LLViewerRegion::accessToString(SIM_ACCESS_PG); + std::string rating = LLViewerRegion::accessToString(SIM_ACCESS_PG); if (flags & 0x1) { rating = LLViewerRegion::accessToString(SIM_ACCESS_MATURE); @@ -320,8 +318,8 @@ void LLPanelPlace::processParcelInfoReply(LLMessageSystem *msg, void **) self->mPosGlobal.setVec(global_x, global_y, global_z); } - LLString location = llformat("%s %d, %d, %d (%s)", - sim_name, region_x, region_y, region_z, rating); + std::string location = llformat("%s %d, %d, %d (%s)", + sim_name.c_str(), region_x, region_y, region_z, rating.c_str()); if (self->mLocationEditor) { self->mLocationEditor->setText(location); @@ -430,8 +428,8 @@ void LLPanelPlace::callbackAuctionWebPage(S32 option, void* data) if (0 == option) { - char url[256]; /*Flawfinder: ignore*/ - snprintf(url, sizeof(url), "%s%010d", AUCTION_URL, self->mAuctionID); /* Flawfinder: ignore */ + std::string url; + url = AUCTION_URL + llformat( "%010d", self->mAuctionID); llinfos << "Loading auction page " << url << llendl; diff --git a/indra/newview/llpanelvolume.cpp b/indra/newview/llpanelvolume.cpp index c96f35d8dd..7681514257 100644 --- a/indra/newview/llpanelvolume.cpp +++ b/indra/newview/llpanelvolume.cpp @@ -182,7 +182,7 @@ void LLPanelVolume::getState( ) BOOL owners_identical; LLUUID owner_id; - LLString owner_name; + std::string owner_name; owners_identical = LLSelectMgr::getInstance()->selectGetOwner(owner_id, owner_name); // BUG? Check for all objects being editable? diff --git a/indra/newview/llpolymesh.cpp b/indra/newview/llpolymesh.cpp index 64315e9e30..fef4726b12 100644 --- a/indra/newview/llpolymesh.cpp +++ b/indra/newview/llpolymesh.cpp @@ -261,12 +261,12 @@ BOOL LLPolyMeshSharedData::allocateJointNames( U32 numJointNames ) //-------------------------------------------------------------------- // LLPolyMeshSharedData::loadMesh() //-------------------------------------------------------------------- -BOOL LLPolyMeshSharedData::loadMesh( const char *fileName ) +BOOL LLPolyMeshSharedData::loadMesh( const std::string& fileName ) { //------------------------------------------------------------------------- // Open the file //------------------------------------------------------------------------- - if(!fileName) + if(fileName.empty()) { llerrs << "Filename is Empty!" << llendl; return FALSE; @@ -595,7 +595,7 @@ BOOL LLPolyMeshSharedData::loadMesh( const char *fileName ) // we reached the end of the morphs break; } - LLPolyMorphData* morph_data = new LLPolyMorphData(morphName); + LLPolyMorphData* morph_data = new LLPolyMorphData(std::string(morphName)); BOOL result = morph_data->loadBinary(fp, this); @@ -761,7 +761,7 @@ LLPolyMesh::~LLPolyMesh() //----------------------------------------------------------------------------- // LLPolyMesh::getMesh() //----------------------------------------------------------------------------- -LLPolyMesh *LLPolyMesh::getMesh(const LLString &name, LLPolyMesh* reference_mesh) +LLPolyMesh *LLPolyMesh::getMesh(const std::string &name, LLPolyMesh* reference_mesh) { //------------------------------------------------------------------------- // search for an existing mesh by this name @@ -777,8 +777,8 @@ LLPolyMesh *LLPolyMesh::getMesh(const LLString &name, LLPolyMesh* reference_mesh //------------------------------------------------------------------------- // if not found, create a new one, add it to the list //------------------------------------------------------------------------- - char full_path[LL_MAX_PATH]; /*Flawfinder: ignore*/ - snprintf(full_path, LL_MAX_PATH, "%s", (gDirUtilp->getExpandedFilename(LL_PATH_CHARACTER,name.c_str())).c_str()); /* Flawfinder: ignore */ + std::string full_path; + full_path = gDirUtilp->getExpandedFilename(LL_PATH_CHARACTER,name); LLPolyMeshSharedData *mesh_data = new LLPolyMeshSharedData(); if (reference_mesh) @@ -935,7 +935,7 @@ void LLPolyMesh::initializeForMorph() //----------------------------------------------------------------------------- // getMorphData() //----------------------------------------------------------------------------- -LLPolyMorphData* LLPolyMesh::getMorphData(const char *morph_name) +LLPolyMorphData* LLPolyMesh::getMorphData(const std::string& morph_name) { if (!mSharedData) return NULL; @@ -943,7 +943,7 @@ LLPolyMorphData* LLPolyMesh::getMorphData(const char *morph_name) iter != mSharedData->mMorphData.end(); ++iter) { LLPolyMorphData *morph_data = *iter; - if (!strcmp(morph_data->getName(), morph_name)) + if (morph_data->getName() == morph_name) { return morph_data; } @@ -1009,7 +1009,7 @@ BOOL LLPolySkeletalDistortionInfo::parseXml(LLXmlTreeNode* node) { if (bone->hasName("bone")) { - LLString name; + std::string name; LLVector3 scale; LLVector3 pos; BOOL haspos = FALSE; diff --git a/indra/newview/llpolymesh.h b/indra/newview/llpolymesh.h index 32e500e19d..2af9cbafae 100644 --- a/indra/newview/llpolymesh.h +++ b/indra/newview/llpolymesh.h @@ -134,7 +134,7 @@ private: U32 getNumKB(); // Load mesh data from file - BOOL loadMesh( const char *fileName ); + BOOL loadMesh( const std::string& fileName ); public: void genIndices(S32 offset); @@ -171,7 +171,7 @@ public: // Requests a mesh by name. // If the mesh already exists in the global mesh table, it is returned, // otherwise it is loaded from file, added to the table, and returned. - static LLPolyMesh *getMesh( const LLString &name, LLPolyMesh* reference_mesh = NULL); + static LLPolyMesh *getMesh( const std::string &name, LLPolyMesh* reference_mesh = NULL); // Frees all loaded meshes. // This should only be called once you know there are no outstanding @@ -311,7 +311,7 @@ public: return mSharedData->mJointNames; } - LLPolyMorphData* getMorphData(const char *morph_name); + LLPolyMorphData* getMorphData(const std::string& morph_name); // void removeMorphData(LLPolyMorphData *morph_target); // void deleteAllMorphData(); @@ -362,7 +362,7 @@ protected: LLPolyMesh *mReferenceMesh; // global mesh list - typedef std::map<LLString, LLPolyMeshSharedData*> LLPolyMeshSharedDataTable; + typedef std::map<std::string, LLPolyMeshSharedData*> LLPolyMeshSharedDataTable; static LLPolyMeshSharedDataTable sGlobalSharedMeshList; // Backlink only; don't make this an LLPointer. @@ -375,12 +375,12 @@ protected: //----------------------------------------------------------------------------- struct LLPolySkeletalBoneInfo { - LLPolySkeletalBoneInfo(LLString &name, LLVector3 &scale, LLVector3 &pos, BOOL haspos) + LLPolySkeletalBoneInfo(std::string &name, LLVector3 &scale, LLVector3 &pos, BOOL haspos) : mBoneName(name), mScaleDeformation(scale), mPositionDeformation(pos), mHasPositionDeformation(haspos) {} - LLString mBoneName; + std::string mBoneName; LLVector3 mScaleDeformation; LLVector3 mPositionDeformation; BOOL mHasPositionDeformation; diff --git a/indra/newview/llpolymorph.cpp b/indra/newview/llpolymorph.cpp index 572a495f70..eafd8201ce 100644 --- a/indra/newview/llpolymorph.cpp +++ b/indra/newview/llpolymorph.cpp @@ -46,13 +46,9 @@ const F32 NORMAL_SOFTEN_FACTOR = 0.65f; //----------------------------------------------------------------------------- // LLPolyMorphData() //----------------------------------------------------------------------------- -LLPolyMorphData::LLPolyMorphData(char *morph_name) +LLPolyMorphData::LLPolyMorphData(const std::string& morph_name) + : mName(morph_name) { - llassert (morph_name); - - mName = new char[strlen(morph_name) + 1]; /*Flawfinder: ignore*/ - strcpy(mName, morph_name); /*Flawfinder: ignore*/ - mNumIndices = 0; mCurrentIndex = 0; mTotalDistortion = 0.f; @@ -72,7 +68,6 @@ LLPolyMorphData::LLPolyMorphData(char *morph_name) //----------------------------------------------------------------------------- LLPolyMorphData::~LLPolyMorphData() { - delete [] mName; delete [] mVertexIndices; delete [] mCoords; delete [] mNormals; @@ -226,7 +221,7 @@ BOOL LLPolyMorphTargetInfo::parseXml(LLXmlTreeNode* node) static LLStdStringHandle name_string = LLXmlTree::addAttributeString("name"); if (child_node->hasName("volume_morph")) { - LLString volume_name; + std::string volume_name; if (child_node->getFastAttributeString(name_string, volume_name)) { LLVector3 scale; @@ -284,10 +279,9 @@ BOOL LLPolyMorphTarget::setInfo(LLPolyMorphTargetInfo* info) for (iter = getInfo()->mVolumeInfoList.begin(); iter != getInfo()->mVolumeInfoList.end(); iter++) { LLPolyVolumeMorphInfo *volume_info = &(*iter); - std::string vol_string(volume_info->mName); for (S32 i = 0; i < avatarp->mNumCollisionVolumes; i++) { - if (avatarp->mCollisionVolumes[i].getName() == vol_string) + if (avatarp->mCollisionVolumes[i].getName() == volume_info->mName) { mVolumeMorphs.push_back(LLPolyVolumeMorph(&avatarp->mCollisionVolumes[i], volume_info->mScale, @@ -297,7 +291,7 @@ BOOL LLPolyMorphTarget::setInfo(LLPolyMorphTargetInfo* info) } } - mMorphData = mMesh->getMorphData(getInfo()->mMorphName.c_str()); + mMorphData = mMesh->getMorphData(getInfo()->mMorphName); if (!mMorphData) { llwarns << "No morph target named " << getInfo()->mMorphName << " found in mesh." << llendl; diff --git a/indra/newview/llpolymorph.h b/indra/newview/llpolymorph.h index 8b4493ce86..71903cdbe0 100644 --- a/indra/newview/llpolymorph.h +++ b/indra/newview/llpolymorph.h @@ -48,15 +48,14 @@ class LLViewerJointCollisionVolume; class LLPolyMorphData { public: - LLPolyMorphData(char *morph_name); + LLPolyMorphData(const std::string& morph_name); ~LLPolyMorphData(); BOOL loadBinary(LLFILE* fp, LLPolyMeshSharedData *mesh); - char* loadASCII(char* text, LLPolyMeshSharedData *mesh); - char* getName() { return mName; } + const std::string& getName() { return mName; } public: - char* mName; + std::string mName; // morphology U32 mNumIndices; @@ -98,10 +97,10 @@ protected: //----------------------------------------------------------------------------- struct LLPolyVolumeMorphInfo { - LLPolyVolumeMorphInfo(LLString &name, LLVector3 &scale, LLVector3 &pos) + LLPolyVolumeMorphInfo(std::string &name, LLVector3 &scale, LLVector3 &pos) : mName(name), mScale(scale), mPos(pos) {}; - LLString mName; + std::string mName; LLVector3 mScale; LLVector3 mPos; }; @@ -130,7 +129,7 @@ public: /*virtual*/ BOOL parseXml(LLXmlTreeNode* node); protected: - LLString mMorphName; + std::string mMorphName; BOOL mIsClothingMorph; typedef std::vector<LLPolyVolumeMorphInfo> volume_info_list_t; volume_info_list_t mVolumeInfoList; diff --git a/indra/newview/llpreview.cpp b/indra/newview/llpreview.cpp index d5f91596e8..7efafe17b2 100644 --- a/indra/newview/llpreview.cpp +++ b/indra/newview/llpreview.cpp @@ -541,7 +541,7 @@ void LLPreview::userSetShape(const LLRect& new_rect) // LLMultiPreview // -LLMultiPreview::LLMultiPreview(const LLRect& rect) : LLMultiFloater("Preview", rect) +LLMultiPreview::LLMultiPreview(const LLRect& rect) : LLMultiFloater(std::string("Preview"), rect) { setCanResize(TRUE); } diff --git a/indra/newview/llpreviewanim.h b/indra/newview/llpreviewanim.h index 28b09a49dd..5d2e4b4c27 100644 --- a/indra/newview/llpreviewanim.h +++ b/indra/newview/llpreviewanim.h @@ -53,7 +53,7 @@ protected: LLAnimPauseRequest mPauseRequest; LLUUID mItemID; - LLString mTitle; + std::string mTitle; LLUUID mObjectID; LLButton* mPlayBtn; LLButton* mAuditionBtn; diff --git a/indra/newview/llpreviewgesture.cpp b/indra/newview/llpreviewgesture.cpp index 9b86690088..7661f9acd6 100644 --- a/indra/newview/llpreviewgesture.cpp +++ b/indra/newview/llpreviewgesture.cpp @@ -72,9 +72,9 @@ // *TODO: Translate? -const char NONE_LABEL[] = "---"; -const char SHIFT_LABEL[] = "Shift"; -const char CTRL_LABEL[] = "Ctrl"; +const std::string NONE_LABEL = "---"; +const std::string SHIFT_LABEL = "Shift"; +const std::string CTRL_LABEL = "Ctrl"; void dialog_refresh_all(); @@ -111,7 +111,7 @@ struct SortItemPtrsByName { bool operator()(const LLInventoryItem* i1, const LLInventoryItem* i2) { - return (LLString::compareDict(i1->getName(), i2->getName()) < 0); + return (LLStringUtil::compareDict(i1->getName(), i2->getName()) < 0); } }; @@ -203,7 +203,7 @@ BOOL LLPreviewGesture::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, - LLString& tooltip_msg) + std::string& tooltip_msg) { BOOL handled = TRUE; switch(cargo_type) @@ -584,7 +584,7 @@ void LLPreviewGesture::addAnimations() combo->removeall(); - LLString none_text = getString("none_text"); + std::string none_text = getString("none_text"); combo->add(none_text, LLUUID::null); @@ -639,7 +639,7 @@ void LLPreviewGesture::addSounds() LLComboBox* combo = mSoundCombo; combo->removeall(); - LLString none_text = getString("none_text"); + std::string none_text = getString("none_text"); combo->add(none_text, LLUUID::null); @@ -775,7 +775,7 @@ void LLPreviewGesture::refresh() mWaitTimeCheck->setVisible(FALSE); mWaitTimeEditor->setVisible(FALSE); - LLString optionstext; + std::string optionstext; if (have_step) { @@ -995,13 +995,13 @@ void LLPreviewGesture::loadUIFromGesture(LLMultiGesture* gesture) { default: case MASK_NONE: - mModifierCombo->setSimple( LLString(NONE_LABEL) ); + mModifierCombo->setSimple( NONE_LABEL ); break; case MASK_SHIFT: - mModifierCombo->setSimple( LLString(SHIFT_LABEL) ); + mModifierCombo->setSimple( SHIFT_LABEL ); break; case MASK_CONTROL: - mModifierCombo->setSimple( LLString(CTRL_LABEL) ); + mModifierCombo->setSimple( CTRL_LABEL ); break; } @@ -1075,7 +1075,7 @@ void LLPreviewGesture::loadUIFromGesture(LLMultiGesture* gesture) // after the save finishes. struct LLSaveInfo { - LLSaveInfo(const LLUUID& item_id, const LLUUID& object_id, const LLString& desc, + LLSaveInfo(const LLUUID& item_id, const LLUUID& object_id, const std::string& desc, const LLTransactionID tid) : mItemUUID(item_id), mObjectUUID(object_id), mDesc(desc), mTransactionID(tid) { @@ -1083,7 +1083,7 @@ struct LLSaveInfo LLUUID mItemUUID; LLUUID mObjectUUID; - LLString mDesc; + std::string mDesc; LLTransactionID mTransactionID; }; @@ -1274,7 +1274,7 @@ void LLPreviewGesture::onSaveComplete(const LLUUID& asset_uuid, void* user_data, else { llwarns << "Problem saving gesture: " << status << llendl; - LLStringBase<char>::format_map_t args; + LLStringUtil::format_map_t args; args["[REASON]"] = std::string(LLAssetStorage::getErrorString(status)); gViewerWindow->alertXml("GestureSaveFailedReason",args); } @@ -1290,7 +1290,7 @@ LLMultiGesture* LLPreviewGesture::createGesture() gesture->mTrigger = mTriggerEditor->getText(); gesture->mReplaceText = mReplaceEditor->getText(); - const LLString& modifier = mModifierCombo->getSimple(); + const std::string& modifier = mModifierCombo->getSimple(); if (modifier == CTRL_LABEL) { gesture->mMask = MASK_CONTROL; @@ -1310,8 +1310,8 @@ LLMultiGesture* LLPreviewGesture::createGesture() } else { - const LLString& key_string = mKeyCombo->getSimple(); - LLKeyboard::keyFromString(key_string.c_str(), &(gesture->mKey)); + const std::string& key_string = mKeyCombo->getSimple(); + LLKeyboard::keyFromString(key_string, &(gesture->mKey)); } std::vector<LLScrollListItem*> data_list = mStepList->getAllData(); @@ -1609,19 +1609,19 @@ void LLPreviewGesture::onClickAdd(void* data) LLScrollListItem* LLPreviewGesture::addStep(const std::string& library_text) { LLGestureStep* step = NULL; - if (!LLString::compareInsensitive(library_text.c_str(), "Animation")) + if (!LLStringUtil::compareInsensitive(library_text, "Animation")) { step = new LLGestureStepAnimation(); } - else if (!LLString::compareInsensitive(library_text.c_str(), "Sound")) + else if (!LLStringUtil::compareInsensitive(library_text, "Sound")) { step = new LLGestureStepSound(); } - else if (!LLString::compareInsensitive(library_text.c_str(), "Chat")) + else if (!LLStringUtil::compareInsensitive(library_text, "Chat")) { step = new LLGestureStepChat(); } - else if (!LLString::compareInsensitive(library_text.c_str(), "Wait")) + else if (!LLStringUtil::compareInsensitive(library_text, "Wait")) { step = new LLGestureStepWait(); } diff --git a/indra/newview/llpreviewgesture.h b/indra/newview/llpreviewgesture.h index b4fa63b69b..3b07608134 100644 --- a/indra/newview/llpreviewgesture.h +++ b/indra/newview/llpreviewgesture.h @@ -58,7 +58,7 @@ public: EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, - LLString& tooltip_msg); + std::string& tooltip_msg); // LLPanel virtual BOOL postBuild(); diff --git a/indra/newview/llpreviewnotecard.cpp b/indra/newview/llpreviewnotecard.cpp index f9e1fc04dc..61ebe6cbbc 100644 --- a/indra/newview/llpreviewnotecard.cpp +++ b/indra/newview/llpreviewnotecard.cpp @@ -281,7 +281,7 @@ void LLPreviewNotecard::loadAsset() mAssetID = item->getAssetUUID(); if(mAssetID.isNull()) { - editor->setText(LLString::null); + editor->setText(LLStringUtil::null); editor->makePristine(); editor->setEnabled(TRUE); mAssetStatus = PREVIEW_ASSET_LOADED; @@ -341,7 +341,7 @@ void LLPreviewNotecard::loadAsset() } else { - editor->setText(LLString::null); + editor->setText(LLStringUtil::null); editor->makePristine(); editor->setEnabled(TRUE); mAssetStatus = PREVIEW_ASSET_LOADED; @@ -376,7 +376,7 @@ void LLPreviewNotecard::onLoadComplete(LLVFS *vfs, if( (file_length > 19) && !strncmp( buffer, "Linden text version", 19 ) ) { - if( !previewEditor->importBuffer( buffer ) ) + if( !previewEditor->importBuffer( buffer, file_length+1 ) ) { llwarns << "Problem importing notecard" << llendl; } @@ -479,7 +479,7 @@ bool LLPreviewNotecard::saveIfNeeded(LLInventoryItem* copyitem) LLVFile file(gVFS, asset_id, LLAssetType::AT_NOTECARD, LLVFile::APPEND); - LLString buffer; + std::string buffer; if (!editor->exportBuffer(buffer)) { return false; @@ -601,15 +601,15 @@ void LLPreviewNotecard::onSaveComplete(const LLUUID& asset_uuid, void* user_data else { llwarns << "Problem saving notecard: " << status << llendl; - LLStringBase<char>::format_map_t args; + LLStringUtil::format_map_t args; args["[REASON]"] = std::string(LLAssetStorage::getErrorString(status)); gViewerWindow->alertXml("SaveNotecardFailReason",args); } - char uuid_string[UUID_STR_LENGTH]; /*Flawfinder: ignore*/ + std::string uuid_string; asset_uuid.toString(uuid_string); - char filename[LL_MAX_PATH]; /*Flawfinder: ignore*/ - snprintf(filename, LL_MAX_PATH, "%s.tmp", gDirUtilp->getExpandedFilename(LL_PATH_CACHE,uuid_string).c_str()); /* Flawfinder: ignore */ + std::string filename; + filename = gDirUtilp->getExpandedFilename(LL_PATH_CACHE,uuid_string) + ".tmp"; LLFile::remove(filename); delete info; } diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp index 2d87cae69b..75e8f52cfc 100644 --- a/indra/newview/llpreviewscript.cpp +++ b/indra/newview/llpreviewscript.cpp @@ -88,7 +88,7 @@ #include "llpanelinventory.h" -const char HELLO_LSL[] = +const std::string HELLO_LSL = "default\n" "{\n" " state_entry()\n" @@ -101,10 +101,10 @@ const char HELLO_LSL[] = " llSay(0, \"Touched.\");\n" " }\n" "}\n"; -const char HELP_LSL[] = "lsl_guide.html"; +const std::string HELP_LSL = "lsl_guide.html"; -const char DEFAULT_SCRIPT_NAME[] = "New Script"; // *TODO:Translate? -const char DEFAULT_SCRIPT_DESC[] = "(No Description)"; // *TODO:Translate? +const std::string DEFAULT_SCRIPT_NAME = "New Script"; // *TODO:Translate? +const std::string DEFAULT_SCRIPT_DESC = "(No Description)"; // *TODO:Translate? // Description and header information @@ -173,7 +173,7 @@ private: LLFloaterScriptSearch* LLFloaterScriptSearch::sInstance = NULL; LLFloaterScriptSearch::LLFloaterScriptSearch(std::string title, LLRect rect, LLScriptEdCore* editor_core) - : LLFloater("script search",rect,title), mEditorCore(editor_core) + : LLFloater(std::string("script search"),rect,title), mEditorCore(editor_core) { LLUICtrlFactory::getInstance()->buildFloater(this,"floater_script_search.xml"); @@ -296,7 +296,7 @@ LLScriptEdCore::LLScriptEdCore( void* userdata, S32 bottom_pad) : - LLPanel( "name", rect ), + LLPanel( std::string("name"), rect ), mSampleText(sample), mHelpFile ( help ), mEditor( NULL ), @@ -326,15 +326,15 @@ LLScriptEdCore::LLScriptEdCore( mEditor->setEnabled(TRUE); mEditor->setWordWrap(TRUE); - LLDynamicArray<const char*> funcs; - LLDynamicArray<const char*> tooltips; + std::vector<std::string> funcs; + std::vector<std::string> tooltips; for (S32 i = 0; i < gScriptLibrary.mNextNumber; i++) { // Make sure this isn't a god only function, or the agent is a god. if (!gScriptLibrary.mFunctions[i]->mGodOnly || gAgent.isGodlike()) { - funcs.put(gScriptLibrary.mFunctions[i]->mName); - tooltips.put(gScriptLibrary.mFunctions[i]->mDesc); + funcs.push_back(ll_safe_string(gScriptLibrary.mFunctions[i]->mName)); + tooltips.push_back(ll_safe_string(gScriptLibrary.mFunctions[i]->mDesc)); } } LLColor3 color(0.5f, 0.0f, 0.15f); @@ -458,7 +458,7 @@ void LLScriptEdCore::draw() } else { - childSetText("line_col", LLString::null); + childSetText("line_col", LLStringUtil::null); } updateDynamicHelp(); @@ -517,18 +517,18 @@ void LLScriptEdCore::updateDynamicHelp(BOOL immediate) } if (immediate || (mLiveHelpTimer.getStarted() && mLiveHelpTimer.getElapsedTimeF32() > LIVE_HELP_REFRESH_TIME)) { - LLString help_string = mEditor->getText().substr(segment->getStart(), segment->getEnd() - segment->getStart()); + std::string help_string = mEditor->getText().substr(segment->getStart(), segment->getEnd() - segment->getStart()); setHelpPage(help_string); mLiveHelpTimer.stop(); } } else if (immediate) { - setHelpPage(""); + setHelpPage(LLStringUtil::null); } } -void LLScriptEdCore::setHelpPage(const LLString& help_string) +void LLScriptEdCore::setHelpPage(const std::string& help_string) { LLFloater* help_floater = mLiveHelpHandle.get(); if (!help_floater) return; @@ -549,7 +549,7 @@ void LLScriptEdCore::setHelpPage(const LLString& help_string) } -void LLScriptEdCore::addHelpItemToHistory(const LLString& help_string) +void LLScriptEdCore::addHelpItemToHistory(const std::string& help_string) { if (help_string.empty()) return; @@ -640,7 +640,7 @@ void LLScriptEdCore::onHelpWebDialog(S32 option, void* userdata) switch(option) { case 0: - load_url_local_file(corep->mHelpFile.c_str()); + load_url_local_file(corep->mHelpFile); break; default: break; @@ -669,7 +669,7 @@ void LLScriptEdCore::onBtnDynamicHelp(void* userdata) return; } - live_help_floater = new LLFloater("lsl_help"); + live_help_floater = new LLFloater(std::string("lsl_help")); LLUICtrlFactory::getInstance()->buildFloater(live_help_floater, "floater_lsl_guide.xml"); ((LLFloater*)corep->getParent())->addDependentFloater(live_help_floater, TRUE); live_help_floater->childSetCommitCallback("lock_check", onCheckLock, userdata); @@ -760,7 +760,7 @@ void LLScriptEdCore::onHelpComboCommit(LLUICtrl* ctrl, void* userdata) LLFloater* live_help_floater = corep->mLiveHelpHandle.get(); if (live_help_floater) { - LLString help_string = ctrl->getValue().asString(); + std::string help_string = ctrl->getValue().asString(); corep->addHelpItemToHistory(help_string); @@ -947,10 +947,10 @@ void LLScriptEdCore::onErrorList(LLUICtrl*, void* user_data) S32 row = 0; S32 column = 0; const LLScrollListCell* cell = item->getColumn(0); - LLString line(cell->getValue().asString()); + std::string line(cell->getValue().asString()); line.erase(0, 1); - LLString::replaceChar(line, ',',' '); - LLString::replaceChar(line, ')',' '); + LLStringUtil::replaceChar(line, ',',' '); + LLStringUtil::replaceChar(line, ')',' '); sscanf(line.c_str(), "%d %d", &row, &column); //llinfos << "LLScriptEdCore::onErrorList() - " << row << ", " //<< column << llendl; @@ -1047,10 +1047,10 @@ BOOL LLScriptEdCore::handleKeyHere(KEY key, MASK mask) struct LLScriptSaveInfo { LLUUID mItemUUID; - LLString mDescription; + std::string mDescription; LLTransactionID mTransactionID; - LLScriptSaveInfo(const LLUUID& uuid, const LLString& desc, LLTransactionID tid) : + LLScriptSaveInfo(const LLUUID& uuid, const std::string& desc, LLTransactionID tid) : mItemUUID(uuid), mDescription(desc), mTransactionID(tid) {} }; @@ -1117,8 +1117,9 @@ LLPreviewLSL::LLPreviewLSL(const std::string& name, const LLRect& rect, void LLPreviewLSL::callbackLSLCompileSucceeded() { llinfos << "LSL Bytecode saved" << llendl; - mScriptEd->mErrorList->addCommentText("Compile successful!"); - mScriptEd->mErrorList->addCommentText("Save complete."); + // *TODO: Translate + mScriptEd->mErrorList->addCommentText(std::string("Compile successful!")); + mScriptEd->mErrorList->addCommentText(std::string("Save complete.")); closeIfNeeded(); } @@ -1189,7 +1190,7 @@ void LLPreviewLSL::loadAsset() } else { - mScriptEd->mEditor->setText(LLString(HELLO_LSL)); + mScriptEd->mEditor->setText(std::string(HELLO_LSL)); mAssetStatus = PREVIEW_ASSET_LOADED; } } @@ -1260,9 +1261,9 @@ void LLPreviewLSL::saveIfNeeded() tid.generate(); LLAssetID asset_id = tid.makeAssetID(gAgent.getSecureSessionID()); std::string filepath = gDirUtilp->getExpandedFilename(LL_PATH_CACHE,asset_id.asString()); - std::string filename = llformat("%s.lsl", filepath.c_str()); + std::string filename = filepath + ".lsl"; - LLFILE* fp = LLFile::fopen(filename.c_str(), "wb"); + LLFILE* fp = LLFile::fopen(filename, "wb"); if(!fp) { llwarns << "Unable to write to " << filename << llendl; @@ -1274,7 +1275,7 @@ void LLPreviewLSL::saveIfNeeded() return; } - LLString utf8text = mScriptEd->mEditor->getText(); + std::string utf8text = mScriptEd->mEditor->getText(); fputs(utf8text.c_str(), fp); fclose(fp); fp = NULL; @@ -1315,7 +1316,7 @@ void LLPreviewLSL::uploadAssetLegacy(const std::string& filename, LLScriptSaveInfo* info = new LLScriptSaveInfo(item_id, descEditor->getText(), tid); - gAssetStorage->storeAssetData(filename.c_str(), tid, + gAssetStorage->storeAssetData(filename, tid, LLAssetType::AT_LSL_TEXT, &LLPreviewLSL::onSaveComplete, info); @@ -1332,15 +1333,15 @@ void LLPreviewLSL::uploadAssetLegacy(const std::string& filename, { llinfos << "Compile failed!" << llendl; //char command[256]; - //sprintf(command, "type %s\n", err_filename); + //sprintf(command, "type %s\n", err_filename.c_str()); //system(command); // load the error file into the error scrolllist - LLFILE* fp = LLFile::fopen(err_filename.c_str(), "r"); + LLFILE* fp = LLFile::fopen(err_filename, "r"); if(fp) { char buffer[MAX_STRING]; /*Flawfinder: ignore*/ - LLString line; + std::string line; while(!feof(fp)) { if (fgets(buffer, MAX_STRING, fp) == NULL) @@ -1354,7 +1355,7 @@ void LLPreviewLSL::uploadAssetLegacy(const std::string& filename, else { line.assign(buffer); - LLString::stripNonprintable(line); + LLStringUtil::stripNonprintable(line); LLSD row; row["columns"][0]["value"] = line; @@ -1374,7 +1375,7 @@ void LLPreviewLSL::uploadAssetLegacy(const std::string& filename, getWindow()->incBusyCount(); mPendingUploads++; LLUUID* this_uuid = new LLUUID(mItemUUID); - gAssetStorage->storeAssetData(dst_filename.c_str(), + gAssetStorage->storeAssetData(dst_filename, tid, LLAssetType::AT_LSL_BYTECODE, &LLPreviewLSL::onSaveBytecodeComplete, @@ -1383,9 +1384,9 @@ void LLPreviewLSL::uploadAssetLegacy(const std::string& filename, } // get rid of any temp files left lying around - LLFile::remove(filename.c_str()); - LLFile::remove(err_filename.c_str()); - LLFile::remove(dst_filename.c_str()); + LLFile::remove(filename); + LLFile::remove(err_filename); + LLFile::remove(dst_filename); } @@ -1431,7 +1432,7 @@ void LLPreviewLSL::onSaveComplete(const LLUUID& asset_uuid, void* user_data, S32 else { llwarns << "Problem saving script: " << status << llendl; - LLStringBase<char>::format_map_t args; + LLStringUtil::format_map_t args; args["[REASON]"] = std::string(LLAssetStorage::getErrorString(status)); gViewerWindow->alertXml("SaveScriptFailReason", args); } @@ -1469,7 +1470,7 @@ void LLPreviewLSL::onSaveBytecodeComplete(const LLUUID& asset_uuid, void* user_d else { llwarns << "Problem saving LSL Bytecode (Preview)" << llendl; - LLStringBase<char>::format_map_t args; + LLStringUtil::format_map_t args; args["[REASON]"] = std::string(LLAssetStorage::getErrorString(status)); gViewerWindow->alertXml("SaveBytecodeFailReason", args); } @@ -1661,8 +1662,9 @@ void LLLiveLSLEditor::callbackLSLCompileSucceeded(const LLUUID& task_id, bool is_script_running) { lldebugs << "LSL Bytecode saved" << llendl; - mScriptEd->mErrorList->addCommentText("Compile successful!"); - mScriptEd->mErrorList->addCommentText("Save complete."); + // *TODO: Translate + mScriptEd->mErrorList->addCommentText(std::string("Compile successful!")); + mScriptEd->mErrorList->addCommentText(std::string("Save complete.")); closeIfNeeded(); } @@ -1738,7 +1740,7 @@ void LLLiveLSLEditor::loadAsset(BOOL is_new) } else { - mScriptEd->mEditor->setText(LLString::null); + mScriptEd->mEditor->setText(LLStringUtil::null); mScriptEd->mEditor->makePristine(); mAssetStatus = PREVIEW_ASSET_LOADED; } @@ -1773,7 +1775,7 @@ void LLLiveLSLEditor::loadAsset(BOOL is_new) // This may be better than having a accessible null pointer around, // though this newly allocated object will most likely be replaced. mItem = new LLViewerInventoryItem(); - mScriptEd->mEditor->setText(LLString::null); + mScriptEd->mEditor->setText(LLStringUtil::null); mScriptEd->mEditor->makePristine(); mScriptEd->mEditor->setEnabled(FALSE); mAssetStatus = PREVIEW_ASSET_LOADED; @@ -1781,8 +1783,8 @@ void LLLiveLSLEditor::loadAsset(BOOL is_new) } else { - mScriptEd->mEditor->setText(LLString(HELLO_LSL)); - //mScriptEd->mEditor->setText(LLString::null); + mScriptEd->mEditor->setText(std::string(HELLO_LSL)); + //mScriptEd->mEditor->setText(LLStringUtil::null); //mScriptEd->mEditor->makePristine(); LLPermissions perm; perm.init(gAgent.getID(), gAgent.getID(), LLUUID::null, gAgent.getGroupID()); @@ -1844,37 +1846,38 @@ void LLLiveLSLEditor::onLoadComplete(LLVFS *vfs, const LLUUID& asset_id, delete xored_id; } -void LLLiveLSLEditor::loadScriptText(const char* filename) -{ - if(!filename) - { - llerrs << "Filename is Empty!" << llendl; - return; - } - LLFILE* file = LLFile::fopen(filename, "rb"); /*Flawfinder: ignore*/ - if(file) - { - // read in the whole file - fseek(file, 0L, SEEK_END); - long file_length = ftell(file); - fseek(file, 0L, SEEK_SET); - char* buffer = new char[file_length+1]; - size_t nread = fread(buffer, 1, file_length, file); - if (nread < (size_t) file_length) - { - llwarns << "Short read" << llendl; - } - buffer[nread] = '\0'; - fclose(file); - mScriptEd->mEditor->setText(LLStringExplicit(buffer)); - mScriptEd->mEditor->makePristine(); - delete[] buffer; - } - else - { - llwarns << "Error opening " << filename << llendl; - } -} +// unused +// void LLLiveLSLEditor::loadScriptText(const std::string& filename) +// { +// if(!filename) +// { +// llerrs << "Filename is Empty!" << llendl; +// return; +// } +// LLFILE* file = LLFile::fopen(filename, "rb"); /*Flawfinder: ignore*/ +// if(file) +// { +// // read in the whole file +// fseek(file, 0L, SEEK_END); +// long file_length = ftell(file); +// fseek(file, 0L, SEEK_SET); +// char* buffer = new char[file_length+1]; +// size_t nread = fread(buffer, 1, file_length, file); +// if (nread < (size_t) file_length) +// { +// llwarns << "Short read" << llendl; +// } +// buffer[nread] = '\0'; +// fclose(file); +// mScriptEd->mEditor->setText(LLStringExplicit(buffer)); +// mScriptEd->mEditor->makePristine(); +// delete[] buffer; +// } +// else +// { +// llwarns << "Error opening " << filename << llendl; +// } +// } void LLLiveLSLEditor::loadScriptText(LLVFS *vfs, const LLUUID &uuid, LLAssetType::EType type) { @@ -1974,7 +1977,8 @@ void LLLiveLSLEditor::draw() { // HACK: Display this information in the title bar. // Really ought to put in main window. - setTitle("Script (object out of range)"); + // *TODO: Translate + setTitle(std::string("Script (object out of range)")); runningCheckbox->setEnabled(FALSE); // object may have fallen out of range. mHaveRunningInfo = FALSE; @@ -2063,7 +2067,7 @@ void LLLiveLSLEditor::saveIfNeeded() mItem->setTransactionID(tid); // write out the data, and store it in the asset database - LLFILE* fp = LLFile::fopen(filename.c_str(), "wb"); + LLFILE* fp = LLFile::fopen(filename, "wb"); if(!fp) { llwarns << "Unable to write to " << filename << llendl; @@ -2074,7 +2078,7 @@ void LLLiveLSLEditor::saveIfNeeded() mScriptEd->mErrorList->addElement(row); return; } - LLString utf8text = mScriptEd->mEditor->getText(); + std::string utf8text = mScriptEd->mEditor->getText(); // Special case for a completely empty script - stuff in one space so it can store properly. See SL-46889 if ( utf8text.size() == 0 ) @@ -2125,7 +2129,7 @@ void LLLiveLSLEditor::uploadAssetLegacy(const std::string& filename, LLLiveLSLSaveData* data = new LLLiveLSLSaveData(mObjectID, mItem, is_running); - gAssetStorage->storeAssetData(filename.c_str(), tid, + gAssetStorage->storeAssetData(filename, tid, LLAssetType::AT_LSL_TEXT, &onSaveTextComplete, (void*)data, @@ -2144,10 +2148,10 @@ void LLLiveLSLEditor::uploadAssetLegacy(const std::string& filename, { // load the error file into the error scrolllist llinfos << "Compile failed!" << llendl; - if(NULL != (fp = LLFile::fopen(err_filename.c_str(), "r"))) + if(NULL != (fp = LLFile::fopen(err_filename, "r"))) { char buffer[MAX_STRING]; /*Flawfinder: ignore*/ - LLString line; + std::string line; while(!feof(fp)) { @@ -2162,7 +2166,7 @@ void LLLiveLSLEditor::uploadAssetLegacy(const std::string& filename, else { line.assign(buffer); - LLString::stripNonprintable(line); + LLStringUtil::stripNonprintable(line); LLSD row; row["columns"][0]["value"] = line; @@ -2182,7 +2186,8 @@ void LLLiveLSLEditor::uploadAssetLegacy(const std::string& filename, else { llinfos << "Compile worked!" << llendl; - mScriptEd->mErrorList->addCommentText("Compile successful, saving..."); + // *TODO: Translate + mScriptEd->mErrorList->addCommentText(std::string("Compile successful, saving...")); if(gAssetStorage) { llinfos << "LLLiveLSLEditor::saveAsset " @@ -2193,7 +2198,7 @@ void LLLiveLSLEditor::uploadAssetLegacy(const std::string& filename, data = new LLLiveLSLSaveData(mObjectID, mItem, is_running); - gAssetStorage->storeAssetData(dst_filename.c_str(), + gAssetStorage->storeAssetData(dst_filename, tid, LLAssetType::AT_LSL_BYTECODE, &LLLiveLSLEditor::onSaveBytecodeComplete, @@ -2203,9 +2208,9 @@ void LLLiveLSLEditor::uploadAssetLegacy(const std::string& filename, } // get rid of any temp files left lying around - LLFile::remove(filename.c_str()); - LLFile::remove(err_filename.c_str()); - LLFile::remove(dst_filename.c_str()); + LLFile::remove(filename); + LLFile::remove(err_filename); + LLFile::remove(dst_filename); // If we successfully saved it, then we should be able to check/uncheck the running box! LLCheckBoxCtrl* runningCheckbox = getChild<LLCheckBoxCtrl>( "running"); @@ -2220,7 +2225,7 @@ void LLLiveLSLEditor::onSaveTextComplete(const LLUUID& asset_uuid, void* user_da if (status) { llwarns << "Unable to save text for a script." << llendl; - LLStringBase<char>::format_map_t args; + LLStringUtil::format_map_t args; args["[REASON]"] = std::string(LLAssetStorage::getErrorString(status)); gViewerWindow->alertXml("CompileQueueSaveText", args); } @@ -2256,7 +2261,8 @@ void LLLiveLSLEditor::onSaveBytecodeComplete(const LLUUID& asset_uuid, void* use if(self) { // Tell the user that the compile worked. - self->mScriptEd->mErrorList->addCommentText("Save complete."); + // *TODO: Translate + self->mScriptEd->mErrorList->addCommentText(std::string("Save complete.")); // close the window if this completes both uploads self->getWindow()->decBusyCount(); self->mPendingUploads--; @@ -2280,14 +2286,14 @@ void LLLiveLSLEditor::onSaveBytecodeComplete(const LLUUID& asset_uuid, void* use llinfos << "Problem saving LSL Bytecode (Live Editor)" << llendl; llwarns << "Unable to save a compiled script." << llendl; - LLStringBase<char>::format_map_t args; + LLStringUtil::format_map_t args; args["[REASON]"] = std::string(LLAssetStorage::getErrorString(status)); gViewerWindow->alertXml("CompileQueueSaveBytecode", args); } std::string filepath = gDirUtilp->getExpandedFilename(LL_PATH_CACHE,asset_uuid.asString()); std::string dst_filename = llformat("%s.lso", filepath.c_str()); - LLFile::remove(dst_filename.c_str()); + LLFile::remove(dst_filename); delete data; } diff --git a/indra/newview/llpreviewscript.h b/indra/newview/llpreviewscript.h index d7d96e2037..aec4bb2ab7 100644 --- a/indra/newview/llpreviewscript.h +++ b/indra/newview/llpreviewscript.h @@ -121,16 +121,16 @@ public: protected: void deleteBridges(); - void setHelpPage(const LLString& help_string); + void setHelpPage(const std::string& help_string); void updateDynamicHelp(BOOL immediate = FALSE); - void addHelpItemToHistory(const LLString& help_string); + void addHelpItemToHistory(const std::string& help_string); static void onErrorList(LLUICtrl*, void* user_data); virtual const char *getTitleName() const { return "Script"; } private: - LLString mSampleText; + std::string mSampleText; std::string mHelpFile; LLTextEditor* mEditor; void (*mLoadCallback)(void* userdata); @@ -253,7 +253,7 @@ protected: static void onRunningCheckboxClicked(LLUICtrl*, void* userdata); static void onReset(void* userdata); - void loadScriptText(const char* filename); +// void loadScriptText(const std::string& filename); // unused void loadScriptText(LLVFS *vfs, const LLUUID &uuid, LLAssetType::EType type); static void onErrorList(LLUICtrl*, void* user_data); @@ -279,7 +279,4 @@ protected: static LLMap<LLUUID, LLLiveLSLEditor*> sInstances; }; -// name of help file for lsl -extern const char HELP_LSL[]; - #endif // LL_LLPREVIEWSCRIPT_H diff --git a/indra/newview/llpreviewtexture.cpp b/indra/newview/llpreviewtexture.cpp index e94e323850..6f2c57c055 100644 --- a/indra/newview/llpreviewtexture.cpp +++ b/indra/newview/llpreviewtexture.cpp @@ -240,7 +240,8 @@ void LLPreviewTexture::draw() if( mLoadingFullImage ) { - LLFontGL::sSansSerif->renderUTF8("Receiving:", 0, + // *TODO: Translate + LLFontGL::sSansSerif->renderUTF8(std::string("Receiving:"), 0, interior.mLeft + 4, interior.mBottom + 4, LLColor4::white, LLFontGL::LEFT, LLFontGL::BOTTOM, @@ -276,7 +277,8 @@ void LLPreviewTexture::draw() else if( !mSavedFileTimer.hasExpired() ) { - LLFontGL::sSansSerif->renderUTF8("File Saved", 0, + // *TODO: Translate + LLFontGL::sSansSerif->renderUTF8(std::string("File Saved"), 0, interior.mLeft + 4, interior.mBottom + 4, LLColor4::white, LLFontGL::LEFT, LLFontGL::BOTTOM, @@ -349,13 +351,13 @@ void LLPreviewTexture::onFileLoadedForSave(BOOL success, LLPointer<LLImageTGA> image_tga = new LLImageTGA; if( !image_tga->encode( src ) ) { - LLStringBase<char>::format_map_t args; + LLStringUtil::format_map_t args; args["[FILE]"] = self->mSaveFileName; gViewerWindow->alertXml("CannotEncodeFile", args); } else if( !image_tga->save( self->mSaveFileName ) ) { - LLStringBase<char>::format_map_t args; + LLStringUtil::format_map_t args; args["[FILE]"] = self->mSaveFileName; gViewerWindow->alertXml("CannotWriteFile", args); } diff --git a/indra/newview/llpreviewtexture.h b/indra/newview/llpreviewtexture.h index 6cb5aebfa9..30feb79e77 100644 --- a/indra/newview/llpreviewtexture.h +++ b/indra/newview/llpreviewtexture.h @@ -86,7 +86,7 @@ private: LLUUID mImageID; LLPointer<LLViewerImage> mImage; BOOL mLoadingFullImage; - LLString mSaveFileName; + std::string mSaveFileName; LLFrameTimer mSavedFileTimer; BOOL mShowKeepDiscard; BOOL mCopyToInv; diff --git a/indra/newview/llprogressview.cpp b/indra/newview/llprogressview.cpp index e5b063e6d7..9df60d67b5 100644 --- a/indra/newview/llprogressview.cpp +++ b/indra/newview/llprogressview.cpp @@ -59,8 +59,8 @@ S32 gStartImageWidth = 1; S32 gStartImageHeight = 1; const F32 FADE_IN_TIME = 1.f; -const LLString ANIMATION_FILENAME = "Login Sequence "; -const LLString ANIMATION_SUFFIX = ".jpg"; +const std::string ANIMATION_FILENAME = "Login Sequence "; +const std::string ANIMATION_SUFFIX = ".jpg"; const F32 TOTAL_LOGIN_TIME = 10.f; // seconds, wild guess at time from GL context to actual world view S32 gLastStartAnimationFrame = 0; // human-style indexing, first image = 1 const S32 ANIMATION_FRAMES = 1; //13; @@ -78,12 +78,11 @@ LLProgressView::LLProgressView(const std::string& name, const LLRect &rect) getRect().getWidth() - CANCEL_BTN_OFFSET - CANCEL_BTN_WIDTH, CANCEL_BTN_OFFSET, CANCEL_BTN_WIDTH, BTN_HEIGHT ); - mCancelBtn = new LLButton( - "Quit", - r, - "", - LLProgressView::onCancelButtonClicked, - NULL ); + mCancelBtn = new LLButton(std::string("Quit"), + r, + std::string(""), + LLProgressView::onCancelButtonClicked, + NULL ); mCancelBtn->setFollows( FOLLOWS_RIGHT | FOLLOWS_BOTTOM ); addChild( mCancelBtn ); mFadeTimer.stop(); @@ -264,7 +263,7 @@ void LLProgressView::draw() F32 alpha = 0.5f + 0.5f*0.5f*(1.f + (F32)sin(3.f*timer.getElapsedTimeF32())); // background_color.mV[3] = background_color.mV[3]*alpha; - LLString top_line = LLAppViewer::instance()->getSecondLifeTitle(); + std::string top_line = LLAppViewer::instance()->getSecondLifeTitle(); S32 bar_bottom = line_two_y - 30; S32 bar_height = 18; @@ -380,7 +379,7 @@ void LLProgressView::draw() LLView::draw(); } -void LLProgressView::setText(const LLString& text) +void LLProgressView::setText(const std::string& text) { mText = text; } @@ -390,12 +389,12 @@ void LLProgressView::setPercent(const F32 percent) mPercentDone = llclamp(percent, 0.f, 100.f); } -void LLProgressView::setMessage(const LLString& msg) +void LLProgressView::setMessage(const std::string& msg) { mMessage = msg; } -void LLProgressView::setCancelButtonVisible(BOOL b, const LLString& label) +void LLProgressView::setCancelButtonVisible(BOOL b, const std::string& label) { mCancelBtn->setVisible( b ); mCancelBtn->setEnabled( b ); diff --git a/indra/newview/llprogressview.h b/indra/newview/llprogressview.h index 63d19c27dc..84ae8f6e82 100644 --- a/indra/newview/llprogressview.h +++ b/indra/newview/llprogressview.h @@ -52,20 +52,20 @@ public: /*virtual*/ BOOL handleKeyHere(KEY key, MASK mask); /*virtual*/ void setVisible(BOOL visible); - void setText(const LLString& text); + void setText(const std::string& text); void setPercent(const F32 percent); // Set it to NULL when you want to eliminate the message. - void setMessage(const LLString& msg); + void setMessage(const std::string& msg); - void setCancelButtonVisible(BOOL b, const LLString& label); + void setCancelButtonVisible(BOOL b, const std::string& label); static void onCancelButtonClicked( void* ); protected: F32 mPercentDone; - LLString mText; - LLString mMessage; + std::string mText; + std::string mMessage; LLButton* mCancelBtn; LLFrameTimer mFadeTimer; LLFrameTimer mProgressTimer; diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index a889388e85..7554778301 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -1955,12 +1955,13 @@ void LLSelectMgr::selectionSetClickAction(U8 action) // godlike requests //----------------------------------------------------------------------------- -typedef std::pair<const LLString, const LLString> godlike_request_t; -void LLSelectMgr::sendGodlikeRequest(const LLString& request, const LLString& param) +typedef std::pair<const std::string, const std::string> godlike_request_t; + +void LLSelectMgr::sendGodlikeRequest(const std::string& request, const std::string& param) { // If the agent is neither godlike nor an estate owner, the server // will reject the request. - LLString message_type; + std::string message_type; if (gAgent.isGodlike()) { message_type = "GodlikeMessage"; @@ -1993,7 +1994,7 @@ void LLSelectMgr::packGodlikeHead(void* user_data) msg->addUUID("TransactionID", LLUUID::null); godlike_request_t* data = (godlike_request_t*)user_data; msg->nextBlock("MethodData"); - msg->addString("Method", data->first.c_str()); + msg->addString("Method", data->first); msg->addUUID("Invoice", LLUUID::null); // The parameters used to be restricted to either string or @@ -2011,8 +2012,7 @@ void LLSelectMgr::packGodlikeHead(void* user_data) // static void LLSelectMgr::packObjectIDAsParam(LLSelectNode* node, void *) { - char buf [MAX_STRING]; /* Flawfinder: ignore */ - snprintf(buf, MAX_STRING, "%u", node->getObject()->getLocalID()); /* Flawfinder: ignore */ + std::string buf = llformat("%u", node->getObject()->getLocalID()); gMessageSystem->nextBlock("ParamList"); gMessageSystem->addString("Parameter", buf); } @@ -2304,7 +2304,7 @@ BOOL LLSelectMgr::selectGetRootsCopy() // selectGetCreator() // Creator information only applies to root objects. //----------------------------------------------------------------------------- -BOOL LLSelectMgr::selectGetCreator(LLUUID& result_id, LLString& name) +BOOL LLSelectMgr::selectGetCreator(LLUUID& result_id, std::string& name) { BOOL identical = TRUE; BOOL first = TRUE; @@ -2356,7 +2356,7 @@ BOOL LLSelectMgr::selectGetCreator(LLUUID& result_id, LLString& name) // selectGetOwner() // Owner information only applies to roots. //----------------------------------------------------------------------------- -BOOL LLSelectMgr::selectGetOwner(LLUUID& result_id, LLString& name) +BOOL LLSelectMgr::selectGetOwner(LLUUID& result_id, std::string& name) { BOOL identical = TRUE; BOOL first = TRUE; @@ -2424,7 +2424,7 @@ BOOL LLSelectMgr::selectGetOwner(LLUUID& result_id, LLString& name) // selectGetLastOwner() // Owner information only applies to roots. //----------------------------------------------------------------------------- -BOOL LLSelectMgr::selectGetLastOwner(LLUUID& result_id, LLString& name) +BOOL LLSelectMgr::selectGetLastOwner(LLUUID& result_id, std::string& name) { BOOL identical = TRUE; BOOL first = TRUE; @@ -3471,7 +3471,7 @@ void LLSelectMgr::deselectAllIfTooFar() } -void LLSelectMgr::selectionSetObjectName(const LLString& name) +void LLSelectMgr::selectionSetObjectName(const std::string& name) { // we only work correctly if 1 object is selected. if(mSelectedObjects->getRootObjectCount() == 1) @@ -3479,7 +3479,7 @@ void LLSelectMgr::selectionSetObjectName(const LLString& name) sendListToRegions("ObjectName", packAgentAndSessionID, packObjectName, - (void*)name.c_str(), + (void*)(new std::string(name)), SEND_ONLY_ROOTS); } else if(mSelectedObjects->getObjectCount() == 1) @@ -3487,12 +3487,12 @@ void LLSelectMgr::selectionSetObjectName(const LLString& name) sendListToRegions("ObjectName", packAgentAndSessionID, packObjectName, - (void*)name.c_str(), + (void*)(new std::string(name)), SEND_INDIVIDUALS); } } -void LLSelectMgr::selectionSetObjectDescription(const LLString& desc) +void LLSelectMgr::selectionSetObjectDescription(const std::string& desc) { // we only work correctly if 1 object is selected. if(mSelectedObjects->getRootObjectCount() == 1) @@ -3500,7 +3500,7 @@ void LLSelectMgr::selectionSetObjectDescription(const LLString& desc) sendListToRegions("ObjectDescription", packAgentAndSessionID, packObjectDescription, - (void*)desc.c_str(), + (void*)(new std::string(desc)), SEND_ONLY_ROOTS); } else if(mSelectedObjects->getObjectCount() == 1) @@ -3508,7 +3508,7 @@ void LLSelectMgr::selectionSetObjectDescription(const LLString& desc) sendListToRegions("ObjectDescription", packAgentAndSessionID, packObjectDescription, - (void*)desc.c_str(), + (void*)(new std::string(desc)), SEND_INDIVIDUALS); } } @@ -3993,22 +3993,26 @@ void LLSelectMgr::packObjectLocalID(LLSelectNode* node, void *) // static void LLSelectMgr::packObjectName(LLSelectNode* node, void* user_data) { - char* name = (char*)user_data; - if(!name) return; - gMessageSystem->nextBlockFast(_PREHASH_ObjectData); - gMessageSystem->addU32Fast(_PREHASH_LocalID, node->getObject()->getLocalID()); - gMessageSystem->addStringFast(_PREHASH_Name, name); + const std::string* name = (const std::string*)user_data; + if(!name->empty()) + { + gMessageSystem->nextBlockFast(_PREHASH_ObjectData); + gMessageSystem->addU32Fast(_PREHASH_LocalID, node->getObject()->getLocalID()); + gMessageSystem->addStringFast(_PREHASH_Name, *name); + } + delete name; } // static -void LLSelectMgr::packObjectDescription(LLSelectNode* node, - void* user_data) +void LLSelectMgr::packObjectDescription(LLSelectNode* node, void* user_data) { - char* desc = (char*)user_data; - if(!desc) return; - gMessageSystem->nextBlockFast(_PREHASH_ObjectData); - gMessageSystem->addU32Fast(_PREHASH_LocalID, node->getObject()->getLocalID()); - gMessageSystem->addStringFast(_PREHASH_Description, desc); + const std::string* desc = (const std::string*)user_data; + if(!desc->empty()) + { + gMessageSystem->nextBlockFast(_PREHASH_ObjectData); + gMessageSystem->addU32Fast(_PREHASH_LocalID, node->getObject()->getLocalID()); + gMessageSystem->addStringFast(_PREHASH_Description, *desc); + } } // static @@ -4057,7 +4061,7 @@ void LLSelectMgr::packPermissions(LLSelectNode* node, void *user_data) // Utility function to send some information to every region containing // an object on the selection list. We want to do this to reduce the total // number of packets sent by the viewer. -void LLSelectMgr::sendListToRegions(const LLString& message_name, +void LLSelectMgr::sendListToRegions(const std::string& message_name, void (*pack_header)(void *user_data), void (*pack_body)(LLSelectNode* node, void *user_data), void *user_data, @@ -4297,15 +4301,15 @@ void LLSelectMgr::processObjectProperties(LLMessageSystem* msg, void** user_data msg->getUUIDFast(_PREHASH_ObjectData, _PREHASH_LastOwnerID, last_owner_id, i); - char name[DB_INV_ITEM_NAME_BUF_SIZE]; /* Flawfinder: ignore */ - msg->getStringFast(_PREHASH_ObjectData, _PREHASH_Name, DB_INV_ITEM_NAME_BUF_SIZE, name, i); - char desc[DB_INV_ITEM_DESC_BUF_SIZE]; /* Flawfinder: ignore */ - msg->getStringFast(_PREHASH_ObjectData, _PREHASH_Description, DB_INV_ITEM_DESC_BUF_SIZE, desc, i); + std::string name; + msg->getStringFast(_PREHASH_ObjectData, _PREHASH_Name, name, i); + std::string desc; + msg->getStringFast(_PREHASH_ObjectData, _PREHASH_Description, desc, i); - char touch_name[DB_INV_ITEM_NAME_BUF_SIZE]; /* Flawfinder: ignore */ - msg->getStringFast(_PREHASH_ObjectData, _PREHASH_TouchName, DB_INV_ITEM_NAME_BUF_SIZE, touch_name, i); - char sit_name[DB_INV_ITEM_DESC_BUF_SIZE]; /* Flawfinder: ignore */ - msg->getStringFast(_PREHASH_ObjectData, _PREHASH_SitName, DB_INV_ITEM_DESC_BUF_SIZE, sit_name, i); + std::string touch_name; + msg->getStringFast(_PREHASH_ObjectData, _PREHASH_TouchName, touch_name, i); + std::string sit_name; + msg->getStringFast(_PREHASH_ObjectData, _PREHASH_SitName, sit_name, i); //unpack TE IDs std::vector<LLUUID> texture_ids; @@ -4448,11 +4452,11 @@ void LLSelectMgr::processObjectPropertiesFamily(LLMessageSystem* msg, void** use msg->getUUIDFast(_PREHASH_ObjectData, _PREHASH_LastOwnerID, last_owner_id ); // unpack name & desc - char name[DB_INV_ITEM_NAME_BUF_SIZE]; /* Flawfinder: ignore */ - msg->getStringFast(_PREHASH_ObjectData, _PREHASH_Name, DB_INV_ITEM_NAME_BUF_SIZE, name); + std::string name; + msg->getStringFast(_PREHASH_ObjectData, _PREHASH_Name, name); - char desc[DB_INV_ITEM_DESC_BUF_SIZE]; /* Flawfinder: ignore */ - msg->getStringFast(_PREHASH_ObjectData, _PREHASH_Description, DB_INV_ITEM_DESC_BUF_SIZE, desc); + std::string desc; + msg->getStringFast(_PREHASH_ObjectData, _PREHASH_Description, desc); // the reporter widget askes the server for info about picked objects if (request_flags & (COMPLAINT_REPORT_REQUEST | BUG_REPORT_REQUEST)) @@ -4961,10 +4965,10 @@ LLSelectNode::LLSelectNode(LLViewerObject* object, BOOL glow) mValid = FALSE; mPermissions = new LLPermissions(); mInventorySerial = 0; - mName = LLString::null; - mDescription = LLString::null; - mTouchName = LLString::null; - mSitName = LLString::null; + mName = LLStringUtil::null; + mDescription = LLStringUtil::null; + mTouchName = LLStringUtil::null; + mSitName = LLStringUtil::null; mSilhouetteExists = FALSE; mDuplicated = FALSE; diff --git a/indra/newview/llselectmgr.h b/indra/newview/llselectmgr.h index 6ae688bae6..ecd065fdf8 100644 --- a/indra/newview/llselectmgr.h +++ b/indra/newview/llselectmgr.h @@ -159,8 +159,8 @@ public: LLAggregatePermissions mAggregatePerm; LLAggregatePermissions mAggregateTexturePerm; LLAggregatePermissions mAggregateTexturePermOwner; - LLString mName; - LLString mDescription; + std::string mName; + std::string mDescription; LLCategory mCategory; S16 mInventorySerial; LLVector3 mSavedPositionLocal; // for interactively modifying object position @@ -176,8 +176,8 @@ public: LLUUID mItemID; LLUUID mFolderID; LLUUID mFromTaskID; - LLString mTouchName; - LLString mSitName; + std::string mTouchName; + std::string mSitName; U64 mCreationDate; std::vector<LLColor4> mSavedColors; std::vector<LLUUID> mSavedTextures; @@ -506,8 +506,8 @@ public: void selectionSetGlow(const F32 glow); void selectionSetObjectPermissions(U8 perm_field, BOOL set, U32 perm_mask, BOOL override = FALSE); - void selectionSetObjectName(const LLString& name); - void selectionSetObjectDescription(const LLString& desc); + void selectionSetObjectName(const std::string& name); + void selectionSetObjectDescription(const std::string& desc); void selectionSetObjectCategory(const LLCategory& category); void selectionSetObjectSaleInfo(const LLSaleInfo& sale_info); @@ -520,7 +520,7 @@ public: U32 update_type); void sendSelectionMove(); - void sendGodlikeRequest(const LLString& request, const LLString& parameter); + void sendGodlikeRequest(const std::string& request, const std::string& parameter); // will make sure all selected object meet current criteria, or deselect them otherwise @@ -543,9 +543,9 @@ public: // returns TRUE if selected objects can be copied. BOOL selectGetRootsCopy(); - BOOL selectGetCreator(LLUUID& id, LLString& name); // TRUE if all have same creator, returns id - BOOL selectGetOwner(LLUUID& id, LLString& name); // TRUE if all objects have same owner, returns id - BOOL selectGetLastOwner(LLUUID& id, LLString& name); // TRUE if all objects have same owner, returns id + BOOL selectGetCreator(LLUUID& id, std::string& name); // TRUE if all have same creator, returns id + BOOL selectGetOwner(LLUUID& id, std::string& name); // TRUE if all objects have same owner, returns id + BOOL selectGetLastOwner(LLUUID& id, std::string& name); // TRUE if all objects have same owner, returns id // returns TRUE if all are the same. id is stuffed with // the value found if available. @@ -646,7 +646,7 @@ private: void addAsFamily(std::vector<LLViewerObject*>& objects, BOOL add_to_end = FALSE); void generateSilhouette(LLSelectNode *nodep, const LLVector3& view_point); // Send one message to each region containing an object on selection list. - void sendListToRegions( const LLString& message_name, + void sendListToRegions( const std::string& message_name, void (*pack_header)(void *user_data), void (*pack_body)(LLSelectNode* node, void *user_data), void *user_data, diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 7480d4dd73..7fe55d6efd 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -190,8 +190,8 @@ // BOOL gAgentMovementCompleted = FALSE; -const char* SCREEN_HOME_FILENAME = "screen_home.bmp"; -const char* SCREEN_LAST_FILENAME = "screen_last.bmp"; +std::string SCREEN_HOME_FILENAME = "screen_home.bmp"; +std::string SCREEN_LAST_FILENAME = "screen_last.bmp"; // // Imported globals @@ -209,8 +209,8 @@ static LLHost gAgentSimHost; static BOOL gSkipOptionalUpdate = FALSE; static bool gGotUseCircuitCodeAck = false; -LLString gInitialOutfit; -LLString gInitialOutfitGender; // "male" or "female" +std::string gInitialOutfit; +std::string gInitialOutfitGender; // "male" or "female" static bool gUseCircuitCallbackCalled = false; @@ -223,12 +223,12 @@ S32 LLStartUp::gStartupState = STATE_FIRST; void login_show(); void login_callback(S32 option, void* userdata); -LLString load_password_from_disk(); +std::string load_password_from_disk(); void save_password_to_disk(const char* hashed_password); BOOL is_hex_string(U8* str, S32 len); void show_first_run_dialog(); void first_run_dialog_callback(S32 option, void* userdata); -void set_startup_status(const F32 frac, const char* string, const char* msg); +void set_startup_status(const F32 frac, const std::string& string, const std::string& msg); void login_alert_status(S32 option, void* user_data); void update_app(BOOL mandatory, const std::string& message); void update_dialog_callback(S32 option, void *userdata); @@ -243,7 +243,7 @@ void init_start_screen(S32 location_id); void release_start_screen(); void reset_login(); -void callback_cache_name(const LLUUID& id, const char* firstname, const char* lastname, BOOL is_group, void* data) +void callback_cache_name(const LLUUID& id, const std::string& firstname, const std::string& lastname, BOOL is_group, void* data) { LLNameListCtrl::refreshAll(id, firstname, lastname, is_group); LLNameBox::refreshAll(id, firstname, lastname, is_group); @@ -267,7 +267,7 @@ namespace class LLNullHTTPSender : public LLHTTPSender { virtual void send(const LLHost& host, - const char* message, const LLSD& body, + const std::string& message, const LLSD& body, LLHTTPClient::ResponderPtr response) const { LL_WARNS("AppInit") << " attemped to send " << message << " to " << host @@ -322,10 +322,10 @@ BOOL idle_startup() static std::string auth_method; static std::string auth_desc; static std::string auth_message; - static LLString firstname; - static LLString lastname; + static std::string firstname; + static std::string lastname; static LLUUID web_login_key; - static LLString password; + static std::string password; static std::vector<const char*> requested_options; static U64 first_sim_handle = 0; @@ -394,16 +394,16 @@ BOOL idle_startup() gSavedSettings.setS32("LastFeatureVersion", LLFeatureManager::getInstance()->getVersion()); - LLString xml_file = LLUI::locateSkin("xui_version.xml"); + std::string xml_file = LLUI::locateSkin("xui_version.xml"); LLXMLNodePtr root; bool xml_ok = false; if (LLXMLNode::parseFile(xml_file, root, NULL)) { if( (root->hasName("xui_version") ) ) { - LLString value = root->getValue(); + std::string value = root->getValue(); F32 version = 0.0f; - LLString::convertToF32(value, version); + LLStringUtil::convertToF32(value, version); if (version >= 1.0f) { xml_ok = true; @@ -414,7 +414,7 @@ BOOL idle_startup() { // *TODO:translate (maybe - very unlikely error message) // Note: alerts.xml may be invalid - if this gets translated it will need to be in the code - LLString bad_xui_msg = "An error occured while updating Second Life. Please download the latest version from www.secondlife.com."; + std::string bad_xui_msg = "An error occured while updating Second Life. Please download the latest version from www.secondlife.com."; LLAppViewer::instance()->earlyExit(bad_xui_msg); } // @@ -422,7 +422,7 @@ BOOL idle_startup() // // Load autopilot and stats stuff - gAgentPilot.load(gSavedSettings.getString("StatsPilotFile").c_str()); + gAgentPilot.load(gSavedSettings.getString("StatsPilotFile")); gFrameStats.setFilename(gSavedSettings.getString("StatsFile")); gFrameStats.setSummaryFilename(gSavedSettings.getString("StatsSummaryFile")); @@ -444,7 +444,7 @@ BOOL idle_startup() std::string message_template_path = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS,"message_template.msg"); LLFILE* found_template = NULL; - found_template = LLFile::fopen(message_template_path.c_str(), "r"); /* Flawfinder: ignore */ + found_template = LLFile::fopen(message_template_path, "r"); /* Flawfinder: ignore */ if (found_template) { fclose(found_template); @@ -645,7 +645,7 @@ BOOL idle_startup() if (STATE_MEDIA_INIT == LLStartUp::getStartupState()) { LL_DEBUGS("AppInit") << "Initializing Multimedia...." << LL_ENDL; - set_startup_status(0.03f, "Initializing Multimedia...", gAgent.mMOTD.c_str()); + set_startup_status(0.03f, "Initializing Multimedia...", gAgent.mMOTD); display_startup(); LLViewerMedia::initClass(); LLViewerParcelMedia::initClass(); @@ -778,8 +778,8 @@ BOOL idle_startup() // create necessary directories // *FIX: these mkdir's should error check - gDirUtilp->setLindenUserDir(firstname.c_str(), lastname.c_str()); - LLFile::mkdir(gDirUtilp->getLindenUserDir().c_str()); + gDirUtilp->setLindenUserDir(firstname, lastname); + LLFile::mkdir(gDirUtilp->getLindenUserDir()); // Set PerAccountSettingsFile to the default value. gSavedSettings.setString("PerAccountSettingsFile", @@ -809,15 +809,15 @@ BOOL idle_startup() gDirUtilp->setChatLogsDir(gSavedPerAccountSettings.getString("InstantMessageLogPath")); } - gDirUtilp->setPerAccountChatLogsDir(firstname.c_str(), lastname.c_str()); + gDirUtilp->setPerAccountChatLogsDir(firstname, lastname); - LLFile::mkdir(gDirUtilp->getChatLogsDir().c_str()); - LLFile::mkdir(gDirUtilp->getPerAccountChatLogsDir().c_str()); + LLFile::mkdir(gDirUtilp->getChatLogsDir()); + LLFile::mkdir(gDirUtilp->getPerAccountChatLogsDir()); if (show_connect_box) { // TODO only set loginuri based on server choice if ! USE_VIEWER_AUTH - LLString server_label; + std::string server_label; S32 domain_name_index; BOOL user_picked_server = LLPanelLogin::getServer( server_label, domain_name_index ); if((EGridInfo)domain_name_index == GRID_INFO_OTHER) @@ -838,7 +838,7 @@ BOOL idle_startup() LLViewerLogin::getInstance()->resetURIs(); } - LLString location; + std::string location; LLPanelLogin::getLocation( location ); LLURLSimString::setString( location ); @@ -894,11 +894,11 @@ BOOL idle_startup() // Display the startup progress bar. gViewerWindow->setShowProgress(TRUE); - gViewerWindow->setProgressCancelButtonVisible(TRUE, "Quit"); + gViewerWindow->setProgressCancelButtonVisible(TRUE, std::string("Quit")); // *TODO: Translate // Poke the VFS, which could potentially block for a while if // Windows XP is acting up - set_startup_status(0.07f, LLTrans::getString("LoginVerifyingCache").c_str(), NULL); + set_startup_status(0.07f, LLTrans::getString("LoginVerifyingCache"), LLStringUtil::null); display_startup(); gVFS->pokeFiles(); @@ -968,16 +968,16 @@ BOOL idle_startup() sAuthUriNum = 0; auth_method = "login_to_simulator"; - LLString::format_map_t args; + LLStringUtil::format_map_t args; args["[APP_NAME]"] = LLAppViewer::instance()->getSecondLifeTitle(); - auth_desc = LLTrans::getString("LoginInProgress", args).c_str(); + auth_desc = LLTrans::getString("LoginInProgress", args); LLStartUp::setStartupState( STATE_LOGIN_AUTHENTICATE ); } if (STATE_LOGIN_AUTHENTICATE == LLStartUp::getStartupState()) { LL_DEBUGS("AppInit") << "STATE_LOGIN_AUTHENTICATE" << LL_ENDL; - set_startup_status(progress, auth_desc.c_str(), auth_message.c_str()); + set_startup_status(progress, auth_desc, auth_message); progress += 0.02f; display_startup(); @@ -991,7 +991,7 @@ BOOL idle_startup() << LLURLSimString::sInstance.mX << "&" << LLURLSimString::sInstance.mY << "&" << LLURLSimString::sInstance.mZ; - start << xml_escape_string(unescaped_start.str().c_str()); + start << xml_escape_string(unescaped_start.str()); } else if (gSavedSettings.getBOOL("LoginLastLocation")) @@ -1012,13 +1012,12 @@ BOOL idle_startup() // TODO if statement here to use web_login_key sAuthUriNum = llclamp(sAuthUriNum, 0, (S32)sAuthUris.size()-1); LLUserAuth::getInstance()->authenticate( - sAuthUris[sAuthUriNum].c_str(), - auth_method.c_str(), - firstname.c_str(), - lastname.c_str(), - // web_login_key, - password.c_str(), - start.str().c_str(), + sAuthUris[sAuthUriNum], + auth_method, + firstname, + lastname, + password, // web_login_key, + start.str(), gSkipOptionalUpdate, gAcceptTOS, gAcceptCriticalMessage, @@ -1040,7 +1039,7 @@ BOOL idle_startup() // If we get here we have gotten past the potential stall // in curl, so take "may appear frozen" out of progress bar. JC auth_desc = "Logging in..."; - set_startup_status(progress, auth_desc.c_str(), auth_message.c_str()); + set_startup_status(progress, auth_desc, auth_message); // Process messages to keep from dropping circuit. LLMessageSystem* msg = gMessageSystem; while (msg->checkAllMessages(gFrameCount, gServicePump)) @@ -1055,7 +1054,7 @@ BOOL idle_startup() } LLStartUp::setStartupState( STATE_LOGIN_DOWNLOADING ); progress += 0.01f; - set_startup_status(progress, auth_desc.c_str(), auth_message.c_str()); + set_startup_status(progress, auth_desc, auth_message); return do_normal_idle; } @@ -1076,7 +1075,7 @@ BOOL idle_startup() } LLStartUp::setStartupState( STATE_LOGIN_PROCESS_RESPONSE ); progress += 0.01f; - set_startup_status(progress, LLTrans::getString("LoginProcessingResponse").c_str(), auth_message.c_str()); + set_startup_status(progress, LLTrans::getString("LoginProcessingResponse"), auth_message); return do_normal_idle; } @@ -1085,9 +1084,9 @@ BOOL idle_startup() LL_DEBUGS("AppInit") << "STATE_LOGIN_PROCESS_RESPONSE" << LL_ENDL; std::ostringstream emsg; BOOL quit = FALSE; - const char* login_response = NULL; - const char* reason_response = NULL; - const char* message_response = NULL; + std::string login_response; + std::string reason_response; + std::string message_response; BOOL successful_login = FALSE; LLUserAuth::UserAuthcode error = LLUserAuth::getInstance()->authResponse(); // reset globals @@ -1097,12 +1096,12 @@ BOOL idle_startup() { case LLUserAuth::E_OK: login_response = LLUserAuth::getInstance()->getResponse("login"); - if(login_response && (0 == strcmp(login_response, "true"))) + if(login_response == "true") { // Yay, login! successful_login = TRUE; } - else if(login_response && (0 == strcmp(login_response, "indeterminate"))) + else if(login_response == "indeterminate") { LL_INFOS("AppInit") << "Indeterminate login..." << LL_ENDL; sAuthUris = LLSRV::rewriteURI(LLUserAuth::getInstance()->getResponse("next_url")); @@ -1111,11 +1110,11 @@ BOOL idle_startup() auth_message = LLUserAuth::getInstance()->getResponse("message"); if(auth_method.substr(0, 5) == "login") { - auth_desc.assign(LLTrans::getString("LoginAuthenticating").c_str()); + auth_desc.assign(LLTrans::getString("LoginAuthenticating")); } else { - auth_desc.assign(LLTrans::getString("LoginMaintenance").c_str()); + auth_desc.assign(LLTrans::getString("LoginMaintenance")); } // ignoring the duration & options array for now. // Go back to authenticate. @@ -1128,15 +1127,15 @@ BOOL idle_startup() reason_response = LLUserAuth::getInstance()->getResponse("reason"); message_response = LLUserAuth::getInstance()->getResponse("message"); - if (gHideLinks && reason_response && (0 == strcmp(reason_response, "disabled"))) + if (gHideLinks && reason_response == "disabled") { emsg << gDisabledMessage; } - else if (message_response) + else if (!message_response.empty()) { // XUI: fix translation for strings returned during login // We need a generic table for translations - LLString big_reason = LLAgent::sTeleportErrorMessages[ message_response ]; + std::string big_reason = LLAgent::sTeleportErrorMessages[ message_response ]; if ( big_reason.size() == 0 ) { emsg << message_response; @@ -1147,7 +1146,7 @@ BOOL idle_startup() } } - if(reason_response && (0 == strcmp(reason_response, "tos"))) + if(reason_response == "tos") { if (show_connect_box) { @@ -1164,7 +1163,7 @@ BOOL idle_startup() quit = TRUE; } } - if(reason_response && (0 == strcmp(reason_response, "critical"))) + if(reason_response == "critical") { if (show_connect_box) { @@ -1181,13 +1180,13 @@ BOOL idle_startup() quit = TRUE; } } - if(reason_response && (0 == strcmp(reason_response, "key"))) + if(reason_response == "key") { // Couldn't login because user/password is wrong // Clear the password password = ""; } - if(reason_response && (0 == strcmp(reason_response, "update"))) + if(reason_response == "update") { auth_message = LLUserAuth::getInstance()->getResponse("message"); if (show_connect_box) @@ -1201,7 +1200,7 @@ BOOL idle_startup() quit = TRUE; } } - if(reason_response && (0 == strcmp(reason_response, "optional"))) + if(reason_response == "optional") { LL_DEBUGS("AppInit") << "Login got optional update" << LL_ENDL; auth_message = LLUserAuth::getInstance()->getResponse("message"); @@ -1228,9 +1227,9 @@ BOOL idle_startup() } else { sAuthUriNum++; std::ostringstream s; - LLString::format_map_t args; + LLStringUtil::format_map_t args; args["[NUMBER]"] = llformat("%d", sAuthUriNum + 1); - auth_desc = LLTrans::getString("LoginAttempt", args).c_str(); + auth_desc = LLTrans::getString("LoginAttempt", args); LLStartUp::setStartupState( STATE_LOGIN_AUTHENTICATE ); return do_normal_idle; } @@ -1248,29 +1247,29 @@ BOOL idle_startup() if(successful_login) { // unpack login data needed by the application - const char* text; + std::string text; text = LLUserAuth::getInstance()->getResponse("agent_id"); - if(text) gAgentID.set(text); + if(!text.empty()) gAgentID.set(text); gDebugInfo["AgentID"] = text; text = LLUserAuth::getInstance()->getResponse("session_id"); - if(text) gAgentSessionID.set(text); + if(!text.empty()) gAgentSessionID.set(text); gDebugInfo["SessionID"] = text; text = LLUserAuth::getInstance()->getResponse("secure_session_id"); - if(text) gAgent.mSecureSessionID.set(text); + if(!text.empty()) gAgent.mSecureSessionID.set(text); text = LLUserAuth::getInstance()->getResponse("first_name"); - if(text) + if(!text.empty()) { // Remove quotes from string. Login.cgi sends these to force // names that look like numbers into strings. firstname.assign(text); - LLString::replaceChar(firstname, '"', ' '); - LLString::trim(firstname); + LLStringUtil::replaceChar(firstname, '"', ' '); + LLStringUtil::trim(firstname); } text = LLUserAuth::getInstance()->getResponse("last_name"); - if(text) lastname.assign(text); + if(!text.empty()) lastname.assign(text); gSavedSettings.setString("FirstName", firstname); gSavedSettings.setString("LastName", lastname); @@ -1285,7 +1284,7 @@ BOOL idle_startup() gSavedSettings.setBOOL("RememberPassword", remember_password); text = LLUserAuth::getInstance()->getResponse("agent_access"); - if(text && (text[0] == 'M')) + if(!text.empty() && (text[0] == 'M')) { gAgent.setTeen(false); } @@ -1295,52 +1294,48 @@ BOOL idle_startup() } text = LLUserAuth::getInstance()->getResponse("start_location"); - if(text) agent_start_location.assign(text); + if(!text.empty()) agent_start_location.assign(text); text = LLUserAuth::getInstance()->getResponse("circuit_code"); - if(text) + if(!text.empty()) { - gMessageSystem->mOurCircuitCode = strtoul(text, NULL, 10); + gMessageSystem->mOurCircuitCode = strtoul(text.c_str(), NULL, 10); } - const char* sim_ip_str = LLUserAuth::getInstance()->getResponse("sim_ip"); - const char* sim_port_str = LLUserAuth::getInstance()->getResponse("sim_port"); - if(sim_ip_str && sim_port_str) + std::string sim_ip_str = LLUserAuth::getInstance()->getResponse("sim_ip"); + std::string sim_port_str = LLUserAuth::getInstance()->getResponse("sim_port"); + if(!sim_ip_str.empty() && !sim_port_str.empty()) { - U32 sim_port = strtoul(sim_port_str, NULL, 10); + U32 sim_port = strtoul(sim_port_str.c_str(), NULL, 10); first_sim.set(sim_ip_str, sim_port); if (first_sim.isOk()) { gMessageSystem->enableCircuit(first_sim, TRUE); } } - const char* region_x_str = LLUserAuth::getInstance()->getResponse("region_x"); - const char* region_y_str = LLUserAuth::getInstance()->getResponse("region_y"); - if(region_x_str && region_y_str) + std::string region_x_str = LLUserAuth::getInstance()->getResponse("region_x"); + std::string region_y_str = LLUserAuth::getInstance()->getResponse("region_y"); + if(!region_x_str.empty() && !region_y_str.empty()) { - U32 region_x = strtoul(region_x_str, NULL, 10); - U32 region_y = strtoul(region_y_str, NULL, 10); + U32 region_x = strtoul(region_x_str.c_str(), NULL, 10); + U32 region_y = strtoul(region_y_str.c_str(), NULL, 10); first_sim_handle = to_region_handle(region_x, region_y); } - const char* look_at_str = LLUserAuth::getInstance()->getResponse("look_at"); - if (look_at_str) + const std::string look_at_str = LLUserAuth::getInstance()->getResponse("look_at"); + if (!look_at_str.empty()) { -#if !LL_WINDOWS && !LL_DARWIN - size_t len = strnlen(look_at_str, MAX_STRING); -#else - size_t len = strlen(look_at_str); -#endif - LLMemoryStream mstr((U8*)look_at_str, len); + size_t len = look_at_str.size(); + LLMemoryStream mstr((U8*)look_at_str.c_str(), len); LLSD sd = LLSDSerialize::fromNotation(mstr, len); agent_start_look_at = ll_vector3_from_sd(sd); } text = LLUserAuth::getInstance()->getResponse("seed_capability"); - if (text) first_sim_seed_cap = text; + if (!text.empty()) first_sim_seed_cap = text; text = LLUserAuth::getInstance()->getResponse("seconds_since_epoch"); - if(text) + if(!text.empty()) { - U32 server_utc_time = strtoul(text, NULL, 10); + U32 server_utc_time = strtoul(text.c_str(), NULL, 10); if(server_utc_time) { time_t now = time(NULL); @@ -1348,15 +1343,11 @@ BOOL idle_startup() } } - const char* home_location = LLUserAuth::getInstance()->getResponse("home"); - if(home_location) + std::string home_location = LLUserAuth::getInstance()->getResponse("home"); + if(!home_location.empty()) { -#if !LL_WINDOWS && !LL_DARWIN - size_t len = strnlen(home_location, MAX_STRING); -#else - size_t len = strlen(home_location); -#endif - LLMemoryStream mstr((U8*)home_location, len); + size_t len = home_location.size(); + LLMemoryStream mstr((U8*)home_location.c_str(), len); LLSD sd = LLSDSerialize::fromNotation(mstr, len); S32 region_x = sd["region_handle"][0].asInteger(); S32 region_y = sd["region_handle"][1].asInteger(); @@ -1373,7 +1364,7 @@ BOOL idle_startup() it = options[0].find("folder_id"); if(it != options[0].end()) { - gAgent.mInventoryRootID.set((*it).second.c_str()); + gAgent.mInventoryRootID.set((*it).second); //gInventory.mock(gAgent.getInventoryRootID()); } } @@ -1435,17 +1426,17 @@ BOOL idle_startup() it = options[0].find("sun_texture_id"); if(it != no_texture) { - gSunTextureID.set((*it).second.c_str()); + gSunTextureID.set((*it).second); } it = options[0].find("moon_texture_id"); if(it != no_texture) { - gMoonTextureID.set((*it).second.c_str()); + gMoonTextureID.set((*it).second); } it = options[0].find("cloud_texture_id"); if(it != no_texture) { - gCloudTextureID.set((*it).second.c_str()); + gCloudTextureID.set((*it).second); } } @@ -1470,7 +1461,7 @@ BOOL idle_startup() exit(0); } // Bounce back to the login screen. - LLStringBase<char>::format_map_t args; + LLStringUtil::format_map_t args; args["[ERROR_MESSAGE]"] = emsg.str(); gViewerWindow->alertXml("ErrorMessage", args, login_alert_done); reset_login(); @@ -1490,7 +1481,7 @@ BOOL idle_startup() exit(0); } // Bounce back to the login screen. - LLStringBase<char>::format_map_t args; + LLStringUtil::format_map_t args; args["[ERROR_MESSAGE]"] = emsg.str(); gViewerWindow->alertXml("ErrorMessage", args, login_alert_done); reset_login(); @@ -1507,7 +1498,7 @@ BOOL idle_startup() //--------------------------------------------------------------------- if (STATE_WORLD_INIT == LLStartUp::getStartupState()) { - set_startup_status(0.40f, LLTrans::getString("LoginInitializingWorld").c_str(), gAgent.mMOTD.c_str()); + set_startup_status(0.40f, LLTrans::getString("LoginInitializingWorld"), gAgent.mMOTD); display_startup(); // We should have an agent id by this point. llassert(!(gAgentID == LLUUID::null)); @@ -1723,7 +1714,7 @@ BOOL idle_startup() for (int i = 0; i < DECODE_TIME_SEC; i++) { F32 frac = (F32)i / (F32)DECODE_TIME_SEC; - set_startup_status(0.45f + frac*0.1f, LLTrans::getString("LoginDecodingImages").c_str(), gAgent.mMOTD.c_str()); + set_startup_status(0.45f + frac*0.1f, LLTrans::getString("LoginDecodingImages"), gAgent.mMOTD); display_startup(); gImageList.decodeAllImages(1.f); } @@ -1761,14 +1752,12 @@ BOOL idle_startup() } //--------------------------------------------------------------------- - - // Agent Send //--------------------------------------------------------------------- if(STATE_WORLD_WAIT == LLStartUp::getStartupState()) { LL_DEBUGS("AppInit") << "Waiting for simulator ack...." << LL_ENDL; - set_startup_status(0.59f, LLTrans::getString("LoginWaitingForRegionHandshake").c_str(), gAgent.mMOTD.c_str()); + set_startup_status(0.59f, LLTrans::getString("LoginWaitingForRegionHandshake"), gAgent.mMOTD); if(gGotUseCircuitCodeAck) { LLStartUp::setStartupState( STATE_AGENT_SEND ); @@ -1787,7 +1776,7 @@ BOOL idle_startup() if (STATE_AGENT_SEND == LLStartUp::getStartupState()) { LL_DEBUGS("AppInit") << "Connecting to region..." << LL_ENDL; - set_startup_status(0.60f, LLTrans::getString("LoginConnectingToRegion").c_str(), gAgent.mMOTD.c_str()); + set_startup_status(0.60f, LLTrans::getString("LoginConnectingToRegion"), gAgent.mMOTD); // register with the message system so it knows we're // expecting this message LLMessageSystem* msg = gMessageSystem; @@ -1870,7 +1859,7 @@ BOOL idle_startup() it = options[0].find("folder_id"); if(it != options[0].end()) { - gInventoryLibraryRoot.set((*it).second.c_str()); + gInventoryLibraryRoot.set((*it).second); } } options.clear(); @@ -1882,7 +1871,7 @@ BOOL idle_startup() it = options[0].find("agent_id"); if(it != options[0].end()) { - gInventoryLibraryOwner.set((*it).second.c_str()); + gInventoryLibraryOwner.set((*it).second); } } options.clear(); @@ -1917,7 +1906,7 @@ BOOL idle_startup() option_it = (*it).find("buddy_id"); if(option_it != (*it).end()) { - agent_id.set((*option_it).second.c_str()); + agent_id.set((*option_it).second); } option_it = (*it).find("buddy_rights_has"); if(option_it != (*it).end()) @@ -1970,7 +1959,7 @@ BOOL idle_startup() { if (option_it->second == "true") { - LLFloaterHUD::show(); + LLFloaterHUD::showHUD(); } } } @@ -1991,19 +1980,27 @@ BOOL idle_startup() LLClassifiedInfo::loadCategories(options); } gInventory.buildParentChildMap(); + + llinfos << "Setting Inventory changed mask and notifying observers" << llendl; gInventory.addChangedMask(LLInventoryObserver::ALL, LLUUID::null); gInventory.notifyObservers(); // set up callbacks + llinfos << "Registering Callbacks" << llendl; LLMessageSystem* msg = gMessageSystem; + llinfos << " Inventory" << llendl; LLInventoryModel::registerCallbacks(msg); + llinfos << " AvatarTracker" << llendl; LLAvatarTracker::instance().registerCallbacks(msg); + llinfos << " Landmark" << llendl; LLLandmark::registerCallbacks(msg); // request mute list + llinfos << "Requesting Mute List" << llendl; LLMuteList::getInstance()->requestFromServer(gAgent.getID()); // Get L$ and ownership credit information + llinfos << "Requesting Money Balance" << llendl; msg->newMessageFast(_PREHASH_MoneyBalanceRequest); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); @@ -2013,11 +2010,13 @@ BOOL idle_startup() gAgent.sendReliableMessage(); // request all group information + llinfos << "Requesting Agent Data" << llendl; gAgent.sendAgentDataUpdateRequest(); BOOL shown_at_exit = gSavedSettings.getBOOL("ShowInventory"); // Create the inventory views + llinfos << "Creating Inventory Views" << llendl; LLInventoryView::showAgentInventory(); // Hide the inventory if it wasn't shown at exit @@ -2072,7 +2071,7 @@ BOOL idle_startup() // based on the comments, we've successfully logged in so we can delete the 'forced' // URL that the updater set in settings.ini (in a mostly paranoid fashion) - LLString nextLoginLocation = gSavedSettings.getString( "NextLoginLocation" ); + std::string nextLoginLocation = gSavedSettings.getString( "NextLoginLocation" ); if ( nextLoginLocation.length() ) { // clear it @@ -2110,13 +2109,13 @@ BOOL idle_startup() if (option_it != response.end()) { const std::string& uuid_string = (*option_it).second; - item_id.set(uuid_string.c_str()); + item_id.set(uuid_string); } option_it = response.find("asset_id"); if (option_it != response.end()) { const std::string& uuid_string = (*option_it).second; - asset_id.set(uuid_string.c_str()); + asset_id.set(uuid_string); } if (item_id.notNull() && asset_id.notNull()) @@ -2180,7 +2179,7 @@ BOOL idle_startup() // location is not your expected location. So, if this is // your first login, then you do not have an expectation, // thus, do not show this alert. - LLString::format_map_t args; + LLStringUtil::format_map_t args; if (url_ok) { args["[TYPE]"] = "desired"; @@ -2237,7 +2236,7 @@ BOOL idle_startup() update_texture_fetch(); set_startup_status(0.60f + 0.40f * timeout_frac, "Loading world...", - gAgent.mMOTD.c_str()); + gAgent.mMOTD); } return do_normal_idle; @@ -2266,15 +2265,15 @@ BOOL idle_startup() { update_texture_fetch(); set_startup_status(0.f + 0.25f * wearables_time / MAX_WEARABLES_TIME, - LLTrans::getString("LoginDownloadingClothing").c_str(), - gAgent.mMOTD.c_str()); + LLTrans::getString("LoginDownloadingClothing"), + gAgent.mMOTD); } return do_normal_idle; } if (STATE_CLEANUP == LLStartUp::getStartupState()) { - set_startup_status(1.0, "", NULL); + set_startup_status(1.0, "", ""); do_normal_idle = TRUE; @@ -2290,7 +2289,7 @@ BOOL idle_startup() gViewerWindow->getWindow()->setCursor(UI_CURSOR_ARROW); LL_DEBUGS("AppInit") << "Done releasing bitmap" << LL_ENDL; gViewerWindow->setShowProgress(FALSE); - gViewerWindow->setProgressCancelButtonVisible(FALSE, ""); + gViewerWindow->setProgressCancelButtonVisible(FALSE); // We're not away from keyboard, even though login might have taken // a while. JC @@ -2368,12 +2367,12 @@ void login_show() LL_DEBUGS("AppInit") << "Setting Servers" << LL_ENDL; - LLPanelLogin::addServer(LLViewerLogin::getInstance()->getGridLabel().c_str(), LLViewerLogin::getInstance()->getGridChoice()); + LLPanelLogin::addServer(LLViewerLogin::getInstance()->getGridLabel(), LLViewerLogin::getInstance()->getGridChoice()); LLViewerLogin* vl = LLViewerLogin::getInstance(); for(int grid_index = GRID_INFO_ADITI; grid_index < GRID_INFO_OTHER; ++grid_index) { - LLPanelLogin::addServer(vl->getKnownGridLabel((EGridInfo)grid_index).c_str(), grid_index); + LLPanelLogin::addServer(vl->getKnownGridLabel((EGridInfo)grid_index), grid_index); } } @@ -2391,7 +2390,7 @@ void login_callback(S32 option, void *userdata) else if (QUIT_OPTION == option) { // Make sure we don't save the password if the user is trying to clear it. - LLString first, last, password; + std::string first, last, password; BOOL remember = TRUE; LLPanelLogin::getFields(first, last, password, remember); if (!remember) @@ -2419,9 +2418,9 @@ void login_callback(S32 option, void *userdata) } } -LLString load_password_from_disk() +std::string load_password_from_disk() { - LLString hashed_password(""); + std::string hashed_password(""); // Look for legacy "marker" password from settings.ini hashed_password = gSavedSettings.getString("Marker"); @@ -2436,7 +2435,7 @@ LLString load_password_from_disk() std::string filepath = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "password.dat"); - LLFILE* fp = LLFile::fopen(filepath.c_str(), "rb"); /* Flawfinder: ignore */ + LLFILE* fp = LLFile::fopen(filepath, "rb"); /* Flawfinder: ignore */ if (!fp) { return hashed_password; @@ -2479,11 +2478,11 @@ void save_password_to_disk(const char* hashed_password) if (!hashed_password) { // No password, remove the file. - LLFile::remove(filepath.c_str()); + LLFile::remove(filepath); } else { - LLFILE* fp = LLFile::fopen(filepath.c_str(), "wb"); /* Flawfinder: ignore */ + LLFILE* fp = LLFile::fopen(filepath, "wb"); /* Flawfinder: ignore */ if (!fp) { return; @@ -2493,7 +2492,7 @@ void save_password_to_disk(const char* hashed_password) const S32 HASHED_LENGTH = 32; U8 buffer[HASHED_LENGTH+1]; - LLString::copy((char*)buffer, hashed_password, HASHED_LENGTH+1); + LLStringUtil::copy((char*)buffer, hashed_password, HASHED_LENGTH+1); LLXORCipher cipher(gMACAddress, 6); cipher.encrypt(buffer, HASHED_LENGTH); @@ -2559,7 +2558,7 @@ void first_run_dialog_callback(S32 option, void* userdata) -void set_startup_status(const F32 frac, const char *string, const char* msg) +void set_startup_status(const F32 frac, const std::string& string, const std::string& msg) { gViewerWindow->setProgressPercent(frac*100); gViewerWindow->setProgressString(string); @@ -2602,7 +2601,7 @@ void update_app(BOOL mandatory, const std::string& auth_msg) { msg = "(" + auth_msg + ") \n"; } - LLStringBase<char>::format_map_t args; + LLStringUtil::format_map_t args; args["[MESSAGE]"] = msg; // represent a bool as a null/non-null pointer @@ -2712,7 +2711,7 @@ void update_dialog_callback(S32 option, void *userdata) updater_source += gDirUtilp->getDirDelimiter(); updater_source += "updater.exe"; - LL_DEBUGS("AppInit") << "Calling CopyFile source: " << updater_source.c_str() + LL_DEBUGS("AppInit") << "Calling CopyFile source: " << updater_source << " dest: " << update_exe_path << LL_ENDL; @@ -2736,9 +2735,9 @@ void update_dialog_callback(S32 option, void *userdata) if (gHideLinks) { // Figure out the program name. - const char* data_dir = gDirUtilp->getAppRODataDir().c_str(); + const std::string& data_dir = gDirUtilp->getAppRODataDir(); // Roll back from the end, stopping at the first '\' - const char* program_name = data_dir + strlen(data_dir); /* Flawfinder: ignore */ + const char* program_name = data_dir.c_str() + data_dir.size(); /* Flawfinder: ignore */ while ( (data_dir != --program_name) && *(program_name) != '\\'); @@ -2790,7 +2789,7 @@ void update_dialog_callback(S32 option, void *userdata) #elif LL_LINUX OSMessageBox("Automatic updating is not yet implemented for Linux.\n" "Please download the latest version from www.secondlife.com.", - NULL, OSMB_OK); + LLStringUtil::null, OSMB_OK); #endif LLAppViewer::instance()->forceQuit(); } @@ -3547,11 +3546,11 @@ void asset_callback_nothing(LLVFS*, const LLUUID&, LLAssetType::EType, void*, S3 } // *HACK: Must match name in Library or agent inventory -const char* COMMON_GESTURES_FOLDER = "Common Gestures"; -const char* MALE_GESTURES_FOLDER = "Male Gestures"; -const char* FEMALE_GESTURES_FOLDER = "Female Gestures"; -const char* MALE_OUTFIT_FOLDER = "Male Shape & Outfit"; -const char* FEMALE_OUTFIT_FOLDER = "Female Shape & Outfit"; +const std::string COMMON_GESTURES_FOLDER = "Common Gestures"; +const std::string MALE_GESTURES_FOLDER = "Male Gestures"; +const std::string FEMALE_GESTURES_FOLDER = "Female Gestures"; +const std::string MALE_OUTFIT_FOLDER = "Male Shape & Outfit"; +const std::string FEMALE_OUTFIT_FOLDER = "Female Shape & Outfit"; const S32 OPT_USE_INITIAL_OUTFIT = -2; const S32 OPT_CLOSED_WINDOW = -1; const S32 OPT_MALE = 0; @@ -3560,12 +3559,11 @@ const S32 OPT_FEMALE = 1; void callback_choose_gender(S32 option, void* userdata) { S32 gender = OPT_FEMALE; - const char* outfit = FEMALE_OUTFIT_FOLDER; - const char* gestures = FEMALE_GESTURES_FOLDER; - const char* common_gestures = COMMON_GESTURES_FOLDER; + std::string outfit; + std::string gestures; if (!gInitialOutfit.empty()) { - outfit = gInitialOutfit.c_str(); + outfit = gInitialOutfit; if (gInitialOutfitGender == "male") { gender = OPT_MALE; @@ -3616,7 +3614,7 @@ void callback_choose_gender(S32 option, void* userdata) wear_outfit_by_name(outfit); } wear_outfit_by_name(gestures); - wear_outfit_by_name(common_gestures); + wear_outfit_by_name(COMMON_GESTURES_FOLDER); typedef std::map<LLUUID, LLMultiGesture*> item_map_t; item_map_t::iterator gestureIterator; @@ -3657,7 +3655,7 @@ void init_start_screen(S32 location_id) LL_DEBUGS("AppInit") << "Loading startup bitmap..." << LL_ENDL; - LLString temp_str = gDirUtilp->getLindenUserDir() + gDirUtilp->getDirDelimiter(); + std::string temp_str = gDirUtilp->getLindenUserDir() + gDirUtilp->getDirDelimiter(); if ((S32)START_LOCATION_ID_LAST == location_id) { diff --git a/indra/newview/llstartup.h b/indra/newview/llstartup.h index 6c832492c0..b5de15d983 100644 --- a/indra/newview/llstartup.h +++ b/indra/newview/llstartup.h @@ -36,13 +36,13 @@ // functions BOOL idle_startup(); -LLString load_password_from_disk(); +std::string load_password_from_disk(); void release_start_screen(); void login_alert_done(S32 option, void* user_data); // constants, variables, & enumerations -extern const char* SCREEN_HOME_FILENAME; -extern const char* SCREEN_LAST_FILENAME; +extern std::string SCREEN_HOME_FILENAME; +extern std::string SCREEN_LAST_FILENAME; enum EStartupState{ STATE_FIRST, // Initial startup diff --git a/indra/newview/llstatusbar.cpp b/indra/newview/llstatusbar.cpp index 0f65510844..a7314548ca 100644 --- a/indra/newview/llstatusbar.cpp +++ b/indra/newview/llstatusbar.cpp @@ -179,9 +179,9 @@ mSquareMetersCommitted(0) mSGBandwidth = new LLStatGraph("BandwidthGraph", r); mSGBandwidth->setFollows(FOLLOWS_BOTTOM | FOLLOWS_RIGHT); mSGBandwidth->setStat(&LLViewerStats::getInstance()->mKBitStat); - LLString text = childGetText("bandwidth_tooltip") + " "; + std::string text = childGetText("bandwidth_tooltip") + " "; LLUIString bandwidth_tooltip = text; // get the text from XML until this widget is XML driven - mSGBandwidth->setLabel(bandwidth_tooltip.getString().c_str()); + mSGBandwidth->setLabel(bandwidth_tooltip.getString()); mSGBandwidth->setUnits("Kbps"); mSGBandwidth->setPrecision(0); mSGBandwidth->setMouseOpaque(FALSE); @@ -194,7 +194,7 @@ mSquareMetersCommitted(0) mSGPacketLoss->setStat(&LLViewerStats::getInstance()->mPacketsLostPercentStat); text = childGetText("packet_loss_tooltip") + " "; LLUIString packet_loss_tooltip = text; // get the text from XML until this widget is XML driven - mSGPacketLoss->setLabel(packet_loss_tooltip.getString().c_str()); + mSGPacketLoss->setLabel(packet_loss_tooltip.getString()); mSGPacketLoss->setUnits("%"); mSGPacketLoss->setMin(0.f); mSGPacketLoss->setMax(5.f); @@ -348,7 +348,7 @@ void LLStatusBar::refresh() childSetRect("health", r); x += buttonRect.getWidth(); - const S32 health_width = S32( LLFontGL::sSansSerifSmall->getWidth("100%") ); + const S32 health_width = S32( LLFontGL::sSansSerifSmall->getWidth(std::string("100%")) ); r.set(x, y+TEXT_HEIGHT - 2, x+health_width, y); mTextHealth->setRect(r); x += health_width; @@ -457,7 +457,7 @@ void LLStatusBar::refresh() x += buttonRect.getWidth(); } - LLString location_name; + std::string location_name; if (region) { const LLVector3& agent_pos_region = gAgent.getPositionAgent(); @@ -493,9 +493,9 @@ void LLStatusBar::refresh() { location_name = region->getName() + llformat(" %d, %d, %d (%s) - %s", - pos_x, pos_y, pos_z, - region->getSimAccessString(), - parcel->getName().c_str()); + pos_x, pos_y, pos_z, + region->getSimAccessString().c_str(), + parcel->getName().c_str()); // keep these around for the LCD to use mRegionDetails.mRegionName = region->getName(); @@ -537,7 +537,7 @@ void LLStatusBar::refresh() location_name = region->getName() + llformat(" %d, %d, %d (%s)", pos_x, pos_y, pos_z, - region->getSimAccessString()); + region->getSimAccessString().c_str()); // keep these around for the LCD to use mRegionDetails.mRegionName = region->getName(); mRegionDetails.mParcelName = "Unknown"; @@ -656,8 +656,8 @@ void LLStatusBar::creditBalance(S32 credit) void LLStatusBar::setBalance(S32 balance) { - LLString money_str = LLResMgr::getInstance()->getMonetaryString( balance ); - LLString balance_str = "L$"; + std::string money_str = LLResMgr::getInstance()->getMonetaryString( balance ); + std::string balance_str = "L$"; balance_str += money_str; mTextBalance->setText( balance_str ); @@ -822,14 +822,14 @@ static void onClickBuyLand(void*) void LLStatusBar::setupDate() { // fill the day array with what's in the xui - LLString day_list = getString("StatBarDaysOfWeek"); + std::string day_list = getString("StatBarDaysOfWeek"); size_t length = day_list.size(); // quick input check if(length < MAX_DATE_STRING_LENGTH) { // tokenize it and put it in the array - LLString cur_word; + std::string cur_word; for(size_t i = 0; i < length; ++i) { if(day_list[i] == ':') @@ -839,21 +839,21 @@ void LLStatusBar::setupDate() } else { - cur_word.append(1, day_list.c_str()[i]); + cur_word.append(1, day_list[i]); } } sDays.push_back(cur_word); } // fill the day array with what's in the xui - LLString month_list = getString( "StatBarMonthsOfYear" ); + std::string month_list = getString( "StatBarMonthsOfYear" ); length = month_list.size(); // quick input check if(length < MAX_DATE_STRING_LENGTH) { // tokenize it and put it in the array - LLString cur_word; + std::string cur_word; for(size_t i = 0; i < length; ++i) { if(month_list[i] == ':') @@ -863,7 +863,7 @@ void LLStatusBar::setupDate() } else { - cur_word.append(1, month_list.c_str()[i]); + cur_word.append(1, month_list[i]); } } sMonths.push_back(cur_word); @@ -892,7 +892,7 @@ void LLStatusBar::onCommitSearch(LLUICtrl*, void* data) void LLStatusBar::onClickSearch(void* data) { LLStatusBar* self = (LLStatusBar*)data; - LLString search_text = self->childGetText("search_editor"); + std::string search_text = self->childGetText("search_editor"); LLFloaterDirectory::showFindAll(search_text); } diff --git a/indra/newview/llstylemap.cpp b/indra/newview/llstylemap.cpp index 09578a011a..0f092b31c4 100644 --- a/indra/newview/llstylemap.cpp +++ b/indra/newview/llstylemap.cpp @@ -60,11 +60,11 @@ const LLStyleSP &LLStyleMap::lookup(const LLUUID &source) { LLStyleSP style(new LLStyle); style->setVisible(true); - style->setFontName(LLString::null); + style->setFontName(LLStringUtil::null); if (source != gAgent.getID() && source != LLUUID::null) { style->setColor(gSavedSettings.getColor4("HTMLLinkColor")); - LLString link = llformat("secondlife:///app/agent/%s/about",source.asString().c_str()); + std::string link = llformat("secondlife:///app/agent/%s/about",source.asString().c_str()); style->setLinkHREF(link); } else diff --git a/indra/newview/lltexlayer.cpp b/indra/newview/lltexlayer.cpp index 6286289d6b..3012625122 100644 --- a/indra/newview/lltexlayer.cpp +++ b/indra/newview/lltexlayer.cpp @@ -991,7 +991,7 @@ BOOL LLTexLayerInfo::parseXml(LLXmlTreeNode* node) static LLStdStringHandle write_all_channels_string = LLXmlTree::addAttributeString("write_all_channels"); node->getFastAttributeBOOL( write_all_channels_string, mWriteAllChannels ); - LLString render_pass_name; + std::string render_pass_name; static LLStdStringHandle render_pass_string = LLXmlTree::addAttributeString("render_pass"); if( node->getFastAttributeString( render_pass_string, render_pass_name ) ) { @@ -1019,7 +1019,7 @@ BOOL LLTexLayerInfo::parseXml(LLXmlTreeNode* node) texture_node; texture_node = node->getNextNamedChild()) { - LLString local_texture; + std::string local_texture; static LLStdStringHandle tga_file_string = LLXmlTree::addAttributeString("tga_file"); static LLStdStringHandle local_texture_string = LLXmlTree::addAttributeString("local_texture"); static LLStdStringHandle file_is_mask_string = LLXmlTree::addAttributeString("file_is_mask"); @@ -1105,14 +1105,14 @@ BOOL LLTexLayerInfo::parseXml(LLXmlTreeNode* node) maskNode; maskNode = node->getNextNamedChild()) { - LLString morph_name; + std::string morph_name; static LLStdStringHandle morph_name_string = LLXmlTree::addAttributeString("morph_name"); if (maskNode->getFastAttributeString(morph_name_string, morph_name)) { BOOL invert = FALSE; static LLStdStringHandle invert_string = LLXmlTree::addAttributeString("invert"); maskNode->getFastAttributeBOOL(invert_string, invert); - mMorphNameList.push_back(std::pair<LLString,BOOL>(morph_name,invert)); + mMorphNameList.push_back(std::pair<std::string,BOOL>(morph_name,invert)); } } @@ -1206,7 +1206,7 @@ BOOL LLTexLayer::setInfo(LLTexLayerInfo* info) // morph target, need a better way of actually looking // this up. LLPolyMorphTarget *morph_param; - LLString *name = &(iter->first); + std::string *name = &(iter->first); morph_param = (LLPolyMorphTarget *)(getTexLayerSet()->getAvatar()->getVisualParam(name->c_str())); if (morph_param) { @@ -2244,11 +2244,11 @@ BOOL LLTexParamColorInfo::parseXml(LLXmlTreeNode *node) return FALSE; } - LLString op_string; + std::string op_string; static LLStdStringHandle operation_string = LLXmlTree::addAttributeString("operation"); if( param_color_node->getFastAttributeString( operation_string, op_string ) ) { - LLString::toLower(op_string); + LLStringUtil::toLower(op_string); if ( op_string == "add" ) mOperation = OP_ADD; else if ( op_string == "multiply" ) mOperation = OP_MULTIPLY; else if ( op_string == "blend" ) mOperation = OP_BLEND; @@ -2465,7 +2465,7 @@ void LLTexStaticImageList::deleteCachedImages() // Returns an LLImageTGA that contains the encoded data from a tga file named file_name. // Caches the result to speed identical subsequent requests. -LLImageTGA* LLTexStaticImageList::getImageTGA(const LLString& file_name) +LLImageTGA* LLTexStaticImageList::getImageTGA(const std::string& file_name) { const char *namekey = sImageNames.addString(file_name); image_tga_map_t::iterator iter = mStaticImageListTGA.find(namekey); @@ -2476,7 +2476,7 @@ LLImageTGA* LLTexStaticImageList::getImageTGA(const LLString& file_name) else { std::string path; - path = gDirUtilp->getExpandedFilename(LL_PATH_CHARACTER,file_name.c_str()); + path = gDirUtilp->getExpandedFilename(LL_PATH_CHARACTER,file_name); LLPointer<LLImageTGA> image_tga = new LLImageTGA( path ); if( image_tga->getDataSize() > 0 ) { @@ -2495,7 +2495,7 @@ LLImageTGA* LLTexStaticImageList::getImageTGA(const LLString& file_name) // Returns a GL Image (without a backing ImageRaw) that contains the decoded data from a tga file named file_name. // Caches the result to speed identical subsequent requests. -LLImageGL* LLTexStaticImageList::getImageGL(const LLString& file_name, BOOL is_mask ) +LLImageGL* LLTexStaticImageList::getImageGL(const std::string& file_name, BOOL is_mask ) { LLPointer<LLImageGL> image_gl; const char *namekey = sImageNames.addString(file_name); @@ -2536,11 +2536,11 @@ LLImageGL* LLTexStaticImageList::getImageGL(const LLString& file_name, BOOL is_m // Reads a .tga file, decodes it, and puts the decoded data in image_raw. // Returns TRUE if successful. -BOOL LLTexStaticImageList::loadImageRaw( const LLString& file_name, LLImageRaw* image_raw ) +BOOL LLTexStaticImageList::loadImageRaw( const std::string& file_name, LLImageRaw* image_raw ) { BOOL success = FALSE; std::string path; - path = gDirUtilp->getExpandedFilename(LL_PATH_CHARACTER,file_name.c_str()); + path = gDirUtilp->getExpandedFilename(LL_PATH_CHARACTER,file_name); LLPointer<LLImageTGA> image_tga = new LLImageTGA( path ); if( image_tga->getDataSize() > 0 ) { diff --git a/indra/newview/lltexlayer.h b/indra/newview/lltexlayer.h index 458db88b8e..59a0660a94 100644 --- a/indra/newview/lltexlayer.h +++ b/indra/newview/lltexlayer.h @@ -87,7 +87,7 @@ public: /*virtual*/ BOOL parseXml(LLXmlTreeNode* node); protected: - LLString mStaticImageFileName; + std::string mStaticImageFileName; BOOL mMultiplyBlend; BOOL mSkipIfZeroWeight; F32 mDomain; @@ -127,7 +127,7 @@ public: protected: typedef std::vector<LLTexParamColorInfo *> color_info_list_t; color_info_list_t mColorInfoList; - LLString mName; + std::string mName; }; //----------------------------------------------------------------------------- @@ -144,10 +144,10 @@ public: BOOL parseXml(LLXmlTreeNode* node); protected: - LLString mBodyRegion; + std::string mBodyRegion; S32 mWidth; S32 mHeight; - LLString mStaticAlphaFileName; + std::string mStaticAlphaFileName; BOOL mClearAlpha; // Set alpha to 1 for this layerset (if there is no mStaticAlphaFileName) typedef std::vector<LLTexLayerInfo*> layer_info_list_t; @@ -174,20 +174,20 @@ public: BOOL parseXml(LLXmlTreeNode* node); protected: - LLString mName; + std::string mName; BOOL mWriteAllChannels; // Don't use masking. Just write RGBA into buffer, ERenderPass mRenderPass; - LLString mGlobalColor; + std::string mGlobalColor; LLColor4 mFixedColor; S32 mLocalTexture; - LLString mStaticImageFileName; + std::string mStaticImageFileName; BOOL mStaticImageIsMask; BOOL mUseLocalTextureAlphaOnly; // Ignore RGB channels from the input texture. Use alpha as a mask - typedef std::vector<std::pair<LLString,BOOL> > morph_name_list_t; + typedef std::vector<std::pair<std::string,BOOL> > morph_name_list_t; morph_name_list_t mMorphNameList; typedef std::vector<LLTexParamColorInfo*> color_info_list_t; @@ -261,7 +261,7 @@ public: BOOL render( S32 x, S32 y, S32 width, S32 height ); BOOL renderBump( S32 x, S32 y, S32 width,S32 height ); - BOOL isBodyRegion( const char* region ) { return mInfo->mBodyRegion == region; } + BOOL isBodyRegion( const std::string& region ) { return mInfo->mBodyRegion == region; } LLTexLayerSetBuffer* getComposite(); void requestUpdate(); void requestUpload(); @@ -277,7 +277,7 @@ public: void deleteCaches(); void gatherAlphaMasks(U8 *data, S32 width, S32 height); void applyMorphMask(U8* tex_data, S32 width, S32 height, S32 num_components); - const LLString& getBodyRegion() { return mInfo->mBodyRegion; } + const std::string getBodyRegion() { return mInfo->mBodyRegion; } BOOL hasComposite() { return (mComposite != NULL); } void setBump( BOOL b ) { mHasBump = b; } BOOL hasBump() { return mHasBump; } @@ -339,7 +339,7 @@ public: void invalidateMorphMasks(); ERenderPass getRenderPass() { return mInfo->mRenderPass; } - const LLString& getGlobalColor() { return mInfo->mGlobalColor; } + const std::string& getGlobalColor() { return mInfo->mGlobalColor; } BOOL findNetColor( LLColor4* color ); BOOL renderImageRaw( U8* in_data, S32 in_width, S32 in_height, S32 in_components, S32 width, S32 height, BOOL is_mask ); BOOL renderAlphaMasks( S32 x, S32 y, S32 width, S32 height, LLColor4* colorp ); @@ -506,15 +506,15 @@ public: LLTexStaticImageList(); ~LLTexStaticImageList(); - LLImageRaw* getImageRaw( const LLString& file_name ); - LLImageGL* getImageGL( const LLString& file_name, BOOL is_mask ); - LLImageTGA* getImageTGA( const LLString& file_name ); + LLImageRaw* getImageRaw( const std::string& file_name ); + LLImageGL* getImageGL( const std::string& file_name, BOOL is_mask ); + LLImageTGA* getImageTGA( const std::string& file_name ); void deleteCachedImages(); void dumpByteCount(); private: - BOOL loadImageRaw( const LLString& file_name, LLImageRaw* image_raw ); + BOOL loadImageRaw( const std::string& file_name, LLImageRaw* image_raw ); private: static LLStringTable sImageNames; diff --git a/indra/newview/lltexturecache.cpp b/indra/newview/lltexturecache.cpp index 10801cfd4f..fad6acc65a 100644 --- a/indra/newview/lltexturecache.cpp +++ b/indra/newview/lltexturecache.cpp @@ -155,7 +155,7 @@ protected: class LLTextureCacheLocalFileWorker : public LLTextureCacheWorker { public: - LLTextureCacheLocalFileWorker(LLTextureCache* cache, U32 priority, const LLString& filename, const LLUUID& id, + LLTextureCacheLocalFileWorker(LLTextureCache* cache, U32 priority, const std::string& filename, const LLUUID& id, U8* data, S32 datasize, S32 offset, S32 imagesize, // for writes LLTextureCache::Responder* responder) @@ -169,7 +169,7 @@ public: virtual bool doWrite(); private: - LLString mFileName; + std::string mFileName; }; bool LLTextureCacheLocalFileWorker::doRead() @@ -180,7 +180,7 @@ bool LLTextureCacheLocalFileWorker::doRead() { mDataSize = local_size; // Only a complete file is valid - LLString extension = mFileName.substr(mFileName.size() - 3, 3); + std::string extension = mFileName.substr(mFileName.size() - 3, 3); mImageFormat = LLImageBase::getCodecFromExtension(extension); @@ -1033,12 +1033,12 @@ S64 LLTextureCache::initCache(ELLPath location, S64 max_size, BOOL read_only) if (!mReadOnly) { - LLFile::mkdir(mTexturesDirName.c_str()); + LLFile::mkdir(mTexturesDirName); const char* subdirs = "0123456789abcdef"; for (S32 i=0; i<16; i++) { std::string dirname = mTexturesDirName + gDirUtilp->getDirDelimiter() + subdirs[i]; - LLFile::mkdir(dirname.c_str()); + LLFile::mkdir(dirname); } } readHeaderCache(); @@ -1134,16 +1134,16 @@ void LLTextureCache::purgeAllTextures(bool purge_directories) for (S32 i=0; i<16; i++) { std::string dirname = mTexturesDirName + delem + subdirs[i]; - gDirUtilp->deleteFilesInDir(dirname.c_str(),mask); + gDirUtilp->deleteFilesInDir(dirname,mask); if (purge_directories) { - LLFile::rmdir(dirname.c_str()); + LLFile::rmdir(dirname); } } ll_apr_file_remove(mTexturesDirEntriesFileName, NULL); if (purge_directories) { - LLFile::rmdir(mTexturesDirName.c_str()); + LLFile::rmdir(mTexturesDirName); } } mTexturesSizeMap.clear(); @@ -1392,7 +1392,7 @@ S32 LLTextureCache::getHeaderCacheEntry(const LLUUID& id, bool touch, S32* image // Calls from texture pipeline thread (i.e. LLTextureFetch) -LLTextureCache::handle_t LLTextureCache::readFromCache(const LLString& filename, const LLUUID& id, U32 priority, +LLTextureCache::handle_t LLTextureCache::readFromCache(const std::string& filename, const LLUUID& id, U32 priority, S32 offset, S32 size, ReadResponder* responder) { // Note: checking to see if an entry exists can cause a stall, diff --git a/indra/newview/lltexturecache.h b/indra/newview/lltexturecache.h index 28b33d5c4e..da7a6c3f12 100644 --- a/indra/newview/lltexturecache.h +++ b/indra/newview/lltexturecache.h @@ -83,7 +83,7 @@ public: void purgeCache(ELLPath location); S64 initCache(ELLPath location, S64 maxsize, BOOL read_only); - handle_t readFromCache(const LLString& local_filename, const LLUUID& id, U32 priority, S32 offset, S32 size, + handle_t readFromCache(const std::string& local_filename, const LLUUID& id, U32 priority, S32 offset, S32 size, ReadResponder* responder); handle_t readFromCache(const LLUUID& id, U32 priority, S32 offset, S32 size, diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp index b89e93b9a4..421f0196e3 100644 --- a/indra/newview/lltexturectrl.cpp +++ b/indra/newview/lltexturectrl.cpp @@ -118,7 +118,7 @@ public: virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, void *cargo_data, EAcceptance *accept, - LLString& tooltip_msg); + std::string& tooltip_msg); virtual void draw(); virtual BOOL handleKeyHere(KEY key, MASK mask); @@ -156,7 +156,7 @@ public: static void onSelectionChange(const std::deque<LLFolderViewItem*> &items, BOOL user_action, void* data); static void onShowFolders(LLUICtrl* ctrl, void* userdata); static void onApplyImmediateCheck(LLUICtrl* ctrl, void* userdata); - static void onSearchEdit(const LLString& search_string, void* user_data ); + static void onSearchEdit(const std::string& search_string, void* user_data ); static void onTextureSelect( const LLTextureEntry& te, void *data ); protected: @@ -174,7 +174,7 @@ protected: LLTextBox* mTentativeLabel; LLTextBox* mResolutionLabel; - LLString mPendingName; + std::string mPendingName; BOOL mIsDirty; BOOL mActive; @@ -196,9 +196,9 @@ LLFloaterTexturePicker::LLFloaterTexturePicker( PermissionMask non_immediate_filter_perm_mask, BOOL can_apply_immediately) : - LLFloater( "texture picker", + LLFloater( std::string("texture picker"), rect, - LLString( "Pick: " ) + label, + std::string( "Pick: " ) + label, TRUE, TEX_PICKER_MIN_WIDTH, TEX_PICKER_MIN_HEIGHT ), mOwner( owner ), @@ -346,12 +346,12 @@ void LLFloaterTexturePicker::updateImageStats() //RN: have we received header data for this image? if (mTexturep->getWidth(0) > 0 && mTexturep->getHeight(0) > 0) { - LLString formatted_dims = llformat("%d x %d", mTexturep->getWidth(0),mTexturep->getHeight(0)); + std::string formatted_dims = llformat("%d x %d", mTexturep->getWidth(0),mTexturep->getHeight(0)); mResolutionLabel->setTextArg("[DIMENSIONS]", formatted_dims); } else { - mResolutionLabel->setTextArg("[DIMENSIONS]", LLString("[? x ?]")); + mResolutionLabel->setTextArg("[DIMENSIONS]", std::string("[? x ?]")); } } } @@ -362,7 +362,7 @@ BOOL LLFloaterTexturePicker::handleDragAndDrop( BOOL drop, EDragAndDropType cargo_type, void *cargo_data, EAcceptance *accept, - LLString& tooltip_msg) + std::string& tooltip_msg) { BOOL handled = FALSE; @@ -816,12 +816,12 @@ void LLFloaterTexturePicker::updateFilterPermMask() //mInventoryPanel->setFilterPermMask( getFilterPermMask() ); Commented out due to no-copy texture loss. } -void LLFloaterTexturePicker::onSearchEdit(const LLString& search_string, void* user_data ) +void LLFloaterTexturePicker::onSearchEdit(const std::string& search_string, void* user_data ) { LLFloaterTexturePicker* picker = (LLFloaterTexturePicker*)user_data; std::string upper_case_search_string = search_string; - LLString::toUpper(upper_case_search_string); + LLStringUtil::toUpper(upper_case_search_string); if (upper_case_search_string.empty()) { @@ -924,11 +924,11 @@ LLTextureCtrl::LLTextureCtrl( S32 image_middle = (image_top + image_bottom) / 2; S32 line_height = llround(LLFontGL::sSansSerifSmall->getLineHeight()); - mTentativeLabel = new LLTextBox( "Multiple", + mTentativeLabel = new LLTextBox( std::string("Multiple"), LLRect( 0, image_middle + line_height / 2, getRect().getWidth(), image_middle - line_height / 2 ), - "Multiple", + std::string("Multiple"), LLFontGL::sSansSerifSmall ); mTentativeLabel->setHAlign( LLFontGL::HCENTER ); mTentativeLabel->setFollowsAll(); @@ -936,7 +936,7 @@ LLTextureCtrl::LLTextureCtrl( LLRect border_rect(0, getRect().getHeight(), getRect().getWidth(), 0); border_rect.mBottom += BTN_HEIGHT_SMALL; - mBorder = new LLViewBorder("border", border_rect, LLViewBorder::BEVEL_IN); + mBorder = new LLViewBorder(std::string("border"), border_rect, LLViewBorder::BEVEL_IN); mBorder->setFollowsAll(); addChild(mBorder); @@ -968,22 +968,22 @@ LLXMLNodePtr LLTextureCtrl::getXML(bool save_children) const LLView* LLTextureCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory) { - LLString name("texture_picker"); + std::string name("texture_picker"); node->getAttributeString("name", name); LLRect rect; createRect(node, rect, parent); - LLString label; + std::string label; node->getAttributeString("label", label); - LLString image_id(""); + std::string image_id(""); node->getAttributeString("image", image_id); - LLString default_image_id(""); + std::string default_image_id(""); node->getAttributeString("default_image", default_image_id); - LLString default_image_name("Default"); + std::string default_image_name("Default"); node->getAttributeString("default_image_name", default_image_name); BOOL allow_no_texture = FALSE; @@ -1017,7 +1017,7 @@ void LLTextureCtrl::setShowLoadingPlaceholder(BOOL showLoadingPlaceholder) mShowLoadingPlaceholder = showLoadingPlaceholder; } -void LLTextureCtrl::setCaption(const LLString& caption) +void LLTextureCtrl::setCaption(const std::string& caption) { mCaption->setText( caption ); } @@ -1046,13 +1046,13 @@ void LLTextureCtrl::setEnabled( BOOL enabled ) LLFloaterTexturePicker* floaterp = (LLFloaterTexturePicker*)mFloaterHandle.get(); if( enabled ) { - LLString tooltip; + std::string tooltip; if (floaterp) tooltip = floaterp->getUIString("choose_picture"); setToolTip( tooltip ); } else { - setToolTip( LLString() ); + setToolTip( std::string() ); // *TODO: would be better to keep floater open and show // disabled state. closeFloater(); @@ -1100,7 +1100,7 @@ void LLTextureCtrl::clear() setImageAssetID(LLUUID::null); } -void LLTextureCtrl::setLabel(const LLString& label) +void LLTextureCtrl::setLabel(const std::string& label) { mLabel = label; mCaption->setText(label); @@ -1251,7 +1251,7 @@ void LLTextureCtrl::setImageAssetID( const LLUUID& asset_id ) BOOL LLTextureCtrl::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, void *cargo_data, EAcceptance *accept, - LLString& tooltip_msg) + std::string& tooltip_msg) { BOOL handled = FALSE; @@ -1435,7 +1435,7 @@ protected: LLToolTexEyedropper::LLToolTexEyedropper( void (*callback)(const LLUUID& obj_id, const LLUUID& image_id, void* userdata ), void* userdata ) - : LLTool("texeyedropper"), + : LLTool(std::string("texeyedropper")), mCallback( callback ), mCallbackUserData( userdata ) { diff --git a/indra/newview/lltexturectrl.h b/indra/newview/lltexturectrl.h index 5dabf07ce5..cf83c628b8 100644 --- a/indra/newview/lltexturectrl.h +++ b/indra/newview/lltexturectrl.h @@ -81,7 +81,7 @@ public: virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, void *cargo_data, EAcceptance *accept, - LLString& tooltip_msg); + std::string& tooltip_msg); virtual BOOL handleHover(S32 x, S32 y, MASK mask); virtual BOOL handleUnicodeCharHere(llwchar uni_char); @@ -103,8 +103,8 @@ public: // LLTextureCtrl interface void showPicker(BOOL take_focus); - void setLabel(const LLString& label); - const LLString& getLabel() const { return mLabel; } + void setLabel(const std::string& label); + const std::string& getLabel() const { return mLabel; } void setAllowNoTexture( BOOL b ) { mAllowNoTexture = b; } bool getAllowNoTexture() const { return mAllowNoTexture; } @@ -116,10 +116,10 @@ public: void setDefaultImageAssetID( const LLUUID& id ) { mDefaultImageAssetID = id; } - const LLString& getDefaultImageName() const { return mDefaultImageName; } + const std::string& getDefaultImageName() const { return mDefaultImageName; } const LLUUID& getDefaultImageAssetID() const { return mDefaultImageAssetID; } - void setCaption(const LLString& caption); + void setCaption(const std::string& caption); void setCanApplyImmediately(BOOL b); void setImmediateFilterPermMask(PermissionMask mask) @@ -163,11 +163,11 @@ private: LLUUID mImageItemID; LLUUID mImageAssetID; LLUUID mDefaultImageAssetID; - LLString mDefaultImageName; + std::string mDefaultImageName; LLHandle<LLFloater> mFloaterHandle; LLTextBox* mTentativeLabel; LLTextBox* mCaption; - LLString mLabel; + std::string mLabel; BOOL mAllowNoTexture; // If true, the user can select "none" as an option LLCoordGL mLastFloaterLeftTop; PermissionMask mImmediateFilterPermMask; @@ -178,7 +178,7 @@ private: BOOL mValid; BOOL mDirty; BOOL mShowLoadingPlaceholder; - LLString mLoadingPlaceholderString; + std::string mLoadingPlaceholderString; }; // XUI HACK: When floaters converted, switch this file to lltexturepicker.h/cpp diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp index c5ae50c050..f32e4dd531 100644 --- a/indra/newview/lltexturefetch.cpp +++ b/indra/newview/lltexturefetch.cpp @@ -235,7 +235,7 @@ private: /*virtual*/ void startWork(S32 param); // called from addWork() (MAIN THREAD) /*virtual*/ void endWork(S32 param, bool aborted); // called from doWork() (MAIN THREAD) - virtual LLString getName() { return LLString::null; } + virtual std::string getName() { return LLStringUtil::null; } void resetFormattedData(); void setImagePriority(F32 priority); @@ -345,18 +345,18 @@ class LLTextureFetchLocalFileWorker : public LLTextureFetchWorker friend class LLTextureFetch; protected: - LLTextureFetchLocalFileWorker(LLTextureFetch* fetcher, const LLString& filename, const LLUUID& id, const LLHost& host, + LLTextureFetchLocalFileWorker(LLTextureFetch* fetcher, const std::string& filename, const LLUUID& id, const LLHost& host, F32 priority, S32 discard, S32 size) : LLTextureFetchWorker(fetcher, id, host, priority, discard, size), mFileName(filename) {} private: - /*virtual*/ LLString getName() { return mFileName; } + /*virtual*/ std::string getName() { return mFileName; } private: - LLString mFileName; + std::string mFileName; }; @@ -1313,10 +1313,10 @@ LLTextureFetch::~LLTextureFetch() bool LLTextureFetch::createRequest(const LLUUID& id, const LLHost& host, F32 priority, S32 w, S32 h, S32 c, S32 desired_discard, bool needs_aux) { - return createRequest(LLString::null, id, host, priority, w, h, c, desired_discard, needs_aux); + return createRequest(LLStringUtil::null, id, host, priority, w, h, c, desired_discard, needs_aux); } -bool LLTextureFetch::createRequest(const LLString& filename, const LLUUID& id, const LLHost& host, F32 priority, +bool LLTextureFetch::createRequest(const std::string& filename, const LLUUID& id, const LLHost& host, F32 priority, S32 w, S32 h, S32 c, S32 desired_discard, bool needs_aux) { if (mDebugPause) diff --git a/indra/newview/lltexturefetch.h b/indra/newview/lltexturefetch.h index 9f55a4ee92..e0f444b3cd 100644 --- a/indra/newview/lltexturefetch.h +++ b/indra/newview/lltexturefetch.h @@ -55,7 +55,7 @@ public: bool createRequest(const LLUUID& id, const LLHost& host, F32 priority, S32 w, S32 h, S32 c, S32 discard, bool needs_aux); - bool createRequest(const LLString& filename, const LLUUID& id, const LLHost& host, F32 priority, + bool createRequest(const std::string& filename, const LLUUID& id, const LLHost& host, F32 priority, S32 w, S32 h, S32 c, S32 discard, bool needs_aux); void deleteRequest(const LLUUID& id, bool cancel); bool getRequestFinished(const LLUUID& id, S32& discard_level, diff --git a/indra/newview/lltextureview.cpp b/indra/newview/lltextureview.cpp index a9005ef71b..43f8391b55 100644 --- a/indra/newview/lltextureview.cpp +++ b/indra/newview/lltextureview.cpp @@ -61,11 +61,11 @@ std::set<LLViewerImage*> LLTextureView::sDebugImages; //////////////////////////////////////////////////////////////////////////// -static LLString title_string1a("Tex UUID Area DDis(Req) DecodePri(Fetch) [download] pk/max"); -static LLString title_string1b("Tex UUID Area DDis(Req) Fetch(DecodePri) [download] pk/max"); -static LLString title_string2("State"); -static LLString title_string3("Pkt Bnd"); -static LLString title_string4(" W x H (Dis) Mem"); +static std::string title_string1a("Tex UUID Area DDis(Req) DecodePri(Fetch) [download] pk/max"); +static std::string title_string1b("Tex UUID Area DDis(Req) Fetch(DecodePri) [download] pk/max"); +static std::string title_string2("State"); +static std::string title_string3("Pkt Bnd"); +static std::string title_string4(" W x H (Dis) Mem"); static S32 title_x1 = 0; static S32 title_x2 = 440; @@ -175,7 +175,7 @@ void LLTextureBar::draw() // The texture UUID or name // The progress bar for the texture, highlighted if it's being download // Various numerical stats. - char tex_str[256]; + std::string tex_str; S32 left, right; S32 top = 0; S32 bottom = top + 6; @@ -184,28 +184,28 @@ void LLTextureBar::draw() LLGLSUIDefault gls_ui; // Name, pixel_area, requested pixel area, decode priority - char uuid_str[255]; + std::string uuid_str; mImagep->mID.toString(uuid_str); - uuid_str[8] = 0; + uuid_str = uuid_str.substr(0,7); if (mTextureView->mOrderFetch) { - sprintf(tex_str, "%s %7.0f %d(%d) 0x%08x(%8.0f)", - uuid_str, - mImagep->mMaxVirtualSize, - mImagep->mDesiredDiscardLevel, - mImagep->mRequestedDiscardLevel, - mImagep->mFetchPriority, - mImagep->getDecodePriority()); + tex_str = llformat("%s %7.0f %d(%d) 0x%08x(%8.0f)", + uuid_str.c_str(), + mImagep->mMaxVirtualSize, + mImagep->mDesiredDiscardLevel, + mImagep->mRequestedDiscardLevel, + mImagep->mFetchPriority, + mImagep->getDecodePriority()); } else { - sprintf(tex_str, "%s %7.0f %d(%d) %8.0f(0x%08x)", - uuid_str, - mImagep->mMaxVirtualSize, - mImagep->mDesiredDiscardLevel, - mImagep->mRequestedDiscardLevel, - mImagep->getDecodePriority(), - mImagep->mFetchPriority); + tex_str = llformat("%s %7.0f %d(%d) %8.0f(0x%08x)", + uuid_str.c_str(), + mImagep->mMaxVirtualSize, + mImagep->mDesiredDiscardLevel, + mImagep->mRequestedDiscardLevel, + mImagep->getDecodePriority(), + mImagep->mFetchPriority); } LLFontGL::sMonospace->renderUTF8(tex_str, 0, title_x1, getRect().getHeight(), @@ -213,7 +213,7 @@ void LLTextureBar::draw() // State // Hack: mirrored from lltexturefetch.cpp - struct { const char* desc; LLColor4 color; } fetch_state_desc[] = { + struct { const std::string desc; LLColor4 color; } fetch_state_desc[] = { { "---", LLColor4::red }, // INVALID { "INI", LLColor4::white }, // INIT { "DSK", LLColor4::cyan }, // LOAD_FROM_TEXTURE_CACHE @@ -325,14 +325,14 @@ void LLTextureBar::draw() LLGLSUIDefault gls_ui; // draw the packet data // { -// LLString num_str = llformat("%3d/%3d", mImagep->mLastPacket+1, mImagep->mPackets); +// std::string num_str = llformat("%3d/%3d", mImagep->mLastPacket+1, mImagep->mPackets); // LLFontGL::sMonospace->renderUTF8(num_str, 0, bar_left + 100, getRect().getHeight(), color, // LLFontGL::LEFT, LLFontGL::TOP); // } // draw the image size at the end { - LLString num_str = llformat("%3dx%3d (%d) %7d", mImagep->getWidth(), mImagep->getHeight(), + std::string num_str = llformat("%3dx%3d (%d) %7d", mImagep->getWidth(), mImagep->getHeight(), mImagep->getDiscardLevel(), mImagep->mTextureMemory); LLFontGL::sMonospace->renderUTF8(num_str, 0, title_x4, getRect().getHeight(), color, LLFontGL::LEFT, LLFontGL::TOP); @@ -474,13 +474,13 @@ void LLGLTexMemBar::draw() S32 dx1 = 0; if (LLAppViewer::getTextureFetch()->mDebugPause) { - LLFontGL::sMonospace->renderUTF8("!", 0, title_x1, line_height, + LLFontGL::sMonospace->renderUTF8(std::string("!"), 0, title_x1, line_height, text_color, LLFontGL::LEFT, LLFontGL::TOP); dx1 += 8; } if (mTextureView->mFreezeView) { - LLFontGL::sMonospace->renderUTF8("*", 0, title_x1, line_height, + LLFontGL::sMonospace->renderUTF8(std::string("*"), 0, title_x1, line_height, text_color, LLFontGL::LEFT, LLFontGL::TOP); dx1 += 8; } @@ -713,8 +713,8 @@ void LLTextureView::draw() /* count = gImageList.getNumImages(); - char info_string[512]; - sprintf(info_string, "Global Info:\nTexture Count: %d", count); + std::string info_string; + info_string = llformat("Global Info:\nTexture Count: %d", count); mInfoTextp->setText(info_string); */ diff --git a/indra/newview/lltool.cpp b/indra/newview/lltool.cpp index 0398b7a0c1..22690b550a 100644 --- a/indra/newview/lltool.cpp +++ b/indra/newview/lltool.cpp @@ -46,9 +46,9 @@ extern BOOL gDebugClicks; //static -const LLString LLTool::sNameNull("null"); +const std::string LLTool::sNameNull("null"); -LLTool::LLTool( const LLString& name, LLToolComposite* composite ) : +LLTool::LLTool( const std::string& name, LLToolComposite* composite ) : mComposite( composite ), mName(name) { @@ -124,7 +124,7 @@ BOOL LLTool::handleRightMouseUp(S32 x, S32 y, MASK mask) return FALSE; } -BOOL LLTool::handleToolTip(S32 x, S32 y, LLString& msg, LLRect* sticky_rect_screen) +BOOL LLTool::handleToolTip(S32 x, S32 y, std::string& msg, LLRect* sticky_rect_screen) { // by default, didn't handle it // llinfos << "LLTool::handleToolTip" << llendl; diff --git a/indra/newview/lltool.h b/indra/newview/lltool.h index 7d565f1574..3cc7f24712 100644 --- a/indra/newview/lltool.h +++ b/indra/newview/lltool.h @@ -47,7 +47,7 @@ class LLTool : public LLMouseHandler { public: - LLTool( const LLString& name, LLToolComposite* composite = NULL ); + LLTool( const std::string& name, LLToolComposite* composite = NULL ); virtual ~LLTool(); // Hack to support LLFocusMgr @@ -61,14 +61,14 @@ public: virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask); 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_screen); + virtual BOOL handleToolTip(S32 x, S32 y, std::string& msg, LLRect* sticky_rect_screen); // Return FALSE to allow context menu to be shown. virtual void screenPointToLocal(S32 screen_x, S32 screen_y, S32* local_x, S32* local_y) const { *local_x = screen_x; *local_y = screen_y; } virtual void localPointToScreen(S32 local_x, S32 local_y, S32* screen_x, S32* screen_y) const { *screen_x = local_x; *screen_y = local_y; } - virtual const LLString& getName() const { return mName; } + virtual const std::string& getName() const { return mName; } // New virtual functions virtual LLViewerObject* getEditingObject() { return NULL; } @@ -99,10 +99,10 @@ public: protected: LLToolComposite* mComposite; // Composite will handle mouse captures. - LLString mName; + std::string mName; public: - static const LLString sNameNull; + static const std::string sNameNull; }; #endif diff --git a/indra/newview/lltoolbar.cpp b/indra/newview/lltoolbar.cpp index 1ab1b15108..39dc0362b3 100644 --- a/indra/newview/lltoolbar.cpp +++ b/indra/newview/lltoolbar.cpp @@ -75,7 +75,7 @@ class LLFakeResizeHandle : public LLResizeHandle { public: - LLFakeResizeHandle(const LLString& name, const LLRect& rect, S32 min_width, S32 min_height, ECorner corner = RIGHT_BOTTOM ) + LLFakeResizeHandle(const std::string& name, const LLRect& rect, S32 min_width, S32 min_height, ECorner corner = RIGHT_BOTTOM ) : LLResizeHandle(name, rect, min_width, min_height, corner ) { @@ -169,7 +169,7 @@ BOOL LLToolBar::postBuild() if(mResizeHandle == NULL) { LLRect rect(0, 0, RESIZE_HANDLE_WIDTH, RESIZE_HANDLE_HEIGHT); - mResizeHandle = new LLFakeResizeHandle(LLString(""), rect, RESIZE_HANDLE_WIDTH, RESIZE_HANDLE_HEIGHT); + mResizeHandle = new LLFakeResizeHandle(std::string(""), rect, RESIZE_HANDLE_WIDTH, RESIZE_HANDLE_HEIGHT); this->addChildAtEnd(mResizeHandle); LLLayoutStack* toolbar_stack = getChild<LLLayoutStack>("toolbar_stack"); toolbar_stack->reshape(toolbar_stack->getRect().getWidth() - RESIZE_HANDLE_WIDTH, toolbar_stack->getRect().getHeight()); @@ -191,7 +191,7 @@ BOOL LLToolBar::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, - LLString& tooltip_msg) + std::string& tooltip_msg) { LLButton* inventory_btn = getChild<LLButton>("inventory_btn"); if (!inventory_btn) return FALSE; @@ -356,7 +356,7 @@ void LLToolBar::updateCommunicateList() LLFloaterIMPanel* im_floaterp = (LLFloaterIMPanel*)floater_handle_it->get(); if (im_floaterp) { - LLString floater_title = im_floaterp->getNumUnreadMessages() > 0 ? "*" : ""; + std::string floater_title = im_floaterp->getNumUnreadMessages() > 0 ? "*" : ""; floater_title.append(im_floaterp->getShortTitle()); itemp = communicate_button->add(floater_title, im_floaterp->getSessionID(), ADD_TOP); if (im_floaterp == frontmost_floater) diff --git a/indra/newview/lltoolbar.h b/indra/newview/lltoolbar.h index 28a03aa5d9..19761692c9 100644 --- a/indra/newview/lltoolbar.h +++ b/indra/newview/lltoolbar.h @@ -56,7 +56,7 @@ public: EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, - LLString& tooltip_msg); + std::string& tooltip_msg); /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); diff --git a/indra/newview/lltoolbrush.cpp b/indra/newview/lltoolbrush.cpp index 32b27fb876..1b006822c1 100644 --- a/indra/newview/lltoolbrush.cpp +++ b/indra/newview/lltoolbrush.cpp @@ -89,7 +89,7 @@ const LLColor4 OVERLAY_COLOR(1.0f, 1.0f, 1.0f, 1.0f); // constructor LLToolBrushLand::LLToolBrushLand() -: LLTool("Land"), +: LLTool(std::string("Land")), mStartingZ( 0.0f ), mMouseX( 0 ), mMouseY(0), @@ -589,7 +589,7 @@ void LLToolBrushLand::alertNoTerraform(LLViewerRegion* regionp) { if (!regionp) return; - LLStringBase<char>::format_map_t args; + LLStringUtil::format_map_t args; args["[REGION]"] = regionp->getName(); gViewerWindow->alertXml("RegionNoTerraforming", args); diff --git a/indra/newview/lltoolcomp.cpp b/indra/newview/lltoolcomp.cpp index 8d1faa850f..4efc6f74d4 100644 --- a/indra/newview/lltoolcomp.cpp +++ b/indra/newview/lltoolcomp.cpp @@ -84,7 +84,7 @@ void LLToolComposite::setCurrentTool( LLTool* new_tool ) } } -LLToolComposite::LLToolComposite(const LLString& name) +LLToolComposite::LLToolComposite(const std::string& name) : LLTool(name), mCur(NULL), mDefault(NULL), mSelected(FALSE), mMouseDown(FALSE), mManip(NULL), mSelectRect(NULL) @@ -129,7 +129,7 @@ void LLToolComposite::handleSelect() //---------------------------------------------------------------------------- LLToolCompInspect::LLToolCompInspect() -: LLToolComposite("Inspect") +: LLToolComposite(std::string("Inspect")) { mSelectRect = new LLToolSelectRect(this); mDefault = mSelectRect; @@ -187,7 +187,7 @@ BOOL LLToolCompInspect::handleDoubleClick(S32 x, S32 y, MASK mask) //---------------------------------------------------------------------------- LLToolCompTranslate::LLToolCompTranslate() - : LLToolComposite("Move") + : LLToolComposite(std::string("Move")) { mManip = new LLManipTranslate(this); mSelectRect = new LLToolSelectRect(this); @@ -314,7 +314,7 @@ void LLToolCompTranslate::render() // LLToolCompScale LLToolCompScale::LLToolCompScale() - : LLToolComposite("Stretch") + : LLToolComposite(std::string("Stretch")) { mManip = new LLManipScale(this); mSelectRect = new LLToolSelectRect(this); @@ -434,7 +434,7 @@ void LLToolCompScale::render() // LLToolCompCreate LLToolCompCreate::LLToolCompCreate() - : LLToolComposite("Create") + : LLToolComposite(std::string("Create")) { mPlacer = new LLToolPlacer(); mSelectRect = new LLToolSelectRect(this); @@ -514,7 +514,7 @@ BOOL LLToolCompCreate::handleMouseUp(S32 x, S32 y, MASK mask) // LLToolCompRotate LLToolCompRotate::LLToolCompRotate() - : LLToolComposite("Rotate") + : LLToolComposite(std::string("Rotate")) { mManip = new LLManipRotate(this); mSelectRect = new LLToolSelectRect(this); @@ -633,11 +633,11 @@ void LLToolCompRotate::render() // LLToolCompGun LLToolCompGun::LLToolCompGun() - : LLToolComposite("Mouselook") + : LLToolComposite(std::string("Mouselook")) { mGun = new LLToolGun(this); mGrab = new LLToolGrab(this); - mNull = new LLTool("null", this); + mNull = new LLTool(std::string("null"), this); setCurrentTool(mGun); mDefault = mGun; diff --git a/indra/newview/lltoolcomp.h b/indra/newview/lltoolcomp.h index d6ec6032cd..8926cd34d2 100644 --- a/indra/newview/lltoolcomp.h +++ b/indra/newview/lltoolcomp.h @@ -47,7 +47,7 @@ class LLTextBox; class LLToolComposite : public LLTool { public: - LLToolComposite(const LLString& name); + LLToolComposite(const std::string& name); virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask) = 0; // Sets the current tool virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); // Returns to the default tool @@ -97,7 +97,7 @@ protected: LLToolSelectRect* mSelectRect; public: - static const LLString sNameComp; + static const std::string sNameComp; }; diff --git a/indra/newview/lltooldraganddrop.cpp b/indra/newview/lltooldraganddrop.cpp index 47ed30a34b..940f5ba62d 100644 --- a/indra/newview/lltooldraganddrop.cpp +++ b/indra/newview/lltooldraganddrop.cpp @@ -569,8 +569,7 @@ LLToolDragAndDrop::dragOrDrop3dImpl LLToolDragAndDrop::sDragAndDrop3d[DAD_COUNT] }; LLToolDragAndDrop::LLToolDragAndDrop() - : - LLTool("draganddrop", NULL), +: LLTool(std::string("draganddrop"), NULL), mDragStartX(0), mDragStartY(0), mSource(SOURCE_AGENT), @@ -822,7 +821,7 @@ BOOL LLToolDragAndDrop::handleKey(KEY key, MASK mask) return FALSE; } -BOOL LLToolDragAndDrop::handleToolTip(S32 x, S32 y, LLString& msg, LLRect *sticky_rect_screen) +BOOL LLToolDragAndDrop::handleToolTip(S32 x, S32 y, std::string& msg, LLRect *sticky_rect_screen) { if (!mToolTipMsg.empty()) { @@ -1169,7 +1168,7 @@ BOOL LLToolDragAndDrop::handleDropTextureProtections(LLViewerObject* hit_obj, if (hit_obj->isInventoryDirty()) { hit_obj->fetchInventoryFromServer(); - LLString::format_map_t args; + LLStringUtil::format_map_t args; args["[ERROR_MESSAGE]"] = "Unable to add texture.\nPlease wait a few seconds and try again."; gViewerWindow->alertXml("ErrorMessage", args); return FALSE; @@ -1674,8 +1673,8 @@ void LLToolDragAndDrop::commitGiveInventoryItem(const LLUUID& to_agent, FALSE, gAgent.getSessionID(), to_agent, - name.c_str(), - item->getName().c_str(), + name, + item->getName(), IM_ONLINE, IM_INVENTORY_OFFERED, transaction_id, @@ -1756,7 +1755,7 @@ void LLToolDragAndDrop::giveInventoryCategory(const LLUUID& to_agent, { LLGiveInventoryInfo* info = NULL; info = new LLGiveInventoryInfo(to_agent, cat->getUUID()); - LLStringBase<char>::format_map_t args; + LLStringUtil::format_map_t args; args["[COUNT]"] = llformat("%d",giveable.countNoCopy()); gViewerWindow->alertXml("CannotCopyCountItems", args, &LLToolDragAndDrop::handleCopyProtectedCategory, @@ -1877,8 +1876,8 @@ void LLToolDragAndDrop::commitGiveInventoryCategory(const LLUUID& to_agent, FALSE, gAgent.getSessionID(), to_agent, - name.c_str(), - cat->getName().c_str(), + name, + cat->getName(), IM_ONLINE, IM_INVENTORY_OFFERED, transaction_id, @@ -2990,11 +2989,11 @@ LLInventoryObject* LLToolDragAndDrop::locateMultipleInventory(LLViewerInventoryC } */ -void LLToolDragAndDrop::createContainer(LLViewerInventoryItem::item_array_t &items, const char* preferred_name ) -{ - llwarns << "LLToolDragAndDrop::createContainer()" << llendl; - return; -} +// void LLToolDragAndDrop::createContainer(LLViewerInventoryItem::item_array_t &items, const char* preferred_name ) +// { +// llwarns << "LLToolDragAndDrop::createContainer()" << llendl; +// return; +// } // utility functions diff --git a/indra/newview/lltooldraganddrop.h b/indra/newview/lltooldraganddrop.h index b5517c29c1..8f6d1713fa 100644 --- a/indra/newview/lltooldraganddrop.h +++ b/indra/newview/lltooldraganddrop.h @@ -55,7 +55,7 @@ public: virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); virtual BOOL handleHover(S32 x, S32 y, MASK mask); virtual BOOL handleKey(KEY key, MASK mask); - virtual BOOL handleToolTip(S32 x, S32 y, LLString& msg, LLRect *sticky_rect_screen); + virtual BOOL handleToolTip(S32 x, S32 y, std::string& msg, LLRect *sticky_rect_screen); virtual void onMouseCaptureLost(); virtual void handleDeselect(); @@ -127,7 +127,7 @@ protected: EAcceptance mLastAccept; BOOL mDrop; S32 mCurItemIndex; - LLString mToolTipMsg; + std::string mToolTipMsg; // array of pointers to functions that implement the logic to // dragging and dropping into the simulator. @@ -187,7 +187,6 @@ protected: // LLViewerInventoryCategory::cat_array_t& cats, // LLViewerInventoryItem::item_array_t& items); - void createContainer(LLViewerInventoryItem::item_array_t &items, const char* preferred_name); void dropObject(LLViewerObject* raycast_target, BOOL bypass_sim_raycast, BOOL from_task_inventory, diff --git a/indra/newview/lltoolface.cpp b/indra/newview/lltoolface.cpp index 0783cd14b7..3248913182 100644 --- a/indra/newview/lltoolface.cpp +++ b/indra/newview/lltoolface.cpp @@ -52,7 +52,7 @@ // LLToolFace::LLToolFace() -: LLTool("Texture") +: LLTool(std::string("Texture")) { } diff --git a/indra/newview/lltoolfocus.cpp b/indra/newview/lltoolfocus.cpp index 7b1394461a..b46d25583a 100644 --- a/indra/newview/lltoolfocus.cpp +++ b/indra/newview/lltoolfocus.cpp @@ -69,7 +69,7 @@ const F32 FOCUS_OFFSET_FACTOR = 1.f; // LLToolCamera::LLToolCamera() -: LLTool("Camera"), +: LLTool(std::string("Camera")), mAccumX(0), mAccumY(0), mMouseDownX(0), diff --git a/indra/newview/lltoolgrab.cpp b/indra/newview/lltoolgrab.cpp index 5073be3173..a41e9381f6 100644 --- a/indra/newview/lltoolgrab.cpp +++ b/indra/newview/lltoolgrab.cpp @@ -75,7 +75,7 @@ extern BOOL gDebugClicks; // Methods // LLToolGrab::LLToolGrab( LLToolComposite* composite ) -: LLTool( "Grab", composite ), +: LLTool( std::string("Grab"), composite ), mMode( GRAB_INACTIVE ), mVerticalDragging( FALSE ), mHitLand(FALSE), diff --git a/indra/newview/lltoolgun.cpp b/indra/newview/lltoolgun.cpp index 134188e2f6..2b6a065a43 100644 --- a/indra/newview/lltoolgun.cpp +++ b/indra/newview/lltoolgun.cpp @@ -48,8 +48,7 @@ #include "lltoolgrab.h" LLToolGun::LLToolGun( LLToolComposite* composite ) - : - LLTool( "gun", composite ) +: LLTool( std::string("gun"), composite ) { } diff --git a/indra/newview/lltoolindividual.cpp b/indra/newview/lltoolindividual.cpp index 0236a5027a..3fa96cd84a 100644 --- a/indra/newview/lltoolindividual.cpp +++ b/indra/newview/lltoolindividual.cpp @@ -61,7 +61,7 @@ // Default constructor LLToolIndividual::LLToolIndividual() - : LLTool("Individual") +: LLTool(std::string("Individual")) { } diff --git a/indra/newview/lltoolmgr.cpp b/indra/newview/lltoolmgr.cpp index a4c7856411..ac2f20895c 100644 --- a/indra/newview/lltoolmgr.cpp +++ b/indra/newview/lltoolmgr.cpp @@ -74,7 +74,7 @@ LLToolMgr::LLToolMgr() mSelectedTool( NULL ), mCurrentToolset( NULL ) { - gToolNull = new LLTool(NULL); // Does nothing + gToolNull = new LLTool(LLStringUtil::null); // Does nothing setCurrentTool(gToolNull); gBasicToolset = new LLToolset(); diff --git a/indra/newview/lltoolobjpicker.cpp b/indra/newview/lltoolobjpicker.cpp index 8354792e31..67e0db962f 100644 --- a/indra/newview/lltoolobjpicker.cpp +++ b/indra/newview/lltoolobjpicker.cpp @@ -50,7 +50,7 @@ LLToolObjPicker::LLToolObjPicker() -: LLTool( "ObjPicker", NULL ), +: LLTool( std::string("ObjPicker"), NULL ), mPicked( FALSE ), mHitObjectID( LLUUID::null ), mExitCallback( NULL ), diff --git a/indra/newview/lltoolpie.cpp b/indra/newview/lltoolpie.cpp index 310b677bff..5954a7f0ff 100644 --- a/indra/newview/lltoolpie.cpp +++ b/indra/newview/lltoolpie.cpp @@ -81,7 +81,7 @@ static ECursorType cursor_from_parcel_media(U8 click_action); LLToolPie::LLToolPie() -: LLTool("Select"), +: LLTool(std::string("Select")), mPieMouseButtonDown( FALSE ), mGrabMouseButtonDown( FALSE ), mHitLand( FALSE ), @@ -327,15 +327,15 @@ BOOL LLToolPie::pickAndShowMenu(S32 x, S32 y, MASK mask, BOOL always_show) // Object is an avatar, so check for mute by id. LLVOAvatar* avatar = (LLVOAvatar*)object; - LLString name = avatar->getFullname(); + std::string name = avatar->getFullname(); if (LLMuteList::getInstance()->isMuted(avatar->getID(), name)) { - gMenuHolder->childSetText("Avatar Mute", LLString("Unmute")); // *TODO:Translate + gMenuHolder->childSetText("Avatar Mute", std::string("Unmute")); // *TODO:Translate //gMutePieMenu->setLabel("Unmute"); } else { - gMenuHolder->childSetText("Avatar Mute", LLString("Mute")); // *TODO:Translate + gMenuHolder->childSetText("Avatar Mute", std::string("Mute")); // *TODO:Translate //gMutePieMenu->setLabel("Mute"); } @@ -348,7 +348,7 @@ BOOL LLToolPie::pickAndShowMenu(S32 x, S32 y, MASK mask, BOOL always_show) else { // BUG: What about chatting child objects? - LLString name; + std::string name; LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode(); if (node) { @@ -356,12 +356,12 @@ BOOL LLToolPie::pickAndShowMenu(S32 x, S32 y, MASK mask, BOOL always_show) } if (LLMuteList::getInstance()->isMuted(object->getID(), name)) { - gMenuHolder->childSetText("Object Mute", LLString("Unmute")); // *TODO:Translate + gMenuHolder->childSetText("Object Mute", std::string("Unmute")); // *TODO:Translate //gMuteObjectPieMenu->setLabel("Unmute"); } else { - gMenuHolder->childSetText("Object Mute", LLString("Mute")); // *TODO:Translate + gMenuHolder->childSetText("Object Mute", std::string("Mute")); // *TODO:Translate //gMuteObjectPieMenu->setLabel("Mute"); } @@ -761,7 +761,7 @@ static void handle_click_action_open_media(LLPointer<LLViewerObject> objectp) std::string media_url = std::string ( parcel->getMediaURL () ); std::string media_type = std::string ( parcel->getMediaType() ); - LLString::trim(media_url); + LLStringUtil::trim(media_url); // Get the scheme, see if that is handled as well. LLURI uri(media_url); @@ -790,7 +790,7 @@ static ECursorType cursor_from_parcel_media(U8 click_action) std::string media_url = std::string ( parcel->getMediaURL () ); std::string media_type = std::string ( parcel->getMediaType() ); - LLString::trim(media_url); + LLStringUtil::trim(media_url); // Get the scheme, see if that is handled as well. LLURI uri(media_url); diff --git a/indra/newview/lltoolpipette.cpp b/indra/newview/lltoolpipette.cpp index aa9500fc0a..a565e4361b 100644 --- a/indra/newview/lltoolpipette.cpp +++ b/indra/newview/lltoolpipette.cpp @@ -51,8 +51,8 @@ // LLToolPipette::LLToolPipette() -: LLTool("Pipette"), -mSuccess(TRUE) +: LLTool(std::string("Pipette")), + mSuccess(TRUE) { mSelectCallback = NULL; mUserData = NULL; @@ -95,7 +95,7 @@ BOOL LLToolPipette::handleHover(S32 x, S32 y, MASK mask) return FALSE; } -BOOL LLToolPipette::handleToolTip(S32 x, S32 y, LLString& msg, LLRect *sticky_rect_screen) +BOOL LLToolPipette::handleToolTip(S32 x, S32 y, std::string& msg, LLRect *sticky_rect_screen) { if (mTooltipMsg.empty()) { @@ -133,7 +133,7 @@ void LLToolPipette::setSelectCallback(select_callback callback, void* user_data) mUserData = user_data; } -void LLToolPipette::setResult(BOOL success, const LLString& msg) +void LLToolPipette::setResult(BOOL success, const std::string& msg) { mTooltipMsg = msg; mSuccess = success; diff --git a/indra/newview/lltoolpipette.h b/indra/newview/lltoolpipette.h index ef4718bd62..b88a6eebc8 100644 --- a/indra/newview/lltoolpipette.h +++ b/indra/newview/lltoolpipette.h @@ -52,11 +52,11 @@ public: virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); virtual BOOL handleHover(S32 x, S32 y, MASK mask); - virtual BOOL handleToolTip(S32 x, S32 y, LLString& msg, LLRect *sticky_rect_screen); + virtual BOOL handleToolTip(S32 x, S32 y, std::string& msg, LLRect *sticky_rect_screen); typedef void (*select_callback)(const LLTextureEntry& te, void *data); void setSelectCallback(select_callback callback, void* user_data); - void setResult(BOOL success, const LLString& msg); + void setResult(BOOL success, const std::string& msg); static void pickCallback(S32 x, S32 y, MASK mask); @@ -64,7 +64,7 @@ protected: LLTextureEntry mTextureEntry; select_callback mSelectCallback; BOOL mSuccess; - LLString mTooltipMsg; + std::string mTooltipMsg; void* mUserData; }; diff --git a/indra/newview/lltoolplacer.cpp b/indra/newview/lltoolplacer.cpp index 062d760322..7d4d0397cc 100644 --- a/indra/newview/lltoolplacer.cpp +++ b/indra/newview/lltoolplacer.cpp @@ -70,7 +70,7 @@ const LLVector3 DEFAULT_OBJECT_SCALE(0.5f, 0.5f, 0.5f); LLPCode LLToolPlacer::sObjectType = LL_PCODE_CUBE; LLToolPlacer::LLToolPlacer() -: LLTool( "Create" ) +: LLTool( std::string("Create") ) { } @@ -570,7 +570,7 @@ LLToolPlacerPanel::LLToolPlacerPanel(const std::string& name, const LLRect& rect */ } -void LLToolPlacerPanel::addButton( const LLString& up_state, const LLString& down_state, LLPCode* pcode ) +void LLToolPlacerPanel::addButton( const std::string& up_state, const std::string& down_state, LLPCode* pcode ) { const S32 TOOL_SIZE = 32; const S32 HORIZ_SPACING = TOOL_SIZE + 5; @@ -593,11 +593,11 @@ void LLToolPlacerPanel::addButton( const LLString& up_state, const LLString& dow TOOL_SIZE ); LLButton* btn = new LLButton( - "ToolPlacerOptBtn", + std::string("ToolPlacerOptBtn"), rect, up_state, down_state, - "", &LLToolPlacerPanel::setObjectType, + LLStringUtil::null, &LLToolPlacerPanel::setObjectType, pcode, LLFontGL::sSansSerif); btn->setFollowsBottom(); diff --git a/indra/newview/lltoolplacer.h b/indra/newview/lltoolplacer.h index b016470129..8c3176e0b5 100644 --- a/indra/newview/lltoolplacer.h +++ b/indra/newview/lltoolplacer.h @@ -98,7 +98,7 @@ public: static LLPCode sGrass; private: - void addButton( const LLString& up_state, const LLString& down_state, LLPCode* pcode ); + void addButton( const std::string& up_state, const std::string& down_state, LLPCode* pcode ); private: static S32 sButtonsAdded; diff --git a/indra/newview/lltoolselect.cpp b/indra/newview/lltoolselect.cpp index 1c19de5571..8f84013a26 100644 --- a/indra/newview/lltoolselect.cpp +++ b/indra/newview/lltoolselect.cpp @@ -56,7 +56,7 @@ extern BOOL gAllowSelectAvatar; const F32 SELECTION_ROTATION_TRESHOLD = 0.1f; LLToolSelect::LLToolSelect( LLToolComposite* composite ) -: LLTool( "Select", composite ), +: LLTool( std::string("Select"), composite ), mIgnoreGroup( FALSE ) { } diff --git a/indra/newview/lltoolselectland.cpp b/indra/newview/lltoolselectland.cpp index 38e9811b73..8ea8ebfc59 100644 --- a/indra/newview/lltoolselectland.cpp +++ b/indra/newview/lltoolselectland.cpp @@ -51,7 +51,7 @@ // LLToolSelectLand::LLToolSelectLand( ) -: LLTool( "Parcel" ), +: LLTool( std::string("Parcel") ), mDragStartGlobal(), mDragEndGlobal(), mDragEndValid(FALSE), diff --git a/indra/newview/lltoolview.cpp b/indra/newview/lltoolview.cpp index 23012993a3..142cdd65bf 100644 --- a/indra/newview/lltoolview.cpp +++ b/indra/newview/lltoolview.cpp @@ -77,50 +77,50 @@ LLToolView::~LLToolView() } //*TODO:translate? -void LLToolView::addTool(const LLString& icon_off, const LLString& icon_on, LLPanel* panel, LLTool* tool, LLView* hoverView, const char* label) -{ - llassert(tool); - - LLToolContainer* contain = new LLToolContainer(this); - - LLRect btn_rect = getButtonRect(mButtonCount); - - contain->mButton = new LLButton("ToolBtn", - btn_rect, - icon_off, - icon_on, - "", - &LLToolView::onClickToolButton, - contain, - LLFontGL::sSansSerif); - - contain->mPanel = panel; - contain->mTool = tool; - - addChild(contain->mButton); - mButtonCount++; - - const S32 LABEL_TOP_SPACING = 0; - const LLFontGL* font = LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF_SMALL ); - S32 label_width = font->getWidth( label ); - LLRect label_rect; - label_rect.setLeftTopAndSize( - btn_rect.mLeft + btn_rect.getWidth() / 2 - label_width / 2, - btn_rect.mBottom - LABEL_TOP_SPACING, - label_width, - llfloor(font->getLineHeight())); - addChild( new LLTextBox( "tool label", label_rect, label, font ) ); - - // Can optionally ignore panel - if (contain->mPanel) - { - contain->mPanel->setBackgroundVisible( FALSE ); - contain->mPanel->setBorderVisible( FALSE ); - addChild(contain->mPanel); - } - - mContainList.push_back(contain); -} +// void LLToolView::addTool(const std::string& icon_off, const std::string& icon_on, LLPanel* panel, LLTool* tool, LLView* hoverView, const char* label) +// { +// llassert(tool); + +// LLToolContainer* contain = new LLToolContainer(this); + +// LLRect btn_rect = getButtonRect(mButtonCount); + +// contain->mButton = new LLButton("ToolBtn", +// btn_rect, +// icon_off, +// icon_on, +// "", +// &LLToolView::onClickToolButton, +// contain, +// LLFontGL::sSansSerif); + +// contain->mPanel = panel; +// contain->mTool = tool; + +// addChild(contain->mButton); +// mButtonCount++; + +// const S32 LABEL_TOP_SPACING = 0; +// const LLFontGL* font = LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF_SMALL ); +// S32 label_width = font->getWidth( label ); +// LLRect label_rect; +// label_rect.setLeftTopAndSize( +// btn_rect.mLeft + btn_rect.getWidth() / 2 - label_width / 2, +// btn_rect.mBottom - LABEL_TOP_SPACING, +// label_width, +// llfloor(font->getLineHeight())); +// addChild( new LLTextBox( "tool label", label_rect, label, font ) ); + +// // Can optionally ignore panel +// if (contain->mPanel) +// { +// contain->mPanel->setBackgroundVisible( FALSE ); +// contain->mPanel->setBorderVisible( FALSE ); +// addChild(contain->mPanel); +// } + +// mContainList.push_back(contain); +// } LLRect LLToolView::getButtonRect(S32 button_index) diff --git a/indra/newview/lltoolview.h b/indra/newview/lltoolview.h index 23f4263602..7faa931532 100644 --- a/indra/newview/lltoolview.h +++ b/indra/newview/lltoolview.h @@ -73,8 +73,6 @@ public: static void onClickToolButton(void* container); - void addTool(const LLString& icon_off, const LLString& icon_on, LLPanel* panel, LLTool* tool, LLView* hoverView, const char* label); - LLView* getCurrentHoverView(); private: diff --git a/indra/newview/lltracker.cpp b/indra/newview/lltracker.cpp index d1b87281f0..85d9504740 100644 --- a/indra/newview/lltracker.cpp +++ b/indra/newview/lltracker.cpp @@ -285,7 +285,7 @@ void LLTracker::render3D() // static -void LLTracker::trackAvatar( const LLUUID& avatar_id, const LLString& name ) +void LLTracker::trackAvatar( const LLUUID& avatar_id, const std::string& name ) { instance()->stopTrackingLandmark(); instance()->stopTrackingLocation(); @@ -297,7 +297,7 @@ void LLTracker::trackAvatar( const LLUUID& avatar_id, const LLString& name ) // static -void LLTracker::trackLandmark( const LLUUID& asset_id, const LLUUID& item_id, const LLString& name) +void LLTracker::trackLandmark( const LLUUID& asset_id, const LLUUID& item_id, const std::string& name) { instance()->stopTrackingAvatar(); instance()->stopTrackingLocation(); @@ -312,7 +312,7 @@ void LLTracker::trackLandmark( const LLUUID& asset_id, const LLUUID& item_id, co // static -void LLTracker::trackLocation(const LLVector3d& pos_global, const LLString& full_name, const LLString& tooltip, ETrackingLocationType location_type) +void LLTracker::trackLocation(const LLVector3d& pos_global, const std::string& full_name, const std::string& tooltip, ETrackingLocationType location_type) { instance()->stopTrackingAvatar(); instance()->stopTrackingLandmark(); @@ -398,7 +398,7 @@ BOOL LLTracker::hasLandmarkPosition() // static -const LLString& LLTracker::getTrackedLocationName() +const std::string& LLTracker::getTrackedLocationName() { return instance()->mTrackedLocationName; } @@ -557,8 +557,8 @@ void LLTracker::renderBeacon(LLVector3d pos_global, //gCylinder.render(1000); glPopMatrix(); - char text[1024]; /* Flawfinder: ignore */ - snprintf(text, sizeof(text), "%.0f m", to_vec.magVec()); /* Flawfinder: ignore */ + std::string text; + text = llformat( "%.0f m", to_vec.magVec()); LLWString wstr; wstr += utf8str_to_wstring(label); diff --git a/indra/newview/lltracker.h b/indra/newview/lltracker.h index 5f7ad98fe5..23d774d9db 100644 --- a/indra/newview/lltracker.h +++ b/indra/newview/lltracker.h @@ -87,15 +87,15 @@ public: static const LLUUID& getTrackedLandmarkAssetID() { return instance()->mTrackedLandmarkAssetID; } static const LLUUID& getTrackedLandmarkItemID() { return instance()->mTrackedLandmarkItemID; } - static void trackAvatar( const LLUUID& avatar_id, const LLString& name ); - static void trackLandmark( const LLUUID& landmark_asset_id, const LLUUID& landmark_item_id , const LLString& name); - static void trackLocation(const LLVector3d& pos, const LLString& full_name, const LLString& tooltip, ETrackingLocationType location_type = LOCATION_NOTHING); + static void trackAvatar( const LLUUID& avatar_id, const std::string& name ); + static void trackLandmark( const LLUUID& landmark_asset_id, const LLUUID& landmark_item_id , const std::string& name); + static void trackLocation(const LLVector3d& pos, const std::string& full_name, const std::string& tooltip, ETrackingLocationType location_type = LOCATION_NOTHING); // returns global pos of tracked thing static LLVector3d getTrackedPositionGlobal(); static BOOL hasLandmarkPosition(); - static const LLString& getTrackedLocationName(); + static const std::string& getTrackedLocationName(); static void drawHUDArrow(); @@ -107,8 +107,8 @@ public: static LLTracker* sTrackerp; static BOOL sCheesyBeacon; - static const LLString& getLabel() { return instance()->mLabel; } - static const LLString& getToolTip() { return instance()->mToolTip; } + static const std::string& getLabel() { return instance()->mLabel; } + static const std::string& getToolTip() { return instance()->mToolTip; } protected: LLTracker(); ~LLTracker(); @@ -137,10 +137,10 @@ protected: LLVector3d mTrackedPositionGlobal; - LLString mLabel; - LLString mToolTip; + std::string mLabel; + std::string mToolTip; - LLString mTrackedLandmarkName; + std::string mTrackedLandmarkName; LLUUID mTrackedLandmarkAssetID; LLUUID mTrackedLandmarkItemID; LLDynamicArray<LLUUID> mLandmarkAssetIDList; @@ -149,7 +149,7 @@ protected: BOOL mHasLandmarkPosition; BOOL mLandmarkHasBeenVisited; - LLString mTrackedLocationName; + std::string mTrackedLocationName; BOOL mIsTrackingLocation; BOOL mHasReachedLocation; }; diff --git a/indra/newview/lluploaddialog.cpp b/indra/newview/lluploaddialog.cpp index 686e386578..e347affa52 100644 --- a/indra/newview/lluploaddialog.cpp +++ b/indra/newview/lluploaddialog.cpp @@ -64,7 +64,7 @@ void LLUploadDialog::modalUploadFinished() LLUploadDialog::LLUploadDialog( const std::string& msg) : - LLPanel( "Uploading...", LLRect(0,100,100,0) ) // dummy rect. Will reshape below. + LLPanel( std::string("Uploading..."), LLRect(0,100,100,0) ) // dummy rect. Will reshape below. { setBackgroundVisible( TRUE ); @@ -78,7 +78,7 @@ LLUploadDialog::LLUploadDialog( const std::string& msg) LLRect msg_rect; for (int line_num=0; line_num<16; ++line_num) { - mLabelBox[line_num] = new LLTextBox( "Filename", msg_rect, "Filename", font ); + mLabelBox[line_num] = new LLTextBox( std::string("Filename"), msg_rect, std::string("Filename"), font ); addChild(mLabelBox[line_num]); } @@ -116,9 +116,10 @@ void LLUploadDialog::setMessage( const std::string& msg) char* token = strtok( temp_msg, "\n" ); while( token ) { - S32 cur_width = S32(font->getWidth(token) + 0.99f) + TEXT_PAD; + std::string tokstr(token); + S32 cur_width = S32(font->getWidth(tokstr) + 0.99f) + TEXT_PAD; max_msg_width = llmax( max_msg_width, cur_width ); - msg_lines.push_back( std::string( token ) ); + msg_lines.push_back( tokstr ); token = strtok( NULL, "\n" ); } delete[] temp_msg; diff --git a/indra/newview/llurldispatcher.cpp b/indra/newview/llurldispatcher.cpp index f103b9b0bf..5f26155bc0 100644 --- a/indra/newview/llurldispatcher.cpp +++ b/indra/newview/llurldispatcher.cpp @@ -326,7 +326,7 @@ void LLURLDispatcherImpl::regionHandleCallback(U64 region_handle, const std::str bool LLURLDispatcherImpl::matchPrefix(const std::string& url, const std::string& prefix) { std::string test_prefix = url.substr(0, prefix.length()); - LLString::toLower(test_prefix); + LLStringUtil::toLower(test_prefix); return test_prefix == prefix; } diff --git a/indra/newview/llurlhistory.cpp b/indra/newview/llurlhistory.cpp index d5241a4e98..902ab88688 100644 --- a/indra/newview/llurlhistory.cpp +++ b/indra/newview/llurlhistory.cpp @@ -43,13 +43,13 @@ const int MAX_URL_COUNT = 10; ///////////////////////////////////////////////////////////////////////////// // static -bool LLURLHistory::loadFile(const LLString& filename) +bool LLURLHistory::loadFile(const std::string& filename) { LLSD data; { - LLString temp_str = gDirUtilp->getLindenUserDir() + gDirUtilp->getDirDelimiter(); + std::string temp_str = gDirUtilp->getLindenUserDir() + gDirUtilp->getDirDelimiter(); - llifstream file((temp_str + filename).c_str()); + llifstream file((temp_str + filename)); if (file.is_open()) { @@ -71,10 +71,10 @@ bool LLURLHistory::loadFile(const LLString& filename) } // static -bool LLURLHistory::saveFile(const LLString& filename) +bool LLURLHistory::saveFile(const std::string& filename) { - LLString temp_str = gDirUtilp->getLindenUserDir() + gDirUtilp->getDirDelimiter(); - llofstream out((temp_str + filename).c_str()); + std::string temp_str = gDirUtilp->getLindenUserDir() + gDirUtilp->getDirDelimiter(); + llofstream out((temp_str + filename)); if (!out.good()) { llwarns << "Unable to open " << filename << " for output." << llendl; diff --git a/indra/newview/llurlhistory.h b/indra/newview/llurlhistory.h index 317440f032..7d4dbab382 100644 --- a/indra/newview/llurlhistory.h +++ b/indra/newview/llurlhistory.h @@ -40,10 +40,10 @@ class LLURLHistory { public: // Loads an xml file of URLs. Currently only supports Parcel URL history - static bool loadFile(const LLString& filename); + static bool loadFile(const std::string& filename); // Saves the current history to XML - static bool saveFile(const LLString& filename); + static bool saveFile(const std::string& filename); static LLSD getURLHistory(const std::string& collection); diff --git a/indra/newview/llurlwhitelist.cpp b/indra/newview/llurlwhitelist.cpp index 6acd3c1a45..add997ac34 100644 --- a/indra/newview/llurlwhitelist.cpp +++ b/indra/newview/llurlwhitelist.cpp @@ -89,10 +89,10 @@ bool LLUrlWhiteList::load () clear (); // build filename for each user - LLString resolvedFilename = gDirUtilp->getExpandedFilename ( LL_PATH_PER_SL_ACCOUNT, mFilename.c_str () ); + std::string resolvedFilename = gDirUtilp->getExpandedFilename ( LL_PATH_PER_SL_ACCOUNT, mFilename ); // open a file for reading - llifstream file ( resolvedFilename.c_str () ); + llifstream file ( resolvedFilename ); if ( file.is_open () ) { // add each line in the file to the list @@ -118,10 +118,10 @@ bool LLUrlWhiteList::load () bool LLUrlWhiteList::save () { // build filename for each user - LLString resolvedFilename = gDirUtilp->getExpandedFilename ( LL_PATH_PER_SL_ACCOUNT, mFilename.c_str () ); + std::string resolvedFilename = gDirUtilp->getExpandedFilename ( LL_PATH_PER_SL_ACCOUNT, mFilename ); // open a file for writing - llofstream file ( resolvedFilename.c_str () ); + llofstream file ( resolvedFilename ); if ( file.is_open () ) { // for each entry we have @@ -149,9 +149,9 @@ bool LLUrlWhiteList::clear () return true; } -LLString url_cleanup(LLString pattern) +std::string url_cleanup(std::string pattern) { - LLString::trim(pattern); + LLStringUtil::trim(pattern); S32 length = pattern.length(); S32 position = 0; std::string::reverse_iterator it = pattern.rbegin(); @@ -164,7 +164,7 @@ LLString url_cleanup(LLString pattern) { // found second to last '/' S32 desired_length = length - position; - LLString::truncate(pattern, desired_length); + LLStringUtil::truncate(pattern, desired_length); break; } ++position; @@ -174,9 +174,9 @@ LLString url_cleanup(LLString pattern) /////////////////////////////////////////////////////////////////////////////// // -bool LLUrlWhiteList::addItem ( const LLString& itemIn, bool saveAfterAdd ) +bool LLUrlWhiteList::addItem ( const std::string& itemIn, bool saveAfterAdd ) { - LLString item = url_cleanup(itemIn); + std::string item = url_cleanup(itemIn); mUrlList.push_back ( item ); @@ -189,7 +189,7 @@ bool LLUrlWhiteList::addItem ( const LLString& itemIn, bool saveAfterAdd ) /////////////////////////////////////////////////////////////////////////////// // -bool LLUrlWhiteList::getFirst ( LLString& valueOut ) +bool LLUrlWhiteList::getFirst ( std::string& valueOut ) { if ( mUrlList.size () == 0 ) return false; @@ -202,7 +202,7 @@ bool LLUrlWhiteList::getFirst ( LLString& valueOut ) /////////////////////////////////////////////////////////////////////////////// // -bool LLUrlWhiteList::getNext ( LLString& valueOut ) +bool LLUrlWhiteList::getNext ( std::string& valueOut ) { if ( mCurIndex >= mUrlList.size () ) return false; @@ -214,7 +214,7 @@ bool LLUrlWhiteList::getNext ( LLString& valueOut ) /////////////////////////////////////////////////////////////////////////////// // -bool LLUrlWhiteList::containsMatch ( const LLString& patternIn ) +bool LLUrlWhiteList::containsMatch ( const std::string& patternIn ) { return false; } diff --git a/indra/newview/llurlwhitelist.h b/indra/newview/llurlwhitelist.h index b9901b68c2..eab63cb542 100644 --- a/indra/newview/llurlwhitelist.h +++ b/indra/newview/llurlwhitelist.h @@ -48,21 +48,21 @@ class LLUrlWhiteList bool save (); bool clear (); - bool addItem ( const LLString& itemIn, bool saveAfterAdd ); + bool addItem ( const std::string& itemIn, bool saveAfterAdd ); - bool containsMatch ( const LLString& patternIn ); + bool containsMatch ( const std::string& patternIn ); - bool getFirst ( LLString& valueOut ); - bool getNext ( LLString& valueOut ); + bool getFirst ( std::string& valueOut ); + bool getNext ( std::string& valueOut ); private: LLUrlWhiteList (); static LLUrlWhiteList* sInstance; - typedef std::vector < LLString > string_list_t ; + typedef std::vector < std::string > string_list_t ; bool mLoaded; - const LLString mFilename; + const std::string mFilename; string_list_t mUrlList; U32 mCurIndex; }; diff --git a/indra/newview/llviewchildren.cpp b/indra/newview/llviewchildren.cpp index 11a5384f85..a88e3f67d4 100644 --- a/indra/newview/llviewchildren.cpp +++ b/indra/newview/llviewchildren.cpp @@ -52,18 +52,18 @@ LLViewChildren::LLViewChildren(LLPanel& parent) } -void LLViewChildren::show(const char* id, bool visible) +void LLViewChildren::show(const std::string& id, bool visible) { mParent.childSetVisible(id, visible); } -void LLViewChildren::enable(const char* id, bool enabled) +void LLViewChildren::enable(const std::string& id, bool enabled) { mParent.childSetEnabled(id, enabled); } void LLViewChildren::setText( - const char* id, const std::string& text, bool visible) + const std::string& id, const std::string& text, bool visible) { LLTextBox* child = mParent.getChild<LLTextBox>(id); if (child) @@ -74,7 +74,7 @@ void LLViewChildren::setText( } void LLViewChildren::setWrappedText( - const char* id, const std::string& text, bool visible) + const std::string& id, const std::string& text, bool visible) { LLTextBox* child = mParent.getChild<LLTextBox>(id); if (child) @@ -84,7 +84,7 @@ void LLViewChildren::setWrappedText( } } -void LLViewChildren::setBadge(const char* id, Badge badge, bool visible) +void LLViewChildren::setBadge(const std::string& id, Badge badge, bool visible) { LLIconCtrl* child = mParent.getChild<LLIconCtrl>(id); if (child) @@ -93,15 +93,15 @@ void LLViewChildren::setBadge(const char* id, Badge badge, bool visible) switch (badge) { default: - case BADGE_OK: child->setImage("badge_ok.j2c"); break; - case BADGE_NOTE: child->setImage("badge_note.j2c"); break; - case BADGE_WARN: child->setImage("badge_warn.j2c"); break; - case BADGE_ERROR: child->setImage("badge_error.j2c"); break; + case BADGE_OK: child->setImage(std::string("badge_ok.j2c")); break; + case BADGE_NOTE: child->setImage(std::string("badge_note.j2c")); break; + case BADGE_WARN: child->setImage(std::string("badge_warn.j2c")); break; + case BADGE_ERROR: child->setImage(std::string("badge_error.j2c")); break; } } } -void LLViewChildren::setAction(const char* id, +void LLViewChildren::setAction(const std::string& id, void(*function)(void*), void* value) { LLButton* button = mParent.getChild<LLButton>(id); diff --git a/indra/newview/llviewchildren.h b/indra/newview/llviewchildren.h index d3a09e9b93..633d6f6126 100644 --- a/indra/newview/llviewchildren.h +++ b/indra/newview/llviewchildren.h @@ -42,27 +42,27 @@ public: LLViewChildren(LLPanel& parent); // all views - void show(const char* id, bool visible = true); - void hide(const char* id) { show(id, false); } + void show(const std::string& id, bool visible = true); + void hide(const std::string& id) { show(id, false); } - void enable(const char* id, bool enabled = true); - void disable(const char* id) { enable(id, false); }; + void enable(const std::string& id, bool enabled = true); + void disable(const std::string& id) { enable(id, false); }; // // LLTextBox - void setText(const char* id, + void setText(const std::string& id, const std::string& text, bool visible = true); - void setWrappedText(const char* id, + void setWrappedText(const std::string& id, const std::string& text, bool visible = true); // LLIconCtrl enum Badge { BADGE_OK, BADGE_NOTE, BADGE_WARN, BADGE_ERROR }; - void setBadge(const char* id, Badge b, bool visible = true); + void setBadge(const std::string& id, Badge b, bool visible = true); // LLButton - void setAction(const char* id, void(*function)(void*), void* value); + void setAction(const std::string& id, void(*function)(void*), void* value); private: diff --git a/indra/newview/llviewerassetstorage.cpp b/indra/newview/llviewerassetstorage.cpp index 39e0bd8555..0363dba631 100644 --- a/indra/newview/llviewerassetstorage.cpp +++ b/indra/newview/llviewerassetstorage.cpp @@ -88,7 +88,7 @@ void LLViewerAssetStorage::storeAssetData( // This can happen if there's a bug in our code or if the VFS has been corrupted. llwarns << "LLViewerAssetStorage::storeAssetData() Data _should_ already be in the VFS, but it's not! " << asset_id << llendl; // LLAssetStorage metric: Zero size VFS - reportMetric( asset_id, asset_type, NULL, LLUUID::null, 0, MR_ZERO_SIZE, __FILE__, __LINE__, "The file didn't exist or was zero length (VFS - can't tell which)" ); + reportMetric( asset_id, asset_type, LLStringUtil::null, LLUUID::null, 0, MR_ZERO_SIZE, __FILE__, __LINE__, "The file didn't exist or was zero length (VFS - can't tell which)" ); delete req; if (callback) @@ -102,7 +102,7 @@ void LLViewerAssetStorage::storeAssetData( // LLAssetStorage metric: Successful Request S32 size = mVFS->getSize(asset_id, asset_type); const char *message = "Added to upload queue"; - reportMetric( asset_id, asset_type, NULL, LLUUID::null, size, MR_OKAY, __FILE__, __LINE__, message ); + reportMetric( asset_id, asset_type, LLStringUtil::null, LLUUID::null, size, MR_OKAY, __FILE__, __LINE__, message ); if(is_priority) { @@ -130,7 +130,7 @@ void LLViewerAssetStorage::storeAssetData( llwarns << "Probable corruption in VFS file, aborting store asset data" << llendl; // LLAssetStorage metric: VFS corrupt - bogus size - reportMetric( asset_id, asset_type, NULL, LLUUID::null, asset_size, MR_VFS_CORRUPTION, __FILE__, __LINE__, "VFS corruption" ); + reportMetric( asset_id, asset_type, LLStringUtil::null, LLUUID::null, asset_size, MR_VFS_CORRUPTION, __FILE__, __LINE__, "VFS corruption" ); if (callback) { @@ -158,7 +158,7 @@ void LLViewerAssetStorage::storeAssetData( { llwarns << "AssetStorage: attempt to upload non-existent vfile " << asset_id << ":" << LLAssetType::lookup(asset_type) << llendl; // LLAssetStorage metric: Zero size VFS - reportMetric( asset_id, asset_type, NULL, LLUUID::null, 0, MR_ZERO_SIZE, __FILE__, __LINE__, "The file didn't exist or was zero length (VFS - can't tell which)" ); + reportMetric( asset_id, asset_type, LLStringUtil::null, LLUUID::null, 0, MR_ZERO_SIZE, __FILE__, __LINE__, "The file didn't exist or was zero length (VFS - can't tell which)" ); if (callback) { callback(asset_id, user_data, LL_ERR_ASSET_REQUEST_NONEXISTENT_FILE, LL_EXSTAT_NONEXISTENT_FILE); @@ -169,7 +169,7 @@ void LLViewerAssetStorage::storeAssetData( { llwarns << "Attempt to move asset store request upstream w/o valid upstream provider" << llendl; // LLAssetStorage metric: Upstream provider dead - reportMetric( asset_id, asset_type, NULL, LLUUID::null, 0, MR_NO_UPSTREAM, __FILE__, __LINE__, "No upstream provider" ); + reportMetric( asset_id, asset_type, LLStringUtil::null, LLUUID::null, 0, MR_NO_UPSTREAM, __FILE__, __LINE__, "No upstream provider" ); if (callback) { callback(asset_id, user_data, LL_ERR_CIRCUIT_GONE, LL_EXSTAT_NO_UPSTREAM); @@ -178,7 +178,7 @@ void LLViewerAssetStorage::storeAssetData( } void LLViewerAssetStorage::storeAssetData( - const char* filename, + const std::string& filename, const LLTransactionID& tid, LLAssetType::EType asset_type, LLStoreAssetCallback callback, @@ -188,10 +188,10 @@ void LLViewerAssetStorage::storeAssetData( bool user_waiting, F64 timeout) { -if(!filename) + if(filename.empty()) { // LLAssetStorage metric: no filename - reportMetric( LLUUID::null, asset_type, "", LLUUID::null, 0, MR_VFS_CORRUPTION, __FILE__, __LINE__, "Filename missing" ); + reportMetric( LLUUID::null, asset_type, LLStringUtil::null, LLUUID::null, 0, MR_VFS_CORRUPTION, __FILE__, __LINE__, "Filename missing" ); llerrs << "No filename specified" << llendl; return; } diff --git a/indra/newview/llviewerassetstorage.h b/indra/newview/llviewerassetstorage.h index 39bab687b0..084b273a8f 100644 --- a/indra/newview/llviewerassetstorage.h +++ b/indra/newview/llviewerassetstorage.h @@ -58,7 +58,7 @@ public: F64 timeout=LL_ASSET_STORAGE_TIMEOUT); virtual void storeAssetData( - const char* filename, + const std::string& filename, const LLTransactionID& tid, LLAssetType::EType type, LLStoreAssetCallback callback, diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp index cbba73b692..eec1fff942 100644 --- a/indra/newview/llviewercontrol.cpp +++ b/indra/newview/llviewercontrol.cpp @@ -76,14 +76,14 @@ BOOL gHackGodmode = FALSE; #endif -std::map<LLString, LLControlGroup*> gSettings; +std::map<std::string, LLControlGroup*> gSettings; LLControlGroup gSavedSettings; // saved at end of session LLControlGroup gSavedPerAccountSettings; // saved at end of session LLControlGroup gColors; // read-only LLControlGroup gCrashSettings; // saved at end of session -LLString gLastRunVersion; -LLString gCurrentVersion; +std::string gLastRunVersion; +std::string gCurrentVersion; extern BOOL gResizeScreenTexture; extern BOOL gDebugGL; @@ -271,7 +271,7 @@ static bool handleAudioStreamMusicChanged(const LLSD& newvalue) // otherwise music will briefly stop if ( !gAudiop->isInternetStreamPlaying() ) { - gAudiop->startInternetStream(LLViewerParcelMgr::getInstance()->getAgentParcel()->getMusicURL().c_str()); + gAudiop->startInternetStream(LLViewerParcelMgr::getInstance()->getAgentParcel()->getMusicURL()); } } } @@ -385,7 +385,7 @@ static bool handleDebugViewsChanged(const LLSD& newvalue) static bool handleLogFileChanged(const LLSD& newvalue) { std::string log_filename = newvalue.asString(); - LLFile::remove(log_filename.c_str()); + LLFile::remove(log_filename); LLError::logToFile(log_filename); return true; } diff --git a/indra/newview/llviewercontrol.h b/indra/newview/llviewercontrol.h index 4ac544b780..954454fbd1 100644 --- a/indra/newview/llviewercontrol.h +++ b/indra/newview/llviewercontrol.h @@ -46,7 +46,7 @@ extern BOOL gHackGodmode; //setting variables are declared in this function void settings_setup_listeners(); -extern std::map<LLString, LLControlGroup*> gSettings; +extern std::map<std::string, LLControlGroup*> gSettings; // for the graphics settings void create_graphics_group(LLControlGroup& group); @@ -62,7 +62,7 @@ extern LLControlGroup gColors; extern LLControlGroup gCrashSettings; // Set after settings loaded -extern LLString gLastRunVersion; -extern LLString gCurrentVersion; +extern std::string gLastRunVersion; +extern std::string gCurrentVersion; #endif // LL_LLVIEWERCONTROL_H diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index c75bcdc9e8..b7b85105cc 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -331,10 +331,10 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) { // Give up. Don't keep the UI locked forever. gAgent.setTeleportState( LLAgent::TELEPORT_NONE ); - gAgent.setTeleportMessage(""); + gAgent.setTeleportMessage(std::string()); } - const LLString& message = gAgent.getTeleportMessage(); + const std::string& message = gAgent.getTeleportMessage(); switch( gAgent.getTeleportState() ) { case LLAgent::TELEPORT_START: @@ -363,7 +363,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) case LLAgent::TELEPORT_START_ARRIVAL: // Transition to ARRIVING. Viewer has received avatar update, etc., from destination simulator gTeleportArrivalTimer.reset(); - gViewerWindow->setProgressCancelButtonVisible(FALSE, "Cancel"); + gViewerWindow->setProgressCancelButtonVisible(FALSE, std::string("Cancel")); //TODO: Translate gViewerWindow->setProgressPercent(75.f); gAgent.setTeleportState( LLAgent::TELEPORT_ARRIVING ); gAgent.setTeleportMessage( @@ -380,7 +380,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) arrival_fraction = 1.f; gAgent.setTeleportState( LLAgent::TELEPORT_NONE ); } - gViewerWindow->setProgressCancelButtonVisible(FALSE, "Cancel"); + gViewerWindow->setProgressCancelButtonVisible(FALSE, std::string("Cancel")); //TODO: Translate gViewerWindow->setProgressPercent( arrival_fraction * 25.f + 75.f); gViewerWindow->setProgressString(message); } @@ -1155,12 +1155,8 @@ void render_disconnected_background() { llinfos << "Loading last bitmap..." << llendl; - char temp_str[MAX_PATH]; /* Flawfinder: ignore */ - strncpy(temp_str, gDirUtilp->getLindenUserDir().c_str(), MAX_PATH -1); /* Flawfinder: ignore */ - temp_str[MAX_PATH -1] = '\0'; - strncat(temp_str, gDirUtilp->getDirDelimiter().c_str(), MAX_PATH - strlen(temp_str) -1); /* Flawfinder: ignore */ - - strcat(temp_str, SCREEN_LAST_FILENAME); /* Flawfinder: ignore */ + std::string temp_str; + temp_str = gDirUtilp->getLindenUserDir() + gDirUtilp->getDirDelimiter() + SCREEN_LAST_FILENAME; LLPointer<LLImageBMP> image_bmp = new LLImageBMP; if( !image_bmp->load(temp_str) ) diff --git a/indra/newview/llviewergenericmessage.cpp b/indra/newview/llviewergenericmessage.cpp index 81b7594ef8..d7dbeb35d6 100644 --- a/indra/newview/llviewergenericmessage.cpp +++ b/indra/newview/llviewergenericmessage.cpp @@ -44,7 +44,7 @@ LLDispatcher gGenericDispatcher; -void send_generic_message(const char* method, +void send_generic_message(const std::string& method, const std::vector<std::string>& strings, const LLUUID& invoice) { @@ -69,7 +69,7 @@ void send_generic_message(const char* method, for(; it != end; ++it) { msg->nextBlock("ParamList"); - msg->addString("Parameter", (*it).c_str()); + msg->addString("Parameter", *it); } } gAgent.sendReliableMessage(); diff --git a/indra/newview/llviewergenericmessage.h b/indra/newview/llviewergenericmessage.h index 2e12f54320..71099d8367 100644 --- a/indra/newview/llviewergenericmessage.h +++ b/indra/newview/llviewergenericmessage.h @@ -37,7 +37,7 @@ class LLUUID; class LLDispatcher; -void send_generic_message(const char* method, +void send_generic_message(const std::string& method, const std::vector<std::string>& strings, const LLUUID& invoice = LLUUID::null); diff --git a/indra/newview/llviewergesture.cpp b/indra/newview/llviewergesture.cpp index 4434098a42..2d2557f46a 100644 --- a/indra/newview/llviewergesture.cpp +++ b/indra/newview/llviewergesture.cpp @@ -126,7 +126,7 @@ void LLViewerGesture::doTrigger( BOOL send_chat ) } else { - LLUUID anim_id = gAnimLibrary.stringToAnimState(mAnimation.c_str()); + LLUUID anim_id = gAnimLibrary.stringToAnimState(mAnimation); gAgent.sendAnimationRequest(anim_id, ANIM_REQUEST_START); } } @@ -161,8 +161,8 @@ BOOL LLViewerGestureList::matchPrefix(const std::string& in_str, std::string* ou { S32 in_len = in_str.length(); - LLString in_str_lc = in_str; - LLString::toLower(in_str_lc); + std::string in_str_lc = in_str; + LLStringUtil::toLower(in_str_lc); for (S32 i = 0; i < count(); i++) { @@ -176,7 +176,7 @@ BOOL LLViewerGestureList::matchPrefix(const std::string& in_str, std::string* ou } std::string trigger_trunc = utf8str_truncate(trigger, in_len); - LLString::toLower(trigger_trunc); + LLStringUtil::toLower(trigger_trunc); if (in_str_lc == trigger_trunc) { *out_str = trigger; diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index a3929de5f3..7fe076553b 100644 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -64,8 +64,8 @@ LLViewerInventoryItem::LLViewerInventoryItem(const LLUUID& uuid, 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, time_t creation_date_utc) : @@ -77,7 +77,7 @@ LLViewerInventoryItem::LLViewerInventoryItem(const LLUUID& uuid, LLViewerInventoryItem::LLViewerInventoryItem(const LLUUID& item_id, const LLUUID& parent_id, - const char* name, + const std::string& name, LLInventoryType::EType inv_type) : LLInventoryItem(), mIsComplete(FALSE) @@ -85,7 +85,7 @@ LLViewerInventoryItem::LLViewerInventoryItem(const LLUUID& item_id, mUUID = item_id; mParentUUID = parent_id; mInventoryType = inv_type; - mName.assign(name); + mName = name; } LLViewerInventoryItem::LLViewerInventoryItem() : @@ -279,12 +279,12 @@ bool LLViewerInventoryItem::importFileLocal(LLFILE* fp) bool LLViewerInventoryItem::exportFileLocal(LLFILE* fp) 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); fprintf(fp, "\t\ttype\t%s\n", LLAssetType::lookup(mType)); const char* inv_type_str = LLInventoryType::lookup(mInventoryType); @@ -327,7 +327,7 @@ void LLViewerInventoryItem::updateParentOnServer(BOOL restamp) const LLViewerInventoryCategory::LLViewerInventoryCategory(const LLUUID& uuid, const LLUUID& parent_uuid, LLAssetType::EType pref, - const LLString& name, + const std::string& name, const LLUUID& owner_id) : LLInventoryCategory(uuid, parent_uuid, pref, name), mOwnerID(owner_id), @@ -518,8 +518,8 @@ bool LLViewerInventoryCategory::importFileLocal(LLFILE* fp) sscanf( /* Flawfinder: ignore */ buffer, " %254s %254[^|]", keyword, valuestr); mName.assign(valuestr); - LLString::replaceNonstandardASCII(mName, ' '); - LLString::replaceChar(mName, '|', ' '); + LLStringUtil::replaceNonstandardASCII(mName, ' '); + LLStringUtil::replaceChar(mName, '|', ' '); } else if(0 == strcmp("owner_id", keyword)) { @@ -540,17 +540,17 @@ bool LLViewerInventoryCategory::importFileLocal(LLFILE* fp) bool LLViewerInventoryCategory::exportFileLocal(LLFILE* fp) 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()); mOwnerID.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()); fprintf(fp, "\t\tversion\t%d\n", mVersion); fprintf(fp,"\t}\n"); return true; @@ -560,17 +560,6 @@ bool LLViewerInventoryCategory::exportFileLocal(LLFILE* fp) const /// Local function definitions ///---------------------------------------------------------------------------- -/* -void inventory_reliable_callback(void**, S32 status) -{ - if(0 != status) - { - char buffer[MAX_STRING]; - sprintf(buffer, "Reliable packet failure: %d", status); - llwarns << buffer << llendl; - } -} -*/ LLInventoryCallbackManager *LLInventoryCallbackManager::sInstance = NULL; LLInventoryCallbackManager::LLInventoryCallbackManager() : @@ -677,7 +666,7 @@ void CreateGestureCallback::fire(const LLUUID& inv_item) if(!LLPreview::show(inv_item,FALSE)) { - LLPreviewGesture* preview = LLPreviewGesture::show(LLString("Gesture: ") + item->getName(), inv_item, LLUUID::null); + LLPreviewGesture* preview = LLPreviewGesture::show(std::string("Gesture: ") + item->getName(), inv_item, LLUUID::null); // Force to be entirely onscreen. gFloaterView->adjustToFitScreen(preview, FALSE); } diff --git a/indra/newview/llviewerinventory.h b/indra/newview/llviewerinventory.h index 102239099f..42dd91f916 100644 --- a/indra/newview/llviewerinventory.h +++ b/indra/newview/llviewerinventory.h @@ -58,8 +58,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, time_t creation_date_utc); @@ -69,7 +69,7 @@ public: LLViewerInventoryItem( const LLUUID& item_id, const LLUUID& parent_id, - const char* name, + const std::string& name, LLInventoryType::EType inv_type); // construct an invalid and incomplete viewer inventory item. @@ -149,7 +149,7 @@ protected: public: LLViewerInventoryCategory(const LLUUID& uuid, const LLUUID& parent_uuid, LLAssetType::EType preferred_type, - const LLString& name, + const std::string& name, const LLUUID& owner_id); LLViewerInventoryCategory(const LLUUID& owner_id); // Create a copy of an inventory category from a pointer to another category @@ -161,7 +161,6 @@ public: virtual void removeFromServer(); virtual void updateParentOnServer(BOOL restamp_children) const; virtual void updateServer(BOOL is_new) const; - //virtual BOOL unpackMessage(LLMessageSystem* msg, const char* block, S32 block_num = 0); const LLUUID& getOwnerID() const { return mOwnerID; } diff --git a/indra/newview/llviewerjointmesh.cpp b/indra/newview/llviewerjointmesh.cpp index d6032118c9..8772149a86 100644 --- a/indra/newview/llviewerjointmesh.cpp +++ b/indra/newview/llviewerjointmesh.cpp @@ -307,7 +307,7 @@ void LLViewerJointMesh::setMesh( LLPolyMesh *mesh ) U32 jn; for (jn = 0; jn < numJointNames; jn++) { - //llinfos << "Setting up joint " << jointNames[jn].c_str() << llendl; + //llinfos << "Setting up joint " << jointNames[jn] << llendl; LLViewerJoint* joint = (LLViewerJoint*)(getRoot()->findJoint(jointNames[jn]) ); mSkinJoints[jn].setupSkinJoint( joint ); } diff --git a/indra/newview/llviewerkeyboard.cpp b/indra/newview/llviewerkeyboard.cpp index a5032c5a30..90b3f3502c 100644 --- a/indra/newview/llviewerkeyboard.cpp +++ b/indra/newview/llviewerkeyboard.cpp @@ -584,7 +584,7 @@ LLViewerKeyboard::LLViewerKeyboard() : } -void LLViewerKeyboard::bindNamedFunction(const char *name, LLKeyFunc func) +void LLViewerKeyboard::bindNamedFunction(const std::string& name, LLKeyFunc func) { S32 i = mNamedFunctionCount; mNamedFunctions[i].mName = name; @@ -593,29 +593,29 @@ void LLViewerKeyboard::bindNamedFunction(const char *name, LLKeyFunc func) } -BOOL LLViewerKeyboard::modeFromString(const char *string, S32 *mode) +BOOL LLViewerKeyboard::modeFromString(const std::string& string, S32 *mode) { - if (!strcmp(string, "FIRST_PERSON")) + if (string == "FIRST_PERSON") { *mode = MODE_FIRST_PERSON; return TRUE; } - else if (!strcmp(string, "THIRD_PERSON")) + else if (string == "THIRD_PERSON") { *mode = MODE_THIRD_PERSON; return TRUE; } - else if (!strcmp(string, "EDIT")) + else if (string == "EDIT") { *mode = MODE_EDIT; return TRUE; } - else if (!strcmp(string, "EDIT_AVATAR")) + else if (string == "EDIT_AVATAR") { *mode = MODE_EDIT_AVATAR; return TRUE; } - else if (!strcmp(string, "SITTING")) + else if (string == "SITTING") { *mode = MODE_SITTING; return TRUE; @@ -663,11 +663,11 @@ BOOL LLViewerKeyboard::handleKey(KEY translated_key, MASK translated_mask, BOOL -BOOL LLViewerKeyboard::bindKey(const S32 mode, const KEY key, const MASK mask, const char *function_name) +BOOL LLViewerKeyboard::bindKey(const S32 mode, const KEY key, const MASK mask, const std::string& function_name) { S32 i,index; void (*function)(EKeystate keystate) = NULL; - const char *name = NULL; + std::string name; // Allow remapping of F2-F12 if (function_name[0] == 'F') @@ -691,7 +691,7 @@ BOOL LLViewerKeyboard::bindKey(const S32 mode, const KEY key, const MASK mask, c // Not remapped, look for a function for (i = 0; i < mNamedFunctionCount; i++) { - if (!strcmp(function_name, mNamedFunctions[i].mName)) + if (function_name == mNamedFunctions[i].mName) { function = mNamedFunctions[i].mFunction; name = mNamedFunctions[i].mName; @@ -731,22 +731,20 @@ BOOL LLViewerKeyboard::bindKey(const S32 mode, const KEY key, const MASK mask, c if (index == mBindingCount[mode]) mBindingCount[mode]++; - // printf("Bound key %c to %s\n", key, name); - return TRUE; } -S32 LLViewerKeyboard::loadBindings(const char *filename) +S32 LLViewerKeyboard::loadBindings(const std::string& filename) { LLFILE *fp; const S32 BUFFER_SIZE = 2048; char buffer[BUFFER_SIZE]; /* Flawfinder: ignore */ // *NOTE: This buffer size is hard coded into scanf() below. - char mode_string[MAX_STRING]; /* Flawfinder: ignore */ - char key_string[MAX_STRING]; /* Flawfinder: ignore */ - char mask_string[MAX_STRING]; /* Flawfinder: ignore */ - char function_string[MAX_STRING]; /* Flawfinder: ignore */ + char mode_string[MAX_STRING] = ""; /* Flawfinder: ignore */ + char key_string[MAX_STRING] = ""; /* Flawfinder: ignore */ + char mask_string[MAX_STRING] = ""; /* Flawfinder: ignore */ + char function_string[MAX_STRING] = ""; /* Flawfinder: ignore */ S32 mode = MODE_THIRD_PERSON; KEY key = 0; MASK mask = 0; @@ -754,7 +752,7 @@ S32 LLViewerKeyboard::loadBindings(const char *filename) S32 binding_count = 0; S32 line_count = 0; - if(!filename) + if(filename.empty()) { llerrs << " No filename specified" << llendl; return 0; diff --git a/indra/newview/llviewerkeyboard.h b/indra/newview/llviewerkeyboard.h index df31e17c70..5f1ec18a08 100644 --- a/indra/newview/llviewerkeyboard.h +++ b/indra/newview/llviewerkeyboard.h @@ -40,10 +40,10 @@ const S32 MAX_KEY_BINDINGS = 128; // was 60 class LLNamedFunction { public: - LLNamedFunction() : mName(NULL), mFunction(NULL) { }; + LLNamedFunction() : mFunction(NULL) { }; ~LLNamedFunction() { }; - const char *mName; + std::string mName; LLKeyFunc mFunction; }; @@ -68,16 +68,16 @@ public: BOOL handleKey(KEY key, MASK mask, BOOL repeated); - void bindNamedFunction(const char *name, LLKeyFunc func); + void bindNamedFunction(const std::string& name, LLKeyFunc func); - S32 loadBindings(const char *filename); // returns number bound, 0 on error + S32 loadBindings(const std::string& filename); // returns number bound, 0 on error EKeyboardMode getMode(); - BOOL modeFromString(const char *string, S32 *mode); // False on failure + BOOL modeFromString(const std::string& string, S32 *mode); // False on failure void scanKey(KEY key, BOOL key_down, BOOL key_up, BOOL key_level); protected: - BOOL bindKey(const S32 mode, const KEY key, const MASK mask, const char *function_name); + BOOL bindKey(const S32 mode, const KEY key, const MASK mask, const std::string& function_name); S32 mNamedFunctionCount; LLNamedFunction mNamedFunctions[MAX_NAMED_FUNCTIONS]; diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp index d53d32ccea..f803ef3a3e 100644 --- a/indra/newview/llviewermedia.cpp +++ b/indra/newview/llviewermedia.cpp @@ -474,7 +474,7 @@ void LLViewerMedia::initClass() LLMIMETypes::mime_info_map_t::const_iterator it; for (it = LLMIMETypes::sMap.begin(); it != LLMIMETypes::sMap.end(); ++it) { - const LLString& mime_type = it->first; + const std::string& mime_type = it->first; const LLMIMETypes::LLMIMEInfo& info = it->second; mm->addMimeTypeImplNameMap( mime_type, info.mImpl ); } diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 645499d943..946167b90e 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -255,24 +255,12 @@ LLPieMenu *gPieAttachment = NULL; LLPieMenu *gPieLand = NULL; // local constants -const LLString LANDMARK_MENU_NAME("Landmarks"); -const LLString CLIENT_MENU_NAME("Advanced"); -const LLString SERVER_MENU_NAME("Admin"); +const std::string LANDMARK_MENU_NAME("Landmarks"); +const std::string CLIENT_MENU_NAME("Advanced"); +const std::string SERVER_MENU_NAME("Admin"); -const LLString SAVE_INTO_INVENTORY("Save Object Back to My Inventory"); -const LLString SAVE_INTO_TASK_INVENTORY("Save Object Back to Object Contents"); - -#if LL_WINDOWS -static const char* SOUND_EXTENSIONS = ".wav"; -static const char* IMAGE_EXTENSIONS = ".tga .bmp .jpg .jpeg .png"; -static const char* ANIM_EXTENSIONS = ".bvh"; -#ifdef _CORY_TESTING -static const char* GEOMETRY_EXTENSIONS = ".slg"; -#endif -static const char* XML_EXTENSIONS = ".xml"; -static const char* SLOBJECT_EXTENSIONS = ".slobject"; -#endif -static const char* ALL_FILE_EXTENSIONS = "*.*"; +const std::string SAVE_INTO_INVENTORY("Save Object Back to My Inventory"); +const std::string SAVE_INTO_TASK_INVENTORY("Save Object Back to Object Contents"); LLMenuGL* gAttachSubMenu = NULL; LLMenuGL* gDetachSubMenu = NULL; @@ -316,7 +304,7 @@ void handle_region_clear_temp_asset_data(void*); BOOL sitting_on_selection(); void near_sit_object(); -void label_sit_or_stand(LLString& label, void*); +void label_sit_or_stand(std::string& label, void*); // buy and take alias into the same UI positions, so these // declarations handle this mess. BOOL is_selection_buy_not_take(); @@ -328,7 +316,7 @@ BOOL enable_buy(void*); void handle_buy(void *); void handle_buy_object(LLSaleInfo sale_info); void handle_buy_contents(LLSaleInfo sale_info); -void label_touch(LLString& label, void*); +void label_touch(std::string& label, void*); // Land pie menu void near_sit_down_point(BOOL success, void *); @@ -339,7 +327,6 @@ void handle_talk_to(void *userdata); // Debug menu void show_permissions_control(void*); -void load_url_local_file(const char* file_name); void toggle_build_options(void* user_data); #if 0 // Unused void handle_audio_status_1(void*); @@ -502,7 +489,7 @@ BOOL enable_selection_you_own_one(void*); BOOL enable_save_into_inventory(void*); BOOL enable_save_into_task_inventory(void*); BOOL enable_not_thirdperson(void*); -BOOL enable_export_selected(void *); +// BOOL enable_export_selected(void *); BOOL enable_have_card(void*); BOOL enable_detach(void*); BOOL enable_region_owner(void*); @@ -725,7 +712,7 @@ void init_menus() LLViewerLogin::getInstance()->isInProductionGrid()); // *TODO:Get the cost info from the server - const LLString upload_cost("10"); + const std::string upload_cost("10"); gMenuHolder->childSetLabelArg("Upload Image", "[COST]", upload_cost); gMenuHolder->childSetLabelArg("Upload Sound", "[COST]", upload_cost); gMenuHolder->childSetLabelArg("Upload Animation", "[COST]", upload_cost); @@ -792,6 +779,7 @@ void init_landmark_menu(LLMenuGL* menu) // clear existing menu, as we might be rebuilding as result of inventory update clear_landmark_menu(menu); + // *TODO: Translate menu->append(new LLMenuItemCallGL("Organize Landmarks", &manage_landmarks, NULL)); menu->append(new LLMenuItemCallGL("New Landmark...", @@ -808,7 +796,7 @@ void init_landmark_menu(LLMenuGL* menu) for(S32 i = 0; i < count; ++i) { LLInventoryItem* item = items->get(i); - LLString landmark_name = item->getName(); + std::string landmark_name = item->getName(); LLUUID* landmark_id_ptr = new LLUUID( item->getUUID() ); LLMenuItemCallGL* menu_item = new LLMenuItemCallGL(landmark_name, landmark_menu_action, @@ -847,9 +835,10 @@ void init_client_menu(LLMenuGL* menu) LLMenuGL* sub_menu = NULL; //menu->append(new LLMenuItemCallGL("Permissions Control", &show_permissions_control)); - -// this is now in the view menu so we don't need it here! + // this is now in the view menu so we don't need it here! + { + // *TODO: Translate LLMenuGL* sub = new LLMenuGL("Consoles"); menu->appendMenu(sub); sub->append(new LLMenuItemCheckGL("Frame Console", @@ -871,22 +860,7 @@ void init_client_menu(LLMenuGL* menu) &get_visibility, debugview, '4', MASK_CONTROL|MASK_SHIFT ) ); -#if 0 // Unused - { - LLMenuGL* sub = new LLMenuGL("Audio"); - menu->appendMenu(sub); - sub->append(new LLMenuItemCallGL("Global Pos", - &handle_audio_status_1, NULL, NULL ,'5', MASK_CONTROL|MASK_SHIFT) ); - sub->append(new LLMenuItemCallGL("Cone", - &handle_audio_status_2, NULL, NULL ,'6', MASK_CONTROL|MASK_SHIFT) ); - sub->append(new LLMenuItemCallGL("Local Pos", - &handle_audio_status_3, NULL, NULL ,'7', MASK_CONTROL|MASK_SHIFT) ); - sub->append(new LLMenuItemCallGL("Duration", - &handle_audio_status_4, NULL, NULL ,'8', MASK_CONTROL|MASK_SHIFT) ); - sub->createJumpKeys(); - } -#endif sub->append(new LLMenuItemCheckGL("Fast Timers", &toggle_visibility, NULL, @@ -1168,7 +1142,7 @@ void handle_export_menus_to_xml(void*) llwarns << "No file" << llendl; return; } - const char* filename = picker.getFirstFile(); + std::string filename = picker.getFirstFile(); llofstream out(filename); LLXMLNodePtr node = gMenuBarView->getXML(); @@ -1536,37 +1510,6 @@ void init_debug_baked_texture_menu(LLMenuGL* menu) void init_server_menu(LLMenuGL* menu) { - /* - { - // These messages are now trusted. We can write scripts to do - // this, and the message is unchecked for source. - LLMenuGL* sub_menu = NULL; - sub_menu = new LLMenuGL("Sim Logging"); - - sub_menu->append(new LLMenuItemCallGL("Turn off llinfos Log", - &handle_reduce_llinfo_log, &enable_god_customer_service)); - - sub_menu->append(new LLMenuItemCallGL("Normal Logging", - &handle_normal_llinfo_log, &enable_god_customer_service)); - - sub_menu->appendSeparator(); - sub_menu->append(new LLMenuItemCallGL("Enable Message Log", - &handle_sim_enable_message_log, &enable_god_customer_service)); - sub_menu->append(new LLMenuItemCallGL("Disable Message Log", - &handle_sim_disable_message_log, &enable_god_customer_service)); - - sub_menu->appendSeparator(); - - sub_menu->append(new LLMenuItemCallGL("Fetch Message Log", - &handle_sim_fetch_message_log, &enable_god_customer_service)); - - sub_menu->append(new LLMenuItemCallGL("Fetch Log", - &handle_sim_fetch_log, &enable_god_customer_service)); - - menu->appendMenu( sub_menu ); - } - */ - { LLMenuGL* sub = new LLMenuGL("Object"); menu->appendMenu(sub); @@ -1764,7 +1707,7 @@ class LLObjectEnableTouch : public view_listener_t } }; -void label_touch(LLString& label, void*) +void label_touch(std::string& label, void*) { LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode(); if (node && node->mValid && !node->mTouchName.empty()) @@ -2128,7 +2071,7 @@ class LLObjectEnableMute : public view_listener_t { // It's an avatar LLNameValue *lastname = avatar->getNVPair("LastName"); - BOOL is_linden = lastname && !LLString::compareStrings(lastname->getString(), "Linden"); + BOOL is_linden = lastname && !LLStringUtil::compareStrings(lastname->getString(), "Linden"); BOOL is_self = avatar->isSelf(); new_value = !is_linden && !is_self; } @@ -2146,7 +2089,7 @@ class LLObjectMute : public view_listener_t if (!object) return true; LLUUID id; - LLString name; + std::string name; LLMute::EType type; LLVOAvatar* avatar = find_avatar_from_object(object); if (avatar) @@ -2275,11 +2218,11 @@ class LLAvatarFreeze : public view_listener_t if( avatar ) { LLUUID* avatar_id = new LLUUID( avatar->getID() ); - LLString fullname = avatar->getFullname(); + std::string fullname = avatar->getFullname(); if (!fullname.empty()) { - LLString::format_map_t args; + LLStringUtil::format_map_t args; args["[AVATAR_NAME]"] = fullname; gViewerWindow->alertXml("FreezeAvatarFullname", args, @@ -2377,11 +2320,11 @@ class LLAvatarEject : public view_listener_t if( avatar ) { LLUUID* avatar_id = new LLUUID( avatar->getID() ); - LLString fullname = avatar->getFullname(); + std::string fullname = avatar->getFullname(); if (!fullname.empty()) { - LLString::format_map_t args; + LLStringUtil::format_map_t args; args["[AVATAR_NAME]"] = fullname; gViewerWindow->alertXml("EjectAvatarFullname", args, @@ -2432,7 +2375,7 @@ class LLAvatarGiveCard : public view_listener_t if(dest && dest->isAvatar()) { bool found_name = false; - LLString::format_map_t args; + LLStringUtil::format_map_t args; LLNameValue* nvfirst = dest->getNVPair("FirstName"); LLNameValue* nvlast = dest->getNVPair("LastName"); if(nvfirst && nvlast) @@ -2501,63 +2444,34 @@ void handle_leave_group(void *) { if (gAgent.getGroupID() != LLUUID::null) { - LLString::format_map_t args; + LLStringUtil::format_map_t args; args["[GROUP]"] = gAgent.mGroupName; gViewerWindow->alertXml("GroupLeaveConfirmMember", args, callback_leave_group); } } -void append_aggregate(LLString& string, const LLAggregatePermissions& ag_perm, PermissionBit bit, const char* txt) +void append_aggregate(std::string& string, const LLAggregatePermissions& ag_perm, PermissionBit bit, const char* txt) { LLAggregatePermissions::EValue val = ag_perm.getValue(bit); - char buffer[MAX_STRING]; /* Flawfinder: ignore */ - buffer[0] = '\0'; + std::string buffer; switch(val) { - case LLAggregatePermissions::AP_NONE: - snprintf(buffer, MAX_STRING, "* %s None\n", txt); /* Flawfinder: ignore */ + case LLAggregatePermissions::AP_NONE: + buffer = llformat( "* %s None\n", txt); break; - case LLAggregatePermissions::AP_SOME: - snprintf(buffer, MAX_STRING, "* %s Some\n", txt); /* Flawfinder: ignore */ + case LLAggregatePermissions::AP_SOME: + buffer = llformat( "* %s Some\n", txt); break; - case LLAggregatePermissions::AP_ALL: - snprintf(buffer, MAX_STRING, "* %s All\n", txt); /* Flawfinder: ignore */ + case LLAggregatePermissions::AP_ALL: + buffer = llformat( "* %s All\n", txt); break; - case LLAggregatePermissions::AP_EMPTY: - default: + case LLAggregatePermissions::AP_EMPTY: + default: break; } string.append(buffer); } -const char* build_extensions_string(LLFilePicker::ELoadFilter filter) -{ - switch(filter) - { -#if LL_WINDOWS - case LLFilePicker::FFLOAD_IMAGE: - return IMAGE_EXTENSIONS; - case LLFilePicker::FFLOAD_WAV: - return SOUND_EXTENSIONS; - case LLFilePicker::FFLOAD_ANIM: - return ANIM_EXTENSIONS; - case LLFilePicker::FFLOAD_SLOBJECT: - return SLOBJECT_EXTENSIONS; -#ifdef _CORY_TESTING - case LLFilePicker::FFLOAD_GEOMETRY: - return GEOMETRY_EXTENSIONS; -#endif - case LLFilePicker::FFLOAD_XML: - return XML_EXTENSIONS; - case LLFilePicker::FFLOAD_ALL: - return ALL_FILE_EXTENSIONS; -#endif - default: - return ALL_FILE_EXTENSIONS; - } -} - - BOOL enable_buy(void*) { // In order to buy, there must only be 1 purchaseable object in @@ -2600,7 +2514,7 @@ void handle_buy_object(LLSaleInfo sale_info) } LLUUID owner_id; - LLString owner_name; + std::string owner_name; BOOL owners_identical = LLSelectMgr::getInstance()->selectGetOwner(owner_id, owner_name); if (!owners_identical) { @@ -2697,8 +2611,8 @@ void handle_dump_region_object_cache(void*) void handle_dump_focus(void *) { LLView *view = gFocusMgr.getKeyboardFocus(); - - llinfos << "Keyboard focus " << (view ? view->getName() : "(none)") << llendl; + std::string name = view ? view->getName() : "(none)"; + llinfos << "Keyboard focus " << name << llendl; } class LLSelfStandUp : public view_listener_t @@ -2766,7 +2680,7 @@ void set_god_level(U8 god_level) LLViewerLogin::getInstance()->isInProductionGrid()); } - LLString::format_map_t args; + LLStringUtil::format_map_t args; if(god_level > GOD_NOT) { args["[LEVEL]"] = llformat("%d",(S32)god_level); @@ -2814,7 +2728,7 @@ void process_grant_godlike_powers(LLMessageSystem* msg, void**) } } -void load_url_local_file(const char* file_name) +void load_url_local_file(const std::string& file_name) { if( gAgent.cameraMouselook() ) { @@ -2838,7 +2752,7 @@ void load_url_local_file(const char* file_name) full_path.append(gDirUtilp->getDirDelimiter()); full_path.append(file_name); - LLWeb::loadURL(full_path.c_str()); + LLWeb::loadURL(full_path); } /* @@ -2926,8 +2840,8 @@ void request_friendship(const LLUUID& dest_id) LLViewerObject* dest = gObjectList.findObject(dest_id); if(dest && dest->isAvatar()) { - LLString fullname; - LLString::format_map_t args; + std::string fullname; + LLStringUtil::format_map_t args; LLNameValue* nvfirst = dest->getNVPair("FirstName"); LLNameValue* nvlast = dest->getNVPair("LastName"); if(nvfirst && nvlast) @@ -3636,17 +3550,17 @@ void handle_claim_public_land(void*) msg->nextBlock("MethodData"); msg->addString("Method", "claimpublicland"); msg->addUUID("Invoice", LLUUID::null); - char buffer[32]; /* Flawfinder: ignore */ - snprintf(buffer, sizeof(buffer), "%f", west_south.mV[VX]); /* Flawfinder: ignore */ + std::string buffer; + buffer = llformat( "%f", west_south.mV[VX]); msg->nextBlock("ParamList"); msg->addString("Parameter", buffer); - snprintf(buffer, sizeof(buffer), "%f", west_south.mV[VY]); /* Flawfinder: ignore */ + buffer = llformat( "%f", west_south.mV[VY]); msg->nextBlock("ParamList"); msg->addString("Parameter", buffer); - snprintf(buffer, sizeof(buffer), "%f", east_north.mV[VX]); /* Flawfinder: ignore */ + buffer = llformat( "%f", east_north.mV[VX]); msg->nextBlock("ParamList"); msg->addString("Parameter", buffer); - snprintf(buffer, sizeof(buffer), "%f", east_north.mV[VY]); /* Flawfinder: ignore */ + buffer = llformat( "%f", east_north.mV[VY]); msg->nextBlock("ParamList"); msg->addString("Parameter", buffer); gAgent.sendReliableMessage(); @@ -4157,11 +4071,11 @@ class LLToolsEnableBuyOrTake : public view_listener_t gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); // Update label - LLString label; - LLString buy_text; - LLString take_text; - LLString param = userdata["data"].asString(); - LLString::size_type offset = param.find(","); + std::string label; + std::string buy_text; + std::string take_text; + std::string param = userdata["data"].asString(); + std::string::size_type offset = param.find(","); if (offset != param.npos) { buy_text = param.substr(0, offset); @@ -4255,7 +4169,7 @@ void show_buy_currency(const char* extra) } mesg << "Go to " << BUY_CURRENCY_URL << "\nfor information on purchasing currency?"; - LLString::format_map_t args; + LLStringUtil::format_map_t args; if (extra != NULL) { args["[EXTRA]"] = extra; @@ -4449,7 +4363,7 @@ class LLToolsLink : public view_listener_t S32 object_count = LLSelectMgr::getInstance()->getSelection()->getObjectCount(); if (object_count > MAX_CHILDREN_PER_TASK + 1) { - LLStringBase<char>::format_map_t args; + LLStringUtil::format_map_t args; args["[COUNT]"] = llformat("%d", object_count); int max = MAX_CHILDREN_PER_TASK+1; args["[MAX]"] = llformat("%d", max); @@ -4468,7 +4382,7 @@ class LLToolsLink : public view_listener_t return true; } LLUUID owner_id; - LLString owner_name; + std::string owner_name; if(!LLSelectMgr::getInstance()->selectGetOwner(owner_id, owner_name)) { // we don't actually care if you're the owner, but novices are @@ -4847,8 +4761,8 @@ void show_debug_menus() gMenuBarView->setItemVisible(SERVER_MENU_NAME, show_server_menu); gMenuBarView->setItemEnabled(SERVER_MENU_NAME, show_server_menu); - //gMenuBarView->setItemVisible(LLString("DebugOptions"), visible); - //gMenuBarView->setItemVisible(LLString(AVI_TOOLS), visible); + //gMenuBarView->setItemVisible("DebugOptions", visible); + //gMenuBarView->setItemVisible(std::string(AVI_TOOLS), visible); gMenuBarView->arrange(); // clean-up positioning }; @@ -4878,43 +4792,43 @@ void toggle_map( void* user_data ) } -LLUUID gExporterRequestID; -LLString gExportDirectory; +// LLUUID gExporterRequestID; +// std::string gExportDirectory; -LLUploadDialog *gExportDialog = NULL; +// LLUploadDialog *gExportDialog = NULL; -void handle_export_selected( void * ) -{ - LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); - if (selection->isEmpty()) - { - return; - } - llinfos << "Exporting selected objects:" << llendl; +// void handle_export_selected( void * ) +// { +// LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); +// if (selection->isEmpty()) +// { +// return; +// } +// llinfos << "Exporting selected objects:" << llendl; - gExporterRequestID.generate(); - gExportDirectory = ""; +// gExporterRequestID.generate(); +// gExportDirectory = ""; - LLMessageSystem* msg = gMessageSystem; - msg->newMessageFast(_PREHASH_ObjectExportSelected); - msg->nextBlockFast(_PREHASH_AgentData); - msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); - msg->addUUIDFast(_PREHASH_RequestID, gExporterRequestID); - msg->addS16Fast(_PREHASH_VolumeDetail, 4); +// LLMessageSystem* msg = gMessageSystem; +// msg->newMessageFast(_PREHASH_ObjectExportSelected); +// msg->nextBlockFast(_PREHASH_AgentData); +// msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); +// msg->addUUIDFast(_PREHASH_RequestID, gExporterRequestID); +// msg->addS16Fast(_PREHASH_VolumeDetail, 4); - for (LLObjectSelection::root_iterator iter = selection->root_begin(); - iter != selection->root_end(); iter++) - { - LLSelectNode* node = *iter; - LLViewerObject* object = node->getObject(); - msg->nextBlockFast(_PREHASH_ObjectData); - msg->addUUIDFast(_PREHASH_ObjectID, object->getID()); - llinfos << "Object: " << object->getID() << llendl; - } - msg->sendReliable(gAgent.getRegion()->getHost()); +// for (LLObjectSelection::root_iterator iter = selection->root_begin(); +// iter != selection->root_end(); iter++) +// { +// LLSelectNode* node = *iter; +// LLViewerObject* object = node->getObject(); +// msg->nextBlockFast(_PREHASH_ObjectData); +// msg->addUUIDFast(_PREHASH_ObjectID, object->getID()); +// llinfos << "Object: " << object->getID() << llendl; +// } +// msg->sendReliable(gAgent.getRegion()->getHost()); - gExportDialog = LLUploadDialog::modalUploadDialog("Exporting selected objects..."); -} +// gExportDialog = LLUploadDialog::modalUploadDialog("Exporting selected objects..."); +// } BOOL menu_check_build_tool( void* user_data ) { @@ -5240,11 +5154,11 @@ class LLObjectEnableSitOrStand : public view_listener_t gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); // Update label - LLString label; - LLString sit_text; - LLString stand_text; - LLString param = userdata["data"].asString(); - LLString::size_type offset = param.find(","); + std::string label; + std::string sit_text; + std::string stand_text; + std::string param = userdata["data"].asString(); + std::string::size_type offset = param.find(","); if (offset != param.npos) { sit_text = param.substr(0, offset); @@ -5331,7 +5245,7 @@ class LLShowFloater : public view_listener_t { bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) { - LLString floater_name = userdata.asString(); + std::string floater_name = userdata.asString(); if (floater_name == "gestures") { LLFloaterGesture::toggleVisibility(); @@ -5431,7 +5345,7 @@ class LLShowFloater : public view_listener_t } else if (floater_name == "help tutorial") { - LLFloaterHUD::show(); + LLFloaterHUD::showHUD(); } else if (floater_name == "complaint reporter") { @@ -5476,8 +5390,8 @@ class LLFloaterVisible : public view_listener_t { bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) { - LLString control_name = userdata["control"].asString(); - LLString floater_name = userdata["data"].asString(); + std::string control_name = userdata["control"].asString(); + std::string floater_name = userdata["data"].asString(); bool new_value = false; if (floater_name == "friends") { @@ -5520,12 +5434,12 @@ class LLFloaterVisible : public view_listener_t } }; -void callback_show_url(S32 option, void* url) +void callback_show_url(S32 option, void* data) { - const char* urlp = (const char*)url; + std::string* urlp = (std::string*)data; if (0 == option) { - LLWeb::loadURL(urlp); + LLWeb::loadURL(*urlp); } delete urlp; } @@ -5534,22 +5448,13 @@ class LLPromptShowURL : public view_listener_t { bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) { - LLString param = userdata.asString(); - LLString::size_type offset = param.find(","); + std::string param = userdata.asString(); + std::string::size_type offset = param.find(","); if (offset != param.npos) { - LLString alert = param.substr(0, offset); - LLString url = param.substr(offset+1); - char *url_copy = new char[url.size()+1]; - if (url_copy != NULL) - { - strcpy(url_copy, url.c_str()); /* Flawfinder: ignore */ - } - else - { - llerrs << "Memory Allocation Failed" << llendl; - return false; - } + std::string alert = param.substr(0, offset); + std::string url = param.substr(offset+1); + std::string* url_copy = new std::string(url); gViewerWindow->alertXml(alert, callback_show_url, url_copy); } else @@ -5560,12 +5465,12 @@ class LLPromptShowURL : public view_listener_t } }; -void callback_show_file(S32 option, void* filename) +void callback_show_file(S32 option, void* data) { - const char* filenamep = (const char*)filename; + std::string* filenamep = (std::string*)data; if (0 == option) { - load_url_local_file(filenamep); + load_url_local_file(*filenamep); } delete filenamep; } @@ -5574,22 +5479,13 @@ class LLPromptShowFile : public view_listener_t { bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) { - LLString param = userdata.asString(); - LLString::size_type offset = param.find(","); + std::string param = userdata.asString(); + std::string::size_type offset = param.find(","); if (offset != param.npos) { - LLString alert = param.substr(0, offset); - LLString file = param.substr(offset+1); - char *file_copy = new char[file.size()+1]; - if (file_copy != NULL) - { - strcpy(file_copy, file.c_str()); /* Flawfinder: ignore */ - } - else - { - llerrs << "Memory Allocation Failed" << llendl; - return false; - } + std::string alert = param.substr(0, offset); + std::string file = param.substr(offset+1); + std::string* file_copy = new std::string(file); gViewerWindow->alertXml(alert, callback_show_file, file_copy); } else @@ -5887,7 +5783,7 @@ void handle_detach_from_avatar(void* user_data) } } -void attach_label(LLString& label, void* user_data) +void attach_label(std::string& label, void* user_data) { LLViewerJointAttachment* attachmentp = (LLViewerJointAttachment*)user_data; if (attachmentp) @@ -5898,13 +5794,13 @@ void attach_label(LLString& label, void* user_data) LLViewerInventoryItem* itemp = gInventory.getItem(attachmentp->getItemID()); if (itemp) { - label += LLString(" (") + itemp->getName() + LLString(")"); + label += std::string(" (") + itemp->getName() + std::string(")"); } } } } -void detach_label(LLString& label, void* user_data) +void detach_label(std::string& label, void* user_data) { LLViewerJointAttachment* attachmentp = (LLViewerJointAttachment*)user_data; if (attachmentp) @@ -5915,7 +5811,7 @@ void detach_label(LLString& label, void* user_data) LLViewerInventoryItem* itemp = gInventory.getItem(attachmentp->getItemID()); if (itemp) { - label += LLString(" (") + itemp->getName() + LLString(")"); + label += std::string(" (") + itemp->getName() + std::string(")"); } } } @@ -6157,7 +6053,7 @@ class LLAvatarSendIM : public view_listener_t LLVOAvatar* avatar = find_avatar_from_object( gViewerWindow->lastObjectHit() ); if(avatar) { - LLString name("IM"); + std::string name("IM"); LLNameValue *first = avatar->getNVPair("FirstName"); LLNameValue *last = avatar->getNVPair("LastName"); if (first && last) @@ -6248,7 +6144,7 @@ class LLToolsSelectedScriptAction : public view_listener_t { bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) { - LLString action = userdata.asString(); + std::string action = userdata.asString(); LLFloaterScriptQueue* queue = NULL; if (action == "compile") { @@ -6413,7 +6309,7 @@ BOOL menu_ui_enabled(void *user_data) void menu_toggle_control( void* user_data ) { BOOL checked = gSavedSettings.getBOOL( static_cast<char*>(user_data) ); - if (LLString(static_cast<char*>(user_data)) == "HighResSnapshot" && !checked) + if (std::string(static_cast<char*>(user_data)) == "HighResSnapshot" && !checked) { // High Res Snapshot active, must uncheck RenderUIInSnapshot gSavedSettings.setBOOL( "RenderUIInSnapshot", FALSE ); @@ -6427,7 +6323,7 @@ class LLToggleControl : public view_listener_t { bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) { - LLString control_name = userdata.asString(); + std::string control_name = userdata.asString(); BOOL checked = gSavedSettings.getBOOL( control_name ); if (control_name == "HighResSnapshot" && !checked) { @@ -6681,22 +6577,22 @@ BOOL enable_not_thirdperson(void*) } -BOOL enable_export_selected(void *) -{ - if (LLSelectMgr::getInstance()->getSelection()->isEmpty()) - { - return FALSE; - } - if (!gExporterRequestID.isNull()) - { - return FALSE; - } - if (!LLUploadDialog::modalUploadIsFinished()) - { - return FALSE; - } - return TRUE; -} +// BOOL enable_export_selected(void *) +// { +// if (LLSelectMgr::getInstance()->getSelection()->isEmpty()) +// { +// return FALSE; +// } +// if (!gExporterRequestID.isNull()) +// { +// return FALSE; +// } +// if (!LLUploadDialog::modalUploadIsFinished()) +// { +// return FALSE; +// } +// return TRUE; +// } class LLViewEnableMouselook : public view_listener_t { @@ -6946,7 +6842,7 @@ void handle_grab_texture(void* data) LLUUID folder_id(gInventory.findCategoryUUIDForType(asset_type)); if(folder_id.notNull()) { - LLString name = "Baked "; + std::string name = "Baked "; switch (index) { case LLVOAvatar::TEX_EYES_BAKED: @@ -6992,7 +6888,7 @@ void handle_grab_texture(void* data) asset_type, inv_type, name, - "", + LLStringUtil::null, LLSaleInfo::DEFAULT, LLInventoryItem::II_FLAGS_NONE, creation_date_now); @@ -7069,12 +6965,7 @@ LLVOAvatar* find_avatar_from_object( const LLUUID& object_id ) void handle_disconnect_viewer(void *) { - char message[2048]; /* Flawfinder: ignore */ - message[0] = '\0'; - - snprintf(message, sizeof(message), "Testing viewer disconnect"); /* Flawfinder: ignore */ - - LLAppViewer::instance()->forceDisconnect(message); + LLAppViewer::instance()->forceDisconnect("Testing viewer disconnect"); } void force_error_breakpoint(void *) @@ -7180,20 +7071,20 @@ void handle_save_to_xml(void*) return; } - LLString default_name = "floater_"; + std::string default_name = "floater_"; default_name += frontmost->getTitle(); default_name += ".xml"; - LLString::toLower(default_name); - LLString::replaceChar(default_name, ' ', '_'); - LLString::replaceChar(default_name, '/', '_'); - LLString::replaceChar(default_name, ':', '_'); - LLString::replaceChar(default_name, '"', '_'); + LLStringUtil::toLower(default_name); + LLStringUtil::replaceChar(default_name, ' ', '_'); + LLStringUtil::replaceChar(default_name, '/', '_'); + LLStringUtil::replaceChar(default_name, ':', '_'); + LLStringUtil::replaceChar(default_name, '"', '_'); LLFilePicker& picker = LLFilePicker::instance(); - if (picker.getSaveFile(LLFilePicker::FFSAVE_XML, default_name.c_str())) + if (picker.getSaveFile(LLFilePicker::FFSAVE_XML, default_name)) { - LLString filename = picker.getFirstFile(); + std::string filename = picker.getFirstFile(); LLUICtrlFactory::getInstance()->saveToXML(frontmost, filename); } } @@ -7203,7 +7094,7 @@ void handle_load_from_xml(void*) LLFilePicker& picker = LLFilePicker::instance(); if (picker.getOpenFile(LLFilePicker::FFLOAD_XML)) { - LLString filename = picker.getFirstFile(); + std::string filename = picker.getFirstFile(); LLFloater* floater = new LLFloater("sample_floater"); LLUICtrlFactory::getInstance()->buildFloater(floater, filename); } @@ -7286,7 +7177,7 @@ class LLViewBeaconWidth : public view_listener_t { bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) { - LLString width = userdata.asString(); + std::string width = userdata.asString(); if(width == "1") { gSavedSettings.setS32("DebugBeaconLineWidth", 1); @@ -7313,7 +7204,7 @@ class LLViewToggleBeacon : public view_listener_t { bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) { - LLString beacon = userdata.asString(); + std::string beacon = userdata.asString(); if (beacon == "scriptsbeacon") { LLPipeline::toggleRenderScriptedBeacons(NULL); @@ -7382,7 +7273,7 @@ class LLViewCheckBeaconEnabled : public view_listener_t { bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) { - LLString beacon = userdata["data"].asString(); + std::string beacon = userdata["data"].asString(); bool new_value = false; if (beacon == "scriptsbeacon") { @@ -7428,7 +7319,7 @@ class LLViewToggleRenderType : public view_listener_t { bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) { - LLString type = userdata.asString(); + std::string type = userdata.asString(); if (type == "hideparticles") { LLPipeline::toggleRenderType(LLPipeline::RENDER_TYPE_PARTICLES); @@ -7441,7 +7332,7 @@ class LLViewCheckRenderType : public view_listener_t { bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) { - LLString type = userdata["data"].asString(); + std::string type = userdata["data"].asString(); bool new_value = false; if (type == "hideparticles") { @@ -7475,8 +7366,8 @@ class LLEditEnableTakeOff : public view_listener_t { bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) { - LLString control_name = userdata["control"].asString(); - LLString clothing = userdata["data"].asString(); + std::string control_name = userdata["control"].asString(); + std::string clothing = userdata["data"].asString(); bool new_value = false; if (clothing == "shirt") { @@ -7523,7 +7414,7 @@ class LLEditTakeOff : public view_listener_t { bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) { - LLString clothing = userdata.asString(); + std::string clothing = userdata.asString(); if (clothing == "shirt") { LLAgent::userRemoveWearable((void*)WT_SHIRT); @@ -7581,7 +7472,7 @@ class LLToolsSelectTool : public view_listener_t { bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) { - LLString tool_name = userdata.asString(); + std::string tool_name = userdata.asString(); if (tool_name == "focus") { LLToolMgr::getInstance()->getCurrentToolset()->selectToolByIndex(1); @@ -7611,7 +7502,7 @@ class LLWorldEnvSettings : public view_listener_t { bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) { - LLString tod = userdata.asString(); + std::string tod = userdata.asString(); LLVector3 sun_direction; if (tod == "editor") @@ -7725,7 +7616,7 @@ class LLWorldDayCycle : public view_listener_t -static void addMenu(view_listener_t *menu, const char *name) +static void addMenu(view_listener_t *menu, const std::string& name) { sMenus.push_back(menu); menu->registerListener(gMenuHolder, name); diff --git a/indra/newview/llviewermenu.h b/indra/newview/llviewermenu.h index 98b08c4985..d8a8bba08c 100644 --- a/indra/newview/llviewermenu.h +++ b/indra/newview/llviewermenu.h @@ -50,7 +50,7 @@ void cleanup_menus(); void show_debug_menus(); // checks for if menus should be shown first. void show_context_menu( S32 x, S32 y, MASK mask ); void show_build_mode_context_menu(S32 x, S32 y, MASK mask); -void load_url_local_file(const char *file_name); +void load_url_local_file(const std::string& file_name); BOOL enable_save_into_inventory(void*); void handle_reset_view(); void handle_cut(void*); @@ -83,8 +83,8 @@ void menu_toggle_control( void* user_data ); void check_toggle_control( LLUICtrl *, void* user_data ); void confirm_replace_attachment(S32 option, void* user_data); void handle_detach_from_avatar(void* user_data); -void attach_label(LLString& label, void* user_data); -void detach_label(LLString& label, void* user_data); +void attach_label(std::string& label, void* user_data); +void detach_label(std::string& label, void* user_data); BOOL object_selected_and_point_valid(void* user_data); BOOL object_attached(void* user_data); void handle_detach(void*); @@ -112,9 +112,6 @@ bool handle_go_to(); // Export to XML or Collada void handle_export_selected( void * ); -//Retrieve a list of valid extensions for a given file "type" -const char* build_extensions_string(LLFilePicker::ELoadFilter filter); - // Pass in an empty string and this function will build a string that // describes buyer permissions. class LLSaleInfo; @@ -137,7 +134,7 @@ protected: LLSafeHandle<LLObjectSelection> mObjectSelection; }; -extern const LLString SAVE_INTO_INVENTORY; +extern const std::string SAVE_INTO_INVENTORY; extern LLMenuBarGL* gMenuBarView; //extern LLView* gMenuBarHolder; diff --git a/indra/newview/llviewermenufile.cpp b/indra/newview/llviewermenufile.cpp index 9dc3208adb..00cc94c3d3 100644 --- a/indra/newview/llviewermenufile.cpp +++ b/indra/newview/llviewermenufile.cpp @@ -92,6 +92,47 @@ class LLFileEnableUpload : public view_listener_t } }; +//============================================================================ + +#if LL_WINDOWS +static std::string SOUND_EXTENSIONS = "wav"; +static std::string IMAGE_EXTENSIONS = "tga bmp jpg jpeg png"; +static std::string ANIM_EXTENSIONS = "bvh"; +#ifdef _CORY_TESTING +static std::string GEOMETRY_EXTENSIONS = "slg"; +#endif +static std::string XML_EXTENSIONS = "xml"; +static std::string SLOBJECT_EXTENSIONS = "slobject"; +#endif +static std::string ALL_FILE_EXTENSIONS = "*.*"; + +std::string build_extensions_string(LLFilePicker::ELoadFilter filter) +{ + switch(filter) + { +#if LL_WINDOWS + case LLFilePicker::FFLOAD_IMAGE: + return IMAGE_EXTENSIONS; + case LLFilePicker::FFLOAD_WAV: + return SOUND_EXTENSIONS; + case LLFilePicker::FFLOAD_ANIM: + return ANIM_EXTENSIONS; + case LLFilePicker::FFLOAD_SLOBJECT: + return SLOBJECT_EXTENSIONS; +#ifdef _CORY_TESTING + case LLFilePicker::FFLOAD_GEOMETRY: + return GEOMETRY_EXTENSIONS; +#endif + case LLFilePicker::FFLOAD_XML: + return XML_EXTENSIONS; + case LLFilePicker::FFLOAD_ALL: + return ALL_FILE_EXTENSIONS; +#endif + default: + return ALL_FILE_EXTENSIONS; + } +} + /** char* upload_pick(void* data) @@ -100,7 +141,7 @@ class LLFileEnableUpload : public view_listener_t returns the string to the full path filename, else returns NULL. Data is the load filter for the type of file as defined in LLFilePicker. **/ -const char* upload_pick(void* data) +const std::string upload_pick(void* data) { if( gAgent.cameraMouselook() ) { @@ -123,23 +164,23 @@ const char* upload_pick(void* data) if (!picker.getOpenFile(type)) { llinfos << "Couldn't import objects from file" << llendl; - return NULL; + return std::string(); } - const char* filename = picker.getFirstFile(); - const char* ext = strrchr(filename, '.'); + + const std::string& filename = picker.getFirstFile(); + std::string ext = gDirUtilp->getExtension(filename); //strincmp doesn't like NULL pointers - if (ext == NULL) + if (ext.empty()) { - const char* short_name = strrchr(filename, - *gDirUtilp->getDirDelimiter().c_str()); + std::string short_name = gDirUtilp->getBaseFileName(filename); // No extension - LLStringBase<char>::format_map_t args; - args["[FILE]"] = LLString(short_name + 1); + LLStringUtil::format_map_t args; + args["[FILE]"] = short_name; gViewerWindow->alertXml("NoFileExtension", args); - return NULL; + return std::string(); } else { @@ -148,8 +189,7 @@ const char* upload_pick(void* data) //if the extension is valid //now grab the set of valid file extensions - const char* valids = build_extensions_string(type); - std::string valid_extensions = std::string(valids); + std::string valid_extensions = build_extensions_string(type); BOOL ext_valid = FALSE; @@ -165,10 +205,9 @@ const char* upload_pick(void* data) token_iter != tokens.end() && ext_valid != TRUE; ++token_iter) { - const char* cur_token = token_iter->c_str(); + const std::string& cur_token = *token_iter; - if (0 == strnicmp(cur_token, ext, strlen(cur_token)) || /* Flawfinder: ignore */ - 0 == strnicmp(cur_token, "*.*", strlen(cur_token))) /* Flawfinder: ignore */ + if (cur_token == ext || cur_token == "*.*") { //valid extension //or the acceptable extension is any @@ -180,11 +219,11 @@ const char* upload_pick(void* data) { //should only get here if the extension exists //but is invalid - LLStringBase<char>::format_map_t args; + LLStringUtil::format_map_t args; args["[EXTENSION]"] = ext; - args["[VALIDS]"] = valids; + args["[VALIDS]"] = valid_extensions; gViewerWindow->alertXml("InvalidFileExtension", args); - return NULL; + return std::string(); } }//end else (non-null extension) @@ -195,14 +234,14 @@ const char* upload_pick(void* data) if (type == LLFilePicker::FFLOAD_WAV) { // pre-qualify wavs to make sure the format is acceptable - char error_msg[MAX_STRING]; /* Flawfinder: ignore */ + std::string error_msg; if (check_for_invalid_wav_formats(filename,error_msg)) { llinfos << error_msg << ": " << filename << llendl; - LLStringBase<char>::format_map_t args; + LLStringUtil::format_map_t args; args["[FILE]"] = filename; gViewerWindow->alertXml( error_msg, args ); - return NULL; + return std::string(); } }//end if a wave/sound file @@ -214,8 +253,8 @@ class LLFileUploadImage : public view_listener_t { bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) { - const char* filename = upload_pick((void *)LLFilePicker::FFLOAD_IMAGE); - if (filename) + std::string filename = upload_pick((void *)LLFilePicker::FFLOAD_IMAGE); + if (!filename.empty()) { LLFloaterImagePreview* floaterp = new LLFloaterImagePreview(filename); LLUICtrlFactory::getInstance()->buildFloater(floaterp, "floater_image_preview.xml"); @@ -228,8 +267,8 @@ class LLFileUploadSound : public view_listener_t { bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) { - const char* filename = upload_pick((void*)LLFilePicker::FFLOAD_WAV); - if (filename) + std::string filename = upload_pick((void*)LLFilePicker::FFLOAD_WAV); + if (!filename.empty()) { LLFloaterNameDesc* floaterp = new LLFloaterNameDesc(filename); LLUICtrlFactory::getInstance()->buildFloater(floaterp, "floater_sound_preview.xml"); @@ -242,8 +281,8 @@ class LLFileUploadAnim : public view_listener_t { bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) { - const char* filename = upload_pick((void*)LLFilePicker::FFLOAD_ANIM); - if (filename) + const std::string filename = upload_pick((void*)LLFilePicker::FFLOAD_ANIM); + if (!filename.empty()) { LLFloaterAnimPreview* floaterp = new LLFloaterAnimPreview(filename); LLUICtrlFactory::getInstance()->buildFloater(floaterp, "floater_animation_preview.xml"); @@ -274,27 +313,18 @@ class LLFileUploadBulk : public view_listener_t LLFilePicker& picker = LLFilePicker::instance(); if (picker.getMultipleOpenFiles()) { - const char* filename = picker.getFirstFile(); - const char* name = picker.getDirname(); - - LLString asset_name = name; - LLString::replaceNonstandardASCII( asset_name, '?' ); - LLString::replaceChar(asset_name, '|', '?'); - LLString::stripNonprintable(asset_name); - LLString::trim(asset_name); - - char* asset_name_str = (char*)asset_name.c_str(); - char* end_p = strrchr(asset_name_str, '.'); // strip extension if exists - if( !end_p ) - { - end_p = asset_name_str + strlen( asset_name_str ); /* Flawfinder: ignore */ - } - - S32 len = llmin( (S32) (DB_INV_ITEM_NAME_STR_LEN), (S32) (end_p - asset_name_str) ); - - asset_name = asset_name.substr( 0, len ); - + const std::string& filename = picker.getFirstFile(); + std::string name = gDirUtilp->getBaseFileName(filename, true); + + std::string asset_name = name; + LLStringUtil::replaceNonstandardASCII( asset_name, '?' ); + LLStringUtil::replaceChar(asset_name, '|', '?'); + LLStringUtil::stripNonprintable(asset_name); + LLStringUtil::trim(asset_name); + upload_new_resource(filename, asset_name, asset_name, 0, LLAssetType::AT_NONE, LLInventoryType::IT_NONE); // file + // *NOTE: Ew, we don't iterate over the file list here, + // we handle the next files in upload_done_callback() } else { @@ -304,11 +334,11 @@ class LLFileUploadBulk : public view_listener_t } }; -void upload_error(const char* error_message, const char* label, const std::string filename, const LLStringBase<char>::format_map_t args) +void upload_error(const std::string& error_message, const std::string& label, const std::string& filename, const LLStringUtil::format_map_t args) { llwarns << error_message << llendl; gViewerWindow->alertXml(label, args); - if(remove(filename.c_str()) == -1) + if(LLFile::remove(filename) == -1) { lldebugs << "unable to remove temp file" << llendl; } @@ -425,8 +455,8 @@ class LLFileQuit : public view_listener_t void handle_upload(void* data) { - const char* filename = upload_pick(data); - if (filename) + const std::string filename = upload_pick(data); + if (!filename.empty()) { LLFloaterNameDesc* floaterp = new LLFloaterNameDesc(filename); LLUICtrlFactory::getInstance()->buildFloater(floaterp, "floater_name_description.xml"); @@ -438,10 +468,9 @@ void handle_compress_image(void*) LLFilePicker& picker = LLFilePicker::instance(); if (picker.getMultipleOpenFiles(LLFilePicker::FFLOAD_IMAGE)) { - const char* input_file = picker.getFirstFile(); - while (input_file) + std::string infile = picker.getFirstFile(); + while (!infile.empty()) { - std::string infile(input_file); std::string outfile = infile + ".j2c"; llinfos << "Input: " << infile << llendl; @@ -460,59 +489,54 @@ void handle_compress_image(void*) llinfos << "Compression failed: " << LLImageBase::getLastError() << llendl; } - input_file = picker.getNextFile(); + infile = picker.getNextFile(); } } } -void upload_new_resource(const LLString& src_filename, std::string name, +void upload_new_resource(const std::string& src_filename, std::string name, std::string desc, S32 compression_info, LLAssetType::EType destination_folder_type, LLInventoryType::EType inv_type, U32 next_owner_perm, - const LLString& display_name, + const std::string& display_name, LLAssetStorage::LLStoreAssetCallback callback, void *userdata) { // Generate the temporary UUID. - LLString filename = gDirUtilp->getTempFilename(); + std::string filename = gDirUtilp->getTempFilename(); LLTransactionID tid; LLAssetID uuid; - LLStringBase<char>::format_map_t args; + LLStringUtil::format_map_t args; + + std::string exten = gDirUtilp->getExtension(src_filename); - LLString ext = src_filename.substr(src_filename.find_last_of('.')); LLAssetType::EType asset_type = LLAssetType::AT_NONE; - char error_message[MAX_STRING]; /* Flawfinder: ignore */ - error_message[0] = '\0'; - LLString temp_str; + std::string error_message; BOOL error = FALSE; - if (ext.empty()) + if (exten.empty()) { - LLString::size_type offset = filename.find_last_of(gDirUtilp->getDirDelimiter()); - if (offset != LLString::npos) - offset++; - LLString short_name = filename.substr(offset); + std::string short_name = gDirUtilp->getBaseFileName(filename); // No extension - snprintf(error_message, /* Flawfinder: ignore */ - MAX_STRING, + error_message = llformat( "No file extension for the file: '%s'\nPlease make sure the file has a correct file extension", short_name.c_str()); args["[FILE]"] = short_name; upload_error(error_message, "NofileExtension", filename, args); return; } - else if( LLString::compareInsensitive(ext.c_str(),".bmp") == 0 ) + else if( exten == "bmp") { asset_type = LLAssetType::AT_TEXTURE; if (!LLViewerImageList::createUploadFile(src_filename, filename, IMG_CODEC_BMP )) { - snprintf(error_message, MAX_STRING, "Problem with file %s:\n\n%s\n", /* Flawfinder: ignore */ + error_message = llformat( "Problem with file %s:\n\n%s\n", src_filename.c_str(), LLImageBase::getLastError().c_str()); args["[FILE]"] = src_filename; args["[ERROR]"] = LLImageBase::getLastError(); @@ -520,14 +544,14 @@ void upload_new_resource(const LLString& src_filename, std::string name, return; } } - else if( LLString::compareInsensitive(ext.c_str(),".tga") == 0 ) + else if( exten == "tga") { asset_type = LLAssetType::AT_TEXTURE; if (!LLViewerImageList::createUploadFile(src_filename, filename, IMG_CODEC_TGA )) { - snprintf(error_message, MAX_STRING, "Problem with file %s:\n\n%s\n", /* Flawfinder: ignore */ + error_message = llformat("Problem with file %s:\n\n%s\n", src_filename.c_str(), LLImageBase::getLastError().c_str()); args["[FILE]"] = src_filename; args["[ERROR]"] = LLImageBase::getLastError(); @@ -535,14 +559,14 @@ void upload_new_resource(const LLString& src_filename, std::string name, return; } } - else if( LLString::compareInsensitive(ext.c_str(),".jpg") == 0 || LLString::compareInsensitive(ext.c_str(),".jpeg") == 0) + else if( exten == "jpg" || exten == "jpeg") { asset_type = LLAssetType::AT_TEXTURE; if (!LLViewerImageList::createUploadFile(src_filename, filename, IMG_CODEC_JPEG )) { - snprintf(error_message, MAX_STRING, "Problem with file %s:\n\n%s\n", /* Flawfinder: ignore */ + error_message = llformat("Problem with file %s:\n\n%s\n", src_filename.c_str(), LLImageBase::getLastError().c_str()); args["[FILE]"] = src_filename; args["[ERROR]"] = LLImageBase::getLastError(); @@ -550,14 +574,14 @@ void upload_new_resource(const LLString& src_filename, std::string name, return; } } - else if( LLString::compareInsensitive(ext.c_str(),".png") == 0 ) + else if( exten == "png") { asset_type = LLAssetType::AT_TEXTURE; if (!LLViewerImageList::createUploadFile(src_filename, filename, IMG_CODEC_PNG )) { - sprintf(error_message, "Problem with file %s:\n\n%s\n", + error_message = llformat("Problem with file %s:\n\n%s\n", src_filename.c_str(), LLImageBase::getLastError().c_str()); args["[FILE]"] = src_filename; args["[ERROR]"] = LLImageBase::getLastError(); @@ -565,27 +589,27 @@ void upload_new_resource(const LLString& src_filename, std::string name, return; } } - else if(LLString::compareInsensitive(ext.c_str(),".wav") == 0) + else if(exten == "wav") { asset_type = LLAssetType::AT_SOUND; // tag it as audio S32 encode_result = 0; llinfos << "Attempting to encode wav as an ogg file" << llendl; - encode_result = encode_vorbis_file(src_filename.c_str(), filename.c_str()); + encode_result = encode_vorbis_file(src_filename, filename); if (LLVORBISENC_NOERR != encode_result) { switch(encode_result) { case LLVORBISENC_DEST_OPEN_ERR: - snprintf(error_message, MAX_STRING, "Couldn't open temporary compressed sound file for writing: %s\n", filename.c_str()); /* Flawfinder: ignore */ + error_message = llformat( "Couldn't open temporary compressed sound file for writing: %s\n", filename.c_str()); args["[FILE]"] = filename; upload_error(error_message, "CannotOpenTemporarySoundFile", filename, args); break; default: - snprintf(error_message, MAX_STRING, "Unknown vorbis encode failure on: %s\n", src_filename.c_str()); /* Flawfinder: ignore */ + error_message = llformat("Unknown vorbis encode failure on: %s\n", src_filename.c_str()); args["[FILE]"] = src_filename; upload_error(error_message, "UnknownVorbisEncodeFailure", filename, args); break; @@ -593,11 +617,11 @@ void upload_new_resource(const LLString& src_filename, std::string name, return; } } - else if(LLString::compareInsensitive(ext.c_str(),".tmp") == 0) + else if(exten == "tmp") { // This is a generic .lin resource file asset_type = LLAssetType::AT_OBJECT; - LLFILE* in = LLFile::fopen(src_filename.c_str(), "rb"); /* Flawfinder: ignore */ + LLFILE* in = LLFile::fopen(src_filename, "rb"); /* Flawfinder: ignore */ if (in) { // read in the file header @@ -627,7 +651,7 @@ void upload_new_resource(const LLString& src_filename, std::string name, if (EOF == tokens_read) { fclose(in); - snprintf(error_message, MAX_STRING, "corrupt resource file: %s", src_filename.c_str()); /* Flawfinder: ignore */ + error_message = llformat("corrupt resource file: %s", src_filename.c_str()); args["[FILE]"] = src_filename; upload_error(error_message, "CorruptResourceFile", filename, args); return; @@ -655,7 +679,7 @@ void upload_new_resource(const LLString& src_filename, std::string name, else { fclose(in); - snprintf(error_message, MAX_STRING, "unknown linden resource file version in file: %s", src_filename.c_str()); /* Flawfinder: ignore */ + error_message = llformat("unknown linden resource file version in file: %s", src_filename.c_str()); args["[FILE]"] = src_filename; upload_error(error_message, "UnknownResourceFileVersion", filename, args); return; @@ -682,7 +706,7 @@ void upload_new_resource(const LLString& src_filename, std::string name, } // copy the file's data segment into another file for uploading - LLFILE* out = LLFile::fopen(filename.c_str(), "wb"); /* Flawfinder: ignore */ + LLFILE* out = LLFile::fopen(filename, "wb"); /* Flawfinder: ignore */ if (out) { while((read = fread(buf, 1, 16384, in))) /* Flawfinder: ignore */ @@ -697,7 +721,7 @@ void upload_new_resource(const LLString& src_filename, std::string name, else { fclose(in); - snprintf(error_message, MAX_STRING, "Unable to create output file: %s", filename.c_str()); /* Flawfinder: ignore */ + error_message = llformat( "Unable to create output file: %s", filename.c_str()); args["[FILE]"] = filename; upload_error(error_message, "UnableToCreateOutputFile", filename, args); return; @@ -710,16 +734,17 @@ void upload_new_resource(const LLString& src_filename, std::string name, llinfos << "Couldn't open .lin file " << src_filename << llendl; } } - else if (LLString::compareInsensitive(ext.c_str(),".bvh") == 0) + else if (exten == "bvh") { - snprintf(error_message, MAX_STRING, "We do not currently support bulk upload of animation files\n"); /* Flawfinder: ignore */ + error_message = llformat("We do not currently support bulk upload of animation files\n"); upload_error(error_message, "DoNotSupportBulkAnimationUpload", filename, args); return; } else { // Unknown extension - snprintf(error_message, MAX_STRING, "Unknown file extension %s\nExpected .wav, .tga, .bmp, .jpg, .jpeg, or .bvh", ext.c_str()); /* Flawfinder: ignore */ + // *TODO: Translate? + error_message = llformat("Unknown file extension .%s\nExpected .wav, .tga, .bmp, .jpg, .jpeg, or .bvh", exten.c_str()); error = TRUE;; } @@ -748,14 +773,14 @@ void upload_new_resource(const LLString& src_filename, std::string name, } else { - snprintf(error_message, MAX_STRING, "Unable to access output file: %s", filename.c_str()); /* Flawfinder: ignore */ + error_message = llformat( "Unable to access output file: %s", filename.c_str()); error = TRUE; } } if (!error) { - LLString t_disp_name = display_name; + std::string t_disp_name = display_name; if (t_disp_name.empty()) { t_disp_name = src_filename; @@ -767,10 +792,10 @@ void upload_new_resource(const LLString& src_filename, std::string name, else { llwarns << error_message << llendl; - LLStringBase<char>::format_map_t args; + LLStringUtil::format_map_t args; args["[ERROR_MESSAGE]"] = error_message; gViewerWindow->alertXml("ErrorMessage", args); - if(LLFile::remove(filename.c_str()) == -1) + if(LLFile::remove(filename) == -1) { lldebugs << "unable to remove temp file" << llendl; } @@ -799,7 +824,7 @@ void upload_done_callback(const LLUUID& uuid, void* user_data, S32 result, LLExt { LLFloaterBuyCurrency::buyCurrency( llformat("Uploading %s costs", - data->mAssetInfo.getName().c_str()), + data->mAssetInfo.getName().c_str()), // *TODO: Translate upload_cost); is_balance_sufficient = FALSE; } @@ -852,9 +877,9 @@ void upload_done_callback(const LLUUID& uuid, void* user_data, S32 result, LLExt } else // if(result >= 0) { - LLStringBase<char>::format_map_t args; + LLStringUtil::format_map_t args; args["[FILE]"] = LLInventoryType::lookupHumanReadable(data->mInventoryType); - args["[REASON]"] = LLString(LLAssetStorage::getErrorString(result)); + args["[REASON]"] = std::string(LLAssetStorage::getErrorString(result)); gViewerWindow->alertXml("CannotUploadReason", args); } @@ -864,27 +889,14 @@ void upload_done_callback(const LLUUID& uuid, void* user_data, S32 result, LLExt // *NOTE: This is a pretty big hack. What this does is check the // file picker if there are any more pending uploads. If so, // upload that file. - const char* next_file = LLFilePicker::instance().getNextFile(); - if(is_balance_sufficient && next_file) + const std::string& next_file = LLFilePicker::instance().getNextFile(); + if(is_balance_sufficient && !next_file.empty()) { - const char* name = LLFilePicker::instance().getDirname(); - - LLString asset_name = name; - LLString::replaceNonstandardASCII( asset_name, '?' ); - LLString::replaceChar(asset_name, '|', '?'); - LLString::stripNonprintable(asset_name); - LLString::trim(asset_name); - - char* asset_name_str = (char*)asset_name.c_str(); - char* end_p = strrchr(asset_name_str, '.'); // strip extension if exists - if( !end_p ) - { - end_p = asset_name_str + strlen( asset_name_str ); /* Flawfinder: ignore */ - } - - S32 len = llmin( (S32) (DB_INV_ITEM_NAME_STR_LEN), (S32) (end_p - asset_name_str) ); - - asset_name = asset_name.substr( 0, len ); + std::string asset_name = gDirUtilp->getBaseFileName(next_file, true); + LLStringUtil::replaceNonstandardASCII( asset_name, '?' ); + LLStringUtil::replaceChar(asset_name, '|', '?'); + LLStringUtil::stripNonprintable(asset_name); + LLStringUtil::trim(asset_name); upload_new_resource(next_file, asset_name, asset_name, // file 0, LLAssetType::AT_NONE, LLInventoryType::IT_NONE); @@ -897,7 +909,7 @@ void upload_new_resource(const LLTransactionID &tid, LLAssetType::EType asset_ty LLAssetType::EType destination_folder_type, LLInventoryType::EType inv_type, U32 next_owner_perm, - const LLString& display_name, + const std::string& display_name, LLAssetStorage::LLStoreAssetCallback callback, void *userdata) { @@ -922,8 +934,8 @@ void upload_new_resource(const LLTransactionID &tid, LLAssetType::EType asset_ty { inv_type = LLInventoryType::defaultForAssetType(asset_type); } - LLString::stripNonprintable(name); - LLString::stripNonprintable(desc); + LLStringUtil::stripNonprintable(name); + LLStringUtil::stripNonprintable(desc); if(name.empty()) { name = "(No Name)"; @@ -934,7 +946,7 @@ void upload_new_resource(const LLTransactionID &tid, LLAssetType::EType asset_ty } // At this point, we're ready for the upload. - LLString upload_message = "Uploading...\n\n"; + std::string upload_message = "Uploading...\n\n"; upload_message.append(display_name); LLUploadDialog::modalUploadDialog(upload_message); diff --git a/indra/newview/llviewermenufile.h b/indra/newview/llviewermenufile.h index 46255da022..f43e5bfc92 100644 --- a/indra/newview/llviewermenufile.h +++ b/indra/newview/llviewermenufile.h @@ -40,12 +40,12 @@ class LLTransactionID; void init_menu_file(); -void upload_new_resource(const LLString& src_filename, std::string name, +void upload_new_resource(const std::string& src_filename, std::string name, std::string desc, S32 compression_info, LLAssetType::EType destination_folder_type, LLInventoryType::EType inv_type, U32 next_owner_perm = 0x0, // PERM_NONE - const LLString& display_name = LLString::null, + const std::string& display_name = LLStringUtil::null, LLAssetStorage::LLStoreAssetCallback callback = NULL, void *userdata = NULL); @@ -55,7 +55,7 @@ void upload_new_resource(const LLTransactionID &tid, LLAssetType::EType type, LLAssetType::EType destination_folder_type, LLInventoryType::EType inv_type, U32 next_owner_perm = 0x0, // PERM_NONE - const LLString& display_name = LLString::null, + const std::string& display_name = LLStringUtil::null, LLAssetStorage::LLStoreAssetCallback callback = NULL, void *userdata = NULL); diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 4c8e75016c..114707791b 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -159,6 +159,9 @@ extern BOOL gDebugClicks; void open_offer(const std::vector<LLUUID>& items, const std::string& from_name); void friendship_offer_callback(S32 option, void* user_data); bool check_offer_throttle(const std::string& from_name, bool check_only); +void callbackCacheEstateOwnerName(const LLUUID& id, + const std::string& first, const std::string& last, + BOOL is_group, void*); //inventory offer throttle globals LLFrameTimer gThrottleTimer; @@ -166,7 +169,7 @@ const U32 OFFER_THROTTLE_MAX_COUNT=5; //number of items per time period const F32 OFFER_THROTTLE_TIME=10.f; //time period in seconds //script permissions -const LLString SCRIPT_QUESTIONS[SCRIPT_PERMISSION_EOF] = +const std::string SCRIPT_QUESTIONS[SCRIPT_PERMISSION_EOF] = { "ScriptTakeMoney", "ActOnControlInputs", @@ -198,7 +201,7 @@ struct LLFriendshipOffer // void give_money(const LLUUID& uuid, LLViewerRegion* region, S32 amount, BOOL is_group, - S32 trx_type, const LLString& desc) + S32 trx_type, const std::string& desc) { if(0 == amount) return; amount = abs(amount); @@ -219,7 +222,7 @@ void give_money(const LLUUID& uuid, LLViewerRegion* region, S32 amount, BOOL is_ msg->addU8Fast(_PREHASH_AggregatePermNextOwner, (U8)LLAggregatePermissions::AP_EMPTY); msg->addU8Fast(_PREHASH_AggregatePermInventory, (U8)LLAggregatePermissions::AP_EMPTY); msg->addS32Fast(_PREHASH_TransactionType, trx_type ); - msg->addStringFast(_PREHASH_Description, desc.c_str()); + msg->addStringFast(_PREHASH_Description, desc); msg->sendReliable(region->getHost()); } else @@ -324,194 +327,191 @@ void process_layer_data(LLMessageSystem *mesgsys, void **user_data) } } -S32 exported_object_count = 0; -S32 exported_image_count = 0; -S32 current_object_count = 0; -S32 current_image_count = 0; - -extern LLNotifyBox *gExporterNotify; -extern LLUUID gExporterRequestID; -extern LLString gExportDirectory; - -extern LLUploadDialog *gExportDialog; - -LLString gExportedFile; - -std::map<LLUUID, LLString> gImageChecksums; - -void export_complete() -{ - LLUploadDialog::modalUploadFinished(); - gExporterRequestID.setNull(); - gExportDirectory = ""; - - LLFILE* fXML = LLFile::fopen(gExportedFile.c_str(), "rb"); /* Flawfinder: ignore */ - fseek(fXML, 0, SEEK_END); - long length = ftell(fXML); - fseek(fXML, 0, SEEK_SET); - U8 *buffer = new U8[length + 1]; - size_t nread = fread(buffer, 1, length, fXML); - if (nread < (size_t) length) - { - LL_WARNS("Messaging") << "Short read" << LL_ENDL; - } - buffer[nread] = '\0'; - fclose(fXML); - - char *pos = (char *)buffer; - while ((pos = strstr(pos+1, "<sl:image ")) != 0) - { - char *pos_check = strstr(pos, "checksum=\""); - - if (pos_check) - { - char *pos_uuid = strstr(pos_check, "\">"); - - if (pos_uuid) - { - char image_uuid_str[UUID_STR_SIZE]; /* Flawfinder: ignore */ - memcpy(image_uuid_str, pos_uuid+2, UUID_STR_SIZE-1); /* Flawfinder: ignore */ - image_uuid_str[UUID_STR_SIZE-1] = 0; +// S32 exported_object_count = 0; +// S32 exported_image_count = 0; +// S32 current_object_count = 0; +// S32 current_image_count = 0; + +// extern LLNotifyBox *gExporterNotify; +// extern LLUUID gExporterRequestID; +// extern std::string gExportDirectory; + +// extern LLUploadDialog *gExportDialog; + +// std::string gExportedFile; + +// std::map<LLUUID, std::string> gImageChecksums; + +// void export_complete() +// { +// LLUploadDialog::modalUploadFinished(); +// gExporterRequestID.setNull(); +// gExportDirectory = ""; + +// LLFILE* fXML = LLFile::fopen(gExportedFile, "rb"); /* Flawfinder: ignore */ +// fseek(fXML, 0, SEEK_END); +// long length = ftell(fXML); +// fseek(fXML, 0, SEEK_SET); +// U8 *buffer = new U8[length + 1]; +// size_t nread = fread(buffer, 1, length, fXML); +// if (nread < (size_t) length) +// { +// llwarns << "Short read" << llendl; +// } +// buffer[nread] = '\0'; +// fclose(fXML); + +// char *pos = (char *)buffer; +// while ((pos = strstr(pos+1, "<sl:image ")) != 0) +// { +// char *pos_check = strstr(pos, "checksum=\""); + +// if (pos_check) +// { +// char *pos_uuid = strstr(pos_check, "\">"); + +// if (pos_uuid) +// { +// char image_uuid_str[UUID_STR_SIZE]; /* Flawfinder: ignore */ +// memcpy(image_uuid_str, pos_uuid+2, UUID_STR_SIZE-1); /* Flawfinder: ignore */ +// image_uuid_str[UUID_STR_SIZE-1] = 0; - LLUUID image_uuid(image_uuid_str); - - LL_INFOS("Messaging") << "Found UUID: " << image_uuid << LL_ENDL; - - std::map<LLUUID, LLString>::iterator itor = gImageChecksums.find(image_uuid); - if (itor != gImageChecksums.end()) - { - LL_INFOS("Messaging") << "Replacing with checksum: " << itor->second << LL_ENDL; - if (itor->second.c_str() != NULL) - { - memcpy(&pos_check[10], itor->second.c_str(), 32); /* Flawfinder: ignore */ - } - } - } - } - } - - LLFILE* fXMLOut = LLFile::fopen(gExportedFile.c_str(), "wb"); /* Flawfinder: ignore */ - if (fwrite(buffer, 1, length, fXMLOut) != length) - { - LL_WARNS("Messaging") << "Short write" << LL_ENDL; - } - fclose(fXMLOut); - - delete [] buffer; -} - - -void exported_item_complete(const LLTSCode status, void *user_data) -{ - //LLString *filename = (LLString *)user_data; - - if (status < LLTS_OK) - { - LL_WARNS("Messaging") << "Export failed!" << LL_ENDL; - } - else - { - ++current_object_count; - if (current_image_count == exported_image_count && current_object_count == exported_object_count) - { - LL_INFOS("Messaging") << "*** Export complete ***" << LL_ENDL; - - export_complete(); - } - else - { - gExportDialog->setMessage(llformat("Exported %d/%d object files, %d/%d textures.", current_object_count, exported_object_count, current_image_count, exported_image_count)); - } - } -} - -struct exported_image_info -{ - LLUUID image_id; - LLString filename; - U32 image_num; -}; - -void exported_j2c_complete(const LLTSCode status, void *user_data) -{ - exported_image_info *info = (exported_image_info *)user_data; - LLUUID image_id = info->image_id; - U32 image_num = info->image_num; - LLString filename = info->filename; - delete info; - - if (status < LLTS_OK) - { - LL_WARNS("Messaging") << "Image download failed!" << LL_ENDL; - } - else - { - LLFILE* fIn = LLFile::fopen(filename.c_str(), "rb"); /* Flawfinder: ignore */ - if (fIn) - { - LLPointer<LLImageJ2C> ImageUtility = new LLImageJ2C; - LLPointer<LLImageTGA> TargaUtility = new LLImageTGA; - - fseek(fIn, 0, SEEK_END); - S32 length = ftell(fIn); - fseek(fIn, 0, SEEK_SET); - U8 *buffer = ImageUtility->allocateData(length); - if (fread(buffer, 1, length, fIn) != length) - { - LL_WARNS("Messaging") << "Short read" << LL_ENDL; - } - fclose(fIn); - LLFile::remove(filename.c_str()); - - // Convert to TGA - LLPointer<LLImageRaw> image = new LLImageRaw(); - - ImageUtility->updateData(); - ImageUtility->decode(image, 100000.0f); +// LLUUID image_uuid(image_uuid_str); + +// LL_INFOS("Messaging") << "Found UUID: " << image_uuid << LL_ENDL; + +// std::map<LLUUID, std::string>::iterator itor = gImageChecksums.find(image_uuid); +// if (itor != gImageChecksums.end()) +// { +// LL_INFOS("Messaging") << "Replacing with checksum: " << itor->second << LL_ENDL; +// if (!itor->second.empty()) +// { +// memcpy(&pos_check[10], itor->second.c_str(), 32); /* Flawfinder: ignore */ +// } +// } +// } +// } +// } + +// LLFILE* fXMLOut = LLFile::fopen(gExportedFile, "wb"); /* Flawfinder: ignore */ +// if (fwrite(buffer, 1, length, fXMLOut) != length) +// { +// LL_WARNS("Messaging") << "Short write" << LL_ENDL; +// } +// fclose(fXMLOut); + +// delete [] buffer; +// } + + +// void exported_item_complete(const LLTSCode status, void *user_data) +// { +// //std::string *filename = (std::string *)user_data; + +// if (status < LLTS_OK) +// { +// LL_WARNS("Messaging") << "Export failed!" << LL_ENDL; +// } +// else +// { +// ++current_object_count; +// if (current_image_count == exported_image_count && current_object_count == exported_object_count) +// { +// LL_INFOS("Messaging") << "*** Export complete ***" << LL_ENDL; + +// export_complete(); +// } +// else +// { +// gExportDialog->setMessage(llformat("Exported %d/%d object files, %d/%d textures.", current_object_count, exported_object_count, current_image_count, exported_image_count)); +// } +// } +// } + +// struct exported_image_info +// { +// LLUUID image_id; +// std::string filename; +// U32 image_num; +// }; + +// void exported_j2c_complete(const LLTSCode status, void *user_data) +// { +// exported_image_info *info = (exported_image_info *)user_data; +// LLUUID image_id = info->image_id; +// U32 image_num = info->image_num; +// std::string filename = info->filename; +// delete info; + +// if (status < LLTS_OK) +// { +// LL_WARNS("Messaging") << "Image download failed!" << LL_ENDL; +// } +// else +// { +// LLFILE* fIn = LLFile::fopen(filename, "rb"); /* Flawfinder: ignore */ +// if (fIn) +// { +// LLPointer<LLImageJ2C> ImageUtility = new LLImageJ2C; +// LLPointer<LLImageTGA> TargaUtility = new LLImageTGA; + +// fseek(fIn, 0, SEEK_END); +// S32 length = ftell(fIn); +// fseek(fIn, 0, SEEK_SET); +// U8 *buffer = ImageUtility->allocateData(length); +// if (fread(buffer, 1, length, fIn) != length) +// { +// LL_WARNS("Messaging") << "Short read" << LL_ENDL; +// } +// fclose(fIn); +// LLFile::remove(filename); + +// // Convert to TGA +// LLPointer<LLImageRaw> image = new LLImageRaw(); + +// ImageUtility->updateData(); +// ImageUtility->decode(image, 100000.0f); - TargaUtility->encode(image); - U8 *data = TargaUtility->getData(); - S32 data_size = TargaUtility->getDataSize(); - - char *file_path = new char[filename.size()+1]; - strcpy(file_path, filename.c_str()); /* Flawfinder: ignore */ - char *end = strrchr(file_path, gDirUtilp->getDirDelimiter()[0]); - end[0] = 0; - LLString output_file = llformat("%s/image-%03d.tga", file_path, image_num);//filename; - delete [] file_path; - //S32 name_len = output_file.length(); - //strcpy(&output_file[name_len-3], "tga"); - LLFILE* fOut = LLFile::fopen(output_file.c_str(), "wb"); /* Flawfinder: ignore */ - char md5_hash_string[33]; /* Flawfinder: ignore */ - strcpy(md5_hash_string, "00000000000000000000000000000000"); /* Flawfinder: ignore */ - if (fOut) - { - if (fwrite(data, 1, data_size, fOut) != data_size) - { - LL_WARNS("Messaging") << "Short write" << LL_ENDL; - } - fseek(fOut, 0, SEEK_SET); - fclose(fOut); - fOut = LLFile::fopen(output_file.c_str(), "rb"); /* Flawfinder: ignore */ - LLMD5 my_md5_hash(fOut); - my_md5_hash.hex_digest(md5_hash_string); - } - - gImageChecksums.insert(std::pair<LLUUID, LLString>(image_id, md5_hash_string)); - } - } +// TargaUtility->encode(image); +// U8 *data = TargaUtility->getData(); +// S32 data_size = TargaUtility->getDataSize(); - ++current_image_count; - if (current_image_count == exported_image_count && current_object_count == exported_object_count) - { - LL_INFOS("Messaging") << "*** Export textures complete ***" << LL_ENDL; - export_complete(); - } - else - { - gExportDialog->setMessage(llformat("Exported %d/%d object files, %d/%d textures.", current_object_count, exported_object_count, current_image_count, exported_image_count)); - } -} +// std::string file_path = gDirUtilp->getDirName(filename); + +// std::string output_file = llformat("%s/image-%03d.tga", file_path.c_str(), image_num);//filename; +// //S32 name_len = output_file.length(); +// //strcpy(&output_file[name_len-3], "tga"); +// LLFILE* fOut = LLFile::fopen(output_file, "wb"); /* Flawfinder: ignore */ +// char md5_hash_string[33]; /* Flawfinder: ignore */ +// strcpy(md5_hash_string, "00000000000000000000000000000000"); /* Flawfinder: ignore */ +// if (fOut) +// { +// if (fwrite(data, 1, data_size, fOut) != data_size) +// { +// LL_WARNS("Messaging") << "Short write" << LL_ENDL; +// } +// fseek(fOut, 0, SEEK_SET); +// fclose(fOut); +// fOut = LLFile::fopen(output_file, "rb"); /* Flawfinder: ignore */ +// LLMD5 my_md5_hash(fOut); +// my_md5_hash.hex_digest(md5_hash_string); +// } + +// gImageChecksums.insert(std::pair<LLUUID, std::string>(image_id, md5_hash_string)); +// } +// } + +// ++current_image_count; +// if (current_image_count == exported_image_count && current_object_count == exported_object_count) +// { +// LL_INFOS("Messaging") << "*** Export textures complete ***" << LL_ENDL; +// export_complete(); +// } +// else +// { +// gExportDialog->setMessage(llformat("Exported %d/%d object files, %d/%d textures.", current_object_count, exported_object_count, current_image_count, exported_image_count)); +// } +//} void process_derez_ack(LLMessageSystem*, void**) { @@ -581,7 +581,7 @@ void join_group_callback(S32 option, void* user_data) if (option == 2 && data && !data->mGroupID.isNull()) { LLFloaterGroupInfo::showFromUUID(data->mGroupID); - LLString::format_map_t args; + LLStringUtil::format_map_t args; args["[MESSAGE]"] = data->mMessage; LLNotifyBox::showXml("JoinGroup", args, &join_group_callback, data); return; @@ -599,7 +599,7 @@ void join_group_callback(S32 option, void* user_data) else { delete_context_data = FALSE; - LLString::format_map_t args; + LLStringUtil::format_map_t args; args["[NAME]"] = data->mName; args["[INVITE]"] = data->mMessage; LLAlertDialog::showXml("JoinedTooManyGroupsMember", args, join_group_callback, (void*)data); @@ -613,7 +613,7 @@ void join_group_callback(S32 option, void* user_data) if (data->mFee > 0) { delete_context_data = FALSE; - LLString::format_map_t args; + LLStringUtil::format_map_t args; args["[COST]"] = llformat("%d", data->mFee); // Set the fee to 0, so that we don't keep // asking about a fee. @@ -626,8 +626,8 @@ void join_group_callback(S32 option, void* user_data) else { send_improved_im(data->mGroupID, - "name", - "message", + std::string("name"), + std::string("message"), IM_ONLINE, IM_GROUP_INVITATION_ACCEPT, data->mTransactionID); @@ -636,8 +636,8 @@ void join_group_callback(S32 option, void* user_data) else if (data) { send_improved_im(data->mGroupID, - "name", - "message", + std::string("name"), + std::string("message"), IM_ONLINE, IM_GROUP_INVITATION_DECLINE, data->mTransactionID); @@ -754,7 +754,7 @@ bool check_offer_throttle(const std::string& from_name, bool check_only) static U32 throttle_count; static bool throttle_logged; LLChat chat; - LLString log_message; + std::string log_message; if (!gSavedSettings.getBOOL("ShowNewInventory")) return false; @@ -837,13 +837,13 @@ void open_offer(const std::vector<LLUUID>& items, const std::string& from_name) switch(item->getType()) { case LLAssetType::AT_NOTECARD: - open_notecard((LLViewerInventoryItem*)item, LLString("Note: ") + item->getName(), LLUUID::null, show_keep_discard, LLUUID::null, FALSE); + open_notecard((LLViewerInventoryItem*)item, std::string("Note: ") + item->getName(), LLUUID::null, show_keep_discard, LLUUID::null, FALSE); break; case LLAssetType::AT_LANDMARK: - open_landmark((LLViewerInventoryItem*)item, LLString("Landmark: ") + item->getName(), show_keep_discard, LLUUID::null, FALSE); + open_landmark((LLViewerInventoryItem*)item, std::string("Landmark: ") + item->getName(), show_keep_discard, LLUUID::null, FALSE); break; case LLAssetType::AT_TEXTURE: - open_texture(*it, LLString("Texture: ") + item->getName(), show_keep_discard, LLUUID::null, FALSE); + open_texture(*it, std::string("Texture: ") + item->getName(), show_keep_discard, LLUUID::null, FALSE); break; default: break; @@ -890,12 +890,12 @@ void open_offer(const std::vector<LLUUID>& items, const std::string& from_name) } void inventory_offer_mute_callback(const LLUUID& blocked_id, - const char* first_name, - const char* last_name, + const std::string& first_name, + const std::string& last_name, BOOL is_group, void* user_data) { - LLString from_name; + std::string from_name; LLMute::EType type; if (is_group) @@ -906,9 +906,7 @@ void inventory_offer_mute_callback(const LLUUID& blocked_id, else { type = LLMute::AGENT; - from_name += first_name; - from_name += " "; - from_name += last_name; + from_name = first_name + " " + last_name; } LLMute mute(blocked_id, from_name, type); @@ -936,7 +934,7 @@ void inventory_offer_mute_callback(const LLUUID& blocked_id, void inventory_offer_callback(S32 button, void* user_data) { LLChat chat; - LLString log_message; + std::string log_message; LLOfferInfo* info = (LLOfferInfo*)user_data; if(!info) return; @@ -978,8 +976,8 @@ void inventory_offer_callback(S32 button, void* user_data) } // *TODO:translate - LLString from_string; // Used in the pop-up. - LLString chatHistory_string; // Used in chat history. + std::string from_string; // Used in the pop-up. + std::string chatHistory_string; // Used in chat history. if (info->mFromObject == TRUE) { if (info->mFromGroup) @@ -987,12 +985,12 @@ void inventory_offer_callback(S32 button, void* user_data) std::string group_name; if (gCacheName->getGroupName(info->mFromID, group_name)) { - from_string = LLString("An object named '") + info->mFromName + "' owned by the group '" + group_name + "'"; + from_string = std::string("An object named '") + info->mFromName + "' owned by the group '" + group_name + "'"; chatHistory_string = info->mFromName + " owned by the group '" + group_name + "'"; } else { - from_string = LLString("An object named '") + info->mFromName + "' owned by an unknown group"; + from_string = std::string("An object named '") + info->mFromName + "' owned by an unknown group"; chatHistory_string = info->mFromName + " owned by an unknown group"; } } @@ -1001,12 +999,12 @@ void inventory_offer_callback(S32 button, void* user_data) std::string first_name, last_name; if (gCacheName->getName(info->mFromID, first_name, last_name)) { - from_string = LLString("An object named '") + info->mFromName + "' owned by " + first_name + " " + last_name; + from_string = std::string("An object named '") + info->mFromName + "' owned by " + first_name + " " + last_name; chatHistory_string = info->mFromName + " owned by " + first_name + " " + last_name; } else { - from_string = LLString("An object named '") + info->mFromName + "' owned by an unknown user"; + from_string = std::string("An object named '") + info->mFromName + "' owned by an unknown user"; chatHistory_string = info->mFromName + " owned by an unknown user"; } } @@ -1177,7 +1175,7 @@ void inventory_offer_handler(LLOfferInfo* info, BOOL from_task) return; } - LLString::format_map_t args; + LLStringUtil::format_map_t args; args["[OBJECTNAME]"] = info->mDesc; // must protect against a NULL return from lookupHumanReadable() std::string typestr = ll_safe_string(LLAssetType::lookupHumanReadable(info->mType)); @@ -1285,7 +1283,7 @@ void lure_callback(S32 option, void* user_data) default: // decline send_simple_im(info->mFromID, - "", + LLStringUtil::null, IM_LURE_DECLINED, info->mLureID); break; @@ -1317,16 +1315,16 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) U8 d = 0; LLUUID session_id; U32 t; - char name[DB_FULL_NAME_BUF_SIZE]; /* Flawfinder: ignore */ - char message[DB_IM_MSG_BUF_SIZE]; /* Flawfinder: ignore */ + std::string name; + std::string message; U32 parent_estate_id = 0; LLUUID region_id; LLVector3 position; - char buffer[DB_IM_MSG_BUF_SIZE * 2]; /* Flawfinder: ignore */ U8 binary_bucket[MTUBYTES]; S32 binary_bucket_size; LLChat chat; - + std::string buffer; + // *TODO:translate - need to fix the full name to first/last (maybe) msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, from_id); msg->getBOOLFast(_PREHASH_MessageBlock, _PREHASH_FromGroup, from_group); @@ -1336,8 +1334,8 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) msg->getUUIDFast(_PREHASH_MessageBlock, _PREHASH_ID, session_id); msg->getU32Fast( _PREHASH_MessageBlock, _PREHASH_Timestamp, t); //msg->getData("MessageBlock", "Count", &count); - msg->getStringFast(_PREHASH_MessageBlock, _PREHASH_FromAgentName, DB_FULL_NAME_BUF_SIZE, name); - msg->getStringFast(_PREHASH_MessageBlock, _PREHASH_Message, DB_IM_MSG_BUF_SIZE, message); + msg->getStringFast(_PREHASH_MessageBlock, _PREHASH_FromAgentName, name); + msg->getStringFast(_PREHASH_MessageBlock, _PREHASH_Message, message); msg->getU32Fast(_PREHASH_MessageBlock, _PREHASH_ParentEstateID, parent_estate_id); msg->getUUIDFast(_PREHASH_MessageBlock, _PREHASH_RegionID, region_id); msg->getVector3Fast(_PREHASH_MessageBlock, _PREHASH_Position, position); @@ -1354,7 +1352,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) chat.mMuted = is_muted && !is_linden; chat.mFromID = from_id; chat.mFromName = name; - chat.mSourceType = (from_id.isNull() || !strcmp(name, SYSTEM_FROM)) ? CHAT_SOURCE_SYSTEM : CHAT_SOURCE_AGENT; + chat.mSourceType = (from_id.isNull() || (name == std::string(SYSTEM_FROM))) ? CHAT_SOURCE_SYSTEM : CHAT_SOURCE_AGENT; LLViewerObject *source = gObjectList.findObject(session_id); //Session ID is probably the wrong thing. if (source) @@ -1362,17 +1360,18 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) is_owned_by_me = source->permYouOwner(); } - char separator_string[3]=": "; /* Flawfinder: ignore */ - int message_offset=0; + std::string separator_string(": "); + int message_offset = 0; //Handle IRC styled /me messages. - if (!strncmp(message, "/me ", 4) || !strncmp(message, "/me'", 4)) + std::string prefix = message.substr(0, 4); + if (prefix == "/me " || prefix == "/me'") { - strcpy(separator_string,""); /* Flawfinder: ignore */ - message_offset=3; + separator_string = ""; + message_offset = 3; } - LLString::format_map_t args; + LLStringUtil::format_map_t args; switch(dialog) { case IM_CONSOLE_AND_CHAT_HISTORY: @@ -1395,7 +1394,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) // do nothing -- don't distract newbies in // Prelude with global IMs } - else if (offline == IM_ONLINE && !is_linden && is_busy && strcmp(name, SYSTEM_FROM)) + else if (offline == IM_ONLINE && !is_linden && is_busy && name != SYSTEM_FROM) { // return a standard "busy" message, but only do it to online IM // (i.e. not other auto responses and not store-and-forward IM) @@ -1405,15 +1404,15 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) // initiated by the other party) then... std::string my_name; gAgent.buildFullname(my_name); - LLString response = gSavedPerAccountSettings.getText("BusyModeResponse"); + std::string response = gSavedPerAccountSettings.getText("BusyModeResponse"); pack_instant_message( gMessageSystem, gAgent.getID(), FALSE, gAgent.getSessionID(), from_id, - my_name.c_str(), - response.c_str(), + my_name, + response, IM_ONLINE, IM_BUSY_AUTO_RESPONSE, session_id); @@ -1422,7 +1421,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) // now store incoming IM in chat history - snprintf(buffer, sizeof(buffer), "%s%s", separator_string, (message+message_offset)); /* Flawfinder: ignore */ + buffer = name + separator_string + message.substr(message_offset); LL_INFOS("Messaging") << "process_improved_im: session_id( " << session_id << " ), from_id( " << from_id << " )" << LL_ENDL; @@ -1432,7 +1431,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) from_id, name, buffer, - NULL, + LLStringUtil::null, dialog, parent_estate_id, region_id, @@ -1440,16 +1439,14 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) true); // pretend this is chat generated by self, so it does not show up on screen - snprintf(buffer, sizeof(buffer), "IM: %s%s%s", name, separator_string, (message+message_offset)); /* Flawfinder: ignore */ - chat.mText = buffer; + chat.mText = std::string("IM: ") + name + separator_string + message.substr(message_offset); LLFloaterChat::addChat( chat, TRUE, TRUE ); } else if (from_id.isNull()) { // Messages from "Second Life" ID don't go to IM history // messages which should be routed to IM window come from a user ID with name=SYSTEM_NAME - snprintf(buffer, sizeof(buffer), "%s: %s", name, message); /* Flawfinder: ignore */ - chat.mText = buffer; + chat.mText = name + ": " + message; LLFloaterChat::addChat(chat, FALSE, FALSE); } else if (to_id.isNull()) @@ -1462,23 +1459,19 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) // Treat like a system message and put in chat history. // Claim to be from a local agent so it doesn't go into // console. - snprintf(buffer, sizeof(buffer), "%s%s%s", name, separator_string, (message+message_offset)); /* Flawfinder: ignore */ - chat.mText = buffer; + chat.mText = name + separator_string + message.substr(message_offset); BOOL local_agent = TRUE; LLFloaterChat::addChat(chat, FALSE, local_agent); } else { // standard message, not from system - char saved[MAX_STRING]; /* Flawfinder: ignore */ - saved[0] = '\0'; + std::string saved; if(offline == IM_OFFLINE) { - char time_buf[TIME_STR_LENGTH]; /* Flawfinder: ignore */ - snprintf(saved, MAX_STRING, "(Saved %s) ", /* Flawfinder: ignore */ - formatted_time(timestamp, time_buf)); + saved = llformat("(Saved %s) ", formatted_time(timestamp).c_str()); } - snprintf(buffer, sizeof(buffer), "%s%s%s", separator_string, saved,(message+message_offset)); /* Flawfinder: ignore */ + buffer = separator_string + saved + message.substr(message_offset); LL_INFOS("Messaging") << "process_improved_im: session_id( " << session_id << " ), from_id( " << from_id << " )" << LL_ENDL; @@ -1489,15 +1482,14 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) from_id, name, buffer, - NULL, + LLStringUtil::null, dialog, parent_estate_id, region_id, position, true); - snprintf(buffer, sizeof(buffer), "IM: %s%s%s%s", name, separator_string, saved, (message+message_offset)); /* Flawfinder: ignore */ + chat.mText = std::string("IM: ") + name + separator_string + saved + message.substr(message_offset); - chat.mText = buffer; BOOL local_agent = FALSE; LLFloaterChat::addChat( chat, TRUE, local_agent ); } @@ -1565,7 +1557,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) U8 has_inventory = notice_bin_bucket->header.has_inventory; U8 asset_type = notice_bin_bucket->header.asset_type; LLUUID group_id = notice_bin_bucket->header.group_id; - const char* item_name = (const char*) notice_bin_bucket->item_name; + std::string item_name = ll_safe_string((const char*) notice_bin_bucket->item_name); // If there is inventory, give the user the inventory offer. LLOfferInfo* info = NULL; @@ -1597,18 +1589,18 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) tokenizer tokens(str, sep); tokenizer::iterator iter = tokens.begin(); - LLString subj(*iter++); - LLString mes(*iter++); + std::string subj(*iter++); + std::string mes(*iter++); if (IM_GROUP_NOTICE == dialog) { subj += "\n"; mes = "\n\n" + mes; - LLGroupNotifyBox::show(subj.c_str(),mes.c_str(),name,group_id,t,has_inventory,item_name,info); + LLGroupNotifyBox::show(subj,mes,name,group_id,t,has_inventory,item_name,info); } else if (IM_GROUP_NOTICE_REQUESTED == dialog) { - LLFloaterGroupInfo::showNotice(subj.c_str(),mes.c_str(),group_id,has_inventory,item_name,info); + LLFloaterGroupInfo::showNotice(subj,mes,group_id,has_inventory,item_name,info); } } break; @@ -1648,7 +1640,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) userdata->mMessage.assign(message); userdata->mFee = membership_fee; - LLString::format_map_t args; + LLStringUtil::format_map_t args; args["[MESSAGE]"] = message; LLNotifyBox::showXml("JoinGroup", args, &join_group_callback, @@ -1764,17 +1756,12 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) } // standard message, not from system - char saved[MAX_STRING]; /* Flawfinder: ignore */ - saved[0] = '\0'; + std::string saved; if(offline == IM_OFFLINE) { - char time_buf[TIME_STR_LENGTH]; /* Flawfinder: ignore */ - snprintf(saved, /* Flawfinder: ignore */ - MAX_STRING, - "(Saved %s) ", - formatted_time(timestamp, time_buf)); + saved = llformat("(Saved %s) ", formatted_time(timestamp).c_str()); } - snprintf(buffer, sizeof(buffer), "%s%s%s", separator_string, saved, (message+message_offset)); /* Flawfinder: ignore */ + buffer = separator_string + saved + message.substr(message_offset); BOOL is_this_agent = FALSE; if(from_id == gAgentID) { @@ -1785,15 +1772,14 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) from_id, name, buffer, - (char*)binary_bucket, + ll_safe_string((char*)binary_bucket), IM_SESSION_INVITE, parent_estate_id, region_id, position, true); - snprintf(buffer, sizeof(buffer), "IM: %s%s%s%s", name, separator_string, saved, (message+message_offset)); /* Flawfinder: ignore */ - chat.mText = buffer; + chat.mText = std::string("IM: ") + name + separator_string + saved + message.substr(message_offset); LLFloaterChat::addChat(chat, TRUE, is_this_agent); } break; @@ -1803,10 +1789,9 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) { return; } - snprintf(buffer, sizeof(buffer), "%s%s%s", name, separator_string, (message+message_offset)); /* Flawfinder: ignore */ + chat.mText = name + separator_string + message.substr(message_offset); // Note: lie to LLFloaterChat::addChat(), pretending that this is NOT an IM, because // IMs from objcts don't open IM sessions. - chat.mText = buffer; chat.mSourceType = CHAT_SOURCE_OBJECT; LLFloaterChat::addChat(chat, FALSE, FALSE); break; @@ -1831,7 +1816,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) else { // TODO: after LLTrans hits release, get "busy response" into translatable file - snprintf(buffer, sizeof(buffer), "%s (%s): %s", name, "busy response", (message+message_offset)); /* Flawfinder: ignore */ + buffer = llformat("%s (%s): %s", name.c_str(), "busy response", message.substr(message_offset).c_str()); gIMMgr->addMessage(session_id, from_id, name, buffer); } break; @@ -1961,15 +1946,15 @@ void busy_message (LLMessageSystem* msg, LLUUID from_id) { std::string my_name; gAgent.buildFullname(my_name); - LLString response = gSavedPerAccountSettings.getText("BusyModeResponse"); + std::string response = gSavedPerAccountSettings.getText("BusyModeResponse"); pack_instant_message( gMessageSystem, gAgent.getID(), FALSE, gAgent.getSessionID(), from_id, - my_name.c_str(), - response.c_str(), + my_name, + response, IM_ONLINE, IM_BUSY_AUTO_RESPONSE); gAgent.sendReliableMessage(); @@ -2085,7 +2070,7 @@ void process_offer_callingcard(LLMessageSystem* msg, void**) offerdata->mHost = msg->getSender(); LLViewerObject* source = gObjectList.findObject(source_id); - LLString::format_map_t args; + LLStringUtil::format_map_t args; std::string source_name; if(source && source->isAvatar()) { @@ -2138,8 +2123,8 @@ void process_decline_callingcard(LLMessageSystem* msg, void**) void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) { LLChat chat; - char mesg[DB_CHAT_MSG_BUF_SIZE]; /* Flawfinder: ignore */ - char from_name[DB_FULL_NAME_BUF_SIZE]; /* Flawfinder: ignore */ + std::string mesg; + std::string from_name; U8 source_temp; U8 type_temp; U8 audible_temp; @@ -2149,7 +2134,7 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) BOOL is_owned_by_me = FALSE; LLViewerObject* chatter; - msg->getString("ChatData", "FromName", DB_FULL_NAME_BUF_SIZE, from_name); + msg->getString("ChatData", "FromName", from_name); chat.mFromName = from_name; msg->getUUID("ChatData", "SourceID", from_id); @@ -2221,15 +2206,16 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) std::string verb; color.setVec(1.f,1.f,1.f,1.f); - msg->getStringFast(_PREHASH_ChatData, _PREHASH_Message, DB_CHAT_MSG_BUF_SIZE, mesg); + msg->getStringFast(_PREHASH_ChatData, _PREHASH_Message, mesg); BOOL ircstyle = FALSE; // Look for IRC-style emotes here so chatbubbles work - if (!strncmp(mesg, "/me ", 4) || !strncmp(mesg, "/me'", 4)) + std::string prefix = mesg.substr(0, 4); + if (prefix == "/me " || prefix == "/me'") { chat.mText = from_name; - chat.mText += (mesg + 3); + chat.mText += mesg.substr(3); ircstyle = TRUE; } else @@ -2320,7 +2306,7 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) if (is_self) { - chat.mText = "You"; + chat.mText = std::string("You"); } else { @@ -2378,11 +2364,11 @@ void process_teleport_start(LLMessageSystem *msg, void**) if (teleport_flags & TELEPORT_FLAGS_DISABLE_CANCEL) { - gViewerWindow->setProgressCancelButtonVisible(FALSE, ""); + gViewerWindow->setProgressCancelButtonVisible(FALSE); } else { - gViewerWindow->setProgressCancelButtonVisible(TRUE, "Cancel"); + gViewerWindow->setProgressCancelButtonVisible(TRUE, std::string("Cancel")); // *TODO: Translate } // Freeze the UI and show progress bar @@ -2413,19 +2399,19 @@ void process_teleport_progress(LLMessageSystem* msg, void**) msg->getU32("Info", "TeleportFlags", teleport_flags); if (teleport_flags & TELEPORT_FLAGS_DISABLE_CANCEL) { - gViewerWindow->setProgressCancelButtonVisible(FALSE, ""); + gViewerWindow->setProgressCancelButtonVisible(FALSE); } else { - gViewerWindow->setProgressCancelButtonVisible(TRUE, "Cancel"); + gViewerWindow->setProgressCancelButtonVisible(TRUE, std::string("Cancel")); //TODO: Translate } - char buffer[MAX_STRING]; /* Flawfinder: ignore */ - msg->getString("Info", "Message", MAX_STRING, buffer); + std::string buffer; + msg->getString("Info", "Message", buffer); LL_DEBUGS("Messaging") << "teleport progress: " << buffer << LL_ENDL; //Sorta hacky...default to using simulator raw messages //if we don't find the coresponding mapping in our progress mappings - LLString message = buffer; + std::string message = buffer; if (LLAgent::sTeleportProgressMessages.find(buffer) != LLAgent::sTeleportProgressMessages.end() ) @@ -2467,7 +2453,7 @@ public: LLInventoryModel::EXCLUDE_TRASH, is_card); } - LLString::format_map_t args; + LLStringUtil::format_map_t args; if ( land_items.count() > 0 ) { // Show notification that they can now teleport to landmarks. Use a random landmark from the inventory S32 random_land = ll_rand( land_items.count() - 1 ); @@ -2576,9 +2562,8 @@ void process_teleport_finish(LLMessageSystem* msg, void**) msg->getU32Fast(_PREHASH_Info, _PREHASH_TeleportFlags, teleport_flags); - char seedCap[STD_STRING_BUF_SIZE]; /* Flawfinder: ignore */ - msg->getStringFast(_PREHASH_Info, _PREHASH_SeedCapability, - STD_STRING_BUF_SIZE, seedCap); + std::string seedCap; + msg->getStringFast(_PREHASH_Info, _PREHASH_SeedCapability, seedCap); // update home location if we are teleporting out of prelude - specific to teleporting to welcome area if((teleport_flags & TELEPORT_FLAGS_SET_HOME_TO_TARGET) @@ -2631,7 +2616,7 @@ void process_teleport_finish(LLMessageSystem* msg, void**) gAgent.setTeleportState( LLAgent::TELEPORT_MOVING ); gAgent.setTeleportMessage(LLAgent::sTeleportProgressMessages["contacting"]); - regionp->setSeedCapability(std::string(seedCap)); + regionp->setSeedCapability(seedCap); // Don't send camera updates to the new region until we're // actually there... @@ -2666,7 +2651,7 @@ void process_avatar_init_complete(LLMessageSystem* msg, void**) static void display_release_message(S32, void* data) { std::string* msg = (std::string*)data; - LLFloaterReleaseMsg::displayMessage(msg->c_str()); + LLFloaterReleaseMsg::displayMessage(*msg); delete msg; } @@ -2696,8 +2681,8 @@ void process_agent_movement_complete(LLMessageSystem* msg, void**) U64 region_handle; msg->getU64Fast(_PREHASH_Data, _PREHASH_RegionHandle, region_handle); - char version_channel_char[MAX_STRING]; - msg->getString("SimData", "ChannelVersion", MAX_STRING, version_channel_char); + std::string version_channel; + msg->getString("SimData", "ChannelVersion", version_channel); LLVOAvatar* avatarp = gAgent.getAvatarObject(); if (!avatarp) @@ -2832,9 +2817,9 @@ void process_agent_movement_complete(LLMessageSystem* msg, void**) // send walk-vs-run status gAgent.sendWalkRun(gAgent.getRunning() || gAgent.getAlwaysRun()); - if (LLFloaterReleaseMsg::checkVersion(version_channel_char)) + if (LLFloaterReleaseMsg::checkVersion(version_channel)) { - LLNotifyBox::showXml("ServerVersionChanged", display_release_message, new std::string(version_channel_char) ); + LLNotifyBox::showXml("ServerVersionChanged", display_release_message, new std::string(version_channel) ); } } @@ -2860,13 +2845,13 @@ void process_crossed_region(LLMessageSystem* msg, void**) U64 region_handle; msg->getU64Fast(_PREHASH_RegionData, _PREHASH_RegionHandle, region_handle); - char seedCap[STD_STRING_BUF_SIZE]; /* Flawfinder: ignore */ - msg->getStringFast(_PREHASH_RegionData, _PREHASH_SeedCapability, STD_STRING_BUF_SIZE, seedCap); + std::string seedCap; + msg->getStringFast(_PREHASH_RegionData, _PREHASH_SeedCapability, seedCap); send_complete_agent_movement(sim_host); LLViewerRegion* regionp = LLWorld::getInstance()->addRegion(region_handle, sim_host); - regionp->setSeedCapability(std::string(seedCap)); + regionp->setSeedCapability(seedCap); } @@ -3858,7 +3843,7 @@ void process_set_follow_cam_properties(LLMessageSystem *mesgsys, void **user_dat // Culled from newsim lltask.cpp void process_name_value(LLMessageSystem *mesgsys, void **user_data) { - char temp_str[NAME_VALUE_BUF_SIZE]; /* Flawfinder: ignore */ + std::string temp_str; LLUUID id; S32 i, num_blocks; @@ -3871,7 +3856,7 @@ void process_name_value(LLMessageSystem *mesgsys, void **user_data) num_blocks = mesgsys->getNumberOfBlocksFast(_PREHASH_NameValueData); for (i = 0; i < num_blocks; i++) { - mesgsys->getStringFast(_PREHASH_NameValueData, _PREHASH_NVPair, NAME_VALUE_BUF_SIZE, temp_str, i); + mesgsys->getStringFast(_PREHASH_NameValueData, _PREHASH_NVPair, temp_str, i); LL_INFOS("Messaging") << "Added to object Name Value: " << temp_str << LL_ENDL; object->addNVPair(temp_str); } @@ -3884,7 +3869,7 @@ void process_name_value(LLMessageSystem *mesgsys, void **user_data) void process_remove_name_value(LLMessageSystem *mesgsys, void **user_data) { - char temp_str[NAME_VALUE_BUF_SIZE]; /* Flawfinder: ignore */ + std::string temp_str; LLUUID id; S32 i, num_blocks; @@ -3897,7 +3882,7 @@ void process_remove_name_value(LLMessageSystem *mesgsys, void **user_data) num_blocks = mesgsys->getNumberOfBlocksFast(_PREHASH_NameValueData); for (i = 0; i < num_blocks; i++) { - mesgsys->getStringFast(_PREHASH_NameValueData, _PREHASH_NVPair, NAME_VALUE_BUF_SIZE, temp_str, i); + mesgsys->getStringFast(_PREHASH_NameValueData, _PREHASH_NVPair, temp_str, i); LL_INFOS("Messaging") << "Removed from object Name Value: " << temp_str << LL_ENDL; object->removeNVPair(temp_str); } @@ -3910,10 +3895,9 @@ void process_remove_name_value(LLMessageSystem *mesgsys, void **user_data) void process_kick_user(LLMessageSystem *msg, void** /*user_data*/) { - char message[2048]; /* Flawfinder: ignore */ - message[0] = '\0'; + std::string message; - msg->getStringFast(_PREHASH_UserInfo, _PREHASH_Reason, 2048, message); + msg->getStringFast(_PREHASH_UserInfo, _PREHASH_Reason, message); LLAppViewer::instance()->forceDisconnect(message); } @@ -3978,12 +3962,12 @@ void process_money_balance_reply( LLMessageSystem* msg, void** ) S32 balance = 0; S32 credit = 0; S32 committed = 0; - char desc[STD_STRING_BUF_SIZE] = ""; /* Flawfinder: ignore */ + std::string desc; msg->getS32("MoneyData", "MoneyBalance", balance); msg->getS32("MoneyData", "SquareMetersCredit", credit); msg->getS32("MoneyData", "SquareMetersCommitted", committed); - msg->getStringFast(_PREHASH_MoneyData, _PREHASH_Description, STD_STRING_BUF_SIZE, desc); + msg->getStringFast(_PREHASH_MoneyData, _PREHASH_Description, desc); LL_INFOS("Messaging") << "L$, credit, committed: " << balance << " " << credit << " " << committed << LL_ENDL; @@ -4013,13 +3997,13 @@ void process_money_balance_reply( LLMessageSystem* msg, void** ) LLUUID tid; msg->getUUID("MoneyData", "TransactionID", tid); static std::deque<LLUUID> recent; - if(desc[0] && gSavedSettings.getBOOL("NotifyMoneyChange") + if(!desc.empty() && gSavedSettings.getBOOL("NotifyMoneyChange") && (std::find(recent.rbegin(), recent.rend(), tid) == recent.rend())) { // Make the user confirm the transaction, since they might // have missed something during an event. // *TODO:translate - LLString::format_map_t args; + LLStringUtil::format_map_t args; args["[MESSAGE]"] = desc; LLNotifyBox::showXml("SystemMessage", args); @@ -4039,8 +4023,8 @@ void process_money_balance_reply( LLMessageSystem* msg, void** ) void process_agent_alert_message(LLMessageSystem* msgsystem, void** user_data) { - char buffer[MAX_STRING]; /* Flawfinder: ignore */ - msgsystem->getStringFast(_PREHASH_AlertData, _PREHASH_Message, MAX_STRING, buffer); + std::string buffer; + msgsystem->getStringFast(_PREHASH_AlertData, _PREHASH_Message, buffer); BOOL modal = FALSE; msgsystem->getBOOL("AlertData", "Modal", modal); process_alert_core(buffer, modal); @@ -4048,8 +4032,8 @@ void process_agent_alert_message(LLMessageSystem* msgsystem, void** user_data) void process_alert_message(LLMessageSystem *msgsystem, void **user_data) { - char buffer[MAX_STRING]; /* Flawfinder: ignore */ - msgsystem->getStringFast(_PREHASH_AlertData, _PREHASH_Message, MAX_STRING, buffer); + std::string buffer; + msgsystem->getStringFast(_PREHASH_AlertData, _PREHASH_Message, buffer); BOOL modal = FALSE; process_alert_core(buffer, modal); } @@ -4068,7 +4052,7 @@ void process_alert_core(const std::string& message, BOOL modal) else if( message == "Home position set." ) { // save the home location image to disk - LLString snap_filename = gDirUtilp->getLindenUserDir(); + std::string snap_filename = gDirUtilp->getLindenUserDir(); snap_filename += gDirUtilp->getDirDelimiter(); snap_filename += SCREEN_HOME_FILENAME; gViewerWindow->saveSnapshot(snap_filename, gViewerWindow->getWindowDisplayWidth(), gViewerWindow->getWindowDisplayHeight(), FALSE, FALSE); @@ -4093,19 +4077,19 @@ void process_alert_core(const std::string& message, BOOL modal) else if (message[0] == '/') { // System message is important, show in upper-right box not tip - LLString text(message.substr(1)); - LLString::format_map_t args; + std::string text(message.substr(1)); + LLStringUtil::format_map_t args; if (text.substr(0,17) == "RESTART_X_MINUTES") { S32 mins = 0; - LLString::convertToS32(text.substr(18), mins); + LLStringUtil::convertToS32(text.substr(18), mins); args["[MINUTES]"] = llformat("%d",mins); LLNotifyBox::showXml("RegionRestartMinutes", args); } else if (text.substr(0,17) == "RESTART_X_SECONDS") { S32 secs = 0; - LLString::convertToS32(text.substr(18), secs); + LLStringUtil::convertToS32(text.substr(18), secs); args["[SECONDS]"] = llformat("%d",secs); LLNotifyBox::showXml("RegionRestartSeconds", args); } @@ -4119,14 +4103,14 @@ void process_alert_core(const std::string& message, BOOL modal) else if (modal) { // *TODO:translate - LLString::format_map_t args; + LLStringUtil::format_map_t args; args["[ERROR_MESSAGE]"] = message; gViewerWindow->alertXml("ErrorMessage", args); } else { // *TODO:translate - LLString::format_map_t args; + LLStringUtil::format_map_t args; args["[MESSAGE]"] = message; LLNotifyBox::showXml("SystemMessageTip", args); } @@ -4145,7 +4129,7 @@ void handle_show_mean_events(void *) LLFloaterBump::show(NULL); } -void mean_name_callback(const LLUUID &id, const char *first, const char *last, BOOL always_false, void* data) +void mean_name_callback(const LLUUID &id, const std::string& first, const std::string& last, BOOL always_false, void* data) { if (gNoRender) { @@ -4167,10 +4151,8 @@ void mean_name_callback(const LLUUID &id, const char *first, const char *last, B LLMeanCollisionData *mcd = *iter; if (mcd->mPerp == id) { - strncpy(mcd->mFirstName, first, DB_FIRST_NAME_BUF_SIZE -1); /* Flawfinder: ignore */ - mcd->mFirstName[DB_FIRST_NAME_BUF_SIZE -1] = '\0'; - strncpy(mcd->mLastName, last, DB_LAST_NAME_BUF_SIZE -1); /* Flawfinder: ignore */ - mcd->mLastName[DB_LAST_NAME_BUF_SIZE -1] = '\0'; + mcd->mFirstName = first; + mcd->mLastName = last; } } } @@ -4265,7 +4247,7 @@ void process_economy_data(LLMessageSystem *msg, void** /*user_data*/) class LLScriptQuestionCBData { public: - LLScriptQuestionCBData(const LLUUID &taskid, const LLUUID &itemid, const LLHost &sender, S32 questions, const char *object_name, const char *owner_name) + LLScriptQuestionCBData(const LLUUID &taskid, const LLUUID &itemid, const LLHost &sender, S32 questions, const std::string& object_name, const std::string& owner_name) : mTaskID(taskid), mItemID(itemid), mSender(sender), mQuestions(questions), mObjectName(object_name), mOwnerName(owner_name) { } @@ -4274,8 +4256,8 @@ public: LLUUID mItemID; LLHost mSender; S32 mQuestions; - LLString mObjectName; - LLString mOwnerName; + std::string mObjectName; + std::string mOwnerName; }; void notify_cautioned_script_question(LLScriptQuestionCBData* cbdata, S32 orig_questions, BOOL granted) @@ -4310,7 +4292,7 @@ void notify_cautioned_script_question(LLScriptQuestionCBData* cbdata, S32 orig_q { // got the region, so include the region and 3d coordinates of the object notice.setArg("[REGIONNAME]", viewregion->getName()); - LLString formatpos = llformat("%.1f, %.1f,%.1f", objpos[VX], objpos[VY], objpos[VZ]); + std::string formatpos = llformat("%.1f, %.1f,%.1f", objpos[VX], objpos[VY], objpos[VZ]); notice.setArg("[REGIONPOS]", formatpos); foundpos = TRUE; @@ -4328,7 +4310,7 @@ void notify_cautioned_script_question(LLScriptQuestionCBData* cbdata, S32 orig_q // permission that has been flagged as a caution permission BOOL caution = FALSE; S32 count = 0; - LLString perms; + std::string perms; for (S32 i = 0; i < SCRIPT_PERMISSION_EOF; i++) { if ((orig_questions & LSCRIPTRunTimePermissionBits[i]) && LLNotifyBox::getTemplateIsCaution(SCRIPT_QUESTIONS[i])) @@ -4455,26 +4437,25 @@ void process_script_question(LLMessageSystem *msg, void **user_data) LLUUID taskid; LLUUID itemid; S32 questions; - char object_name[255]; /* Flawfinder: ignore */ - char owner_name[DB_FULL_NAME_BUF_SIZE]; /* Flawfinder: ignore */ + std::string object_name; + std::string owner_name; // taskid -> object key of object requesting permissions msg->getUUIDFast(_PREHASH_Data, _PREHASH_TaskID, taskid ); // itemid -> script asset key of script requesting permissions msg->getUUIDFast(_PREHASH_Data, _PREHASH_ItemID, itemid ); - msg->getStringFast(_PREHASH_Data, _PREHASH_ObjectName, 255, object_name); - msg->getStringFast(_PREHASH_Data, _PREHASH_ObjectOwner, DB_FULL_NAME_BUF_SIZE, owner_name); + msg->getStringFast(_PREHASH_Data, _PREHASH_ObjectName, object_name); + msg->getStringFast(_PREHASH_Data, _PREHASH_ObjectOwner, owner_name); msg->getS32Fast(_PREHASH_Data, _PREHASH_Questions, questions ); // don't display permission requests if this object is muted - JS. if (LLMuteList::getInstance()->isMuted(taskid)) return; // throttle excessive requests from any specific user's scripts - LLString throttle_owner_name = owner_name; - typedef LLKeyThrottle<LLString> LLStringThrottle; + typedef LLKeyThrottle<std::string> LLStringThrottle; static LLStringThrottle question_throttle( LLREQUEST_PERMISSION_THROTTLE_LIMIT, LLREQUEST_PERMISSION_THROTTLE_INTERVAL ); - switch (question_throttle.noteAction(throttle_owner_name)) + switch (question_throttle.noteAction(owner_name)) { case LLStringThrottle::THROTTLE_NEWLY_BLOCKED: LL_INFOS("Messaging") << "process_script_question throttled" @@ -4490,12 +4471,12 @@ void process_script_question(LLMessageSystem *msg, void **user_data) break; } - LLString script_question; + std::string script_question; if (questions) { BOOL caution = FALSE; S32 count = 0; - LLString::format_map_t args; + LLStringUtil::format_map_t args; args["[OBJECTNAME]"] = object_name; args["[NAME]"] = owner_name; @@ -4563,7 +4544,7 @@ void container_inventory_arrived(LLViewerObject* object, LLUUID cat_id; cat_id = gInventory.createNewCategory(gAgent.getInventoryRootID(), LLAssetType::AT_NONE, - "Acquired Items"); + std::string("Acquired Items")); //TODO: Translate InventoryObjectList::const_iterator it = inventory->begin(); InventoryObjectList::const_iterator end = inventory->end(); @@ -4654,24 +4635,23 @@ void container_inventory_arrived(LLViewerObject* object, } } -// method to format the time. Buffer should be at least -// TIME_STR_LENGTH long, and the function returns buffer (for use in -// sprintf and the like) -char* formatted_time(const time_t& the_time, char* buffer) +// method to format the time. +std::string formatted_time(const time_t& the_time) { - LLString::copy(buffer, ctime(&the_time), TIME_STR_LENGTH); + char buffer[30]; /* Flawfinder: ignore */ + LLStringUtil::copy(buffer, ctime(&the_time), 30); buffer[24] = '\0'; - return buffer; + return std::string(buffer); } void process_teleport_failed(LLMessageSystem *msg, void**) { - char reason[STD_STRING_BUF_SIZE]; /* Flawfinder: ignore */ - msg->getStringFast(_PREHASH_Info, _PREHASH_Reason, STD_STRING_BUF_SIZE, reason); + std::string reason; + msg->getStringFast(_PREHASH_Info, _PREHASH_Reason, reason); - LLStringBase<char>::format_map_t args; - LLString big_reason = LLAgent::sTeleportErrorMessages[reason]; + LLStringUtil::format_map_t args; + std::string big_reason = LLAgent::sTeleportErrorMessages[reason]; if ( big_reason.size() > 0 ) { // Substitute verbose reason from the local map args["[REASON]"] = big_reason; @@ -4735,14 +4715,14 @@ void process_teleport_local(LLMessageSystem *msg,void**) } void send_simple_im(const LLUUID& to_id, - const char* message, + const std::string& message, EInstantMessage dialog, const LLUUID& id) { std::string my_name; gAgent.buildFullname(my_name); send_improved_im(to_id, - my_name.c_str(), + my_name, message, IM_ONLINE, dialog, @@ -4753,8 +4733,8 @@ void send_simple_im(const LLUUID& to_id, } void send_group_notice(const LLUUID& group_id, - const char* subject, - const char* message, + const std::string& subject, + const std::string& message, const LLInventoryItem* item) { // Put this notice into an instant message form. @@ -4793,8 +4773,8 @@ void send_group_notice(const LLUUID& group_id, send_improved_im( group_id, - my_name.c_str(), - subject_and_message.str().c_str(), + my_name, + subject_and_message.str(), IM_ONLINE, IM_GROUP_NOTICE, LLUUID::null, @@ -4803,7 +4783,7 @@ void send_group_notice(const LLUUID& group_id, bin_bucket_size); } -void handle_lure_callback(S32 option, const LLString& text, void* userdata) +void handle_lure_callback(S32 option, const std::string& text, void* userdata) { LLDynamicArray<LLUUID>* invitees = (LLDynamicArray<LLUUID>*)userdata; @@ -4816,7 +4796,7 @@ void handle_lure_callback(S32 option, const LLString& text, void* userdata) msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->nextBlockFast(_PREHASH_Info); msg->addU8Fast(_PREHASH_LureType, (U8)0); // sim will fill this in. - msg->addStringFast(_PREHASH_Message, text.c_str()); + msg->addStringFast(_PREHASH_Message, text); for(LLDynamicArray<LLUUID>::iterator itr = invitees->begin(); itr != invitees->end(); ++itr) { msg->nextBlockFast(_PREHASH_TargetData); @@ -4831,7 +4811,7 @@ void handle_lure_callback(S32 option, const LLString& text, void* userdata) void handle_lure_callback_godlike(S32 option, void* userdata) { - handle_lure_callback(option, LLString::null, userdata); + handle_lure_callback(option, LLStringUtil::null, userdata); } void handle_lure(const LLUUID& invitee) @@ -4846,7 +4826,7 @@ void handle_lure(LLDynamicArray<LLUUID>& ids) { LLDynamicArray<LLUUID>* userdata = new LLDynamicArray<LLUUID>(ids); - LLString::format_map_t edit_args; + LLStringUtil::format_map_t edit_args; edit_args["[REGION]"] = gAgent.getRegion()->getName(); if (gAgent.isGodlike()) { @@ -4864,8 +4844,8 @@ void handle_lure(LLDynamicArray<LLUUID>& ids) void send_improved_im(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, @@ -4896,10 +4876,10 @@ void send_improved_im(const LLUUID& to_id, void send_places_query(const LLUUID& query_id, const LLUUID& trans_id, - const char* query_text, + const std::string& query_text, U32 query_flags, S32 category, - const char* sim_name) + const std::string& sim_name) { LLMessageSystem* msg = gMessageSystem; @@ -4931,12 +4911,10 @@ void process_user_info_reply(LLMessageSystem* msg, void**) BOOL im_via_email; msg->getBOOLFast(_PREHASH_UserData, _PREHASH_IMViaEMail, im_via_email); - char email[DB_USER_EMAIL_ADDR_BUF_SIZE]; /* Flawfinder: ignore */ - msg->getStringFast(_PREHASH_UserData, _PREHASH_EMail, DB_USER_EMAIL_ADDR_BUF_SIZE, - email); - char dir_visibility[MAX_STRING]; /* Flawfinder: ignore */ - msg->getString( - "UserData", "DirectoryVisibility", MAX_STRING, dir_visibility); + std::string email; + msg->getStringFast(_PREHASH_UserData, _PREHASH_EMail, email); + std::string dir_visibility; + msg->getString( "UserData", "DirectoryVisibility", dir_visibility); LLFloaterPreference::updateUserInfo(dir_visibility, im_via_email, email); LLFloaterPostcard::updateUserInfo(email); @@ -4957,7 +4935,7 @@ struct ScriptDialogInfo LLHost mSender; LLUUID mObjectID; S32 mChatChannel; - std::vector<LLString> mButtons; + std::vector<std::string> mButtons; }; void callback_script_dialog(S32 option, void* data) @@ -4990,19 +4968,17 @@ void process_script_dialog(LLMessageSystem* msg, void**) ScriptDialogInfo* info = new ScriptDialogInfo; - const S32 messageLength = SCRIPT_DIALOG_MAX_MESSAGE_SIZE + sizeof(SCRIPT_DIALOG_HEADER); - char message[messageLength]; /* Flawfinder: ignore */ // Account for size of "Script Dialog:\n" - - char first_name[DB_FIRST_NAME_BUF_SIZE]; /* Flawfinder: ignore */ - char last_name[DB_GROUP_NAME_BUF_SIZE]; /* Flawfinder: ignore */ - char title[DB_INV_ITEM_NAME_BUF_SIZE]; /* Flawfinder: ignore */ + std::string message; // Account for size of "Script Dialog:\n" + std::string first_name; + std::string last_name; + std::string title; info->mSender = msg->getSender(); msg->getUUID("Data", "ObjectID", info->mObjectID); - msg->getString("Data", "FirstName", DB_FIRST_NAME_BUF_SIZE, first_name); - msg->getString("Data", "LastName", DB_LAST_NAME_BUF_SIZE, last_name); - msg->getString("Data", "ObjectName", DB_INV_ITEM_NAME_BUF_SIZE, title); - msg->getString("Data", "Message", SCRIPT_DIALOG_MAX_MESSAGE_SIZE, message); + msg->getString("Data", "FirstName", first_name); + msg->getString("Data", "LastName", last_name); + msg->getString("Data", "ObjectName", title); + msg->getString("Data", "Message", message); msg->getS32("Data", "ChatChannel", info->mChatChannel); // unused for now @@ -5017,15 +4993,15 @@ void process_script_dialog(LLMessageSystem* msg, void**) for (i = 0; i < button_count; i++) { - char tdesc[SCRIPT_DIALOG_BUTTON_STR_SIZE+1]; /* Flawfinder: ignore */ - msg->getString("Buttons", "ButtonLabel", SCRIPT_DIALOG_BUTTON_STR_SIZE + 1, tdesc, i); - info->mButtons.push_back(LLString(tdesc)); + std::string tdesc; + msg->getString("Buttons", "ButtonLabel", tdesc, i); + info->mButtons.push_back(tdesc); } - LLStringBase<char>::format_map_t args; + LLStringUtil::format_map_t args; args["[TITLE]"] = title; args["[MESSAGE]"] = message; - if (strlen(first_name) > 0) /* Flawfinder: ignore */ + if (!first_name.empty()) { args["[FIRST]"] = first_name; args["[LAST]"] = last_name; @@ -5051,9 +5027,9 @@ struct LoadUrlInfo LLUUID mObjectID; LLUUID mOwnerID; BOOL mOwnerIsGroup; - char mObjectName[256]; /* Flawfinder: ignore */ - char mMessage[256]; /* Flawfinder: ignore */ - char mUrl[256]; /* Flawfinder: ignore */ + std::string mObjectName; + std::string mMessage; + std::string mUrl; }; std::vector<LoadUrlInfo*> gLoadUrlList; @@ -5075,7 +5051,7 @@ void callback_load_url(S32 option, void* data) // We've got the name of the person who owns the object hurling the url. // Display confirmation dialog. -void callback_load_url_name(const LLUUID& id, const char* first, const char* last, BOOL is_group, void* data) +void callback_load_url_name(const LLUUID& id, const std::string& first, const std::string& last, BOOL is_group, void* data) { std::vector<LoadUrlInfo*>::iterator it; for (it = gLoadUrlList.begin(); it != gLoadUrlList.end(); ) @@ -5085,15 +5061,14 @@ void callback_load_url_name(const LLUUID& id, const char* first, const char* las { it = gLoadUrlList.erase(it); - std::string owner_name(first); + std::string owner_name; if (is_group) { - owner_name += " (group)"; + owner_name = first + " (group)"; } else { - owner_name += " "; - owner_name += last; + owner_name = first + " " + last; } // For legacy name-only mutes. @@ -5103,7 +5078,7 @@ void callback_load_url_name(const LLUUID& id, const char* first, const char* las infop = NULL; continue; } - LLString::format_map_t args; + LLStringUtil::format_map_t args; args["[URL]"] = infop->mUrl; args["[MESSAGE]"] = infop->mMessage; args["[OBJECTNAME]"] = infop->mObjectName; @@ -5121,12 +5096,12 @@ void process_load_url(LLMessageSystem* msg, void**) { LoadUrlInfo* infop = new LoadUrlInfo; - msg->getString("Data", "ObjectName", 256, infop->mObjectName); + msg->getString("Data", "ObjectName", infop->mObjectName); msg->getUUID( "Data", "ObjectID", infop->mObjectID); msg->getUUID( "Data", "OwnerID", infop->mOwnerID); msg->getBOOL( "Data", "OwnerIsGroup", infop->mOwnerIsGroup); - msg->getString("Data", "Message", 256, infop->mMessage); - msg->getString("Data", "URL", 256, infop->mUrl); + msg->getString("Data", "Message", infop->mMessage); + msg->getString("Data", "URL", infop->mUrl); // URL is safety checked in load_url above @@ -5149,8 +5124,8 @@ void process_load_url(LLMessageSystem* msg, void**) void callback_download_complete(void** data, S32 result, LLExtStat ext_status) { - LLString* filepath = (LLString*)data; - LLString::format_map_t args; + std::string* filepath = (std::string*)data; + LLStringUtil::format_map_t args; args["[DOWNLOAD_PATH]"] = *filepath; gViewerWindow->alertXml("FinishedRawDownload", args); delete filepath; @@ -5167,10 +5142,10 @@ void process_initiate_download(LLMessageSystem* msg, void**) return; } - char sim_filename[MAX_PATH]; /* Flawfinder: ignore */ - char viewer_filename[MAX_PATH]; /* Flawfinder: ignore */ - msg->getString("FileData", "SimFilename", MAX_PATH, sim_filename); - msg->getString("FileData", "ViewerFilename", MAX_PATH, viewer_filename); + std::string sim_filename; + std::string viewer_filename; + msg->getString("FileData", "SimFilename", sim_filename); + msg->getString("FileData", "ViewerFilename", viewer_filename); gXferManager->requestFile(viewer_filename, sim_filename, @@ -5178,19 +5153,19 @@ void process_initiate_download(LLMessageSystem* msg, void**) msg->getSender(), FALSE, // don't delete remote callback_download_complete, - (void**)new LLString(viewer_filename)); + (void**)new std::string(viewer_filename)); } void process_script_teleport_request(LLMessageSystem* msg, void**) { - char object_name[256]; /* Flawfinder: ignore */ - char sim_name[256]; /* Flawfinder: ignore */ + std::string object_name; + std::string sim_name; LLVector3 pos; LLVector3 look_at; - msg->getString("Data", "ObjectName", 255, object_name); - msg->getString( "Data", "SimName", 255, sim_name); + msg->getString("Data", "ObjectName", object_name); + msg->getString("Data", "SimName", sim_name); msg->getVector3("Data", "SimPosition", pos); msg->getVector3("Data", "LookAt", look_at); @@ -5206,11 +5181,11 @@ void process_script_teleport_request(LLMessageSystem* msg, void**) void process_covenant_reply(LLMessageSystem* msg, void**) { LLUUID covenant_id, estate_owner_id; - char estate_name[MAX_STRING]; /* Flawfinder: ignore */ + std::string estate_name; U32 covenant_timestamp; msg->getUUID("Data", "CovenantID", covenant_id); msg->getU32("Data", "CovenantTimestamp", covenant_timestamp); - msg->getString("Data", "EstateName", MAX_STRING, estate_name); + msg->getString("Data", "EstateName", estate_name); msg->getUUID("Data", "EstateOwnerID", estate_owner_id); LLPanelEstateCovenant::updateEstateName(estate_name); @@ -5218,11 +5193,7 @@ void process_covenant_reply(LLMessageSystem* msg, void**) LLFloaterBuyLand::updateEstateName(estate_name); // standard message, not from system - char last_modified[MAX_STRING]; /* Flawfinder: ignore */ - last_modified[0] = '\0'; - char time_buf[TIME_STR_LENGTH]; /* Flawfinder: ignore */ - snprintf(last_modified, MAX_STRING, "Last Modified %s", /* Flawfinder: ignore */ - formatted_time((time_t)covenant_timestamp, time_buf)); + std::string last_modified = std::string("Last Modified ") + formatted_time((time_t)covenant_timestamp); LLPanelEstateCovenant::updateLastModified(last_modified); LLPanelLandCovenant::updateLastModified(last_modified); @@ -5262,12 +5233,9 @@ void process_covenant_reply(LLMessageSystem* msg, void**) } } -void callbackCacheEstateOwnerName( - const LLUUID& id, - const char* first, - const char* last, - BOOL is_group, - void*) +void callbackCacheEstateOwnerName(const LLUUID& id, + const std::string& first, const std::string& last, + BOOL is_group, void*) { std::string name; @@ -5277,9 +5245,7 @@ void callbackCacheEstateOwnerName( } else { - name = first; - name += " "; - name += last; + name = first + " " + last; } LLPanelEstateCovenant::updateEstateOwnerName(name); LLPanelLandCovenant::updateEstateOwnerName(name); @@ -5314,10 +5280,10 @@ void onCovenantLoadComplete(LLVFS *vfs, if( (file_length > 19) && !strncmp( buffer, "Linden text version", 19 ) ) { LLViewerTextEditor* editor = - new LLViewerTextEditor("temp", + new LLViewerTextEditor(std::string("temp"), LLRect(0,0,0,0), file_length+1); - if( !editor->importBuffer( buffer ) ) + if( !editor->importBuffer( buffer, file_length+1 ) ) { LL_WARNS("Messaging") << "Problem importing estate covenant." << LL_ENDL; covenant_text = "Problem importing estate covenant."; @@ -5367,12 +5333,12 @@ void process_feature_disabled_message(LLMessageSystem* msg, void**) // Handle Blacklisted feature simulator response... LLUUID agentID; LLUUID transactionID; - char messageText[MAX_STRING]; /* Flawfinder: ignore */ - msg->getStringFast(_PREHASH_FailureInfo,_PREHASH_ErrorMessage,MAX_STRING,&messageText[0],0); + std::string messageText; + msg->getStringFast(_PREHASH_FailureInfo,_PREHASH_ErrorMessage, messageText,0); msg->getUUIDFast(_PREHASH_FailureInfo,_PREHASH_AgentID,agentID); msg->getUUIDFast(_PREHASH_FailureInfo,_PREHASH_TransactionID,transactionID); - LL_WARNS("Messaging") << "Blacklisted Feature Response:" << &messageText[0] << LL_ENDL; + LL_WARNS("Messaging") << "Blacklisted Feature Response:" << messageText << LL_ENDL; } // ------------------------------------------------------------ diff --git a/indra/newview/llviewermessage.h b/indra/newview/llviewermessage.h index 23783058a0..a2ed04d0a7 100644 --- a/indra/newview/llviewermessage.h +++ b/indra/newview/llviewermessage.h @@ -61,7 +61,7 @@ enum InventoryOfferResponse BOOL can_afford_transaction(S32 cost); void give_money(const LLUUID& uuid, LLViewerRegion* region, S32 amount, BOOL is_group = FALSE, - S32 trx_type = TRANS_GIFT, const LLString& desc = LLString::null); + S32 trx_type = TRANS_GIFT, const std::string& desc = LLStringUtil::null); void busy_message (LLMessageSystem* msg, LLUUID from_id); void process_logout_reply(LLMessageSystem* msg, void**); @@ -139,13 +139,13 @@ void process_teleport_local(LLMessageSystem *msg,void**); void process_user_sim_location_reply(LLMessageSystem *msg,void**); void send_simple_im(const LLUUID& to_id, - const char* message, + const std::string& message, EInstantMessage dialog = IM_NOTHING_SPECIAL, const LLUUID& id = LLUUID::null); void send_group_notice(const LLUUID& group_id, - const char* subject, - const char* message, + const std::string& subject, + const std::string& message, const LLInventoryItem* item); void handle_lure(const LLUUID& invitee); @@ -154,8 +154,8 @@ void handle_lure(LLDynamicArray<LLUUID>& ids); // always from gAgent and // routes through the gAgent's current simulator void send_improved_im(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, @@ -165,18 +165,15 @@ void send_improved_im(const LLUUID& to_id, void process_user_info_reply(LLMessageSystem* msg, void**); -// method to format the time. Buffer should be at least -// TIME_STR_LENGTH long, and the function reutnrs buffer (for use in -// sprintf and the like) -const S32 TIME_STR_LENGTH = 30; -char* formatted_time(const time_t& the_time, char* buffer); +// method to format the time. +std::string formatted_time(const time_t& the_time); void send_places_query(const LLUUID& query_id, const LLUUID& trans_id, - const char* query_text, + const std::string& query_text, U32 query_flags, S32 category, - const char* sim_name); + const std::string& sim_name); void process_script_dialog(LLMessageSystem* msg, void**); void process_load_url(LLMessageSystem* msg, void**); void process_script_teleport_request(LLMessageSystem* msg, void**); @@ -185,12 +182,6 @@ void onCovenantLoadComplete(LLVFS *vfs, const LLUUID& asset_uuid, LLAssetType::EType type, void* user_data, S32 status, LLExtStat ext_status); -void callbackCacheEstateOwnerName( - const LLUUID& id, - const char* first, - const char* last, - BOOL is_group, - void*); // calling cards void process_offer_callingcard(LLMessageSystem* msg, void**); @@ -214,8 +205,8 @@ struct LLOfferInfo LLUUID mFolderID; LLUUID mObjectID; LLAssetType::EType mType; - LLString mFromName; - LLString mDesc; + std::string mFromName; + std::string mDesc; LLHost mHost; }; diff --git a/indra/newview/llviewernetwork.cpp b/indra/newview/llviewernetwork.cpp index fed98d5daa..d2d8f774a0 100644 --- a/indra/newview/llviewernetwork.cpp +++ b/indra/newview/llviewernetwork.cpp @@ -176,7 +176,7 @@ void LLViewerLogin::setGridChoice(const std::string& grid_name) int grid_index = GRID_INFO_NONE; for(;grid_index < GRID_INFO_OTHER; ++grid_index) { - if(0 == LLString::compareInsensitive(gGridInfo[grid_index].mLabel, grid_name.c_str())) + if(0 == LLStringUtil::compareInsensitive(gGridInfo[grid_index].mLabel, grid_name)) { // Founding a matching label in the list... setGridChoice((EGridInfo)grid_index); @@ -301,7 +301,7 @@ bool LLViewerLogin::isInProductionGrid() // but it seems that loginURI trumps that. std::vector<std::string> uris; getLoginURIs(uris); - LLString::toLower(uris[0]); + LLStringUtil::toLower(uris[0]); if((uris[0].find("agni") != std::string::npos)) { return true; diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index 3a501a9045..19025b34a4 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -467,7 +467,7 @@ void LLViewerObject::setNameValueList(const std::string& name_value_list) if (end > start) { std::string tok = name_value_list.substr(start, end - start); - addNVPair(tok.c_str()); + addNVPair(tok); } start = end+1; } @@ -955,12 +955,9 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, S32 nv_size = mesgsys->getSizeFast(_PREHASH_ObjectData, block_num, _PREHASH_NameValue); if (nv_size > 0) { - char* name_value_list = new char[nv_size]; - mesgsys->getStringFast(_PREHASH_ObjectData, _PREHASH_NameValue, nv_size, name_value_list, block_num); - + std::string name_value_list; + mesgsys->getStringFast(_PREHASH_ObjectData, _PREHASH_NameValue, name_value_list, block_num); setNameValueList(name_value_list); - - delete [] name_value_list; } // Clear out any existing generic data @@ -996,8 +993,8 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, mText->setOnHUDAttachment(isHUDAttachment()); } - char temp_string[256]; /* Flawfinder: ignore */ // not MAX_STRING, must hold 255 chars + \0 - mesgsys->getStringFast(_PREHASH_ObjectData, _PREHASH_Text, 256, temp_string, block_num ); + std::string temp_string; + mesgsys->getStringFast(_PREHASH_ObjectData, _PREHASH_Text, temp_string, block_num ); LLColor4U coloru; mesgsys->getBinaryDataFast(_PREHASH_ObjectData, _PREHASH_TextColor, coloru.mV, 4, block_num); @@ -1019,13 +1016,13 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, mText = NULL; } - char media_url[MAX_STRING+1]; /* Flawfinder: ignore */ - mesgsys->getStringFast(_PREHASH_ObjectData, _PREHASH_MediaURL, MAX_STRING+1, media_url, block_num); - //if (media_url[0]) + std::string media_url; + mesgsys->getStringFast(_PREHASH_ObjectData, _PREHASH_MediaURL, media_url, block_num); + //if (!media_url.empty()) //{ // llinfos << "WEBONPRIM media_url " << media_url << llendl; //} - if (!mMedia && media_url[0] != '\0') + if (!mMedia && !media_url.empty()) { retval |= MEDIA_URL_ADDED; mMedia = new LLViewerObjectMedia; @@ -1035,7 +1032,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, } else if (mMedia) { - if (media_url[0] == '\0') + if (media_url.empty()) { retval |= MEDIA_URL_REMOVED; delete mMedia; @@ -1514,7 +1511,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, std::string name_value_list; dp->unpackString(name_value_list, "NV"); - setNameValueList(name_value_list.c_str()); + setNameValueList(name_value_list); } mTotalCRC = crc; @@ -2386,7 +2383,7 @@ void LLViewerObject::fetchInventoryFromServer() struct LLFilenameAndTask { LLUUID mTaskID; - char mFilename[MAX_STRING]; /* Flawfinder: ignore */ // Just the filename, not the path + std::string mFilename; #ifdef _DEBUG static S32 sCount; LLFilenameAndTask() @@ -2427,8 +2424,8 @@ void LLViewerObject::processTaskInv(LLMessageSystem* msg, void** user_data) msg->getS16Fast(_PREHASH_InventoryData, _PREHASH_Serial, object->mInventorySerialNum); LLFilenameAndTask* ft = new LLFilenameAndTask; ft->mTaskID = task_id; - msg->getStringFast(_PREHASH_InventoryData, _PREHASH_Filename, MAX_STRING, ft->mFilename); - if(!ft->mFilename[0]) + msg->getStringFast(_PREHASH_InventoryData, _PREHASH_Filename, ft->mFilename); + if(ft->mFilename.empty()) { lldebugs << "Task has no inventory" << llendl; // mock up some inventory to make a drop target. @@ -2443,13 +2440,13 @@ void LLViewerObject::processTaskInv(LLMessageSystem* msg, void** user_data) LLPointer<LLInventoryObject> obj; obj = new LLInventoryObject(object->mID, LLUUID::null, LLAssetType::AT_CATEGORY, - "Contents"); + std::string("Contents")); object->mInventory->push_front(obj); object->doInventoryCallback(); delete ft; return; } - gXferManager->requestFile(gDirUtilp->getExpandedFilename(LL_PATH_CACHE, ft->mFilename).c_str(), + gXferManager->requestFile(gDirUtilp->getExpandedFilename(LL_PATH_CACHE, ft->mFilename), ft->mFilename, LL_PATH_CACHE, object->mRegionp->getHost(), TRUE, @@ -2477,12 +2474,12 @@ void LLViewerObject::processTaskInvFile(void** user_data, S32 error_code, LLExtS delete ft; } -void LLViewerObject::loadTaskInvFile(const char* filename) +void LLViewerObject::loadTaskInvFile(const std::string& filename) { LLMemType mt(LLMemType::MTYPE_OBJECT); std::string filename_and_local_path = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, filename); - llifstream ifs(filename_and_local_path.c_str()); + llifstream ifs(filename_and_local_path); if(ifs.good()) { char buffer[MAX_STRING]; /* Flawfinder: ignore */ @@ -2519,7 +2516,7 @@ void LLViewerObject::loadTaskInvFile(const char* filename) } } ifs.close(); - LLFile::remove(filename_and_local_path.c_str()); + LLFile::remove(filename_and_local_path); } else { @@ -2970,7 +2967,7 @@ void LLViewerObject::addNVPair(const std::string& data) mNameValuePairs[nv->mName] = nv; } -BOOL LLViewerObject::removeNVPair(const char *name) +BOOL LLViewerObject::removeNVPair(const std::string& name) { char* canonical_name = gNVNameTable.addString(name); @@ -2989,7 +2986,7 @@ BOOL LLViewerObject::removeNVPair(const char *name) gMessageSystem->addUUIDFast(_PREHASH_ID, mID); gMessageSystem->nextBlockFast(_PREHASH_NameValueData); - gMessageSystem->addStringFast(_PREHASH_NVPair, buffer.c_str()); + gMessageSystem->addStringFast(_PREHASH_NVPair, buffer); gMessageSystem->sendReliable( mRegionp->getHost() ); */ @@ -3007,7 +3004,7 @@ BOOL LLViewerObject::removeNVPair(const char *name) } -LLNameValue *LLViewerObject::getNVPair(const char *name) const +LLNameValue *LLViewerObject::getNVPair(const std::string& name) const { char *canonical_name; @@ -3394,7 +3391,7 @@ void LLViewerObject::setMediaType(U8 media_type) } } -const LLString& LLViewerObject::getMediaURL() const +std::string LLViewerObject::getMediaURL() const { if (mMedia) { @@ -3402,11 +3399,11 @@ const LLString& LLViewerObject::getMediaURL() const } else { - return LLString::null; + return std::string(); } } -void LLViewerObject::setMediaURL(const LLString& media_url) +void LLViewerObject::setMediaURL(const std::string& media_url) { LLMemType mt(LLMemType::MTYPE_OBJECT); diff --git a/indra/newview/llviewerobject.h b/indra/newview/llviewerobject.h index ed38911d4e..0f0fa62ea1 100644 --- a/indra/newview/llviewerobject.h +++ b/indra/newview/llviewerobject.h @@ -143,8 +143,8 @@ public: static void cleanupVOClasses(); void addNVPair(const std::string& data); - BOOL removeNVPair(const char *name); - LLNameValue *getNVPair(const char *name) const; // null if no name value pair by that name + BOOL removeNVPair(const std::string& name); + LLNameValue* getNVPair(const std::string& name) const; // null if no name value pair by that name // Object create and update functions virtual BOOL idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time); @@ -326,8 +326,8 @@ public: U8 getMediaType() const; void setMediaType(U8 media_type); - const LLString& getMediaURL() const; - void setMediaURL(const LLString& media_url); + std::string getMediaURL() const; + void setMediaURL(const std::string& media_url); BOOL getMediaPassedWhitelist() const; void setMediaPassedWhitelist(BOOL passed); @@ -550,7 +550,7 @@ protected: // static void processTaskInvFile(void** user_data, S32 error_code, LLExtStat ext_status); - void loadTaskInvFile(const char* filename); + void loadTaskInvFile(const std::string& filename); void doInventoryCallback(); BOOL isOnMap(); @@ -657,7 +657,7 @@ class LLViewerObjectMedia public: LLViewerObjectMedia() : mMediaURL(), mPassedWhitelist(FALSE), mMediaType(0) { } - LLString mMediaURL; // for web pages on surfaces, one per prim + std::string mMediaURL; // for web pages on surfaces, one per prim BOOL mPassedWhitelist; // user has OK'd display U8 mMediaType; // see LLTextureEntry::WEB_PAGE, etc. }; diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp index 2345b4ea06..1c0aaec29a 100644 --- a/indra/newview/llviewerobjectlist.cpp +++ b/indra/newview/llviewerobjectlist.cpp @@ -717,17 +717,17 @@ void LLViewerObjectList::update(LLAgent &agent, LLWorld &world) /* // Debugging code for viewing orphans, and orphaned parents LLUUID id; - char id_str[UUID_STR_LENGTH + 20]; for (i = 0; i < mOrphanParents.count(); i++) { id = sIndexAndLocalIDToUUID[mOrphanParents[i]]; LLViewerObject *objectp = findObject(id); if (objectp) { - sprintf(id_str, "Par: "); - objectp->mID.toString(id_str + 5); + std::string id_str; + objectp->mID.toString(id_str); + std::string tmpstr = std::string("Par: ") + id_str; addDebugBeacon(objectp->getPositionAgent(), - id_str, + tmpstr, LLColor4(1.f,0.f,0.f,1.f), LLColor4(1.f,1.f,1.f,1.f)); } @@ -740,20 +740,22 @@ void LLViewerObjectList::update(LLAgent &agent, LLWorld &world) LLViewerObject *objectp = findObject(oi.mChildInfo); if (objectp) { + std::string id_str; + objectp->mID.toString(id_str); + std::string tmpstr; if (objectp->getParent()) { - sprintf(id_str, "ChP: "); + tmpstr = std::string("ChP: ") + id_str; text_color = LLColor4(0.f, 1.f, 0.f, 1.f); } else { - sprintf(id_str, "ChNoP: "); + tmpstr = std::string("ChNoP: ") + id_str; text_color = LLColor4(1.f, 0.f, 0.f, 1.f); } id = sIndexAndLocalIDToUUID[oi.mParentInfo]; - objectp->mID.toString(id_str + 8); addDebugBeacon(objectp->getPositionAgent() + LLVector3(0.f, 0.f, -0.25f), - id_str, + tmpstr, LLColor4(0.25f,0.25f,0.25f,1.f), text_color); } @@ -1236,7 +1238,7 @@ LLViewerObject *LLViewerObjectList::getSelectedObject(const U32 object_id) } void LLViewerObjectList::addDebugBeacon(const LLVector3 &pos_agent, - const LLString &string, + const std::string &string, const LLColor4 &color, const LLColor4 &text_color, S32 line_width) diff --git a/indra/newview/llviewerobjectlist.h b/indra/newview/llviewerobjectlist.h index 39603cfd3b..b9b6ff243f 100644 --- a/indra/newview/llviewerobjectlist.h +++ b/indra/newview/llviewerobjectlist.h @@ -95,7 +95,7 @@ public: void renderObjectsForMap(LLNetMap &netmap); void renderObjectBounds(const LLVector3 ¢er); - void addDebugBeacon(const LLVector3 &pos_agent, const LLString &string, + void addDebugBeacon(const LLVector3 &pos_agent, const std::string &string, const LLColor4 &color=LLColor4(1.f, 0.f, 0.f, 0.5f), const LLColor4 &text_color=LLColor4(1.f, 1.f, 1.f, 1.f), S32 line_width = 1); @@ -225,7 +225,7 @@ public: } LLVector3 mPositionAgent; - LLString mString; + std::string mString; LLColor4 mColor; LLColor4 mTextColor; S32 mLineWidth; diff --git a/indra/newview/llviewerparcelmedia.cpp b/indra/newview/llviewerparcelmedia.cpp index ba6a6005bf..272080678f 100644 --- a/indra/newview/llviewerparcelmedia.cpp +++ b/indra/newview/llviewerparcelmedia.cpp @@ -120,7 +120,7 @@ void LLViewerParcelMedia::update(LLParcel* parcel) } std::string mediaUrl = std::string ( parcel->getMediaURL () ); - LLString::trim(mediaUrl); + LLStringUtil::trim(mediaUrl); // has something changed? if ( ( LLViewerMedia::getMediaURL() != mediaUrl ) @@ -370,7 +370,7 @@ void LLViewerParcelMedia::processParcelMediaUpdate( LLMessageSystem *msg, void * { // temporarily store these new values in the parcel parcel->setMediaURL(media_url); - parcel->setMediaType(media_type.c_str()); + parcel->setMediaType(media_type); parcel->setMediaID(media_id); parcel->setMediaWidth(media_width); parcel->setMediaHeight(media_height); diff --git a/indra/newview/llviewerparcelmgr.cpp b/indra/newview/llviewerparcelmgr.cpp index f14d206b7f..6e37ec2095 100644 --- a/indra/newview/llviewerparcelmgr.cpp +++ b/indra/newview/llviewerparcelmgr.cpp @@ -83,7 +83,7 @@ LLPointer<LLViewerImage> sBlockedImage; LLPointer<LLViewerImage> sPassImage; // Local functions -void optionally_start_music(const LLString& music_url); +void optionally_start_music(const std::string& music_url); void callback_start_music(S32 option, void* data); void optionally_prepare_video(const LLParcel *parcelp); void callback_prepare_video(S32 option, void* data); @@ -1211,22 +1211,21 @@ void LLViewerParcelMgr::makeLandmarkAtSelection() LLVector3 west_south_bottom_region = region->getPosRegionFromGlobal( mWestSouth ); LLVector3 east_north_top_region = region->getPosRegionFromGlobal( mEastNorth ); - LLString name("My Land"); - char buffer[MAX_STRING]; + std::string name("My Land"); + std::string buffer; S32 pos_x = (S32)floor((west_south_bottom_region.mV[VX] + east_north_top_region.mV[VX]) / 2.0f); S32 pos_y = (S32)floor((west_south_bottom_region.mV[VY] + east_north_top_region.mV[VY]) / 2.0f); - sprintf(buffer, "%s in %s (%d, %d)", + buffer = llformat("%s in %s (%d, %d)", name.c_str(), region->getName().c_str(), pos_x, pos_y); name.assign(buffer); - const char* desc = "Claimed land"; - create_landmark(name.c_str(), desc, global_center); + create_landmark(name, "Claimed land", global_center); } */ -const LLString& LLViewerParcelMgr::getAgentParcelName() const +const std::string& LLViewerParcelMgr::getAgentParcelName() const { return mAgentParcel->getName(); } @@ -1649,16 +1648,16 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use { if (parcel) { - LLString music_url_raw = parcel->getMusicURL(); + std::string music_url_raw = parcel->getMusicURL(); // Trim off whitespace from front and back - LLString music_url = music_url_raw; - LLString::trim(music_url); + std::string music_url = music_url_raw; + LLStringUtil::trim(music_url); // On entering a new parcel, stop the last stream if the // new parcel has a different music url. (Empty URL counts // as different.) - const char* stream_url = gAudiop->getInternetStreamURL(); + const std::string& stream_url = gAudiop->getInternetStreamURL(); if (music_url.empty() || music_url != stream_url) { @@ -1673,10 +1672,10 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use optionally_start_music(music_url); } } - else if (gAudiop->getInternetStreamURL()[0]) + else if (!gAudiop->getInternetStreamURL().empty()) { llinfos << "Stopping parcel music" << llendl; - gAudiop->startInternetStream(NULL); + gAudiop->startInternetStream(LLStringUtil::null); } } } @@ -1692,7 +1691,7 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use }; } -void optionally_start_music(const LLString& music_url) +void optionally_start_music(const std::string& music_url) { if (gSavedSettings.getBOOL("AudioStreamingMusic")) { @@ -1703,7 +1702,7 @@ void optionally_start_music(const LLString& music_url) // changed as part of SL-4878 if ( gOverlayBar && gOverlayBar->musicPlaying()) { - gAudiop->startInternetStream(music_url.c_str()); + gAudiop->startInternetStream(music_url); } } } @@ -1909,7 +1908,7 @@ void LLViewerParcelMgr::deedLandToGroup() { std::string group_name; gCacheName->getGroupName(mCurrentParcel->getGroupID(), group_name); - LLString::format_map_t args; + LLStringUtil::format_map_t args; args["[AREA]"] = llformat("%d", mCurrentParcel->getArea()); args["[GROUP_NAME]"] = group_name; if(mCurrentParcel->getContributeWithDeed()) @@ -1980,7 +1979,7 @@ void LLViewerParcelMgr::startReleaseLand() if ((region->getRegionFlags() & REGION_FLAGS_BLOCK_LAND_RESELL) && !gAgent.isGodlike()) { - LLStringBase<char>::format_map_t args; + LLStringUtil::format_map_t args; args["[REGION]"] = region->getName(); gViewerWindow->alertXml("CannotReleaseLandNoTransfer", args); return; @@ -1994,7 +1993,7 @@ void LLViewerParcelMgr::startReleaseLand() } // Compute claim price - LLStringBase<char>::format_map_t args; + LLStringUtil::format_map_t args; args["[AREA]"] = llformat("%d",mCurrentParcel->getArea()); gViewerWindow->alertXml("ReleaseLandWarning", args, releaseAlertCB, this); @@ -2193,7 +2192,7 @@ void LLViewerParcelMgr::startDeedLandToGroup() if((region->getRegionFlags() & REGION_FLAGS_BLOCK_LAND_RESELL) && (mCurrentParcel->getOwnerID() != region->getOwner())) { - LLStringBase<char>::format_map_t args; + LLStringUtil::format_map_t args; args["[REGION]"] = region->getName(); gViewerWindow->alertXml("CannotDeedLandNoTransfer", args); return; diff --git a/indra/newview/llviewerparcelmgr.h b/indra/newview/llviewerparcelmgr.h index 37499e3751..4326e07e46 100644 --- a/indra/newview/llviewerparcelmgr.h +++ b/indra/newview/llviewerparcelmgr.h @@ -237,7 +237,7 @@ public: void sendParcelRelease(); // accessors for mAgentParcel - const LLString& getAgentParcelName() const; + const std::string& getAgentParcelName() const; // Create a landmark at the "appropriate" location for the // currently selected parcel. diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 41c97818dc..568a4049f0 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -276,12 +276,9 @@ void LLViewerRegion::loadCache() LLVOCacheEntry *entry; - char filename[256]; /* Flawfinder: ignore */ - snprintf(filename, sizeof(filename), "%s%sobjects_%d_%d.slc", /* Flawfinder: ignore */ - gDirUtilp->getExpandedFilename(LL_PATH_CACHE,"").c_str(), - gDirUtilp->getDirDelimiter().c_str(), - U32(mHandle>>32)/REGION_WIDTH_UNITS, - U32(mHandle)/REGION_WIDTH_UNITS ); + std::string filename; + filename = gDirUtilp->getExpandedFilename(LL_PATH_CACHE,"") + gDirUtilp->getDirDelimiter() + + llformat("objects_%d_%d.slc",U32(mHandle>>32)/REGION_WIDTH_UNITS, U32(mHandle)/REGION_WIDTH_UNITS ); LLFILE* fp = LLFile::fopen(filename, "rb"); /* Flawfinder: ignore */ if (!fp) @@ -365,12 +362,9 @@ void LLViewerRegion::saveCache() return; } - char filename[256]; /* Flawfinder: ignore */ - snprintf(filename, sizeof(filename), "%s%sobjects_%d_%d.slc", /* Flawfinder: ignore */ - gDirUtilp->getExpandedFilename(LL_PATH_CACHE,"").c_str(), - gDirUtilp->getDirDelimiter().c_str(), - U32(mHandle>>32)/REGION_WIDTH_UNITS, - U32(mHandle)/REGION_WIDTH_UNITS ); + std::string filename; + filename = gDirUtilp->getExpandedFilename(LL_PATH_CACHE,"") + gDirUtilp->getDirDelimiter() + + llformat("sobjects_%d_%d.slc", U32(mHandle>>32)/REGION_WIDTH_UNITS, U32(mHandle)/REGION_WIDTH_UNITS ); LLFILE* fp = LLFile::fopen(filename, "wb"); /* Flawfinder: ignore */ if (!fp) @@ -495,9 +489,8 @@ LLVector3 LLViewerRegion::getCenterAgent() const return gAgent.getPosAgentFromGlobal(mCenterGlobal); } -void LLViewerRegion::setRegionNameAndZone(const char* name_and_zone) +void LLViewerRegion::setRegionNameAndZone (const std::string& name_zone) { - LLString name_zone(name_and_zone); std::string::size_type pipe_pos = name_zone.find('|'); S32 length = name_zone.size(); if (pipe_pos != std::string::npos) @@ -511,8 +504,8 @@ void LLViewerRegion::setRegionNameAndZone(const char* name_and_zone) mZoning = ""; } - LLString::stripNonprintable(mName); - LLString::stripNonprintable(mZoning); + LLStringUtil::stripNonprintable(mName); + LLStringUtil::stripNonprintable(mZoning); } BOOL LLViewerRegion::canManageEstate() const @@ -522,7 +515,7 @@ BOOL LLViewerRegion::canManageEstate() const || gAgent.getID() == getOwner(); } -const char* LLViewerRegion::getSimAccessString() const +const std::string LLViewerRegion::getSimAccessString() const { return accessToString(mSimAccess); } @@ -554,9 +547,9 @@ const char* SIM_ACCESS_STR[] = { "Free Trial", "Unknown" }; // static -const char* LLViewerRegion::accessToString(U8 access) /* Flawfinder: ignore */ +std::string LLViewerRegion::accessToString(U8 sim_access) { - switch(access) /* Flawfinder: ignore */ + switch(sim_access) { case SIM_ACCESS_TRIAL: return SIM_ACCESS_STR[0]; @@ -577,28 +570,28 @@ const char* LLViewerRegion::accessToString(U8 access) /* Flawfinder: ignore */ } // static -U8 LLViewerRegion::stringToAccess(const char* access_str) +U8 LLViewerRegion::stringToAccess(const std::string& access_str) { - U8 access = SIM_ACCESS_MIN; - if (0 == strcmp(access_str, SIM_ACCESS_STR[0])) + U8 sim_access = SIM_ACCESS_MIN; + if (access_str == SIM_ACCESS_STR[0]) { - access = SIM_ACCESS_TRIAL; + sim_access = SIM_ACCESS_TRIAL; } - else if (0 == strcmp(access_str, SIM_ACCESS_STR[1])) + else if (access_str == SIM_ACCESS_STR[1]) { - access = SIM_ACCESS_PG; + sim_access = SIM_ACCESS_PG; } - else if (0 == strcmp(access_str, SIM_ACCESS_STR[2])) + else if (access_str == SIM_ACCESS_STR[2]) { - access = SIM_ACCESS_MATURE; + sim_access = SIM_ACCESS_MATURE; } - return access; /* Flawfinder: ignore */ + return sim_access; } // static -const char* LLViewerRegion::accessToShortString(U8 access) /* Flawfinder: ignore */ +std::string LLViewerRegion::accessToShortString(U8 sim_access) { - switch(access) /* Flawfinder: ignore */ + switch(sim_access) /* Flawfinder: ignore */ { case SIM_ACCESS_PG: return "PG"; @@ -1277,10 +1270,9 @@ void LLViewerRegion::unpackRegionHandshake() { LLMessageSystem *msg = gMessageSystem; - const S32 SIM_NAME_BUF = 256; U32 region_flags; U8 sim_access; - char sim_name[SIM_NAME_BUF]; /* Flawfinder: ignore */ + std::string sim_name; LLUUID sim_owner; BOOL is_estate_manager; F32 water_height; @@ -1289,7 +1281,7 @@ void LLViewerRegion::unpackRegionHandshake() msg->getU32 ("RegionInfo", "RegionFlags", region_flags); msg->getU8 ("RegionInfo", "SimAccess", sim_access); - msg->getString ("RegionInfo", "SimName", SIM_NAME_BUF, sim_name); + msg->getString ("RegionInfo", "SimName", sim_name); msg->getUUID ("RegionInfo", "SimOwner", sim_owner); msg->getBOOL ("RegionInfo", "IsEstateManager", is_estate_manager); msg->getF32 ("RegionInfo", "WaterHeight", water_height); diff --git a/indra/newview/llviewerregion.h b/indra/newview/llviewerregion.h index d6e5e8320f..8c3115f78d 100644 --- a/indra/newview/llviewerregion.h +++ b/indra/newview/llviewerregion.h @@ -161,9 +161,9 @@ public: const LLVector3d &getCenterGlobal() const { return mCenterGlobal; } LLVector3 getCenterAgent() const; - void setRegionNameAndZone(const char* name_and_zone); - const LLString& getName() const { return mName; } - const LLString& getZoning() const { return mZoning; } + void setRegionNameAndZone(const std::string& name_and_zone); + const std::string& getName() const { return mName; } + const std::string& getZoning() const { return mZoning; } void setOwner(const LLUUID& owner_id) { mOwnerID = owner_id; } const LLUUID& getOwner() const { return mOwnerID; } @@ -175,18 +175,18 @@ public: void setSimAccess(U8 sim_access) { mSimAccess = sim_access; } U8 getSimAccess() const { return mSimAccess; } - const char* getSimAccessString() const; + const std::string getSimAccessString() const; // Returns "Sandbox", "Expensive", etc. static std::string regionFlagsToString(U32 flags); // Returns "Mature", "PG", etc. - static const char* accessToString(U8 access); + static std::string accessToString(U8 sim_access); - static U8 stringToAccess(const char* access_str); + static U8 stringToAccess(const std::string& access_str); // Returns "M", "PG", etc. - static const char* accessToShortString(U8 access); /* Flawfinder: ignore */ + static std::string accessToShortString(U8 sim_access); // helper function which just makes sure all interested parties // can process the message. @@ -320,8 +320,8 @@ protected: F32 mTimeDilation; // time dilation of physics simulation on simulator // simulator name - LLString mName; - LLString mZoning; + std::string mName; + std::string mZoning; // region/estate owner - usually null. LLUUID mOwnerID; diff --git a/indra/newview/llviewerstats.cpp b/indra/newview/llviewerstats.cpp index ab0ef9df4a..b90f665abd 100644 --- a/indra/newview/llviewerstats.cpp +++ b/indra/newview/llviewerstats.cpp @@ -64,7 +64,7 @@ class StatAttributes { public: - StatAttributes(const char *name, + StatAttributes(const char* name, const BOOL enabled, const BOOL is_timer) : mName(name), @@ -73,9 +73,9 @@ public: { } - const char *mName; - const BOOL mEnabled; - const BOOL mIsTimer; + std::string mName; + BOOL mEnabled; + BOOL mIsTimer; }; const StatAttributes STAT_INFO[LLViewerStats::ST_COUNT] = @@ -331,17 +331,17 @@ void LLViewerStats::addToMessage(LLSD &body) const } // static -const char *LLViewerStats::statTypeToText(EStatType type) -{ - if (type >= 0 && type < ST_COUNT) - { - return STAT_INFO[type].mName; - } - else - { - return "Unknown statistic"; - } -} +// const std::string LLViewerStats::statTypeToText(EStatType type) +// { +// if (type >= 0 && type < ST_COUNT) +// { +// return STAT_INFO[type].mName; +// } +// else +// { +// return "Unknown statistic"; +// } +// } // *NOTE:Mani The following methods used to exist in viewer.cpp // Moving them here, but not merging them into LLViewerStats yet. @@ -679,7 +679,7 @@ void send_stats() // send fps only for time app spends in foreground agent["fps"] = (F32)gForegroundFrameCount / gForegroundTime.getElapsedTimeF32(); agent["version"] = gCurrentVersion; - LLString language(gSavedSettings.getString("Language")); + std::string language(gSavedSettings.getString("Language")); if(language == "default") language = gSavedSettings.getString("SystemLanguage"); agent["language"] = language; diff --git a/indra/newview/llviewerstats.h b/indra/newview/llviewerstats.h index bd16e61149..ccd3110758 100644 --- a/indra/newview/llviewerstats.h +++ b/indra/newview/llviewerstats.h @@ -185,8 +185,6 @@ public: void addToMessage(LLSD &body) const; - static const char *statTypeToText(EStatType type); - private: F64 mStats[ST_COUNT]; diff --git a/indra/newview/llviewertexteditor.cpp b/indra/newview/llviewertexteditor.cpp index aba7d4dac4..0a11f79fd1 100644 --- a/indra/newview/llviewertexteditor.cpp +++ b/indra/newview/llviewertexteditor.cpp @@ -108,7 +108,7 @@ public: LLPreviewNotecard* preview; preview = new LLPreviewNotecard("preview notecard", rect, - LLString("Embedded Note: ") + item->getName(), + std::string("Embedded Note: ") + item->getName(), item->getUUID(), LLUUID::null, item->getAssetUUID(), @@ -561,10 +561,10 @@ struct LLNotecardCopyInfo // Member functions // -LLViewerTextEditor::LLViewerTextEditor(const LLString& name, +LLViewerTextEditor::LLViewerTextEditor(const std::string& name, const LLRect& rect, S32 max_length, - const LLString& default_text, + const std::string& default_text, const LLFontGL* font, BOOL allow_embedded_items) : LLTextEditor(name, rect, max_length, default_text, font, allow_embedded_items), @@ -581,7 +581,7 @@ LLViewerTextEditor::LLViewerTextEditor(const LLString& name, //LLMenuGL* menu = LLUICtrlFactory::getInstance()->buildMenu("menu_slurl.xml", this); //if (!menu) //{ - // menu = new LLMenuGL(""); + // menu = new LLMenuGL(LLStringUtil::null); //} //menu->setBackgroundColor(gColors.getColor("MenuPopupBgColor")); //// menu->setVisible(FALSE); @@ -608,7 +608,7 @@ void LLViewerTextEditor::makePristine() /////////////////////////////////////////////////////////////////// -BOOL LLViewerTextEditor::handleToolTip(S32 x, S32 y, LLString& msg, LLRect* sticky_rect_screen) +BOOL LLViewerTextEditor::handleToolTip(S32 x, S32 y, std::string& msg, LLRect* sticky_rect_screen) { for (child_list_const_iter_t child_iter = getChildList()->begin(); child_iter != getChildList()->end(); ++child_iter) @@ -1068,7 +1068,7 @@ BOOL LLViewerTextEditor::handleDoubleClick(S32 x, S32 y, MASK mask) BOOL LLViewerTextEditor::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, void *cargo_data, EAcceptance *accept, - LLString& tooltip_msg) + std::string& tooltip_msg) { BOOL handled = FALSE; @@ -1084,7 +1084,7 @@ BOOL LLViewerTextEditor::handleDragAndDrop(S32 x, S32 y, MASK mask, if (drop) { LLInventoryItem *item = (LLInventoryItem *)cargo_data; - LLString name = item->getName(); + std::string name = item->getName(); appendText(name, true, true); } *accept = ACCEPT_YES_COPY_SINGLE; @@ -1165,7 +1165,7 @@ BOOL LLViewerTextEditor::handleDragAndDrop(S32 x, S32 y, MASK mask, return handled; } -void LLViewerTextEditor::setASCIIEmbeddedText(const LLString& instr) +void LLViewerTextEditor::setASCIIEmbeddedText(const std::string& instr) { LLWString wtext; const U8* buffer = (U8*)(instr.c_str()); @@ -1187,7 +1187,7 @@ void LLViewerTextEditor::setASCIIEmbeddedText(const LLString& instr) setWText(wtext); } -void LLViewerTextEditor::setEmbeddedText(const LLString& instr) +void LLViewerTextEditor::setEmbeddedText(const std::string& instr) { LLWString wtext = utf8str_to_wstring(instr); for (S32 i=0; i<(S32)wtext.size(); i++) @@ -1202,7 +1202,7 @@ void LLViewerTextEditor::setEmbeddedText(const LLString& instr) setWText(wtext); } -LLString LLViewerTextEditor::getEmbeddedText() +std::string LLViewerTextEditor::getEmbeddedText() { #if 1 // New version (Version 2) @@ -1218,12 +1218,12 @@ LLString LLViewerTextEditor::getEmbeddedText() } outtextw.push_back(wch); } - LLString outtext = wstring_to_utf8str(outtextw); + std::string outtext = wstring_to_utf8str(outtextw); return outtext; #else // Old version (Version 1) mEmbeddedItemList->copyUsedCharsToIndexed(); - LLString outtext; + std::string outtext; for (S32 i=0; i<(S32)mWText.size(); i++) { llwchar wch = mWText[i]; @@ -1242,7 +1242,7 @@ LLString LLViewerTextEditor::getEmbeddedText() #endif } -LLString LLViewerTextEditor::appendTime(bool prepend_newline) +std::string LLViewerTextEditor::appendTime(bool prepend_newline) { time_t utc_time; utc_time = time_corrected(); @@ -1254,7 +1254,7 @@ LLString LLViewerTextEditor::appendTime(bool prepend_newline) // it's daylight savings time there. timep = utc_to_pacific_time(utc_time, gPacificDaylightTime); - LLString text = llformat("[%d:%02d] ", timep->tm_hour, timep->tm_min); + std::string text = llformat("[%d:%02d] ", timep->tm_hour, timep->tm_min); appendColoredText(text, false, prepend_newline, LLColor4::grey); return text; @@ -1411,8 +1411,8 @@ void LLViewerTextEditor::openEmbeddedSound( LLInventoryItem* item ) void LLViewerTextEditor::openEmbeddedLandmark( LLInventoryItem* item ) { - LLString title = - LLString(" ") + LLLandmarkBridge::prefix() + item->getName(); + std::string title = + std::string(" ") + LLLandmarkBridge::prefix() + item->getName(); open_landmark((LLViewerInventoryItem*)item, title, FALSE, item->getUUID(), TRUE); } @@ -1519,13 +1519,13 @@ bool LLViewerTextEditor::hasEmbeddedInventory() //////////////////////////////////////////////////////////////////////////// -BOOL LLViewerTextEditor::importBuffer( const LLString& buffer ) +BOOL LLViewerTextEditor::importBuffer( const char* buffer, S32 length ) { - LLMemoryStream str((U8*)buffer.c_str(), buffer.length()); + LLMemoryStream str((U8*)buffer, length); return importStream(str); } -BOOL LLViewerTextEditor::exportBuffer( LLString& buffer ) +BOOL LLViewerTextEditor::exportBuffer( std::string& buffer ) { LLNotecard nc(LLNotecard::MAX_SIZE); @@ -1547,7 +1547,7 @@ BOOL LLViewerTextEditor::exportBuffer( LLString& buffer ) LLView* LLViewerTextEditor::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory) { - LLString name("text_editor"); + std::string name("text_editor"); node->getAttributeString("name", name); LLRect rect; @@ -1561,8 +1561,8 @@ LLView* LLViewerTextEditor::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlF LLFontGL* font = LLView::selectFont(node); - // LLString text = node->getValue(); - LLString text = node->getTextContents().substr(0, max_text_length - 1); + // std::string text = node->getValue(); + std::string text = node->getTextContents().substr(0, max_text_length - 1); if (text.size() > max_text_length) { @@ -1573,7 +1573,7 @@ LLView* LLViewerTextEditor::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlF LLViewerTextEditor* text_editor = new LLViewerTextEditor(name, rect, max_text_length, - "", + LLStringUtil::null, font, allow_embedded_items); diff --git a/indra/newview/llviewertexteditor.h b/indra/newview/llviewertexteditor.h index 019375b010..7ce28fc60a 100644 --- a/indra/newview/llviewertexteditor.h +++ b/indra/newview/llviewertexteditor.h @@ -42,10 +42,10 @@ class LLViewerTextEditor : public LLTextEditor { public: - LLViewerTextEditor(const LLString& name, + LLViewerTextEditor(const std::string& name, const LLRect& rect, S32 max_length, - const LLString& default_text = LLString(), + const std::string& default_text = std::string(), const LLFontGL* glfont = NULL, BOOL allow_embedded_items = FALSE); @@ -62,28 +62,28 @@ public: virtual BOOL handleHover(S32 x, S32 y, MASK mask); virtual BOOL handleDoubleClick(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 handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, - void *cargo_data, EAcceptance *accept, LLString& tooltip_msg); + void *cargo_data, EAcceptance *accept, std::string& tooltip_msg); const class LLInventoryItem* getDragItem() const { return mDragItem; } - virtual BOOL importBuffer(const LLString& buffer); + virtual BOOL importBuffer(const char* buffer, S32 length); virtual bool importStream(std::istream& str); - virtual BOOL exportBuffer(LLString& buffer); + virtual BOOL exportBuffer(std::string& buffer); void setNotecardInfo(const LLUUID& notecard_item_id, const LLUUID& object_id) { mNotecardInventoryID = notecard_item_id; mObjectID = object_id; } - void setASCIIEmbeddedText(const LLString& instr); - void setEmbeddedText(const LLString& instr); - LLString getEmbeddedText(); + void setASCIIEmbeddedText(const std::string& instr); + void setEmbeddedText(const std::string& instr); + std::string getEmbeddedText(); // Appends Second Life time, small font, grey. // If this starts a line, you need to prepend a newline. - LLString appendTime(bool prepend_newline); + std::string appendTime(bool prepend_newline); void copyInventory(const LLInventoryItem* item, U32 callback_id = 0); diff --git a/indra/newview/llviewerthrottle.cpp b/indra/newview/llviewerthrottle.cpp index c23a74c533..28b3834de4 100644 --- a/indra/newview/llviewerthrottle.cpp +++ b/indra/newview/llviewerthrottle.cpp @@ -58,7 +58,7 @@ const F32 DYNAMIC_UPDATE_DURATION = 5.0f; // seconds LLViewerThrottle gViewerThrottle; // static -const char *LLViewerThrottle::sNames[TC_EOF] = { +const std:: string LLViewerThrottle::sNames[TC_EOF] = { "Resend", "Land", "Wind", diff --git a/indra/newview/llviewerthrottle.h b/indra/newview/llviewerthrottle.h index 4ef58083e5..19e9ce8e7a 100644 --- a/indra/newview/llviewerthrottle.h +++ b/indra/newview/llviewerthrottle.h @@ -77,7 +77,7 @@ public: LLViewerThrottleGroup getThrottleGroup(const F32 bandwidth_kbps); - static const char* sNames[TC_EOF]; /* Flawfinder: ignore */ + static const std::string sNames[TC_EOF]; protected: F32 mMaxBandwidth; F32 mCurrentBandwidth; diff --git a/indra/newview/llviewervisualparam.cpp b/indra/newview/llviewervisualparam.cpp index 3999eb0317..08bacab7c0 100644 --- a/indra/newview/llviewervisualparam.cpp +++ b/indra/newview/llviewervisualparam.cpp @@ -71,7 +71,7 @@ BOOL LLViewerVisualParamInfo::parseXml(LLXmlTreeNode *node) // VIEWER SPECIFIC PARAMS - LLString wearable; + std::string wearable; static LLStdStringHandle wearable_string = LLXmlTree::addAttributeString("wearable"); if( node->getFastAttributeString( wearable_string, wearable) ) { diff --git a/indra/newview/llviewervisualparam.h b/indra/newview/llviewervisualparam.h index b115fecc51..8dc4b16ac2 100644 --- a/indra/newview/llviewervisualparam.h +++ b/indra/newview/llviewervisualparam.h @@ -50,11 +50,11 @@ public: protected: S32 mWearableType; - LLString mEditGroup; + std::string mEditGroup; F32 mCamDist; F32 mCamAngle; // degrees F32 mCamElevation; - LLString mCamTargetName; + std::string mCamTargetName; F32 mEditGroupDisplayOrder; BOOL mShowSimple; // show edit controls when in "simple ui" mode? F32 mSimpleMin; // when in simple UI, apply this minimum, range 0.f to 100.f @@ -91,7 +91,7 @@ public: // interface methods F32 getDisplayOrder() { return getInfo()->mEditGroupDisplayOrder; } S32 getWearableType() const { return getInfo()->mWearableType; } - const LLString& getEditGroup() const { return getInfo()->mEditGroup; } + const std::string& getEditGroup() const { return getInfo()->mEditGroup; } F32 getCameraDistance() const { return getInfo()->mCamDist; } F32 getCameraAngle() const { return getInfo()->mCamAngle; } // degrees diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 8f79253cf3..068f4c86e9 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -112,7 +112,6 @@ #include "llframestatview.h" #include "llgesturemgr.h" #include "llglheaders.h" -#include "llhippo.h" #include "llhoverview.h" #include "llhudmanager.h" #include "llhudview.h" @@ -289,10 +288,10 @@ static F32 temp2 = 20.f; LLCoordGL new_gl; #endif //SABINRIG -char LLViewerWindow::sSnapshotBaseName[LL_MAX_PATH]; -char LLViewerWindow::sSnapshotDir[LL_MAX_PATH]; +std::string LLViewerWindow::sSnapshotBaseName; +std::string LLViewerWindow::sSnapshotDir; -char LLViewerWindow::sMovieBaseName[LL_MAX_PATH]; +std::string LLViewerWindow::sMovieBaseName; extern void toggle_debug_menus(void*); @@ -665,7 +664,7 @@ BOOL LLViewerWindow::handleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask x = llround((F32)x / mDisplayScale.mV[VX]); y = llround((F32)y / mDisplayScale.mV[VY]); - LLView::sMouseHandlerMessage = ""; + LLView::sMouseHandlerMessage.clear(); if (gDebugClicks) { @@ -773,7 +772,7 @@ BOOL LLViewerWindow::handleDoubleClick(LLWindow *window, LLCoordGL pos, MASK ma x = llround((F32)x / mDisplayScale.mV[VX]); y = llround((F32)y / mDisplayScale.mV[VY]); - LLView::sMouseHandlerMessage = ""; + LLView::sMouseHandlerMessage.clear(); if (gDebugClicks) { @@ -853,7 +852,7 @@ BOOL LLViewerWindow::handleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask) x = llround((F32)x / mDisplayScale.mV[VX]); y = llround((F32)y / mDisplayScale.mV[VY]); - LLView::sMouseHandlerMessage = ""; + LLView::sMouseHandlerMessage.clear(); if (gDebugClicks) { @@ -944,7 +943,7 @@ BOOL LLViewerWindow::handleRightMouseDown(LLWindow *window, LLCoordGL pos, MASK x = llround((F32)x / mDisplayScale.mV[VX]); y = llround((F32)y / mDisplayScale.mV[VY]); - LLView::sMouseHandlerMessage = ""; + LLView::sMouseHandlerMessage.clear(); if (gDebugClicks) { @@ -1051,7 +1050,7 @@ BOOL LLViewerWindow::handleRightMouseUp(LLWindow *window, LLCoordGL pos, MASK m x = llround((F32)x / mDisplayScale.mV[VX]); y = llround((F32)y / mDisplayScale.mV[VY]); - LLView::sMouseHandlerMessage = ""; + LLView::sMouseHandlerMessage.clear(); // Don't care about caps lock for mouse events. if (gDebugClicks) @@ -1406,24 +1405,23 @@ BOOL LLViewerWindow::handlePaint(LLWindow *window, S32 x, S32 y, S32 width, S //SetBKColor(hdc, RGB(255, 255, 255)); FillRect(hdc, &wnd_rect, CreateSolidBrush(RGB(255, 255, 255))); - LLString name_str; + std::string name_str; gAgent.getName(name_str); - S32 len; - char temp_str[255]; /* Flawfinder: ignore */ - snprintf(temp_str, sizeof(temp_str), "%s FPS %3.1f Phy FPS %2.1f Time Dil %1.3f", /* Flawfinder: ignore */ + std::string temp_str; + temp_str = llformat( "%s FPS %3.1f Phy FPS %2.1f Time Dil %1.3f", /* Flawfinder: ignore */ name_str.c_str(), LLViewerStats::getInstance()->mFPSStat.getMeanPerSec(), LLViewerStats::getInstance()->mSimPhysicsFPS.getPrev(0), LLViewerStats::getInstance()->mSimTimeDilation.getPrev(0)); - len = strlen(temp_str); /* Flawfinder: ignore */ - TextOutA(hdc, 0, 0, temp_str, len); + S32 len = temp_str.length(); + TextOutA(hdc, 0, 0, temp_str.c_str(), len); LLVector3d pos_global = gAgent.getPositionGlobal(); - snprintf(temp_str, sizeof(temp_str), "Avatar pos %6.1lf %6.1lf %6.1lf", pos_global.mdV[0], pos_global.mdV[1], pos_global.mdV[2]); /* Flawfinder: ignore */ - len = strlen(temp_str); /* Flawfinder: ignore */ - TextOutA(hdc, 0, 25, temp_str, len); + temp_str = llformat( "Avatar pos %6.1lf %6.1lf %6.1lf", pos_global.mdV[0], pos_global.mdV[1], pos_global.mdV[2]); + len = temp_str.length(); + TextOutA(hdc, 0, 25, temp_str.c_str(), len); TextOutA(hdc, 0, 50, "Set \"DisableRendering FALSE\" in settings.ini file to reenable", 61); EndPaint(window_handle, &ps); @@ -1492,7 +1490,7 @@ BOOL LLViewerWindow::handleDeviceChange(LLWindow *window) // Classes // LLViewerWindow::LLViewerWindow( - const char* title, const char* name, + const std::string& title, const std::string& name, S32 x, S32 y, S32 width, S32 height, BOOL fullscreen, BOOL ignore_pixel_depth) @@ -1515,9 +1513,9 @@ LLViewerWindow::LLViewerWindow( mIgnoreActivate( FALSE ) { // Default to application directory. - strcpy(LLViewerWindow::sSnapshotBaseName, "Snapshot"); /* Flawfinder: ignore */ - strcpy(LLViewerWindow::sMovieBaseName, "SLmovie"); /* Flawfinder: ignore */ - LLViewerWindow::sSnapshotDir[0] = '\0'; + LLViewerWindow::sSnapshotBaseName = "Snapshot"; + LLViewerWindow::sMovieBaseName = "SLmovie"; + LLViewerWindow::sSnapshotDir.clear(); // create window @@ -1626,7 +1624,7 @@ LLViewerWindow::LLViewerWindow( gShowOverlayTitle = gSavedSettings.getBOOL("ShowOverlayTitle"); mOverlayTitle = gSavedSettings.getString("OverlayTitle"); // Can't have spaces in settings.ini strings, so use underscores instead and convert them. - LLString::replaceChar(mOverlayTitle, '_', ' '); + LLStringUtil::replaceChar(mOverlayTitle, '_', ' '); LLAlertDialog::setDisplayCallback(alertCallback); // call this before calling any modal dialogs @@ -1757,7 +1755,7 @@ void LLViewerWindow::initBase() mRootView->addChild(gNotifyBoxView, -2); // Tooltips go above floaters - mToolTip = new LLTextBox( "tool tip", LLRect(0, 1, 1, 0 ) ); + mToolTip = new LLTextBox( std::string("tool tip"), LLRect(0, 1, 1, 0 ) ); mToolTip->setHPad( 4 ); mToolTip->setVPad( 2 ); mToolTip->setColor( gColors.getColor( "ToolTipTextColor" ) ); @@ -1770,14 +1768,14 @@ void LLViewerWindow::initBase() mToolTip->setVisible( FALSE ); // Add the progress bar view (startup view), which overrides everything - mProgressView = new LLProgressView("ProgressView", full_window); + mProgressView = new LLProgressView(std::string("ProgressView"), full_window); mRootView->addChild(mProgressView); setShowProgress(FALSE); - setProgressCancelButtonVisible(FALSE, ""); + setProgressCancelButtonVisible(FALSE); } -void adjust_rect_top_left(const LLString& control, const LLRect& window) +void adjust_rect_top_left(const std::string& control, const LLRect& window) { LLRect r = gSavedSettings.getRect(control); if (r.mLeft == 0 && r.mBottom == 0) @@ -1787,7 +1785,7 @@ void adjust_rect_top_left(const LLString& control, const LLRect& window) } } -void adjust_rect_top_center(const LLString& control, const LLRect& window) +void adjust_rect_top_center(const std::string& control, const LLRect& window) { LLRect r = gSavedSettings.getRect(control); if (r.mLeft == 0 && r.mBottom == 0) @@ -1800,7 +1798,7 @@ void adjust_rect_top_center(const LLString& control, const LLRect& window) } } -void adjust_rect_top_right(const LLString& control, const LLRect& window) +void adjust_rect_top_right(const std::string& control, const LLRect& window) { LLRect r = gSavedSettings.getRect(control); if (r.mLeft == 0 && r.mBottom == 0) @@ -1813,7 +1811,7 @@ void adjust_rect_top_right(const LLString& control, const LLRect& window) } } -void adjust_rect_bottom_center(const LLString& control, const LLRect& window) +void adjust_rect_bottom_center(const std::string& control, const LLRect& window) { LLRect r = gSavedSettings.getRect(control); if (r.mLeft == 0 && r.mBottom == 0) @@ -1829,7 +1827,7 @@ void adjust_rect_bottom_center(const LLString& control, const LLRect& window) } } -void adjust_rect_centered_partial_zoom(const LLString& control, +void adjust_rect_centered_partial_zoom(const std::string& control, const LLRect& window) { LLRect rect = gSavedSettings.getRect(control); @@ -1905,7 +1903,7 @@ void LLViewerWindow::initWorldUI() mRootView->addChild(gBottomPanel); // View for hover information - gHoverView = new LLHoverView("gHoverView", full_window); + gHoverView = new LLHoverView(std::string("gHoverView"), full_window); gHoverView->setVisible(TRUE); mRootView->addChild(gHoverView); @@ -1913,7 +1911,7 @@ void LLViewerWindow::initWorldUI() // Map // // TODO: Move instance management into class - gFloaterMap = new LLFloaterMap("Map"); + gFloaterMap = new LLFloaterMap(std::string("Map")); gFloaterMap->setFollows(FOLLOWS_TOP|FOLLOWS_RIGHT); // keep onscreen @@ -1929,7 +1927,7 @@ void LLViewerWindow::initWorldUI() LLRect morph_view_rect = full_window; morph_view_rect.stretch( -STATUS_BAR_HEIGHT ); morph_view_rect.mTop = full_window.mTop - 32; - gMorphView = new LLMorphView("gMorphView", morph_view_rect ); + gMorphView = new LLMorphView(std::string("gMorphView"), morph_view_rect ); mRootView->addChild(gMorphView); gMorphView->setVisible(FALSE); @@ -1956,7 +1954,7 @@ void LLViewerWindow::initWorldUI() S32 menu_bar_height = gMenuBarView->getRect().getHeight(); LLRect root_rect = getRootView()->getRect(); LLRect status_rect(0, root_rect.getHeight(), root_rect.getWidth(), root_rect.getHeight() - menu_bar_height); - gStatusBar = new LLStatusBar("status", status_rect); + gStatusBar = new LLStatusBar(std::string("status"), status_rect); gStatusBar->setFollows(FOLLOWS_LEFT | FOLLOWS_RIGHT | FOLLOWS_TOP); gStatusBar->reshape(root_rect.getWidth(), gStatusBar->getRect().getHeight(), TRUE); @@ -2211,7 +2209,7 @@ void LLViewerWindow::setNormalControlsVisible( BOOL visible ) void LLViewerWindow::setMenuBackgroundColor(bool god_mode, bool dev_grid) { - LLString::format_map_t args; + LLStringUtil::format_map_t args; LLColor4 new_bg_color; if(god_mode && LLViewerLogin::getInstance()->isInProductionGrid()) @@ -2283,7 +2281,7 @@ void LLViewerWindow::draw() if (gSavedSettings.getBOOL("DisplayTimecode")) { // draw timecode block - char text[256]; /* Flawfinder: ignore */ + std::string text; glLoadIdentity(); @@ -2457,15 +2455,6 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask) } } - // Example "bug" for bug reporter web page - if ((MASK_SHIFT & mask) - && (MASK_ALT & mask) - && (MASK_CONTROL & mask) - && ('H' == key || 'h' == key)) - { - trigger_hippo_bug(NULL); - } - // handle escape key if (key == KEY_ESCAPE && mask == MASK_NONE) { @@ -2663,7 +2652,7 @@ BOOL LLViewerWindow::handleUnicodeChar(llwchar uni_char, MASK mask) void LLViewerWindow::handleScrollWheel(S32 clicks) { - LLView::sMouseHandlerMessage = ""; + LLView::sMouseHandlerMessage.clear(); gMouseIdleTimer.reset(); @@ -2739,7 +2728,7 @@ BOOL LLViewerWindow::handlePerFrameHover() { static std::string last_handle_msg; - LLView::sMouseHandlerMessage = ""; + LLView::sMouseHandlerMessage.clear(); //RN: fix for asynchronous notification of mouse leaving window not working LLCoordWindow mouse_pos; @@ -2880,9 +2869,9 @@ BOOL LLViewerWindow::handlePerFrameHover() } else if (LLView::sDebugMouseHandling) { - if (last_handle_msg != "") + if (last_handle_msg != LLStringUtil::null) { - last_handle_msg = ""; + last_handle_msg.clear(); llinfos << "Hover not handled by view" << llendl; } } @@ -2927,7 +2916,7 @@ BOOL LLViewerWindow::handlePerFrameHover() //llinfos << (mToolTipBlocked ? "BLOCKED" : "NOT BLOCKED") << llendl; // Show a new tool tip (or update one that is alrady shown) BOOL tool_tip_handled = FALSE; - LLString tool_tip_msg; + std::string tool_tip_msg; F32 tooltip_delay = gSavedSettings.getF32( "ToolTipDelay" ); //HACK: hack for tool-based tooltips which need to pop up more quickly //Also for show xui names as tooltips debug mode @@ -4060,14 +4049,14 @@ BOOL LLViewerWindow::mousePointOnLandGlobal(const S32 x, const S32 y, LLVector3d } // Saves an image to the harddrive as "SnapshotX" where X >= 1. -BOOL LLViewerWindow::saveImageNumbered(LLImageRaw *raw, const LLString& extension_in) +BOOL LLViewerWindow::saveImageNumbered(LLImageRaw *raw, const std::string& extension_in) { if (! raw) { return FALSE; } - LLString extension(extension_in); + std::string extension(extension_in); if (extension.empty()) { extension = (gSavedSettings.getBOOL("CompressSnapshotsToDisk")) ? ".j2c" : ".bmp"; @@ -4084,75 +4073,41 @@ BOOL LLViewerWindow::saveImageNumbered(LLImageRaw *raw, const LLString& extensio pick_type = LLFilePicker::FFSAVE_ALL; // ??? // Get a directory if this is the first time. - if (strlen(sSnapshotDir) == 0) /* Flawfinder: ignore */ + if (sSnapshotDir.empty()) { - LLString proposed_name( sSnapshotBaseName ); + std::string proposed_name( sSnapshotBaseName ); proposed_name.append( extension ); // pick a directory in which to save LLFilePicker& picker = LLFilePicker::instance(); - if (!picker.getSaveFile(pick_type, proposed_name.c_str())) + if (!picker.getSaveFile(pick_type, proposed_name)) { // Clicked cancel return FALSE; } // Copy the directory + file name - char directory[LL_MAX_PATH]; /* Flawfinder: ignore */ - strncpy(directory, picker.getFirstFile(), LL_MAX_PATH -1); /* Flawfinder: ignore */ - directory[LL_MAX_PATH -1] = '\0'; - - // Smash the file extension - S32 length = strlen(directory); /* Flawfinder: ignore */ - S32 index = length; + std::string filepath = picker.getFirstFile(); - // Back up over extension - index -= extension.length(); - if (index >= 0 && directory[index] == '.') - { - directory[index] = '\0'; - } - else - { - index = length; - } - - // Find trailing backslash - while (index >= 0 && directory[index] != gDirUtilp->getDirDelimiter()[0]) - { - index--; - } - - // If we found one, truncate the string there - if (index >= 0) - { - if (index + 1 <= length) - { - strncpy(LLViewerWindow::sSnapshotBaseName, directory + index + 1, LL_MAX_PATH -1); /* Flawfinder: ignore */ - LLViewerWindow::sSnapshotBaseName[LL_MAX_PATH -1] = '\0'; - } - - index++; - directory[index] = '\0'; - strncpy(LLViewerWindow::sSnapshotDir, directory, LL_MAX_PATH -1); /* Flawfinder: ignore */ - LLViewerWindow::sSnapshotDir[LL_MAX_PATH -1] = '\0'; - } + LLViewerWindow::sSnapshotBaseName = gDirUtilp->getBaseFileName(filepath, true); + LLViewerWindow::sSnapshotDir = gDirUtilp->getDirName(filepath); } // Look for an unused file name - LLString filepath; + std::string filepath; S32 i = 1; S32 err = 0; do { filepath = sSnapshotDir; + filepath += gDirUtilp->getDirDelimiter(); filepath += sSnapshotBaseName; filepath += llformat("_%.3d",i); filepath += extension; - struct stat stat_info; - err = mWindow->stat( filepath.c_str(), &stat_info ); + llstat stat_info; + err = LLFile::stat( filepath, &stat_info ); i++; } while( -1 != err ); // search until the file is not found (i.e., stat() gives an error). @@ -4207,7 +4162,7 @@ void LLViewerWindow::movieSize(S32 new_width, S32 new_height) } } -BOOL LLViewerWindow::saveSnapshot( const LLString& filepath, S32 image_width, S32 image_height, BOOL show_ui, BOOL do_rebuild, ESnapshotType type) +BOOL LLViewerWindow::saveSnapshot( const std::string& filepath, S32 image_width, S32 image_height, BOOL show_ui, BOOL do_rebuild, ESnapshotType type) { llinfos << "Saving snapshot to: " << filepath << llendl; @@ -4657,7 +4612,7 @@ void LLViewerWindow::destroyWindow() void LLViewerWindow::drawMouselookInstructions() { // Draw instructions for mouselook ("Press ESC to leave Mouselook" in a box at the top of the screen.) - const char* instructions = "Press ESC to leave Mouselook."; + const std::string instructions = "Press ESC to leave Mouselook."; const LLFontGL* font = LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF ); const S32 INSTRUCTIONS_PAD = 5; @@ -4816,7 +4771,7 @@ void LLViewerWindow::moveProgressViewToFront() } } -void LLViewerWindow::setProgressString(const LLString& string) +void LLViewerWindow::setProgressString(const std::string& string) { if (mProgressView) { @@ -4824,7 +4779,7 @@ void LLViewerWindow::setProgressString(const LLString& string) } } -void LLViewerWindow::setProgressMessage(const LLString& msg) +void LLViewerWindow::setProgressMessage(const std::string& msg) { if(mProgressView) { @@ -4840,7 +4795,7 @@ void LLViewerWindow::setProgressPercent(const F32 percent) } } -void LLViewerWindow::setProgressCancelButtonVisible( BOOL b, const LLString& label ) +void LLViewerWindow::setProgressCancelButtonVisible( BOOL b, const std::string& label ) { if (mProgressView) { @@ -4908,7 +4863,7 @@ void LLViewerWindow::stopGL(BOOL save_state) } } -void LLViewerWindow::restoreGL(const LLString& progress_message) +void LLViewerWindow::restoreGL(const std::string& progress_message) { if (gGLManager.mIsDisabled) { @@ -5146,7 +5101,7 @@ BOOL LLViewerWindow::changeDisplaySettings(BOOL fullscreen, LLCoordScreen size, if (!result_first_try) { - LLStringBase<char>::format_map_t args; + LLStringUtil::format_map_t args; args["[RESX]"] = llformat("%d",size.mX); args["[RESY]"] = llformat("%d",size.mY); alertXml("ResolutionSwitchFail", args); @@ -5319,11 +5274,11 @@ bool LLViewerWindow::alertCallback(S32 modal) LLAlertDialog* LLViewerWindow::alertXml(const std::string& xml_filename, LLAlertDialog::alert_callback_t callback, void* user_data) { - LLString::format_map_t args; + LLStringUtil::format_map_t args; return alertXml( xml_filename, args, callback, user_data ); } -LLAlertDialog* LLViewerWindow::alertXml(const std::string& xml_filename, const LLString::format_map_t& args, +LLAlertDialog* LLViewerWindow::alertXml(const std::string& xml_filename, const LLStringUtil::format_map_t& args, LLAlertDialog::alert_callback_t callback, void* user_data) { if (gNoRender) @@ -5347,10 +5302,10 @@ LLAlertDialog* LLViewerWindow::alertXml(const std::string& xml_filename, const L return LLAlertDialog::showXml( xml_filename, args, callback, user_data ); } -LLAlertDialog* LLViewerWindow::alertXmlEditText(const std::string& xml_filename, const LLString::format_map_t& args, +LLAlertDialog* LLViewerWindow::alertXmlEditText(const std::string& xml_filename, const LLStringUtil::format_map_t& args, LLAlertDialog::alert_callback_t callback, void* user_data, LLAlertDialog::alert_text_callback_t text_callback, void *text_data, - const LLString::format_map_t& edit_args, BOOL draw_asterixes) + const LLStringUtil::format_map_t& edit_args, BOOL draw_asterixes) { if (gNoRender) { @@ -5387,7 +5342,7 @@ LLAlertDialog* LLViewerWindow::alertXmlEditText(const std::string& xml_filename, //////////////////////////////////////////////////////////////////////////// LLBottomPanel::LLBottomPanel(const LLRect &rect) : - LLPanel("", rect, FALSE), + LLPanel(LLStringUtil::null, rect, FALSE), mIndicator(NULL) { // bottom panel is focus root, so Tab moves through the toolbar and button bar, and overlay diff --git a/indra/newview/llviewerwindow.h b/indra/newview/llviewerwindow.h index 78afaf6cdf..997ac21dfd 100644 --- a/indra/newview/llviewerwindow.h +++ b/indra/newview/llviewerwindow.h @@ -68,7 +68,7 @@ public: // // CREATORS // - LLViewerWindow(const char* title, const char* name, S32 x, S32 y, S32 width, S32 height, BOOL fullscreen, BOOL ignore_pixel_depth); + LLViewerWindow(const std::string& title, const std::string& name, S32 x, S32 y, S32 width, S32 height, BOOL fullscreen, BOOL ignore_pixel_depth); virtual ~LLViewerWindow(); void initGLDefaults(); @@ -162,7 +162,7 @@ public: // The 'target' is where the user wants the window to be. It may not be // there yet, because we may be supressing fullscreen prior to login. - const LLString& getInitAlert() { return mInitAlert; } + const std::string& getInitAlert() { return mInitAlert; } // // MANIPULATORS @@ -177,10 +177,10 @@ public: void setShowProgress(const BOOL show); BOOL getShowProgress() const; void moveProgressViewToFront(); - void setProgressString(const LLString& string); + void setProgressString(const std::string& string); void setProgressPercent(const F32 percent); - void setProgressMessage(const LLString& msg); - void setProgressCancelButtonVisible( BOOL b, const LLString& label ); + void setProgressMessage(const std::string& msg); + void setProgressCancelButtonVisible( BOOL b, const std::string& label = LLStringUtil::null ); LLProgressView *getProgressView() const; void updateObjectUnderCursor(); @@ -226,11 +226,11 @@ public: SNAPSHOT_TYPE_OBJECT_ID } ESnapshotType; - BOOL saveSnapshot(const LLString& filename, S32 image_width, S32 image_height, BOOL show_ui = TRUE, BOOL do_rebuild = FALSE, ESnapshotType type = SNAPSHOT_TYPE_COLOR); + BOOL saveSnapshot(const std::string& filename, S32 image_width, S32 image_height, BOOL show_ui = TRUE, BOOL do_rebuild = FALSE, ESnapshotType type = SNAPSHOT_TYPE_COLOR); BOOL rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_height, BOOL keep_window_aspect = TRUE, BOOL is_texture = FALSE, BOOL show_ui = TRUE, BOOL do_rebuild = FALSE, ESnapshotType type = SNAPSHOT_TYPE_COLOR, S32 max_size = MAX_IMAGE_SIZE ); BOOL thumbnailSnapshot(LLImageRaw *raw, S32 preview_width, S32 preview_height, BOOL show_ui, BOOL do_rebuild, ESnapshotType type) ; - BOOL saveImageNumbered(LLImageRaw *raw, const LLString& extension = LLString()); + BOOL saveImageNumbered(LLImageRaw *raw, const std::string& extension = std::string()); void playSnapshotAnimAndSound(); @@ -278,12 +278,12 @@ public: LLAlertDialog* alertXml(const std::string& xml_filename, LLAlertDialog::alert_callback_t callback = NULL, void* user_data = NULL); - LLAlertDialog* alertXml(const std::string& xml_filename, const LLString::format_map_t& args, + LLAlertDialog* alertXml(const std::string& xml_filename, const LLStringUtil::format_map_t& args, LLAlertDialog::alert_callback_t callback = NULL, void* user_data = NULL); - LLAlertDialog* alertXmlEditText(const std::string& xml_filename, const LLString::format_map_t& args, + LLAlertDialog* alertXmlEditText(const std::string& xml_filename, const LLStringUtil::format_map_t& args, LLAlertDialog::alert_callback_t callback, void* user_data, LLAlertDialog::alert_text_callback_t text_callback, void *text_data, - const LLString::format_map_t& edit_args = LLString::format_map_t(), + const LLStringUtil::format_map_t& edit_args = LLStringUtil::format_map_t(), BOOL draw_asterixes = FALSE); static bool alertCallback(S32 modal); @@ -298,7 +298,7 @@ private: void destroyWindow(); void drawMouselookInstructions(); void stopGL(BOOL save_state = TRUE); - void restoreGL(const LLString& progress_message = LLString::null); + void restoreGL(const std::string& progress_message = LLStringUtil::null); void initFonts(F32 zoom_factor = 1.f); void analyzeHit( @@ -354,20 +354,20 @@ protected: BOOL mPickPending; void (*mPickCallback)(S32 x, S32 y, MASK mask); - LLString mOverlayTitle; // Used for special titles such as "Second Life - Special E3 2003 Beta" + std::string mOverlayTitle; // Used for special titles such as "Second Life - Special E3 2003 Beta" BOOL mIgnoreActivate; U8* mPickBuffer; - LLString mInitAlert; // Window / GL initialization requires an alert + std::string mInitAlert; // Window / GL initialization requires an alert class LLDebugText* mDebugText; // Internal class for debug text protected: - static char sSnapshotBaseName[LL_MAX_PATH]; /* Flawfinder: ignore */ - static char sSnapshotDir[LL_MAX_PATH]; /* Flawfinder: ignore */ + static std::string sSnapshotBaseName; + static std::string sSnapshotDir; - static char sMovieBaseName[LL_MAX_PATH]; /* Flawfinder: ignore */ + static std::string sMovieBaseName; }; class LLBottomPanel : public LLPanel @@ -391,7 +391,7 @@ void toggle_flying(void*); void toggle_first_person(); void toggle_build(void*); void reset_viewer_state_on_sim(void); -void update_saved_window_size(const LLString& control,S32 delta_width, S32 delta_height); +void update_saved_window_size(const std::string& control,S32 delta_width, S32 delta_height); // // Constants // diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 2e001a50c7..4b7ad71e80 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -718,8 +718,6 @@ LLVOAvatar::LLVOAvatar( mSpeed = 0.f; setAnimationData("Speed", &mSpeed); - strcpy(mAvatarDefinition, AVATAR_DEFAULT_CHAR); /* Flawfinder: ignore */ - if (id == gAgentID) { mIsSelf = TRUE; @@ -1358,9 +1356,9 @@ void LLVOAvatar::initClass() { LLVOAvatar::sMaxOtherAvatarsToComposite = gSavedSettings.getS32("AvatarCompositeLimit"); - char xmlFile[MAX_PATH]; /* Flawfinder: ignore */ + std::string xmlFile; - snprintf(xmlFile, MAX_PATH, "%s_lad.xml", gDirUtilp->getExpandedFilename(LL_PATH_CHARACTER,AVATAR_DEFAULT_CHAR).c_str()); /* Flawfinder: ignore */ + xmlFile = gDirUtilp->getExpandedFilename(LL_PATH_CHARACTER,AVATAR_DEFAULT_CHAR) + "_lad.xml"; BOOL success = sXMLTree.parseFile( xmlFile, FALSE ); if (!success) { @@ -1383,7 +1381,7 @@ void LLVOAvatar::initClass() llerrs << "Invalid avatar file header: " << xmlFile << llendl; } - LLString version; + std::string version; static LLStdStringHandle version_string = LLXmlTree::addAttributeString("version"); if( !root->getFastAttributeString( version_string, version ) || (version != "1.0") ) { @@ -1395,7 +1393,7 @@ void LLVOAvatar::initClass() root->getFastAttributeS32( wearable_definition_version_string, wearable_def_version ); LLWearable::setCurrentDefinitionVersion( wearable_def_version ); - LLString mesh_file_name; + std::string mesh_file_name; LLXmlTreeNode* skeleton_node = root->getChildByName( "skeleton" ); if (!skeleton_node) @@ -1404,7 +1402,7 @@ void LLVOAvatar::initClass() return; } - LLString skeleton_file_name; + std::string skeleton_file_name; static LLStdStringHandle file_name_string = LLXmlTree::addAttributeString("file_name"); if (!skeleton_node->getFastAttributeString(file_name_string, skeleton_file_name)) { @@ -1569,7 +1567,7 @@ void LLVOAvatar::getSpatialExtents(LLVector3& newMin, LLVector3& newMax) //----------------------------------------------------------------------------- // parseSkeletonFile() //----------------------------------------------------------------------------- -BOOL LLVOAvatar::parseSkeletonFile(const LLString& filename) +BOOL LLVOAvatar::parseSkeletonFile(const std::string& filename) { LLMemType mt(LLMemType::MTYPE_AVATAR); @@ -1596,7 +1594,7 @@ BOOL LLVOAvatar::parseSkeletonFile(const LLString& filename) llerrs << "Invalid avatar skeleton file header: " << filename << llendl; } - LLString version; + std::string version; static LLStdStringHandle version_string = LLXmlTree::addAttributeString("version"); if( !root->getFastAttributeString( version_string, version ) || (version != "1.0") ) { @@ -1815,7 +1813,6 @@ void LLVOAvatar::buildCharacter() if ( mIsSelf ) { llerrs << "Unable to load user's avatar" << llendl; - //set_avatar_character( &LLString(AVATAR_DEFAULT_CHAR)); } else { @@ -1925,23 +1922,24 @@ void LLVOAvatar::buildCharacter() //------------------------------------------------------------------------- if (mIsSelf) { + // *TODO: Translate gAttachBodyPartPieMenus[0] = NULL; - gAttachBodyPartPieMenus[1] = new LLPieMenu("Right Arm >"); - gAttachBodyPartPieMenus[2] = new LLPieMenu("Head >"); - gAttachBodyPartPieMenus[3] = new LLPieMenu("Left Arm >"); + gAttachBodyPartPieMenus[1] = new LLPieMenu(std::string("Right Arm >")); + gAttachBodyPartPieMenus[2] = new LLPieMenu(std::string("Head >")); + gAttachBodyPartPieMenus[3] = new LLPieMenu(std::string("Left Arm >")); gAttachBodyPartPieMenus[4] = NULL; - gAttachBodyPartPieMenus[5] = new LLPieMenu("Left Leg >"); - gAttachBodyPartPieMenus[6] = new LLPieMenu("Torso >"); - gAttachBodyPartPieMenus[7] = new LLPieMenu("Right Leg >"); + gAttachBodyPartPieMenus[5] = new LLPieMenu(std::string("Left Leg >")); + gAttachBodyPartPieMenus[6] = new LLPieMenu(std::string("Torso >")); + gAttachBodyPartPieMenus[7] = new LLPieMenu(std::string("Right Leg >")); gDetachBodyPartPieMenus[0] = NULL; - gDetachBodyPartPieMenus[1] = new LLPieMenu("Right Arm >"); - gDetachBodyPartPieMenus[2] = new LLPieMenu("Head >"); - gDetachBodyPartPieMenus[3] = new LLPieMenu("Left Arm >"); + gDetachBodyPartPieMenus[1] = new LLPieMenu(std::string("Right Arm >")); + gDetachBodyPartPieMenus[2] = new LLPieMenu(std::string("Head >")); + gDetachBodyPartPieMenus[3] = new LLPieMenu(std::string("Left Arm >")); gDetachBodyPartPieMenus[4] = NULL; - gDetachBodyPartPieMenus[5] = new LLPieMenu("Left Leg >"); - gDetachBodyPartPieMenus[6] = new LLPieMenu("Torso >"); - gDetachBodyPartPieMenus[7] = new LLPieMenu("Right Leg >"); + gDetachBodyPartPieMenus[5] = new LLPieMenu(std::string("Left Leg >")); + gDetachBodyPartPieMenus[6] = new LLPieMenu(std::string("Torso >")); + gDetachBodyPartPieMenus[7] = new LLPieMenu(std::string("Right Leg >")); for (S32 i = 0; i < 8; i++) { @@ -2510,7 +2508,7 @@ void LLVOAvatar::idleUpdateVoiceVisualizer(bool voice_enabled) { if ( mCurrentGesticulationLevel != VOICE_GESTICULATION_LEVEL_OFF ) { - LLString gestureString = "unInitialized"; + std::string gestureString = "unInitialized"; if ( mCurrentGesticulationLevel == 0 ) { gestureString = "/voicelevel1"; } else if ( mCurrentGesticulationLevel == 1 ) { gestureString = "/voicelevel2"; } else if ( mCurrentGesticulationLevel == 2 ) { gestureString = "/voicelevel3"; } @@ -4405,7 +4403,7 @@ void LLVOAvatar::updateTextures(LLAgent &agent) { llwarns << "LLVOAvatar::updateTextures No host for texture " << imagep->getID() << " for avatar " - << (mIsSelf ? "<myself>" : getID().asString().c_str()) + << (mIsSelf ? "<myself>" : getID().asString()) << " on host " << getRegion()->getHost() << llendl; } @@ -5487,7 +5485,7 @@ BOOL LLVOAvatar::loadMeshNodes() iter != sAvatarInfo->mMeshInfoList.end(); iter++) { LLVOAvatarInfo::LLVOAvatarMeshInfo *info = *iter; - LLString &type = info->mType; + std::string &type = info->mType; S32 lod = info->mLOD; LLViewerJointMesh* mesh = NULL; @@ -5687,7 +5685,7 @@ BOOL LLVOAvatar::loadMeshNodes() } // Multimap insert - mMeshes.insert(std::pair<LLString, LLPolyMesh*>(info->mMeshFileName, poly_mesh)); + mMeshes.insert(std::make_pair(info->mMeshFileName, poly_mesh)); mesh->setMesh( poly_mesh ); @@ -6402,7 +6400,7 @@ LLViewerObject* LLVOAvatar::getWornAttachment( const LLUUID& inv_item_id ) return NULL; } -const LLString LLVOAvatar::getAttachedPointName(const LLUUID& inv_item_id) +const std::string LLVOAvatar::getAttachedPointName(const LLUUID& inv_item_id) { for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); iter != mAttachmentPoints.end(); ) @@ -6411,11 +6409,11 @@ const LLString LLVOAvatar::getAttachedPointName(const LLUUID& inv_item_id) LLViewerJointAttachment* attachment = curiter->second; if( attachment->getItemID() == inv_item_id ) { - return (LLString)attachment->getName(); + return attachment->getName(); } } - return LLString::null; + return LLStringUtil::null; } @@ -6499,7 +6497,7 @@ void LLVOAvatar::updateComposites() } } -LLColor4 LLVOAvatar::getGlobalColor( const LLString& color_name ) +LLColor4 LLVOAvatar::getGlobalColor( const std::string& color_name ) { if( color_name=="skin_color" && mTexSkinColor ) { @@ -8008,7 +8006,7 @@ LLColor4 LLVOAvatar::getClothesColor( ETextureIndex te ) -void LLVOAvatar::dumpAvatarTEs( const char* context ) +void LLVOAvatar::dumpAvatarTEs( const std::string& context ) { llinfos << (mIsSelf ? "Self: " : "Other: ") << context << llendl; for( S32 i=0; i<TEX_NUM_ENTRIES; i++ ) @@ -8826,8 +8824,8 @@ void LLVOAvatar::dumpArchetypeXML( void* ) // only body parts, not clothing. for( S32 type = WT_SHAPE; type <= WT_EYES; type++ ) { - const char* wearable_name = LLWearable::typeToTypeName( (EWearableType) type ); - apr_file_printf( file, "\n\t\t<!-- wearable: %s -->\n", wearable_name ); + const std::string& wearable_name = LLWearable::typeToTypeName( (EWearableType) type ); + apr_file_printf( file, "\n\t\t<!-- wearable: %s -->\n", wearable_name.c_str() ); for( LLVisualParam* param = avatar->getFirstVisualParam(); param; param = avatar->getNextVisualParam() ) { @@ -8847,9 +8845,9 @@ void LLVOAvatar::dumpArchetypeXML( void* ) LLViewerImage* te_image = avatar->getTEImage( te ); if( te_image ) { - char uuid_str[UUID_STR_LENGTH]; /* Flawfinder: ignore */ + std::string uuid_str; te_image->getID().toString( uuid_str ); - apr_file_printf( file, "\t\t<texture te=\"%i\" uuid=\"%s\"/>\n", te, uuid_str); + apr_file_printf( file, "\t\t<texture te=\"%i\" uuid=\"%s\"/>\n", te, uuid_str.c_str()); } } } @@ -9480,7 +9478,7 @@ BOOL LLVOAvatarInfo::parseXmlColorNodes(LLXmlTreeNode* root) color_node; color_node = root->getNextNamedChild()) { - LLString global_color_name; + std::string global_color_name; static LLStdStringHandle name_string = LLXmlTree::addAttributeString("name"); if (color_node->getFastAttributeString( name_string, global_color_name ) ) { @@ -9620,9 +9618,9 @@ void LLVOAvatar::updateRegion(LLViewerRegion *regionp) } } -LLString LLVOAvatar::getFullname() const +std::string LLVOAvatar::getFullname() const { - LLString name; + std::string name; LLNameValue* first = getNVPair("FirstName"); LLNameValue* last = getNVPair("LastName"); diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index d958c40eb2..b991ae305e 100644 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -128,7 +128,7 @@ public: BOOL parseXml(LLXmlTreeNode* node); protected: - LLString mName; + std::string mName; BOOL mIsJoint; LLVector3 mPos; LLVector3 mRot; @@ -194,10 +194,10 @@ protected: mPolyMorphTargetInfoList.clear(); } - LLString mType; + std::string mType; S32 mLOD; - LLString mMeshFileName; - LLString mReferenceMeshName; + std::string mMeshFileName; + std::string mReferenceMeshName; F32 mMinPixelArea; morph_info_list_t mPolyMorphTargetInfoList; }; @@ -212,8 +212,8 @@ protected: LLVOAvatarAttachmentInfo() : mGroup(-1), mAttachmentID(-1), mPieMenuSlice(-1), mVisibleFirstPerson(FALSE), mIsHUDAttachment(FALSE), mHasPosition(FALSE), mHasRotation(FALSE) {} - LLString mName; - LLString mJointName; + std::string mName; + std::string mJointName; LLVector3 mPosition; LLVector3 mRotationEuler; S32 mGroup; @@ -277,7 +277,7 @@ public: //-------------------------------------------------------------------- static void initClass(); // Initialize data that's only inited once per class. static void cleanupClass(); // Cleanup data that's only inited once per class. - static BOOL parseSkeletonFile(const LLString& filename); + static BOOL parseSkeletonFile(const std::string& filename); virtual U32 processUpdateMessage( LLMessageSystem *mesgsys, void **user_data, U32 block_num, @@ -454,7 +454,7 @@ public: void stopTyping() { mTyping = FALSE; } // Returns "FirstName LastName" - LLString getFullname() const; + std::string getFullname() const; //-------------------------------------------------------------------- // internal (pseudo-private) functions @@ -510,7 +510,7 @@ public: BOOL isWearingAttachment( const LLUUID& inv_item_id ); LLViewerObject* getWornAttachment( const LLUUID& inv_item_id ); - const LLString getAttachedPointName(const LLUUID& inv_item_id); + const std::string getAttachedPointName(const LLUUID& inv_item_id); static LLVOAvatar* findAvatarFromAttachment( LLViewerObject* obj ); @@ -541,7 +541,7 @@ public: //-------------------------------------------------------------------- // texture compositing (used only by the LLTexLayer series of classes) //-------------------------------------------------------------------- - LLColor4 getGlobalColor( const LLString& color_name ); + LLColor4 getGlobalColor( const std::string& color_name ); BOOL isLocalTextureDataAvailable( LLTexLayerSet* layerset ); BOOL isLocalTextureDataFinal( LLTexLayerSet* layerset ); ETextureIndex getBakedTE( LLTexLayerSet* layerset ); @@ -602,11 +602,6 @@ public: BOOL mIsBuilt; //-------------------------------------------------------------------- - // avatar definition name - //-------------------------------------------------------------------- - char mAvatarDefinition[64]; /* Flawfinder: ignore */ - - //-------------------------------------------------------------------- // skeleton for skinned avatar //-------------------------------------------------------------------- S32 mNumJoints; @@ -694,7 +689,7 @@ public: LLViewerJointMesh mSkirtMesh3; LLViewerJointMesh mSkirtMesh4; - typedef std::multimap<LLString, LLPolyMesh*> mesh_map_t; + typedef std::multimap<std::string, LLPolyMesh*> mesh_map_t; mesh_map_t mMeshes; //-------------------------------------------------------------------- @@ -924,7 +919,7 @@ protected: F32 mAdjustedPixelArea; LLWString mNameString; - LLString mTitle; + std::string mTitle; BOOL mNameAway; BOOL mNameBusy; BOOL mNameMute; @@ -932,8 +927,7 @@ protected: BOOL mVisibleChat; BOOL mRenderGroupTitles; - - LLString mDebugText; + std::string mDebugText; U64 mLastRegionHandle; LLFrameTimer mRegionCrossingTimer; S32 mRegionCrossingCount; @@ -1013,7 +1007,7 @@ protected: static void onInitialBakedTextureLoaded( BOOL success, LLViewerImage *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata ); static void onBakedTextureLoaded(BOOL success, LLViewerImage *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata); void useBakedTexture(const LLUUID& id); - void dumpAvatarTEs(const char* context); + void dumpAvatarTEs(const std::string& context); void removeMissingBakedTextures(); LLTexLayerSet* getLayerSet(ETextureIndex index) const; LLHost getObjectHost() const; diff --git a/indra/newview/llvograss.cpp b/indra/newview/llvograss.cpp index 54dabe5615..cc7d73e37a 100644 --- a/indra/newview/llvograss.cpp +++ b/indra/newview/llvograss.cpp @@ -172,7 +172,7 @@ void LLVOGrass::initClass() if (newGrass->mTextureID.isNull()) { - LLString textureName; + std::string textureName; static LLStdStringHandle texture_name_string = LLXmlTree::addAttributeString("texture_name"); success &= grass_def->getFastAttributeString(texture_name_string, textureName); @@ -203,7 +203,7 @@ void LLVOGrass::initClass() if (!success) { - LLString name; + std::string name; static LLStdStringHandle name_string = LLXmlTree::addAttributeString("name"); grass_def->getFastAttributeString(name_string, name); llwarns << "Incomplete definition of grass " << name << llendl; @@ -211,22 +211,20 @@ void LLVOGrass::initClass() } BOOL have_all_grass = TRUE; - LLString err; - char buffer[10]; /* Flawfinder: ignore */ + std::string err; for (S32 i=0;i<sMaxGrassSpecies;++i) { if (!sSpeciesTable.count(i)) { - snprintf(buffer,10," %d",i); /* Flawfinder: ignore */ - err.append(buffer); + err.append(llformat(" %d",i)); have_all_grass = FALSE; } } if (!have_all_grass) { - LLStringBase<char>::format_map_t args; + LLStringUtil::format_map_t args; args["[SPECIES]"] = err; gViewerWindow->alertXml("ErrorUndefinedGrasses", args, alert_done ); } diff --git a/indra/newview/llvoiceclient.cpp b/indra/newview/llvoiceclient.cpp index b3b82d9c79..222ce45d9d 100644 --- a/indra/newview/llvoiceclient.cpp +++ b/indra/newview/llvoiceclient.cpp @@ -1,4 +1,4 @@ -/** + /** * @file llvoiceclient.cpp * @brief Implementation of LLVoiceClient class which is the interface to the voice client process. * @@ -421,7 +421,7 @@ void LLVivoxProtocolParser::StartTag(const char *tag, const char **attr) void LLVivoxProtocolParser::EndTag(const char *tag) { - const char *string = textBuffer.c_str(); + const std::string& string = textBuffer; bool clearbuffer = true; responseDepth--; @@ -445,9 +445,9 @@ void LLVivoxProtocolParser::EndTag(const char *tag) // Closing a tag. Finalize the text we've accumulated and reset if (strcmp("ReturnCode", tag) == 0) - returnCode = strtol(string, NULL, 10); + returnCode = strtol(string.c_str(), NULL, 10); else if (strcmp("StatusCode", tag) == 0) - statusCode = strtol(string, NULL, 10); + statusCode = strtol(string.c_str(), NULL, 10); else if (strcmp("ConnectorHandle", tag) == 0) connectorHandle = string; else if (strcmp("AccountHandle", tag) == 0) @@ -462,11 +462,11 @@ void LLVivoxProtocolParser::EndTag(const char *tag) else if (strcmp("StatusString", tag) == 0) statusString = string; else if (strcmp("State", tag) == 0) - state = strtol(string, NULL, 10); + state = strtol(string.c_str(), NULL, 10); else if (strcmp("URI", tag) == 0) uriString = string; else if (strcmp("IsChannel", tag) == 0) - isChannel = strcmp(string, "true") == 0; + isChannel = string == "true" ? true : false; else if (strcmp("Name", tag) == 0) nameString = string; else if (strcmp("AudioMedia", tag) == 0) @@ -480,19 +480,19 @@ void LLVivoxProtocolParser::EndTag(const char *tag) else if (strcmp("AccountName", tag) == 0) nameString = string; else if (strcmp("ParticipantTyppe", tag) == 0) - participantType = strtol(string, NULL, 10); + participantType = strtol(string.c_str(), NULL, 10); else if (strcmp("IsLocallyMuted", tag) == 0) - isLocallyMuted = strcmp(string, "true") == 0; + isLocallyMuted = string == "true" ? true : false; else if (strcmp("IsModeratorMuted", tag) == 0) - isModeratorMuted = strcmp(string, "true") == 0; + isModeratorMuted = string == "true" ? true : false; else if (strcmp("IsSpeaking", tag) == 0) - isSpeaking = strcmp(string, "true") == 0; + isSpeaking = string == "true" ? true : false; else if (strcmp("Volume", tag) == 0) - volume = strtol(string, NULL, 10); + volume = strtol(string.c_str(), NULL, 10); else if (strcmp("Energy", tag) == 0) - energy = (F32)strtod(string, NULL); + energy = (F32)strtod(string.c_str(), NULL); else if (strcmp("MicEnergy", tag) == 0) - energy = (F32)strtod(string, NULL); + energy = (F32)strtod(string.c_str(), NULL); else if (strcmp("ChannelName", tag) == 0) nameString = string; else if (strcmp("ChannelURI", tag) == 0) @@ -1096,9 +1096,9 @@ void LLVoiceClient::idle(void* user_data) self->stateMachine(); } -const char *LLVoiceClient::state2string(LLVoiceClient::state inState) +std::string LLVoiceClient::state2string(LLVoiceClient::state inState) { - const char *result = "UNKNOWN"; + std::string result = "UNKNOWN"; // Prevent copy-paste errors when updating this list... #define CASE(x) case x: result = #x; break @@ -1148,9 +1148,9 @@ const char *LLVoiceClient::state2string(LLVoiceClient::state inState) return result; } -const char *LLVoiceClientStatusObserver::status2string(LLVoiceClientStatusObserver::EStatusType inStatus) +std::string LLVoiceClientStatusObserver::status2string(LLVoiceClientStatusObserver::EStatusType inStatus) { - const char *result = "UNKNOWN"; + std::string result = "UNKNOWN"; // Prevent copy-paste errors when updating this list... #define CASE(x) case x: result = #x; break @@ -1279,7 +1279,7 @@ void LLVoiceClient::stateMachine() #endif // See if the vivox executable exists llstat s; - if(!LLFile::stat(exe_path.c_str(), &s)) + if(!LLFile::stat(exe_path, &s)) { // vivox executable exists. Build the command line and launch the daemon. std::string args = " -p tcp -h -c"; @@ -1325,7 +1325,7 @@ void LLVoiceClient::stateMachine() // This should be the same for mac and linux { std::vector<std::string> arglist; - arglist.push_back(exe_path.c_str()); + arglist.push_back(exe_path); // Split the argument string into separate strings for each argument typedef boost::tokenizer<boost::char_separator<char> > tokenizer; @@ -1376,7 +1376,7 @@ void LLVoiceClient::stateMachine() // To do this, launch the gateway on a nearby host like this: // vivox-gw.exe -p tcp -i 0.0.0.0:44124 // and put that host's IP address here. - mDaemonHost = LLHost(gSavedSettings.getString("VoiceHost").c_str(), gSavedSettings.getU32("VoicePort")); + mDaemonHost = LLHost(gSavedSettings.getString("VoiceHost"), gSavedSettings.getU32("VoicePort")); } mUpdateTimer.start(); @@ -2927,9 +2927,9 @@ void LLVoiceClient::sessionNewEvent( LLIMMgr::computeSessionID( IM_SESSION_P2P_INVITE, caller_id), - LLString::null, + LLStringUtil::null, caller_id, - LLString::null, + LLStringUtil::null, IM_SESSION_P2P_INVITE, LLIMMgr::INVITATION_TYPE_VOICE, eventSessionHandle); @@ -3426,8 +3426,8 @@ std::string LLVoiceClient::nameFromAvatar(LLVOAvatar *avatar) std::string LLVoiceClient::nameFromID(const LLUUID &uuid) { std::string result; - U8 rawuuid[UUID_BYTES + 1]; - uuid.toCompressedString((char*)rawuuid); + std::string rawuuid; + uuid.toCompressedString(rawuuid); // Prepending this apparently prevents conflicts with reserved names inside the vivox and diamondware code. result = "x"; @@ -3435,9 +3435,9 @@ std::string LLVoiceClient::nameFromID(const LLUUID &uuid) // Base64 encode and replace the pieces of base64 that are less compatible // with e-mail local-parts. // See RFC-4648 "Base 64 Encoding with URL and Filename Safe Alphabet" - result += LLBase64::encode(rawuuid, UUID_BYTES); - LLString::replaceChar(result, '+', '-'); - LLString::replaceChar(result, '/', '_'); + result += LLBase64::encode((const U8*)rawuuid.c_str(), UUID_BYTES); + LLStringUtil::replaceChar(result, '+', '-'); + LLStringUtil::replaceChar(result, '/', '_'); // If you need to transform a GUID to this form on the Mac OS X command line, this will do so: // echo -n x && (echo e669132a-6c43-4ee1-a78d-6c82fff59f32 |xxd -r -p |openssl base64|tr '/+' '_-') @@ -3459,8 +3459,8 @@ bool LLVoiceClient::IDFromName(const std::string name, LLUUID &uuid) // Reverse the transforms done by nameFromID std::string temp = name; - LLString::replaceChar(temp, '-', '+'); - LLString::replaceChar(temp, '_', '/'); + LLStringUtil::replaceChar(temp, '-', '+'); + LLStringUtil::replaceChar(temp, '_', '/'); U8 rawuuid[UUID_BYTES + 1]; int len = apr_base64_decode_binary(rawuuid, temp.c_str() + 1); @@ -3490,7 +3490,7 @@ std::string LLVoiceClient::sipURIFromName(std::string &name) result += "@"; result += mAccountServerName; -// LLString::toLower(result); +// LLStringUtil::toLower(result); return result; } @@ -3855,9 +3855,9 @@ F32 LLVoiceClient::getCurrentPower(const LLUUID& id) } -LLString LLVoiceClient::getDisplayName(const LLUUID& id) +std::string LLVoiceClient::getDisplayName(const LLUUID& id) { - LLString result; + std::string result; participantState *participant = findParticipantByID(id); if(participant) { @@ -4054,17 +4054,17 @@ void LLVoiceClient::notifyStatusObservers(LLVoiceClientStatusObserver::EStatusTy } //static -void LLVoiceClient::onAvatarNameLookup(const LLUUID& id, const char* first, const char* last, BOOL is_group, void* user_data) -{ - participantState* statep = gVoiceClient->findParticipantByID(id); - - if (statep) - { - statep->mDisplayName = llformat("%s %s", first, last); - } +// void LLVoiceClient::onAvatarNameLookup(const LLUUID& id, const std::string& first, const std::string& last, BOOL is_group, void* user_data) +// { +// participantState* statep = gVoiceClient->findParticipantByID(id); + +// if (statep) +// { +// statep->mDisplayName = first + " " + last; +// } - gVoiceClient->notifyObservers(); -} +// gVoiceClient->notifyObservers(); +// } class LLViewerParcelVoiceInfo : public LLHTTPNode { diff --git a/indra/newview/llvoiceclient.h b/indra/newview/llvoiceclient.h index 8c3637830d..85a1674d98 100644 --- a/indra/newview/llvoiceclient.h +++ b/indra/newview/llvoiceclient.h @@ -74,7 +74,7 @@ public: virtual ~LLVoiceClientStatusObserver() { } virtual void onChange(EStatusType status, const std::string &channelURI, bool proximal) = 0; - static const char *status2string(EStatusType inStatus); + static std::string status2string(EStatusType inStatus); }; class LLVoiceClient: public LLSingleton<LLVoiceClient> @@ -227,7 +227,7 @@ class LLVoiceClient: public LLSingleton<LLVoiceClient> BOOL getPTTPressed(const LLUUID& id); // This is the inverse of the "locally muted" property. BOOL getOnMuteList(const LLUUID& id); F32 getUserVolume(const LLUUID& id); - LLString getDisplayName(const LLUUID& id); + std::string getDisplayName(const LLUUID& id); // MBW -- XXX -- Not sure how to get this data out of the TVC BOOL getUsingPTT(const LLUUID& id); @@ -274,7 +274,7 @@ class LLVoiceClient: public LLSingleton<LLVoiceClient> void addStatusObserver(LLVoiceClientStatusObserver* observer); void removeStatusObserver(LLVoiceClientStatusObserver* observer); - static void onAvatarNameLookup(const LLUUID& id, const char* first, const char* last, BOOL is_group, void* user_data); +// static void onAvatarNameLookup(const LLUUID& id, const std::string& first, const std::string& last, BOOL is_group, void* user_data); typedef std::vector<std::string> deviceList; deviceList *getCaptureDevices(); @@ -357,7 +357,7 @@ class LLVoiceClient: public LLSingleton<LLVoiceClient> void setState(state inState); state getState(void) { return mState; }; - static const char *state2string(state inState); + static std::string state2string(state inState); void stateMachine(); static void idle(void *user_data); diff --git a/indra/newview/llvotree.cpp b/indra/newview/llvotree.cpp index 5f83dd4b06..97a1ed162d 100644 --- a/indra/newview/llvotree.cpp +++ b/indra/newview/llvotree.cpp @@ -232,7 +232,7 @@ void LLVOTree::initClass() if (!success) { - LLString name; + std::string name; static LLStdStringHandle name_string = LLXmlTree::addAttributeString("name"); tree_def->getFastAttributeString(name_string, name); llwarns << "Incomplete definition of tree " << name << llendl; @@ -240,22 +240,20 @@ void LLVOTree::initClass() } BOOL have_all_trees = TRUE; - LLString err; - char buffer[10]; /* Flawfinder: ignore */ + std::string err; for (S32 i=0;i<sMaxTreeSpecies;++i) { if (!sSpeciesTable.count(i)) { - snprintf(buffer,10," %d",i); /* Flawfinder: ignore */ - err.append(buffer); + err.append(llformat(" %d",i)); have_all_trees = FALSE; } } if (!have_all_trees) { - LLStringBase<char>::format_map_t args; + LLStringUtil::format_map_t args; args["[SPECIES]"] = err; gViewerWindow->alertXml("ErrorUndefinedTrees", args ); } diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 0117737225..16c6bcdd5f 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -212,9 +212,9 @@ U32 LLVOVolume::processUpdateMessage(LLMessageSystem *mesgsys, // Well, crap, there's something bogus in the data that we're unpacking. dp->dumpBufferToLog(); llwarns << "Flushing cache files" << llendl; - char mask[LL_MAX_PATH]; /* Flawfinder: ignore */ - snprintf(mask, LL_MAX_PATH, "%s*.slc", gDirUtilp->getDirDelimiter().c_str()); /* Flawfinder: ignore */ - gDirUtilp->deleteFilesInDir(gDirUtilp->getExpandedFilename(LL_PATH_CACHE,"").c_str(),mask); + std::string mask; + mask = gDirUtilp->getDirDelimiter() + "*.slc"; + gDirUtilp->deleteFilesInDir(gDirUtilp->getExpandedFilename(LL_PATH_CACHE,""), mask); // llerrs << "Bogus TE data in " << getID() << ", crashing!" << llendl; llwarns << "Bogus TE data in " << getID() << llendl; } diff --git a/indra/newview/llwaterparammanager.cpp b/indra/newview/llwaterparammanager.cpp index 2853860802..4f2dd663ed 100644 --- a/indra/newview/llwaterparammanager.cpp +++ b/indra/newview/llwaterparammanager.cpp @@ -84,9 +84,9 @@ LLWaterParamManager::~LLWaterParamManager() { } -void LLWaterParamManager::loadAllPresets(const LLString& file_name) +void LLWaterParamManager::loadAllPresets(const std::string& file_name) { - LLString path_name(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/water", "")); + std::string path_name(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/water", "")); LL_INFOS2("AppInit", "Shaders") << "Loading water settings from " << path_name << LL_ENDL; //mParamList.clear(); @@ -111,10 +111,10 @@ void LLWaterParamManager::loadAllPresets(const LLString& file_name) // not much error checking here since we're getting rid of this std::string water_name = unescaped_name.substr(0, unescaped_name.size() - 4); - LLString cur_path(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/water", name)); + std::string cur_path(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/water", name)); LL_DEBUGS2("AppInit", "Shaders") << "Loading water from " << cur_path << LL_ENDL; - std::ifstream water_xml(cur_path.c_str()); + llifstream water_xml(cur_path); if (water_xml) { LLSD water_data(LLSD::emptyMap()); @@ -122,12 +122,13 @@ void LLWaterParamManager::loadAllPresets(const LLString& file_name) parser->parse(water_xml, water_data, LLSDSerialize::SIZE_UNLIMITED); addParamSet(water_name, water_data); + water_xml.close(); } } } } -void LLWaterParamManager::loadPreset(const LLString & name) +void LLWaterParamManager::loadPreset(const std::string & name) { // bugfix for SL-46920: preventing filenames that break stuff. char * curl_str = curl_escape(name.c_str(), name.size()); @@ -140,7 +141,7 @@ void LLWaterParamManager::loadPreset(const LLString & name) std::string pathName(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/water", escaped_filename)); llinfos << "Loading water settings from " << pathName << llendl; - std::ifstream presetsXML(pathName.c_str()); + llifstream presetsXML(pathName); if (presetsXML) { @@ -159,6 +160,7 @@ void LLWaterParamManager::loadPreset(const LLString & name) { setParamSet(name, paramsData); } + presetsXML.close(); } else { @@ -171,7 +173,7 @@ void LLWaterParamManager::loadPreset(const LLString & name) propagateParameters(); } -void LLWaterParamManager::savePreset(const LLString & name) +void LLWaterParamManager::savePreset(const std::string & name) { // bugfix for SL-46920: preventing filenames that break stuff. char * curl_str = curl_escape(name.c_str(), name.size()); @@ -189,7 +191,7 @@ void LLWaterParamManager::savePreset(const LLString & name) paramsData = mParamList[name].getAll(); // write to file - std::ofstream presetsXML(pathName.c_str()); + llofstream presetsXML(pathName); LLPointer<LLSDFormatter> formatter = new LLSDXMLFormatter(); formatter->format(paramsData, presetsXML, LLSDFormatter::OPTIONS_PRETTY); presetsXML.close(); @@ -386,7 +388,7 @@ bool LLWaterParamManager::removeParamSet(const std::string& name, bool delete_fr if(delete_from_disk) { - LLString path_name(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/water", "")); + std::string path_name(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/water", "")); // use full curl escaped name char * curl_str = curl_escape(name.c_str(), name.size()); @@ -425,7 +427,7 @@ LLWaterParamManager * LLWaterParamManager::instance() { sInstance = new LLWaterParamManager(); - sInstance->loadAllPresets(""); + sInstance->loadAllPresets(LLStringUtil::null); sInstance->getParamSet("Default", sInstance->mCurParams); } diff --git a/indra/newview/llwaterparammanager.h b/indra/newview/llwaterparammanager.h index 937dd9e388..6f31ebce5c 100644 --- a/indra/newview/llwaterparammanager.h +++ b/indra/newview/llwaterparammanager.h @@ -44,12 +44,12 @@ const F32 WATER_FOG_LIGHT_CLAMP = 0.3f; struct WaterColorControl { F32 mR, mG, mB, mA, mI; /// the values - char const * mName; /// name to use to dereference params + std::string mName; /// name to use to dereference params std::string mSliderName; /// name of the slider in menu bool mHasSliderName; /// only set slider name for true color types inline WaterColorControl(F32 red, F32 green, F32 blue, F32 alpha, - F32 intensity, char const * n, char const * sliderName = "") + F32 intensity, const std::string& n, const std::string& sliderName = LLStringUtil::null) : mR(red), mG(green), mB(blue), mA(alpha), mI(intensity), mName(n), mSliderName(sliderName) { // if there's a slider name, say we have one @@ -104,10 +104,10 @@ struct WaterVector3Control F32 mY; F32 mZ; - char const * mName; + std::string mName; // basic constructor - inline WaterVector3Control(F32 valX, F32 valY, F32 valZ, char const * n) + inline WaterVector3Control(F32 valX, F32 valY, F32 valZ, const std::string& n) : mX(valX), mY(valY), mZ(valZ), mName(n) { } @@ -133,10 +133,10 @@ struct WaterVector2Control F32 mX; F32 mY; - char const * mName; + std::string mName; // basic constructor - inline WaterVector2Control(F32 valX, F32 valY, char const * n) + inline WaterVector2Control(F32 valX, F32 valY, const std::string& n) : mX(valX), mY(valY), mName(n) { } @@ -159,10 +159,10 @@ struct WaterVector2Control struct WaterFloatControl { F32 mX; - char const * mName; + std::string mName; F32 mMult; - inline WaterFloatControl(F32 val, char const * n, F32 m=1.0f) + inline WaterFloatControl(F32 val, const std::string& n, F32 m=1.0f) : mX(val), mName(n), mMult(m) { } @@ -189,10 +189,10 @@ struct WaterFloatControl struct WaterExpFloatControl { F32 mExp; - char const * mName; + std::string mName; F32 mBase; - inline WaterExpFloatControl(F32 val, char const * n, F32 b) + inline WaterExpFloatControl(F32 val, const std::string& n, F32 b) : mExp(val), mName(n), mBase(b) { } @@ -225,13 +225,13 @@ public: ~LLWaterParamManager(); /// load a preset file - void loadAllPresets(const LLString & fileName); + void loadAllPresets(const std::string & fileName); /// load an individual preset into the sky - void loadPreset(const LLString & name); + void loadPreset(const std::string & name); /// save the parameter presets to file - void savePreset(const LLString & name); + void savePreset(const std::string & name); /// send the parameters to the shaders void propagateParameters(void); diff --git a/indra/newview/llwaterparamset.cpp b/indra/newview/llwaterparamset.cpp index 78797eecce..ab3b6a820f 100644 --- a/indra/newview/llwaterparamset.cpp +++ b/indra/newview/llwaterparamset.cpp @@ -87,7 +87,7 @@ LLWaterParamSet::LLWaterParamSet(void) : } -void LLWaterParamSet::set(const char * paramName, float x) +void LLWaterParamSet::set(const std::string& paramName, float x) { // handle case where no array if(mParamValues[paramName].isReal()) @@ -103,19 +103,19 @@ void LLWaterParamSet::set(const char * paramName, float x) } } -void LLWaterParamSet::set(const char * paramName, float x, float y) { +void LLWaterParamSet::set(const std::string& paramName, float x, float y) { mParamValues[paramName][0] = x; mParamValues[paramName][1] = y; } -void LLWaterParamSet::set(const char * paramName, float x, float y, float z) +void LLWaterParamSet::set(const std::string& paramName, float x, float y, float z) { mParamValues[paramName][0] = x; mParamValues[paramName][1] = y; mParamValues[paramName][2] = z; } -void LLWaterParamSet::set(const char * paramName, float x, float y, float z, float w) +void LLWaterParamSet::set(const std::string& paramName, float x, float y, float z, float w) { mParamValues[paramName][0] = x; mParamValues[paramName][1] = y; @@ -123,7 +123,7 @@ void LLWaterParamSet::set(const char * paramName, float x, float y, float z, flo mParamValues[paramName][3] = w; } -void LLWaterParamSet::set(const char * paramName, const float * val) +void LLWaterParamSet::set(const std::string& paramName, const float * val) { mParamValues[paramName][0] = val[0]; mParamValues[paramName][1] = val[1]; @@ -131,7 +131,7 @@ void LLWaterParamSet::set(const char * paramName, const float * val) mParamValues[paramName][3] = val[3]; } -void LLWaterParamSet::set(const char * paramName, const LLVector4 & val) +void LLWaterParamSet::set(const std::string& paramName, const LLVector4 & val) { mParamValues[paramName][0] = val.mV[0]; mParamValues[paramName][1] = val.mV[1]; @@ -139,7 +139,7 @@ void LLWaterParamSet::set(const char * paramName, const LLVector4 & val) mParamValues[paramName][3] = val.mV[3]; } -void LLWaterParamSet::set(const char * paramName, const LLColor4 & val) +void LLWaterParamSet::set(const std::string& paramName, const LLColor4 & val) { mParamValues[paramName][0] = val.mV[0]; mParamValues[paramName][1] = val.mV[1]; @@ -147,7 +147,7 @@ void LLWaterParamSet::set(const char * paramName, const LLColor4 & val) mParamValues[paramName][3] = val.mV[3]; } -LLVector4 LLWaterParamSet::getVector4(const char * paramName, bool& error) +LLVector4 LLWaterParamSet::getVector4(const std::string& paramName, bool& error) { // test to see if right type @@ -168,7 +168,7 @@ LLVector4 LLWaterParamSet::getVector4(const char * paramName, bool& error) return val; } -LLVector3 LLWaterParamSet::getVector3(const char * paramName, bool& error) +LLVector3 LLWaterParamSet::getVector3(const std::string& paramName, bool& error) { // test to see if right type @@ -188,7 +188,7 @@ LLVector3 LLWaterParamSet::getVector3(const char * paramName, bool& error) return val; } -LLVector2 LLWaterParamSet::getVector2(const char * paramName, bool& error) +LLVector2 LLWaterParamSet::getVector2(const std::string& paramName, bool& error) { // test to see if right type int ttest; @@ -208,7 +208,7 @@ LLVector2 LLWaterParamSet::getVector2(const char * paramName, bool& error) return val; } -F32 LLWaterParamSet::getFloat(const char * paramName, bool& error) +F32 LLWaterParamSet::getFloat(const std::string& paramName, bool& error) { // test to see if right type diff --git a/indra/newview/llwaterparamset.h b/indra/newview/llwaterparamset.h index f853140733..b733160dff 100644 --- a/indra/newview/llwaterparamset.h +++ b/indra/newview/llwaterparamset.h @@ -48,7 +48,7 @@ class LLWaterParamSet friend class LLWaterParamManager; public: - LLString mName; + std::string mName; private: @@ -70,20 +70,20 @@ public: /// Set a float parameter. /// \param paramName The name of the parameter to set. /// \param x The float value to set. - void set(const char * paramName, float x); + void set(const std::string& paramName, float x); /// Set a float2 parameter. /// \param paramName The name of the parameter to set. /// \param x The x component's value to set. /// \param y The y component's value to set. - void set(const char * paramName, float x, float y); + void set(const std::string& paramName, float x, float y); /// Set a float3 parameter. /// \param paramName The name of the parameter to set. /// \param x The x component's value to set. /// \param y The y component's value to set. /// \param z The z component's value to set. - void set(const char * paramName, float x, float y, float z); + void set(const std::string& paramName, float x, float y, float z); /// Set a float4 parameter. /// \param paramName The name of the parameter to set. @@ -91,42 +91,42 @@ public: /// \param y The y component's value to set. /// \param z The z component's value to set. /// \param w The w component's value to set. - void set(const char * paramName, float x, float y, float z, float w); + void set(const std::string& paramName, float x, float y, float z, float w); /// Set a float4 parameter. /// \param paramName The name of the parameter to set. /// \param val An array of the 4 float values to set the parameter to. - void set(const char * paramName, const float * val); + void set(const std::string& paramName, const float * val); /// Set a float4 parameter. /// \param paramName The name of the parameter to set. /// \param val A struct of the 4 float values to set the parameter to. - void set(const char * paramName, const LLVector4 & val); + void set(const std::string& paramName, const LLVector4 & val); /// Set a float4 parameter. /// \param paramName The name of the parameter to set. /// \param val A struct of the 4 float values to set the parameter to. - void set(const char * paramName, const LLColor4 & val); + void set(const std::string& paramName, const LLColor4 & val); /// Get a float4 parameter. /// \param paramName The name of the parameter to set. /// \param error A flag to set if it's not the proper return type - LLVector4 getVector4(const char * paramName, bool& error); + LLVector4 getVector4(const std::string& paramName, bool& error); /// Get a float3 parameter. /// \param paramName The name of the parameter to set. /// \param error A flag to set if it's not the proper return type - LLVector3 getVector3(const char * paramName, bool& error); + LLVector3 getVector3(const std::string& paramName, bool& error); /// Get a float2 parameter. /// \param paramName The name of the parameter to set. /// \param error A flag to set if it's not the proper return type - LLVector2 getVector2(const char * paramName, bool& error); + LLVector2 getVector2(const std::string& paramName, bool& error); /// Get an integer parameter /// \param paramName The name of the parameter to set. /// \param error A flag to set if it's not the proper return type - F32 getFloat(const char * paramName, bool& error); + F32 getFloat(const std::string& paramName, bool& error); /// interpolate two parameter sets /// \param src The parameter set to start with diff --git a/indra/newview/llwearable.cpp b/indra/newview/llwearable.cpp index f084088478..ef077101e9 100644 --- a/indra/newview/llwearable.cpp +++ b/indra/newview/llwearable.cpp @@ -52,7 +52,7 @@ S32 LLWearable::sCurrentDefinitionVersion = 1; // static -const char* LLWearable::sTypeName[ WT_COUNT ] = +const std::string LLWearable::sTypeName[ WT_COUNT+1 ] = { "shape", "skin", @@ -66,11 +66,12 @@ const char* LLWearable::sTypeName[ WT_COUNT ] = "gloves", "undershirt", "underpants", - "skirt" + "skirt", + "invalid" }; // static -const char* LLWearable::sTypeLabel[ WT_COUNT ] = +const std::string LLWearable::sTypeLabel[ WT_COUNT+1 ] = { "Shape", "Skin", @@ -84,7 +85,8 @@ const char* LLWearable::sTypeLabel[ WT_COUNT ] = "Gloves", "Undershirt", "Underpants", - "Skirt" + "Skirt", + "invalid" }; @@ -136,7 +138,7 @@ LLWearable::~LLWearable() // static -EWearableType LLWearable::typeNameToType( const LLString& type_name ) +EWearableType LLWearable::typeNameToType( const std::string& type_name ) { for( S32 i = 0; i < WT_COUNT; i++ ) { @@ -149,37 +151,35 @@ EWearableType LLWearable::typeNameToType( const LLString& type_name ) } -const char* terse_F32_to_string( F32 f, char s[MAX_STRING] ) /* Flawfinder: ignore */ +std::string terse_F32_to_string( F32 f ) { - char* r = s; - S32 len = snprintf( s, MAX_STRING, "%.2f", f ); /* Flawfinder: ignore */ + std::string r = llformat( "%.2f", f ); // "1.20" -> "1.2" // "24.00" -> "24." - while( '0' == r[len - 1] ) + S32 len = r.length(); + while( len > 0 && '0' == r[len - 1] ) { - len--; - r[len] = '\0'; + r.erase(len-1, 1); + len--; } if( '.' == r[len - 1] ) { // "24." -> "24" - len--; - r[len] = '\0'; + r.erase(len-1, 1); } else if( ('-' == r[0]) && ('0' == r[1]) ) { // "-0.59" -> "-.59" - r++; - r[0] = '-'; + r.erase(1, 1); } else if( '0' == r[0] ) { // "0.59" -> ".59" - r++; + r.erase(0, 1); } return r; @@ -231,13 +231,12 @@ BOOL LLWearable::exportFile( LLFILE* file ) return FALSE; } - char s[ MAX_STRING ]; /* Flawfinder: ignore */ for (param_map_t::iterator iter = mVisualParamMap.begin(); iter != mVisualParamMap.end(); ++iter) { S32 param_id = iter->first; F32 param_weight = iter->second; - if( fprintf( file, "%d %s\n", param_id, terse_F32_to_string( param_weight, s ) ) < 0 ) + if( fprintf( file, "%d %s\n", param_id, terse_F32_to_string( param_weight ).c_str() ) < 0 ) { return FALSE; } @@ -311,7 +310,7 @@ BOOL LLWearable::importFile( LLFILE* file ) return FALSE; } mName = text_buffer; - LLString::truncate(mName, DB_INV_ITEM_NAME_STR_LEN ); + LLStringUtil::truncate(mName, DB_INV_ITEM_NAME_STR_LEN ); } // description @@ -334,7 +333,7 @@ BOOL LLWearable::importFile( LLFILE* file ) return FALSE; } mDescription = text_buffer; - LLString::truncate(mDescription, DB_INV_ITEM_DESC_STR_LEN ); + LLStringUtil::truncate(mDescription, DB_INV_ITEM_DESC_STR_LEN ); } // permissions @@ -848,10 +847,10 @@ void LLWearable::saveNewAsset() // llinfos << "LLWearable::saveNewAsset() type: " << getTypeName() << llendl; //llinfos << *this << llendl; - char new_asset_id_string[UUID_STR_LENGTH]; /* Flawfinder: ignore */ + std::string new_asset_id_string; mAssetID.toString(new_asset_id_string); - char filename[LL_MAX_PATH]; /* Flawfinder: ignore */ - snprintf(filename, LL_MAX_PATH, "%s.wbl", gDirUtilp->getExpandedFilename(LL_PATH_CACHE,new_asset_id_string).c_str()); /* Flawfinder: ignore */ + std::string filename; + filename = gDirUtilp->getExpandedFilename(LL_PATH_CACHE,new_asset_id_string) + ".wbl"; LLFILE* fp = LLFile::fopen(filename, "wb"); /* Flawfinder: ignore */ BOOL successful_save = FALSE; if(fp && exportFile(fp)) @@ -865,14 +864,10 @@ void LLWearable::saveNewAsset() } if(!successful_save) { - char buffer[2*MAX_STRING]; /* Flawfinder: ignore */ - snprintf(buffer, /* Flawfinder: ignore */ - sizeof(buffer), - "Unable to save '%s' to wearable file.", - mName.c_str()); + std::string buffer = llformat("Unable to save '%s' to wearable file.", mName.c_str()); llwarns << buffer << llendl; - LLStringBase<char>::format_map_t args; + LLStringUtil::format_map_t args; args["[NAME]"] = mName; gViewerWindow->alertXml("CannotSaveWearableOutOfSpace", args); return; @@ -910,7 +905,7 @@ void LLWearable::saveNewAsset() void LLWearable::onSaveNewAssetComplete(const LLUUID& new_asset_id, void* userdata, S32 status, LLExtStat ext_status) // StoreAssetData callback (fixed) { LLWearableSaveData* data = (LLWearableSaveData*)userdata; - const char* type_name = LLWearable::typeToTypeName(data->mType); + const std::string& type_name = LLWearable::typeToTypeName(data->mType); if(0 == status) { // Success @@ -918,22 +913,18 @@ void LLWearable::onSaveNewAssetComplete(const LLUUID& new_asset_id, void* userda } else { - char buffer[2*MAX_STRING]; /* Flawfinder: ignore */ - snprintf(buffer, /* Flawfinder: ignore */ - sizeof(buffer), - "Unable to save %s to central asset store.", - type_name); + std::string buffer = llformat("Unable to save %s to central asset store.", type_name.c_str()); llwarns << buffer << " Status: " << status << llendl; - LLStringBase<char>::format_map_t args; + LLStringUtil::format_map_t args; args["[NAME]"] = type_name; gViewerWindow->alertXml("CannotSaveToAssetStore", args); } // Delete temp file - char new_asset_id_string[UUID_STR_LENGTH]; /* Flawfinder: ignore */ + std::string new_asset_id_string; new_asset_id.toString(new_asset_id_string); - char src_filename[LL_MAX_PATH]; /* Flawfinder: ignore */ - snprintf(src_filename, LL_MAX_PATH, "%s.wbl", gDirUtilp->getExpandedFilename(LL_PATH_CACHE,new_asset_id_string).c_str()); /* Flawfinder: ignore */ + std::string src_filename; + src_filename = gDirUtilp->getExpandedFilename(LL_PATH_CACHE,new_asset_id_string) + ".wbl"; LLFile::remove(src_filename); // delete the context data diff --git a/indra/newview/llwearable.h b/indra/newview/llwearable.h index 059444d941..ab9a00c785 100644 --- a/indra/newview/llwearable.h +++ b/indra/newview/llwearable.h @@ -69,7 +69,6 @@ public: const LLAssetID& getID() { return mAssetID; } const LLTransactionID& getTransactionID() { return mTransactionID; } - BOOL readData( const char *buffer ); BOOL isDirty(); BOOL isOldVersion(); @@ -84,11 +83,11 @@ public: EWearableType getType() const { return mType; } void setType( EWearableType type ) { mType = type; } - void setName( const LLString& name ) { mName = name; } - const LLString& getName() { return mName; } + void setName( const std::string& name ) { mName = name; } + const std::string& getName() { return mName; } - void setDescription( const LLString& desc ) { mDescription = desc; } - const LLString& getDescription() { return mDescription; } + void setDescription( const std::string& desc ) { mDescription = desc; } + const std::string& getDescription() { return mDescription; } void setPermissions( const LLPermissions& p ) { mPermissions = p; } const LLPermissions& getPermissions() { return mPermissions; } @@ -96,17 +95,17 @@ public: void setSaleInfo( const LLSaleInfo& info ) { mSaleInfo = info; } const LLSaleInfo& getSaleInfo() { return mSaleInfo; } - const char* getTypeLabel() const { return LLWearable::sTypeLabel[ mType ]; } - const char* getTypeName() const { return LLWearable::sTypeName[ mType ]; } + const std::string& getTypeLabel() const { return LLWearable::sTypeLabel[ mType ]; } + const std::string& getTypeName() const { return LLWearable::sTypeName[ mType ]; } void setParamsToDefaults(); void setTexturesToDefaults(); LLAssetType::EType getAssetType() const { return LLWearable::typeToAssetType( mType ); } - static EWearableType typeNameToType( const LLString& type_name ); - static const char* typeToTypeName( EWearableType type ) { return (type<WT_COUNT) ? LLWearable::sTypeName[type] : "invalid"; } - static const char* typeToTypeLabel( EWearableType type ) { return (type<WT_COUNT) ? LLWearable::sTypeLabel[type] : "invalid"; } + static EWearableType typeNameToType( const std::string& type_name ); + static const std::string& typeToTypeName( EWearableType type ) { return LLWearable::sTypeName[llmin(type,WT_COUNT)]; } + static const std::string& typeToTypeLabel( EWearableType type ) { return LLWearable::sTypeLabel[llmin(type,WT_COUNT)]; } static LLAssetType::EType typeToAssetType( EWearableType wearable_type ); void saveNewAsset(); @@ -123,8 +122,8 @@ public: private: static S32 sCurrentDefinitionVersion; // Depends on the current state of the avatar_lad.xml. S32 mDefinitionVersion; // Depends on the state of the avatar_lad.xml when this asset was created. - LLString mName; - LLString mDescription; + std::string mName; + std::string mDescription; LLPermissions mPermissions; LLSaleInfo mSaleInfo; LLAssetID mAssetID; @@ -136,8 +135,8 @@ private: typedef std::map<S32, LLUUID> te_map_t; te_map_t mTEMap; // maps TE to Image ID - static const char* sTypeName[ WT_COUNT ]; - static const char* sTypeLabel[ WT_COUNT ]; + static const std::string sTypeName[ WT_COUNT+1 ]; + static const std::string sTypeLabel[ WT_COUNT+1 ]; }; #endif // LL_LLWEARABLE_H diff --git a/indra/newview/llwearablelist.cpp b/indra/newview/llwearablelist.cpp index 7fca271d3d..7678727e58 100644 --- a/indra/newview/llwearablelist.cpp +++ b/indra/newview/llwearablelist.cpp @@ -50,7 +50,7 @@ struct LLWearableArrivedData { LLWearableArrivedData( LLAssetType::EType asset_type, - const LLString& wearable_name, + const std::string& wearable_name, void(*asset_arrived_callback)(LLWearable*, void* userdata), void* userdata ) : @@ -64,7 +64,7 @@ struct LLWearableArrivedData LLAssetType::EType mAssetType; void (*mCallback)(LLWearable*, void* userdata); void* mUserdata; - LLString mName; + std::string mName; S32 mRetries; }; @@ -79,7 +79,7 @@ LLWearableList::~LLWearableList() mList.clear(); } -void LLWearableList::getAsset( const LLAssetID& assetID, const LLString& wearable_name, LLAssetType::EType asset_type, void(*asset_arrived_callback)(LLWearable*, void* userdata), void* userdata ) +void LLWearableList::getAsset( const LLAssetID& assetID, const std::string& wearable_name, LLAssetType::EType asset_type, void(*asset_arrived_callback)(LLWearable*, void* userdata), void* userdata ) { llassert( (asset_type == LLAssetType::AT_CLOTHING) || (asset_type == LLAssetType::AT_BODYPART) ); LLWearable* instance = get_if_there(mList, assetID, (LLWearable*)NULL ); @@ -112,7 +112,7 @@ void LLWearableList::processGetAssetReply( const char* filename, const LLAssetID if( status >= 0 ) { // read the file - LLFILE* fp = LLFile::fopen(filename, "rb"); /*Flawfinder: ignore*/ + LLFILE* fp = LLFile::fopen(std::string(filename), "rb"); /*Flawfinder: ignore*/ if( !fp ) { LL_WARNS("Wearable") << "Bad Wearable Asset: unable to open file: '" << filename << "'" << LL_ENDL; @@ -130,7 +130,7 @@ void LLWearableList::processGetAssetReply( const char* filename, const LLAssetID fclose( fp ); if(filename) { - LLFile::remove(filename); + LLFile::remove(std::string(filename)); } } } @@ -138,7 +138,7 @@ void LLWearableList::processGetAssetReply( const char* filename, const LLAssetID { if(filename) { - LLFile::remove(filename); + LLFile::remove(std::string(filename)); } LLViewerStats::getInstance()->incStat( LLViewerStats::ST_DOWNLOAD_FAILED ); @@ -180,7 +180,7 @@ void LLWearableList::processGetAssetReply( const char* filename, const LLAssetID } else { - LLString::format_map_t args; + LLStringUtil::format_map_t args; // *TODO:translate args["[TYPE]"] = LLAssetType::lookupHumanReadable(data->mAssetType); if (data->mName.empty()) @@ -290,7 +290,7 @@ LLWearable* LLWearableList::createNewWearable( EWearableType type ) LLWearable* wearable = new LLWearable( tid ); wearable->setType( type ); - LLString name = "New "; + std::string name = "New "; name.append( wearable->getTypeLabel() ); wearable->setName( name ); diff --git a/indra/newview/llwearablelist.h b/indra/newview/llwearablelist.h index 88434842b4..1b7bb2fff2 100644 --- a/indra/newview/llwearablelist.h +++ b/indra/newview/llwearablelist.h @@ -46,7 +46,7 @@ public: void getAsset( const LLAssetID& assetID, - const LLString& wearable_name, + const std::string& wearable_name, LLAssetType::EType asset_type, void(*asset_arrived_callback)(LLWearable*, void* userdata), void* userdata ); @@ -56,7 +56,7 @@ public: LLWearable* createCopy( LLWearable* old_wearable ); LLWearable* createNewWearable( EWearableType type ); - // Pseudo-private + // Callback static void processGetAssetReply(const char* filename, const LLAssetID& assetID, void* user_data, S32 status, LLExtStat ext_status); protected: diff --git a/indra/newview/llweb.cpp b/indra/newview/llweb.cpp index 21be936960..77c98d0569 100644 --- a/indra/newview/llweb.cpp +++ b/indra/newview/llweb.cpp @@ -34,7 +34,7 @@ #include "llweb.h" -#include "llwindow.h" +#include "llviewerwindow.h" #include "llviewercontrol.h" #include "llfloaterhtmlhelp.h" @@ -63,7 +63,7 @@ void LLWeb::loadURL(const std::string& url) void LLWeb::loadURLExternal(const std::string& url) { std::string escaped_url = escapeURL(url); - spawn_web_browser(escaped_url.c_str()); + gViewerWindow->getWindow()->spawnWebBrowser(escaped_url); } diff --git a/indra/newview/llweb.h b/indra/newview/llweb.h index 318410bb3b..b294bd8fe2 100644 --- a/indra/newview/llweb.h +++ b/indra/newview/llweb.h @@ -45,7 +45,7 @@ public: // browser, depending on user settings. static void loadURL(const std::string& url); - static void loadURL(const char* url) { loadURL( std::string(url) ); } + static void loadURL(const char* url) { loadURL( ll_safe_string(url) ); } // Loads unescaped url in external browser. static void loadURLExternal(const std::string& url); diff --git a/indra/newview/llwindebug.cpp b/indra/newview/llwindebug.cpp index bf6fcd6ccc..b13ef98bec 100644 --- a/indra/newview/llwindebug.cpp +++ b/indra/newview/llwindebug.cpp @@ -486,7 +486,7 @@ LLSD WINAPI Get_Exception_Info(PEXCEPTION_POINTERS pException) // Save instruction that caused exception. /* - LLString str; + std::string str; for (i = 0; i < 16; i++) str += llformat(" %02X", PBYTE(E.ExceptionAddress)[i]); info["Instruction"] = str; @@ -639,7 +639,7 @@ bool LLWinDebug::checkExceptionHandler() return ok; } -void LLWinDebug::writeDumpToFile(MINIDUMP_TYPE type, MINIDUMP_EXCEPTION_INFORMATION *ExInfop, const char *filename) +void LLWinDebug::writeDumpToFile(MINIDUMP_TYPE type, MINIDUMP_EXCEPTION_INFORMATION *ExInfop, const std::string& filename) { if(f_mdwp == NULL || gDirUtilp == NULL) { @@ -648,8 +648,7 @@ void LLWinDebug::writeDumpToFile(MINIDUMP_TYPE type, MINIDUMP_EXCEPTION_INFORMAT } else { - std::string dump_path = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, - filename); + std::string dump_path = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, filename); HANDLE hFile = CreateFileA(dump_path.c_str(), GENERIC_WRITE, @@ -734,7 +733,7 @@ void LLWinDebug::generateCrashStacks(struct _EXCEPTION_POINTERS *exception_infop info["Threads"] = threads; - std::ofstream out_file(log_path.c_str()); + llofstream out_file(log_path); LLSDSerialize::toPrettyXML(info, out_file); out_file.close(); } diff --git a/indra/newview/llwindebug.h b/indra/newview/llwindebug.h index f7543597cc..6875b943ae 100644 --- a/indra/newview/llwindebug.h +++ b/indra/newview/llwindebug.h @@ -66,7 +66,7 @@ public: static bool checkExceptionHandler(); static void generateCrashStacks(struct _EXCEPTION_POINTERS *pExceptionInfo = NULL); - static void writeDumpToFile(MINIDUMP_TYPE type, MINIDUMP_EXCEPTION_INFORMATION *ExInfop, const char *filename); + static void writeDumpToFile(MINIDUMP_TYPE type, MINIDUMP_EXCEPTION_INFORMATION *ExInfop, const std::string& filename); private: }; diff --git a/indra/newview/llwldaycycle.cpp b/indra/newview/llwldaycycle.cpp index b8b2a85ee4..1abf760580 100644 --- a/indra/newview/llwldaycycle.cpp +++ b/indra/newview/llwldaycycle.cpp @@ -48,17 +48,17 @@ LLWLDayCycle::~LLWLDayCycle() { } -void LLWLDayCycle::loadDayCycle(const LLString & fileName) +void LLWLDayCycle::loadDayCycle(const std::string & fileName) { // clear the first few things mTimeMap.clear(); // now load the file - LLString pathName(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, + std::string pathName(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/days", fileName)); llinfos << "Loading DayCycle settings from " << pathName << llendl; - llifstream day_cycle_xml(pathName.c_str()); + llifstream day_cycle_xml(pathName); if (day_cycle_xml.is_open()) { // load and parse it @@ -82,7 +82,7 @@ void LLWLDayCycle::loadDayCycle(const LLString & fileName) if(!success) { // alert the user - LLString::format_map_t args; + LLStringUtil::format_map_t args; args["[SKY]"] = day_data[i][1].asString(); gViewerWindow->alertXml("WLMissingSky", args); continue; @@ -96,11 +96,11 @@ void LLWLDayCycle::loadDayCycle(const LLString & fileName) } } -void LLWLDayCycle::saveDayCycle(const LLString & fileName) +void LLWLDayCycle::saveDayCycle(const std::string & fileName) { LLSD day_data(LLSD::emptyArray()); - LLString pathName(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/days", fileName)); + std::string pathName(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/days", fileName)); //llinfos << "Saving WindLight settings to " << pathName << llendl; for(std::map<F32, std::string>::const_iterator mIt = mTimeMap.begin(); @@ -113,11 +113,10 @@ void LLWLDayCycle::saveDayCycle(const LLString & fileName) day_data.append(key); } - std::ofstream day_cycle_xml(pathName.c_str()); + llofstream day_cycle_xml(pathName); LLPointer<LLSDFormatter> formatter = new LLSDXMLFormatter(); formatter->format(day_data, day_cycle_xml, LLSDFormatter::OPTIONS_PRETTY); - - //day_cycle_xml.close(); + day_cycle_xml.close(); } @@ -127,7 +126,7 @@ void LLWLDayCycle::clearKeys() } -bool LLWLDayCycle::addKey(F32 newTime, const LLString & paramName) +bool LLWLDayCycle::addKey(F32 newTime, const std::string & paramName) { // no adding negative time if(newTime < 0) @@ -160,7 +159,7 @@ bool LLWLDayCycle::changeKeyTime(F32 oldTime, F32 newTime) return addKey(newTime, name); } -bool LLWLDayCycle::changeKeyParam(F32 time, const LLString & name) +bool LLWLDayCycle::changeKeyParam(F32 time, const std::string & name) { // just remove and add back // make sure param exists @@ -189,7 +188,7 @@ bool LLWLDayCycle::removeKey(F32 time) return false; } -bool LLWLDayCycle::getKey(const LLString & name, F32& key) +bool LLWLDayCycle::getKey(const std::string & name, F32& key) { // scroll through till we find the std::map<F32, std::string>::iterator mIt = mTimeMap.begin(); @@ -218,7 +217,7 @@ bool LLWLDayCycle::getKeyedParam(F32 time, LLWLParamSet& param) return false; } -bool LLWLDayCycle::getKeyedParamName(F32 time, LLString & name) +bool LLWLDayCycle::getKeyedParamName(F32 time, std::string & name) { // just scroll on through till you find it std::map<F32, std::string>::iterator mIt = mTimeMap.find(time); diff --git a/indra/newview/llwldaycycle.h b/indra/newview/llwldaycycle.h index b554c915fc..018774cf2b 100644 --- a/indra/newview/llwldaycycle.h +++ b/indra/newview/llwldaycycle.h @@ -61,10 +61,10 @@ public: ~LLWLDayCycle(); /// load a day cycle - void loadDayCycle(const LLString & fileName); + void loadDayCycle(const std::string & fileName); /// load a day cycle - void saveDayCycle(const LLString & fileName); + void saveDayCycle(const std::string & fileName); /// clear keys void clearKeys(); @@ -73,7 +73,7 @@ public: /// add a new key frame to the day cycle /// returns true if successful /// no negative time - bool addKey(F32 newTime, const LLString & paramName); + bool addKey(F32 newTime, const std::string & paramName); /// adjust a key's placement in the day cycle /// returns true if successful @@ -81,7 +81,7 @@ public: /// adjust a key's parameter used /// returns true if successful - bool changeKeyParam(F32 time, const LLString & paramName); + bool changeKeyParam(F32 time, const std::string & paramName); /// remove a key from the day cycle /// returns true if successful @@ -89,7 +89,7 @@ public: /// get the first key time for a parameter /// returns false if not there - bool getKey(const LLString & name, F32& key); + bool getKey(const std::string & name, F32& key); /// get the param set at a given time /// returns true if found one @@ -97,7 +97,7 @@ public: /// get the name /// returns true if it found one - bool getKeyedParamName(F32 time, LLString & name); + bool getKeyedParamName(F32 time, std::string & name); }; diff --git a/indra/newview/llwlparammanager.cpp b/indra/newview/llwlparammanager.cpp index 5fb8990774..24ddb6fc08 100644 --- a/indra/newview/llwlparammanager.cpp +++ b/indra/newview/llwlparammanager.cpp @@ -104,16 +104,16 @@ LLWLParamManager::~LLWLParamManager() { } -void LLWLParamManager::loadPresets(const LLString& file_name) +void LLWLParamManager::loadPresets(const std::string& file_name) { // if fileName exists, use legacy loading form the big file, otherwise, search the sky // directory, and add the list if(file_name != "") { - LLString path_name(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight", file_name)); + std::string path_name(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight", file_name)); LL_INFOS2("AppInit", "Shaders") << "Loading WindLight settings from " << path_name << LL_ENDL; - llifstream presetsXML(path_name.c_str()); + llifstream presetsXML(path_name); if (presetsXML) { @@ -136,7 +136,7 @@ void LLWLParamManager::loadPresets(const LLString& file_name) // otherwise, search the sky directory and find things there else { - LLString path_name(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/skies", "")); + std::string path_name(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/skies", "")); LL_INFOS2("AppInit", "Shaders") << "Loading WindLight settings from " << path_name << LL_ENDL; //mParamList.clear(); @@ -161,10 +161,10 @@ void LLWLParamManager::loadPresets(const LLString& file_name) // not much error checking here since we're getting rid of this std::string sky_name = unescaped_name.substr(0, unescaped_name.size() - 4); - LLString cur_path(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/skies", name)); + std::string cur_path(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/skies", name)); LL_DEBUGS2("AppInit", "Shaders") << "Loading sky from " << cur_path << LL_ENDL; - std::ifstream sky_xml(cur_path.c_str()); + llifstream sky_xml(cur_path); if (sky_xml) { LLSD sky_data(LLSD::emptyMap()); @@ -172,17 +172,18 @@ void LLWLParamManager::loadPresets(const LLString& file_name) parser->parse(sky_xml, sky_data, LLSDSerialize::SIZE_UNLIMITED); addParamSet(sky_name, sky_data); + sky_xml.close(); } } } } } -void LLWLParamManager::savePresets(const LLString & fileName) +void LLWLParamManager::savePresets(const std::string & fileName) { LLSD paramsData(LLSD::emptyMap()); - LLString pathName(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight", fileName)); + std::string pathName(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight", fileName)); for(std::map<std::string, LLWLParamSet>::iterator mIt = mParamList.begin(); mIt != mParamList.end(); @@ -191,7 +192,7 @@ void LLWLParamManager::savePresets(const LLString & fileName) paramsData[mIt->first] = mIt->second.getAll(); } - std::ofstream presetsXML(pathName.c_str()); + llofstream presetsXML(pathName); LLPointer<LLSDFormatter> formatter = new LLSDXMLFormatter(); @@ -200,7 +201,7 @@ void LLWLParamManager::savePresets(const LLString & fileName) presetsXML.close(); } -void LLWLParamManager::loadPreset(const LLString & name) +void LLWLParamManager::loadPreset(const std::string & name) { // bugfix for SL-46920: preventing filenames that break stuff. char * curl_str = curl_escape(name.c_str(), name.size()); @@ -213,7 +214,7 @@ void LLWLParamManager::loadPreset(const LLString & name) std::string pathName(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/skies", escaped_filename)); llinfos << "Loading WindLight sky setting from " << pathName << llendl; - std::ifstream presetsXML(pathName.c_str()); + llifstream presetsXML(pathName); if (presetsXML) { @@ -232,6 +233,7 @@ void LLWLParamManager::loadPreset(const LLString & name) { setParamSet(name, paramsData); } + presetsXML.close(); } else { @@ -244,7 +246,7 @@ void LLWLParamManager::loadPreset(const LLString & name) propagateParameters(); } -void LLWLParamManager::savePreset(const LLString & name) +void LLWLParamManager::savePreset(const std::string & name) { // bugfix for SL-46920: preventing filenames that break stuff. char * curl_str = curl_escape(name.c_str(), name.size()); @@ -262,7 +264,7 @@ void LLWLParamManager::savePreset(const LLString & name) paramsData = mParamList[name].getAll(); // write to file - std::ofstream presetsXML(pathName.c_str()); + llofstream presetsXML(pathName); LLPointer<LLSDFormatter> formatter = new LLSDXMLFormatter(); formatter->format(paramsData, presetsXML, LLSDFormatter::OPTIONS_PRETTY); presetsXML.close(); @@ -531,7 +533,7 @@ bool LLWLParamManager::removeParamSet(const std::string& name, bool delete_from_ if(delete_from_disk) { - LLString path_name(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/skies", "")); + std::string path_name(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/skies", "")); // use full curl escaped name char * curl_str = curl_escape(name.c_str(), name.size()); @@ -553,10 +555,10 @@ LLWLParamManager * LLWLParamManager::instance() { sInstance = new LLWLParamManager(); - sInstance->loadPresets(""); + sInstance->loadPresets(LLStringUtil::null); // load the day - sInstance->mDay.loadDayCycle("Default.xml"); + sInstance->mDay.loadDayCycle(std::string("Default.xml")); // *HACK - sets cloud scrolling to what we want... fix this better in the future sInstance->getParamSet("Default", sInstance->mCurParams); diff --git a/indra/newview/llwlparammanager.h b/indra/newview/llwlparammanager.h index 474db19cfa..1a2b2a3903 100644 --- a/indra/newview/llwlparammanager.h +++ b/indra/newview/llwlparammanager.h @@ -45,15 +45,15 @@ class LLGLSLShader; struct WLColorControl { F32 r, g, b, i; /// the values - char const * name; /// name to use to dereference params + std::string mName; /// name to use to dereference params std::string mSliderName; /// name of the slider in menu bool hasSliderName; /// only set slider name for true color types bool isSunOrAmbientColor; /// flag for if it's the sun or ambient color controller bool isBlueHorizonOrDensity; /// flag for if it's the Blue Horizon or Density color controller - inline WLColorControl(F32 red, F32 green, F32 blue, F32 intensity, char const * n, - char const * sliderName = "") - : r(red), g(green), b(blue), i(intensity), name(n), mSliderName(sliderName) + inline WLColorControl(F32 red, F32 green, F32 blue, F32 intensity, + const std::string& n, const std::string& sliderName = LLStringUtil::null) + : r(red), g(green), b(blue), i(intensity), mName(n), mSliderName(sliderName) { // if there's a slider name, say we have one hasSliderName = false; @@ -90,18 +90,18 @@ struct WLColorControl { } inline void update(LLWLParamSet & params) const { - params.set(name, r, g, b, i); + params.set(mName, r, g, b, i); } }; // float slider control struct WLFloatControl { F32 x; - char const * name; + std::string mName; F32 mult; - inline WLFloatControl(F32 val, char const * n, F32 m=1.0f) - : x(val), name(n), mult(m) + inline WLFloatControl(F32 val, const std::string& n, F32 m=1.0f) + : x(val), mName(n), mult(m) { } @@ -116,7 +116,7 @@ struct WLFloatControl { } inline void update(LLWLParamSet & params) const { - params.set(name, x); + params.set(mName, x); } }; @@ -129,16 +129,16 @@ public: ~LLWLParamManager(); /// load a preset file - void loadPresets(const LLString & fileName); + void loadPresets(const std::string & fileName); /// save the preset file - void savePresets(const LLString & fileName); + void savePresets(const std::string & fileName); /// load an individual preset into the sky - void loadPreset(const LLString & name); + void loadPreset(const std::string & name); /// save the parameter presets to file - void savePreset(const LLString & name); + void savePreset(const std::string & name); /// Set shader uniforms dirty, so they'll update automatically. void propagateParameters(void); diff --git a/indra/newview/llwlparamset.cpp b/indra/newview/llwlparamset.cpp index 6e1a3972ea..7a109c42de 100644 --- a/indra/newview/llwlparamset.cpp +++ b/indra/newview/llwlparamset.cpp @@ -80,7 +80,7 @@ void LLWLParamSet::update(LLGLSLShader * shader) const i != mParamValues.endMap(); ++i) { - const LLString& param = i->first; + const std::string& param = i->first; if( param == "star_brightness" || param == "preset_num" || param == "sun_angle" || param == "east_angle" || param == "enable_cloud_scroll" || @@ -130,7 +130,7 @@ void LLWLParamSet::update(LLGLSLShader * shader) const } } -void LLWLParamSet::set(const char * paramName, float x) +void LLWLParamSet::set(const std::string& paramName, float x) { // handle case where no array if(mParamValues[paramName].isReal()) @@ -146,19 +146,19 @@ void LLWLParamSet::set(const char * paramName, float x) } } -void LLWLParamSet::set(const char * paramName, float x, float y) { +void LLWLParamSet::set(const std::string& paramName, float x, float y) { mParamValues[paramName][0] = x; mParamValues[paramName][1] = y; } -void LLWLParamSet::set(const char * paramName, float x, float y, float z) +void LLWLParamSet::set(const std::string& paramName, float x, float y, float z) { mParamValues[paramName][0] = x; mParamValues[paramName][1] = y; mParamValues[paramName][2] = z; } -void LLWLParamSet::set(const char * paramName, float x, float y, float z, float w) +void LLWLParamSet::set(const std::string& paramName, float x, float y, float z, float w) { mParamValues[paramName][0] = x; mParamValues[paramName][1] = y; @@ -166,7 +166,7 @@ void LLWLParamSet::set(const char * paramName, float x, float y, float z, float mParamValues[paramName][3] = w; } -void LLWLParamSet::set(const char * paramName, const float * val) +void LLWLParamSet::set(const std::string& paramName, const float * val) { mParamValues[paramName][0] = val[0]; mParamValues[paramName][1] = val[1]; @@ -174,7 +174,7 @@ void LLWLParamSet::set(const char * paramName, const float * val) mParamValues[paramName][3] = val[3]; } -void LLWLParamSet::set(const char * paramName, const LLVector4 & val) +void LLWLParamSet::set(const std::string& paramName, const LLVector4 & val) { mParamValues[paramName][0] = val.mV[0]; mParamValues[paramName][1] = val.mV[1]; @@ -182,7 +182,7 @@ void LLWLParamSet::set(const char * paramName, const LLVector4 & val) mParamValues[paramName][3] = val.mV[3]; } -void LLWLParamSet::set(const char * paramName, const LLColor4 & val) +void LLWLParamSet::set(const std::string& paramName, const LLColor4 & val) { mParamValues[paramName][0] = val.mV[0]; mParamValues[paramName][1] = val.mV[1]; @@ -190,7 +190,7 @@ void LLWLParamSet::set(const char * paramName, const LLColor4 & val) mParamValues[paramName][3] = val.mV[3]; } -LLVector4 LLWLParamSet::getVector(const char * paramName, bool& error) +LLVector4 LLWLParamSet::getVector(const std::string& paramName, bool& error) { // test to see if right type @@ -211,7 +211,7 @@ LLVector4 LLWLParamSet::getVector(const char * paramName, bool& error) return val; } -F32 LLWLParamSet::getFloat(const char * paramName, bool& error) +F32 LLWLParamSet::getFloat(const std::string& paramName, bool& error) { // test to see if right type diff --git a/indra/newview/llwlparamset.h b/indra/newview/llwlparamset.h index fe075ece9a..15afeaf364 100644 --- a/indra/newview/llwlparamset.h +++ b/indra/newview/llwlparamset.h @@ -48,7 +48,7 @@ class LLWLParamSet { friend class LLWLParamManager; public: - LLString mName; + std::string mName; private: @@ -73,20 +73,20 @@ public: /// Set a float parameter. /// \param paramName The name of the parameter to set. /// \param x The float value to set. - void set(const char * paramName, float x); + void set(const std::string& paramName, float x); /// Set a float2 parameter. /// \param paramName The name of the parameter to set. /// \param x The x component's value to set. /// \param y The y component's value to set. - void set(const char * paramName, float x, float y); + void set(const std::string& paramName, float x, float y); /// Set a float3 parameter. /// \param paramName The name of the parameter to set. /// \param x The x component's value to set. /// \param y The y component's value to set. /// \param z The z component's value to set. - void set(const char * paramName, float x, float y, float z); + void set(const std::string& paramName, float x, float y, float z); /// Set a float4 parameter. /// \param paramName The name of the parameter to set. @@ -94,32 +94,32 @@ public: /// \param y The y component's value to set. /// \param z The z component's value to set. /// \param w The w component's value to set. - void set(const char * paramName, float x, float y, float z, float w); + void set(const std::string& paramName, float x, float y, float z, float w); /// Set a float4 parameter. /// \param paramName The name of the parameter to set. /// \param val An array of the 4 float values to set the parameter to. - void set(const char * paramName, const float * val); + void set(const std::string& paramName, const float * val); /// Set a float4 parameter. /// \param paramName The name of the parameter to set. /// \param val A struct of the 4 float values to set the parameter to. - void set(const char * paramName, const LLVector4 & val); + void set(const std::string& paramName, const LLVector4 & val); /// Set a float4 parameter. /// \param paramName The name of the parameter to set. /// \param val A struct of the 4 float values to set the parameter to. - void set(const char * paramName, const LLColor4 & val); + void set(const std::string& paramName, const LLColor4 & val); /// Get a float4 parameter. /// \param paramName The name of the parameter to set. /// \param error A flag to set if it's not the proper return type - LLVector4 getVector(const char * paramName, bool& error); + LLVector4 getVector(const std::string& paramName, bool& error); /// Get an integer parameter /// \param paramName The name of the parameter to set. /// \param error A flag to set if it's not the proper return type - F32 getFloat(const char * paramName, bool& error); + F32 getFloat(const std::string& paramName, bool& error); // specific getters and setters diff --git a/indra/newview/llworldmap.cpp b/indra/newview/llworldmap.cpp index 1dd08604cd..2afeb4a1e4 100644 --- a/indra/newview/llworldmap.cpp +++ b/indra/newview/llworldmap.cpp @@ -237,7 +237,7 @@ LLSimInfo* LLWorldMap::simInfoFromHandle(const U64 handle) } -LLSimInfo* LLWorldMap::simInfoFromName(const LLString& sim_name) +LLSimInfo* LLWorldMap::simInfoFromName(const std::string& sim_name) { LLSimInfo* sim_info = NULL; if (!sim_name.empty()) @@ -246,7 +246,7 @@ LLSimInfo* LLWorldMap::simInfoFromName(const LLString& sim_name) { sim_info = (*it).second; if (sim_info - && (0 == LLString::compareInsensitive(sim_name.c_str(), sim_info->mName.c_str())) ) + && (0 == LLStringUtil::compareInsensitive(sim_name, sim_info->mName)) ) { break; } @@ -256,7 +256,7 @@ LLSimInfo* LLWorldMap::simInfoFromName(const LLString& sim_name) return sim_info; } -bool LLWorldMap::simNameFromPosGlobal(const LLVector3d& pos_global, LLString & outSimName ) +bool LLWorldMap::simNameFromPosGlobal(const LLVector3d& pos_global, std::string & outSimName ) { bool gotSimName = true; @@ -266,7 +266,7 @@ bool LLWorldMap::simNameFromPosGlobal(const LLVector3d& pos_global, LLString & o if (it != mSimInfoMap.end()) { LLSimInfo* info = (*it).second; - outSimName = info->mName.c_str(); + outSimName = info->mName; } else { @@ -552,16 +552,16 @@ void LLWorldMap::processMapBlockReply(LLMessageSystem* msg, void**) { U16 x_regions; U16 y_regions; - char name[MAX_STRING]; /* Flawfinder: ignore */ - U8 access; /* Flawfinder: ignore */ + std::string name; + U8 accesscode; U32 region_flags; U8 water_height; U8 agents; LLUUID image_id; msg->getU16Fast(_PREHASH_Data, _PREHASH_X, x_regions, block); msg->getU16Fast(_PREHASH_Data, _PREHASH_Y, y_regions, block); - msg->getStringFast(_PREHASH_Data, _PREHASH_Name, MAX_STRING, name, block); - msg->getU8Fast(_PREHASH_Data, _PREHASH_Access, access, block); /* Flawfinder: ignore */ + msg->getStringFast(_PREHASH_Data, _PREHASH_Name, name, block); + msg->getU8Fast(_PREHASH_Data, _PREHASH_Access, accesscode, block); msg->getU32Fast(_PREHASH_Data, _PREHASH_RegionFlags, region_flags, block); msg->getU8Fast(_PREHASH_Data, _PREHASH_WaterHeight, water_height, block); msg->getU8Fast(_PREHASH_Data, _PREHASH_Agents, agents, block); @@ -572,7 +572,7 @@ void LLWorldMap::processMapBlockReply(LLMessageSystem* msg, void**) U64 handle = to_region_handle(x_meters, y_meters); - if (access == 255) + if (accesscode == 255) { // This region doesn't exist if (LLWorldMap::getInstance()->mIsTrackingUnknownLocation && @@ -611,7 +611,7 @@ void LLWorldMap::processMapBlockReply(LLMessageSystem* msg, void**) siminfo->mHandle = handle; siminfo->mName.assign( name ); - siminfo->mAccess = access; /* Flawfinder: ignore */ + siminfo->mAccess = accesscode; siminfo->mRegionFlags = region_flags; siminfo->mWaterHeight = (F32) water_height; siminfo->mMapImageID[agent_flags] = image_id; @@ -655,9 +655,9 @@ void LLWorldMap::processMapBlockReply(LLMessageSystem* msg, void**) if(LLWorldMap::getInstance()->mSLURLCallback != NULL) { - // Server returns definitive capitalization, SLURL might - // not have that. - if (!stricmp(LLWorldMap::getInstance()->mSLURLRegionName.c_str(), name) || (LLWorldMap::getInstance()->mSLURLRegionHandle == handle)) + // Server returns definitive capitalization, SLURL might not have that. + if ((LLStringUtil::compareInsensitive(LLWorldMap::getInstance()->mSLURLRegionName, name)==0) + || (LLWorldMap::getInstance()->mSLURLRegionHandle == handle)) { url_callback_t callback = LLWorldMap::getInstance()->mSLURLCallback; @@ -685,12 +685,12 @@ void LLWorldMap::processMapItemReply(LLMessageSystem* msg, void**) for (S32 block=0; block<num_blocks; ++block) { U32 X, Y; - char name[MAX_STRING]; /* Flawfinder: ignore */ + std::string name; S32 extra, extra2; LLUUID uuid; msg->getU32Fast(_PREHASH_Data, _PREHASH_X, X, block); msg->getU32Fast(_PREHASH_Data, _PREHASH_Y, Y, block); - msg->getStringFast(_PREHASH_Data, _PREHASH_Name, MAX_STRING, name, block); + msg->getStringFast(_PREHASH_Data, _PREHASH_Name, name, block); msg->getUUIDFast(_PREHASH_Data, _PREHASH_ID, uuid, block); msg->getS32Fast(_PREHASH_Data, _PREHASH_Extra, extra, block); msg->getS32Fast(_PREHASH_Data, _PREHASH_Extra2, extra2, block); @@ -735,7 +735,6 @@ void LLWorldMap::processMapItemReply(LLMessageSystem* msg, void**) case MAP_ITEM_PG_EVENT: // events case MAP_ITEM_MATURE_EVENT: { - char buffer[32]; /* Flawfinder: ignore */ struct tm* timep; // Convert to Pacific, based on server's opinion of whether // it's daylight savings time there. @@ -744,11 +743,10 @@ void LLWorldMap::processMapItemReply(LLMessageSystem* msg, void**) S32 display_hour = timep->tm_hour % 12; if (display_hour == 0) display_hour = 12; - snprintf(buffer, sizeof(buffer), "%d:%02d %s", /* Flawfinder: ignore */ - display_hour, - timep->tm_min, - (timep->tm_hour < 12 ? "AM" : "PM") ); - new_item.mToolTip.assign( buffer ); + new_item.mToolTip = llformat( "%d:%02d %s", + display_hour, + timep->tm_min, + (timep->tm_hour < 12 ? "AM" : "PM") ); // HACK: store Z in extra2 new_item.mPosGlobal.mdV[VZ] = (F64)extra2; @@ -824,7 +822,7 @@ void LLWorldMap::dump() from_region_handle(handle, &x_pos, &y_pos); llinfos << x_pos << "," << y_pos - << " " << info->mName.c_str() + << " " << info->mName << " " << (S32)info->mAccess << " " << std::hex << info->mRegionFlags << std::dec << " " << info->mWaterHeight diff --git a/indra/newview/llworldmap.h b/indra/newview/llworldmap.h index 3c22159cc8..5d9e1972ae 100644 --- a/indra/newview/llworldmap.h +++ b/indra/newview/llworldmap.h @@ -138,10 +138,10 @@ public: LLSimInfo* simInfoFromPosGlobal(const LLVector3d& pos_global); // Returns simulator information for named sim, or NULL if non-existent - LLSimInfo* simInfoFromName(const LLString& sim_name); + LLSimInfo* simInfoFromName(const std::string& sim_name); // Gets simulator name for a global position, returns true if it was found - bool simNameFromPosGlobal(const LLVector3d& pos_global, LLString & outSimName ); + bool simNameFromPosGlobal(const LLVector3d& pos_global, std::string& outSimName ); // Sets the current layer void setCurrentLayer(S32 layer, bool request_layer = false); diff --git a/indra/newview/llworldmapview.cpp b/indra/newview/llworldmapview.cpp index 04a09490ea..b5e23550b9 100644 --- a/indra/newview/llworldmapview.cpp +++ b/indra/newview/llworldmapview.cpp @@ -99,7 +99,7 @@ S32 LLWorldMapView::sTrackingArrowY = 0; F32 LLWorldMapView::sPixelsPerMeter = 1.f; F32 CONE_SIZE = 0.6f; -std::map<std::string,LLString> LLWorldMapView::sStringsMap; +std::map<std::string,std::string> LLWorldMapView::sStringsMap; #define SIM_NULL_MAP_SCALE 1 // width in pixels, where we start drawing "null" sims #define SIM_MAP_AGENT_SCALE 2 // width in pixels, where we start drawing agents @@ -172,40 +172,40 @@ LLWorldMapView::LLWorldMapView(const std::string& name, const LLRect& rect ) const S32 DIR_HEIGHT = 10; LLRect major_dir_rect( 0, DIR_HEIGHT, DIR_WIDTH, 0 ); - mTextBoxNorth = new LLTextBox( "N", major_dir_rect ); + mTextBoxNorth = new LLTextBox( std::string("N"), major_dir_rect ); addChild( mTextBoxNorth ); LLColor4 minor_color( 1.f, 1.f, 1.f, .7f ); - mTextBoxEast = new LLTextBox( "E", major_dir_rect ); + mTextBoxEast = new LLTextBox( std::string("E"), major_dir_rect ); mTextBoxEast->setColor( minor_color ); addChild( mTextBoxEast ); major_dir_rect.mRight += 1 ; - mTextBoxWest = new LLTextBox( "W", major_dir_rect ); + mTextBoxWest = new LLTextBox( std::string("W"), major_dir_rect ); mTextBoxWest->setColor( minor_color ); addChild( mTextBoxWest ); major_dir_rect.mRight -= 1 ; - mTextBoxSouth = new LLTextBox( "S", major_dir_rect ); + mTextBoxSouth = new LLTextBox( std::string("S"), major_dir_rect ); mTextBoxSouth->setColor( minor_color ); addChild( mTextBoxSouth ); LLRect minor_dir_rect( 0, DIR_HEIGHT, DIR_WIDTH * 2, 0 ); - mTextBoxSouthEast = new LLTextBox( "SE", minor_dir_rect ); + mTextBoxSouthEast = new LLTextBox( std::string("SE"), minor_dir_rect ); mTextBoxSouthEast->setColor( minor_color ); addChild( mTextBoxSouthEast ); - mTextBoxNorthEast = new LLTextBox( "NE", minor_dir_rect ); + mTextBoxNorthEast = new LLTextBox( std::string("NE"), minor_dir_rect ); mTextBoxNorthEast->setColor( minor_color ); addChild( mTextBoxNorthEast ); - mTextBoxSouthWest = new LLTextBox( "SW", minor_dir_rect ); + mTextBoxSouthWest = new LLTextBox( std::string("SW"), minor_dir_rect ); mTextBoxSouthWest->setColor( minor_color ); addChild( mTextBoxSouthWest ); - mTextBoxNorthWest = new LLTextBox( "NW", minor_dir_rect ); + mTextBoxNorthWest = new LLTextBox( std::string("NW"), minor_dir_rect ); mTextBoxNorthWest->setColor( minor_color ); addChild( mTextBoxNorthWest ); } @@ -625,33 +625,31 @@ void LLWorldMapView::draw() // Draw the region name in the lower left corner LLFontGL* font = LLFontGL::sSansSerifSmall; - char mesg[MAX_STRING]; /* Flawfinder: ignore */ + std::string mesg; if (gMapScale < sThresholdA) { - mesg[0] = '\0'; } else if (gMapScale < sThresholdB) { - //sprintf(mesg, "%d", info->mAgents); - mesg[0] = '\0'; + // mesg = llformat( info->mAgents); } else { - //sprintf(mesg, "%d / %s (%s)", + //mesg = llformat("%d / %s (%s)", // info->mAgents, // info->mName.c_str(), - // LLViewerRegion::accessToShortString(info->mAccess) ); + // LLViewerRegion::accessToShortString(info->mAccess).c_str() ); if (info->mAccess == SIM_ACCESS_DOWN) { - snprintf(mesg, MAX_STRING, "%s (%s)", info->mName.c_str(), sStringsMap["offline"].c_str()); /* Flawfinder: ignore */ + mesg = llformat( "%s (%s)", info->mName.c_str(), sStringsMap["offline"].c_str()); } else { - snprintf(mesg, MAX_STRING, "%s", info->mName.c_str()); /* Flawfinder: ignore */ + mesg = info->mName; } } - if (mesg[0] != '\0') + if (!mesg.empty()) { font->renderUTF8( mesg, 0, @@ -668,7 +666,7 @@ void LLWorldMapView::draw() simimage->getDiscardLevel() != 0) { font->renderUTF8( - sStringsMap["loading"].c_str(), 0, + sStringsMap["loading"], 0, llfloor(left + 18), llfloor(top - 25), LLColor4::white, @@ -1017,8 +1015,8 @@ LLVector3 LLWorldMapView::globalPosToView( const LLVector3d& global_pos ) } -void LLWorldMapView::drawTracking(const LLVector3d& pos_global, const LLColor4& color, - BOOL draw_arrow, LLString label, LLString tooltip, S32 vert_offset ) +void LLWorldMapView::drawTracking(const LLVector3d& pos_global, const LLColor4& color, BOOL draw_arrow, + const std::string& label, const std::string& tooltip, S32 vert_offset ) { LLVector3 pos_local = globalPosToView( pos_global ); S32 x = llround( pos_local.mV[VX] ); @@ -1108,7 +1106,7 @@ LLVector3d LLWorldMapView::viewPosToGlobal( S32 x, S32 y ) } -BOOL LLWorldMapView::handleToolTip( S32 x, S32 y, LLString& msg, LLRect* sticky_rect_screen ) +BOOL LLWorldMapView::handleToolTip( S32 x, S32 y, std::string& msg, LLRect* sticky_rect_screen ) { LLVector3d pos_global = viewPosToGlobal(x, y); @@ -1120,7 +1118,7 @@ BOOL LLWorldMapView::handleToolTip( S32 x, S32 y, LLString& msg, LLRect* sticky_ std::string message = llformat("%s (%s)", info->mName.c_str(), - LLViewerRegion::accessToString(info->mAccess)); + LLViewerRegion::accessToString(info->mAccess).c_str()); if (info->mAccess != SIM_ACCESS_DOWN) { @@ -1784,10 +1782,11 @@ BOOL LLWorldMapView::handleDoubleClick( S32 x, S32 y, MASK mask ) { gFloaterWorldMap->close(); // This is an ungainly hack - char uuid_str[38]; /* Flawfinder: ignore */ + std::string uuid_str; S32 event_id; id.toString(uuid_str); - sscanf(&uuid_str[28], "%X", &event_id); + uuid_str = uuid_str.substr(28); + sscanf(uuid_str.c_str(), "%X", &event_id); LLFloaterDirectory::showEvents(event_id); break; } diff --git a/indra/newview/llworldmapview.h b/indra/newview/llworldmapview.h index 8f70b79f2e..7fce2a03cc 100644 --- a/indra/newview/llworldmapview.h +++ b/indra/newview/llworldmapview.h @@ -69,7 +69,7 @@ public: virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); virtual BOOL handleDoubleClick( S32 x, S32 y, MASK mask ); virtual BOOL handleHover( S32 x, S32 y, MASK mask ); - virtual BOOL handleToolTip( S32 x, S32 y, LLString& msg, LLRect* sticky_rect_screen ); + virtual BOOL handleToolTip( S32 x, S32 y, std::string& msg, LLRect* sticky_rect_screen ); bool checkItemHit(S32 x, S32 y, LLItemInfo& item, LLUUID* id, bool track); void handleClick(S32 x, S32 y, MASK mask, S32* hit_type, LLUUID* id); @@ -95,9 +95,9 @@ public: // Draw the tracking indicator, doing the right thing if it's outside // the view area. - void drawTracking( const LLVector3d& pos_global, - const LLColor4& color, - BOOL draw_arrow = TRUE, LLString label = LLString(), LLString tooltip = "", S32 vert_offset = 0); + void drawTracking( const LLVector3d& pos_global, const LLColor4& color, BOOL draw_arrow = TRUE, + const std::string& label = std::string(), const std::string& tooltip = std::string(), + S32 vert_offset = 0); static void drawTrackingArrow(const LLRect& view_rect, S32 x, S32 y, const LLColor4& color, S32 arrow_size = DEFAULT_TRACKING_ARROW_SIZE); @@ -188,7 +188,7 @@ public: typedef std::vector<U64> handle_list_t; handle_list_t mVisibleRegions; // set every frame - static std::map<std::string,LLString> sStringsMap; + static std::map<std::string,std::string> sStringsMap; }; #endif |