From db5ecf18246d24795715422cfa821ca01aad0b99 Mon Sep 17 00:00:00 2001 From: Alex Zolotarev Date: Mon, 7 Mar 2011 03:14:27 +0000 Subject: [PATCH] [jansson] Fixed compilation warnings --- 3party/jansson/src/dump.c | 7 ++++++- 3party/jansson/src/jansson_private.h | 2 +- 3party/jansson/src/load.c | 5 +++++ 3party/jansson/src/util.h | 4 +++- 3party/jansson/src/value.c | 2 +- 5 files changed, 16 insertions(+), 4 deletions(-) diff --git a/3party/jansson/src/dump.c b/3party/jansson/src/dump.c index e58bb2bc5c..a2bc10b446 100644 --- a/3party/jansson/src/dump.c +++ b/3party/jansson/src/dump.c @@ -16,6 +16,11 @@ #include "strbuffer.h" #include "utf.h" +// Visual Studio fix +#ifdef _MSC_VER + #define snprintf _snprintf +#endif + #define MAX_INTEGER_STR_LENGTH 100 #define MAX_REAL_STR_LENGTH 100 @@ -306,7 +311,7 @@ static int do_dump(const json_t *json, unsigned long flags, int depth, if(flags & JSON_SORT_KEYS || flags & JSON_PRESERVE_ORDER) { - const object_key_t **keys; + object_key_t **keys; unsigned int size; unsigned int i; int (*cmp_func)(const void *, const void *); diff --git a/3party/jansson/src/jansson_private.h b/3party/jansson/src/jansson_private.h index 4490702aa8..6977bb5bf5 100644 --- a/3party/jansson/src/jansson_private.h +++ b/3party/jansson/src/jansson_private.h @@ -55,6 +55,6 @@ typedef struct { char key[]; } object_key_t; -const object_key_t *jsonp_object_iter_fullkey(void *iter); +object_key_t *jsonp_object_iter_fullkey(void *iter); #endif diff --git a/3party/jansson/src/load.c b/3party/jansson/src/load.c index afb5fd2aed..de42d72e2f 100644 --- a/3party/jansson/src/load.c +++ b/3party/jansson/src/load.c @@ -20,6 +20,11 @@ #include "strbuffer.h" #include "utf.h" +// Visual Studio fix +#ifdef _MSC_VER + #define snprintf _snprintf +#endif + #define TOKEN_INVALID -1 #define TOKEN_EOF 0 #define TOKEN_STRING 256 diff --git a/3party/jansson/src/util.h b/3party/jansson/src/util.h index 06a547b8aa..49b3a17755 100644 --- a/3party/jansson/src/util.h +++ b/3party/jansson/src/util.h @@ -8,6 +8,8 @@ #ifndef UTIL_H #define UTIL_H -#define max(a, b) ((a) > (b) ? (a) : (b)) +#ifndef max + #define max(a, b) ((a) > (b) ? (a) : (b)) +#endif #endif diff --git a/3party/jansson/src/value.c b/3party/jansson/src/value.c index 2d58f8cc86..8f53440e2e 100644 --- a/3party/jansson/src/value.c +++ b/3party/jansson/src/value.c @@ -232,7 +232,7 @@ void *json_object_iter_next(json_t *json, void *iter) return hashtable_iter_next(&object->hashtable, iter); } -const object_key_t *jsonp_object_iter_fullkey(void *iter) +object_key_t *jsonp_object_iter_fullkey(void *iter) { if(!iter) return NULL;