Switched VS build to -W4, and fixed all resulting warnings.

Change-Id: I654217cbd01a3a449503d95753e19b672ec7ec23
Tested: on Windows, Linux
This commit is contained in:
Wouter van Oortmerssen
2014-06-30 15:56:31 -07:00
parent a0b6ffc25b
commit 1256307a38
15 changed files with 83 additions and 33 deletions

View File

@@ -1,4 +1,7 @@
// automatically generated, do not modify
// automatically generated by the FlatBuffers compiler, do not modify
#ifndef FLATBUFFERS_GENERATED_MONSTER_MYGAME_SAMPLE_H_
#define FLATBUFFERS_GENERATED_MONSTER_MYGAME_SAMPLE_H_
#include "flatbuffers/flatbuffers.h"
@@ -30,6 +33,8 @@ inline const char **EnumNamesAny() {
inline const char *EnumNameAny(int e) { return EnumNamesAny()[e]; }
bool VerifyAny(const flatbuffers::Verifier &verifier, const void *union_obj, uint8_t type);
struct Vec3;
struct Monster;
@@ -56,6 +61,17 @@ struct Monster : private flatbuffers::Table {
const flatbuffers::String *name() const { return GetPointer<const flatbuffers::String *>(10); }
const flatbuffers::Vector<uint8_t> *inventory() const { return GetPointer<const flatbuffers::Vector<uint8_t> *>(14); }
int8_t color() const { return GetField<int8_t>(16, 2); }
bool Verify(const flatbuffers::Verifier &verifier) const {
return VerifyTable(verifier) &&
VerifyField<Vec3>(verifier, 4) &&
VerifyField<int16_t>(verifier, 6) &&
VerifyField<int16_t>(verifier, 8) &&
VerifyField<flatbuffers::uoffset_t>(verifier, 10) &&
verifier.Verify(name()) &&
VerifyField<flatbuffers::uoffset_t>(verifier, 14) &&
verifier.Verify(inventory()) &&
VerifyField<int8_t>(verifier, 16);
}
};
struct MonsterBuilder {
@@ -68,6 +84,7 @@ struct MonsterBuilder {
void add_inventory(flatbuffers::Offset<flatbuffers::Vector<uint8_t>> inventory) { fbb_.AddOffset(14, inventory); }
void add_color(int8_t color) { fbb_.AddElement<int8_t>(16, color, 2); }
MonsterBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); }
MonsterBuilder &operator=(const MonsterBuilder &);
flatbuffers::Offset<Monster> Finish() { return flatbuffers::Offset<Monster>(fbb_.EndTable(start_, 7)); }
};
@@ -82,7 +99,19 @@ inline flatbuffers::Offset<Monster> CreateMonster(flatbuffers::FlatBufferBuilder
return builder_.Finish();
}
bool VerifyAny(const flatbuffers::Verifier &verifier, const void *union_obj, uint8_t type) {
switch (type) {
case Any_NONE: return true;
case Any_Monster: return reinterpret_cast<const Monster *>(union_obj)->Verify(verifier);
default: return false;
}
}
inline const Monster *GetMonster(const void *buf) { return flatbuffers::GetRoot<Monster>(buf); }
}; // namespace MyGame
}; // namespace Sample
inline bool VerifyMonsterBuffer(const flatbuffers::Verifier &verifier) { return verifier.VerifyBuffer<Monster>(); }
}; // namespace MyGame
}; // namespace Sample
#endif // FLATBUFFERS_GENERATED_MONSTER_MYGAME_SAMPLE_H_

View File

@@ -22,7 +22,7 @@ using namespace MyGame::Sample;
// Example how to use FlatBuffers to create and read binary buffers.
int main(int argc, const char *argv[]) {
int main(int /*argc*/, const char * /*argv*/[]) {
// Build up a serialized buffer algorithmically:
flatbuffers::FlatBufferBuilder builder;

View File

@@ -24,7 +24,7 @@ using namespace MyGame::Sample;
// This is an example of parsing text straight into a buffer and then
// generating flatbuffer (JSON) text from the buffer.
int main(int argc, const char *argv[]) {
int main(int /*argc*/, const char * /*argv*/[]) {
// load FlatBuffer schema (.fbs) and JSON from disk
std::string schemafile;
std::string jsonfile;