diff options
author | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-17 23:33:41 +0000 |
---|---|---|
committer | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-17 23:33:41 +0000 |
commit | c10688623b331e0c72c502b718cff5016de61f85 (patch) | |
tree | bf6698e1a93d3dc99df45d0c4cf5ac6867dee552 /base | |
parent | 30be4cdd9c93313dd50b15501e133096da5e5a08 (diff) | |
download | chromium_src-c10688623b331e0c72c502b718cff5016de61f85.zip chromium_src-c10688623b331e0c72c502b718cff5016de61f85.tar.gz chromium_src-c10688623b331e0c72c502b718cff5016de61f85.tar.bz2 |
Don't force callers to be ASCII (when some of them already aren't).
TBR=tfarina
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/3137015
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@56451 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r-- | base/environment.cc | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/base/environment.cc b/base/environment.cc index 2f2431e..9ccc0785 100644 --- a/base/environment.cc +++ b/base/environment.cc @@ -78,22 +78,21 @@ class EnvironmentImpl : public base::Environment { bool SetVarImpl(const char* variable_name, const std::string& new_value) { #if defined(OS_POSIX) // On success, zero is returned. - return setenv(variable_name, new_value.c_str(), 1) == 0; + return !setenv(variable_name, new_value.c_str(), 1); #elif defined(OS_WIN) - // On success, a nonzero is returned. - return ::SetEnvironmentVariable(ASCIIToWide(variable_name).c_str(), - ASCIIToWide(new_value).c_str()) != 0; + // On success, a nonzero value is returned. + return !!SetEnvironmentVariable(UTF8ToWide(variable_name).c_str(), + UTF8ToWide(new_value).c_str()); #endif } bool UnSetVarImpl(const char* variable_name) { #if defined(OS_POSIX) // On success, zero is returned. - return unsetenv(variable_name) == 0; + return !unsetenv(variable_name); #elif defined(OS_WIN) - // On success, a nonzero is returned. - return ::SetEnvironmentVariable(ASCIIToWide(variable_name).c_str(), - NULL) != 0; + // On success, a nonzero value is returned. + return !!SetEnvironmentVariable(UTF8ToWide(variable_name).c_str(), NULL); #endif } }; |