From: Michael Wallner Date: Thu, 30 Oct 2014 16:26:25 +0000 (+0100) Subject: more explicit constant names X-Git-Tag: RELEASE_2_2_0_RC1~9^2~14 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=d3ccf4a87cda3a4101e2dfb85f620c7e2c401731;p=m6w6%2Fext-http more explicit constant names --- diff --git a/php_http_url.c b/php_http_url.c index 23dec9f..09f94ec 100644 --- a/php_http_url.c +++ b/php_http_url.c @@ -384,7 +384,7 @@ static const char parse_xdigits[] = "0123456789ABCDEF"; static size_t parse_mb(php_http_url_t *url, parse_mb_what_t what, const char *ptr, const char *end, const char *begin, zend_bool silent) { size_t consumed = 0; - zend_bool idn = (what == PARSE_HOSTINFO) && (url->flags & PHP_HTTP_URL_PARSE_IDN); + zend_bool idn = (what == PARSE_HOSTINFO) && (url->flags & PHP_HTTP_URL_PARSE_TOIDN); if (url->flags & PHP_HTTP_URL_PARSE_MBUTF8) { consumed = parse_mb_utf8(url, ptr, end, idn); @@ -396,7 +396,7 @@ static size_t parse_mb(php_http_url_t *url, parse_mb_what_t what, const char *pt #endif if (consumed) { - if (!(url->flags & PHP_HTTP_URL_PARSE_PCTENC) || what == PARSE_HOSTINFO || what == PARSE_SCHEME) { + if (!(url->flags & PHP_HTTP_URL_PARSE_TOPCT) || what == PARSE_HOSTINFO || what == PARSE_SCHEME) { PHP_HTTP_DUFF(consumed, url->buffer[url->offset++] = *ptr++); } else { int i = 0; @@ -596,7 +596,7 @@ static STATUS parse_hostinfo(php_http_url_t *url, const char *ptr) } #ifdef PHP_HTTP_HAVE_IDN - if (url->flags & PHP_HTTP_URL_PARSE_IDN) { + if (url->flags & PHP_HTTP_URL_PARSE_TOIDN) { char *idn = NULL; int rv = -1; @@ -1209,9 +1209,9 @@ PHP_MINIT_FUNCTION(http_url) #endif zend_declare_class_constant_long(php_http_url_class_entry, ZEND_STRL("PARSE_MBUTF8"), PHP_HTTP_URL_PARSE_MBUTF8 TSRMLS_CC); #ifdef PHP_HTTP_HAVE_IDN - zend_declare_class_constant_long(php_http_url_class_entry, ZEND_STRL("PARSE_IDN"), PHP_HTTP_URL_PARSE_IDN TSRMLS_CC); + zend_declare_class_constant_long(php_http_url_class_entry, ZEND_STRL("PARSE_TOIDN"), PHP_HTTP_URL_PARSE_TOIDN TSRMLS_CC); #endif - zend_declare_class_constant_long(php_http_url_class_entry, ZEND_STRL("PARSE_PCTENC"), PHP_HTTP_URL_PARSE_PCTENC TSRMLS_CC); + zend_declare_class_constant_long(php_http_url_class_entry, ZEND_STRL("PARSE_TOPCT"), PHP_HTTP_URL_PARSE_TOPCT TSRMLS_CC); return SUCCESS; } diff --git a/php_http_url.h b/php_http_url.h index 3c2ff76..eaecdfa 100644 --- a/php_http_url.h +++ b/php_http_url.h @@ -45,9 +45,9 @@ typedef struct php_http_url_part { /* parse utf8 multibyte sequences */ #define PHP_HTTP_URL_PARSE_MBUTF8 0x002 /* convert multibyte hostnames to IDNA */ -#define PHP_HTTP_URL_PARSE_IDN 0x010 +#define PHP_HTTP_URL_PARSE_TOIDN 0x010 /* percent encode multibyte sequences in userinfo, path, query and fragment */ -#define PHP_HTTP_URL_PARSE_PCTENC 0x020 +#define PHP_HTTP_URL_PARSE_TOPCT 0x020 typedef struct php_http_url { /* compatible to php_url, but do not use php_url_free() */ diff --git a/tests/urlparser006.phpt b/tests/urlparser006.phpt index c35a20f..72ee358 100644 --- a/tests/urlparser006.phpt +++ b/tests/urlparser006.phpt @@ -4,9 +4,9 @@ url parser multibyte/locale/idna --FILE-- @@ -21,7 +21,7 @@ $urls = array( foreach ($urls as $url) { printf("\n%s\n", $url); - var_dump(http\Url::parse($url, http\Url::PARSE_MBLOC|http\Url::PARSE_IDN)); + var_dump(http\Url::parse($url, http\Url::PARSE_MBLOC|http\Url::PARSE_TOIDN)); } ?> DONE diff --git a/tests/urlparser007.phpt b/tests/urlparser007.phpt index 702302b..518bb72 100644 --- a/tests/urlparser007.phpt +++ b/tests/urlparser007.phpt @@ -3,8 +3,8 @@ url parser multibyte/utf-8/idna --SKIPIF-- --FILE-- @@ -19,7 +19,7 @@ $urls = array( foreach ($urls as $url) { printf("\n%s\n", $url); - var_dump(http\Url::parse($url, http\Url::PARSE_MBUTF8|http\Url::PARSE_IDN)); + var_dump(http\Url::parse($url, http\Url::PARSE_MBUTF8|http\Url::PARSE_TOIDN)); } ?> DONE