mirror of
				https://github.com/eledio-devices/thirdparty-ArduinoJson.git
				synced 2025-10-31 08:42:39 +01:00 
			
		
		
		
	Added more warning flags for GCC (as suggested in issue #28)
This commit is contained in:
		| @@ -9,8 +9,6 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin) | ||||
|  | ||||
| if(MSVC) | ||||
| 	add_definitions(-D_CRT_SECURE_NO_WARNINGS -W4) | ||||
| else() | ||||
| 	add_definitions(-Wall) | ||||
| endif() | ||||
|  | ||||
| add_subdirectory(src) | ||||
|   | ||||
| @@ -23,7 +23,7 @@ namespace ArduinoJson | ||||
|                 JSON_PROXY, | ||||
|                 JSON_DOUBLE_0_DECIMALS, | ||||
|                 JSON_DOUBLE_1_DECIMAL, | ||||
|                 JSON_DOUBLE_2_DECIMALS, | ||||
|                 JSON_DOUBLE_2_DECIMALS | ||||
|                 // etc. | ||||
|             }; | ||||
|  | ||||
|   | ||||
| @@ -12,32 +12,32 @@ namespace ArduinoJson | ||||
|         public: | ||||
|  | ||||
|             explicit JsonNodeIterator(JsonNode* node) | ||||
|             : node(node) | ||||
|                 : _node(node) | ||||
|             { | ||||
|             } | ||||
|  | ||||
|             bool operator!= (const JsonNodeIterator& other) const | ||||
|             { | ||||
|                 return node != other.node; | ||||
|                 return _node != other._node; | ||||
|             } | ||||
|  | ||||
|             void operator++() | ||||
|             { | ||||
|                 node = node->next; | ||||
|                 _node = _node->next; | ||||
|             } | ||||
|  | ||||
|             JsonNode* operator*() const | ||||
|             { | ||||
|                 return node; | ||||
|                 return _node; | ||||
|             } | ||||
|  | ||||
|             JsonNode* operator->() const | ||||
|             { | ||||
|                 return node; | ||||
|                 return _node; | ||||
|             } | ||||
|  | ||||
|         private: | ||||
|             JsonNode* node; | ||||
|             JsonNode* _node; | ||||
|         }; | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -22,7 +22,7 @@ namespace ArduinoJson | ||||
|         void add(bool value); | ||||
|         void add(const char* value); | ||||
|         void add(double value, int decimals=2); | ||||
|         void add(int value) { add((long) value); } | ||||
|         void add(int value) { add(static_cast<long>(value)); } | ||||
|         void add(long value); | ||||
|         void add(JsonContainer nestedArray); // TODO: should allow JsonValue too | ||||
|  | ||||
|   | ||||
| @@ -21,7 +21,7 @@ size_t Print::print(const char s[]) | ||||
| size_t Print::print(double value, int digits) | ||||
| { | ||||
|     char tmp[32]; | ||||
|     sprintf(tmp, "%.*lg", digits+1, value); | ||||
|     sprintf(tmp, "%.*g", digits+1, value); | ||||
|     return print(tmp); | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -3,4 +3,32 @@ file(GLOB_RECURSE SRC_FILES *.cpp) | ||||
|  | ||||
| include_directories(../include) | ||||
|  | ||||
| if(CMAKE_COMPILER_IS_GNUCXX) | ||||
| 	add_definitions( | ||||
| 		-Wall | ||||
| 		-Wcast-align | ||||
| 		-Wcast-qual | ||||
| 		-Wctor-dtor-privacy | ||||
| 		-Wdisabled-optimization | ||||
| 		-Wextra | ||||
| 		-Wformat=2 | ||||
| 		-Winit-self | ||||
| 		-Wlogical-op | ||||
| 		-Wmissing-include-dirs | ||||
| 		-Wno-parentheses | ||||
| 		-Wno-unused | ||||
| 		-Wno-variadic-macros | ||||
| 		-Wnoexcept | ||||
| 		-Wold-style-cast | ||||
| 		-Woverloaded-virtual | ||||
| 		-Wpedantic | ||||
| 		-Wredundant-decls | ||||
| 		-Wshadow | ||||
| 		-Wsign-promo | ||||
| 		-Wstrict-null-sentinel | ||||
| 		-Wstrict-overflow=5 | ||||
| 		-Wundef | ||||
| 	) | ||||
| endif() | ||||
|  | ||||
| add_library(ArduinoJson ${SRC_FILES} ${INC_FILES}) | ||||
| @@ -71,13 +71,13 @@ void JsonContainer::removeChild(JsonNode* childToRemove) | ||||
|  | ||||
| size_t JsonContainer::size() const | ||||
| { | ||||
|     int size = 0; | ||||
|     int n = 0; | ||||
|  | ||||
|     for (JsonNodeIterator it = beginChildren(); it != endChildren(); ++it) | ||||
|     { | ||||
|         size++; | ||||
|         n++; | ||||
|     } | ||||
|  | ||||
|     return size; | ||||
|     return n; | ||||
| } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user