summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2018-12-14 15:38:13 -0500
committerNat Goodspeed <nat@lindenlab.com>2018-12-14 15:38:13 -0500
commitc4096f670c7b3d43f8a5c1f65ef7e02033b0329d (patch)
tree29f3f8cae0dc5bfc983a25ec6e4e9afb245d4925
parent132e708fec50fd756b822925313456c70a4ff27f (diff)
SL-10153: Review and rationalize fetching paths from environment.
Use LLStringUtil::getenv() or getoptenv() whenever we fetch a string that will be used as a pathname. Use LLFile::tmpdir() instead of getenv("TEMP"). As an added extra-special bonus, finally clean up $TMP/llcontrol-test-zzzzzz directories that have been accumulating every time we run a local build!
-rw-r--r--indra/llcommon/llfile.cpp19
-rw-r--r--indra/llcommon/tests/llleap_test.cpp7
-rw-r--r--indra/llcommon/tests/llprocess_test.cpp5
-rw-r--r--indra/llcommon/tests/llsdserialize_test.cpp7
-rw-r--r--indra/llmessage/tests/commtest.h8
-rw-r--r--indra/llmessage/tests/llhttpclient_test.cpp9
-rw-r--r--indra/llrender/llfontgl.cpp41
-rw-r--r--indra/llvfs/lldir_linux.cpp33
-rw-r--r--indra/llvfs/lldir_solaris.cpp60
-rw-r--r--indra/llvfs/lldir_win32.cpp26
-rw-r--r--indra/llxml/tests/llcontrol_test.cpp39
-rw-r--r--indra/newview/llexternaleditor.cpp7
-rw-r--r--indra/newview/llwebprofile.cpp4
13 files changed, 116 insertions, 149 deletions
diff --git a/indra/llcommon/llfile.cpp b/indra/llcommon/llfile.cpp
index fc203f78e1..8355b1e797 100644
--- a/indra/llcommon/llfile.cpp
+++ b/indra/llcommon/llfile.cpp
@@ -30,6 +30,7 @@
#if LL_WINDOWS
#include "llwin32headerslean.h"
#include <stdlib.h> // Windows errno
+#include <vector>
#else
#include <errno.h>
#endif
@@ -134,8 +135,10 @@ int warnif(const std::string& desc, const std::string& filename, int rc, int acc
{
// Only do any of this stuff (before LL_ENDL) if it will be logged.
LL_DEBUGS("LLFile") << empty;
- const char* TEMP = getenv("TEMP");
- if (! TEMP)
+ // would be nice to use LLDir for this, but dependency goes the
+ // wrong way
+ const char* TEMP = LLFile::tmpdir();
+ if (! (TEMP && *TEMP))
{
LL_CONT << "No $TEMP, not running 'handle'";
}
@@ -341,17 +344,13 @@ const char *LLFile::tmpdir()
#if LL_WINDOWS
sep = '\\';
- DWORD len = GetTempPathW(0, L"");
- llutf16string utf16path;
- utf16path.resize(len + 1);
- len = GetTempPathW(static_cast<DWORD>(utf16path.size()), &utf16path[0]);
- utf8path = utf16str_to_utf8str(utf16path);
+ std::vector<wchar_t> utf16path(MAX_PATH + 1);
+ GetTempPathW(utf16path.size(), &utf16path[0]);
+ utf8path = ll_convert_wide_to_string(&utf16path[0]);
#else
sep = '/';
- char *env = getenv("TMPDIR");
-
- utf8path = env ? env : "/tmp/";
+ utf8path = LLStringUtil::getenv("TMPDIR", "/tmp/");
#endif
if (utf8path[utf8path.size() - 1] != sep)
{
diff --git a/indra/llcommon/tests/llleap_test.cpp b/indra/llcommon/tests/llleap_test.cpp
index c387da6c48..45648536c4 100644
--- a/indra/llcommon/tests/llleap_test.cpp
+++ b/indra/llcommon/tests/llleap_test.cpp
@@ -26,6 +26,7 @@
#include "wrapllerrs.h"
#include "llevents.h"
#include "llprocess.h"
+#include "llstring.h"
#include "stringize.h"
#include "StringVec.h"
#include <functional>
@@ -198,14 +199,12 @@ namespace tut
// basename.
reader_module(LLProcess::basename(
reader.getName().substr(0, reader.getName().length()-3))),
- pPYTHON(getenv("PYTHON")),
- PYTHON(pPYTHON? pPYTHON : "")
+ PYTHON(LLStringUtil::getenv("PYTHON"))
{
- ensure("Set PYTHON to interpreter pathname", pPYTHON);
+ ensure("Set PYTHON to interpreter pathname", !PYTHON.empty());
}
NamedExtTempFile reader;
const std::string reader_module;
- const char* pPYTHON;
const std::string PYTHON;
};
typedef test_group<llleap_data> llleap_group;
diff --git a/indra/llcommon/tests/llprocess_test.cpp b/indra/llcommon/tests/llprocess_test.cpp
index b27e125d2e..5c87cdabd9 100644
--- a/indra/llcommon/tests/llprocess_test.cpp
+++ b/indra/llcommon/tests/llprocess_test.cpp
@@ -34,6 +34,7 @@
#include "stringize.h"
#include "llsdutil.h"
#include "llevents.h"
+#include "llstring.h"
#include "wrapllerrs.h"
#if defined(LL_WINDOWS)
@@ -142,8 +143,8 @@ struct PythonProcessLauncher
mDesc(desc),
mScript("py", script)
{
- const char* PYTHON(getenv("PYTHON"));
- tut::ensure("Set $PYTHON to the Python interpreter", PYTHON);
+ auto PYTHON(LLStringUtil::getenv("PYTHON"));
+ tut::ensure("Set $PYTHON to the Python interpreter", !PYTHON.empty());
mParams.desc = desc + " script";
mParams.executable = PYTHON;
diff --git a/indra/llcommon/tests/llsdserialize_test.cpp b/indra/llcommon/tests/llsdserialize_test.cpp
index 745e3a168c..6ac974e659 100644
--- a/indra/llcommon/tests/llsdserialize_test.cpp
+++ b/indra/llcommon/tests/llsdserialize_test.cpp
@@ -41,6 +41,7 @@ typedef U32 uint32_t;
#include <sys/stat.h>
#include <sys/wait.h>
#include "llprocess.h"
+#include "llstring.h"
#endif
#include "boost/range.hpp"
@@ -1705,8 +1706,8 @@ namespace tut
template <typename CONTENT>
void python(const std::string& desc, const CONTENT& script, int expect=0)
{
- const char* PYTHON(getenv("PYTHON"));
- ensure("Set $PYTHON to the Python interpreter", PYTHON);
+ auto PYTHON(LLStringUtil::getenv("PYTHON"));
+ ensure("Set $PYTHON to the Python interpreter", !PYTHON.empty());
NamedTempFile scriptfile("py", script);
@@ -1714,7 +1715,7 @@ namespace tut
std::string q("\"");
std::string qPYTHON(q + PYTHON + q);
std::string qscript(q + scriptfile.getName() + q);
- int rc = _spawnl(_P_WAIT, PYTHON, qPYTHON.c_str(), qscript.c_str(), NULL);
+ int rc = _spawnl(_P_WAIT, PYTHON.c_str(), qPYTHON.c_str(), qscript.c_str(), NULL);
if (rc == -1)
{
char buffer[256];
diff --git a/indra/llmessage/tests/commtest.h b/indra/llmessage/tests/commtest.h
index 7c8f27bbd2..0359eba803 100644
--- a/indra/llmessage/tests/commtest.h
+++ b/indra/llmessage/tests/commtest.h
@@ -34,6 +34,7 @@
#include "llsd.h"
#include "llhost.h"
#include "llexception.h"
+#include "llstring.h"
#include "stringize.h"
#include <map>
#include <string>
@@ -46,12 +47,7 @@ struct CommtestError: public LLException
static bool query_verbose()
{
- const char* cbose = getenv("INTEGRATION_TEST_VERBOSE");
- if (! cbose)
- {
- cbose = "1";
- }
- std::string strbose(cbose);
+ std::string strbose(LLStringUtil::getenv("INTEGRATION_TEST_VERBOSE", "1"));
return (! (strbose == "0" || strbose == "off" ||
strbose == "false" || strbose == "quiet"));
}
diff --git a/indra/llmessage/tests/llhttpclient_test.cpp b/indra/llmessage/tests/llhttpclient_test.cpp
index 9356a14f1f..78faa66a0d 100644
--- a/indra/llmessage/tests/llhttpclient_test.cpp
+++ b/indra/llmessage/tests/llhttpclient_test.cpp
@@ -41,6 +41,7 @@
#include "llpumpio.h"
#include "lliosocket.h"
+#include "llstring.h"
#include "stringize.h"
#include "llcleanup.h"
@@ -50,13 +51,13 @@ namespace tut
{
public:
HTTPClientTestData():
- PORT(getenv("PORT")),
+ PORT(LLStringUtil::getenv("PORT")),
// Turning NULL PORT into empty string doesn't make things work;
// that's just to keep this initializer from blowing up. We test
// PORT separately in the constructor body.
- local_server(STRINGIZE("http://127.0.0.1:" << (PORT? PORT : "") << "/"))
+ local_server(STRINGIZE("http://127.0.0.1:" << PORT << "/"))
{
- ensure("Set environment variable PORT to local test server port", PORT);
+ ensure("Set environment variable PORT to local test server port", !PORT.empty());
apr_pool_create(&mPool, NULL);
LLCurl::initClass(false);
mClientPump = new LLPumpIO(mPool);
@@ -87,7 +88,7 @@ namespace tut
}
}
- const char* const PORT;
+ const std::string PORT;
const std::string local_server;
private:
diff --git a/indra/llrender/llfontgl.cpp b/indra/llrender/llfontgl.cpp
index cf0a117567..bb56988422 100644
--- a/indra/llrender/llfontgl.cpp
+++ b/indra/llrender/llfontgl.cpp
@@ -1063,33 +1063,24 @@ LLFontGL* LLFontGL::getFontDefault()
// static
std::string LLFontGL::getFontPathSystem()
{
- std::string system_path;
-
- // Try to figure out where the system's font files are stored.
- char *system_root = NULL;
-#if LL_WINDOWS
- system_root = getenv("SystemRoot"); /* Flawfinder: ignore */
- if (!system_root)
- {
- LL_WARNS() << "SystemRoot not found, attempting to load fonts from default path." << LL_ENDL;
- }
+#if LL_DARWIN
+ // HACK for Mac OS X
+ return "/System/Library/Fonts/";
+
+#elif LL_WINDOWS
+ wchar_t *pwstr = NULL;
+ HRESULT okay = SHGetKnownFolderPath(FOLDERID_Fonts, 0, NULL, &pwstr);
+ if (SUCCEEDED(okay) && pwstr)
+ {
+ std::string fontpath(ll_convert_wide_to_string(pwstr));
+ // SHGetKnownFolderPath() contract requires us to free pwstr
+ CoTaskMemFree(pwstr);
+ return fontpath;
+ }
#endif
- if (system_root)
- {
- system_path = llformat("%s/fonts/", system_root);
- }
- else
- {
-#if LL_WINDOWS
- // HACK for windows 98/Me
- system_path = "/WINDOWS/FONTS/";
-#elif LL_DARWIN
- // HACK for Mac OS X
- system_path = "/System/Library/Fonts/";
-#endif
- }
- return system_path;
+ LL_WARNS() << "Could not determine system fonts path" << LL_ENDL;
+ return {};
}
diff --git a/indra/llvfs/lldir_linux.cpp b/indra/llvfs/lldir_linux.cpp
index 2cd06b81f8..80ad05345a 100644
--- a/indra/llvfs/lldir_linux.cpp
+++ b/indra/llvfs/lldir_linux.cpp
@@ -29,6 +29,7 @@
#include "lldir_linux.h"
#include "llerror.h"
#include "llrand.h"
+#include "llstring.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
@@ -40,28 +41,24 @@ static std::string getCurrentUserHome(char* fallback)
{
const uid_t uid = getuid();
struct passwd *pw;
- char *result_cstr = fallback;
-
+
pw = getpwuid(uid);
if ((pw != NULL) && (pw->pw_dir != NULL))
{
- result_cstr = (char*) pw->pw_dir;
+ return pw->pw_dir;
+ }
+
+ LL_INFOS() << "Couldn't detect home directory from passwd - trying $HOME" << LL_ENDL;
+ auto home_env = LLStringUtil::getoptenv("HOME");
+ if (home_env)
+ {
+ return *home_env;
}
else
{
- LL_INFOS() << "Couldn't detect home directory from passwd - trying $HOME" << LL_ENDL;
- const char *const home_env = getenv("HOME"); /* Flawfinder: ignore */
- if (home_env)
- {
- result_cstr = (char*) home_env;
- }
- else
- {
- LL_WARNS() << "Couldn't detect home directory! Falling back to " << fallback << LL_ENDL;
- }
+ LL_WARNS() << "Couldn't detect home directory! Falling back to " << fallback << LL_ENDL;
+ return fallback;
}
-
- return std::string(result_cstr);
}
@@ -156,18 +153,18 @@ void LLDir_Linux::initAppDirs(const std::string &app_name,
if (!app_read_only_data_dir.empty())
{
mAppRODataDir = app_read_only_data_dir;
- mSkinBaseDir = mAppRODataDir + mDirDelimiter + "skins";
+ mSkinBaseDir = add(mAppRODataDir, "skins");
}
mAppName = app_name;
std::string upper_app_name(app_name);
LLStringUtil::toUpper(upper_app_name);
- char* app_home_env = getenv((upper_app_name + "_USER_DIR").c_str()); /* Flawfinder: ignore */
+ auto app_home_env(LLStringUtil::getoptenv(upper_app_name + "_USER_DIR"));
if (app_home_env)
{
// user has specified own userappdir i.e. $SECONDLIFE_USER_DIR
- mOSUserAppDir = app_home_env;
+ mOSUserAppDir = *app_home_env;
}
else
{
diff --git a/indra/llvfs/lldir_solaris.cpp b/indra/llvfs/lldir_solaris.cpp
index d3536a12ee..f18560ff20 100644
--- a/indra/llvfs/lldir_solaris.cpp
+++ b/indra/llvfs/lldir_solaris.cpp
@@ -29,6 +29,7 @@
#include "lldir_solaris.h"
#include "llerror.h"
#include "llrand.h"
+#include "llstring.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
@@ -41,30 +42,28 @@
static std::string getCurrentUserHome(char* fallback)
{
+ // fwiw this exactly duplicates getCurrentUserHome() in lldir_linux.cpp...
+ // we should either derive both from LLDir_Posix or just axe Solaris.
const uid_t uid = getuid();
struct passwd *pw;
- char *result_cstr = fallback;
-
+
pw = getpwuid(uid);
if ((pw != NULL) && (pw->pw_dir != NULL))
{
- result_cstr = (char*) pw->pw_dir;
+ return pw->pw_dir;
+ }
+
+ LL_INFOS() << "Couldn't detect home directory from passwd - trying $HOME" << LL_ENDL;
+ auto home_env = LLStringUtil::getoptenv("HOME");
+ if (home_env)
+ {
+ return *home_env;
}
else
{
- LL_INFOS() << "Couldn't detect home directory from passwd - trying $HOME" << LL_ENDL;
- const char *const home_env = getenv("HOME"); /* Flawfinder: ignore */
- if (home_env)
- {
- result_cstr = (char*) home_env;
- }
- else
- {
- LL_WARNS() << "Couldn't detect home directory! Falling back to " << fallback << LL_ENDL;
- }
+ LL_WARNS() << "Couldn't detect home directory! Falling back to " << fallback << LL_ENDL;
+ return fallback;
}
-
- return std::string(result_cstr);
}
@@ -135,27 +134,15 @@ LLDir_Solaris::LLDir_Solaris()
//NOTE: Why force people to cd into the package directory?
// Look for SECONDLIFE env variable and use it, if set.
- char *dcf = getenv("SECONDLIFE");
- if(dcf != NULL){
- (void)strcpy(path, dcf);
- (void)strcat(path, "/bin"); //NOTE: make sure we point at the bin
- mExecutableDir = strdup(path);
+ auto SECONDLIFE(LLDirUtil::getoptenv("SECONDLIFE"));
+ if(SECONDLIFE){
+ mExecutableDir = add(*SECONDLIFE, "bin"); //NOTE: make sure we point at the bin
}else{
- // plunk a null at last '/' to get exec dir
- char *s = execpath + strlen(execpath) -1;
- while(*s != '/' && s != execpath){
- --s;
- }
-
- if(s != execpath){
- *s = (char)NULL;
-
- mExecutableDir = strdup(execpath);
- LL_INFOS() << "mExecutableDir = [" << mExecutableDir << "]" << LL_ENDL;
- }
+ mExecutableDir = getDirName(execpath);
+ LL_INFOS() << "mExecutableDir = [" << mExecutableDir << "]" << LL_ENDL;
}
-
- mLLPluginDir = mExecutableDir + mDirDelimiter + "llplugin";
+
+ mLLPluginDir = add(mExecutableDir, "llplugin");
// *TODO: don't use /tmp, use $HOME/.secondlife/tmp or something.
mTempDir = "/tmp";
@@ -175,17 +162,18 @@ void LLDir_Solaris::initAppDirs(const std::string &app_name,
if (!app_read_only_data_dir.empty())
{
mAppRODataDir = app_read_only_data_dir;
+ mSkinBaseDir = add(mAppRODataDir, "skins");
}
mAppName = app_name;
std::string upper_app_name(app_name);
LLStringUtil::toUpper(upper_app_name);
- char* app_home_env = getenv((upper_app_name + "_USER_DIR").c_str()); /* Flawfinder: ignore */
+ auto app_home_env(LLStringUtil::getoptenv(upper_app_name + "_USER_DIR"));
if (app_home_env)
{
// user has specified own userappdir i.e. $SECONDLIFE_USER_DIR
- mOSUserAppDir = app_home_env;
+ mOSUserAppDir = *app_home_env;
}
else
{
diff --git a/indra/llvfs/lldir_win32.cpp b/indra/llvfs/lldir_win32.cpp
index fc4680bbfb..acf734f16b 100644
--- a/indra/llvfs/lldir_win32.cpp
+++ b/indra/llvfs/lldir_win32.cpp
@@ -30,6 +30,7 @@
#include "lldir_win32.h"
#include "llerror.h"
+#include "llstring.h"
#include "stringize.h"
#include "llfile.h"
#include <shlobj.h>
@@ -55,17 +56,17 @@ namespace
{
switch (state)
{
+ boost::optional<std::string> prelog_name;
+
case prst::INIT:
// assume we failed, until we succeed
state = prst::SKIP;
- // can't initialize within one case of a switch statement
- const char* prelog_name;
- prelog_name = getenv("PRELOG");
+ prelog_name = LLDirUtil::getoptenv("PRELOG");
if (! prelog_name)
// no PRELOG variable set, carry on
return;
- prelogf = new std::ofstream(prelog_name, std::ios_base::app);
+ prelogf = new llofstream(*prelog_name, std::ios_base::app);
if (! (prelogf && prelogf->is_open()))
// can't complain to anybody; how?
return;
@@ -95,13 +96,11 @@ LLDir_Win32::LLDir_Win32()
WCHAR w_str[MAX_PATH];
// Application Data is where user settings go. We rely on $APPDATA being
- // correct; in fact the VMP makes a point of setting it properly, since
- // Windows itself botches the job for non-ASCII usernames (MAINT-8087).
- // Try using wide-character getenv()??
- wchar_t *APPDATA = _wgetenv(L"APPDATA");
+ // correct.
+ auto APPDATA = LLStringUtil::getoptenv("APPDATA");
if (APPDATA)
{
- mOSUserDir = ll_convert_wide_to_string(APPDATA, CP_UTF8);
+ mOSUserDir = *APPDATA;
}
PRELOG("APPDATA='" << mOSUserDir << "'");
// On Windows, we could have received a plain-ASCII pathname in which
@@ -118,7 +117,7 @@ LLDir_Win32::LLDir_Win32()
if (SUCCEEDED(okay) && pwstr)
{
// But of course, only update mOSUserDir if SHGetKnownFolderPath() works.
- mOSUserDir = ll_convert_wide_to_string(pwstr, CP_UTF8);
+ mOSUserDir = ll_convert_wide_to_string(pwstr);
// Not only that: update our environment so that child processes
// will see a reasonable value as well.
_wputenv_s(L"APPDATA", pwstr);
@@ -136,11 +135,10 @@ LLDir_Win32::LLDir_Win32()
//
// We used to store the cache in AppData\Roaming, and the installer
// cleans up that version on upgrade. JC
- // Again, try using wide-character getenv().
- wchar_t *LOCALAPPDATA = _wgetenv(L"LOCALAPPDATA");
+ auto LOCALAPPDATA = LLStringUtil::getoptenv("LOCALAPPDATA");
if (LOCALAPPDATA)
{
- mOSCacheDir = ll_convert_wide_to_string(LOCALAPPDATA, CP_UTF8);
+ mOSCacheDir = *LOCALAPPDATA;
}
PRELOG("LOCALAPPDATA='" << mOSCacheDir << "'");
// Windows really does not deal well with pathnames containing non-ASCII
@@ -155,7 +153,7 @@ LLDir_Win32::LLDir_Win32()
if (SUCCEEDED(okay) && pwstr)
{
// But of course, only update mOSCacheDir if SHGetKnownFolderPath() works.
- mOSCacheDir = ll_convert_wide_to_string(pwstr, CP_UTF8);
+ mOSCacheDir = ll_convert_wide_to_string(pwstr);
// Update our environment so that child processes will see a
// reasonable value as well.
_wputenv_s(L"LOCALAPPDATA", pwstr);
diff --git a/indra/llxml/tests/llcontrol_test.cpp b/indra/llxml/tests/llcontrol_test.cpp
index 2b691ffbb1..f7e43d6def 100644
--- a/indra/llxml/tests/llcontrol_test.cpp
+++ b/indra/llxml/tests/llcontrol_test.cpp
@@ -27,43 +27,31 @@
#include "linden_common.h"
#include "llsdserialize.h"
+#include "llfile.h"
+#include "stringize.h"
#include "../llcontrol.h"
#include "../test/lltut.h"
+#include <memory>
+#include <vector>
namespace tut
{
-
struct control_group
{
- LLControlGroup* mCG;
+ std::unique_ptr<LLControlGroup> mCG;
std::string mTestConfigDir;
std::string mTestConfigFile;
+ std::vector<std::string> mCleanups;
static bool mListenerFired;
control_group()
{
- mCG = new LLControlGroup("foo");
+ mCG.reset(new LLControlGroup("foo"));
LLUUID random;
random.generate();
// generate temp dir
- std::ostringstream oStr;
-
-#ifdef LL_WINDOWS
- char* tmp_dir = getenv("TMP");
- if(tmp_dir)
- {
- oStr << tmp_dir << "/llcontrol-test-" << random << "/";
- }
- else
- {
- oStr << "c:/tmp/llcontrol-test-" << random << "/";
- }
-#else
- oStr << "/tmp/llcontrol-test-" << random << "/";
-#endif
-
- mTestConfigDir = oStr.str();
+ mTestConfigDir = STRINGIZE(LLFile::tmpdir() << "llcontrol-test-" << random << "/");
mTestConfigFile = mTestConfigDir + "settings.xml";
LLFile::mkdir(mTestConfigDir);
LLSD config;
@@ -76,7 +64,12 @@ namespace tut
~control_group()
{
//Remove test files
- delete mCG;
+ for (auto filename : mCleanups)
+ {
+ LLFile::remove(filename);
+ }
+ LLFile::remove(mTestConfigFile);
+ LLFile::rmdir(mTestConfigDir);
}
void writeSettingsFile(const LLSD& config)
{
@@ -118,6 +111,7 @@ namespace tut
ensure_equals("value of changed setting", mCG->getU32("TestSetting"), 13);
LLControlGroup test_cg("foo2");
std::string temp_test_file = (mTestConfigDir + "setting_llsd_temp.xml");
+ mCleanups.push_back(temp_test_file);
mCG->saveToFile(temp_test_file.c_str(), TRUE);
results = test_cg.loadFromFile(temp_test_file.c_str());
ensure("number of changed settings loaded", (results == 1));
@@ -139,6 +133,7 @@ namespace tut
ensure_equals("value of changed setting", mCG->getU32("TestSetting"), 13);
LLControlGroup test_cg("foo3");
std::string temp_test_file = (mTestConfigDir + "setting_llsd_persist_temp.xml");
+ mCleanups.push_back(temp_test_file);
mCG->saveToFile(temp_test_file.c_str(), TRUE);
results = test_cg.loadFromFile(temp_test_file.c_str());
//If we haven't changed any settings, then we shouldn't have any settings to load
@@ -153,7 +148,7 @@ namespace tut
ensure("number of settings", (results == 1));
mCG->getControl("TestSetting")->getSignal()->connect(boost::bind(&this->handleListenerTest));
mCG->setU32("TestSetting", 13);
- ensure("listener fired on changed setting", mListenerFired);
+ ensure("listener fired on changed setting", mListenerFired);
}
}
diff --git a/indra/newview/llexternaleditor.cpp b/indra/newview/llexternaleditor.cpp
index df9c848cb8..776bbf78c2 100644
--- a/indra/newview/llexternaleditor.cpp
+++ b/indra/newview/llexternaleditor.cpp
@@ -31,6 +31,7 @@
#include "llui.h"
#include "llprocess.h"
#include "llsdutil.h"
+#include "llstring.h"
#include <boost/foreach.hpp>
// static
@@ -188,12 +189,12 @@ std::string LLExternalEditor::findCommand(
cmd = LLUI::sSettingGroups["config"]->getString(sSetting);
LL_INFOS() << "Using setting" << LL_ENDL;
}
- else // otherwise use the path specified by the environment variable
+ else // otherwise use the path specified by the environment variable
{
- char* env_var_val = getenv(env_var.c_str());
+ auto env_var_val(LLStringUtil::getoptenv(env_var));
if (env_var_val)
{
- cmd = env_var_val;
+ cmd = *env_var_val;
LL_INFOS() << "Using env var " << env_var << LL_ENDL;
}
}
diff --git a/indra/newview/llwebprofile.cpp b/indra/newview/llwebprofile.cpp
index 81d4e30a7a..8dcef2c7cd 100644
--- a/indra/newview/llwebprofile.cpp
+++ b/indra/newview/llwebprofile.cpp
@@ -33,6 +33,7 @@
#include "llimagepng.h"
#include "llsdserialize.h"
+#include "llstring.h"
// newview
#include "llpanelprofile.h" // for getProfileURL(). FIXME: move the method to LLAvatarActions
@@ -264,6 +265,5 @@ void LLWebProfile::reportImageUploadStatus(bool ok)
std::string LLWebProfile::getAuthCookie()
{
// This is needed to test image uploads on Linux viewer built with OpenSSL 1.0.0 (0.9.8 works fine).
- const char* debug_cookie = getenv("LL_SNAPSHOT_COOKIE");
- return debug_cookie ? debug_cookie : sAuthCookie;
+ return LLStringUtil::getenv("LL_SNAPSHOT_COOKIE", sAuthCookie);
}