From 271c53ebdd6ca995a6feec6dd67881e15b7a9eb0 Mon Sep 17 00:00:00 2001 From: Mateusz Loskot Date: Tue, 22 May 2012 23:51:44 +0100 Subject: [PATCH] Missing explicit casts from void* to specific pointers required. Added #define strcasecmp for Visual C++. --- json_object.c | 2 +- tests/parse_flags.c | 8 ++++++++ tests/test1.c | 4 ++-- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/json_object.c b/json_object.c index 8e399dea..2258c02d 100644 --- a/json_object.c +++ b/json_object.c @@ -538,7 +538,7 @@ struct json_object* json_object_new_string_len(const char *s, int len) if(!jso) return NULL; jso->_delete = &json_object_string_delete; jso->_to_json_string = &json_object_string_to_json_string; - jso->o.c_string.str = malloc(len); + jso->o.c_string.str = (char*)malloc(len); memcpy(jso->o.c_string.str, (void *)s, len); jso->o.c_string.len = len; return jso; diff --git a/tests/parse_flags.c b/tests/parse_flags.c index fafabc8f..e33ffee3 100644 --- a/tests/parse_flags.c +++ b/tests/parse_flags.c @@ -1,9 +1,17 @@ +#include "config.h" + #include #include #include "json.h" #include "parse_flags.h" +#if !defined(HAVE_STRCASECMP) && defined(_MSC_VER) +# define strcasecmp _stricmp +#elif !defined(HAVE_STRCASECMP) +# error You do not have strcasecmp on your system. +#endif /* HAVE_STRNCASECMP */ + static struct { const char *arg; int flag; diff --git a/tests/test1.c b/tests/test1.c index 9802eb10..87d7ea47 100644 --- a/tests/test1.c +++ b/tests/test1.c @@ -12,8 +12,8 @@ static int sort_fn (const void *j1, const void *j2) json_object * const *jso1, * const *jso2; int i1, i2; - jso1 = j1; - jso2 = j2; + jso1 = (json_object* const*)j1; + jso2 = (json_object* const*)j2; if (!*jso1 && !*jso2) { return 0; } -- 2.47.2