diff --git a/.gitignore b/.gitignore index 15000ba..ee8171d 100644 --- a/.gitignore +++ b/.gitignore @@ -49,6 +49,8 @@ /tests/*.trs /Debug /Release +/*/Debug +/*/Release *.lo *.o /libjson-c.la diff --git a/config.h.in b/config.h.in index 0dcab1a..af2e5fc 100644 --- a/config.h.in +++ b/config.h.in @@ -134,6 +134,9 @@ */ #undef LT_OBJDIR +/* Define to 1 if your C compiler doesn't accept -c and -o together. */ +#undef NO_MINUS_C_MINUS_O + /* Name of package */ #undef PACKAGE diff --git a/config.h.win32 b/config.h.win32 index 6515945..de6bc3c 100644 --- a/config.h.win32 +++ b/config.h.win32 @@ -8,35 +8,43 @@ /* Define to 1 if you have the declaration of `INFINITY', and to 0 if you don't. */ +#if defined(_MSC_VER) && _MSC_VER >= 1800 #define HAVE_DECL_INFINITY 1 +#endif /* Define to 1 if you have the declaration of `isinf', and to 0 if you don't. */ +#if defined(_MSC_VER) && _MSC_VER >= 1800 #define HAVE_DECL_ISINF 1 +#endif /* Define to 1 if you have the declaration of `isnan', and to 0 if you don't. */ +#if defined(_MSC_VER) && _MSC_VER >= 1800 #define HAVE_DECL_ISNAN 1 +#endif /* Define to 1 if you have the declaration of `nan', and to 0 if you don't. */ +#if defined(_MSC_VER) && _MSC_VER >= 1800 #define HAVE_DECL_NAN 1 +#endif /* Define to 1 if you have the declaration of `_finite', and to 0 if you don't. */ -#define HAVE_DECL__FINITE 0 +#define HAVE_DECL__FINITE 1 /* Define to 1 if you have the declaration of `_isnan', and to 0 if you don't. */ -#define HAVE_DECL__ISNAN 0 +#define HAVE_DECL__ISNAN 1 /* Define to 1 if you have the header file. */ -#undef HAVE_DLFCN_H +#define HAVE_DLFCN_H 1 /* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */ -#undef HAVE_DOPRNT +#define HAVE_DOPRNT 1 /* Define to 1 if you have the header file. */ -#define HAVE_ENDIAN_H 1 +#undef HAVE_ENDIAN_H /* Define to 1 if you have the header file. */ #define HAVE_FCNTL_H 1 @@ -58,7 +66,7 @@ #define HAVE_MEMORY_H 1 /* Define to 1 if you have the `open' function. */ -#undef HAVE_OPEN +#define HAVE_OPEN 1 /* Define to 1 if your system has a GNU libc compatible `realloc' function, and to 0 otherwise. */ @@ -95,13 +103,13 @@ #define HAVE_STRING_H 1 /* Define to 1 if you have the `strncasecmp' function. */ -#define HAVE_STRNCASECMP 1 +#undef HAVE_STRNCASECMP /* Define to 1 if you have the header file. */ #undef HAVE_SYSLOG_H /* Define to 1 if you have the header file. */ -#undef HAVE_SYS_CDEFS_H +#define HAVE_SYS_CDEFS_H 1 /* Define to 1 if you have the header file. */ #undef HAVE_SYS_PARAM_H @@ -119,21 +127,21 @@ #undef HAVE_VASPRINTF /* Define to 1 if you have the `vprintf' function. */ -#undef HAVE_VPRINTF +#define HAVE_VPRINTF 1 /* Define to 1 if you have the `vsnprintf' function. */ -#undef HAVE_VSNPRINTF +#define HAVE_VSNPRINTF 1 /* Define to 1 if you have the `vsyslog' function. */ #undef HAVE_VSYSLOG -/* Public define for json_inttypes.h */ -#define JSON_C_HAVE_INTTYPES_H 1 - /* Define to the sub-directory in which libtool stores uninstalled libraries. */ #undef LT_OBJDIR +/* Define to 1 if your C compiler doesn't accept -c and -o together. */ +/* #undef NO_MINUS_C_MINUS_O */ + /* Name of package */ #define PACKAGE "json-c" diff --git a/json-c.vcxproj b/json-c.vcxproj index 9c50712..c39ef7e 100644 --- a/json-c.vcxproj +++ b/json-c.vcxproj @@ -1,26 +1,44 @@ - + Debug Win32 + + Debug + x64 + Release Win32 + + Release + x64 + {04D8CDBE-FB3E-4362-87E6-07DC3C0083B2} - Win32Proj + jsonc + + StaticLibrary + v120 + MultiByte + + + StaticLibrary + v120 + MultiByte + StaticLibrary v120 MultiByte - + StaticLibrary v120 MultiByte @@ -28,60 +46,88 @@ - - - + + + + + + + + + - - <_ProjectFileVersion>12.0.30324.0 - - - Debug\ - Debug\ - - - Release\ - Release\ - Disabled WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) true EnableFastChecks - MultiThreadedDebug - Level3 EditAndContinue + CompileAsCpp - - $(OutDir)json-c.lib - copy config.h.win32 config.h copy json_config.h.win32 json_config.h + + copy config.h from Windows template instead of calling configure + - + - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - MultiThreaded - + Disabled + WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + true + EnableFastChecks Level3 - ProgramDatabase + EditAndContinue + CompileAsCpp - - $(OutDir)json-c.lib - copy config.h.win32 config.h copy json_config.h.win32 json_config.h + + copy config.h from Windows template instead of calling configure + + + + + WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) + Level3 + ProgramDatabase + CompileAsCpp + + + copy config.h.win32 config.h +copy json_config.h.win32 json_config.h + + + + copy config.h from Windows template instead of calling configure + + + + + WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) + Level3 + ProgramDatabase + CompileAsCpp + + + copy config.h.win32 config.h +copy json_config.h.win32 json_config.h + + + + copy config.h from Windows template instead of calling configure + @@ -91,17 +137,20 @@ copy json_config.h.win32 json_config.h + - + + + diff --git a/json-c.vcxproj.filters b/json-c.vcxproj.filters index 1805d88..63b6fb1 100644 --- a/json-c.vcxproj.filters +++ b/json-c.vcxproj.filters @@ -1,4 +1,4 @@ - + @@ -14,7 +14,7 @@ rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx - {d3849076-874e-490e-858c-0871d04d1ecb} + {8c5a59ed-4639-4361-9b7c-ecdcd09b953c} @@ -39,14 +39,14 @@ Source Files + + Source Files + Header Files - - Header Files - Header Files @@ -68,14 +68,23 @@ Header Files + + Header Files + + + Header Files + + + Header Files + Documentation + - \ No newline at end of file diff --git a/json_config.h.win32 b/json_config.h.win32 index 405fda2..9c542a4 100644 --- a/json_config.h.win32 +++ b/json_config.h.win32 @@ -1,3 +1,5 @@ /* Define to 1 if you have the header file. */ +#if defined(_MSC_VER) && _MSC_VER >= 1800 #define JSON_C_HAVE_INTTYPES_H 1 +#endif diff --git a/json_inttypes.h b/json_inttypes.h index 9de8d24..e86f4cc 100644 --- a/json_inttypes.h +++ b/json_inttypes.h @@ -4,25 +4,16 @@ #include "json_config.h" -#if defined(_MSC_VER) && _MSC_VER <= 1700 +#ifdef JSON_C_HAVE_INTTYPES_H +/* inttypes.h includes stdint.h */ +#include + +#else +#include -/* Anything less than Visual Studio C++ 10 is missing stdint.h and inttypes.h */ -typedef __int32 int32_t; -#define INT32_MIN ((int32_t)_I32_MIN) -#define INT32_MAX ((int32_t)_I32_MAX) -typedef __int64 int64_t; -#define INT64_MIN ((int64_t)_I64_MIN) -#define INT64_MAX ((int64_t)_I64_MAX) #define PRId64 "I64d" #define SCNd64 "I64d" -#else - -#ifdef JSON_C_HAVE_INTTYPES_H -#include -#endif -/* inttypes.h includes stdint.h */ - #endif #endif diff --git a/json_object.c b/json_object.c index 9b89bb7..d0aba48 100644 --- a/json_object.c +++ b/json_object.c @@ -409,7 +409,7 @@ void json_object_object_add(struct json_object* jso, const char *key, lh_table_insert(jso->o.c_object, strdup(key), val); return; } - existing_value = (void *)existing_entry->v; + existing_value = (json_object *)existing_entry->v; if (existing_value) json_object_put(existing_value); existing_entry->v = val; @@ -661,8 +661,8 @@ struct json_object* json_object_new_double_s(double d, const char *ds) int json_object_userdata_to_json_string(struct json_object *jso, struct printbuf *pb, int level, int flags) { - int userdata_len = strlen(jso->_userdata); - printbuf_memappend(pb, jso->_userdata, userdata_len); + int userdata_len = strlen((const char *)jso->_userdata); + printbuf_memappend(pb, (const char *)jso->_userdata, userdata_len); return userdata_len; } diff --git a/json_tokener.c b/json_tokener.c index d9e9e24..8b1e3e6 100644 --- a/json_tokener.c +++ b/json_tokener.c @@ -16,6 +16,7 @@ #include "config.h" #include +#include "math_compat.h" #include #include #include @@ -353,7 +354,7 @@ struct json_object* json_tokener_parse_ex(struct json_tokener *tok, case json_tokener_state_inf: /* aka starts with 'i' */ { - int size_inf; + size_t size_inf; int is_negative = 0; printbuf_memappend_fast(tok->pb, &c, 1); diff --git a/linkhash.c b/linkhash.c index a5b2945..572f4dc 100644 --- a/linkhash.c +++ b/linkhash.c @@ -10,6 +10,8 @@ * */ +#include "config.h" + #include #include #include @@ -413,7 +415,7 @@ unsigned long lh_char_hash(const void *k) #if defined __GNUC__ __sync_val_compare_and_swap(&random_seed, -1, seed); #elif defined _MSC_VER - InterlockedCompareExchange(&random_seed, seed, -1); + InterlockedCompareExchange((LONG *)&random_seed, seed, -1); #else #warning "racy random seed initializtion if used by multiple threads" random_seed = seed; /* potentially racy */ diff --git a/math_compat.h b/math_compat.h index f40b8fa..baf3eb9 100644 --- a/math_compat.h +++ b/math_compat.h @@ -1,7 +1,7 @@ #ifndef __math_compat_h #define __math_compat_h -/* Define isnan and isinf on Windows/MSVC */ +/* Define isnan, isinf, infinity and nan on Windows/MSVC */ #ifndef HAVE_DECL_ISNAN # ifdef HAVE_DECL__ISNAN @@ -17,12 +17,15 @@ # endif #endif -#ifndef HAVE_DECL_NAN -#error This platform does not have nan() -#endif - #ifndef HAVE_DECL_INFINITY -#error This platform does not have INFINITY +#include +#define INFINITY (DBL_MAX + DBL_MAX) +#define HAVE_DECL_INFINITY +#endif + +#ifndef HAVE_DECL_NAN +#define NAN (INFINITY - INFINITY) +#define HAVE_DECL_NAN #endif #endif diff --git a/random_seed.c b/random_seed.c index 2e7cd5e..3b61b77 100644 --- a/random_seed.c +++ b/random_seed.c @@ -11,6 +11,7 @@ #include #include "config.h" +#include "random_seed.h" #define DEBUG_SEED(s)