X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fsupport%2Fenvironment.cpp;h=a364725c21173c137c00960c0ba3ea2cc3bb9270;hb=51c380440b0b2d5f04158e67047727ba1f985dc4;hp=d766bd583ef89ce5b91a8558371fc6326e3e1830;hpb=dbda8edf6df0b72c1fb1d598e3a0b4c0af8449f7;p=lyx.git diff --git a/src/support/environment.cpp b/src/support/environment.cpp index d766bd583e..a364725c21 100644 --- a/src/support/environment.cpp +++ b/src/support/environment.cpp @@ -4,8 +4,8 @@ * Licence details can be found in the file COPYING. * * \author Angus Leeming - * \author João Luis M. Assirati - * \author Lars Gullik Bjønnes + * \author João Luis M. Assirati + * \author Lars Gullik Bjønnes * * Full author contact details are available in file CREDITS. */ @@ -23,9 +23,7 @@ #include #include -using std::string; -using std::vector; - +using namespace std; namespace lyx { namespace support { @@ -49,7 +47,7 @@ vector const getEnvPath(string const & name) Tokenizer::const_iterator it = tokens.begin(); Tokenizer::const_iterator const end = tokens.end(); - std::vector vars; + vector vars; for (; it != end; ++it) vars.push_back(os::internal_path(*it)); @@ -64,11 +62,11 @@ bool setEnv(string const & name, string const & value) string const encoded = to_local8bit(from_utf8(value)); #if defined (HAVE_SETENV) - return ::setenv(name.c_str(), encoded.c_str(), true); + return ::setenv(name.c_str(), encoded.c_str(), 1) == 0; #elif defined (HAVE_PUTENV) - static std::map varmap; + static map varmap; varmap[name] = name + '=' + encoded; - return ::putenv(varmap[name].c_str()) == 0; + return ::putenv(const_cast(varmap[name].c_str())) == 0; #else #error No environment-setting function has been defined. #endif @@ -79,7 +77,7 @@ bool setEnv(string const & name, string const & value) void setEnvPath(string const & name, vector const & env) { char const separator(os::path_separator()); - std::ostringstream ss; + ostringstream ss; vector::const_iterator const begin = env.begin(); vector::const_iterator const end = env.end(); vector::const_iterator it = begin; @@ -111,7 +109,7 @@ void prependEnvPath(string const & name, string const & prefix) token_iterator const end = reversed_tokens.rend(); for (; it != end; ++it) { vector::iterator remove_it = - std::remove(env_var.begin(), env_var.end(), *it); + remove(env_var.begin(), env_var.end(), *it); env_var.erase(remove_it, env_var.end()); env_var.insert(env_var.begin(), *it); }