mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-06 13:37:25 +00:00
Switched VS build to -W4, and fixed all resulting warnings.
Change-Id: I654217cbd01a3a449503d95753e19b672ec7ec23 Tested: on Windows, Linux
This commit is contained in:
@@ -632,7 +632,7 @@ class Verifier {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// Verify this whole buffer, starting with root type T.
|
||||
template<typename T> bool VerifyBuffer() const {
|
||||
// Call T::Verify, which must be in the generated code for this type.
|
||||
|
||||
@@ -117,11 +117,11 @@ struct Type {
|
||||
|
||||
// Represents a parsed scalar value, it's type, and field offset.
|
||||
struct Value {
|
||||
Value() : constant("0"), offset(-1) {}
|
||||
|
||||
Value() : constant("0"), offset(static_cast<voffset_t>(
|
||||
~(static_cast<voffset_t>(0U)))) {}
|
||||
Type type;
|
||||
std::string constant;
|
||||
int offset;
|
||||
voffset_t offset;
|
||||
};
|
||||
|
||||
// Helper class that retains the original order of a set of identifiers and
|
||||
|
||||
@@ -32,10 +32,16 @@ template<typename T> std::string NumToString(T t) {
|
||||
// to_string() prints different numbers of digits for floats depending on
|
||||
// platform and isn't available on Android, so we use stringstream
|
||||
std::stringstream ss;
|
||||
if (sizeof(T) > 1) ss << t;
|
||||
else ss << static_cast<int>(t); // Avoid char types used as character data.
|
||||
ss << t;
|
||||
return ss.str();
|
||||
}
|
||||
// Avoid char types used as character data.
|
||||
template<> inline std::string NumToString<signed char>(signed char t) {
|
||||
return NumToString(static_cast<int>(t));
|
||||
}
|
||||
template<> inline std::string NumToString<unsigned char>(unsigned char t) {
|
||||
return NumToString(static_cast<int>(t));
|
||||
}
|
||||
|
||||
// Convert an integer value to a hexadecimal string.
|
||||
// The returned string length is the number of nibbles in
|
||||
|
||||
Reference in New Issue
Block a user