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

@@ -207,7 +207,8 @@ void ParseAndGenerateTextTest() {
}
template<typename T> void CompareTableFieldValue(flatbuffers::Table *table,
int voffset, T val) {
flatbuffers::voffset_t voffset,
T val) {
T read = table->GetField(voffset, static_cast<T>(0));
TEST_EQ(read, val);
}
@@ -231,7 +232,7 @@ void FuzzTest1() {
const double double_val = 3.14159265359;
const int test_values_max = 11;
const int fields_per_object = 4;
const flatbuffers::voffset_t fields_per_object = 4;
const int num_fuzz_objects = 10000; // The higher, the more thorough :)
flatbuffers::FlatBufferBuilder builder;
@@ -244,9 +245,9 @@ void FuzzTest1() {
// fields_per_object fields, each of a random type.
for (int i = 0; i < num_fuzz_objects; i++) {
auto start = builder.StartTable();
for (int f = 0; f < fields_per_object; f++) {
for (flatbuffers::voffset_t f = 0; f < fields_per_object; f++) {
int choice = lcg_rand() % test_values_max;
flatbuffers::voffset_t off = flatbuffers::FieldIndexToOffset(f);
auto off = flatbuffers::FieldIndexToOffset(f);
switch (choice) {
case 0: builder.AddElement<uint8_t >(off, bool_val, 0); break;
case 1: builder.AddElement<int8_t >(off, char_val, 0); break;
@@ -274,7 +275,7 @@ void FuzzTest1() {
// so this is deterministic.
for (int i = 0; i < num_fuzz_objects; i++) {
auto table = reinterpret_cast<flatbuffers::Table *>(eob - objects[i]);
for (int f = 0; f < fields_per_object; f++) {
for (flatbuffers::voffset_t f = 0; f < fields_per_object; f++) {
int choice = lcg_rand() % test_values_max;
flatbuffers::voffset_t off = flatbuffers::FieldIndexToOffset(f);
switch (choice) {
@@ -477,7 +478,7 @@ void ErrorTest() {
TestError("union Z { X } struct X { Y:int; }", "only tables");
}
int main(int argc, const char *argv[]) {
int main(int /*argc*/, const char * /*argv*/[]) {
// Run our various test suites:
auto flatbuf = CreateFlatBufferTest();