From 7818a6c0461b76269429c049764f732bac924eec Mon Sep 17 00:00:00 2001 From: fbraem Date: Thu, 14 Feb 2013 22:50:43 +0100 Subject: [PATCH] Put quotes around string in toString, boolean is an unsigned value --- MongoDB/include/Poco/MongoDB/Element.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/MongoDB/include/Poco/MongoDB/Element.h b/MongoDB/include/Poco/MongoDB/Element.h index 25cdafe6b..b0578c063 100644 --- a/MongoDB/include/Poco/MongoDB/Element.h +++ b/MongoDB/include/Poco/MongoDB/Element.h @@ -137,7 +137,7 @@ struct ElementTraits static std::string toString(const std::string& value) { - return value; + return '"' + value + '"'; } }; @@ -175,7 +175,7 @@ struct ElementTraits template<> inline void BSONReader::read(bool& to) { - Int32 b; + unsigned char b; _reader >> b; to = b != 0; } @@ -183,7 +183,8 @@ inline void BSONReader::read(bool& to) template<> inline void BSONWriter::write(bool& from) { - _writer << (from ? 0x01 : 0x00); + unsigned char b = from ? 0x01 : 0x00; + _writer << b; } // BSON 32-bit integer