diff options
| author | Lloyd Hilaiel <lloyd@hilaiel.com> | 2009-01-17 08:48:48 -0700 |
|---|---|---|
| committer | Lloyd Hilaiel <lloyd@hilaiel.com> | 2009-01-17 08:48:48 -0700 |
| commit | 2d0df50e483f7767a6434bd60ecb880a5951e1a0 (patch) | |
| tree | 0c245a1d582d0606294020e4c5fea70d0d7f94c8 | |
| parent | 7240b28d6eae179d02c40ff1a1a17588b4836a72 (diff) | |
| download | yajl-2d0df50e483f7767a6434bd60ecb880a5951e1a0.tar.gz | |
integrate patches from Robert Varga to eliminate build warnings on 64bit linux w/ gcc 4.3.2 - test suite still needs a bit of fixing to handle 64bit platforms where long is 64 bit.
| -rw-r--r-- | reformatter/json_reformat.c | 22 | ||||
| -rw-r--r-- | src/yajl_encode.c | 2 | ||||
| -rw-r--r-- | src/yajl_gen.c | 6 | ||||
| -rw-r--r-- | src/yajl_lex.c | 11 | ||||
| -rw-r--r-- | src/yajl_parser.c | 12 |
5 files changed, 26 insertions, 27 deletions
diff --git a/reformatter/json_reformat.c b/reformatter/json_reformat.c index b630bc9..01a30c0 100644 --- a/reformatter/json_reformat.c +++ b/reformatter/json_reformat.c @@ -37,44 +37,44 @@ #include <stdlib.h> #include <string.h> -int reformat_null(void * ctx) +static int reformat_null(void * ctx) { yajl_gen g = (yajl_gen) ctx; yajl_gen_null(g); return 1; } -int reformat_boolean(void * ctx, int boolean) +static int reformat_boolean(void * ctx, int boolean) { yajl_gen g = (yajl_gen) ctx; yajl_gen_bool(g, boolean); return 1; } -int reformat_number(void * ctx, const char * s, unsigned int l) +static int reformat_number(void * ctx, const char * s, unsigned int l) { yajl_gen g = (yajl_gen) ctx; yajl_gen_number(g, s, l); return 1; } -int reformat_string(void * ctx, const unsigned char * stringVal, - unsigned int stringLen) +static int reformat_string(void * ctx, const unsigned char * stringVal, + unsigned int stringLen) { yajl_gen g = (yajl_gen) ctx; yajl_gen_string(g, stringVal, stringLen); return 1; } -int reformat_map_key(void * ctx, const unsigned char * stringVal, - unsigned int stringLen) +static int reformat_map_key(void * ctx, const unsigned char * stringVal, + unsigned int stringLen) { yajl_gen g = (yajl_gen) ctx; yajl_gen_string(g, stringVal, stringLen); return 1; } -int reformat_start_map(void * ctx) +static int reformat_start_map(void * ctx) { yajl_gen g = (yajl_gen) ctx; yajl_gen_map_open(g); @@ -82,21 +82,21 @@ int reformat_start_map(void * ctx) } -int reformat_end_map(void * ctx) +static int reformat_end_map(void * ctx) { yajl_gen g = (yajl_gen) ctx; yajl_gen_map_close(g); return 1; } -int reformat_start_array(void * ctx) +static int reformat_start_array(void * ctx) { yajl_gen g = (yajl_gen) ctx; yajl_gen_array_open(g); return 1; } -int reformat_end_array(void * ctx) +static int reformat_end_array(void * ctx) { yajl_gen g = (yajl_gen) ctx; yajl_gen_array_close(g); diff --git a/src/yajl_encode.c b/src/yajl_encode.c index 6804b54..0449225 100644 --- a/src/yajl_encode.c +++ b/src/yajl_encode.c @@ -55,7 +55,7 @@ yajl_string_encode(yajl_buf buf, const unsigned char * str, hexBuf[6] = 0; while (end < len) { - char * escaped = NULL; + const char * escaped = NULL; switch (str[end]) { case '\r': escaped = "\\r"; break; case '\n': escaped = "\\n"; break; diff --git a/src/yajl_gen.c b/src/yajl_gen.c index ffc2bf6..67740ec 100644 --- a/src/yajl_gen.c +++ b/src/yajl_gen.c @@ -88,11 +88,11 @@ yajl_gen_free(yajl_gen g) if (g->pretty) yajl_buf_append(g->buf, " ", 1); \ } -#define INSERT_WHITESPACE \ +#define INSERT_WHITESPACE \ if (g->pretty) { \ if (g->state[g->depth] != yajl_gen_map_val) { \ - unsigned int i; \ - for (i=0;i<g->depth;i++) \ + unsigned int _i; \ + for (_i=0;_i<g->depth;_i++) \ yajl_buf_append(g->buf, g->indentString, \ strlen(g->indentString)); \ } \ diff --git a/src/yajl_lex.c b/src/yajl_lex.c index 3fdb1cb..3a54e93 100644 --- a/src/yajl_lex.c +++ b/src/yajl_lex.c @@ -113,7 +113,8 @@ readChar(yajl_lexer lxr, const unsigned char * txt, unsigned int *off) if (lxr->bufInUse && yajl_buf_len(lxr->buf) && lxr->bufOff < yajl_buf_len(lxr->buf)) { - return *((unsigned char *) yajl_buf_data(lxr->buf) + (lxr->bufOff)++); + return *((const unsigned char *) yajl_buf_data(lxr->buf) + + (lxr->bufOff)++); } return txt[(*off)++]; } @@ -153,7 +154,7 @@ yajl_lex_free(yajl_lexer lxr) #define VEC 1 #define IJC 2 #define VHC 4 -const static char charLookupTable[256] = +static const char charLookupTable[256] = { /*00*/ IJC , IJC , IJC , IJC , IJC , IJC , IJC , IJC , /*08*/ IJC , IJC , IJC , IJC , IJC , IJC , IJC , IJC , @@ -574,7 +575,7 @@ yajl_lex_lex(yajl_lexer lexer, const unsigned char * jsonText, goto lexed; } case '"': { - tok = yajl_lex_string(lexer, (unsigned char *) jsonText, + tok = yajl_lex_string(lexer, (const unsigned char *) jsonText, jsonTextLen, context); goto lexed; } @@ -583,7 +584,7 @@ yajl_lex_lex(yajl_lexer lexer, const unsigned char * jsonText, case '5': case '6': case '7': case '8': case '9': { /* integer parsing wants to start from the beginning */ unreadChar(lexer, context); - tok = yajl_lex_number(lexer, (unsigned char *) jsonText, + tok = yajl_lex_number(lexer, (const unsigned char *) jsonText, jsonTextLen, context); goto lexed; } @@ -602,7 +603,7 @@ yajl_lex_lex(yajl_lexer lexer, const unsigned char * jsonText, * - malformed comment opening (slash not followed by * '*' or '/') (tok_error) * - eof hit. (tok_eof) */ - tok = yajl_lex_comment(lexer, (unsigned char *) jsonText, + tok = yajl_lex_comment(lexer, (const unsigned char *) jsonText, jsonTextLen, context); if (tok == yajl_tok_comment) { /* "error" is silly, but that's the initial diff --git a/src/yajl_parser.c b/src/yajl_parser.c index 2574941..e6bc437 100644 --- a/src/yajl_parser.c +++ b/src/yajl_parser.c @@ -222,15 +222,14 @@ yajl_do_parse(yajl_handle hand, unsigned int * offset, */ if (hand->callbacks) { if (hand->callbacks->yajl_number) { - _CC_CHK(hand->callbacks->yajl_number(hand->ctx, - (char *) buf, - bufLen)); + _CC_CHK(hand->callbacks->yajl_number( + hand->ctx,(const char *) buf, bufLen)); } else if (hand->callbacks->yajl_integer) { long int i = 0; yajl_buf_clear(hand->decodeBuf); yajl_buf_append(hand->decodeBuf, buf, bufLen); buf = yajl_buf_data(hand->decodeBuf); - i = strtol((char *) buf, NULL, 10); + i = strtol((const char *) buf, NULL, 10); if ((i == LONG_MIN || i == LONG_MAX) && errno == ERANGE) { @@ -249,9 +248,8 @@ yajl_do_parse(yajl_handle hand, unsigned int * offset, case yajl_tok_double: if (hand->callbacks) { if (hand->callbacks->yajl_number) { - _CC_CHK(hand->callbacks->yajl_number(hand->ctx, - (char *) buf, - bufLen)); + _CC_CHK(hand->callbacks->yajl_number( + hand->ctx, (const char *) buf, bufLen)); } else if (hand->callbacks->yajl_double) { double d = 0.0; yajl_buf_clear(hand->decodeBuf); |
