Merge branch 'fix-slash' of git://github.com/jrbasso/jansson
authorPetri Lehtinen <petri@digip.org>
Fri, 29 Jun 2012 10:17:55 +0000 (13:17 +0300)
committerPetri Lehtinen <petri@digip.org>
Fri, 29 Jun 2012 10:24:55 +0000 (13:24 +0300)
Fixes #81.

22 files changed:
configure.ac
doc/apiref.rst
doc/conf.py
doc/gettingstarted.rst
src/dump.c
src/error.c
src/jansson.def [new file with mode: 0644]
src/jansson.h
src/jansson_private.h
src/load.c
src/memory.c
src/pack_unpack.c
src/value.c
test/.gitignore
test/suites/api/Makefile.am
test/suites/api/check-exports
test/suites/api/test_load_callback.c [new file with mode: 0644]
win32/jansson_config.h [moved from src/jansson_config.h.win32 with 97% similarity]
win32/vs2010/jansson.sln [new file with mode: 0644]
win32/vs2010/jansson.vcxproj [new file with mode: 0644]
win32/vs2010/jansson.vcxproj.filters [new file with mode: 0644]
win32/vs2010/jansson.vcxproj.user [new file with mode: 0644]

index 677dbef..753a09b 100644 (file)
@@ -1,5 +1,5 @@
 AC_PREREQ([2.60])
-AC_INIT([jansson], [2.3.1], [petri@digip.org])
+AC_INIT([jansson], [2.4-dev], [petri@digip.org])
 
 AM_INIT_AUTOMAKE([1.10 foreign])
 
index d6f451c..e8f1375 100644 (file)
@@ -967,6 +967,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:
 
index 701fd46..35c5238 100644 (file)
@@ -48,9 +48,9 @@ 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
+release = '2.4-dev'
 
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.
index 0b0d743..f30e1e7 100644 (file)
@@ -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
index 43c135e..30d5433 100644 (file)
@@ -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"
@@ -194,7 +194,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);
index a7c8cbb..a544a59 100644 (file)
@@ -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';
 }
diff --git a/src/jansson.def b/src/jansson.def
new file mode 100644 (file)
index 0000000..6b2c8a7
--- /dev/null
@@ -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
+
index 655f136..966ceeb 100644 (file)
@@ -22,10 +22,10 @@ extern "C" {
 
 #define JANSSON_MAJOR_VERSION  2
 #define JANSSON_MINOR_VERSION  3
-#define JANSSON_MICRO_VERSION  1
+#define JANSSON_MICRO_VERSION  99
 
 /* Micro version is omitted if it's 0 */
-#define JANSSON_VERSION  "2.3.1"
+#define JANSSON_VERSION  "2.4-dev"
 
 /* Version as a 3-byte hex number, e.g. 0x010201 == 1.2.1. Use this
    for numeric comparisons, e.g. #if JANSSON_VERSION_HEX >= ... */
@@ -232,10 +232,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 */
index bd11e87..7d6d09d 100644 (file)
@@ -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
index 9ad4752..d88a704 100644 (file)
@@ -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;
+}
index b2f529d..543ecc4 100644 (file)
@@ -9,7 +9,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include <jansson.h>
+#include "jansson.h"
 #include "jansson_private.h"
 
 /* memory function pointers */
index 7a6d81d..39db9b8 100644 (file)
@@ -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;
index 70d03ca..8d05d91 100644 (file)
@@ -11,7 +11,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include <jansson.h>
+#include "jansson.h"
 #include "hashtable.h"
 #include "jansson_private.h"
 #include "utf.h"
@@ -779,7 +779,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
index 7b7203d..ae6c8f9 100644 (file)
@@ -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
index 61a216f..9e60f48 100644 (file)
@@ -8,6 +8,7 @@ check_PROGRAMS = \
        test_equal \
        test_load \
        test_loadb \
+       test_load_callback \
        test_memory_funcs \
        test_number \
        test_object \
index a7c87a9..eb2d83e 100755 (executable)
@@ -1,98 +1,17 @@
 #!/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
 
diff --git a/test/suites/api/test_load_callback.c b/test/suites/api/test_load_callback.c
new file mode 100644 (file)
index 0000000..9449528
--- /dev/null
@@ -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");
+    }
+}
similarity index 97%
rename from src/jansson_config.h.win32
rename to win32/jansson_config.h
index da5d0e9..fc8e5ea 100644 (file)
@@ -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()
diff --git a/win32/vs2010/jansson.sln b/win32/vs2010/jansson.sln
new file mode 100644 (file)
index 0000000..58f911b
--- /dev/null
@@ -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
diff --git a/win32/vs2010/jansson.vcxproj b/win32/vs2010/jansson.vcxproj
new file mode 100644 (file)
index 0000000..d5b2a87
--- /dev/null
@@ -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>
\ No newline at end of file
diff --git a/win32/vs2010/jansson.vcxproj.filters b/win32/vs2010/jansson.vcxproj.filters
new file mode 100644 (file)
index 0000000..f8eee30
--- /dev/null
@@ -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>
\ No newline at end of file
diff --git a/win32/vs2010/jansson.vcxproj.user b/win32/vs2010/jansson.vcxproj.user
new file mode 100644 (file)
index 0000000..ace9a86
--- /dev/null
@@ -0,0 +1,3 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+</Project>
\ No newline at end of file