From 778bfc932f1b107c1bf79e11b66e2c467c58cc26 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Thu, 25 Apr 2019 15:10:19 -0400 Subject: Remove a couple unused iterators per Xcode 10.2.1. --- indra/llui/lllayoutstack.cpp | 1 - indra/newview/llappearancemgr.cpp | 1 - 2 files changed, 2 deletions(-) (limited to 'indra') diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp index 69246a2f57..ce8dbb1f66 100644 --- a/indra/llui/lllayoutstack.cpp +++ b/indra/llui/lllayoutstack.cpp @@ -510,7 +510,6 @@ LLLayoutPanel* LLLayoutStack::findEmbeddedPanel(LLPanel* panelp) const { if (!panelp) return NULL; - e_panel_list_t::const_iterator panel_it; BOOST_FOREACH(LLLayoutPanel* p, mPanels) { if (p == panelp) diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 08daeb0f59..22bcbad7da 100644 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -1865,7 +1865,6 @@ bool LLAppearanceMgr::getCanRemoveOutfit(const LLUUID& outfit_cat_id) LLFindNonRemovableObjects filter_non_removable; LLInventoryModel::cat_array_t cats; LLInventoryModel::item_array_t items; - LLInventoryModel::item_array_t::const_iterator it; gInventory.collectDescendentsIf(outfit_cat_id, cats, items, false, filter_non_removable); if (!cats.empty() || !items.empty()) { -- cgit v1.2.3 From 468fbd6b515cf321834e0056adde9b29e07ccffc Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Thu, 25 Apr 2019 15:11:55 -0400 Subject: Return CGPoint and CGSize by value, not const ref to temporary. --- indra/llwindow/llwindowmacosx-objc.h | 6 +++--- indra/llwindow/llwindowmacosx-objc.mm | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'indra') diff --git a/indra/llwindow/llwindowmacosx-objc.h b/indra/llwindow/llwindowmacosx-objc.h index 34da99de19..99af161102 100644 --- a/indra/llwindow/llwindowmacosx-objc.h +++ b/indra/llwindow/llwindowmacosx-objc.h @@ -110,9 +110,9 @@ void glSwapBuffers(void* context); CGLContextObj getCGLContextObj(GLViewRef view); unsigned long getVramSize(GLViewRef view); float getDeviceUnitSize(GLViewRef view); -const CGPoint & getContentViewBoundsPosition(NSWindowRef window); -const CGSize & getContentViewBoundsSize(NSWindowRef window); -const CGSize & getDeviceContentViewSize(NSWindowRef window, GLViewRef view); +CGPoint getContentViewBoundsPosition(NSWindowRef window); +CGSize getContentViewBoundsSize(NSWindowRef window); +CGSize getDeviceContentViewSize(NSWindowRef window, GLViewRef view); void getWindowSize(NSWindowRef window, float* size); void setWindowSize(NSWindowRef window, int width, int height); void getCursorPos(NSWindowRef window, float* pos); diff --git a/indra/llwindow/llwindowmacosx-objc.mm b/indra/llwindow/llwindowmacosx-objc.mm index c3eb9b8c8a..f895c17643 100644 --- a/indra/llwindow/llwindowmacosx-objc.mm +++ b/indra/llwindow/llwindowmacosx-objc.mm @@ -258,17 +258,17 @@ float getDeviceUnitSize(GLViewRef view) return [(LLOpenGLView*)view convertSizeToBacking:NSMakeSize(1, 1)].width; } -const CGPoint & getContentViewBoundsPosition(NSWindowRef window) +CGPoint getContentViewBoundsPosition(NSWindowRef window) { return [[(LLNSWindow*)window contentView] bounds].origin; } -const CGSize & getContentViewBoundsSize(NSWindowRef window) +CGSize getContentViewBoundsSize(NSWindowRef window) { return [[(LLNSWindow*)window contentView] bounds].size; } -const CGSize & getDeviceContentViewSize(NSWindowRef window, GLViewRef view) +CGSize getDeviceContentViewSize(NSWindowRef window, GLViewRef view) { return [(NSOpenGLView*)view convertRectToBacking:[[(LLNSWindow*)window contentView] bounds]].size; } -- cgit v1.2.3 From a2d4122de41ff161b7397ca663a41595cb9dbf2a Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Thu, 25 Apr 2019 15:40:44 -0400 Subject: Reorder logic in LLAppViewer::initConfiguration(); remove dup code. There were two nearly-identical copies of a stanza that calls sendURLToOtherInstance(). Remove one. It's possible that the reason no one noticed the duplication was because the two copies were 70 lines apart. Move setSkinFolder(), setUseSpellCheck() and setSecondaryDictionaries() stanzas to consolidate SLURL-handling code more closely. Also move logic for NextLoginLocation and CmdLineLoginLocation. Remove a couple unnecessary std::ostringstream instances. Streaming a single string literal to std::ostringstream and retrieving its str() is the same as simply converting the literal to std::string, only slower. OSMessageBox() accepts const std::string&. Given that you have a std::string in hand, passing its c_str() to OSMessageBox() is not only unnecessary but wasteful: it requires silently converting the const char* back to a different std::string instance. Calling a class method from another method of the same class does not require ClassName:: qualification. Calling a singleton subclass method from another non-static method of the same subclass does not require going through ClassName::instance() or sInstance or whatever. --- indra/newview/llappviewer.cpp | 124 +++++++++++++++++++----------------------- 1 file changed, 56 insertions(+), 68 deletions(-) (limited to 'indra') diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 1bc21ec469..9d658ab376 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -2429,9 +2429,9 @@ bool LLAppViewer::initConfiguration() bool set_defaults = true; if(!loadSettingsFromDirectory("Default", set_defaults)) { - std::ostringstream msg; - msg << "Unable to load default settings file. The installation may be corrupted."; - OSMessageBox(msg.str(),LLStringUtil::null,OSMB_OK); + OSMessageBox( + "Unable to load default settings file. The installation may be corrupted.", + LLStringUtil::null,OSMB_OK); return false; } @@ -2552,7 +2552,7 @@ bool LLAppViewer::initConfiguration() if(gSavedSettings.getBOOL("DisableCrashLogger")) { LL_WARNS() << "Crashes will be handled by system, stack trace logs and crash logger are both disabled" << LL_ENDL; - LLAppViewer::instance()->disableCrashlogger(); + disableCrashlogger(); } // Handle initialization from settings. @@ -2569,7 +2569,7 @@ bool LLAppViewer::initConfiguration() LL_INFOS() << msg.str() << LL_ENDL; OSMessageBox( - msg.str().c_str(), + msg.str(), LLStringUtil::null, OSMB_OK); @@ -2679,7 +2679,34 @@ bool LLAppViewer::initConfiguration() ll_init_fail_log(gDirUtilp->getExpandedFilename(LL_PATH_LOGS, "test_failures.log")); } + const LLControlVariable* skinfolder = gSavedSettings.getControl("SkinCurrent"); + if(skinfolder && LLStringUtil::null != skinfolder->getValue().asString()) + { + // Examining "Language" may not suffice -- see LLUI::getLanguage() + // logic. Unfortunately LLUI::getLanguage() doesn't yet do us much + // good because we haven't yet called LLUI::initClass(). + gDirUtilp->setSkinFolder(skinfolder->getValue().asString(), + gSavedSettings.getString("Language")); + } + + if (gSavedSettings.getBOOL("SpellCheck")) + { + std::list dict_list; + std::string dict_setting = gSavedSettings.getString("SpellCheckDictionary"); + boost::split(dict_list, dict_setting, boost::is_any_of(std::string(","))); + if (!dict_list.empty()) + { + LLSpellChecker::setUseSpellCheck(dict_list.front()); + dict_list.pop_front(); + LLSpellChecker::instance().setSecondaryDictionaries(dict_list); + } + } + // Handle slurl use. NOTE: Don't let SL-55321 reappear. + // This initial-SLURL logic, up through the call to + // sendURLToOtherInstance(), must precede LLSplashScreen::show() -- + // because if sendURLToOtherInstance() succeeds, we take a fast exit, + // SKIPPING the splash screen and everything else. // *FIX: This init code should be made more robust to prevent // the issue SL-55321 from returning. One thought is to allow @@ -2724,6 +2751,27 @@ bool LLAppViewer::initConfiguration() } } + // NextLoginLocation is set as a side effect of LLStartUp::setStartSLURL() + std::string nextLoginLocation = gSavedSettings.getString( "NextLoginLocation" ); + if ( !nextLoginLocation.empty() ) + { + LL_DEBUGS("AppInit")<<"set start from NextLoginLocation: "<getValue().asString()) - { - // Examining "Language" may not suffice -- see LLUI::getLanguage() - // logic. Unfortunately LLUI::getLanguage() doesn't yet do us much - // good because we haven't yet called LLUI::initClass(). - gDirUtilp->setSkinFolder(skinfolder->getValue().asString(), - gSavedSettings.getString("Language")); - } - - if (gSavedSettings.getBOOL("SpellCheck")) - { - std::list dict_list; - std::string dict_setting = gSavedSettings.getString("SpellCheckDictionary"); - boost::split(dict_list, dict_setting, boost::is_any_of(std::string(","))); - if (!dict_list.empty()) - { - LLSpellChecker::setUseSpellCheck(dict_list.front()); - dict_list.pop_front(); - LLSpellChecker::instance().setSecondaryDictionaries(dict_list); - } - } - - // Display splash screen. Must be after above check for previous // crash as this dialog is always frontmost. std::string splash_msg; @@ -2794,30 +2818,15 @@ bool LLAppViewer::initConfiguration() } 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 - // it relies on checking a marker file which will not work when running - // out of different directories - - if (LLStartUp::getStartSLURL().isValid() && - (gSavedSettings.getBOOL("SLURLPassToOtherInstance"))) - { - if (sendURLToOtherInstance(LLStartUp::getStartSLURL().getSLURLString())) - { - // successfully handed off URL to existing instance, exit - return false; - } - } - // // Check for another instance of the app running + // This happens AFTER LLSplashScreen::show(). That may or may not be + // important. // if (mSecondInstance && !gSavedSettings.getBOOL("AllowMultipleViewers")) { - std::ostringstream msg; - msg << LLTrans::getString("MBAlreadyRunning"); OSMessageBox( - msg.str(), + LLTrans::getString("MBAlreadyRunning"), LLStringUtil::null, OSMB_OK); return false; @@ -2835,27 +2844,6 @@ bool LLAppViewer::initConfiguration() } } - // NextLoginLocation is set from the command line option - std::string nextLoginLocation = gSavedSettings.getString( "NextLoginLocation" ); - if ( !nextLoginLocation.empty() ) - { - LL_DEBUGS("AppInit")<<"set start from NextLoginLocation: "< Date: Thu, 25 Apr 2019 15:48:20 -0400 Subject: SL-11049: Notice explicit --grid command-line switch and honor it. LLPanelLogin's constructor checks both LLGridManager::getGrid() and LLStartUp::getStartSLURL(). But by the time we get there, we've blurred the distinction between explicit command-line arguments and defaults left over from a previous run. Of course, if the grid implied by getStartSLURL() is the same as the getGrid(), the distinction is irrelevant. But if they differ, up until now, getStartSLURL() has always "won" -- even when getGrid() was set by an explicit --grid switch whereas getStartSLURL() was only left over from a previous run. Notice that case and try to avoid overriding the explicitly-specified grid with the grid from the default SLURL. --- indra/newview/llpanellogin.cpp | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) (limited to 'indra') diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index 142dea83e2..0b674301f0 100644 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -178,7 +178,7 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect, mPasswordModified = FALSE; - LLPanelLogin::sInstance = this; + sInstance = this; LLView* login_holder = gViewerWindow->getLoginPanelHolder(); if (login_holder) @@ -234,29 +234,44 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect, server_choice_combo->add(LLGridManager::getInstance()->getGridLabel(), current_grid, ADD_TOP); - server_choice_combo->selectFirstItem(); + server_choice_combo->selectFirstItem(); LLSLURL start_slurl(LLStartUp::getStartSLURL()); + // The StartSLURL might have been set either by an explicit command-line + // argument (CmdLineLoginLocation) or by default. + // current_grid might have been set either by an explicit command-line + // argument (CmdLineGridChoice) or by default. + // If the grid specified by StartSLURL is the same as current_grid, the + // distinction is moot. + // If we have an explicit command-line SLURL, use that. + // If we DON'T have an explicit command-line SLURL but we DO have an + // explicit command-line grid, which is different from the default SLURL's + // -- do NOT override the explicit command-line grid with the grid from + // the default SLURL! + bool force_grid{ start_slurl.getGrid() != current_grid && + gSavedSettings.getString("CmdLineLoginLocation").empty() && + ! gSavedSettings.getString("CmdLineGridChoice").empty() }; if ( !start_slurl.isSpatial() ) // has a start been established by the command line or NextLoginLocation ? { // no, so get the preference setting std::string defaultStartLocation = gSavedSettings.getString("LoginLocation"); LL_INFOS("AppInit")<<"default LoginLocation '"<