diff --git a/src/Serialize/BsonParser.h b/src/Serialize/BsonParser.h index 865775a0..e9a55d27 100644 --- a/src/Serialize/BsonParser.h +++ b/src/Serialize/BsonParser.h @@ -60,7 +60,7 @@ class BsonParser: public ParserInterface virtual void ignoreDataValue() override; - virtual void getValue(short int& value) override {value = getIntValue::value, short int>();} + virtual void getValue(short int& value) override {value = static_cast(getIntValue::value, short int>());} virtual void getValue(int& value) override {value = getIntValue();} virtual void getValue(long int& value) override {value = getIntValue();} virtual void getValue(long long int& value) override {value = getIntValue();} @@ -194,17 +194,17 @@ inline IEEE_754::_2008::Binary BsonParser::readFloat() template inline Int BsonParser::getIntValue() { - if (nextType == '\x10') {ThorsMessage(5, "BsonParser", "getIntValue", "Int-32"); return readInt<4, std::int32_t>();} - if (nextType == '\x12') {ThorsMessage(5, "BsonParser", "getIntValue", "Int-64"); return readInt<8, std::int64_t>();} + if (nextType == '\x10') {ThorsMessage(5, "BsonParser", "getIntValue", "Int-32"); return static_cast(readInt<4, std::int32_t>());} + if (nextType == '\x12') {ThorsMessage(5, "BsonParser", "getIntValue", "Int-64"); return static_cast(readInt<8, std::int64_t>());} badType("Int(32 or 64)", nextType); } template inline Float BsonParser::getFloatValue() { - if (nextType == '\x10') {ThorsMessage(5, "BsonParser", "getFloatValue", "Double-32");return readInt<4, std::int32_t>();} - if (nextType == '\x12') {ThorsMessage(5, "BsonParser", "getFloatValue", "Double-64");return readInt<8, std::int64_t>();} - if (nextType == '\x01') {ThorsMessage(5, "BsonParser", "getFloatValue", "Double-128");return readFloat<8>();} + if (nextType == '\x10') {ThorsMessage(5, "BsonParser", "getFloatValue", "Double-32");return static_cast(readInt<4, std::int32_t>());} + if (nextType == '\x12') {ThorsMessage(5, "BsonParser", "getFloatValue", "Double-64");return static_cast(readInt<8, std::int64_t>());} + if (nextType == '\x01') {ThorsMessage(5, "BsonParser", "getFloatValue", "Double-128");return static_cast(readFloat<8>());} #if 0 if (nextType == '\x13') {return readFloat<16>();} #endif diff --git a/src/Serialize/BsonPrinter.cpp b/src/Serialize/BsonPrinter.cpp index 5da77e26..48ca5b06 100644 --- a/src/Serialize/BsonPrinter.cpp +++ b/src/Serialize/BsonPrinter.cpp @@ -93,7 +93,7 @@ void BsonPrinter::writeKey(char value, std::size_t size) // So when we write a single value we wrap it just like an array. // // <4 byte Doc Size> <1 byte Type info> <2 byte Index "0"> <1 byte doc term> - std::int32_t totalSize = 4 + 1 + 2 + size + 1; + std::int32_t totalSize = static_cast(4 + 1 + 2 + size + 1); writeSize<4, std::int32_t>(totalSize); output.write(&value, 1); output.write("0", 2); @@ -121,7 +121,7 @@ THORS_SERIALIZER_HEADER_ONLY_INCLUDE void BsonPrinter::openMap(std::size_t size) { writeKey('\x03', -1); - writeSize<4, std::int32_t>(size); + writeSize<4, std::int32_t>(static_cast(size)); currentContainer.emplace_back(BsonContainer::Map); } @@ -142,7 +142,7 @@ THORS_SERIALIZER_HEADER_ONLY_INCLUDE void BsonPrinter::openArray(std::size_t size) { writeKey('\x04', -1); - writeSize<4, std::int32_t>(size); + writeSize<4, std::int32_t>(static_cast(size)); currentContainer.emplace_back(BsonContainer::Array); arrayIndex.emplace_back(0); } @@ -173,7 +173,7 @@ THORS_SERIALIZER_HEADER_ONLY_INCLUDE void BsonPrinter::writeString(std::string const& value) { writeKey('\x02', 4 + value.size() + 1); - writeSize<4, std::int32_t>(value.size() + 1); + writeSize<4, std::int32_t>(static_cast(value.size() + 1)); output << EscapeString(value); output.write("", 1); } @@ -188,7 +188,7 @@ THORS_SERIALIZER_HEADER_ONLY_INCLUDE void BsonPrinter::writeBinary(std::string const& value) { writeKey('\x05', 4 + 1 + value.size()); // binary - writeSize<4, std::int32_t>(value.size()); + writeSize<4, std::int32_t>(static_cast(value.size())); output.write("\x80", 1); output.write(value.c_str(), value.size()); } diff --git a/src/Serialize/YamlPrinter.cpp b/src/Serialize/YamlPrinter.cpp index 1fd2ff8b..d0318604 100644 --- a/src/Serialize/YamlPrinter.cpp +++ b/src/Serialize/YamlPrinter.cpp @@ -159,7 +159,7 @@ void YamlPrinter::emit(T const& data) NULL, NULL, reinterpret_cast(const_cast(buffer.str().c_str())), - buffer.str().size(), + static_cast(buffer.str().size()), 1, 0, YAML_ANY_SCALAR_STYLE);