summaryrefslogtreecommitdiff
blob: da33d47df7ff105d1913335ceca51614bf9242e0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
From 9df9837299ab952d4d30db2427beef667e608f79 Mon Sep 17 00:00:00 2001
From: Steven Green <steven@greenius.co.uk>
Date: Mon, 17 Jul 2017 13:05:44 +0100
Subject: [PATCH] SERVER-30166 Replace string with explicit std::string.
 Enables compulation when using --use-system-pcre which presusably used to do
 'using std::string' in an earlier version of pcre

 https://github.com/mongodb/mongo/pull/1166

---
 src/mongo/db/dbwebserver.cpp             |  1 +
 src/mongo/db/matcher/expression_leaf.cpp |  4 ++--
 src/mongo/db/repl/master_slave.cpp       | 40 ++++++++++++++++----------------
 src/mongo/shell/bench.cpp                | 14 +++++------
 src/mongo/util/net/miniwebserver.cpp     |  1 +
 5 files changed, 31 insertions(+), 29 deletions(-)

diff --git a/src/mongo/db/dbwebserver.cpp b/src/mongo/db/dbwebserver.cpp
index b202e0500b9..02556135240 100644
--- a/src/mongo/db/dbwebserver.cpp
+++ b/src/mongo/db/dbwebserver.cpp
@@ -67,6 +67,7 @@ namespace mongo {
 using std::map;
 using std::stringstream;
 using std::vector;
+using std::string;
 
 using namespace html;
 
diff --git a/src/mongo/db/matcher/expression_leaf.cpp b/src/mongo/db/matcher/expression_leaf.cpp
index d562bff141e..b96a36d543f 100644
--- a/src/mongo/db/matcher/expression_leaf.cpp
+++ b/src/mongo/db/matcher/expression_leaf.cpp
@@ -202,7 +202,7 @@ void ComparisonMatchExpression::debugString(StringBuilder& debug, int level) con
 }
 
 void ComparisonMatchExpression::serialize(BSONObjBuilder* out) const {
-    string opString = "";
+    std::string opString = "";
     switch (matchType()) {
         case LT:
             opString = "$lt";
@@ -884,7 +884,7 @@ void BitTestMatchExpression::debugString(StringBuilder& debug, int level) const
 }
 
 void BitTestMatchExpression::serialize(BSONObjBuilder* out) const {
-    string opString = "";
+    std::string opString = "";
 
     switch (matchType()) {
         case BITS_ALL_SET:
diff --git a/src/mongo/db/repl/master_slave.cpp b/src/mongo/db/repl/master_slave.cpp
index 05faad12599..042350465c6 100644
--- a/src/mongo/db/repl/master_slave.cpp
+++ b/src/mongo/db/repl/master_slave.cpp
@@ -168,7 +168,7 @@ BSONObj ReplSource::jsobj() {
 
     BSONObjBuilder dbsNextPassBuilder;
     int n = 0;
-    for (set<string>::iterator i = addDbNextPass.begin(); i != addDbNextPass.end(); i++) {
+    for (set<std::string>::iterator i = addDbNextPass.begin(); i != addDbNextPass.end(); i++) {
         n++;
         dbsNextPassBuilder.appendBool(*i, 1);
     }
@@ -177,7 +177,7 @@ BSONObj ReplSource::jsobj() {
 
     BSONObjBuilder incompleteCloneDbsBuilder;
     n = 0;
-    for (set<string>::iterator i = incompleteCloneDbs.begin(); i != incompleteCloneDbs.end(); i++) {
+    for (set<std::string>::iterator i = incompleteCloneDbs.begin(); i != incompleteCloneDbs.end(); i++) {
         n++;
         incompleteCloneDbsBuilder.appendBool(*i, 1);
     }
@@ -188,7 +188,7 @@ BSONObj ReplSource::jsobj() {
 }
 
 void ReplSource::ensureMe(OperationContext* txn) {
-    string myname = getHostName();
+    std::string myname = getHostName();
 
     // local.me is an identifier for a server for getLastError w:2+
     bool exists = Helpers::getSingleton(txn, "local.me", _me);
@@ -378,10 +378,10 @@ class HandshakeCmd : public Command {
     }
 
     virtual bool run(OperationContext* txn,
-                     const string& ns,
+                     const std::string& ns,
                      BSONObj& cmdObj,
                      int options,
-                     string& errmsg,
+                     std::string& errmsg,
                      BSONObjBuilder& result) {
         HandshakeArgs handshake;
         Status status = handshake.initialize(cmdObj);
@@ -398,7 +398,7 @@ class HandshakeCmd : public Command {
 } handshakeCmd;
 
 bool replHandshake(DBClientConnection* conn, const OID& myRID) {
-    string myname = getHostName();
+    std::string myname = getHostName();
 
     BSONObjBuilder cmd;
     cmd.append("handshake", myRID);
@@ -450,7 +450,7 @@ void ReplSource::forceResync(OperationContext* txn, const char* requester) {
         BSONElement e = i.next();
         if (e.eoo())
             break;
-        string name = e.embeddedObject().getField("name").valuestr();
+        std::string name = e.embeddedObject().getField("name").valuestr();
         if (!e.embeddedObject().getBoolField("empty")) {
             if (name != "local") {
                 if (only.empty() || only == name) {
@@ -481,7 +481,7 @@ Status ReplSource::_updateIfDoneWithInitialSync() {
     return Status::OK();
 }
 
-void ReplSource::resyncDrop(OperationContext* txn, const string& dbName) {
+void ReplSource::resyncDrop(OperationContext* txn, const std::string& dbName) {
     log() << "resync: dropping database " << dbName;
     invariant(txn->lockState()->isW());
 
@@ -531,13 +531,13 @@ void ReplSource::resync(OperationContext* txn, const std::string& dbName) {
 
 static DatabaseIgnorer ___databaseIgnorer;
 
-void DatabaseIgnorer::doIgnoreUntilAfter(const string& db, const Timestamp& futureOplogTime) {
+void DatabaseIgnorer::doIgnoreUntilAfter(const std::string& db, const Timestamp& futureOplogTime) {
     if (futureOplogTime > _ignores[db]) {
         _ignores[db] = futureOplogTime;
     }
 }
 
-bool DatabaseIgnorer::ignoreAt(const string& db, const Timestamp& currentOplogTime) {
+bool DatabaseIgnorer::ignoreAt(const std::string& db, const Timestamp& currentOplogTime) {
     if (_ignores[db].isNull()) {
         return false;
     }
@@ -627,7 +627,7 @@ bool ReplSource::handleDuplicateDbName(OperationContext* txn,
 
     // The database is present on the master and no conflicting databases
     // are present on the master.  Drop any local conflicts.
-    for (set<string>::const_iterator i = duplicates.begin(); i != duplicates.end(); ++i) {
+    for (set<std::string>::const_iterator i = duplicates.begin(); i != duplicates.end(); ++i) {
         ___databaseIgnorer.doIgnoreUntilAfter(*i, lastTime);
         incompleteCloneDbs.erase(*i);
         addDbNextPass.erase(*i);
@@ -826,10 +826,10 @@ void ReplSource::_sync_pullOpLog_applyOperation(OperationContext* txn,
 }
 
 void ReplSource::syncToTailOfRemoteLog() {
-    string _ns = ns();
+    std::string _ns = ns();
     BSONObjBuilder b;
     if (!only.empty()) {
-        b.appendRegex("ns", string("^") + pcrecpp::RE::QuoteMeta(only));
+        b.appendRegex("ns", std::string("^") + pcrecpp::RE::QuoteMeta(only));
     }
     BSONObj last = oplogReader.findOne(_ns.c_str(), Query(b.done()).sort(BSON("$natural" << -1)));
     if (!last.isEmpty()) {
@@ -877,7 +877,7 @@ class ReplApplyBatchSize
 */
 int ReplSource::_sync_pullOpLog(OperationContext* txn, int& nApplied) {
     int okResultCode = restartSyncAfterSleep;
-    string ns = string("local.oplog.$") + sourceName();
+    std::string ns = std::string("local.oplog.$") + sourceName();
     LOG(2) << "sync_pullOpLog " << ns << " syncedTo:" << syncedTo.toStringLong() << '\n';
 
     bool tailing = true;
@@ -897,7 +897,7 @@ int ReplSource::_sync_pullOpLog(OperationContext* txn, int& nApplied) {
                 BSONElement e = i.next();
                 if (e.eoo())
                     break;
-                string name = e.embeddedObject().getField("name").valuestr();
+                std::string name = e.embeddedObject().getField("name").valuestr();
                 if (!e.embeddedObject().getBoolField("empty")) {
                     if (name != "local") {
                         if (only.empty() || only == name) {
@@ -921,7 +921,7 @@ int ReplSource::_sync_pullOpLog(OperationContext* txn, int& nApplied) {
         if (!only.empty()) {
             // note we may here skip a LOT of data table scanning, a lot of work for the master.
             // maybe append "\\." here?
-            query.appendRegex("ns", string("^") + pcrecpp::RE::QuoteMeta(only));
+            query.appendRegex("ns", std::string("^") + pcrecpp::RE::QuoteMeta(only));
         }
         BSONObj queryObj = query.done();
         // e.g. queryObj = { ts: { $gte: syncedTo } }
@@ -940,7 +940,7 @@ int ReplSource::_sync_pullOpLog(OperationContext* txn, int& nApplied) {
 
     // show any deferred database creates from a previous pass
     {
-        set<string>::iterator i = addDbNextPass.begin();
+        set<std::string>::iterator i = addDbNextPass.begin();
         if (i != addDbNextPass.end()) {
             BSONObjBuilder b;
             b.append("ns", *i + '.');
@@ -984,7 +984,7 @@ int ReplSource::_sync_pullOpLog(OperationContext* txn, int& nApplied) {
         BSONObj op = oplogReader.nextSafe();
         BSONElement ts = op.getField("ts");
         if (ts.type() != Date && ts.type() != bsonTimestamp) {
-            string err = op.getStringField("$err");
+            std::string err = op.getStringField("$err");
             if (!err.empty()) {
                 // 13051 is "tailable cursor requested on non capped collection"
                 if (op.getIntField("code") == 13051) {
@@ -1152,7 +1152,7 @@ int ReplSource::sync(OperationContext* txn, int& nApplied) {
 
     // FIXME Handle cases where this db isn't on default port, or default port is spec'd in
     // hostName.
-    if ((string("localhost") == hostName || string("127.0.0.1") == hostName) &&
+    if ((std::string("localhost") == hostName || std::string("127.0.0.1") == hostName) &&
         serverGlobalParams.port == ServerGlobalParams::DefaultDBPort) {
         log() << "can't sync from self (localhost). sources configuration may be wrong." << endl;
         sleepsecs(5);
@@ -1297,7 +1297,7 @@ static void replMain(OperationContext* txn) {
         if (s) {
             stringstream ss;
             ss << "sleep " << s << " sec before next pass";
-            string msg = ss.str();
+            std::string msg = ss.str();
             if (!serverGlobalParams.quiet)
                 log() << msg << endl;
             ReplInfo r(msg.c_str());
diff --git a/src/mongo/shell/bench.cpp b/src/mongo/shell/bench.cpp
index 040002f5c6e..338477ebe56 100644
--- a/src/mongo/shell/bench.cpp
+++ b/src/mongo/shell/bench.cpp
@@ -674,7 +674,7 @@ void BenchRunWorker::generateLoadOnConnection(DBClientBase* conn) {
     invariant(bsonTemplateEvaluator.setId(_id) == BsonTemplateEvaluator::StatusSuccess);
 
     if (_config->username != "") {
-        string errmsg;
+        std::string errmsg;
         if (!conn->auth("admin", _config->username, _config->password, errmsg)) {
             uasserted(15931, "Authenticating to connection for _benchThread failed: " + errmsg);
         }
@@ -918,7 +918,7 @@ void BenchRunWorker::generateLoadOnConnection(DBClientBase* conn) {
 
                             if (!result["err"].eoo() && result["err"].type() == String &&
                                 (_config->throwGLE || op.throwGLE))
-                                throw DBException((string) "From benchRun GLE" +
+                                throw DBException((std::string) "From benchRun GLE" +
                                                       causedBy(result["err"].String()),
                                                   result["code"].eoo() ? 0 : result["code"].Int());
                         }
@@ -984,7 +984,7 @@ void BenchRunWorker::generateLoadOnConnection(DBClientBase* conn) {
 
                             if (!result["err"].eoo() && result["err"].type() == String &&
                                 (_config->throwGLE || op.throwGLE))
-                                throw DBException((string) "From benchRun GLE" +
+                                throw DBException((std::string) "From benchRun GLE" +
                                                       causedBy(result["err"].String()),
                                                   result["code"].eoo() ? 0 : result["code"].Int());
                         }
@@ -1031,7 +1031,7 @@ void BenchRunWorker::generateLoadOnConnection(DBClientBase* conn) {
 
                             if (!result["err"].eoo() && result["err"].type() == String &&
                                 (_config->throwGLE || op.throwGLE))
-                                throw DBException((string) "From benchRun GLE " +
+                                throw DBException((std::string) "From benchRun GLE " +
                                                       causedBy(result["err"].String()),
                                                   result["code"].eoo() ? 0 : result["code"].Int());
                         }
@@ -1133,7 +1133,7 @@ void BenchRunWorker::run() {
     try {
         std::unique_ptr<DBClientBase> conn(_config->createConnection());
         if (!_config->username.empty()) {
-            string errmsg;
+            std::string errmsg;
             if (!conn->auth("admin", _config->username, _config->password, errmsg)) {
                 uasserted(15932, "Authenticating to connection for benchThread failed: " + errmsg);
             }
@@ -1165,7 +1165,7 @@ void BenchRunner::start() {
         std::unique_ptr<DBClientBase> conn(_config->createConnection());
         // Must authenticate to admin db in order to run serverStatus command
         if (_config->username != "") {
-            string errmsg;
+            std::string errmsg;
             if (!conn->auth("admin", _config->username, _config->password, errmsg)) {
                 uasserted(
                     16704,
@@ -1201,7 +1201,7 @@ void BenchRunner::stop() {
     {
         std::unique_ptr<DBClientBase> conn(_config->createConnection());
         if (_config->username != "") {
-            string errmsg;
+            std::string errmsg;
             // this can only fail if admin access was revoked since start of run
             if (!conn->auth("admin", _config->username, _config->password, errmsg)) {
                 uasserted(
diff --git a/src/mongo/util/net/miniwebserver.cpp b/src/mongo/util/net/miniwebserver.cpp
index 5f4165d42f4..7a7d0714934 100644
--- a/src/mongo/util/net/miniwebserver.cpp
+++ b/src/mongo/util/net/miniwebserver.cpp
@@ -47,6 +47,7 @@ namespace mongo {
 using std::shared_ptr;
 using std::stringstream;
 using std::vector;
+using std::string;
 
 MiniWebServer::MiniWebServer(const string& name, const string& ip, int port, ServiceContext* ctx)
     : Listener(name, ip, port, ctx, false, false) {}