diff options
author | Andrew Morrow <acm@mongodb.com> | 2015-06-10 18:41:42 -0400 |
---|---|---|
committer | Andrew Morrow <acm@mongodb.com> | 2015-06-10 22:37:55 -0400 |
commit | 1360f243ee7fa662c0ded25a9bc479aa47388446 (patch) | |
tree | 4e612c60d4e45386800e147e5d67366c61284d71 /src/mongo/util | |
parent | d7d1fdb75966c684e9a42150e6e9b69c4a10ee08 (diff) | |
download | mongo-1360f243ee7fa662c0ded25a9bc479aa47388446.tar.gz |
SERVER-17308 Replace boost::scoped_array<T> with std::unique_ptr<T[]>
Diffstat (limited to 'src/mongo/util')
-rw-r--r-- | src/mongo/util/base64.h | 3 | ||||
-rw-r--r-- | src/mongo/util/net/listen.cpp | 3 | ||||
-rw-r--r-- | src/mongo/util/processinfo_windows.cpp | 11 | ||||
-rw-r--r-- | src/mongo/util/stacktrace_windows.cpp | 9 | ||||
-rw-r--r-- | src/mongo/util/stringutils.h | 4 | ||||
-rw-r--r-- | src/mongo/util/text.cpp | 5 | ||||
-rw-r--r-- | src/mongo/util/unordered_fast_key_table.h | 4 |
7 files changed, 17 insertions, 22 deletions
diff --git a/src/mongo/util/base64.h b/src/mongo/util/base64.h index cfbea3fad20..35de757532a 100644 --- a/src/mongo/util/base64.h +++ b/src/mongo/util/base64.h @@ -29,7 +29,6 @@ #pragma once -#include <boost/scoped_array.hpp> #include "mongo/util/assert_util.h" @@ -65,7 +64,7 @@ namespace mongo { private: const unsigned char * encode; public: - boost::scoped_array<unsigned char> decode; + std::unique_ptr<unsigned char[]> decode; }; extern Alphabet alphabet; diff --git a/src/mongo/util/net/listen.cpp b/src/mongo/util/net/listen.cpp index 2a8e366e105..4cb97c9367e 100644 --- a/src/mongo/util/net/listen.cpp +++ b/src/mongo/util/net/listen.cpp @@ -34,7 +34,6 @@ #include "mongo/util/net/listen.h" -#include <boost/scoped_array.hpp> #include <boost/shared_ptr.hpp> #include "mongo/config.h" @@ -430,7 +429,7 @@ namespace mongo { } OwnedPointerVector<EventHolder> eventHolders; - boost::scoped_array<WSAEVENT> events(new WSAEVENT[_socks.size()]); + std::unique_ptr<WSAEVENT[]> events(new WSAEVENT[_socks.size()]); // Populate events array with an event for each socket we are watching diff --git a/src/mongo/util/processinfo_windows.cpp b/src/mongo/util/processinfo_windows.cpp index e370076fec9..f52ff511ef9 100644 --- a/src/mongo/util/processinfo_windows.cpp +++ b/src/mongo/util/processinfo_windows.cpp @@ -31,7 +31,6 @@ #include "mongo/platform/basic.h" -#include <boost/scoped_array.hpp> #include <iostream> #include <psapi.h> @@ -39,7 +38,7 @@ #include "mongo/util/log.h" using namespace std; -using boost::scoped_array; +using std::unique_ptr; namespace mongo { @@ -177,7 +176,7 @@ namespace mongo { return false; } - boost::scoped_array<char> verData(new char[verSize]); + std::unique_ptr<char[]> verData(new char[verSize]); if (GetFileVersionInfoA(filePath, NULL, verSize, verData.get()) == 0) { DWORD gle = GetLastError(); warning() << "GetFileVersionInfoSizeA on " << filePath << " failed with " << errnoWithDescription(gle); @@ -213,7 +212,7 @@ namespace mongo { return false; } - boost::scoped_array<char> systemDirectory(new char[pathBufferSize]); + std::unique_ptr<char[]> systemDirectory(new char[pathBufferSize]); UINT systemDirectoryPathLen; systemDirectoryPathLen = GetSystemDirectoryA(systemDirectory.get(), pathBufferSize); if (systemDirectoryPathLen == 0) { @@ -380,7 +379,7 @@ namespace mongo { DWORD returnLength = 0; DWORD numaNodeCount = 0; - scoped_array<SYSTEM_LOGICAL_PROCESSOR_INFORMATION> buffer; + unique_ptr<SYSTEM_LOGICAL_PROCESSOR_INFORMATION[]> buffer; LPFN_GLPI glpi(reinterpret_cast<LPFN_GLPI>(GetProcAddress( GetModuleHandleW(L"kernel32"), @@ -454,7 +453,7 @@ namespace mongo { bool ProcessInfo::pagesInMemory(const void* start, size_t numPages, vector<char>* out) { out->resize(numPages); - scoped_array<PSAPI_WORKING_SET_EX_INFORMATION> wsinfo( + unique_ptr<PSAPI_WORKING_SET_EX_INFORMATION[]> wsinfo( new PSAPI_WORKING_SET_EX_INFORMATION[numPages]); const void* startOfFirstPage = alignToStartOfPage(start); diff --git a/src/mongo/util/stacktrace_windows.cpp b/src/mongo/util/stacktrace_windows.cpp index 4abc27e3c97..b11ae1d630e 100644 --- a/src/mongo/util/stacktrace_windows.cpp +++ b/src/mongo/util/stacktrace_windows.cpp @@ -33,7 +33,6 @@ #include <DbgHelp.h> #include <boost/filesystem/operations.hpp> -#include <boost/smart_ptr/scoped_array.hpp> #include <cstdio> #include <cstdlib> #include <iostream> @@ -58,7 +57,7 @@ namespace mongo { if (symbolSearchPath.empty()) { static const size_t bufferSize = 1024; - boost::scoped_array<char> pathBuffer(new char[bufferSize]); + std::unique_ptr<char[]> pathBuffer(new char[bufferSize]); GetModuleFileNameA(NULL, pathBuffer.get(), bufferSize); boost::filesystem::path exePath(pathBuffer.get()); symbolSearchPath = exePath.parent_path().string(); @@ -122,7 +121,7 @@ namespace mongo { filename.swap( shorter ); } static const size_t bufferSize = 32; - boost::scoped_array<char> lineNumber( new char[bufferSize] ); + std::unique_ptr<char[]> lineNumber( new char[bufferSize] ); _snprintf( lineNumber.get(), bufferSize, "(%u)", line64.LineNumber ); filename += lineNumber.get(); returnedSourceAndLine->swap( filename ); @@ -148,7 +147,7 @@ namespace mongo { } std::string symbolString( symbolInfo->Name ); static const size_t bufferSize = 32; - boost::scoped_array<char> symbolOffset( new char[bufferSize] ); + std::unique_ptr<char[]> symbolOffset( new char[bufferSize] ); _snprintf( symbolOffset.get(), bufferSize, "+0x%x", displacement64 ); symbolString += symbolOffset.get(); returnedSymbolAndOffset->swap( symbolString ); @@ -219,7 +218,7 @@ namespace mongo { const size_t nameSize = 1024; const size_t symbolBufferSize = sizeof(SYMBOL_INFO) + nameSize; - boost::scoped_array<char> symbolCharBuffer( new char[symbolBufferSize] ); + std::unique_ptr<char[]> symbolCharBuffer( new char[symbolBufferSize] ); memset( symbolCharBuffer.get(), 0, symbolBufferSize ); SYMBOL_INFO* symbolBuffer = reinterpret_cast<SYMBOL_INFO*>( symbolCharBuffer.get() ); symbolBuffer->SizeOfStruct = sizeof(SYMBOL_INFO); diff --git a/src/mongo/util/stringutils.h b/src/mongo/util/stringutils.h index c57205b4160..794b128816a 100644 --- a/src/mongo/util/stringutils.h +++ b/src/mongo/util/stringutils.h @@ -31,10 +31,10 @@ #include <ctype.h> +#include <memory> #include <string> #include <vector> -#include <boost/scoped_array.hpp> #include "mongo/base/string_data.h" @@ -50,7 +50,7 @@ namespace mongo { inline std::string tolowerString( StringData input ) { std::string::size_type sz = input.size(); - boost::scoped_array<char> line(new char[sz+1]); + std::unique_ptr<char[]> line(new char[sz+1]); char * copy = line.get(); for ( std::string::size_type i=0; i<sz; i++ ) { diff --git a/src/mongo/util/text.cpp b/src/mongo/util/text.cpp index 3b0e7ee7d6f..264c9a0e771 100644 --- a/src/mongo/util/text.cpp +++ b/src/mongo/util/text.cpp @@ -30,7 +30,6 @@ #include "mongo/util/text.h" #include <boost/integer_traits.hpp> -#include <boost/smart_ptr/scoped_array.hpp> #include <errno.h> #include <iostream> #include <sstream> @@ -209,7 +208,7 @@ namespace mongo { if ( bufferSize == 0 ) { return std::wstring(); } - boost::scoped_array< wchar_t > tempBuffer( new wchar_t[ bufferSize ] ); + std::unique_ptr< wchar_t []> tempBuffer( new wchar_t[ bufferSize ] ); tempBuffer[0] = 0; MultiByteToWideChar( CP_UTF8, // Code page @@ -241,7 +240,7 @@ namespace mongo { if ( bufferSize == 0 ) { return true; } - boost::scoped_array<wchar_t> utf16String( new wchar_t[ bufferSize ] ); + std::unique_ptr<wchar_t[]> utf16String( new wchar_t[ bufferSize ] ); MultiByteToWideChar( CP_UTF8, // Code page 0, // Flags diff --git a/src/mongo/util/unordered_fast_key_table.h b/src/mongo/util/unordered_fast_key_table.h index e7d670cc24d..786747bcecb 100644 --- a/src/mongo/util/unordered_fast_key_table.h +++ b/src/mongo/util/unordered_fast_key_table.h @@ -29,7 +29,7 @@ #pragma once -#include <boost/smart_ptr/scoped_array.hpp> +#include <memory> #include "mongo/base/disallow_copying.h" @@ -85,7 +85,7 @@ namespace mongo { unsigned _capacity; unsigned _maxProbe; - boost::scoped_array<Entry> _entries; + std::unique_ptr<Entry[]> _entries; }; public: |