summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-18 14:21:58 +0000
committertfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-18 14:21:58 +0000
commit604eb05b99b6098d36abadd2c1c2b6a1a79b705a (patch)
treea57ea3e89c68cc897af73baaf536ddfe38fda8b1
parent64c25e10e8d8e53c536c322d274765cb93eaca77 (diff)
downloadchromium_src-604eb05b99b6098d36abadd2c1c2b6a1a79b705a.zip
chromium_src-604eb05b99b6098d36abadd2c1c2b6a1a79b705a.tar.gz
chromium_src-604eb05b99b6098d36abadd2c1c2b6a1a79b705a.tar.bz2
base: Convert scoped_arrays to the new scoped_ptr style.
BUG=109874 R=darin@chromium.org,ajwong@chromium.org Review URL: https://chromiumcodereview.appspot.com/11961021 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@177670 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--base/environment.cc2
-rw-r--r--base/file_util_proxy.cc4
-rw-r--r--base/i18n/icu_string_conversions.cc6
-rw-r--r--base/linux_util.cc2
-rw-r--r--base/md5_unittest.cc4
-rw-r--r--base/nix/mime_util_xdg.cc2
-rw-r--r--base/pickle_unittest.cc6
-rw-r--r--base/process_util_posix.cc6
-rw-r--r--base/process_util_unittest.cc2
-rw-r--r--base/process_util_win.cc4
-rw-r--r--base/security_unittest.cc2
-rw-r--r--base/shared_memory_unittest.cc8
-rw-r--r--base/synchronization/condition_variable_unittest.cc2
-rw-r--r--base/win/enum_variant.h2
-rw-r--r--base/win/win_util.cc2
15 files changed, 27 insertions, 27 deletions
diff --git a/base/environment.cc b/base/environment.cc
index 8c61591..6849fef 100644
--- a/base/environment.cc
+++ b/base/environment.cc
@@ -66,7 +66,7 @@ class EnvironmentImpl : public base::Environment {
if (value_length == 0)
return false;
if (result) {
- scoped_array<wchar_t> value(new wchar_t[value_length]);
+ scoped_ptr<wchar_t[]> value(new wchar_t[value_length]);
::GetEnvironmentVariable(UTF8ToWide(variable_name).c_str(), value.get(),
value_length);
*result = WideToUTF8(value.get());
diff --git a/base/file_util_proxy.cc b/base/file_util_proxy.cc
index 17a0f22..1f1ab81 100644
--- a/base/file_util_proxy.cc
+++ b/base/file_util_proxy.cc
@@ -152,7 +152,7 @@ class ReadHelper {
}
private:
- scoped_array<char> buffer_;
+ scoped_ptr<char[]> buffer_;
int bytes_to_read_;
int bytes_read_;
DISALLOW_COPY_AND_ASSIGN(ReadHelper);
@@ -181,7 +181,7 @@ class WriteHelper {
}
private:
- scoped_array<char> buffer_;
+ scoped_ptr<char[]> buffer_;
int bytes_to_write_;
int bytes_written_;
DISALLOW_COPY_AND_ASSIGN(WriteHelper);
diff --git a/base/i18n/icu_string_conversions.cc b/base/i18n/icu_string_conversions.cc
index 5e428c3..2ff5009 100644
--- a/base/i18n/icu_string_conversions.cc
+++ b/base/i18n/icu_string_conversions.cc
@@ -188,7 +188,7 @@ bool CodepageToUTF16(const std::string& encoded,
size_t uchar_max_length = encoded.length() + 1;
SetUpErrorHandlerForToUChars(on_error, converter, &status);
- scoped_array<char16> buffer(new char16[uchar_max_length]);
+ scoped_ptr<char16[]> buffer(new char16[uchar_max_length]);
int actual_size = ucnv_toUChars(converter, buffer.get(),
static_cast<int>(uchar_max_length), encoded.data(),
static_cast<int>(encoded.length()), &status);
@@ -253,7 +253,7 @@ bool CodepageToWide(const std::string& encoded,
size_t wchar_max_length = encoded.length() + 1;
SetUpErrorHandlerForToUChars(on_error, converter, &status);
- scoped_array<wchar_t> buffer(new wchar_t[wchar_max_length]);
+ scoped_ptr<wchar_t[]> buffer(new wchar_t[wchar_max_length]);
int actual_size = ucnv_toAlgorithmic(utf32_platform_endian(), converter,
reinterpret_cast<char*>(buffer.get()),
static_cast<int>(wchar_max_length) * sizeof(wchar_t), encoded.data(),
@@ -282,7 +282,7 @@ bool ConvertToUtf8AndNormalize(const std::string& text,
UErrorCode status = U_ZERO_ERROR;
size_t max_length = utf16.length() + 1;
string16 normalized_utf16;
- scoped_array<char16> buffer(new char16[max_length]);
+ scoped_ptr<char16[]> buffer(new char16[max_length]);
int actual_length = unorm_normalize(
utf16.c_str(), utf16.length(), UNORM_NFC, 0,
buffer.get(), static_cast<int>(max_length), &status);
diff --git a/base/linux_util.cc b/base/linux_util.cc
index 49df773..660ea19 100644
--- a/base/linux_util.cc
+++ b/base/linux_util.cc
@@ -277,7 +277,7 @@ pid_t FindThreadIDWithSyscall(pid_t pid, const std::string& expected_data,
}
closedir(task);
- scoped_array<char> syscall_data(new char[expected_data.length()]);
+ scoped_ptr<char[]> syscall_data(new char[expected_data.length()]);
for (std::vector<pid_t>::const_iterator
i = tids.begin(); i != tids.end(); ++i) {
const pid_t current_tid = *i;
diff --git a/base/md5_unittest.cc b/base/md5_unittest.cc
index a20d819..1112c4b 100644
--- a/base/md5_unittest.cc
+++ b/base/md5_unittest.cc
@@ -67,7 +67,7 @@ TEST(MD5, MD5SumOneByteData) {
TEST(MD5, MD5SumLongData) {
const int length = 10 * 1024 * 1024 + 1;
- scoped_array<char> data(new char[length]);
+ scoped_ptr<char[]> data(new char[length]);
for (int i = 0; i < length; ++i)
data[i] = i & 0xFF;
@@ -109,7 +109,7 @@ TEST(MD5, ContextWithLongData) {
MD5Init(&ctx);
const int length = 10 * 1024 * 1024 + 1;
- scoped_array<char> data(new char[length]);
+ scoped_ptr<char[]> data(new char[length]);
for (int i = 0; i < length; ++i)
data[i] = i & 0xFF;
diff --git a/base/nix/mime_util_xdg.cc b/base/nix/mime_util_xdg.cc
index e58e03d..2e0dbee 100644
--- a/base/nix/mime_util_xdg.cc
+++ b/base/nix/mime_util_xdg.cc
@@ -160,7 +160,7 @@ class IconTheme {
// store the subdirs of this theme and array index of |info_array_|.
std::map<std::string, int> subdirs_;
- scoped_array<SubDirInfo> info_array_; // List of sub-directories.
+ scoped_ptr<SubDirInfo[]> info_array_; // List of sub-directories.
std::string inherits_; // Name of the theme this one inherits from.
};
diff --git a/base/pickle_unittest.cc b/base/pickle_unittest.cc
index 5a4d6a0..d418fdf 100644
--- a/base/pickle_unittest.cc
+++ b/base/pickle_unittest.cc
@@ -101,7 +101,7 @@ TEST(PickleTest, EncodeDecode) {
// Tests that we can handle really small buffers.
TEST(PickleTest, SmallBuffer) {
- scoped_array<char> buffer(new char[1]);
+ scoped_ptr<char[]> buffer(new char[1]);
// We should not touch the buffer.
Pickle pickle(buffer.get(), 1);
@@ -185,7 +185,7 @@ TEST(PickleTest, FindNext) {
TEST(PickleTest, FindNextWithIncompleteHeader) {
size_t header_size = sizeof(Pickle::Header);
- scoped_array<char> buffer(new char[header_size - 1]);
+ scoped_ptr<char[]> buffer(new char[header_size - 1]);
memset(buffer.get(), 0x1, header_size - 1);
const char* start = buffer.get();
@@ -215,7 +215,7 @@ TEST(PickleTest, GetReadPointerAndAdvance) {
TEST(PickleTest, Resize) {
size_t unit = Pickle::kPayloadUnit;
- scoped_array<char> data(new char[unit]);
+ scoped_ptr<char[]> data(new char[unit]);
char* data_ptr = data.get();
for (size_t i = 0; i < unit; i++)
data_ptr[i] = 'G';
diff --git a/base/process_util_posix.cc b/base/process_util_posix.cc
index 5ee1ae4..bc4c08e 100644
--- a/base/process_util_posix.cc
+++ b/base/process_util_posix.cc
@@ -549,8 +549,8 @@ bool LaunchProcess(const std::vector<std::string>& argv,
fd_shuffle1.reserve(fd_shuffle_size);
fd_shuffle2.reserve(fd_shuffle_size);
- scoped_array<char*> argv_cstr(new char*[argv.size() + 1]);
- scoped_array<char*> new_environ;
+ scoped_ptr<char*[]> argv_cstr(new char*[argv.size() + 1]);
+ scoped_ptr<char*[]> new_environ;
if (options.environ)
new_environ.reset(AlterEnvironment(*options.environ, GetEnvironment()));
@@ -1012,7 +1012,7 @@ static GetAppOutputInternalResult GetAppOutputInternal(
int pipe_fd[2];
pid_t pid;
InjectiveMultimap fd_shuffle1, fd_shuffle2;
- scoped_array<char*> argv_cstr(new char*[argv.size() + 1]);
+ scoped_ptr<char*[]> argv_cstr(new char*[argv.size() + 1]);
fd_shuffle1.reserve(3);
fd_shuffle2.reserve(3);
diff --git a/base/process_util_unittest.cc b/base/process_util_unittest.cc
index 4c1eff4..fff2c68 100644
--- a/base/process_util_unittest.cc
+++ b/base/process_util_unittest.cc
@@ -441,7 +441,7 @@ TEST_F(ProcessUtilTest, CalcFreeMemory) {
// Allocate 20M and check again. It should have gone down.
const int kAllocMB = 20;
- scoped_array<char> alloc(new char[kAllocMB * 1024 * 1024]);
+ scoped_ptr<char[]> alloc(new char[kAllocMB * 1024 * 1024]);
size_t expected_total = free_mem1.total - kAllocMB;
size_t expected_largest = free_mem1.largest;
diff --git a/base/process_util_win.cc b/base/process_util_win.cc
index 3addf51..3ac2ca4 100644
--- a/base/process_util_win.cc
+++ b/base/process_util_win.cc
@@ -252,7 +252,7 @@ bool GetProcessIntegrityLevel(ProcessHandle process, IntegrityLevel *level) {
GetLastError() != ERROR_INSUFFICIENT_BUFFER)
return false;
- scoped_array<char> token_label_bytes(new char[token_info_length]);
+ scoped_ptr<char[]> token_label_bytes(new char[token_info_length]);
if (!token_label_bytes.get())
return false;
@@ -921,7 +921,7 @@ bool EnableLowFragmentationHeap() {
// Gives us some extra space in the array in case a thread is creating heaps
// at the same time we're querying them.
static const int MARGIN = 8;
- scoped_array<HANDLE> heaps(new HANDLE[number_heaps + MARGIN]);
+ scoped_ptr<HANDLE[]> heaps(new HANDLE[number_heaps + MARGIN]);
number_heaps = GetProcessHeaps(number_heaps + MARGIN, heaps.get());
if (!number_heaps)
return false;
diff --git a/base/security_unittest.cc b/base/security_unittest.cc
index 11e871b..5db18fd 100644
--- a/base/security_unittest.cc
+++ b/base/security_unittest.cc
@@ -95,7 +95,7 @@ TEST(SecurityTest, ALLOC_TEST(MemoryAllocationRestrictionsNew)) {
TEST(SecurityTest, ALLOC_TEST(MemoryAllocationRestrictionsNewArray)) {
if (!IsTcMallocBypassed()) {
- scoped_array<char> ptr(new (nothrow) char[kTooBigAllocSize]);
+ scoped_ptr<char[]> ptr(new (nothrow) char[kTooBigAllocSize]);
ASSERT_TRUE(ptr == NULL);
}
}
diff --git a/base/shared_memory_unittest.cc b/base/shared_memory_unittest.cc
index f02e275..3f83248 100644
--- a/base/shared_memory_unittest.cc
+++ b/base/shared_memory_unittest.cc
@@ -249,8 +249,8 @@ TEST(SharedMemoryTest, MultipleThreads) {
int threadcounts[] = { 1, kNumThreads };
for (size_t i = 0; i < arraysize(threadcounts); i++) {
int numthreads = threadcounts[i];
- scoped_array<PlatformThreadHandle> thread_handles;
- scoped_array<MultipleThreadMain*> thread_delegates;
+ scoped_ptr<PlatformThreadHandle[]> thread_handles;
+ scoped_ptr<MultipleThreadMain*[]> thread_delegates;
thread_handles.reset(new PlatformThreadHandle[numthreads]);
thread_delegates.reset(new MultipleThreadMain*[numthreads]);
@@ -309,8 +309,8 @@ TEST(SharedMemoryTest, AnonymousPrivate) {
bool rv;
const uint32 kDataSize = 8192;
- scoped_array<SharedMemory> memories(new SharedMemory[count]);
- scoped_array<int*> pointers(new int*[count]);
+ scoped_ptr<SharedMemory[]> memories(new SharedMemory[count]);
+ scoped_ptr<int*[]> pointers(new int*[count]);
ASSERT_TRUE(memories.get());
ASSERT_TRUE(pointers.get());
diff --git a/base/synchronization/condition_variable_unittest.cc b/base/synchronization/condition_variable_unittest.cc
index a6426cf..ee33908 100644
--- a/base/synchronization/condition_variable_unittest.cc
+++ b/base/synchronization/condition_variable_unittest.cc
@@ -129,7 +129,7 @@ class WorkQueue : public PlatformThread::Delegate {
const int thread_count_;
int waiting_thread_count_;
- scoped_array<PlatformThreadHandle> thread_handles_;
+ scoped_ptr<PlatformThreadHandle[]> thread_handles_;
std::vector<int> assignment_history_; // Number of assignment per worker.
std::vector<int> completion_history_; // Number of completions per worker.
int thread_started_counter_; // Used to issue unique id to workers.
diff --git a/base/win/enum_variant.h b/base/win/enum_variant.h
index 7cee91d..82f8750 100644
--- a/base/win/enum_variant.h
+++ b/base/win/enum_variant.h
@@ -41,7 +41,7 @@ class BASE_EXPORT EnumVariant
private:
~EnumVariant();
- scoped_array<VARIANT> items_;
+ scoped_ptr<VARIANT[]> items_;
unsigned long count_;
unsigned long current_index_;
};
diff --git a/base/win/win_util.cc b/base/win/win_util.cc
index e0d37f2..875dbad 100644
--- a/base/win/win_util.cc
+++ b/base/win/win_util.cc
@@ -83,7 +83,7 @@ bool GetUserSidString(std::wstring* user_sid) {
base::win::ScopedHandle token_scoped(token);
DWORD size = sizeof(TOKEN_USER) + SECURITY_MAX_SID_SIZE;
- scoped_array<BYTE> user_bytes(new BYTE[size]);
+ scoped_ptr<BYTE[]> user_bytes(new BYTE[size]);
TOKEN_USER* user = reinterpret_cast<TOKEN_USER*>(user_bytes.get());
if (!::GetTokenInformation(token, TokenUser, user, size, &size))