diff --git a/CMakeLists.txt b/CMakeLists.txt index 706e5e2175250112e6b4f0c60ef6b59d3e41f00e..0261d88a1cd10e64bff3d2664bf8cc4ce6102221 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,7 +15,7 @@ set(PROJECT_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT option(ENABLE_CUSTOM_COMPILER_FLAGS "Enables custom compiler flags for Clang and GCC" ON) if (ENABLE_CUSTOM_COMPILER_FLAGS) if(("${CMAKE_C_COMPILER_ID}" MATCHES "GNU") OR ("${CMAKE_C_COMPILER_ID}" MATCHES "Clang")) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c89 -pedantic -Wall -Wextra -Werror -Wstrict-prototypes -Wwrite-strings -Wshadow -Winit-self -Wcast-align -Wformat=2 -Wmissing-prototypes -Wstrict-overflow=2 -Wcast-qual -Wc++-compat -Wundef") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c89 -pedantic -Wall -Wextra -Werror -Wstrict-prototypes -Wwrite-strings -Wshadow -Winit-self -Wcast-align -Wformat=2 -Wmissing-prototypes -Wstrict-overflow=2 -Wcast-qual -Wc++-compat -Wundef -Wswitch-default") endif() endif() diff --git a/Makefile b/Makefile index b8a8e08df755326de384c8998391ea15a172c570..33be51a8087fe93a4d3e1727e2de5331b2b9c7dd 100644 --- a/Makefile +++ b/Makefile @@ -23,7 +23,7 @@ INSTALL_LIBRARY_PATH = $(DESTDIR)$(PREFIX)/$(LIBRARY_PATH) INSTALL ?= cp -a -R_CFLAGS = -fPIC -std=c89 -pedantic -Wall -Werror -Wstrict-prototypes -Wwrite-strings -Wshadow -Winit-self -Wcast-align -Wformat=2 -Wmissing-prototypes -Wstrict-overflow=2 -Wcast-qual -Wc++-compat -Wundef $(CFLAGS) +R_CFLAGS = -fPIC -std=c89 -pedantic -Wall -Werror -Wstrict-prototypes -Wwrite-strings -Wshadow -Winit-self -Wcast-align -Wformat=2 -Wmissing-prototypes -Wstrict-overflow=2 -Wcast-qual -Wc++-compat -Wundef -Wswitch-default $(CFLAGS) uname := $(shell sh -c 'uname -s 2>/dev/null || echo false') diff --git a/cJSON.c b/cJSON.c index 12e78cf29702439f916d4e46c5649004dbcf20cc..3025dfda10d9ef07b6e395e3f63b9ee5b25d4a61 100644 --- a/cJSON.c +++ b/cJSON.c @@ -645,6 +645,9 @@ static const char *parse_string(cJSON *item, const char *str, const char **ep) /* depending on the length in bytes this determines the * encoding ofthe first UTF8 byte */ *--ptr2 = (uc | firstByteMark[len]); + default: + *ep = str; + return NULL; } ptr2 += len; break; @@ -1032,6 +1035,9 @@ static char *print_value(const cJSON *item, int depth, cjbool fmt, printbuffer * case cJSON_Object: out = print_object(item, depth, fmt, p); break; + default: + out = NULL; + break; } } else @@ -1062,6 +1068,9 @@ static char *print_value(const cJSON *item, int depth, cjbool fmt, printbuffer * case cJSON_Object: out = print_object(item, depth, fmt, 0); break; + default: + out = NULL; + break; } }