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

Unified Diff: base/environment.cc

Issue 1852433005: Convert //base to use std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase after r384946 Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/environment.h ('k') | base/environment_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/environment.cc
diff --git a/base/environment.cc b/base/environment.cc
index adb73871d07d12d800bce5f9a6b735a0aef26296..d14ce870bde3a851e9debfd9953f293e0e4e1552 100644
--- a/base/environment.cc
+++ b/base/environment.cc
@@ -69,7 +69,7 @@ class EnvironmentImpl : public Environment {
if (value_length == 0)
return false;
if (result) {
- scoped_ptr<wchar_t[]> value(new wchar_t[value_length]);
+ std::unique_ptr<wchar_t[]> value(new wchar_t[value_length]);
::GetEnvironmentVariable(UTF8ToWide(variable_name).c_str(), value.get(),
value_length);
*result = WideToUTF8(value.get());
@@ -184,8 +184,8 @@ string16 AlterEnvironment(const wchar_t* env,
#elif defined(OS_POSIX)
-scoped_ptr<char*[]> AlterEnvironment(const char* const* const env,
- const EnvironmentMap& changes) {
+std::unique_ptr<char* []> AlterEnvironment(const char* const* const env,
+ const EnvironmentMap& changes) {
std::string value_storage; // Holds concatenated null-terminated strings.
std::vector<size_t> result_indices; // Line indices into value_storage.
@@ -218,7 +218,7 @@ scoped_ptr<char*[]> AlterEnvironment(const char* const* const env,
size_t pointer_count_required =
result_indices.size() + 1 + // Null-terminated array of pointers.
(value_storage.size() + sizeof(char*) - 1) / sizeof(char*); // Buffer.
- scoped_ptr<char*[]> result(new char*[pointer_count_required]);
+ std::unique_ptr<char* []> result(new char*[pointer_count_required]);
// The string storage goes after the array of pointers.
char* storage_data = reinterpret_cast<char*>(
« no previous file with comments | « base/environment.h ('k') | base/environment_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698