OLD | NEW |
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 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 24 matching lines...) Expand all Loading... |
35 // and look for a variable name with the reverse case. | 35 // and look for a variable name with the reverse case. |
36 // I.e. HTTP_PROXY may be http_proxy for some users/systems. | 36 // I.e. HTTP_PROXY may be http_proxy for some users/systems. |
37 char first_char = variable_name[0]; | 37 char first_char = variable_name[0]; |
38 std::string alternate_case_var; | 38 std::string alternate_case_var; |
39 if (IsAsciiLower(first_char)) | 39 if (IsAsciiLower(first_char)) |
40 alternate_case_var = ToUpperASCII(variable_name); | 40 alternate_case_var = ToUpperASCII(variable_name); |
41 else if (IsAsciiUpper(first_char)) | 41 else if (IsAsciiUpper(first_char)) |
42 alternate_case_var = ToLowerASCII(variable_name); | 42 alternate_case_var = ToLowerASCII(variable_name); |
43 else | 43 else |
44 return false; | 44 return false; |
45 return GetVarImpl(alternate_case_var.c_str(), result); | 45 return GetVarImpl(alternate_case_var, result); |
46 } | 46 } |
47 | 47 |
48 bool SetVar(StringPiece variable_name, | 48 bool SetVar(StringPiece variable_name, |
49 const std::string& new_value) override { | 49 const std::string& new_value) override { |
50 return SetVarImpl(variable_name, new_value); | 50 return SetVarImpl(variable_name, new_value); |
51 } | 51 } |
52 | 52 |
53 bool UnSetVar(StringPiece variable_name) override { | 53 bool UnSetVar(StringPiece variable_name) override { |
54 return UnSetVarImpl(variable_name); | 54 return UnSetVarImpl(variable_name); |
55 } | 55 } |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 for (size_t i = 0; i < result_indices.size(); i++) | 231 for (size_t i = 0; i < result_indices.size(); i++) |
232 result[i] = &storage_data[result_indices[i]]; | 232 result[i] = &storage_data[result_indices[i]]; |
233 result[result_indices.size()] = 0; // Null terminator. | 233 result[result_indices.size()] = 0; // Null terminator. |
234 | 234 |
235 return result; | 235 return result; |
236 } | 236 } |
237 | 237 |
238 #endif // OS_POSIX | 238 #endif // OS_POSIX |
239 | 239 |
240 } // namespace base | 240 } // namespace base |
OLD | NEW |