{
int stack_size;
char *prediction;
- int pred_index;
+ size_t pred_index;
/* these two are indexed by lex_level */
char **fnames;
bool *fnull;
static inline JsonParseErrorType json_lex_string(JsonLexContext *lex);
static inline JsonParseErrorType json_lex_number(JsonLexContext *lex, char *s,
- bool *num_err, int *total_len);
+ bool *num_err, size_t *total_len);
static inline JsonParseErrorType parse_scalar(JsonLexContext *lex, JsonSemAction *sem);
static JsonParseErrorType parse_object_field(JsonLexContext *lex, JsonSemAction *sem);
static JsonParseErrorType parse_object(JsonLexContext *lex, JsonSemAction *sem);
* str is of length len, and need not be null-terminated.
*/
bool
-IsValidJsonNumber(const char *str, int len)
+IsValidJsonNumber(const char *str, size_t len)
{
bool numeric_error;
- int total_len;
+ size_t total_len;
JsonLexContext dummy_lex;
if (len <= 0)
*/
JsonLexContext *
makeJsonLexContextCstringLen(JsonLexContext *lex, char *json,
- int len, int encoding, bool need_escapes)
+ size_t len, int encoding, bool need_escapes)
{
if (lex == NULL)
{
pg_parse_json_incremental(JsonLexContext *lex,
JsonSemAction *sem,
char *json,
- int len,
+ size_t len,
bool is_last)
{
JsonTokenType tok;
}
else
{
- int tlen = (lex->token_terminator - lex->token_start);
+ ptrdiff_t tlen = (lex->token_terminator - lex->token_start);
pstack->scalar_val = palloc(tlen + 1);
memcpy(pstack->scalar_val, lex->token_start, tlen);
* recursive call
*/
StringInfo ptok = &(lex->inc_state->partial_token);
- int added = 0;
+ size_t added = 0;
bool tok_done = false;
JsonLexContext dummy_lex;
JsonParseErrorType partial_result;
break;
}
- for (int i = 0; i < lex->input_length; i++)
+ for (size_t i = 0; i < lex->input_length; i++)
{
char c = lex->input[i];
bool numend = false;
- for (int i = 0; i < lex->input_length && !numend; i++)
+ for (size_t i = 0; i < lex->input_length && !numend; i++)
{
char cc = lex->input[i];
* {null, false, true} literals as well as any trailing
* alphanumeric junk on non-string tokens.
*/
- for (int i = added; i < lex->input_length; i++)
+ for (size_t i = added; i < lex->input_length; i++)
{
char cc = lex->input[i];
*/
static inline JsonParseErrorType
json_lex_number(JsonLexContext *lex, char *s,
- bool *num_err, int *total_len)
+ bool *num_err, size_t *total_len)
{
bool error = false;
int len = s - lex->input;
typedef struct JsonLexContext
{
char *input;
- int input_length;
+ size_t input_length;
int input_encoding;
char *token_start;
char *token_terminator;
extern JsonParseErrorType pg_parse_json_incremental(JsonLexContext *lex,
JsonSemAction *sem,
char *json,
- int len,
+ size_t len,
bool is_last);
/* the null action object used for pure validation */
*/
extern JsonLexContext *makeJsonLexContextCstringLen(JsonLexContext *lex,
char *json,
- int len,
+ size_t len,
int encoding,
bool need_escapes);
*
* str argument does not need to be nul-terminated.
*/
-extern bool IsValidJsonNumber(const char *str, int len);
+extern bool IsValidJsonNumber(const char *str, size_t len);
#endif /* JSONAPI_H */
char *buffer, size_t size);
extern JsonManifestParseIncrementalState *json_parse_manifest_incremental_init(JsonManifestParseContext *context);
extern void json_parse_manifest_incremental_chunk(
- JsonManifestParseIncrementalState *incstate, char *chunk, int size,
+ JsonManifestParseIncrementalState *incstate, char *chunk, size_t size,
bool is_last);
extern void json_parse_manifest_incremental_shutdown(JsonManifestParseIncrementalState *incstate);