Compare commits
55 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3279aacdee | ||
|
|
2158670177 | ||
|
|
4cff593dd4 | ||
|
|
597423ea80 | ||
|
|
c3fc1d7382 | ||
|
|
c922354076 | ||
|
|
4118315afa | ||
|
|
ee13c667f1 | ||
|
|
23d563434a | ||
|
|
6142dbd8d0 | ||
|
|
0dac319bc4 | ||
|
|
0b871a113c | ||
|
|
8176527f56 | ||
|
|
ec7bb71d75 | ||
|
|
b6a1d8cfd4 | ||
|
|
52924288b9 | ||
|
|
7892ecce1c | ||
|
|
a501a39626 | ||
|
|
37bc3bbf4b | ||
|
|
2d46ea069b | ||
|
|
b217cd6689 | ||
|
|
a0c262d08b | ||
|
|
6ce273e2e6 | ||
|
|
f62b1f5d69 | ||
|
|
2b87fdcb43 | ||
|
|
c0139681cd | ||
|
|
9d6f9511f5 | ||
|
|
a79f64e155 | ||
|
|
7ca783c3bc | ||
|
|
ff0c05b8f1 | ||
|
|
4601bf71e5 | ||
|
|
c7f86abf6d | ||
|
|
f309e30320 | ||
|
|
233574e8e0 | ||
|
|
4a6939ef87 | ||
|
|
42bc7a3c50 | ||
|
|
abdb8d99d7 | ||
|
|
8b2bfd5586 | ||
|
|
1581f26a7f | ||
|
|
e8fd3e3085 | ||
|
|
873eddaf19 | ||
|
|
bd2c0c730d | ||
|
|
17a51a4bf0 | ||
|
|
09c39adc55 | ||
|
|
cbb80baf03 | ||
|
|
040bd7b0fa | ||
|
|
952e1d4ba9 | ||
|
|
d286e7b753 | ||
|
|
9af64480e1 | ||
|
|
56039ed596 | ||
|
|
1eb274c555 | ||
|
|
f736e705b2 | ||
|
|
98a99fb2bd | ||
|
|
60fd7ab781 | ||
|
|
a894980258 |
42
CHANGES
42
CHANGES
@@ -1,3 +1,45 @@
|
||||
Version 2.4
|
||||
===========
|
||||
|
||||
Released 2012-09-23
|
||||
|
||||
* New features:
|
||||
|
||||
- Add `json_boolean()` macro that returns the JSON true or false
|
||||
value based on its argument (#86).
|
||||
|
||||
- Add `json_load_callback()` that calls a callback function
|
||||
repeatedly to read the JSON input (#57).
|
||||
|
||||
- Add JSON_ESCAPE_SLASH encoding flag to escape all occurences of
|
||||
``/`` with ``\/``.
|
||||
|
||||
* Bug fixes:
|
||||
|
||||
- Check for and reject NaN and Inf values for reals. Encoding these
|
||||
values resulted in invalid JSON.
|
||||
|
||||
- Fix `json_real_set()` to return -1 on error.
|
||||
|
||||
* Build:
|
||||
|
||||
- Jansson now builds on Windows with Visual Studio 2010, and
|
||||
includes solution and project files in ``win32/vs2010/``
|
||||
directory.
|
||||
|
||||
- Fix build warnings (#77, #78).
|
||||
|
||||
- Add ``-no-undefined`` to LDFLAGS (#90).
|
||||
|
||||
* Tests:
|
||||
|
||||
- Fix the symbol exports test on Linux/PPC64 (#88).
|
||||
|
||||
* Documentation:
|
||||
|
||||
- Fix typos (#73, #84).
|
||||
|
||||
|
||||
Version 2.3.1
|
||||
=============
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
EXTRA_DIST = CHANGES LICENSE README.rst
|
||||
EXTRA_DIST = CHANGES LICENSE README.rst win32
|
||||
SUBDIRS = doc src test
|
||||
|
||||
# "make distcheck" builds the dvi target, so use it to check that the
|
||||
|
||||
@@ -33,8 +33,8 @@ To run the test suite, invoke::
|
||||
$ make check
|
||||
|
||||
If the source has been checked out from a Git repository, the
|
||||
./configure script has to be generated fist. The easiest way is to use
|
||||
autoreconf::
|
||||
./configure script has to be generated first. The easiest way is to
|
||||
use autoreconf::
|
||||
|
||||
$ autoreconf -i
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
AC_PREREQ([2.60])
|
||||
AC_INIT([jansson], [2.3.1], [petri@digip.org])
|
||||
AC_INIT([jansson], [2.4], [petri@digip.org])
|
||||
|
||||
AM_INIT_AUTOMAKE([1.10 foreign])
|
||||
|
||||
|
||||
@@ -255,8 +255,8 @@ returns an error status.
|
||||
True, False and Null
|
||||
====================
|
||||
|
||||
These values are implemented as singletons, so each of these functions
|
||||
returns the same value each time.
|
||||
These three values are implemented as singletons, so the returned
|
||||
pointers won't change between invocations of these functions.
|
||||
|
||||
.. function:: json_t *json_true(void)
|
||||
|
||||
@@ -270,6 +270,17 @@ returns the same value each time.
|
||||
|
||||
Returns the JSON false value.
|
||||
|
||||
.. function:: json_t *json_boolean(val)
|
||||
|
||||
.. refcounting:: new
|
||||
|
||||
Returns JSON false if ``val`` is zero, and JSON true otherwise.
|
||||
This is a macro, and equivalent to ``val ? json_true() :
|
||||
json_false()``.
|
||||
|
||||
.. versionadded:: 2.4
|
||||
|
||||
|
||||
.. function:: json_t *json_null(void)
|
||||
|
||||
.. refcounting:: new
|
||||
@@ -798,6 +809,11 @@ can be ORed together to obtain *flags*.
|
||||
|
||||
.. versionadded:: 2.1
|
||||
|
||||
``JSON_ESCAPE_SLASH``
|
||||
Escape the ``/`` characters in strings with ``\/``.
|
||||
|
||||
.. versionadded:: 2.4
|
||||
|
||||
The following functions perform the actual JSON encoding. The result
|
||||
is in UTF-8.
|
||||
|
||||
@@ -967,6 +983,34 @@ The following functions perform the actual JSON decoding.
|
||||
filled with information about the error. *flags* is described
|
||||
above.
|
||||
|
||||
.. type:: json_load_callback_t
|
||||
|
||||
A typedef for a function that's called by
|
||||
:func:`json_load_callback()` to read a chunk of input data::
|
||||
|
||||
typedef size_t (*json_load_callback_t)(void *buffer, size_t buflen, void *data);
|
||||
|
||||
*buffer* points to a buffer of *buflen* bytes, and *data* is the
|
||||
corresponding :func:`json_load_callback()` argument passed through.
|
||||
|
||||
On error, the function should return ``(size_t)-1`` to abort the
|
||||
decoding process. When there's no data left, it should return 0 to
|
||||
report that the end of input has been reached.
|
||||
|
||||
.. versionadded:: 2.4
|
||||
|
||||
.. function:: json_t *json_load_callback(json_load_callback_t callback, void *data, size_t flags, json_error_t *error)
|
||||
|
||||
.. refcounting:: new
|
||||
|
||||
Decodes the JSON text produced by repeated calls to *callback*, and
|
||||
returns the array or object it contains, or *NULL* on error, in
|
||||
which case *error* is filled with information about the error.
|
||||
*data* is passed through to *callback* on each call. *flags* is
|
||||
described above.
|
||||
|
||||
.. versionadded:: 2.4
|
||||
|
||||
|
||||
.. _apiref-pack:
|
||||
|
||||
@@ -1073,7 +1117,7 @@ More examples::
|
||||
json_pack("{s:i, s:i}", "foo", 42, "bar", 7);
|
||||
|
||||
/* Build the JSON array [[1, 2], {"cool": true}] */
|
||||
json_pack("[[i,i],{s:b]]", 1, 2, "cool", 1);
|
||||
json_pack("[[i,i],{s:b}]", 1, 2, "cool", 1);
|
||||
|
||||
|
||||
.. _apiref-unpack:
|
||||
@@ -1191,7 +1235,7 @@ The following functions compose the parsing and validation API:
|
||||
modifying the structure or contents of a value reachable from
|
||||
``root``.
|
||||
|
||||
If the ``O`` and ``o`` format character are not used, it's
|
||||
If the ``O`` and ``o`` format characters are not used, it's
|
||||
perfectly safe to cast a ``const json_t *`` variable to plain
|
||||
``json_t *`` when used with these functions.
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ copyright = u'2009-2012, Petri Lehtinen'
|
||||
# built documents.
|
||||
#
|
||||
# The short X.Y version.
|
||||
version = '2.3.1'
|
||||
version = '2.4'
|
||||
# The full version, including alpha/beta/rc tags.
|
||||
release = version
|
||||
|
||||
|
||||
@@ -54,22 +54,25 @@ used as described above.
|
||||
.. _libtool: http://www.gnu.org/software/libtool/
|
||||
|
||||
|
||||
Windows
|
||||
-------
|
||||
|
||||
Jansson can be built with Visual Studio 2010 (and probably newer
|
||||
versions, too). The solution and project files are in the
|
||||
``win32/vs2010/`` directory in the source distribution.
|
||||
|
||||
|
||||
Other Systems
|
||||
-------------
|
||||
|
||||
On Windows and other non Unix-like systems, you may be unable to run
|
||||
the ``./configure`` script. In this case, follow these steps. All the
|
||||
files mentioned can be found in the ``src/`` directory.
|
||||
On non Unix-like systems, you may be unable to run the ``./configure``
|
||||
script. In this case, follow these steps. All the files mentioned can
|
||||
be found in the ``src/`` directory.
|
||||
|
||||
1. Create ``jansson_config.h``. This file has some platform-specific
|
||||
1. Create ``jansson_config.h`` (which has some platform-specific
|
||||
parameters that are normally filled in by the ``./configure``
|
||||
script:
|
||||
|
||||
- On Windows, rename ``jansson_config.h.win32`` to ``jansson_config.h``.
|
||||
|
||||
- On other systems, edit ``jansson_config.h.in``, replacing all
|
||||
``@variable@`` placeholders, and rename the file to
|
||||
``jansson_config.h``.
|
||||
script). Edit ``jansson_config.h.in``, replacing all ``@variable@``
|
||||
placeholders, and rename the file to ``jansson_config.h``.
|
||||
|
||||
2. Make ``jansson.h`` and ``jansson_config.h`` available to the
|
||||
compiler, so that they can be found when compiling programs that
|
||||
|
||||
@@ -205,7 +205,7 @@ Next we'll extract the commit ID (a hexadecimal SHA-1 sum),
|
||||
intermediate commit info object, and the commit message from that
|
||||
object. We also do proper type checks::
|
||||
|
||||
sha = json_object_get(commit, "sha");
|
||||
sha = json_object_get(data, "sha");
|
||||
if(!json_is_string(sha))
|
||||
{
|
||||
fprintf(stderr, "error: commit %d: sha is not a string\n", i + 1);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
EXTRA_DIST = jansson_config.h.win32
|
||||
EXTRA_DIST = jansson.def
|
||||
|
||||
include_HEADERS = jansson.h jansson_config.h
|
||||
|
||||
@@ -19,8 +19,9 @@ libjansson_la_SOURCES = \
|
||||
utf.h \
|
||||
value.c
|
||||
libjansson_la_LDFLAGS = \
|
||||
-no-undefined \
|
||||
-export-symbols-regex '^json_' \
|
||||
-version-info 7:1:3
|
||||
-version-info 8:0:4
|
||||
|
||||
if GCC
|
||||
# These flags are gcc specific
|
||||
|
||||
23
src/dump.c
23
src/dump.c
@@ -11,7 +11,7 @@
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include <jansson.h>
|
||||
#include "jansson.h"
|
||||
#include "jansson_private.h"
|
||||
#include "strbuffer.h"
|
||||
#include "utf.h"
|
||||
@@ -62,7 +62,7 @@ static int dump_indent(size_t flags, int depth, int space, json_dump_callback_t
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int dump_string(const char *str, int ascii, json_dump_callback_t dump, void *data)
|
||||
static int dump_string(const char *str, json_dump_callback_t dump, void *data, size_t flags)
|
||||
{
|
||||
const char *pos, *end;
|
||||
int32_t codepoint;
|
||||
@@ -87,8 +87,12 @@ static int dump_string(const char *str, int ascii, json_dump_callback_t dump, vo
|
||||
if(codepoint == '\\' || codepoint == '"' || codepoint < 0x20)
|
||||
break;
|
||||
|
||||
/* slash */
|
||||
if((flags & JSON_ESCAPE_SLASH) && codepoint == '/')
|
||||
break;
|
||||
|
||||
/* non-ASCII */
|
||||
if(ascii && codepoint > 0x7F)
|
||||
if((flags & JSON_ENSURE_ASCII) && codepoint > 0x7F)
|
||||
break;
|
||||
|
||||
pos = end;
|
||||
@@ -102,7 +106,7 @@ static int dump_string(const char *str, int ascii, json_dump_callback_t dump, vo
|
||||
if(end == pos)
|
||||
break;
|
||||
|
||||
/* handle \, ", and control codes */
|
||||
/* handle \, /, ", and control codes */
|
||||
length = 2;
|
||||
switch(codepoint)
|
||||
{
|
||||
@@ -113,6 +117,7 @@ static int dump_string(const char *str, int ascii, json_dump_callback_t dump, vo
|
||||
case '\n': text = "\\n"; break;
|
||||
case '\r': text = "\\r"; break;
|
||||
case '\t': text = "\\t"; break;
|
||||
case '/': text = "\\/"; break;
|
||||
default:
|
||||
{
|
||||
/* codepoint is in BMP */
|
||||
@@ -166,8 +171,6 @@ static int object_key_compare_serials(const void *key1, const void *key2)
|
||||
static int do_dump(const json_t *json, size_t flags, int depth,
|
||||
json_dump_callback_t dump, void *data)
|
||||
{
|
||||
int ascii = flags & JSON_ENSURE_ASCII ? 1 : 0;
|
||||
|
||||
switch(json_typeof(json)) {
|
||||
case JSON_NULL:
|
||||
return dump("null", 4, data);
|
||||
@@ -186,7 +189,7 @@ static int do_dump(const json_t *json, size_t flags, int depth,
|
||||
size = snprintf(buffer, MAX_INTEGER_STR_LENGTH,
|
||||
"%" JSON_INTEGER_FORMAT,
|
||||
json_integer_value(json));
|
||||
if(size >= MAX_INTEGER_STR_LENGTH)
|
||||
if(size < 0 || size >= MAX_INTEGER_STR_LENGTH)
|
||||
return -1;
|
||||
|
||||
return dump(buffer, size, data);
|
||||
@@ -206,7 +209,7 @@ static int do_dump(const json_t *json, size_t flags, int depth,
|
||||
}
|
||||
|
||||
case JSON_STRING:
|
||||
return dump_string(json_string_value(json), ascii, dump, data);
|
||||
return dump_string(json_string_value(json), dump, data, flags);
|
||||
|
||||
case JSON_ARRAY:
|
||||
{
|
||||
@@ -327,7 +330,7 @@ static int do_dump(const json_t *json, size_t flags, int depth,
|
||||
value = json_object_get(json, key);
|
||||
assert(value);
|
||||
|
||||
dump_string(key, ascii, dump, data);
|
||||
dump_string(key, dump, data, flags);
|
||||
if(dump(separator, separator_length, data) ||
|
||||
do_dump(value, flags, depth + 1, dump, data))
|
||||
{
|
||||
@@ -364,7 +367,7 @@ static int do_dump(const json_t *json, size_t flags, int depth,
|
||||
{
|
||||
void *next = json_object_iter_next((json_t *)json, iter);
|
||||
|
||||
dump_string(json_object_iter_key(iter), ascii, dump, data);
|
||||
dump_string(json_object_iter_key(iter), dump, data, flags);
|
||||
if(dump(separator, separator_length, data) ||
|
||||
do_dump(json_object_iter_value(iter), flags, depth + 1,
|
||||
dump, data))
|
||||
|
||||
@@ -59,4 +59,5 @@ void jsonp_error_vset(json_error_t *error, int line, int column,
|
||||
error->position = position;
|
||||
|
||||
vsnprintf(error->text, JSON_ERROR_TEXT_LENGTH, msg, ap);
|
||||
error->text[JSON_ERROR_TEXT_LENGTH - 1] = '\0';
|
||||
}
|
||||
|
||||
65
src/jansson.def
Normal file
65
src/jansson.def
Normal file
@@ -0,0 +1,65 @@
|
||||
LIBRARY "jansson"
|
||||
|
||||
EXPORTS
|
||||
json_delete
|
||||
json_true
|
||||
json_false
|
||||
json_null
|
||||
json_string
|
||||
json_string_nocheck
|
||||
json_string_value
|
||||
json_string_set
|
||||
json_string_set_nocheck
|
||||
json_integer
|
||||
json_integer_value
|
||||
json_integer_set
|
||||
json_real
|
||||
json_real_value
|
||||
json_real_set
|
||||
json_number_value
|
||||
json_array
|
||||
json_array_size
|
||||
json_array_get
|
||||
json_array_set_new
|
||||
json_array_append_new
|
||||
json_array_insert_new
|
||||
json_array_remove
|
||||
json_array_clear
|
||||
json_array_extend
|
||||
json_object
|
||||
json_object_size
|
||||
json_object_get
|
||||
json_object_set_new
|
||||
json_object_set_new_nocheck
|
||||
json_object_del
|
||||
json_object_clear
|
||||
json_object_update
|
||||
json_object_update_existing
|
||||
json_object_update_missing
|
||||
json_object_iter
|
||||
json_object_iter_at
|
||||
json_object_iter_next
|
||||
json_object_iter_key
|
||||
json_object_iter_value
|
||||
json_object_iter_set_new
|
||||
json_object_key_to_iter
|
||||
json_dumps
|
||||
json_dumpf
|
||||
json_dump_file
|
||||
json_dump_callback
|
||||
json_loads
|
||||
json_loadb
|
||||
json_loadf
|
||||
json_load_file
|
||||
json_load_callback
|
||||
json_equal
|
||||
json_copy
|
||||
json_deep_copy
|
||||
json_pack
|
||||
json_pack_ex
|
||||
json_vpack_ex
|
||||
json_unpack
|
||||
json_unpack_ex
|
||||
json_vunpack_ex
|
||||
json_set_alloc_funcs
|
||||
|
||||
@@ -21,11 +21,11 @@ extern "C" {
|
||||
/* version */
|
||||
|
||||
#define JANSSON_MAJOR_VERSION 2
|
||||
#define JANSSON_MINOR_VERSION 3
|
||||
#define JANSSON_MICRO_VERSION 1
|
||||
#define JANSSON_MINOR_VERSION 4
|
||||
#define JANSSON_MICRO_VERSION 0
|
||||
|
||||
/* Micro version is omitted if it's 0 */
|
||||
#define JANSSON_VERSION "2.3.1"
|
||||
#define JANSSON_VERSION "2.4"
|
||||
|
||||
/* Version as a 3-byte hex number, e.g. 0x010201 == 1.2.1. Use this
|
||||
for numeric comparisons, e.g. #if JANSSON_VERSION_HEX >= ... */
|
||||
@@ -86,6 +86,7 @@ json_t *json_integer(json_int_t value);
|
||||
json_t *json_real(double value);
|
||||
json_t *json_true(void);
|
||||
json_t *json_false(void);
|
||||
#define json_boolean(val) ((val) ? json_true() : json_false())
|
||||
json_t *json_null(void);
|
||||
|
||||
static JSON_INLINE
|
||||
@@ -232,10 +233,13 @@ json_t *json_deep_copy(json_t *value);
|
||||
#define JSON_DISABLE_EOF_CHECK 0x2
|
||||
#define JSON_DECODE_ANY 0x4
|
||||
|
||||
typedef size_t (*json_load_callback_t)(void *buffer, size_t buflen, void *data);
|
||||
|
||||
json_t *json_loads(const char *input, size_t flags, json_error_t *error);
|
||||
json_t *json_loadb(const char *buffer, size_t buflen, size_t flags, json_error_t *error);
|
||||
json_t *json_loadf(FILE *input, size_t flags, json_error_t *error);
|
||||
json_t *json_load_file(const char *path, size_t flags, json_error_t *error);
|
||||
json_t *json_load_callback(json_load_callback_t callback, void *data, size_t flags, json_error_t *error);
|
||||
|
||||
|
||||
/* encoding */
|
||||
@@ -246,6 +250,7 @@ json_t *json_load_file(const char *path, size_t flags, json_error_t *error);
|
||||
#define JSON_SORT_KEYS 0x80
|
||||
#define JSON_PRESERVE_ORDER 0x100
|
||||
#define JSON_ENCODE_ANY 0x200
|
||||
#define JSON_ESCAPE_SLASH 0x400
|
||||
|
||||
typedef int (*json_dump_callback_t)(const char *buffer, size_t size, void *data);
|
||||
|
||||
|
||||
@@ -83,4 +83,10 @@ void* jsonp_malloc(size_t size);
|
||||
void jsonp_free(void *ptr);
|
||||
char *jsonp_strdup(const char *str);
|
||||
|
||||
/* Windows compatibility */
|
||||
#ifdef _WIN32
|
||||
#define snprintf _snprintf
|
||||
#define vsnprintf _vsnprintf
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
64
src/load.c
64
src/load.c
@@ -13,7 +13,7 @@
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include <jansson.h>
|
||||
#include "jansson.h"
|
||||
#include "jansson_private.h"
|
||||
#include "strbuffer.h"
|
||||
#include "utf.h"
|
||||
@@ -87,6 +87,7 @@ static void error_set(json_error_t *error, const lex_t *lex,
|
||||
|
||||
va_start(ap, msg);
|
||||
vsnprintf(msg_text, JSON_ERROR_TEXT_LENGTH, msg, ap);
|
||||
msg_text[JSON_ERROR_TEXT_LENGTH - 1] = '\0';
|
||||
va_end(ap);
|
||||
|
||||
if(lex)
|
||||
@@ -102,6 +103,7 @@ static void error_set(json_error_t *error, const lex_t *lex,
|
||||
if(lex->saved_text.length <= 20) {
|
||||
snprintf(msg_with_context, JSON_ERROR_TEXT_LENGTH,
|
||||
"%s near '%s'", msg_text, saved_text);
|
||||
msg_with_context[JSON_ERROR_TEXT_LENGTH - 1] = '\0';
|
||||
result = msg_with_context;
|
||||
}
|
||||
}
|
||||
@@ -114,6 +116,7 @@ static void error_set(json_error_t *error, const lex_t *lex,
|
||||
else {
|
||||
snprintf(msg_with_context, JSON_ERROR_TEXT_LENGTH,
|
||||
"%s near end of file", msg_text);
|
||||
msg_with_context[JSON_ERROR_TEXT_LENGTH - 1] = '\0';
|
||||
result = msg_with_context;
|
||||
}
|
||||
}
|
||||
@@ -444,7 +447,11 @@ out:
|
||||
}
|
||||
|
||||
#if JSON_INTEGER_IS_LONG_LONG
|
||||
#ifdef _MSC_VER // Microsoft Visual Studio
|
||||
#define json_strtoint _strtoi64
|
||||
#else
|
||||
#define json_strtoint strtoll
|
||||
#endif
|
||||
#else
|
||||
#define json_strtoint strtol
|
||||
#endif
|
||||
@@ -990,3 +997,58 @@ json_t *json_load_file(const char *path, size_t flags, json_error_t *error)
|
||||
fclose(fp);
|
||||
return result;
|
||||
}
|
||||
|
||||
#define MAX_BUF_LEN 1024
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char data[MAX_BUF_LEN];
|
||||
size_t len;
|
||||
size_t pos;
|
||||
json_load_callback_t callback;
|
||||
void *arg;
|
||||
} callback_data_t;
|
||||
|
||||
static int callback_get(void *data)
|
||||
{
|
||||
char c;
|
||||
callback_data_t *stream = data;
|
||||
|
||||
if(stream->pos >= stream->len) {
|
||||
stream->pos = 0;
|
||||
stream->len = stream->callback(stream->data, MAX_BUF_LEN, stream->arg);
|
||||
if(stream->len == 0 || stream->len == (size_t)-1)
|
||||
return EOF;
|
||||
}
|
||||
|
||||
c = stream->data[stream->pos];
|
||||
stream->pos++;
|
||||
return (unsigned char)c;
|
||||
}
|
||||
|
||||
json_t *json_load_callback(json_load_callback_t callback, void *arg, size_t flags, json_error_t *error)
|
||||
{
|
||||
lex_t lex;
|
||||
json_t *result;
|
||||
|
||||
callback_data_t stream_data;
|
||||
|
||||
memset(&stream_data, 0, sizeof(stream_data));
|
||||
stream_data.callback = callback;
|
||||
stream_data.arg = arg;
|
||||
|
||||
jsonp_error_init(error, "<callback>");
|
||||
|
||||
if (callback == NULL) {
|
||||
error_set(error, NULL, "wrong arguments");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if(lex_init(&lex, (get_func)callback_get, &stream_data))
|
||||
return NULL;
|
||||
|
||||
result = parse_json(&lex, flags, error);
|
||||
|
||||
lex_close(&lex);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <jansson.h>
|
||||
#include "jansson.h"
|
||||
#include "jansson_private.h"
|
||||
|
||||
/* memory function pointers */
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <jansson.h>
|
||||
#include "jansson.h"
|
||||
#include "jansson_private.h"
|
||||
#include "utf.h"
|
||||
|
||||
@@ -431,7 +431,7 @@ static int unpack(scanner_t *s, json_t *root, va_list *ap)
|
||||
if(!(s->flags & JSON_VALIDATE_ONLY)) {
|
||||
int *target = va_arg(*ap, int*);
|
||||
if(root)
|
||||
*target = json_integer_value(root);
|
||||
*target = (int)json_integer_value(root);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
23
src/value.c
23
src/value.c
@@ -10,12 +10,20 @@
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
#include <jansson.h>
|
||||
#include "jansson.h"
|
||||
#include "hashtable.h"
|
||||
#include "jansson_private.h"
|
||||
#include "utf.h"
|
||||
|
||||
/* Work around nonstandard isnan() and isinf() implementations */
|
||||
#ifndef isnan
|
||||
static JSON_INLINE int isnan(double x) { return x != x; }
|
||||
#endif
|
||||
#ifndef isinf
|
||||
static JSON_INLINE int isinf(double x) { return !isnan(x) && isnan(x - x); }
|
||||
#endif
|
||||
|
||||
static JSON_INLINE void json_init(json_t *json, json_type type)
|
||||
{
|
||||
@@ -731,7 +739,12 @@ static json_t *json_integer_copy(json_t *integer)
|
||||
|
||||
json_t *json_real(double value)
|
||||
{
|
||||
json_real_t *real = jsonp_malloc(sizeof(json_real_t));
|
||||
json_real_t *real;
|
||||
|
||||
if(isnan(value) || isinf(value))
|
||||
return NULL;
|
||||
|
||||
real = jsonp_malloc(sizeof(json_real_t));
|
||||
if(!real)
|
||||
return NULL;
|
||||
json_init(&real->json, JSON_REAL);
|
||||
@@ -750,8 +763,8 @@ double json_real_value(const json_t *json)
|
||||
|
||||
int json_real_set(json_t *json, double value)
|
||||
{
|
||||
if(!json_is_real(json))
|
||||
return 0;
|
||||
if(!json_is_real(json) || isnan(value) || isinf(value))
|
||||
return -1;
|
||||
|
||||
json_to_real(json)->value = value;
|
||||
|
||||
@@ -779,7 +792,7 @@ static json_t *json_real_copy(json_t *real)
|
||||
double json_number_value(const json_t *json)
|
||||
{
|
||||
if(json_is_integer(json))
|
||||
return json_integer_value(json);
|
||||
return (double)json_integer_value(json);
|
||||
else if(json_is_real(json))
|
||||
return json_real_value(json);
|
||||
else
|
||||
|
||||
1
test/.gitignore
vendored
1
test/.gitignore
vendored
@@ -14,3 +14,4 @@ suites/api/test_object
|
||||
suites/api/test_pack
|
||||
suites/api/test_simple
|
||||
suites/api/test_unpack
|
||||
suites/api/test_load_callback
|
||||
|
||||
@@ -3,6 +3,18 @@
|
||||
# Jansson is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the MIT license. See LICENSE for details.
|
||||
|
||||
die() {
|
||||
echo "$1" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
[ -n "$1" ] || die "Usage: $0 suite-name"
|
||||
[ -n "$bindir" ] || die "Set bindir"
|
||||
[ -n "$logdir" ] || die "Set logdir"
|
||||
[ -n "$scriptdir" ] || die "Set scriptdir"
|
||||
[ -n "$suites_srcdir" ] || die "Set suites_srcdir"
|
||||
[ -n "$suites_builddir" ] || die "Set suites_builddir"
|
||||
|
||||
json_process=$bindir/json_process
|
||||
|
||||
suite_name=$1
|
||||
@@ -10,7 +22,6 @@ suite_srcdir=$suites_srcdir/$suite_name
|
||||
suite_builddir=$suites_builddir/$suite_name
|
||||
suite_log=$logdir/$suite_name
|
||||
|
||||
|
||||
[ -z "$VERBOSE" ] && VERBOSE=0
|
||||
[ -z "$STOP" ] && STOP=0
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ check_PROGRAMS = \
|
||||
test_equal \
|
||||
test_load \
|
||||
test_loadb \
|
||||
test_load_callback \
|
||||
test_memory_funcs \
|
||||
test_number \
|
||||
test_object \
|
||||
|
||||
@@ -1,102 +1,21 @@
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# This test checks that libjansson.so exports the correct symbols.
|
||||
|
||||
# The list of symbols that the shared object should export
|
||||
sort >$test_log/exports <<EOF
|
||||
json_delete
|
||||
json_true
|
||||
json_false
|
||||
json_null
|
||||
json_string
|
||||
json_string_nocheck
|
||||
json_string_value
|
||||
json_string_set
|
||||
json_string_set_nocheck
|
||||
json_integer
|
||||
json_integer_value
|
||||
json_integer_set
|
||||
json_real
|
||||
json_real_value
|
||||
json_real_set
|
||||
json_number_value
|
||||
json_array
|
||||
json_array_size
|
||||
json_array_get
|
||||
json_array_set_new
|
||||
json_array_append_new
|
||||
json_array_insert_new
|
||||
json_array_remove
|
||||
json_array_clear
|
||||
json_array_extend
|
||||
json_object
|
||||
json_object_size
|
||||
json_object_get
|
||||
json_object_set_new
|
||||
json_object_set_new_nocheck
|
||||
json_object_del
|
||||
json_object_clear
|
||||
json_object_update
|
||||
json_object_update_existing
|
||||
json_object_update_missing
|
||||
json_object_iter
|
||||
json_object_iter_at
|
||||
json_object_iter_next
|
||||
json_object_iter_key
|
||||
json_object_iter_value
|
||||
json_object_iter_set_new
|
||||
json_object_key_to_iter
|
||||
json_dumps
|
||||
json_dumpf
|
||||
json_dump_file
|
||||
json_dump_callback
|
||||
json_loads
|
||||
json_loadf
|
||||
json_load_file
|
||||
json_loadb
|
||||
json_equal
|
||||
json_copy
|
||||
json_deep_copy
|
||||
json_pack
|
||||
json_pack_ex
|
||||
json_vpack_ex
|
||||
json_unpack
|
||||
json_unpack_ex
|
||||
json_vunpack_ex
|
||||
json_set_alloc_funcs
|
||||
EOF
|
||||
|
||||
# The list of functions are not exported in the library because they
|
||||
# are macros or static inline functions. This is only the make the
|
||||
# list complete, there are not used by the test.
|
||||
sort >$test_log/macros_or_inline <<EOF
|
||||
json_typeof
|
||||
json_incref
|
||||
json_decref
|
||||
json_is_object
|
||||
json_is_object
|
||||
json_is_array
|
||||
json_is_string
|
||||
json_is_integer
|
||||
json_is_real
|
||||
json_is_true
|
||||
json_is_false
|
||||
json_is_null
|
||||
json_is_number
|
||||
json_is_boolean
|
||||
json_array_set
|
||||
json_array_append
|
||||
json_array_insert
|
||||
json_object_set
|
||||
json_object_set_nocheck
|
||||
EOF
|
||||
#
|
||||
|
||||
SOFILE="../src/.libs/libjansson.so"
|
||||
|
||||
# The list of symbols, which the shared object should export, is read
|
||||
# from the def file, which is used in Windows builds
|
||||
grep 'json_' $top_srcdir/src/jansson.def \
|
||||
| sed -e 's/ //g' \
|
||||
| sort \
|
||||
>$test_log/exports
|
||||
|
||||
nm -D $SOFILE >/dev/null >$test_log/symbols 2>/dev/null \
|
||||
|| exit 77 # Skip if "nm -D" doesn't seem to work
|
||||
|
||||
grep ' T ' $test_log/symbols | cut -d' ' -f3 | sort >$test_log/output
|
||||
grep ' [DT] ' $test_log/symbols | cut -d' ' -f3 | sort >$test_log/output
|
||||
|
||||
if ! cmp -s $test_log/exports $test_log/output; then
|
||||
diff -u $test_log/exports $test_log/output >&2
|
||||
|
||||
@@ -133,9 +133,34 @@ static void encode_other_than_array_or_object()
|
||||
|
||||
}
|
||||
|
||||
static void escape_slashes()
|
||||
{
|
||||
/* Test dump escaping slashes */
|
||||
|
||||
json_t *json;
|
||||
char *result;
|
||||
|
||||
json = json_object();
|
||||
json_object_set_new(json, "url", json_string("https://github.com/akheron/jansson"));
|
||||
|
||||
result = json_dumps(json, 0);
|
||||
if(!result || strcmp(result, "{\"url\": \"https://github.com/akheron/jansson\"}"))
|
||||
fail("json_dumps failed to not escape slashes");
|
||||
|
||||
free(result);
|
||||
|
||||
result = json_dumps(json, JSON_ESCAPE_SLASH);
|
||||
if(!result || strcmp(result, "{\"url\": \"https:\\/\\/github.com\\/akheron\\/jansson\"}"))
|
||||
fail("json_dumps failed to escape slashes");
|
||||
|
||||
free(result);
|
||||
json_decref(json);
|
||||
}
|
||||
|
||||
static void run_tests()
|
||||
{
|
||||
encode_twice();
|
||||
circular_references();
|
||||
encode_other_than_array_or_object();
|
||||
escape_slashes();
|
||||
}
|
||||
|
||||
75
test/suites/api/test_load_callback.c
Normal file
75
test/suites/api/test_load_callback.c
Normal file
@@ -0,0 +1,75 @@
|
||||
/*
|
||||
* Copyright (c) 2009-2011 Petri Lehtinen <petri@digip.org>
|
||||
*
|
||||
* Jansson is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the MIT license. See LICENSE for details.
|
||||
*/
|
||||
|
||||
#include <jansson.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include "util.h"
|
||||
|
||||
struct my_source {
|
||||
const char *buf;
|
||||
size_t off;
|
||||
size_t cap;
|
||||
};
|
||||
|
||||
static const char my_str[] = "[\"A\", {\"B\": \"C\", \"e\": false}, 1, null, \"foo\"]";
|
||||
|
||||
static size_t greedy_reader(void *buf, size_t buflen, void *arg)
|
||||
{
|
||||
struct my_source *s = arg;
|
||||
if (buflen > s->cap - s->off)
|
||||
buflen = s->cap - s->off;
|
||||
if (buflen > 0) {
|
||||
memcpy(buf, s->buf + s->off, buflen);
|
||||
s->off += buflen;
|
||||
return buflen;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
static void run_tests()
|
||||
{
|
||||
struct my_source s;
|
||||
json_t *json;
|
||||
json_error_t error;
|
||||
|
||||
s.off = 0;
|
||||
s.cap = strlen(my_str);
|
||||
s.buf = my_str;
|
||||
|
||||
json = json_load_callback(greedy_reader, &s, 0, &error);
|
||||
|
||||
if (!json)
|
||||
fail("json_load_callback failed on a valid callback");
|
||||
json_decref(json);
|
||||
|
||||
s.off = 0;
|
||||
s.cap = strlen(my_str) - 1;
|
||||
s.buf = my_str;
|
||||
|
||||
json = json_load_callback(greedy_reader, &s, 0, &error);
|
||||
if (json) {
|
||||
json_decref(json);
|
||||
fail("json_load_callback should have failed on an incomplete stream, but it didn't");
|
||||
}
|
||||
if (strcmp(error.source, "<callback>") != 0) {
|
||||
fail("json_load_callback returned an invalid error source");
|
||||
}
|
||||
if (strcmp(error.text, "']' expected near end of file") != 0) {
|
||||
fail("json_load_callback returned an invalid error message for an unclosed top-level array");
|
||||
}
|
||||
|
||||
json = json_load_callback(NULL, NULL, 0, &error);
|
||||
if (json) {
|
||||
json_decref(json);
|
||||
fail("json_load_callback should have failed on NULL load callback, but it didn't");
|
||||
}
|
||||
if (strcmp(error.text, "wrong arguments") != 0) {
|
||||
fail("json_load_callback returned an invalid error message for a NULL load callback");
|
||||
}
|
||||
}
|
||||
@@ -55,14 +55,14 @@ static void *secure_malloc(size_t size)
|
||||
/* Store the memory area size in the beginning of the block */
|
||||
void *ptr = malloc(size + 8);
|
||||
*((size_t *)ptr) = size;
|
||||
return ptr + 8;
|
||||
return (char *)ptr + 8;
|
||||
}
|
||||
|
||||
static void secure_free(void *ptr)
|
||||
{
|
||||
size_t size;
|
||||
|
||||
ptr -= 8;
|
||||
ptr = (char *)ptr - 8;
|
||||
size = *((size_t *)ptr);
|
||||
|
||||
/*guaranteed_*/memset(ptr, 0, size);
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
* it under the terms of the MIT license. See LICENSE for details.
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
#include <jansson.h>
|
||||
#include "util.h"
|
||||
|
||||
@@ -39,4 +40,34 @@ static void run_tests()
|
||||
|
||||
json_decref(integer);
|
||||
json_decref(real);
|
||||
|
||||
#ifdef NAN
|
||||
real = json_real(NAN);
|
||||
if(real != NULL)
|
||||
fail("could construct a real from NaN");
|
||||
|
||||
real = json_real(1.0);
|
||||
if(json_real_set(real, NAN) != -1)
|
||||
fail("could set a real to NaN");
|
||||
|
||||
if(json_real_value(real) != 1.0)
|
||||
fail("real value changed unexpectedly");
|
||||
|
||||
json_decref(real);
|
||||
#endif
|
||||
|
||||
#ifdef INFINITY
|
||||
real = json_real(INFINITY);
|
||||
if(real != NULL)
|
||||
fail("could construct a real from Inf");
|
||||
|
||||
real = json_real(1.0);
|
||||
if(json_real_set(real, INFINITY) != -1)
|
||||
fail("could set a real to Inf");
|
||||
|
||||
if(json_real_value(real) != 1.0)
|
||||
fail("real value changed unexpectedly");
|
||||
|
||||
json_decref(real);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ static void run_tests()
|
||||
value = json_pack("b", 1);
|
||||
if(!json_is_true(value))
|
||||
fail("json_pack boolean failed");
|
||||
if(value->refcount != (ssize_t)-1)
|
||||
if(value->refcount != (size_t)-1)
|
||||
fail("json_pack boolean refcount failed");
|
||||
json_decref(value);
|
||||
|
||||
@@ -33,7 +33,7 @@ static void run_tests()
|
||||
value = json_pack("b", 0);
|
||||
if(!json_is_false(value))
|
||||
fail("json_pack boolean failed");
|
||||
if(value->refcount != (ssize_t)-1)
|
||||
if(value->refcount != (size_t)-1)
|
||||
fail("json_pack boolean refcount failed");
|
||||
json_decref(value);
|
||||
|
||||
@@ -41,7 +41,7 @@ static void run_tests()
|
||||
value = json_pack("n");
|
||||
if(!json_is_null(value))
|
||||
fail("json_pack null failed");
|
||||
if(value->refcount != (ssize_t)-1)
|
||||
if(value->refcount != (size_t)-1)
|
||||
fail("json_pack null refcount failed");
|
||||
json_decref(value);
|
||||
|
||||
@@ -49,7 +49,7 @@ static void run_tests()
|
||||
value = json_pack("i", 1);
|
||||
if(!json_is_integer(value) || json_integer_value(value) != 1)
|
||||
fail("json_pack integer failed");
|
||||
if(value->refcount != (ssize_t)1)
|
||||
if(value->refcount != (size_t)1)
|
||||
fail("json_pack integer refcount failed");
|
||||
json_decref(value);
|
||||
|
||||
@@ -57,7 +57,7 @@ static void run_tests()
|
||||
value = json_pack("I", (json_int_t)555555);
|
||||
if(!json_is_integer(value) || json_integer_value(value) != 555555)
|
||||
fail("json_pack json_int_t failed");
|
||||
if(value->refcount != (ssize_t)1)
|
||||
if(value->refcount != (size_t)1)
|
||||
fail("json_pack integer refcount failed");
|
||||
json_decref(value);
|
||||
|
||||
@@ -65,7 +65,7 @@ static void run_tests()
|
||||
value = json_pack("f", 1.0);
|
||||
if(!json_is_real(value) || json_real_value(value) != 1.0)
|
||||
fail("json_pack real failed");
|
||||
if(value->refcount != (ssize_t)1)
|
||||
if(value->refcount != (size_t)1)
|
||||
fail("json_pack real refcount failed");
|
||||
json_decref(value);
|
||||
|
||||
@@ -73,7 +73,7 @@ static void run_tests()
|
||||
value = json_pack("s", "test");
|
||||
if(!json_is_string(value) || strcmp("test", json_string_value(value)))
|
||||
fail("json_pack string failed");
|
||||
if(value->refcount != (ssize_t)1)
|
||||
if(value->refcount != (size_t)1)
|
||||
fail("json_pack string refcount failed");
|
||||
json_decref(value);
|
||||
|
||||
@@ -81,7 +81,7 @@ static void run_tests()
|
||||
value = json_pack("{}", 1.0);
|
||||
if(!json_is_object(value) || json_object_size(value) != 0)
|
||||
fail("json_pack empty object failed");
|
||||
if(value->refcount != (ssize_t)1)
|
||||
if(value->refcount != (size_t)1)
|
||||
fail("json_pack empty object refcount failed");
|
||||
json_decref(value);
|
||||
|
||||
@@ -89,7 +89,7 @@ static void run_tests()
|
||||
value = json_pack("[]", 1.0);
|
||||
if(!json_is_array(value) || json_array_size(value) != 0)
|
||||
fail("json_pack empty list failed");
|
||||
if(value->refcount != (ssize_t)1)
|
||||
if(value->refcount != (size_t)1)
|
||||
fail("json_pack empty list failed");
|
||||
json_decref(value);
|
||||
|
||||
@@ -97,7 +97,7 @@ static void run_tests()
|
||||
value = json_pack("o", json_integer(1));
|
||||
if(!json_is_integer(value) || json_integer_value(value) != 1)
|
||||
fail("json_pack object failed");
|
||||
if(value->refcount != (ssize_t)1)
|
||||
if(value->refcount != (size_t)1)
|
||||
fail("json_pack integer refcount failed");
|
||||
json_decref(value);
|
||||
|
||||
@@ -105,7 +105,7 @@ static void run_tests()
|
||||
value = json_pack("O", json_integer(1));
|
||||
if(!json_is_integer(value) || json_integer_value(value) != 1)
|
||||
fail("json_pack object failed");
|
||||
if(value->refcount != (ssize_t)2)
|
||||
if(value->refcount != (size_t)2)
|
||||
fail("json_pack integer refcount failed");
|
||||
json_decref(value);
|
||||
json_decref(value);
|
||||
@@ -116,7 +116,7 @@ static void run_tests()
|
||||
fail("json_pack array failed");
|
||||
if(!json_is_array(json_object_get(value, "foo")))
|
||||
fail("json_pack array failed");
|
||||
if(json_object_get(value, "foo")->refcount != (ssize_t)1)
|
||||
if(json_object_get(value, "foo")->refcount != (size_t)1)
|
||||
fail("json_pack object refcount failed");
|
||||
json_decref(value);
|
||||
|
||||
|
||||
@@ -14,6 +14,22 @@ static void run_tests()
|
||||
{
|
||||
json_t *value;
|
||||
|
||||
value = json_boolean(1);
|
||||
if(!json_is_true(value))
|
||||
fail("json_boolean(1) failed");
|
||||
json_decref(value);
|
||||
|
||||
value = json_boolean(-123);
|
||||
if(!json_is_true(value))
|
||||
fail("json_boolean(-123) failed");
|
||||
json_decref(value);
|
||||
|
||||
value = json_boolean(0);
|
||||
if(!json_is_false(value))
|
||||
fail("json_boolean(0) failed");
|
||||
json_decref(value);
|
||||
|
||||
|
||||
value = json_integer(1);
|
||||
if(json_typeof(value) != JSON_INTEGER)
|
||||
fail("json_typeof failed");
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#ifdef __cplusplus
|
||||
#define JSON_INLINE inline
|
||||
#else
|
||||
#define JSON_INLINE
|
||||
#define JSON_INLINE __inline
|
||||
#endif
|
||||
|
||||
/* If your compiler supports the `long long` type and the strtoll()
|
||||
20
win32/vs2010/jansson.sln
Normal file
20
win32/vs2010/jansson.sln
Normal file
@@ -0,0 +1,20 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Visual C++ Express 2010
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "jansson", "jansson.vcxproj", "{76226D20-1972-4789-A595-EDACC7A76DC3}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{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}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{76226D20-1972-4789-A595-EDACC7A76DC3}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
108
win32/vs2010/jansson.vcxproj
Normal file
108
win32/vs2010/jansson.vcxproj
Normal file
@@ -0,0 +1,108 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\src\dump.c" />
|
||||
<ClCompile Include="..\..\src\error.c" />
|
||||
<ClCompile Include="..\..\src\hashtable.c" />
|
||||
<ClCompile Include="..\..\src\load.c" />
|
||||
<ClCompile Include="..\..\src\memory.c" />
|
||||
<ClCompile Include="..\..\src\pack_unpack.c" />
|
||||
<ClCompile Include="..\..\src\strbuffer.c" />
|
||||
<ClCompile Include="..\..\src\strconv.c" />
|
||||
<ClCompile Include="..\..\src\utf.c" />
|
||||
<ClCompile Include="..\..\src\value.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\src\hashtable.h" />
|
||||
<ClInclude Include="..\..\src\jansson.h" />
|
||||
<ClInclude Include="..\..\src\jansson_private.h" />
|
||||
<ClInclude Include="..\..\src\strbuffer.h" />
|
||||
<ClInclude Include="..\..\src\utf.h" />
|
||||
<ClInclude Include="..\jansson_config.h" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{76226D20-1972-4789-A595-EDACC7A76DC3}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>jansson_dll</RootNamespace>
|
||||
<ProjectName>jansson</ProjectName>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<OutDir>Output\$(Configuration)\</OutDir>
|
||||
<IntDir>Build\$(Configuration)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<OutDir>Output\$(Configuration)\</OutDir>
|
||||
<IntDir>Build\$(Configuration)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;JANSSON_DLL_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>..</AdditionalIncludeDirectories>
|
||||
<DisableSpecificWarnings>4996</DisableSpecificWarnings>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<ModuleDefinitionFile>../../src/jansson.def</ModuleDefinitionFile>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;JANSSON_DLL_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>..</AdditionalIncludeDirectories>
|
||||
<DisableSpecificWarnings>4996</DisableSpecificWarnings>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<ModuleDefinitionFile>../../src/jansson.def</ModuleDefinitionFile>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
69
win32/vs2010/jansson.vcxproj.filters
Normal file
69
win32/vs2010/jansson.vcxproj.filters
Normal file
@@ -0,0 +1,69 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\src\dump.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\error.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\hashtable.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\load.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\memory.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\pack_unpack.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\strbuffer.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\strconv.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\utf.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\value.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\src\hashtable.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\jansson.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\jansson_private.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\strbuffer.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\utf.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\jansson_config.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
3
win32/vs2010/jansson.vcxproj.user
Normal file
3
win32/vs2010/jansson.vcxproj.user
Normal file
@@ -0,0 +1,3 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
</Project>
|
||||
Reference in New Issue
Block a user