diff --git a/deps/jansson/CMakeLists.txt b/deps/jansson/CMakeLists.txt index 446ec6e96..08c1666d8 100644 --- a/deps/jansson/CMakeLists.txt +++ b/deps/jansson/CMakeLists.txt @@ -102,7 +102,7 @@ if (MSVC) endif() -if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) +if (NOT WIN32 AND (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)) set(CMAKE_C_FLAGS "-fPIC") endif() @@ -415,7 +415,7 @@ if (NOT WITHOUT_TESTS) # Test suites. # if (CMAKE_COMPILER_IS_GNUCC) - add_definitions(-Wall -Wextra -Wdeclaration-after-statement -Werror) + add_definitions(-Wall -Wextra -Wdeclaration-after-statement) endif () set(api_tests diff --git a/deps/jansson/Makefile.am b/deps/jansson/Makefile.am index 9221cd19b..788f9ac12 100644 --- a/deps/jansson/Makefile.am +++ b/deps/jansson/Makefile.am @@ -1,4 +1,4 @@ -EXTRA_DIST = CHANGES LICENSE README.rst win32 +EXTRA_DIST = CHANGES LICENSE README.rst win32 CMakeLists.txt cmake SUBDIRS = doc src test # "make distcheck" builds the dvi target, so use it to check that the diff --git a/deps/jansson/doc/apiref.rst b/deps/jansson/doc/apiref.rst index 13b7901da..717e1406b 100644 --- a/deps/jansson/doc/apiref.rst +++ b/deps/jansson/doc/apiref.rst @@ -150,6 +150,11 @@ functions: Returns true for types ``JSON_TRUE`` and ``JSON_FALSE``, and false for values of other types and for *NULL*. +.. function:: json_boolean_value(const json_t *json) + + Alias of :func:`json_is_true()`, i.e. returns 1 for ``JSON_TRUE`` + and 0 otherwise. + .. _apiref-reference-count: diff --git a/deps/jansson/doc/github_commits.c b/deps/jansson/doc/github_commits.c index 2b39250d2..94fb8b71d 100644 --- a/deps/jansson/doc/github_commits.c +++ b/deps/jansson/doc/github_commits.c @@ -53,6 +53,7 @@ static char *request(const char *url) { CURL *curl = NULL; CURLcode status; + struct curl_slist *headers = NULL; char *data = NULL; long code; @@ -71,6 +72,11 @@ static char *request(const char *url) }; curl_easy_setopt(curl, CURLOPT_URL, url); + + /* GitHub commits API v3 requires a User-Agent header */ + headers = curl_slist_append(headers, "User-Agent: Jansson-Tutorial"); + curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); + curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_response); curl_easy_setopt(curl, CURLOPT_WRITEDATA, &write_result); @@ -90,6 +96,7 @@ static char *request(const char *url) } curl_easy_cleanup(curl); + curl_slist_free_all(headers); curl_global_cleanup(); /* zero-terminate the result */ @@ -102,6 +109,8 @@ error: free(data); if(curl) curl_easy_cleanup(curl); + if(headers) + curl_slist_free_all(headers); curl_global_cleanup(); return NULL; } diff --git a/deps/jansson/src/dump.c b/deps/jansson/src/dump.c index 26a1906e7..d347aae5f 100644 --- a/deps/jansson/src/dump.c +++ b/deps/jansson/src/dump.c @@ -230,7 +230,7 @@ static int do_dump(const json_t *json, size_t flags, int depth, goto array_error; array->visited = 1; - n = (int)json_array_size(json); + n = json_array_size(json); if(dump("[", 1, data)) goto array_error; diff --git a/deps/jansson/src/error.c b/deps/jansson/src/error.c index 2ba8d82ce..a544a59fb 100644 --- a/deps/jansson/src/error.c +++ b/deps/jansson/src/error.c @@ -56,7 +56,7 @@ void jsonp_error_vset(json_error_t *error, int line, int column, error->line = line; error->column = column; - error->position = (int)position; + error->position = position; vsnprintf(error->text, JSON_ERROR_TEXT_LENGTH, msg, ap); error->text[JSON_ERROR_TEXT_LENGTH - 1] = '\0'; diff --git a/deps/jansson/src/jansson.h b/deps/jansson/src/jansson.h index 27c0c74ba..c4975985d 100644 --- a/deps/jansson/src/jansson.h +++ b/deps/jansson/src/jansson.h @@ -75,6 +75,7 @@ typedef long json_int_t; #define json_is_number(json) (json_is_integer(json) || json_is_real(json)) #define json_is_true(json) ((json) && json_typeof(json) == JSON_TRUE) #define json_is_false(json) ((json) && json_typeof(json) == JSON_FALSE) +#define json_boolean_value json_is_true #define json_is_boolean(json) (json_is_true(json) || json_is_false(json)) #define json_is_null(json) ((json) && json_typeof(json) == JSON_NULL) diff --git a/deps/jansson/src/load.c b/deps/jansson/src/load.c index 5d0d1efcd..2adaee80d 100644 --- a/deps/jansson/src/load.c +++ b/deps/jansson/src/load.c @@ -171,7 +171,7 @@ static int stream_get(stream_t *stream, json_error_t *error) /* multi-byte UTF-8 sequence */ int i, count; - count = (int)utf8_check_first(c); + count = utf8_check_first(c); if(!count) goto out; @@ -900,7 +900,7 @@ static json_t *parse_json(lex_t *lex, size_t flags, json_error_t *error) if(error) { /* Save the position even though there was no error */ - error->position = (int)lex->stream.position; + error->position = lex->stream.position; } return result; diff --git a/deps/jansson/src/value.c b/deps/jansson/src/value.c index 417ea85b8..336873b51 100644 --- a/deps/jansson/src/value.c +++ b/deps/jansson/src/value.c @@ -76,7 +76,7 @@ json_t *json_object_get(const json_t *json, const char *key) { json_object_t *object; - if(!json_is_object(json)) + if(!key || !json_is_object(json)) return NULL; object = json_to_object(json); @@ -121,7 +121,7 @@ int json_object_del(json_t *json, const char *key) { json_object_t *object; - if(!json_is_object(json)) + if(!key || !json_is_object(json)) return -1; object = json_to_object(json); diff --git a/deps/jansson/test/suites/api/test_simple.c b/deps/jansson/test/suites/api/test_simple.c index ca97a7d1b..7eed591e3 100644 --- a/deps/jansson/test/suites/api/test_simple.c +++ b/deps/jansson/test/suites/api/test_simple.c @@ -27,6 +27,8 @@ static void run_tests() value = json_boolean(0); if(!json_is_false(value)) fail("json_boolean(0) failed"); + if(json_boolean_value(value) != 0) + fail("json_boolean_value failed"); json_decref(value); diff --git a/vs/2013/OBS.sln b/vs/2013/OBS.sln index a936c0a8b..93a6fc055 100644 --- a/vs/2013/OBS.sln +++ b/vs/2013/OBS.sln @@ -119,12 +119,10 @@ Global {C6CD0240-5A92-43F6-B0EE-FF3ACE10742F}.Release|x64.Build.0 = Release|x64 {76226D20-1972-4789-A595-EDACC7A76DC3}.Debug|Win32.ActiveCfg = Debug|Win32 {76226D20-1972-4789-A595-EDACC7A76DC3}.Debug|Win32.Build.0 = Debug|Win32 - {76226D20-1972-4789-A595-EDACC7A76DC3}.Debug|x64.ActiveCfg = Debug|x64 - {76226D20-1972-4789-A595-EDACC7A76DC3}.Debug|x64.Build.0 = Debug|x64 + {76226D20-1972-4789-A595-EDACC7A76DC3}.Debug|x64.ActiveCfg = Debug|Win32 {76226D20-1972-4789-A595-EDACC7A76DC3}.Release|Win32.ActiveCfg = Release|Win32 {76226D20-1972-4789-A595-EDACC7A76DC3}.Release|Win32.Build.0 = Release|Win32 - {76226D20-1972-4789-A595-EDACC7A76DC3}.Release|x64.ActiveCfg = Release|x64 - {76226D20-1972-4789-A595-EDACC7A76DC3}.Release|x64.Build.0 = Release|x64 + {76226D20-1972-4789-A595-EDACC7A76DC3}.Release|x64.ActiveCfg = Release|Win32 {36970254-B1E5-4BE6-A561-301B6E7CDCE3}.Debug|Win32.ActiveCfg = Debug|Win32 {36970254-B1E5-4BE6-A561-301B6E7CDCE3}.Debug|Win32.Build.0 = Debug|Win32 {36970254-B1E5-4BE6-A561-301B6E7CDCE3}.Debug|x64.ActiveCfg = Debug|x64