diff options
author | Shaun Verch <shaun.verch@10gen.com> | 2013-01-22 18:36:24 +0000 |
---|---|---|
committer | Shaun Verch <shaun.verch@10gen.com> | 2013-01-22 18:47:40 +0000 |
commit | 439ce8c8911e33ec47fd1bec9bb6289baf3edfc0 (patch) | |
tree | 24564ef089bb3875bcd6c99bd561dbd6dec02b2e /src/mongo/s | |
parent | 24b35b78bc6f7b7e964edfa2ae96813a39aac4f7 (diff) | |
download | mongo-439ce8c8911e33ec47fd1bec9bb6289baf3edfc0.tar.gz |
SERVER-939 Removed unused default parameter from extract function
Diffstat (limited to 'src/mongo/s')
-rw-r--r-- | src/mongo/s/config_upgrade_v3_to_v4.cpp | 1 | ||||
-rw-r--r-- | src/mongo/s/field_parser-inl.h | 11 | ||||
-rw-r--r-- | src/mongo/s/field_parser.cpp | 10 | ||||
-rw-r--r-- | src/mongo/s/field_parser.h | 12 | ||||
-rw-r--r-- | src/mongo/s/field_parser_test.cpp | 86 | ||||
-rw-r--r-- | src/mongo/s/type_changelog.cpp | 14 | ||||
-rw-r--r-- | src/mongo/s/type_chunk.cpp | 12 | ||||
-rw-r--r-- | src/mongo/s/type_collection.cpp | 21 | ||||
-rw-r--r-- | src/mongo/s/type_config_version.cpp | 15 | ||||
-rw-r--r-- | src/mongo/s/type_database.cpp | 6 | ||||
-rw-r--r-- | src/mongo/s/type_database_test.cpp | 2 | ||||
-rw-r--r-- | src/mongo/s/type_lockpings.cpp | 4 | ||||
-rw-r--r-- | src/mongo/s/type_locks.cpp | 12 | ||||
-rw-r--r-- | src/mongo/s/type_mongos.cpp | 12 | ||||
-rw-r--r-- | src/mongo/s/type_settings.cpp | 15 | ||||
-rw-r--r-- | src/mongo/s/type_shard.cpp | 10 | ||||
-rw-r--r-- | src/mongo/s/type_tags.cpp | 8 |
17 files changed, 110 insertions, 141 deletions
diff --git a/src/mongo/s/config_upgrade_v3_to_v4.cpp b/src/mongo/s/config_upgrade_v3_to_v4.cpp index f7dbc5b68f2..8b80ee876de 100644 --- a/src/mongo/s/config_upgrade_v3_to_v4.cpp +++ b/src/mongo/s/config_upgrade_v3_to_v4.cpp @@ -136,7 +136,6 @@ namespace mongo { bool inCriticalSection; if (!FieldParser::extract(lastUpgradeState, inCriticalSectionField, - false, // UNUSED!!!! &inCriticalSection, errMsg)) { diff --git a/src/mongo/s/field_parser-inl.h b/src/mongo/s/field_parser-inl.h index 2b168e4fc13..9698e905530 100644 --- a/src/mongo/s/field_parser-inl.h +++ b/src/mongo/s/field_parser-inl.h @@ -25,7 +25,6 @@ namespace mongo { template<typename T> FieldParser::FieldState FieldParser::extract(BSONObj doc, const BSONField<vector<T> >& field, - const vector<T>& def, vector<T>* out, string* errMsg) { @@ -52,11 +51,10 @@ namespace mongo { BSONObjIterator objIt(arr); while (objIt.more()) { BSONElement next = objIt.next(); - BSONField<T> fieldFor(next.fieldName()); + BSONField<T> fieldFor(next.fieldName(), out->at(initialSize + i)); if (!FieldParser::extract(arr, fieldFor, - out->at(initialSize + i), &out->at(initialSize + i), &elErrMsg)) { @@ -83,7 +81,6 @@ namespace mongo { template<typename K, typename T> FieldParser::FieldState FieldParser::extract(BSONObj doc, const BSONField<map<K, T> >& field, - const map<K, T>& def, map<K, T>* out, string* errMsg) { @@ -105,10 +102,10 @@ namespace mongo { BSONObjIterator objIt(obj); while (objIt.more()) { BSONElement next = objIt.next(); - BSONField<T> fieldFor(next.fieldName()); - T& value = (*out)[next.fieldName()]; - if (!FieldParser::extract(obj, fieldFor, value, &value, &elErrMsg)) { + + BSONField<T> fieldFor(next.fieldName(), value); + if (!FieldParser::extract(obj, fieldFor, &value, &elErrMsg)) { if (errMsg) { *errMsg = stream() << "error parsing map element " << next.fieldName() << " of field " << field() << causedBy(elErrMsg); diff --git a/src/mongo/s/field_parser.cpp b/src/mongo/s/field_parser.cpp index 695289357a3..b06ede37336 100644 --- a/src/mongo/s/field_parser.cpp +++ b/src/mongo/s/field_parser.cpp @@ -34,7 +34,6 @@ namespace mongo { FieldParser::FieldState FieldParser::extract(BSONObj doc, const BSONField<bool>& field, - bool def, bool* out, string* errMsg) { @@ -60,7 +59,6 @@ namespace mongo { FieldParser::FieldState FieldParser::extract(BSONObj doc, const BSONField<BSONArray>& field, - const BSONArray& def, BSONArray* out, string* errMsg) { @@ -86,7 +84,6 @@ namespace mongo { FieldParser::FieldState FieldParser::extract(BSONObj doc, const BSONField<BSONObj>& field, - const BSONObj& def, BSONObj* out, string* errMsg) { @@ -112,7 +109,6 @@ namespace mongo { FieldParser::FieldState FieldParser::extract(BSONObj doc, const BSONField<Date_t>& field, - const Date_t def, Date_t* out, string* errMsg) { @@ -138,7 +134,6 @@ namespace mongo { FieldParser::FieldState FieldParser::extract(BSONObj doc, const BSONField<string>& field, - const string& def, string* out, string* errMsg) { @@ -164,7 +159,6 @@ namespace mongo { FieldParser::FieldState FieldParser::extract(BSONObj doc, const BSONField<OID>& field, - const OID& def, OID* out, string* errMsg) { @@ -190,7 +184,6 @@ namespace mongo { FieldParser::FieldState FieldParser::extract(BSONObj doc, const BSONField<int>& field, - const int& def, int* out, string* errMsg) { @@ -216,7 +209,6 @@ namespace mongo { FieldParser::FieldState FieldParser::extractNumber(BSONObj doc, const BSONField<int>& field, - const int& def, int* out, string* errMsg) { @@ -242,7 +234,6 @@ namespace mongo { FieldParser::FieldState FieldParser::extract(BSONObj doc, const BSONField<long long>& field, - const long long& def, long long* out, string* errMsg) { @@ -268,7 +259,6 @@ namespace mongo { FieldParser::FieldState FieldParser::extractNumber(BSONObj doc, const BSONField<long long>& field, - const long long& def, long long* out, string* errMsg) { diff --git a/src/mongo/s/field_parser.h b/src/mongo/s/field_parser.h index ca1f44516e4..b5f3c48d22a 100644 --- a/src/mongo/s/field_parser.h +++ b/src/mongo/s/field_parser.h @@ -55,49 +55,41 @@ namespace mongo { static FieldState extract(BSONObj doc, const BSONField<bool>& field, - bool def, bool* out, string* errMsg = NULL); static FieldState extract(BSONObj doc, const BSONField<BSONArray>& field, - const BSONArray& def, BSONArray* out, string* errMsg = NULL); static FieldState extract(BSONObj doc, const BSONField<BSONObj>& field, - const BSONObj& def, BSONObj* out, string* errMsg = NULL); static FieldState extract(BSONObj doc, const BSONField<Date_t>& field, - const Date_t def, Date_t* out, string* errMsg = NULL); static FieldState extract(BSONObj doc, const BSONField<string>& field, - const string& def, string* out, string* errMsg = NULL); static FieldState extract(BSONObj doc, const BSONField<OID>& field, - const OID& def, OID* out, string* errMsg = NULL); static FieldState extract(BSONObj doc, const BSONField<int>& field, - const int& def, int* out, string* errMsg = NULL); static FieldState extract(BSONObj doc, const BSONField<long long>& field, - const long long& def, long long* out, string* errMsg = NULL); @@ -108,13 +100,11 @@ namespace mongo { */ static FieldState extractNumber(BSONObj doc, const BSONField<int>& field, - const int& def, int* out, string* errMsg = NULL); static FieldState extractNumber(BSONObj doc, const BSONField<long long>& field, - const long long& def, long long* out, string* errMsg = NULL); @@ -130,14 +120,12 @@ namespace mongo { template<typename T> static FieldState extract(BSONObj doc, const BSONField<vector<T> >& field, - const vector<T>& def, vector<T>* out, string* errMsg = NULL); template<typename K, typename T> static FieldState extract(BSONObj doc, const BSONField<map<K, T> >& field, - const map<K, T>& def, map<K, T>* out, string* errMsg = NULL); }; diff --git a/src/mongo/s/field_parser_test.cpp b/src/mongo/s/field_parser_test.cpp index 26f84b8d68e..b483e00ecad 100644 --- a/src/mongo/s/field_parser_test.cpp +++ b/src/mongo/s/field_parser_test.cpp @@ -91,55 +91,55 @@ namespace { BSONField<bool> notThere("otherBool", true); BSONField<bool> wrongType(anObj.name()); bool val; - ASSERT_TRUE(FieldParser::extract(doc, aBool, false, &val)); + ASSERT_TRUE(FieldParser::extract(doc, aBool, &val)); ASSERT_EQUALS(val, valBool); - ASSERT_TRUE(FieldParser::extract(doc, notThere, true, &val)); + ASSERT_TRUE(FieldParser::extract(doc, notThere, &val)); ASSERT_EQUALS(val, true); - ASSERT_FALSE(FieldParser::extract(doc, wrongType, true, &val)); + ASSERT_FALSE(FieldParser::extract(doc, wrongType, &val)); } TEST_F(ExtractionFixture, GetBSONArray) { BSONField<BSONArray> notThere("otherArray", BSON_ARRAY("a" << "b")); BSONField<BSONArray> wrongType(aString.name()); BSONArray val; - ASSERT_TRUE(FieldParser::extract(doc, anArray, BSONArray(), &val)); + ASSERT_TRUE(FieldParser::extract(doc, anArray, &val)); ASSERT_EQUALS(val, valArray); - ASSERT_TRUE(FieldParser::extract(doc, notThere, BSON_ARRAY("a" << "b"), &val)); + ASSERT_TRUE(FieldParser::extract(doc, notThere, &val)); ASSERT_EQUALS(val, BSON_ARRAY("a" << "b")); - ASSERT_FALSE(FieldParser::extract(doc, wrongType, BSON_ARRAY("a" << "b"), &val)); + ASSERT_FALSE(FieldParser::extract(doc, wrongType, &val)); } TEST_F(ExtractionFixture, GetBSONObj) { BSONField<BSONObj> notThere("otherObj", BSON("b" << 1)); BSONField<BSONObj> wrongType(aString.name()); BSONObj val; - ASSERT_TRUE(FieldParser::extract(doc, anObj, BSONObj(), &val)); + ASSERT_TRUE(FieldParser::extract(doc, anObj, &val)); ASSERT_EQUALS(val, valObj); - ASSERT_TRUE(FieldParser::extract(doc, notThere, BSON("b" << 1), &val)); + ASSERT_TRUE(FieldParser::extract(doc, notThere, &val)); ASSERT_EQUALS(val, BSON("b" << 1)); - ASSERT_FALSE(FieldParser::extract(doc, wrongType, BSON("b" << 1), &val)); + ASSERT_FALSE(FieldParser::extract(doc, wrongType, &val)); } TEST_F(ExtractionFixture, GetDate) { BSONField<Date_t> notThere("otherDate", 99ULL); BSONField<Date_t> wrongType(aString.name()); Date_t val; - ASSERT_TRUE(FieldParser::extract(doc, aDate, time(0), &val)); + ASSERT_TRUE(FieldParser::extract(doc, aDate, &val)); ASSERT_EQUALS(val, valDate); - ASSERT_TRUE(FieldParser::extract(doc, notThere, 99ULL, &val)); + ASSERT_TRUE(FieldParser::extract(doc, notThere, &val)); ASSERT_EQUALS(val, 99ULL); - ASSERT_FALSE(FieldParser::extract(doc, wrongType, 99ULL, &val)); + ASSERT_FALSE(FieldParser::extract(doc, wrongType, &val)); } TEST_F(ExtractionFixture, GetString) { BSONField<string> notThere("otherString", "abc"); BSONField<string> wrongType(aBool.name()); string val; - ASSERT_TRUE(FieldParser::extract(doc, aString, "", &val)); + ASSERT_TRUE(FieldParser::extract(doc, aString, &val)); ASSERT_EQUALS(val, valString); - ASSERT_TRUE(FieldParser::extract(doc, notThere, "abc", &val)); + ASSERT_TRUE(FieldParser::extract(doc, notThere, &val)); ASSERT_EQUALS(val, "abc"); - ASSERT_FALSE(FieldParser::extract(doc, wrongType, "abc", &val)); + ASSERT_FALSE(FieldParser::extract(doc, wrongType, &val)); } TEST_F(ExtractionFixture, GetOID) { @@ -147,58 +147,58 @@ namespace { BSONField<OID> notThere("otherOID", defOID); BSONField<OID> wrongType(aString.name()); OID val; - ASSERT_TRUE(FieldParser::extract(doc, anOID, OID(), &val)); + ASSERT_TRUE(FieldParser::extract(doc, anOID, &val)); ASSERT_EQUALS(val, valOID); - ASSERT_TRUE(FieldParser::extract(doc, notThere, defOID, &val)); + ASSERT_TRUE(FieldParser::extract(doc, notThere, &val)); ASSERT_EQUALS(val, defOID); - ASSERT_FALSE(FieldParser::extract(doc, wrongType, defOID, &val)); + ASSERT_FALSE(FieldParser::extract(doc, wrongType, &val)); } TEST_F(ExtractionFixture, GetLong) { BSONField<long long> notThere("otherLong", 0); BSONField<long long> wrongType(aString.name()); long long val; - ASSERT_TRUE(FieldParser::extract(doc, aLong, 0, &val)); + ASSERT_TRUE(FieldParser::extract(doc, aLong, &val)); ASSERT_EQUALS(val, valLong); - ASSERT_TRUE(FieldParser::extract(doc, notThere, 0, &val)); + ASSERT_TRUE(FieldParser::extract(doc, notThere, &val)); ASSERT_EQUALS(val, 0); - ASSERT_FALSE(FieldParser::extract(doc, wrongType, 0, &val)); + ASSERT_FALSE(FieldParser::extract(doc, wrongType, &val)); } TEST_F(ExtractionFixture, IsFound) { bool bool_val; BSONField<bool> aBoolMissing("aBoolMissing"); - ASSERT_EQUALS(FieldParser::extract(doc, aBool, 0, &bool_val, NULL), + ASSERT_EQUALS(FieldParser::extract(doc, aBool, &bool_val, NULL), FieldParser::FIELD_SET); - ASSERT_EQUALS(FieldParser::extract(doc, aBoolMissing, 0, &bool_val, NULL), + ASSERT_EQUALS(FieldParser::extract(doc, aBoolMissing, &bool_val, NULL), FieldParser::FIELD_NONE); Date_t Date_t_val; BSONField<Date_t> aDateMissing("aDateMissing"); - ASSERT_EQUALS(FieldParser::extract(doc, aDate, 0, &Date_t_val, NULL), + ASSERT_EQUALS(FieldParser::extract(doc, aDate, &Date_t_val, NULL), FieldParser::FIELD_SET); - ASSERT_EQUALS(FieldParser::extract(doc, aDateMissing, 0, &Date_t_val, NULL), + ASSERT_EQUALS(FieldParser::extract(doc, aDateMissing, &Date_t_val, NULL), FieldParser::FIELD_NONE); string string_val; BSONField<string> aStringMissing("aStringMissing"); - ASSERT_EQUALS(FieldParser::extract(doc, aString, "", &string_val, NULL), + ASSERT_EQUALS(FieldParser::extract(doc, aString, &string_val, NULL), FieldParser::FIELD_SET); - ASSERT_EQUALS(FieldParser::extract(doc, aStringMissing, "", &string_val, NULL), + ASSERT_EQUALS(FieldParser::extract(doc, aStringMissing, &string_val, NULL), FieldParser::FIELD_NONE); OID OID_val; BSONField<OID> anOIDMissing("anOIDMissing"); - ASSERT_EQUALS(FieldParser::extract(doc, anOID, OID(), &OID_val, NULL), + ASSERT_EQUALS(FieldParser::extract(doc, anOID, &OID_val, NULL), FieldParser::FIELD_SET); - ASSERT_EQUALS(FieldParser::extract(doc, anOIDMissing, OID(), &OID_val, NULL), + ASSERT_EQUALS(FieldParser::extract(doc, anOIDMissing, &OID_val, NULL), FieldParser::FIELD_NONE); long long long_long_val; BSONField<long long> aLongMissing("aLongMissing"); - ASSERT_EQUALS(FieldParser::extract(doc, aLong, 0, &long_long_val, NULL), + ASSERT_EQUALS(FieldParser::extract(doc, aLong, &long_long_val, NULL), FieldParser::FIELD_SET); - ASSERT_EQUALS(FieldParser::extract(doc, aLongMissing, 0, &long_long_val, NULL), + ASSERT_EQUALS(FieldParser::extract(doc, aLongMissing, &long_long_val, NULL), FieldParser::FIELD_NONE); } @@ -213,7 +213,7 @@ namespace { vector<string> parsedVector; - ASSERT(FieldParser::extract(obj, vectorField, parsedVector, &parsedVector)); + ASSERT(FieldParser::extract(obj, vectorField, &parsedVector)); ASSERT_EQUALS("a", parsedVector[0]); ASSERT_EQUALS("b", parsedVector[1]); ASSERT_EQUALS("c", parsedVector[2]); @@ -231,7 +231,7 @@ namespace { vector<BSONObj> parsedVector; - ASSERT(FieldParser::extract(obj, vectorField, parsedVector, &parsedVector)); + ASSERT(FieldParser::extract(obj, vectorField, &parsedVector)); ASSERT_EQUALS(BSON("a" << 1), parsedVector[0]); ASSERT_EQUALS(BSON("b" << 1), parsedVector[1]); ASSERT_EQUALS(BSON("c" << 1), parsedVector[2]); @@ -250,7 +250,7 @@ namespace { vector<BSONObj> parsedVector; string errMsg; - ASSERT(!FieldParser::extract(obj, vectorField, parsedVector, &parsedVector, &errMsg)); + ASSERT(!FieldParser::extract(obj, vectorField, &parsedVector, &errMsg)); ASSERT_NOT_EQUALS(errMsg, ""); } @@ -267,7 +267,7 @@ namespace { } vector<string> parsedVector; - ASSERT(FieldParser::extract(obj, vectorField, parsedVector, &parsedVector)); + ASSERT(FieldParser::extract(obj, vectorField, &parsedVector)); { BSONObjBuilder bob; @@ -276,7 +276,7 @@ namespace { } parsedVector.clear(); - ASSERT(FieldParser::extract(obj, vectorField, parsedVector, &parsedVector)); + ASSERT(FieldParser::extract(obj, vectorField, &parsedVector)); ASSERT_EQUALS("a", parsedVector[0]); ASSERT_EQUALS("b", parsedVector[1]); @@ -295,7 +295,7 @@ namespace { map<string, string> parsedMap; - ASSERT(FieldParser::extract(obj, mapField, parsedMap, &parsedMap)); + ASSERT(FieldParser::extract(obj, mapField, &parsedMap)); ASSERT_EQUALS("a", parsedMap["a"]); ASSERT_EQUALS("b", parsedMap["b"]); ASSERT_EQUALS("c", parsedMap["c"]); @@ -315,7 +315,7 @@ namespace { map<string, BSONObj> parsedMap; - ASSERT(FieldParser::extract(obj, mapField, parsedMap, &parsedMap)); + ASSERT(FieldParser::extract(obj, mapField, &parsedMap)); ASSERT_EQUALS(BSON("a" << "a"), parsedMap["a"]); ASSERT_EQUALS(BSON("b" << "b"), parsedMap["b"]); ASSERT_EQUALS(BSON("c" << "c"), parsedMap["c"]); @@ -334,7 +334,7 @@ namespace { map<string, string> parsedMap; string errMsg; - ASSERT(!FieldParser::extract(obj, mapField, parsedMap, &parsedMap, &errMsg)); + ASSERT(!FieldParser::extract(obj, mapField, &parsedMap, &errMsg)); ASSERT_NOT_EQUALS(errMsg, ""); } @@ -351,7 +351,7 @@ namespace { } map<string, string> parsedMap; - ASSERT(FieldParser::extract(obj, mapField, parsedMap, &parsedMap)); + ASSERT(FieldParser::extract(obj, mapField, &parsedMap)); { BSONObjBuilder bob; @@ -360,7 +360,7 @@ namespace { } parsedMap.clear(); - ASSERT(FieldParser::extract(obj, mapField, parsedMap, &parsedMap)); + ASSERT(FieldParser::extract(obj, mapField, &parsedMap)); ASSERT_EQUALS("a", parsedMap["a"]); ASSERT_EQUALS("b", parsedMap["b"]); @@ -381,7 +381,7 @@ namespace { vector<map<string, string> > parsed; - ASSERT(FieldParser::extract(obj, nestedField, parsed, &parsed)); + ASSERT(FieldParser::extract(obj, nestedField, &parsed)); ASSERT_EQUALS(parsed.size(), static_cast<size_t>(3)); for (int i = 0; i < 3; i++) { map<string, string>& parsedMap = parsed[i]; @@ -406,7 +406,7 @@ namespace { vector<map<string, string> > parsed; string errMsg; - ASSERT(!FieldParser::extract(obj, nestedField, parsed, &parsed, &errMsg)); + ASSERT(!FieldParser::extract(obj, nestedField, &parsed, &errMsg)); ASSERT_NOT_EQUALS(errMsg, ""); } diff --git a/src/mongo/s/type_changelog.cpp b/src/mongo/s/type_changelog.cpp index e71c1d2f525..c05aa537e6b 100644 --- a/src/mongo/s/type_changelog.cpp +++ b/src/mongo/s/type_changelog.cpp @@ -99,31 +99,31 @@ namespace mongo { if (!errMsg) errMsg = &dummy; FieldParser::FieldState fieldState; - fieldState = FieldParser::extract(source, changeID, "", &_changeID, errMsg); + fieldState = FieldParser::extract(source, changeID, &_changeID, errMsg); if (fieldState == FieldParser::FIELD_INVALID) return false; _isChangeIDSet = fieldState == FieldParser::FIELD_SET; - fieldState = FieldParser::extract(source, server, "", &_server, errMsg); + fieldState = FieldParser::extract(source, server, &_server, errMsg); if (fieldState == FieldParser::FIELD_INVALID) return false; _isServerSet = fieldState == FieldParser::FIELD_SET; - fieldState = FieldParser::extract(source, clientAddr, "", &_clientAddr, errMsg); + fieldState = FieldParser::extract(source, clientAddr, &_clientAddr, errMsg); if (fieldState == FieldParser::FIELD_INVALID) return false; _isClientAddrSet = fieldState == FieldParser::FIELD_SET; - fieldState = FieldParser::extract(source, time, 0, &_time, errMsg); + fieldState = FieldParser::extract(source, time, &_time, errMsg); if (fieldState == FieldParser::FIELD_INVALID) return false; _isTimeSet = fieldState == FieldParser::FIELD_SET; - fieldState = FieldParser::extract(source, what, "", &_what, errMsg); + fieldState = FieldParser::extract(source, what, &_what, errMsg); if (fieldState == FieldParser::FIELD_INVALID) return false; _isWhatSet = fieldState == FieldParser::FIELD_SET; - fieldState = FieldParser::extract(source, ns, "", &_ns, errMsg); + fieldState = FieldParser::extract(source, ns, &_ns, errMsg); if (fieldState == FieldParser::FIELD_INVALID) return false; _isNsSet = fieldState == FieldParser::FIELD_SET; - fieldState = FieldParser::extract(source, details, BSONObj(), &_details, errMsg); + fieldState = FieldParser::extract(source, details, &_details, errMsg); if (fieldState == FieldParser::FIELD_INVALID) return false; _isDetailsSet = fieldState == FieldParser::FIELD_SET; diff --git a/src/mongo/s/type_chunk.cpp b/src/mongo/s/type_chunk.cpp index 1773e3bd3c7..0d598cfe683 100644 --- a/src/mongo/s/type_chunk.cpp +++ b/src/mongo/s/type_chunk.cpp @@ -130,27 +130,27 @@ namespace mongo { if (!errMsg) errMsg = &dummy; FieldParser::FieldState fieldState; - fieldState = FieldParser::extract(source, name, "", &_name, errMsg); + fieldState = FieldParser::extract(source, name, &_name, errMsg); if (fieldState == FieldParser::FIELD_INVALID) return false; _isNameSet = fieldState == FieldParser::FIELD_SET; - fieldState = FieldParser::extract(source, ns, "", &_ns, errMsg); + fieldState = FieldParser::extract(source, ns, &_ns, errMsg); if (fieldState == FieldParser::FIELD_INVALID) return false; _isNsSet = fieldState == FieldParser::FIELD_SET; - fieldState = FieldParser::extract(source, min, BSONObj(), &_min, errMsg); + fieldState = FieldParser::extract(source, min, &_min, errMsg); if (fieldState == FieldParser::FIELD_INVALID) return false; _isMinSet = fieldState == FieldParser::FIELD_SET; - fieldState = FieldParser::extract(source, max, BSONObj(), &_max, errMsg); + fieldState = FieldParser::extract(source, max, &_max, errMsg); if (fieldState == FieldParser::FIELD_INVALID) return false; _isMaxSet = fieldState == FieldParser::FIELD_SET; - fieldState = FieldParser::extract(source, shard, "", &_shard, errMsg); + fieldState = FieldParser::extract(source, shard, &_shard, errMsg); if (fieldState == FieldParser::FIELD_INVALID) return false; _isShardSet = fieldState == FieldParser::FIELD_SET; - fieldState = FieldParser::extract(source, jumbo, false, &_jumbo, errMsg); + fieldState = FieldParser::extract(source, jumbo, &_jumbo, errMsg); if (fieldState == FieldParser::FIELD_INVALID) return false; _isJumboSet = fieldState == FieldParser::FIELD_SET; diff --git a/src/mongo/s/type_collection.cpp b/src/mongo/s/type_collection.cpp index 40ba4ac0754..b6d395038a5 100644 --- a/src/mongo/s/type_collection.cpp +++ b/src/mongo/s/type_collection.cpp @@ -107,35 +107,35 @@ namespace mongo { if (!errMsg) errMsg = &dummy; FieldParser::FieldState fieldState; - fieldState = FieldParser::extract(source, ns, "", &_ns, errMsg); + fieldState = FieldParser::extract(source, ns, &_ns, errMsg); if (fieldState == FieldParser::FIELD_INVALID) return false; _isNsSet = fieldState == FieldParser::FIELD_SET; - fieldState = FieldParser::extract(source, primary, "", &_primary, errMsg); + fieldState = FieldParser::extract(source, primary, &_primary, errMsg); if (fieldState == FieldParser::FIELD_INVALID) return false; _isPrimarySet = fieldState == FieldParser::FIELD_SET; - fieldState = FieldParser::extract(source, keyPattern, BSONObj(), &_keyPattern, errMsg); + fieldState = FieldParser::extract(source, keyPattern, &_keyPattern, errMsg); if (fieldState == FieldParser::FIELD_INVALID) return false; _isKeyPatternSet = fieldState == FieldParser::FIELD_SET; - fieldState = FieldParser::extract(source, unique, false, &_unique, errMsg); + fieldState = FieldParser::extract(source, unique, &_unique, errMsg); if (fieldState == FieldParser::FIELD_INVALID) return false; _isUniqueSet = fieldState == FieldParser::FIELD_SET; - fieldState = FieldParser::extract(source, updatedAt, 0, &_updatedAt, errMsg); + fieldState = FieldParser::extract(source, updatedAt, &_updatedAt, errMsg); if (fieldState == FieldParser::FIELD_INVALID) return false; _isUpdatedAtSet = fieldState == FieldParser::FIELD_SET; - fieldState = FieldParser::extract(source, noBalance, false, &_noBalance, errMsg); + fieldState = FieldParser::extract(source, noBalance, &_noBalance, errMsg); if (fieldState == FieldParser::FIELD_INVALID) return false; _isNoBalanceSet = fieldState == FieldParser::FIELD_SET; - fieldState = FieldParser::extract(source, epoch, OID(), &_epoch, errMsg); + fieldState = FieldParser::extract(source, epoch, &_epoch, errMsg); if (fieldState == FieldParser::FIELD_INVALID) return false; _isEpochSet = fieldState == FieldParser::FIELD_SET; - fieldState = FieldParser::extract(source, dropped, false, &_dropped, errMsg); + fieldState = FieldParser::extract(source, dropped, &_dropped, errMsg); if (fieldState == FieldParser::FIELD_INVALID) return false; _isDroppedSet = fieldState == FieldParser::FIELD_SET; @@ -146,7 +146,7 @@ namespace mongo { // 'updatedAt' used to be called 'lastmod' up to 2.2. Date_t lastmod; - fieldState = FieldParser::extract(source, DEPRECATED_lastmod, 0ULL, &lastmod, errMsg); + fieldState = FieldParser::extract(source, DEPRECATED_lastmod, &lastmod, errMsg); if (fieldState == FieldParser::FIELD_INVALID) return false; if (fieldState == FieldParser::FIELD_SET && _isUpdatedAtSet == false) { @@ -156,8 +156,7 @@ namespace mongo { // 'lastmodEpoch' was a transition format to 'epoch', up to 2.2 OID lastmodEpoch; - fieldState = FieldParser::extract(source, DEPRECATED_lastmodEpoch, - OID(), &lastmodEpoch, errMsg); + fieldState = FieldParser::extract(source, DEPRECATED_lastmodEpoch, &lastmodEpoch, errMsg); if (fieldState == FieldParser::FIELD_INVALID) return false; if (fieldState == FieldParser::FIELD_SET && _isEpochSet == false) { diff --git a/src/mongo/s/type_config_version.cpp b/src/mongo/s/type_config_version.cpp index 77e8b2af80b..ae6ea718514 100644 --- a/src/mongo/s/type_config_version.cpp +++ b/src/mongo/s/type_config_version.cpp @@ -94,19 +94,18 @@ namespace mongo { FieldParser::FieldState fieldState; fieldState = FieldParser::extractNumber(source, minCompatibleVersion, - -1, &_minCompatibleVersion, errMsg); + &_minCompatibleVersion, errMsg); if (fieldState == FieldParser::FIELD_INVALID) return false; _isMinCompatibleVersionSet = fieldState == FieldParser::FIELD_SET; if (!_isMinCompatibleVersionSet) { fieldState = FieldParser::extractNumber(source, version_DEPRECATED, - -1, &_minCompatibleVersion, errMsg); + &_minCompatibleVersion, errMsg); if (fieldState == FieldParser::FIELD_INVALID) return false; _isMinCompatibleVersionSet = fieldState == FieldParser::FIELD_SET; } - fieldState = FieldParser::extractNumber(source, currentVersion, - -1, &_currentVersion, errMsg); + fieldState = FieldParser::extractNumber(source, currentVersion, &_currentVersion, errMsg); if (fieldState == FieldParser::FIELD_INVALID) return false; _isCurrentVersionSet = fieldState == FieldParser::FIELD_SET; @@ -116,19 +115,19 @@ namespace mongo { } fieldState = FieldParser::extract(source, excludingMongoVersions, - BSONArray(), &_excludingMongoVersions, errMsg); + &_excludingMongoVersions, errMsg); if (fieldState == FieldParser::FIELD_INVALID) return false; _isExcludingMongoVersionsSet = fieldState == FieldParser::FIELD_SET; - fieldState = FieldParser::extract(source, clusterId, OID(), &_clusterId, errMsg); + fieldState = FieldParser::extract(source, clusterId, &_clusterId, errMsg); if (fieldState == FieldParser::FIELD_INVALID) return false; _isClusterIdSet = fieldState == FieldParser::FIELD_SET; - fieldState = FieldParser::extract(source, upgradeId, OID(), &_upgradeId, errMsg); + fieldState = FieldParser::extract(source, upgradeId, &_upgradeId, errMsg); if (fieldState == FieldParser::FIELD_INVALID) return false; _isUpgradeIdSet = fieldState == FieldParser::FIELD_SET; - fieldState = FieldParser::extract(source, upgradeState, BSONObj(), &_upgradeState, errMsg); + fieldState = FieldParser::extract(source, upgradeState, &_upgradeState, errMsg); if (fieldState == FieldParser::FIELD_INVALID) return false; _isUpgradeStateSet = fieldState == FieldParser::FIELD_SET; diff --git a/src/mongo/s/type_database.cpp b/src/mongo/s/type_database.cpp index 7f6ab368a68..2ce9539632e 100644 --- a/src/mongo/s/type_database.cpp +++ b/src/mongo/s/type_database.cpp @@ -74,15 +74,15 @@ namespace mongo { if (!errMsg) errMsg = &dummy; FieldParser::FieldState fieldState; - fieldState = FieldParser::extract(source, name, "", &_name, errMsg); + fieldState = FieldParser::extract(source, name, &_name, errMsg); if (fieldState == FieldParser::FIELD_INVALID) return false; _isNameSet = fieldState == FieldParser::FIELD_SET; - fieldState = FieldParser::extract(source, primary, "", &_primary, errMsg); + fieldState = FieldParser::extract(source, primary, &_primary, errMsg); if (fieldState == FieldParser::FIELD_INVALID) return false; _isPrimarySet = fieldState == FieldParser::FIELD_SET; - fieldState = FieldParser::extract(source, draining, false, &_draining, errMsg); + fieldState = FieldParser::extract(source, draining, &_draining, errMsg); if (fieldState == FieldParser::FIELD_INVALID) return false; _isDrainingSet = fieldState == FieldParser::FIELD_SET; diff --git a/src/mongo/s/type_database_test.cpp b/src/mongo/s/type_database_test.cpp index df546139d54..8a4e44a6ba3 100644 --- a/src/mongo/s/type_database_test.cpp +++ b/src/mongo/s/type_database_test.cpp @@ -96,7 +96,7 @@ namespace { ASSERT_EQUALS(dbNotDraining.getDraining(), DatabaseType::draining.getDefault()); bool isDraining; BSONObj genObj; - ASSERT_EQUALS( FieldParser::extract( genObj, DatabaseType::draining, true, &isDraining ), + ASSERT_EQUALS( FieldParser::extract( genObj, DatabaseType::draining, &isDraining ), FieldParser::FIELD_DEFAULT ); } diff --git a/src/mongo/s/type_lockpings.cpp b/src/mongo/s/type_lockpings.cpp index 3e611f7c8be..3df9da0b1e9 100644 --- a/src/mongo/s/type_lockpings.cpp +++ b/src/mongo/s/type_lockpings.cpp @@ -69,11 +69,11 @@ namespace mongo { if (!errMsg) errMsg = &dummy; FieldParser::FieldState fieldState; - fieldState = FieldParser::extract(source, process, "", &_process, errMsg); + fieldState = FieldParser::extract(source, process, &_process, errMsg); if (fieldState == FieldParser::FIELD_INVALID) return false; _isProcessSet = fieldState == FieldParser::FIELD_SET; - fieldState = FieldParser::extract(source, ping, 0, &_ping, errMsg); + fieldState = FieldParser::extract(source, ping, &_ping, errMsg); if (fieldState == FieldParser::FIELD_INVALID) return false; _isPingSet = fieldState == FieldParser::FIELD_SET; diff --git a/src/mongo/s/type_locks.cpp b/src/mongo/s/type_locks.cpp index d316c5d8c16..bf608bfc14a 100644 --- a/src/mongo/s/type_locks.cpp +++ b/src/mongo/s/type_locks.cpp @@ -100,27 +100,27 @@ namespace mongo { if (!errMsg) errMsg = &dummy; FieldParser::FieldState fieldState; - fieldState = FieldParser::extract(source, name, "", &_name, errMsg); + fieldState = FieldParser::extract(source, name, &_name, errMsg); if (fieldState == FieldParser::FIELD_INVALID) return false; _isNameSet = fieldState == FieldParser::FIELD_SET; - fieldState = FieldParser::extract(source, state, 0, &_state, errMsg); + fieldState = FieldParser::extract(source, state, &_state, errMsg); if (fieldState == FieldParser::FIELD_INVALID) return false; _isStateSet = fieldState == FieldParser::FIELD_SET; - fieldState = FieldParser::extract(source, process, "", &_process, errMsg); + fieldState = FieldParser::extract(source, process, &_process, errMsg); if (fieldState == FieldParser::FIELD_INVALID) return false; _isProcessSet = fieldState == FieldParser::FIELD_SET; - fieldState = FieldParser::extract(source, lockID, OID(), &_lockID, errMsg); + fieldState = FieldParser::extract(source, lockID, &_lockID, errMsg); if (fieldState == FieldParser::FIELD_INVALID) return false; _isLockIDSet = fieldState == FieldParser::FIELD_SET; - fieldState = FieldParser::extract(source, who, "", &_who, errMsg); + fieldState = FieldParser::extract(source, who, &_who, errMsg); if (fieldState == FieldParser::FIELD_INVALID) return false; _isWhoSet = fieldState == FieldParser::FIELD_SET; - fieldState = FieldParser::extract(source, why, "", &_why, errMsg); + fieldState = FieldParser::extract(source, why, &_why, errMsg); if (fieldState == FieldParser::FIELD_INVALID) return false; _isWhySet = fieldState == FieldParser::FIELD_SET; diff --git a/src/mongo/s/type_mongos.cpp b/src/mongo/s/type_mongos.cpp index 73c2950461a..8f5febb240b 100644 --- a/src/mongo/s/type_mongos.cpp +++ b/src/mongo/s/type_mongos.cpp @@ -93,27 +93,27 @@ namespace mongo { if (!errMsg) errMsg = &dummy; FieldParser::FieldState fieldState; - fieldState = FieldParser::extract(source, name, "", &_name, errMsg); + fieldState = FieldParser::extract(source, name, &_name, errMsg); if (fieldState == FieldParser::FIELD_INVALID) return false; _isNameSet = fieldState == FieldParser::FIELD_SET; - fieldState = FieldParser::extract(source, ping, 0, &_ping, errMsg); + fieldState = FieldParser::extract(source, ping, &_ping, errMsg); if (fieldState == FieldParser::FIELD_INVALID) return false; _isPingSet = fieldState == FieldParser::FIELD_SET; - fieldState = FieldParser::extract(source, up, 0, &_up, errMsg); + fieldState = FieldParser::extract(source, up, &_up, errMsg); if (fieldState == FieldParser::FIELD_INVALID) return false; _isUpSet = fieldState == FieldParser::FIELD_SET; - fieldState = FieldParser::extract(source, waiting, false, &_waiting, errMsg); + fieldState = FieldParser::extract(source, waiting, &_waiting, errMsg); if (fieldState == FieldParser::FIELD_INVALID) return false; _isWaitingSet = fieldState == FieldParser::FIELD_SET; - fieldState = FieldParser::extract(source, mongoVersion, "", &_mongoVersion, errMsg); + fieldState = FieldParser::extract(source, mongoVersion, &_mongoVersion, errMsg); if (fieldState == FieldParser::FIELD_INVALID) return false; _isMongoVersionSet = fieldState == FieldParser::FIELD_SET; - fieldState = FieldParser::extract(source, configVersion, 0, &_configVersion, errMsg); + fieldState = FieldParser::extract(source, configVersion, &_configVersion, errMsg); if (fieldState == FieldParser::FIELD_INVALID) return false; _isConfigVersionSet = fieldState == FieldParser::FIELD_SET; diff --git a/src/mongo/s/type_settings.cpp b/src/mongo/s/type_settings.cpp index 0940ead376f..c80b7bced4e 100644 --- a/src/mongo/s/type_settings.cpp +++ b/src/mongo/s/type_settings.cpp @@ -114,31 +114,28 @@ namespace mongo { if (!errMsg) errMsg = &dummy; FieldParser::FieldState fieldState; - fieldState = FieldParser::extract(source, key, "", &_key, errMsg); + fieldState = FieldParser::extract(source, key, &_key, errMsg); if (fieldState == FieldParser::FIELD_INVALID) return false; _isKeySet = fieldState == FieldParser::FIELD_SET; - fieldState = FieldParser::extract(source, chunksize, 0, &_chunksize, errMsg); + fieldState = FieldParser::extract(source, chunksize, &_chunksize, errMsg); if (fieldState == FieldParser::FIELD_INVALID) return false; _isChunksizeSet = fieldState == FieldParser::FIELD_SET; - fieldState = FieldParser::extract(source, balancerStopped, - false, &_balancerStopped, errMsg); + fieldState = FieldParser::extract(source, balancerStopped, &_balancerStopped, errMsg); if (fieldState == FieldParser::FIELD_INVALID) return false; _isBalancerStoppedSet = fieldState == FieldParser::FIELD_SET; fieldState = FieldParser::extract(source, balancerActiveWindow, - BSONObj(), &_balancerActiveWindow, errMsg); + &_balancerActiveWindow, errMsg); if (fieldState == FieldParser::FIELD_INVALID) return false; _isBalancerActiveWindowSet = fieldState == FieldParser::FIELD_SET; - fieldState = FieldParser::extract(source, shortBalancerSleep, - false, &_shortBalancerSleep, errMsg); + fieldState = FieldParser::extract(source, shortBalancerSleep, &_shortBalancerSleep, errMsg); if (fieldState == FieldParser::FIELD_INVALID) return false; _isShortBalancerSleepSet = fieldState == FieldParser::FIELD_SET; - fieldState = FieldParser::extract(source, secondaryThrottle, - false, &_secondaryThrottle, errMsg); + fieldState = FieldParser::extract(source, secondaryThrottle, &_secondaryThrottle, errMsg); if (fieldState == FieldParser::FIELD_INVALID) return false; _isSecondaryThrottleSet = fieldState == FieldParser::FIELD_SET; diff --git a/src/mongo/s/type_shard.cpp b/src/mongo/s/type_shard.cpp index 692f35810a0..9b6fd2fdb78 100644 --- a/src/mongo/s/type_shard.cpp +++ b/src/mongo/s/type_shard.cpp @@ -75,23 +75,23 @@ namespace mongo { if (!errMsg) errMsg = &dummy; FieldParser::FieldState fieldState; - fieldState = FieldParser::extract(source, name, "", &_name, errMsg); + fieldState = FieldParser::extract(source, name, &_name, errMsg); if (fieldState == FieldParser::FIELD_INVALID) return false; _isNameSet = fieldState == FieldParser::FIELD_SET; - fieldState = FieldParser::extract(source, host, "", &_host, errMsg); + fieldState = FieldParser::extract(source, host, &_host, errMsg); if (fieldState == FieldParser::FIELD_INVALID) return false; _isHostSet = fieldState == FieldParser::FIELD_SET; - fieldState = FieldParser::extract(source, draining, false, &_draining, errMsg); + fieldState = FieldParser::extract(source, draining, &_draining, errMsg); if (fieldState == FieldParser::FIELD_INVALID) return false; _isDrainingSet = fieldState == FieldParser::FIELD_SET; - fieldState = FieldParser::extract(source, maxSize, 0, &_maxSize, errMsg); + fieldState = FieldParser::extract(source, maxSize, &_maxSize, errMsg); if (fieldState == FieldParser::FIELD_INVALID) return false; _isMaxSizeSet = fieldState == FieldParser::FIELD_SET; - fieldState = FieldParser::extract(source, tags, BSONArray(), &_tags, errMsg); + fieldState = FieldParser::extract(source, tags, &_tags, errMsg); if (fieldState == FieldParser::FIELD_INVALID) return false; _isTagsSet = fieldState == FieldParser::FIELD_SET; diff --git a/src/mongo/s/type_tags.cpp b/src/mongo/s/type_tags.cpp index 4381b8b5224..b2d36c26fad 100644 --- a/src/mongo/s/type_tags.cpp +++ b/src/mongo/s/type_tags.cpp @@ -106,19 +106,19 @@ namespace mongo { if (!errMsg) errMsg = &dummy; FieldParser::FieldState fieldState; - fieldState = FieldParser::extract(source, ns, "", &_ns, errMsg); + fieldState = FieldParser::extract(source, ns, &_ns, errMsg); if (fieldState == FieldParser::FIELD_INVALID) return false; _isNsSet = fieldState == FieldParser::FIELD_SET; - fieldState = FieldParser::extract(source, tag, "", &_tag, errMsg); + fieldState = FieldParser::extract(source, tag, &_tag, errMsg); if (fieldState == FieldParser::FIELD_INVALID) return false; _isTagSet = fieldState == FieldParser::FIELD_SET; - fieldState = FieldParser::extract(source, min, BSONObj(), &_min, errMsg); + fieldState = FieldParser::extract(source, min, &_min, errMsg); if (fieldState == FieldParser::FIELD_INVALID) return false; _isMinSet = fieldState == FieldParser::FIELD_SET; - fieldState = FieldParser::extract(source, max, BSONObj(), &_max, errMsg); + fieldState = FieldParser::extract(source, max, &_max, errMsg); if (fieldState == FieldParser::FIELD_INVALID) return false; _isMaxSet = fieldState == FieldParser::FIELD_SET; |