From 6bea993d718cbee4da764ae1c3d4187ea61f7033 Mon Sep 17 00:00:00 2001 From: "miloyip@gmail.com" Date: Fri, 16 Nov 2012 13:02:05 +0000 Subject: [PATCH] Remove warnings in examples --- example/condense/condense.cpp | 2 +- example/pretty/pretty.cpp | 2 +- example/prettyauto/prettyauto.cpp | 2 +- example/serialize/serialize.cpp | 2 +- example/tutorial/tutorial.cpp | 5 ++++- include/rapidjson/encodedstream.h | 2 +- 6 files changed, 9 insertions(+), 6 deletions(-) diff --git a/example/condense/condense.cpp b/example/condense/condense.cpp index 22c882e..8f1da83 100644 --- a/example/condense/condense.cpp +++ b/example/condense/condense.cpp @@ -10,7 +10,7 @@ using namespace rapidjson; -int main(int argc, char* argv[]) { +int main(int, char*[]) { // Prepare JSON reader and input stream. Reader reader; char readBuffer[65536]; diff --git a/example/pretty/pretty.cpp b/example/pretty/pretty.cpp index 950d636..b09fc78 100644 --- a/example/pretty/pretty.cpp +++ b/example/pretty/pretty.cpp @@ -8,7 +8,7 @@ using namespace rapidjson; -int main(int argc, char* argv[]) { +int main(int, char*[]) { // Prepare reader and input stream. Reader reader; char readBuffer[65536]; diff --git a/example/prettyauto/prettyauto.cpp b/example/prettyauto/prettyauto.cpp index bb970cd..2e52e9e 100644 --- a/example/prettyauto/prettyauto.cpp +++ b/example/prettyauto/prettyauto.cpp @@ -14,7 +14,7 @@ using namespace rapidjson; -int main(int argc, char* argv[]) { +int main(int, char*[]) { #ifdef _WIN32 // Prevent Windows converting between CR+LF and LF _setmode(_fileno(stdin), _O_BINARY); // NEW diff --git a/example/serialize/serialize.cpp b/example/serialize/serialize.cpp index bbc41d5..b1192ba 100644 --- a/example/serialize/serialize.cpp +++ b/example/serialize/serialize.cpp @@ -108,7 +108,7 @@ class Employee : public Person { std::vector dependents_; }; -int main(int argc, char* argv[]) { +int main(int, char*[]) { std::vector employees; employees.push_back(Employee("Milo YIP", 34, true)); diff --git a/example/tutorial/tutorial.cpp b/example/tutorial/tutorial.cpp index 1b5cacb..aaa4cc8 100644 --- a/example/tutorial/tutorial.cpp +++ b/example/tutorial/tutorial.cpp @@ -8,7 +8,7 @@ using namespace rapidjson; -int main(int argc, char* argv[]) { +int main(int, char*[]) { //////////////////////////////////////////////////////////////////////////// // 1. Parse a JSON text string to a document. @@ -46,6 +46,7 @@ int main(int argc, char* argv[]) { assert(hello != 0); assert(hello->value.IsString()); assert(strcmp("world", hello->value.GetString()) == 0); + (void)hello; assert(document["t"].IsBool()); // JSON true/false are bool. Can also uses more specific function IsTrue(). printf("t = %s\n", document["t"].GetBool() ? "true" : "false"); @@ -73,6 +74,8 @@ int main(int argc, char* argv[]) { //int x = a[0].GetInt(); // Error: operator[ is ambiguous, as 0 also mean a null pointer of const char* type. int y = a[SizeType(0)].GetInt(); // Cast to SizeType will work. int z = a[0u].GetInt(); // This works too. + (void)y; + (void)z; // Iterating array with iterators printf("a = "); diff --git a/include/rapidjson/encodedstream.h b/include/rapidjson/encodedstream.h index 0deecbb..70bf6ce 100644 --- a/include/rapidjson/encodedstream.h +++ b/include/rapidjson/encodedstream.h @@ -104,7 +104,7 @@ class AutoUTFInputStream { size_t Tell() const { return is_->Tell(); } // Not implemented - void Put(Ch c) { RAPIDJSON_ASSERT(false); } + void Put(Ch) { RAPIDJSON_ASSERT(false); } void Flush() { RAPIDJSON_ASSERT(false); } Ch* PutBegin() { RAPIDJSON_ASSERT(false); return 0; } size_t PutEnd(Ch*) { RAPIDJSON_ASSERT(false); return 0; }