summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLloyd Hilaiel <lloyd@hilaiel.com>2011-04-25 11:16:15 -0700
committerLloyd Hilaiel <lloyd@hilaiel.com>2011-04-25 11:16:15 -0700
commit18e45d1e52e7cd7a4e948b74ae30057ab5d960fe (patch)
tree010ff8a59f073fdeee2a53a6ded3b728a901cc05 /src
parent8b203acbff93612f2e504a9e725ad8a995eaeffc (diff)
downloadyajl-18e45d1e52e7cd7a4e948b74ae30057ab5d960fe.tar.gz
compiling cleanly on winblows
Diffstat (limited to 'src')
-rw-r--r--src/api/yajl_tree.h2
-rw-r--r--src/yajl_tree.c24
2 files changed, 13 insertions, 13 deletions
diff --git a/src/api/yajl_tree.h b/src/api/yajl_tree.h
index a02c531..8b377f6 100644
--- a/src/api/yajl_tree.h
+++ b/src/api/yajl_tree.h
@@ -72,12 +72,12 @@ struct yajl_val_s
{
char * string;
struct {
- char *r; /*< unparsed number in string form. */
long long i; /*< integer value, if representable. */
double d; /*< double value, if representable. */
/** Signals whether the \em i and \em d members are
* valid. See \c YAJL_NUMBER_INT_VALID and
* \c YAJL_NUMBER_DOUBLE_VALID. */
+ char *r; /*< unparsed number in string form. */
unsigned int flags;
} number;
struct {
diff --git a/src/yajl_tree.c b/src/yajl_tree.c
index e05e41b..17bb7af 100644
--- a/src/yajl_tree.c
+++ b/src/yajl_tree.c
@@ -25,6 +25,10 @@
#include "yajl_parser.h"
+#if WIN32
+#define snprintf sprintf_s
+#endif
+
#define STATUS_CONTINUE 1
#define STATUS_ABORT 0
@@ -46,11 +50,11 @@ struct context_s
};
typedef struct context_s context_t;
-#define RETURN_ERROR(ctx,retval,...) do { \
+#define RETURN_ERROR(ctx,retval,...) { \
if ((ctx)->errbuf != NULL) \
snprintf ((ctx)->errbuf, (ctx)->errbuf_size, __VA_ARGS__); \
return (retval); \
- } while (0) \
+ }
static yajl_val value_alloc (yajl_type type)
{
@@ -78,7 +82,7 @@ static void yajl_object_free (yajl_val v)
v->u.object.values[i] = NULL;
}
- free(v->u.object.keys);
+ free((void*) v->u.object.keys);
free(v->u.object.values);
free(v);
}
@@ -160,7 +164,7 @@ static int object_add_keyval(context_t *ctx,
/* We're assuring that "obj" is an object in "context_add_value". */
assert(YAJL_IS_OBJECT(obj));
- tmpk = realloc(obj->u.object.keys, sizeof(*(obj->u.object.keys)) * (obj->u.object.len + 1));
+ tmpk = realloc((void *) obj->u.object.keys, sizeof(*(obj->u.object.keys)) * (obj->u.object.len + 1));
if (tmpk == NULL)
RETURN_ERROR(ctx, ENOMEM, "Out of memory");
obj->u.object.keys = tmpk;
@@ -415,16 +419,12 @@ yajl_val yajl_tree_parse (const char *input,
/* end array = */ handle_end_array
};
- context_t ctx =
- {
- /* key = */ NULL,
- /* stack = */ NULL,
- /* errbuf = */ error_buffer,
- /* errbuf_size = */ error_buffer_size
- };
-
yajl_handle handle;
yajl_status status;
+ context_t ctx = { NULL, NULL, NULL, 0 };
+
+ ctx.errbuf = error_buffer;
+ ctx.errbuf_size = error_buffer_size;
if (error_buffer != NULL)
memset (error_buffer, 0, error_buffer_size);