Skip to content

Commit 271c53e

Browse files
committedMay 22, 2012
Missing explicit casts from void* to specific pointers required. Added #define strcasecmp for Visual C++.
1 parent a6f39a3 commit 271c53e

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed
 

‎json_object.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,7 @@ struct json_object* json_object_new_string_len(const char *s, int len)
538538
if(!jso) return NULL;
539539
jso->_delete = &json_object_string_delete;
540540
jso->_to_json_string = &json_object_string_to_json_string;
541-
jso->o.c_string.str = malloc(len);
541+
jso->o.c_string.str = (char*)malloc(len);
542542
memcpy(jso->o.c_string.str, (void *)s, len);
543543
jso->o.c_string.len = len;
544544
return jso;

‎tests/parse_flags.c

+8
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
1+
#include "config.h"
2+
13
#include <stdio.h>
24
#include <string.h>
35

46
#include "json.h"
57
#include "parse_flags.h"
68

9+
#if !defined(HAVE_STRCASECMP) && defined(_MSC_VER)
10+
# define strcasecmp _stricmp
11+
#elif !defined(HAVE_STRCASECMP)
12+
# error You do not have strcasecmp on your system.
13+
#endif /* HAVE_STRNCASECMP */
14+
715
static struct {
816
const char *arg;
917
int flag;

‎tests/test1.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ static int sort_fn (const void *j1, const void *j2)
1212
json_object * const *jso1, * const *jso2;
1313
int i1, i2;
1414

15-
jso1 = j1;
16-
jso2 = j2;
15+
jso1 = (json_object* const*)j1;
16+
jso2 = (json_object* const*)j2;
1717
if (!*jso1 && !*jso2) {
1818
return 0;
1919
}

0 commit comments

Comments
 (0)
Please sign in to comment.