Support building on Windows

Jansson now builds correctly with Visual C++ Express 2010.
This commit is contained in:
Petri Lehtinen
2012-04-29 22:09:29 +03:00
parent 4601bf71e5
commit ff0c05b8f1
12 changed files with 99 additions and 102 deletions

View 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 _WIN32
#define json_strtoint _strtoi64
#else
#define json_strtoint strtoll
#endif
#else
#define json_strtoint strtol
#endif