summaryrefslogtreecommitdiff
path: root/src/mongo/bson
diff options
context:
space:
mode:
authorMark Benvenuto <mark.benvenuto@mongodb.com>2015-06-19 10:57:36 -0400
committerMark Benvenuto <mark.benvenuto@mongodb.com>2015-06-20 10:56:04 -0400
commit6f6fa5a63d482b0dc117eb2ac21cf096deb5a6f3 (patch)
treeb76c2a4dfc7f45eb25dd62cb3ffe89ea448d9e0e /src/mongo/bson
parent9c2ed42daa8fbbef4a919c21ec564e2db55e8d60 (diff)
downloadmongo-6f6fa5a63d482b0dc117eb2ac21cf096deb5a6f3.tar.gz
SERVER-18978: Clang-Format - Fix comment word wrapping indentation
Diffstat (limited to 'src/mongo/bson')
-rw-r--r--src/mongo/bson/bsonelement.cpp3
-rw-r--r--src/mongo/bson/bsonelement.h3
-rw-r--r--src/mongo/bson/bsonmisc.h6
-rw-r--r--src/mongo/bson/bsonobj.cpp12
-rw-r--r--src/mongo/bson/bsonobj.h33
-rw-r--r--src/mongo/bson/bsonobjbuilder.h14
-rw-r--r--src/mongo/bson/util/builder.h13
7 files changed, 47 insertions, 37 deletions
diff --git a/src/mongo/bson/bsonelement.cpp b/src/mongo/bson/bsonelement.cpp
index 799da76b11d..72d104b15d6 100644
--- a/src/mongo/bson/bsonelement.cpp
+++ b/src/mongo/bson/bsonelement.cpp
@@ -843,7 +843,8 @@ int compareElementValues(const BSONElement& l, const BSONElement& r) {
case Bool:
return *l.value() - *r.value();
case bsonTimestamp:
- // unsigned compare for timestamps - note they are not really dates but (ordinal + time_t)
+ // unsigned compare for timestamps - note they are not really dates but (ordinal +
+ // time_t)
if (l.date() < r.date())
return -1;
return l.date() == r.date() ? 0 : 1;
diff --git a/src/mongo/bson/bsonelement.h b/src/mongo/bson/bsonelement.h
index 9ee5513ddf9..92ddf87600a 100644
--- a/src/mongo/bson/bsonelement.h
+++ b/src/mongo/bson/bsonelement.h
@@ -685,7 +685,8 @@ inline double BSONElement::numberDouble() const {
}
}
-/** Retrieve int value for the element safely. Zero returned if not a number. Converted to int if another numeric type. */
+/** Retrieve int value for the element safely. Zero returned if not a number. Converted to int if
+ * another numeric type. */
inline int BSONElement::numberInt() const {
switch (type()) {
case NumberDouble:
diff --git a/src/mongo/bson/bsonmisc.h b/src/mongo/bson/bsonmisc.h
index baa7abad5e7..d1c1894190a 100644
--- a/src/mongo/bson/bsonmisc.h
+++ b/src/mongo/bson/bsonmisc.h
@@ -83,7 +83,8 @@ enum FieldCompareResult {
/** Use BSON_ARRAY macro like BSON macro, but without keys
- BSONArray arr = BSON_ARRAY( "hello" << 1 << BSON( "foo" << BSON_ARRAY( "bar" << "baz" << "qux" ) ) );
+ BSONArray arr = BSON_ARRAY( "hello" << 1 <<
+ BSON( "foo" << BSON_ARRAY( "bar" << "baz" << "qux" ) ) );
*/
#define BSON_ARRAY(x) ((::mongo::BSONArrayBuilder() << x).arr())
@@ -264,7 +265,8 @@ private:
};
/**
- used in conjuction with BSONObjBuilder, allows for proper buffer size to prevent crazy memory usage
+ used in conjuction with BSONObjBuilder, allows for proper buffer size to prevent crazy memory
+ usage
*/
class BSONSizeTracker {
public:
diff --git a/src/mongo/bson/bsonobj.cpp b/src/mongo/bson/bsonobj.cpp
index 0c9f8f01636..2cd2ef64bde 100644
--- a/src/mongo/bson/bsonobj.cpp
+++ b/src/mongo/bson/bsonobj.cpp
@@ -177,12 +177,12 @@ int BSONObj::woCompare(const BSONObj& r, const BSONObj& idxKey, bool considerFie
int x;
/*
- if( ordered && o.type() == String && strcmp(o.valuestr(), "ascii-proto") == 0 &&
- l.type() == String && r.type() == String ) {
- // note: no negative support yet, as this is just sort of a POC
- x = _stricmp(l.valuestr(), r.valuestr());
- }
- else*/ {
+ if( ordered && o.type() == String && strcmp(o.valuestr(), "ascii-proto") == 0 &&
+ l.type() == String && r.type() == String ) {
+ // note: no negative support yet, as this is just sort of a POC
+ x = _stricmp(l.valuestr(), r.valuestr());
+ }
+ else*/ {
x = l.woCompare(r, considerFieldName);
if (ordered && o.number() < 0)
x = -x;
diff --git a/src/mongo/bson/bsonobj.h b/src/mongo/bson/bsonobj.h
index 269278bef92..466ee1521f1 100644
--- a/src/mongo/bson/bsonobj.h
+++ b/src/mongo/bson/bsonobj.h
@@ -147,22 +147,22 @@ public:
A BSONObj can use a buffer it "owns" or one it does not.
OWNED CASE
- If the BSONObj owns the buffer, the buffer can be shared among several BSONObj's (by assignment).
- In this case the buffer is basically implemented as a shared_ptr.
+ If the BSONObj owns the buffer, the buffer can be shared among several BSONObj's (by
+ assignment). In this case the buffer is basically implemented as a shared_ptr.
Since BSONObj's are typically immutable, this works well.
UNOWNED CASE
- A BSONObj can also point to BSON data in some other data structure it does not "own" or free later.
- For example, in a memory mapped file. In this case, it is important the original data stays in
- scope for as long as the BSONObj is in use. If you think the original data may go out of scope,
- call BSONObj::getOwned() to promote your BSONObj to having its own copy.
+ A BSONObj can also point to BSON data in some other data structure it does not "own" or free
+ later. For example, in a memory mapped file. In this case, it is important the original data
+ stays in scope for as long as the BSONObj is in use. If you think the original data may go
+ out of scope, call BSONObj::getOwned() to promote your BSONObj to having its own copy.
On a BSONObj assignment, if the source is unowned, both the source and dest will have unowned
pointers to the original buffer after the assignment.
If you are not sure about ownership but need the buffer to last as long as the BSONObj, call
- getOwned(). getOwned() is a no-op if the buffer is already owned. If not already owned, a malloc
- and memcpy will result.
+ getOwned(). getOwned() is a no-op if the buffer is already owned. If not already owned, a
+ malloc and memcpy will result.
Most ways to create BSONObj's create 'owned' variants. Unowned versions can be created with:
(1) specifying true for the ifree parameter in the constructor
@@ -240,8 +240,8 @@ public:
/** Get several fields at once. This is faster than separate getField() calls as the size of
elements iterated can then be calculated only once each.
@param n number of fieldNames, and number of elements in the fields array
- @param fields if a field is found its element is stored in its corresponding position in this array.
- if not found the array element is unchanged.
+ @param fields if a field is found its element is stored in its corresponding position in
+ this array. if not found the array element is unchanged.
*/
void getFields(unsigned n, const char** fieldNames, BSONElement* fields) const;
@@ -459,9 +459,9 @@ public:
return BSONElement(objdata() + 4);
}
- /** faster than firstElement().fieldName() - for the first element we can easily find the fieldname without
- computing the element size.
- */
+ /** faster than firstElement().fieldName() - for the first element we can easily find the
+ * fieldname without computing the element size.
+ */
const char* firstElementFieldName() const {
const char* p = objdata() + 4;
return *p == EOO ? "" : p + 1;
@@ -655,12 +655,15 @@ public:
return _pos < _theend;
}
- /** @return true if more elements exist to be enumerated INCLUDING the EOO element which is always at the end. */
+ /** @return true if more elements exist to be enumerated INCLUDING the EOO element which is
+ * always at the end. */
bool moreWithEOO() {
return _pos <= _theend;
}
- /** @return the next element in the object. For the final element, element.eoo() will be true. */
+ /**
+ * @return the next element in the object. For the final element, element.eoo() will be true.
+ */
BSONElement next(bool checkEnd) {
verify(_pos <= _theend);
diff --git a/src/mongo/bson/bsonobjbuilder.h b/src/mongo/bson/bsonobjbuilder.h
index 76ed3f60ec8..87c9f3f876a 100644
--- a/src/mongo/bson/bsonobjbuilder.h
+++ b/src/mongo/bson/bsonobjbuilder.h
@@ -78,7 +78,8 @@ public:
}
/** @param baseBuilder construct a BSONObjBuilder using an existing BufBuilder
- * This is for more efficient adding of subobjects/arrays. See docs for subobjStart for example.
+ * This is for more efficient adding of subobjects/arrays. See docs for subobjStart for
+ * example.
*/
BSONObjBuilder(BufBuilder& baseBuilder)
: _b(baseBuilder),
@@ -129,16 +130,16 @@ public:
/** append element to the object we are building */
BSONObjBuilder& append(const BSONElement& e) {
- verify(
- !e.eoo()); // do not append eoo, that would corrupt us. the builder auto appends when done() is called.
+ // do not append eoo, that would corrupt us. the builder auto appends when done() is called.
+ verify(!e.eoo());
_b.appendBuf((void*)e.rawdata(), e.size());
return *this;
}
/** append an element but with a new name */
BSONObjBuilder& appendAs(const BSONElement& e, StringData fieldName) {
- verify(
- !e.eoo()); // do not append eoo, that would corrupt us. the builder auto appends when done() is called.
+ // do not append eoo, that would corrupt us. the builder auto appends when done() is called.
+ verify(!e.eoo());
_b.appendNum((char)e.type());
_b.appendStr(fieldName);
_b.appendBuf((void*)e.value(), e.valuesize());
@@ -677,7 +678,8 @@ public:
return false;
}
- /** @return true if we are using our own bufbuilder, and not an alternate that was given to us in our constructor */
+ /** @return true if we are using our own bufbuilder, and not an alternate that was given to us
+ * in our constructor */
bool owned() const {
return &_b == &_buf;
}
diff --git a/src/mongo/bson/util/builder.h b/src/mongo/bson/util/builder.h
index bf0668a6da5..5878a2ed386 100644
--- a/src/mongo/bson/util/builder.h
+++ b/src/mongo/bson/util/builder.h
@@ -46,9 +46,9 @@
namespace mongo {
/* Accessing unaligned doubles on ARM generates an alignment trap and aborts with SIGBUS on Linux.
- Wrapping the double in a packed struct forces gcc to generate code that works with unaligned values too.
- The generated code for other architectures (which already allow unaligned accesses) is the same as if
- there was a direct pointer access.
+ Wrapping the double in a packed struct forces gcc to generate code that works with unaligned
+ values too. The generated code for other architectures (which already allow unaligned accesses)
+ is the same as if there was a direct pointer access.
*/
struct PackedDouble {
double d;
@@ -58,8 +58,8 @@ struct PackedDouble {
/* Note the limit here is rather arbitrary and is simply a standard. generally the code works
with any object that fits in ram.
- Also note that the server has some basic checks to enforce this limit but those checks are not exhaustive
- for example need to check for size too big after
+ Also note that the server has some basic checks to enforce this limit but those checks are not
+ exhaustive for example need to check for size too big after
update $push (append) operation
various db.eval() type operations
*/
@@ -165,7 +165,8 @@ public:
}
/** leave room for some stuff later
- @return point to region that was skipped. pointer may change later (on realloc), so for immediate use only
+ @return point to region that was skipped. pointer may change later (on realloc), so for
+ immediate use only
*/
char* skip(int n) {
return grow(n);