com php-src: make xml_utf8_ encode/decode work with size_t: ext/xml/php_xml.h ext/xml/xml.c
| From: | Anatol Belski | Date: | Sun, 14 Sep 2014 19:38:46 +0000 |
| Subject: | com php-src: make xml_utf8_ encode/decode work with size_t: ext/xml/php_xml.h ext/xml/xml.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-81609@lists.php.net to get a copy of this message | ||
Commit: a7482fd2bf340e03b5c5c5ac4f94aacdabccb1ce
Author: Anatol Belski <ab@php.net> Sun, 14 Sep 2014 21:38:46 +0200
Parents: 90972355b3d23e8c099e119cb7b2e0fbb463beab
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=a7482fd2bf340e03b5c5c5ac4f94aacdabccb1ce
Log:
make xml_utf8_ encode/decode work with size_t
Changed paths:
M ext/xml/php_xml.h
M ext/xml/xml.c
Diff:
diff --git a/ext/xml/php_xml.h b/ext/xml/php_xml.h
index 0195bb5..35e61b5 100644
--- a/ext/xml/php_xml.h
+++ b/ext/xml/php_xml.h
@@ -134,8 +134,8 @@ PHP_FUNCTION(utf8_decode);
PHP_FUNCTION(xml_parse_into_struct);
PHPAPI char *_xml_zval_strdup(zval *);
-PHPAPI zend_string *xml_utf8_decode(const XML_Char *, int, const XML_Char *);
-PHPAPI zend_string *xml_utf8_encode(const char *, int, const XML_Char *);
+PHPAPI zend_string *xml_utf8_decode(const XML_Char *, size_t, const XML_Char *);
+PHPAPI zend_string *xml_utf8_encode(const char *, size_t, const XML_Char *);
#endif /* HAVE_LIBEXPAT */
diff --git a/ext/xml/xml.c b/ext/xml/xml.c
index 2ad53e7..ee2d7da 100644
--- a/ext/xml/xml.c
+++ b/ext/xml/xml.c
@@ -554,9 +554,9 @@ static xml_encoding *xml_get_encoding(const XML_Char *name)
/* }}} */
/* {{{ xml_utf8_encode() */
-PHPAPI zend_string *xml_utf8_encode(const char *s, int len, const XML_Char *encoding)
+PHPAPI zend_string *xml_utf8_encode(const char *s, size_t len, const XML_Char *encoding)
{
- int pos = len;
+ size_t pos = len;
zend_string *str;
unsigned int c;
unsigned short (*encoder)(unsigned char) = NULL;
@@ -605,7 +605,7 @@ PHPAPI zend_string *xml_utf8_encode(const char *s, int len, const XML_Char *enco
/* }}} */
/* {{{ xml_utf8_decode() */
-PHPAPI zend_string *xml_utf8_decode(const XML_Char *s, int len, const XML_Char *encoding)
+PHPAPI zend_string *xml_utf8_decode(const XML_Char *s, size_t len, const XML_Char *encoding)
{
size_t pos = 0;
unsigned int c;
@@ -627,7 +627,7 @@ PHPAPI zend_string *xml_utf8_decode(const XML_Char *s, int len, const XML_Char *
str = zend_string_alloc(len, 0);
str->len = 0;
- while (pos < (size_t)len) {
+ while (pos < len) {
int status = FAILURE;
c = php_next_utf8_char((const unsigned char*)s, (size_t) len, &pos, &status);