From 2466d8e993a800a17e00deda2f3a27e0505140e1 Mon Sep 17 00:00:00 2001 From: mmentovai Date: Mon, 23 Oct 2006 20:25:42 +0000 Subject: Replace auto_ptr with scoped_ptr (#56). r=bryner http://groups.google.com/group/airbag-dev/browse_thread/thread/54c66451ed8e2835 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@46 4c0a9323-5329-0410-9bdc-e9ce6186880e --- src/processor/minidump.cc | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'src/processor/minidump.cc') diff --git a/src/processor/minidump.cc b/src/processor/minidump.cc index 2d3dce81..068f47d0 100644 --- a/src/processor/minidump.cc +++ b/src/processor/minidump.cc @@ -49,17 +49,16 @@ typedef SSIZE_T ssize_t; #endif // _WIN32 #include -#include #include #include "processor/minidump.h" #include "processor/range_map-inl.h" +#include "processor/scoped_ptr.h" namespace google_airbag { -using std::auto_ptr; using std::vector; @@ -163,7 +162,7 @@ static inline void Swap(MDGUID* guid) { // of making it a dependency when we don't care about anything but UTF-16. static string* UTF16ToUTF8(const vector& in, bool swap) { - auto_ptr out(new string()); + scoped_ptr out(new string()); // Set the string's initial capacity to the number of UTF-16 characters, // because the UTF-8 representation will always be at least this long. @@ -288,7 +287,7 @@ bool MinidumpContext::Read(u_int32_t expected_size) { if (expected_size != sizeof(MDRawContextX86)) return false; - auto_ptr context_x86(new MDRawContextX86()); + scoped_ptr context_x86(new MDRawContextX86()); // Set the context_flags member, which has already been read, and // read the rest of the structure beginning with the first member @@ -355,7 +354,7 @@ bool MinidumpContext::Read(u_int32_t expected_size) { if (expected_size != sizeof(MDRawContextPPC)) return false; - auto_ptr context_ppc(new MDRawContextPPC()); + scoped_ptr context_ppc(new MDRawContextPPC()); // Set the context_flags member, which has already been read, and // read the rest of the structure beginning with the first member @@ -647,7 +646,7 @@ const u_int8_t* MinidumpMemoryRegion::GetMemory() { return NULL; // TODO(mmentovai): verify rational size! - auto_ptr< vector > memory( + scoped_ptr< vector > memory( new vector(descriptor_->memory.data_size)); if (!minidump_->ReadBytes(&(*memory)[0], descriptor_->memory.data_size)) @@ -817,7 +816,7 @@ MinidumpContext* MinidumpThread::GetContext() { if (!minidump_->SeekSet(thread_.thread_context.rva)) return NULL; - auto_ptr context(new MinidumpContext(minidump_)); + scoped_ptr context(new MinidumpContext(minidump_)); if (!context->Read(thread_.thread_context.data_size)) return NULL; @@ -916,7 +915,7 @@ bool MinidumpThreadList::Read(u_int32_t expected_size) { } // TODO(mmentovai): verify rational size! - auto_ptr threads( + scoped_ptr threads( new MinidumpThreads(thread_count, MinidumpThread(minidump_))); for (unsigned int thread_index = 0; @@ -1086,7 +1085,7 @@ const u_int8_t* MinidumpModule::GetCVRecord() { // variable-sized due to their pdb_file_name fields; these structures // are not sizeof(MDCVInfoPDB70) or sizeof(MDCVInfoPDB20) and treating // them as such would result in incomplete structures or overruns. - auto_ptr< vector > cv_record( + scoped_ptr< vector > cv_record( new vector(module_.cv_record.data_size)); if (!minidump_->ReadBytes(&(*cv_record)[0], module_.cv_record.data_size)) @@ -1161,7 +1160,7 @@ const MDImageDebugMisc* MinidumpModule::GetMiscRecord() { // because the MDImageDebugMisc is variable-sized due to its data field; // this structure is not sizeof(MDImageDebugMisc) and treating it as such // would result in an incomplete structure or an overrun. - auto_ptr< vector > misc_record_mem( + scoped_ptr< vector > misc_record_mem( new vector(module_.misc_record.data_size)); MDImageDebugMisc* misc_record = reinterpret_cast(&(*misc_record_mem)[0]); @@ -1443,7 +1442,7 @@ bool MinidumpModuleList::Read(u_int32_t expected_size) { } // TODO(mmentovai): verify rational size! - auto_ptr modules( + scoped_ptr modules( new MinidumpModules(module_count, MinidumpModule(minidump_))); for (unsigned int module_index = 0; @@ -1557,7 +1556,8 @@ bool MinidumpMemoryList::Read(u_int32_t expected_size) { } // TODO(mmentovai): verify rational size! - auto_ptr descriptors(new MemoryDescriptors(region_count)); + scoped_ptr descriptors( + new MemoryDescriptors(region_count)); // Read the entire array in one fell swoop, instead of reading one entry // at a time in the loop. @@ -1566,7 +1566,7 @@ bool MinidumpMemoryList::Read(u_int32_t expected_size) { return false; } - auto_ptr regions( + scoped_ptr regions( new MemoryRegions(region_count, MinidumpMemoryRegion(minidump_))); for (unsigned int region_index = 0; @@ -1720,7 +1720,7 @@ MinidumpContext* MinidumpException::GetContext() { if (!minidump_->SeekSet(exception_.thread_context.rva)) return NULL; - auto_ptr context(new MinidumpContext(minidump_)); + scoped_ptr context(new MinidumpContext(minidump_)); if (!context->Read(exception_.thread_context.data_size)) return NULL; @@ -2060,7 +2060,7 @@ bool Minidump::Read() { return false; // TODO(mmentovai): verify rational size! - auto_ptr directory( + scoped_ptr directory( new MinidumpDirectoryEntries(header_.stream_count)); // Read the entire array in one fell swoop, instead of reading one entry @@ -2069,7 +2069,7 @@ bool Minidump::Read() { sizeof(MDRawDirectory) * header_.stream_count)) return false; - auto_ptr stream_map(new MinidumpStreamMap()); + scoped_ptr stream_map(new MinidumpStreamMap()); for (unsigned int stream_index = 0; stream_index < header_.stream_count; @@ -2312,7 +2312,7 @@ T* Minidump::GetStream(T** stream) { if (!SeekToStreamType(stream_type, &stream_length)) return NULL; - auto_ptr new_stream(new T(this)); + scoped_ptr new_stream(new T(this)); if (!new_stream->Read(stream_length)) return NULL; -- cgit v1.2.1