Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(151)

Side by Side Diff: base/environment.cc

Issue 11961021: base: Convert scoped_arrays to the new scoped_ptr style. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: revert callback changes Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | base/file_util_proxy.cc » ('j') | base/nix/mime_util_xdg.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/environment.h" 5 #include "base/environment.h"
6 6
7 #if defined(OS_POSIX) 7 #if defined(OS_POSIX)
8 #include <stdlib.h> 8 #include <stdlib.h>
9 #elif defined(OS_WIN) 9 #elif defined(OS_WIN)
10 #include <windows.h> 10 #include <windows.h>
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 // Note that the variable may be defined but empty. 59 // Note that the variable may be defined but empty.
60 if (result) 60 if (result)
61 *result = env_value; 61 *result = env_value;
62 return true; 62 return true;
63 #elif defined(OS_WIN) 63 #elif defined(OS_WIN)
64 DWORD value_length = ::GetEnvironmentVariable( 64 DWORD value_length = ::GetEnvironmentVariable(
65 UTF8ToWide(variable_name).c_str(), NULL, 0); 65 UTF8ToWide(variable_name).c_str(), NULL, 0);
66 if (value_length == 0) 66 if (value_length == 0)
67 return false; 67 return false;
68 if (result) { 68 if (result) {
69 scoped_array<wchar_t> value(new wchar_t[value_length]); 69 scoped_ptr<wchar_t[]> value(new wchar_t[value_length]);
70 ::GetEnvironmentVariable(UTF8ToWide(variable_name).c_str(), value.get(), 70 ::GetEnvironmentVariable(UTF8ToWide(variable_name).c_str(), value.get(),
71 value_length); 71 value_length);
72 *result = WideToUTF8(value.get()); 72 *result = WideToUTF8(value.get());
73 } 73 }
74 return true; 74 return true;
75 #else 75 #else
76 #error need to port 76 #error need to port
77 #endif 77 #endif
78 } 78 }
79 79
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 // static 118 // static
119 Environment* Environment::Create() { 119 Environment* Environment::Create() {
120 return new EnvironmentImpl(); 120 return new EnvironmentImpl();
121 } 121 }
122 122
123 bool Environment::HasVar(const char* variable_name) { 123 bool Environment::HasVar(const char* variable_name) {
124 return GetVar(variable_name, NULL); 124 return GetVar(variable_name, NULL);
125 } 125 }
126 126
127 } // namespace base 127 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | base/file_util_proxy.cc » ('j') | base/nix/mime_util_xdg.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698