summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mongo/bson/bson_validate_test.cpp5
-rw-r--r--src/mongo/bson/bsonobj.h3
-rw-r--r--src/mongo/client/cyrus_sasl_client_session.h3
-rw-r--r--src/mongo/client/sasl_client_session.h4
-rw-r--r--src/mongo/client/sasl_sspi.cpp5
-rw-r--r--src/mongo/db/field_ref.h1
-rw-r--r--src/mongo/db/pipeline/document.cpp5
-rw-r--r--src/mongo/db/pipeline/expression.h2
-rw-r--r--src/mongo/db/pipeline/value.cpp3
-rw-r--r--src/mongo/db/repl/isself.cpp3
-rw-r--r--src/mongo/db/sorter/sorter.cpp4
-rw-r--r--src/mongo/db/sorter/sorter_test.cpp2
-rw-r--r--src/mongo/db/storage/key_string.cpp5
-rw-r--r--src/mongo/db/storage/mmap_v1/durop.cpp4
-rw-r--r--src/mongo/db/storage/mmap_v1/file_allocator.cpp2
-rw-r--r--src/mongo/db/storage/mmap_v1/record_access_tracker.h3
-rw-r--r--src/mongo/logger/rotatable_file_writer.cpp3
-rw-r--r--src/mongo/platform/backtrace.cpp4
-rw-r--r--src/mongo/scripting/engine.cpp3
-rw-r--r--src/mongo/scripting/v8-3.25_db.cpp5
-rw-r--r--src/mongo/scripting/v8_db.cpp5
-rw-r--r--src/mongo/shell/linenoise.cpp25
-rw-r--r--src/mongo/shell/linenoise_utf8.cpp2
-rw-r--r--src/mongo/shell/linenoise_utf8.h4
-rw-r--r--src/mongo/shell/shell_utils_launcher.cpp9
-rw-r--r--src/mongo/util/base64.h3
-rw-r--r--src/mongo/util/net/listen.cpp3
-rw-r--r--src/mongo/util/processinfo_windows.cpp11
-rw-r--r--src/mongo/util/stacktrace_windows.cpp9
-rw-r--r--src/mongo/util/stringutils.h4
-rw-r--r--src/mongo/util/text.cpp5
-rw-r--r--src/mongo/util/unordered_fast_key_table.h4
32 files changed, 66 insertions, 87 deletions
diff --git a/src/mongo/bson/bson_validate_test.cpp b/src/mongo/bson/bson_validate_test.cpp
index 77dfc11e15c..b3965763861 100644
--- a/src/mongo/bson/bson_validate_test.cpp
+++ b/src/mongo/bson/bson_validate_test.cpp
@@ -27,7 +27,6 @@
#define MONGO_LOG_DEFAULT_COMPONENT ::mongo::logger::LogComponent::kDefault
-#include <boost/scoped_array.hpp>
#include "mongo/base/data_view.h"
#include "mongo/db/jsobj.h"
@@ -39,7 +38,7 @@
namespace {
using namespace mongo;
- using boost::scoped_array;
+ using std::unique_ptr;
using std::endl;
void appendInvalidStringElement(const char* fieldName, BufBuilder* bb) {
@@ -165,7 +164,7 @@ namespace {
int32_t fuzzFrequency = fuzzFrequencies[ i ];
// Copy the 'original' BSONObj to 'buffer'.
- scoped_array<char> buffer( new char[ original.objsize() ] );
+ unique_ptr<char[]> buffer( new char[ original.objsize() ] );
memcpy( buffer.get(), original.objdata(), original.objsize() );
// Randomly flip bits in 'buffer', with probability determined by 'fuzzFrequency'. The
diff --git a/src/mongo/bson/bsonobj.h b/src/mongo/bson/bsonobj.h
index e8f82e895cc..32411f21118 100644
--- a/src/mongo/bson/bsonobj.h
+++ b/src/mongo/bson/bsonobj.h
@@ -29,7 +29,6 @@
#pragma once
-#include <boost/scoped_array.hpp>
#include <list>
#include <set>
#include <string>
@@ -721,7 +720,7 @@ namespace mongo {
private:
const int _nfields;
- const boost::scoped_array<const char *> _fields;
+ const std::unique_ptr<const char *[]> _fields;
int _cur;
};
diff --git a/src/mongo/client/cyrus_sasl_client_session.h b/src/mongo/client/cyrus_sasl_client_session.h
index d24d12124c5..977b22d9a93 100644
--- a/src/mongo/client/cyrus_sasl_client_session.h
+++ b/src/mongo/client/cyrus_sasl_client_session.h
@@ -25,7 +25,6 @@
* then also delete it in the license file.
*/
-#include <boost/scoped_array.hpp>
#include "mongo/client/sasl_client_session.h"
@@ -77,7 +76,7 @@ namespace mongo {
bool _done;
/// Stored of password in sasl_secret_t format
- boost::scoped_array<char> _secret;
+ std::unique_ptr<char[]> _secret;
/// Callbacks registered on _saslConnection for providing the Cyrus SASL library with
/// parameter values, etc.
diff --git a/src/mongo/client/sasl_client_session.h b/src/mongo/client/sasl_client_session.h
index 4bb6c9b72ba..80d8b698d6c 100644
--- a/src/mongo/client/sasl_client_session.h
+++ b/src/mongo/client/sasl_client_session.h
@@ -27,7 +27,7 @@
#pragma once
-#include <boost/scoped_array.hpp>
+#include <memory>
#include <string>
#include "mongo/base/disallow_copying.h"
@@ -133,7 +133,7 @@ namespace mongo {
* Buffer object that owns data for a single parameter.
*/
struct DataBuffer {
- boost::scoped_array<char> data;
+ std::unique_ptr<char[]> data;
size_t size;
};
diff --git a/src/mongo/client/sasl_sspi.cpp b/src/mongo/client/sasl_sspi.cpp
index 391530e20eb..8d2ccc55df3 100644
--- a/src/mongo/client/sasl_sspi.cpp
+++ b/src/mongo/client/sasl_sspi.cpp
@@ -32,7 +32,6 @@
#include "mongo/platform/basic.h"
-#include <boost/scoped_array.hpp>
#include <sasl/sasl.h>
#include <sasl/saslplug.h>
#include <sspi.h>
@@ -219,7 +218,7 @@ namespace {
sasl_client_params_t* cparams,
const char *serverin,
unsigned serverinlen) {
- boost::scoped_array<char> message(new char[serverinlen]);
+ std::unique_ptr<char[]> message(new char[serverinlen]);
memcpy(message.get(), serverin, serverinlen);
SecBuffer wrapBufs[2];
@@ -299,7 +298,7 @@ namespace {
// See RFC4752.
int plaintextMessageSize = 4 + pcctx->userPlusRealm.size();
- boost::scoped_array<char> message(new char[sizes.cbSecurityTrailer +
+ std::unique_ptr<char[]> message(new char[sizes.cbSecurityTrailer +
plaintextMessageSize +
sizes.cbBlockSize]);
char* plaintextMessage = message.get() + sizes.cbSecurityTrailer;
diff --git a/src/mongo/db/field_ref.h b/src/mongo/db/field_ref.h
index 70bb97cf587..b22bfcb3da9 100644
--- a/src/mongo/db/field_ref.h
+++ b/src/mongo/db/field_ref.h
@@ -28,7 +28,6 @@
#pragma once
-#include <boost/scoped_array.hpp>
#include <iosfwd>
#include <string>
#include <vector>
diff --git a/src/mongo/db/pipeline/document.cpp b/src/mongo/db/pipeline/document.cpp
index 4a54a5e614d..741834d39cf 100644
--- a/src/mongo/db/pipeline/document.cpp
+++ b/src/mongo/db/pipeline/document.cpp
@@ -31,7 +31,6 @@
#include "mongo/db/pipeline/document.h"
#include <boost/functional/hash.hpp>
-#include <boost/scoped_array.hpp>
#include "mongo/db/jsobj.h"
#include "mongo/db/pipeline/field_path.h"
@@ -146,7 +145,7 @@ namespace mongo {
uassert(16490, "Tried to make oversized document",
capacity <= size_t(BufferMaxSize));
- boost::scoped_array<char> oldBuf(_buffer);
+ std::unique_ptr<char[]> oldBuf(_buffer);
_buffer = new char[capacity];
_bufferEnd = _buffer + capacity - hashTabBytes();
@@ -211,7 +210,7 @@ namespace mongo {
}
DocumentStorage::~DocumentStorage() {
- boost::scoped_array<char> deleteBufferAtScopeEnd (_buffer);
+ std::unique_ptr<char[]> deleteBufferAtScopeEnd (_buffer);
for (DocumentStorageIterator it = iteratorAll(); !it.atEnd(); it.advance()) {
it->val.~Value(); // explicit destructor call
diff --git a/src/mongo/db/pipeline/expression.h b/src/mongo/db/pipeline/expression.h
index 05891fe1592..d1f24408038 100644
--- a/src/mongo/db/pipeline/expression.h
+++ b/src/mongo/db/pipeline/expression.h
@@ -88,7 +88,7 @@ namespace mongo {
private:
Document _root;
- const boost::scoped_array<Value> _rest;
+ const std::unique_ptr<Value[]> _rest;
const size_t _numVars;
};
diff --git a/src/mongo/db/pipeline/value.cpp b/src/mongo/db/pipeline/value.cpp
index c949601ac4d..833d7ac23de 100644
--- a/src/mongo/db/pipeline/value.cpp
+++ b/src/mongo/db/pipeline/value.cpp
@@ -32,7 +32,6 @@
#include <cmath>
#include <boost/functional/hash.hpp>
-#include <boost/scoped_array.hpp>
#include "mongo/base/compare_numbers.h"
#include "mongo/db/jsobj.h"
@@ -124,7 +123,7 @@ namespace mongo {
const size_t totalLen = patternLen + 1/*middle NUL*/ + flagsLen;
// Need to copy since putString doesn't support scatter-gather.
- boost::scoped_array<char> buf (new char[totalLen]);
+ std::unique_ptr<char[]> buf (new char[totalLen]);
re.pattern.copyTo(buf.get(), true);
re.flags.copyTo(buf.get() + patternLen + 1, false); // no NUL
putString(StringData(buf.get(), totalLen));
diff --git a/src/mongo/db/repl/isself.cpp b/src/mongo/db/repl/isself.cpp
index 4746ff01a28..d0b44858913 100644
--- a/src/mongo/db/repl/isself.cpp
+++ b/src/mongo/db/repl/isself.cpp
@@ -66,7 +66,6 @@
#elif defined(_WIN32)
#include <boost/asio/detail/socket_ops.hpp>
-#include <boost/scoped_array.hpp>
#include <boost/system/error_code.hpp>
#include <iphlpapi.h>
#include <winsock2.h>
@@ -260,7 +259,7 @@ namespace {
// for the rare case that the adapter config changes between calls
ULONG adaptersLen = 15 * 1024;
- boost::scoped_array<char> buf(new char[adaptersLen]);
+ std::unique_ptr<char[]> buf(new char[adaptersLen]);
IP_ADAPTER_ADDRESSES* adapters = reinterpret_cast<IP_ADAPTER_ADDRESSES*>(buf.get());
DWORD err;
diff --git a/src/mongo/db/sorter/sorter.cpp b/src/mongo/db/sorter/sorter.cpp
index 8b2e82ef665..adf287fa86d 100644
--- a/src/mongo/db/sorter/sorter.cpp
+++ b/src/mongo/db/sorter/sorter.cpp
@@ -228,7 +228,7 @@ namespace mongo {
massert(17061, "couldn't get uncompressed length",
snappy::GetUncompressedLength(_buffer.get(), blockSize, &uncompressedSize));
- boost::scoped_array<char> decompressionBuffer(new char[uncompressedSize]);
+ std::unique_ptr<char[]> decompressionBuffer(new char[uncompressedSize]);
massert(17062, "decompression failed",
snappy::RawUncompress(_buffer.get(),
blockSize,
@@ -257,7 +257,7 @@ namespace mongo {
const Settings _settings;
bool _done;
- boost::scoped_array<char> _buffer;
+ std::unique_ptr<char[]> _buffer;
std::unique_ptr<BufReader> _reader;
std::string _fileName;
boost::shared_ptr<FileDeleter> _fileDeleter; // Must outlive _file
diff --git a/src/mongo/db/sorter/sorter_test.cpp b/src/mongo/db/sorter/sorter_test.cpp
index 6c6501dc576..f053c5de4a7 100644
--- a/src/mongo/db/sorter/sorter_test.cpp
+++ b/src/mongo/db/sorter/sorter_test.cpp
@@ -497,7 +497,7 @@ namespace mongo {
NUM_ITEMS = 500*1000,
MEM_LIMIT = 64*1024,
};
- boost::scoped_array<int> _array;
+ std::unique_ptr<int[]> _array;
};
diff --git a/src/mongo/db/storage/key_string.cpp b/src/mongo/db/storage/key_string.cpp
index c77e5fc2e72..526460c1d68 100644
--- a/src/mongo/db/storage/key_string.cpp
+++ b/src/mongo/db/storage/key_string.cpp
@@ -34,7 +34,6 @@
#include "mongo/db/storage/key_string.h"
-#include <boost/scoped_array.hpp>
#include <cmath>
#include "mongo/base/data_view.h"
@@ -839,7 +838,7 @@ namespace mongo {
*stream << BSONBinData(ptr, size, subType);
}
else {
- boost::scoped_array<char> flipped(new char[size]);
+ std::unique_ptr<char[]> flipped(new char[size]);
memcpy_flipBits(flipped.get(), ptr, size);
*stream << BSONBinData(flipped.get(), size, subType);
}
@@ -863,7 +862,7 @@ namespace mongo {
case CType::kDBRef: {
size_t size = endian::bigToNative(readType<uint32_t>(reader, inverted));
if (inverted) {
- boost::scoped_array<char> ns(new char[size]);
+ std::unique_ptr<char[]> ns(new char[size]);
memcpy_flipBits(ns.get(), reader->skip(size), size);
char oidBytes[OID::kOIDSize];
memcpy_flipBits(oidBytes, reader->skip(OID::kOIDSize), OID::kOIDSize);
diff --git a/src/mongo/db/storage/mmap_v1/durop.cpp b/src/mongo/db/storage/mmap_v1/durop.cpp
index ee91e0c60aa..573c1f5688a 100644
--- a/src/mongo/db/storage/mmap_v1/durop.cpp
+++ b/src/mongo/db/storage/mmap_v1/durop.cpp
@@ -48,7 +48,7 @@
namespace mongo {
- using boost::scoped_array;
+ using std::unique_ptr;
using boost::shared_ptr;
using std::endl;
using std::string;
@@ -162,7 +162,7 @@ namespace mongo {
massert(13547, str::stream() << "recover couldn't create file " << full, f.is_open());
unsigned long long left = _len;
const unsigned blksz = 64 * 1024;
- scoped_array<char> v( new char[blksz] );
+ unique_ptr<char[]> v( new char[blksz] );
memset( v.get(), 0, blksz );
fileofs ofs = 0;
while( left ) {
diff --git a/src/mongo/db/storage/mmap_v1/file_allocator.cpp b/src/mongo/db/storage/mmap_v1/file_allocator.cpp
index d0bd764d25a..17ea4b328b2 100644
--- a/src/mongo/db/storage/mmap_v1/file_allocator.cpp
+++ b/src/mongo/db/storage/mmap_v1/file_allocator.cpp
@@ -289,7 +289,7 @@ namespace mongo {
lseek(fd, 0, SEEK_SET);
const long z = 256 * 1024;
- const boost::scoped_array<char> buf_holder (new char[z]);
+ const std::unique_ptr<char[]> buf_holder (new char[z]);
char* buf = buf_holder.get();
memset(buf, 0, z);
long left = size;
diff --git a/src/mongo/db/storage/mmap_v1/record_access_tracker.h b/src/mongo/db/storage/mmap_v1/record_access_tracker.h
index 7145ed833dc..aa98e22230e 100644
--- a/src/mongo/db/storage/mmap_v1/record_access_tracker.h
+++ b/src/mongo/db/storage/mmap_v1/record_access_tracker.h
@@ -28,7 +28,6 @@
#pragma once
-#include <boost/scoped_array.hpp>
#include "mongo/util/concurrency/mutex.h"
@@ -154,7 +153,7 @@ namespace mongo {
bool _blockSupported;
// An array of Rolling instances for tracking record accesses.
- boost::scoped_array<Rolling> _rollingTable;
+ std::unique_ptr<Rolling[]> _rollingTable;
};
} // namespace
diff --git a/src/mongo/logger/rotatable_file_writer.cpp b/src/mongo/logger/rotatable_file_writer.cpp
index f657f42c18d..f97e3a72958 100644
--- a/src/mongo/logger/rotatable_file_writer.cpp
+++ b/src/mongo/logger/rotatable_file_writer.cpp
@@ -30,7 +30,6 @@
#include "mongo/logger/rotatable_file_writer.h"
#include <boost/filesystem/operations.hpp>
-#include <boost/scoped_array.hpp>
#include <cstdio>
#include <fstream>
@@ -61,7 +60,7 @@ namespace {
// A Windows wchar_t encoding of a unicode codepoint never takes more instances of wchar_t
// than the UTF-8 encoding takes instances of char.
- boost::scoped_array<wchar_t> tempBuffer(new wchar_t[utf8Str.size()]);
+ std::unique_ptr<wchar_t[]> tempBuffer(new wchar_t[utf8Str.size()]);
tempBuffer[0] = L'\0';
int finalSize = MultiByteToWideChar(
CP_UTF8, // Code page
diff --git a/src/mongo/platform/backtrace.cpp b/src/mongo/platform/backtrace.cpp
index 8ed3303decd..f1c963aca22 100644
--- a/src/mongo/platform/backtrace.cpp
+++ b/src/mongo/platform/backtrace.cpp
@@ -32,9 +32,9 @@
#include "mongo/platform/backtrace.h"
-#include <boost/smart_ptr/scoped_array.hpp>
#include <cstdio>
#include <dlfcn.h>
+#include <memory>
#include <string>
#include <ucontext.h>
#include <vector>
@@ -141,7 +141,7 @@ namespace {
size_t blockSize = size * sizeof(char*);
size_t blockPtr = blockSize;
const size_t kBufferSize = 8 * 1024;
- boost::scoped_array<char> stringBuffer(new char[kBufferSize]);
+ std::unique_ptr<char[]> stringBuffer(new char[kBufferSize]);
for (int i = 0; i < size; ++i) {
size_t thisLength = 1 + addrtosymstr(array[i], stringBuffer.get(), kBufferSize);
stringVector.push_back(string(stringBuffer.get()));
diff --git a/src/mongo/scripting/engine.cpp b/src/mongo/scripting/engine.cpp
index 153df5d7f6d..e42a3db8186 100644
--- a/src/mongo/scripting/engine.cpp
+++ b/src/mongo/scripting/engine.cpp
@@ -35,7 +35,6 @@
#include <cctype>
#include <boost/filesystem/operations.hpp>
-#include <boost/scoped_array.hpp>
#include <boost/shared_ptr.hpp>
#include "mongo/client/dbclientcursor.h"
@@ -172,7 +171,7 @@ namespace {
return false;
}
unsigned len = static_cast<unsigned>(fo);
- boost::scoped_array<char> data (new char[len+1]);
+ std::unique_ptr<char[]> data (new char[len+1]);
data[len] = 0;
f.read(0, data.get(), len);
diff --git a/src/mongo/scripting/v8-3.25_db.cpp b/src/mongo/scripting/v8-3.25_db.cpp
index bf8fd9c78a5..f4fe7d6a88d 100644
--- a/src/mongo/scripting/v8-3.25_db.cpp
+++ b/src/mongo/scripting/v8-3.25_db.cpp
@@ -31,7 +31,6 @@
#include <iostream>
#include <iomanip>
-#include <boost/scoped_array.hpp>
#include <boost/shared_ptr.hpp>
#include "mongo/base/init.h"
@@ -46,7 +45,7 @@
#include "mongo/util/text.h"
using namespace std;
-using boost::scoped_array;
+using std::unique_ptr;
using boost::shared_ptr;
namespace mongo {
@@ -895,7 +894,7 @@ namespace mongo {
// up of valid hex digits, and fails in the hex utility functions
int len = hexstr.length() / 2;
- scoped_array<char> data(new char[len]);
+ unique_ptr<char[]> data(new char[len]);
const char* src = hexstr.c_str();
for(int i = 0; i < len; i++) {
data[i] = fromHex(src + i * 2);
diff --git a/src/mongo/scripting/v8_db.cpp b/src/mongo/scripting/v8_db.cpp
index b14016e86ea..6d4fa2a4e2f 100644
--- a/src/mongo/scripting/v8_db.cpp
+++ b/src/mongo/scripting/v8_db.cpp
@@ -31,7 +31,6 @@
#include <iostream>
#include <iomanip>
-#include <boost/scoped_array.hpp>
#include <boost/shared_ptr.hpp>
#include "mongo/base/init.h"
@@ -50,7 +49,7 @@
#include "mongo/util/text.h"
using namespace std;
-using boost::scoped_array;
+using std::unique_ptr;
using boost::shared_ptr;
namespace mongo {
@@ -995,7 +994,7 @@ namespace mongo {
// up of valid hex digits, and fails in the hex utility functions
int len = hexstr.length() / 2;
- scoped_array<char> data(new char[len]);
+ unique_ptr<char[]> data(new char[len]);
const char* src = hexstr.c_str();
for(int i = 0; i < len; i++) {
data[i] = fromHex(src + i * 2);
diff --git a/src/mongo/shell/linenoise.cpp b/src/mongo/shell/linenoise.cpp
index 753f1154f27..43b42b9f028 100644
--- a/src/mongo/shell/linenoise.cpp
+++ b/src/mongo/shell/linenoise.cpp
@@ -119,12 +119,11 @@
#include "mk_wcwidth.h"
#include <string>
#include <vector>
-#include <boost/smart_ptr/scoped_array.hpp>
using std::string;
using std::vector;
-using boost::scoped_array;
+using std::unique_ptr;
using linenoise_utf8::UChar8;
using linenoise_utf8::UChar32;
@@ -1652,7 +1651,7 @@ int InputBuffer::incrementalHistorySearch( PromptBase& pi, int startChar ) {
if ( historyIndex == historyLen - 1 ) {
free( history[historyLen - 1] );
bufferSize = sizeof( UChar32 ) * len + 1;
- scoped_array< UChar8 > tempBuffer( new UChar8[ bufferSize ] );
+ unique_ptr< UChar8 []> tempBuffer( new UChar8[ bufferSize ] );
copyString32to8( tempBuffer.get(), buf32, bufferSize );
history[ historyLen - 1 ] = reinterpret_cast< UChar8 * >( strdup( reinterpret_cast< const char * >( tempBuffer.get() ) ) );
}
@@ -1759,7 +1758,7 @@ int InputBuffer::incrementalHistorySearch( PromptBase& pi, int startChar ) {
enableRawMode(); // Back from Linux shell, re-enter raw mode
{
bufferSize = historyLineLength + 1;
- scoped_array< UChar32 > tempUnicode( new UChar32[ bufferSize ] );
+ unique_ptr< UChar32 []> tempUnicode( new UChar32[ bufferSize ] );
copyString8to32( tempUnicode.get(), history[ historyIndex ], bufferSize, ucharCount, errorCode );
dynamicRefresh( dp, tempUnicode.get(), historyLineLength, historyLinePosition );
}
@@ -1770,7 +1769,7 @@ int InputBuffer::incrementalHistorySearch( PromptBase& pi, int startChar ) {
// these characters update the search string, and hence the selected input line
case ctrlChar( 'H' ): // backspace/ctrl-H, delete char to left of cursor
if ( dp.searchTextLen > 0 ) {
- scoped_array<UChar32> tempUnicode( new UChar32[ dp.searchTextLen ] );
+ unique_ptr<UChar32[]> tempUnicode( new UChar32[ dp.searchTextLen ] );
--dp.searchTextLen;
dp.searchText[ dp.searchTextLen ] = 0;
copyString32( tempUnicode.get(), dp.searchText.get(), dp.searchTextLen + 1 );
@@ -1786,7 +1785,7 @@ int InputBuffer::incrementalHistorySearch( PromptBase& pi, int startChar ) {
default:
if ( !isControlChar( c ) && c <= 0x0010FFFF ) { // not an action character
- scoped_array< UChar32 > tempUnicode( new UChar32[ dp.searchTextLen + 2 ] );
+ unique_ptr< UChar32 []> tempUnicode( new UChar32[ dp.searchTextLen + 2 ] );
copyString32( tempUnicode.get(), dp.searchText.get(), dp.searchTextLen + 2 );
tempUnicode[ dp.searchTextLen ] = c;
tempUnicode[ dp.searchTextLen + 1 ] = 0;
@@ -1889,7 +1888,7 @@ int InputBuffer::getInputLine( PromptBase& pi ) {
// The latest history entry is always our current buffer
if ( len > 0 ) {
size_t bufferSize = sizeof( UChar32 ) * len + 1;
- scoped_array< char > tempBuffer( new char[ bufferSize ] );
+ unique_ptr< char []> tempBuffer( new char[ bufferSize ] );
copyString32to8( reinterpret_cast< UChar8 * >( tempBuffer.get() ), buf32, bufferSize );
linenoiseHistoryAdd( tempBuffer.get() );
}
@@ -2193,7 +2192,7 @@ int InputBuffer::getInputLine( PromptBase& pi ) {
if ( historyIndex == historyLen - 1 ) {
free( history[historyLen - 1] );
size_t tempBufferSize = sizeof( UChar32 ) * len + 1;
- scoped_array< UChar8 > tempBuffer( new UChar8[ tempBufferSize ] );
+ unique_ptr< UChar8 []> tempBuffer( new UChar8[ tempBufferSize ] );
copyString32to8( tempBuffer.get(), buf32, tempBufferSize );
history[historyLen - 1] = reinterpret_cast< UChar8 * >( strdup( reinterpret_cast< const char * >( tempBuffer.get() ) ) );
}
@@ -2385,7 +2384,7 @@ int InputBuffer::getInputLine( PromptBase& pi ) {
if ( historyIndex == historyLen - 1 ) {
free( history[historyLen - 1] );
size_t tempBufferSize = sizeof( UChar32 ) * len + 1;
- scoped_array< UChar8 > tempBuffer( new UChar8[ tempBufferSize ] );
+ unique_ptr< UChar8 []> tempBuffer( new UChar8[ tempBufferSize ] );
copyString32to8( tempBuffer.get(), buf32, tempBufferSize );
history[historyLen - 1] = reinterpret_cast< UChar8 * >( strdup( reinterpret_cast< const char * >( tempBuffer.get() ) ) );
}
@@ -2466,7 +2465,7 @@ void linenoisePreloadBuffer( const char* preloadText ) {
return;
}
int bufferSize = strlen( preloadText ) + 1;
- scoped_array< char > tempBuffer( new char[ bufferSize ] );
+ unique_ptr< char []> tempBuffer( new char[ bufferSize ] );
strncpy( &tempBuffer[0], preloadText, bufferSize );
// remove characters that won't display correctly
@@ -2535,7 +2534,7 @@ char* linenoise( const char* prompt ) {
if ( write32( 1, pi.promptText.get(), pi.promptChars ) == -1 ) return 0;
fflush( stdout );
if ( preloadedBufferContents.empty() ) {
- scoped_array<char> buf8( new char[ LINENOISE_MAX_LINE ] );
+ unique_ptr<char[]> buf8( new char[ LINENOISE_MAX_LINE ] );
if ( fgets( buf8.get(), LINENOISE_MAX_LINE, stdin ) == NULL ) {
return NULL;
}
@@ -2568,13 +2567,13 @@ char* linenoise( const char* prompt ) {
return NULL;
}
size_t bufferSize = sizeof( UChar32 ) * ib.length() + 1;
- scoped_array<UChar8> buf8( new UChar8[ bufferSize ] );
+ unique_ptr<UChar8[]> buf8( new UChar8[ bufferSize ] );
copyString32to8( buf8.get(), buf32, bufferSize );
return strdup( reinterpret_cast<char*>( buf8.get() ) ); // caller must free buffer
}
}
else { // input not from a terminal, we should work with piped input, i.e. redirected stdin
- scoped_array<char> buf8( new char[ LINENOISE_MAX_LINE ] );
+ unique_ptr<char[]> buf8( new char[ LINENOISE_MAX_LINE ] );
if ( fgets( buf8.get(), LINENOISE_MAX_LINE, stdin ) == NULL ) {
return NULL;
}
diff --git a/src/mongo/shell/linenoise_utf8.cpp b/src/mongo/shell/linenoise_utf8.cpp
index f5c69708bb8..986e87259f6 100644
--- a/src/mongo/shell/linenoise_utf8.cpp
+++ b/src/mongo/shell/linenoise_utf8.cpp
@@ -336,7 +336,7 @@ int strncmp32( UChar32* first32, UChar32* second32, size_t length ) {
*/
int write32( int fileHandle, const UChar32* string32, unsigned int sourceLengthInCharacters ) {
size_t tempBufferBytes = 4 * sourceLengthInCharacters + 1;
- boost::scoped_array<char> tempCharString( new char[ tempBufferBytes ] );
+ std::unique_ptr<char[]> tempCharString( new char[ tempBufferBytes ] );
size_t count = copyString32to8counted( reinterpret_cast<UChar8*>( tempCharString.get() ),
string32,
tempBufferBytes,
diff --git a/src/mongo/shell/linenoise_utf8.h b/src/mongo/shell/linenoise_utf8.h
index b650098e73c..4cca38ad298 100644
--- a/src/mongo/shell/linenoise_utf8.h
+++ b/src/mongo/shell/linenoise_utf8.h
@@ -27,8 +27,8 @@
* then also delete it in the license file.
*/
-#include <boost/smart_ptr/scoped_array.hpp>
#include <algorithm>
+#include <memory>
#include <string.h>
namespace linenoise_utf8 {
@@ -165,7 +165,7 @@ protected:
size_t _len; // in units of char_t without nul
size_t _cap; // size of _str buffer including nul
size_t _chars; // number of codepoints
- boost::scoped_array<char_t> _str;
+ std::unique_ptr<char_t[]> _str;
};
struct Utf32String;
diff --git a/src/mongo/shell/shell_utils_launcher.cpp b/src/mongo/shell/shell_utils_launcher.cpp
index 4578e195f4a..2b8aa0239db 100644
--- a/src/mongo/shell/shell_utils_launcher.cpp
+++ b/src/mongo/shell/shell_utils_launcher.cpp
@@ -33,7 +33,6 @@
#include "mongo/shell/shell_utils_launcher.h"
-#include <boost/scoped_array.hpp>
#include <boost/thread/thread.hpp>
#include <iostream>
#include <map>
@@ -62,7 +61,7 @@
namespace mongo {
- using boost::scoped_array;
+ using std::unique_ptr;
using std::cout;
using std::endl;
using std::make_pair;
@@ -398,7 +397,7 @@ namespace mongo {
string args = ss.str();
- boost::scoped_array<TCHAR> args_tchar (new TCHAR[args.size() + 1]);
+ std::unique_ptr<TCHAR[]> args_tchar (new TCHAR[args.size() + 1]);
size_t i;
for(i=0; i < args.size(); i++)
args_tchar[i] = args[i];
@@ -444,14 +443,14 @@ namespace mongo {
#else
- scoped_array<const char *> argvStorage( new const char* [_argv.size()+1] );
+ unique_ptr<const char *[]> argvStorage( new const char* [_argv.size()+1] );
const char** argv = argvStorage.get();
for (unsigned i=0; i < _argv.size(); i++) {
argv[i] = _argv[i].c_str();
}
argv[_argv.size()] = 0;
- scoped_array<const char *> envStorage( new const char* [2] );
+ unique_ptr<const char *[]> envStorage( new const char* [2] );
const char** env = envStorage.get();
env[0] = NULL;
env[1] = NULL;
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: