From 3ffecac9163826f7160660996ee77d3dc54f8fa0 Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Fri, 29 Nov 2013 11:47:48 +0100 Subject: basic fixes for ext/json --- ext/json/JSON_parser.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ext/json/JSON_parser.c') diff --git a/ext/json/JSON_parser.c b/ext/json/JSON_parser.c index dd832a7cbd..b95629e825 100644 --- a/ext/json/JSON_parser.c +++ b/ext/json/JSON_parser.c @@ -328,7 +328,7 @@ static void json_create_zval(zval **z, smart_str *buf, int type, int options) } } - ZVAL_LONG(*z, strtol(buf->c, NULL, 10)); + ZVAL_LONG(*z, ZEND_STRTOL(buf->c, NULL, 10)); } else if (type == IS_DOUBLE) { @@ -436,7 +436,7 @@ static void attach_zval(JSON_parser jp, int up, int cur, smart_str *key, int ass machine with a stack. */ int -parse_JSON_ex(JSON_parser jp, zval *z, unsigned short utf16_json[], int length, int options TSRMLS_DC) +parse_JSON_ex(JSON_parser jp, zval *z, unsigned short utf16_json[], zend_str_size_int length, int options TSRMLS_DC) { int next_char; /* the next character */ int next_class; /* the next character class */ -- cgit v1.2.1 From 23019318b1e92ef324dde2d5655103064a8ab93c Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Fri, 29 Nov 2013 13:00:29 +0100 Subject: finer fixes for ext/json --- ext/json/JSON_parser.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'ext/json/JSON_parser.c') diff --git a/ext/json/JSON_parser.c b/ext/json/JSON_parser.c index b95629e825..823b1b8b60 100644 --- a/ext/json/JSON_parser.c +++ b/ext/json/JSON_parser.c @@ -239,7 +239,7 @@ pop(JSON_parser jp, int mode) JSON_checker_char will delete the JSON_checker object if it sees an error. */ JSON_parser -new_JSON_parser(int depth) +new_JSON_parser(php_int_t depth) { JSON_parser jp = (JSON_parser)emalloc(sizeof(struct JSON_parser_struct)); jp->state = GO; @@ -291,7 +291,7 @@ static int dehexchar(char c) } -static void json_create_zval(zval **z, smart_str *buf, int type, int options) +static void json_create_zval(zval **z, smart_str *buf, int type, php_int_t options) { ALLOC_INIT_ZVAL(*z); @@ -418,7 +418,7 @@ static void attach_zval(JSON_parser jp, int up, int cur, smart_str *key, int ass #define FREE_BUFFERS() smart_str_free(&buf); smart_str_free(&key); #define SWAP_BUFFERS(from, to) do { \ char *t1 = from.c; \ - int t2 = from.a; \ + zend_str_size_int t2 = from.a; \ from.c = to.c; \ from.a = to.a; \ to.c = t1; \ @@ -436,7 +436,7 @@ static void attach_zval(JSON_parser jp, int up, int cur, smart_str *key, int ass machine with a stack. */ int -parse_JSON_ex(JSON_parser jp, zval *z, unsigned short utf16_json[], zend_str_size_int length, int options TSRMLS_DC) +parse_JSON_ex(JSON_parser jp, zval *z, unsigned short utf16_json[], zend_str_size_int length, php_int_t options TSRMLS_DC) { int next_char; /* the next character */ int next_class; /* the next character class */ -- cgit v1.2.1 From b1abe4ca21e10b04a8bae2d00e8113f4b2b02567 Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Wed, 18 Dec 2013 14:46:44 -0800 Subject: mass replacement for zend_size_t/php_size_t --- ext/json/JSON_parser.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ext/json/JSON_parser.c') diff --git a/ext/json/JSON_parser.c b/ext/json/JSON_parser.c index 823b1b8b60..a619b33c27 100644 --- a/ext/json/JSON_parser.c +++ b/ext/json/JSON_parser.c @@ -418,7 +418,7 @@ static void attach_zval(JSON_parser jp, int up, int cur, smart_str *key, int ass #define FREE_BUFFERS() smart_str_free(&buf); smart_str_free(&key); #define SWAP_BUFFERS(from, to) do { \ char *t1 = from.c; \ - zend_str_size_int t2 = from.a; \ + php_size_t t2 = from.a; \ from.c = to.c; \ from.a = to.a; \ to.c = t1; \ @@ -436,7 +436,7 @@ static void attach_zval(JSON_parser jp, int up, int cur, smart_str *key, int ass machine with a stack. */ int -parse_JSON_ex(JSON_parser jp, zval *z, unsigned short utf16_json[], zend_str_size_int length, php_int_t options TSRMLS_DC) +parse_JSON_ex(JSON_parser jp, zval *z, unsigned short utf16_json[], php_size_t length, php_int_t options TSRMLS_DC) { int next_char; /* the next character */ int next_class; /* the next character class */ -- cgit v1.2.1 From f58d0b35edf25a8f39fad6bd5e0e4eeb5cdfe9a7 Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Thu, 19 Dec 2013 05:07:37 -0800 Subject: massive update semantical LONG vs INT replacements --- ext/json/JSON_parser.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'ext/json/JSON_parser.c') diff --git a/ext/json/JSON_parser.c b/ext/json/JSON_parser.c index a619b33c27..28d5f8fe5a 100644 --- a/ext/json/JSON_parser.c +++ b/ext/json/JSON_parser.c @@ -295,7 +295,7 @@ static void json_create_zval(zval **z, smart_str *buf, int type, php_int_t optio { ALLOC_INIT_ZVAL(*z); - if (type == IS_LONG) + if (type == IS_INT) { zend_bool bigint = 0; @@ -303,8 +303,8 @@ static void json_create_zval(zval **z, smart_str *buf, int type, php_int_t optio buf->len--; } - if (buf->len >= MAX_LENGTH_OF_LONG - 1) { - if (buf->len == MAX_LENGTH_OF_LONG - 1) { + if (buf->len >= MAX_LENGTH_OF_ZEND_INT - 1) { + if (buf->len == MAX_LENGTH_OF_ZEND_INT - 1) { int cmp = strcmp(buf->c + (buf->c[0] == '-'), long_min_digits); if (!(cmp < 0 || (cmp == 0 && buf->c[0] == '-'))) { @@ -328,7 +328,7 @@ static void json_create_zval(zval **z, smart_str *buf, int type, php_int_t optio } } - ZVAL_LONG(*z, ZEND_STRTOL(buf->c, NULL, 10)); + ZVAL_INT(*z, ZEND_STRTOL(buf->c, NULL, 10)); } else if (type == IS_DOUBLE) { @@ -508,10 +508,10 @@ parse_JSON_ex(JSON_parser jp, zval *z, unsigned short utf16_json[], php_size_t l utf16 += dehexchar(next_char); utf16_to_utf8(&buf, utf16); } - } else if (type < IS_LONG && (next_class == C_DIGIT || next_class == C_ZERO)) { - type = IS_LONG; + } else if (type < IS_INT && (next_class == C_DIGIT || next_class == C_ZERO)) { + type = IS_INT; smart_str_appendc(&buf, next_char); - } else if (type == IS_LONG && next_state == E1) { + } else if (type == IS_INT && next_state == E1) { type = IS_DOUBLE; smart_str_appendc(&buf, next_char); } else if (type < IS_DOUBLE && next_class == C_POINT) { -- cgit v1.2.1 From f2fc935502b110b7a706d1641c000a9e9500315b Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Thu, 19 Dec 2013 23:28:52 -0800 Subject: next wave on semantical replacements long vs. int --- ext/json/JSON_parser.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ext/json/JSON_parser.c') diff --git a/ext/json/JSON_parser.c b/ext/json/JSON_parser.c index 28d5f8fe5a..acc5e8d115 100644 --- a/ext/json/JSON_parser.c +++ b/ext/json/JSON_parser.c @@ -305,7 +305,7 @@ static void json_create_zval(zval **z, smart_str *buf, int type, php_int_t optio if (buf->len >= MAX_LENGTH_OF_ZEND_INT - 1) { if (buf->len == MAX_LENGTH_OF_ZEND_INT - 1) { - int cmp = strcmp(buf->c + (buf->c[0] == '-'), long_min_digits); + int cmp = strcmp(buf->c + (buf->c[0] == '-'), int_min_digits); if (!(cmp < 0 || (cmp == 0 && buf->c[0] == '-'))) { bigint = 1; -- cgit v1.2.1 From d5c924750b97aa034e8223f4c7b8005844512548 Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Sun, 9 Feb 2014 10:55:52 +0100 Subject: replace *_STRTOL with STRTOI, etc. --- ext/json/JSON_parser.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ext/json/JSON_parser.c') diff --git a/ext/json/JSON_parser.c b/ext/json/JSON_parser.c index acc5e8d115..2a8ee9dde0 100644 --- a/ext/json/JSON_parser.c +++ b/ext/json/JSON_parser.c @@ -328,7 +328,7 @@ static void json_create_zval(zval **z, smart_str *buf, int type, php_int_t optio } } - ZVAL_INT(*z, ZEND_STRTOL(buf->c, NULL, 10)); + ZVAL_INT(*z, ZEND_STRTOI(buf->c, NULL, 10)); } else if (type == IS_DOUBLE) { -- cgit v1.2.1 From 63d3f0b844b3a5f1c94be3c97bca29235dc2b3fc Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Tue, 19 Aug 2014 08:07:31 +0200 Subject: basic macro replacements, all at once --- ext/json/JSON_parser.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'ext/json/JSON_parser.c') diff --git a/ext/json/JSON_parser.c b/ext/json/JSON_parser.c index 116fc0c9b6..a4e34b07bc 100644 --- a/ext/json/JSON_parser.c +++ b/ext/json/JSON_parser.c @@ -293,7 +293,7 @@ static int dehexchar(char c) static void json_create_zval(zval *z, smart_str *buf, int type, int options TSRMLS_DC) { - if (type == IS_LONG) + if (type == IS_INT) { zend_bool bigint = 0; @@ -301,9 +301,9 @@ static void json_create_zval(zval *z, smart_str *buf, int type, int options TSRM buf->s->len--; } - if (buf->s->len >= MAX_LENGTH_OF_LONG - 1) { - if (buf->s->len == MAX_LENGTH_OF_LONG - 1) { - int cmp = strcmp(buf->s->val + (buf->s->val[0] == '-'), long_min_digits); + if (buf->s->len >= MAX_LENGTH_OF_ZEND_INT - 1) { + if (buf->s->len == MAX_LENGTH_OF_ZEND_INT - 1) { + int cmp = strcmp(buf->s->val + (buf->s->val[0] == '-'), int_min_digits); if (!(cmp < 0 || (cmp == 0 && buf->s->val[0] == '-'))) { bigint = 1; @@ -326,7 +326,7 @@ static void json_create_zval(zval *z, smart_str *buf, int type, int options TSRM } } - ZVAL_LONG(z, strtol(buf->s->val, NULL, 10)); + ZVAL_INT(z, strtol(buf->s->val, NULL, 10)); } else if (type == IS_DOUBLE) { @@ -516,10 +516,10 @@ parse_JSON_ex(JSON_parser jp, zval *z, unsigned short utf16_json[], int length, utf16 += dehexchar(next_char); utf16_to_utf8(&buf, utf16); } - } else if (type < IS_LONG && (next_class == C_DIGIT || next_class == C_ZERO)) { - type = IS_LONG; + } else if (type < IS_INT && (next_class == C_DIGIT || next_class == C_ZERO)) { + type = IS_INT; smart_str_appendc(&buf, next_char); - } else if (type == IS_LONG && next_state == E1) { + } else if (type == IS_INT && next_state == E1) { type = IS_DOUBLE; smart_str_appendc(&buf, next_char); } else if (type < IS_DOUBLE && next_class == C_POINT) { -- cgit v1.2.1 From 19588572258d3c3216e93ee1c9db7e28c6007e20 Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Tue, 19 Aug 2014 20:15:59 +0200 Subject: ported ext/json --- ext/json/JSON_parser.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ext/json/JSON_parser.c') diff --git a/ext/json/JSON_parser.c b/ext/json/JSON_parser.c index a4e34b07bc..f2a1ee4dda 100644 --- a/ext/json/JSON_parser.c +++ b/ext/json/JSON_parser.c @@ -373,7 +373,7 @@ static void utf16_to_utf8(smart_str *buf, unsigned short utf16) && ((unsigned char) buf->s->val[buf->s->len - 1] & 0xc0) == 0x80) { /* found surrogate pair */ - unsigned long utf32; + php_uint_t utf32; utf32 = (((buf->s->val[buf->s->len - 2] & 0xf) << 16) | ((buf->s->val[buf->s->len - 1] & 0x3f) << 10) -- cgit v1.2.1 From c3e3c98ec666812daaaca896cf5ef758a8a6df14 Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Mon, 25 Aug 2014 19:24:55 +0200 Subject: master renames phase 1 --- ext/json/JSON_parser.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'ext/json/JSON_parser.c') diff --git a/ext/json/JSON_parser.c b/ext/json/JSON_parser.c index f2a1ee4dda..a9f1b0a7ae 100644 --- a/ext/json/JSON_parser.c +++ b/ext/json/JSON_parser.c @@ -293,7 +293,7 @@ static int dehexchar(char c) static void json_create_zval(zval *z, smart_str *buf, int type, int options TSRMLS_DC) { - if (type == IS_INT) + if (type == IS_LONG) { zend_bool bigint = 0; @@ -301,9 +301,9 @@ static void json_create_zval(zval *z, smart_str *buf, int type, int options TSRM buf->s->len--; } - if (buf->s->len >= MAX_LENGTH_OF_ZEND_INT - 1) { - if (buf->s->len == MAX_LENGTH_OF_ZEND_INT - 1) { - int cmp = strcmp(buf->s->val + (buf->s->val[0] == '-'), int_min_digits); + if (buf->s->len >= MAX_LENGTH_OF_LONG - 1) { + if (buf->s->len == MAX_LENGTH_OF_LONG - 1) { + int cmp = strcmp(buf->s->val + (buf->s->val[0] == '-'), long_min_digits); if (!(cmp < 0 || (cmp == 0 && buf->s->val[0] == '-'))) { bigint = 1; @@ -326,7 +326,7 @@ static void json_create_zval(zval *z, smart_str *buf, int type, int options TSRM } } - ZVAL_INT(z, strtol(buf->s->val, NULL, 10)); + ZVAL_LONG(z, strtol(buf->s->val, NULL, 10)); } else if (type == IS_DOUBLE) { @@ -373,7 +373,7 @@ static void utf16_to_utf8(smart_str *buf, unsigned short utf16) && ((unsigned char) buf->s->val[buf->s->len - 1] & 0xc0) == 0x80) { /* found surrogate pair */ - php_uint_t utf32; + zend_ulong utf32; utf32 = (((buf->s->val[buf->s->len - 2] & 0xf) << 16) | ((buf->s->val[buf->s->len - 1] & 0x3f) << 10) @@ -516,10 +516,10 @@ parse_JSON_ex(JSON_parser jp, zval *z, unsigned short utf16_json[], int length, utf16 += dehexchar(next_char); utf16_to_utf8(&buf, utf16); } - } else if (type < IS_INT && (next_class == C_DIGIT || next_class == C_ZERO)) { - type = IS_INT; + } else if (type < IS_LONG && (next_class == C_DIGIT || next_class == C_ZERO)) { + type = IS_LONG; smart_str_appendc(&buf, next_char); - } else if (type == IS_INT && next_state == E1) { + } else if (type == IS_LONG && next_state == E1) { type = IS_DOUBLE; smart_str_appendc(&buf, next_char); } else if (type < IS_DOUBLE && next_class == C_POINT) { -- cgit v1.2.1 From 993ae7e9f6df9c565ec5f0b17a8bad3da32470a7 Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Tue, 26 Aug 2014 00:24:38 +0200 Subject: fix strtol call --- ext/json/JSON_parser.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ext/json/JSON_parser.c') diff --git a/ext/json/JSON_parser.c b/ext/json/JSON_parser.c index a9f1b0a7ae..d78ec35a2e 100644 --- a/ext/json/JSON_parser.c +++ b/ext/json/JSON_parser.c @@ -326,7 +326,7 @@ static void json_create_zval(zval *z, smart_str *buf, int type, int options TSRM } } - ZVAL_LONG(z, strtol(buf->s->val, NULL, 10)); + ZVAL_LONG(z, ZEND_STRTOL(buf->s->val, NULL, 10)); } else if (type == IS_DOUBLE) { -- cgit v1.2.1