64-bit build fix for YAJL < 2.0

refs #7454
This commit is contained in:
Gunnar Beutner 2014-10-28 06:33:40 +01:00
parent 66fa686a6f
commit b0179cc1fe
1 changed files with 10 additions and 3 deletions

View File

@ -34,6 +34,12 @@ using namespace icinga;
static void Encode(yajl_gen handle, const Value& value);
#ifdef YAJL_MAJOR < 2
typedef unsigned int yajl_size;
#else /* YAJL_MAJOR */
typedef size_t yajl_size;
#endif /* YAJL_MAJOR */
static void EncodeDictionary(yajl_gen handle, const Dictionary::Ptr& dict)
{
yajl_gen_map_open(handle);
@ -104,7 +110,8 @@ String icinga::JsonEncode(const Value& value)
Encode(handle, value);
const unsigned char *buf;
size_t len;
yajl_size len;
yajl_gen_get_buf(handle, &buf, &len);
String result = String(buf, buf + len);
@ -222,7 +229,7 @@ static int DecodeBoolean(void *ctx, int value)
return 1;
}
static int DecodeNumber(void *ctx, const char *str, size_t len)
static int DecodeNumber(void *ctx, const char *str, yajl_size len)
{
JsonContext *context = static_cast<JsonContext *>(ctx);
@ -237,7 +244,7 @@ static int DecodeNumber(void *ctx, const char *str, size_t len)
return 1;
}
static int DecodeString(void *ctx, const unsigned char *str, size_t len)
static int DecodeString(void *ctx, const unsigned char *str, yajl_size len)
{
JsonContext *context = static_cast<JsonContext *>(ctx);